+
{{/if}}
From 7a2aa6ae6147e165f192ff40b95969a41c8f227e Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 9 Oct 2023 00:14:05 +0200
Subject: [PATCH 18/38] Code clean up
---
croutonjs/dist/crouton-map.js | 48 +++++++-----------------
croutonjs/src/js/crouton-core.js | 5 ++-
croutonjs/src/js/crouton-localization.js | 18 ++++++++-
croutonjs/src/templates/header.hbs | 4 +-
4 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/croutonjs/dist/crouton-map.js b/croutonjs/dist/crouton-map.js
index 5f26031..fddb29d 100644
--- a/croutonjs/dist/crouton-map.js
+++ b/croutonjs/dist/crouton-map.js
@@ -11,6 +11,7 @@ function CroutonMap(config) {
self.map_clusters = [];
self.oms = null;
self.markerClusterer = null;
+ self.handlebarMapOptions = null;
self.loadGapi = function(callbackFunctionName) {
var tag = document.createElement('script');
tag.src = "https://maps.googleapis.com/maps/api/js?key=" + self.config['google_api_key'] + "&callback=" + callbackFunctionName;
@@ -101,10 +102,6 @@ CroutonMap.prototype.mapSearchClickMode = function() {
gestureHandling: 'none'
});
};
-CroutonMap.prototype.reset = function() {
- //self.clearAllMapObjects();
- //self.clearAllMapClusters();
-}
CroutonMap.prototype.mapSearchPanZoomMode = function() {
var self = this;
self.mapClickSearchMode = false;
@@ -137,16 +134,15 @@ CroutonMap.prototype.mapSearchTextMode = function(location) {
}
};
-Crouton.prototype.renderMap = function() {
+CroutonMap.prototype.renderMap = function() {
var self = this;
- jQuery("#bmlt-tabs").before("
");
self.geocoder = new google.maps.Geocoder();
jQuery.when(jQuery.getJSON(self.config['template_path'] + "/themes/" + self.config['theme'] + ".json").then(
function (data, textStatus, jqXHR) {
return self.config["theme_js"] = data["google_map_theme"];
}
)).then(function() {
- self.map = new google.maps.Map(document.getElementById('bmlt-map'), {
+ self.map = new google.maps.Map(document.getElementById(self.domElementName), {
zoom: self.config['map_search']['zoom'] || 10,
center: {
lat: self.config['map_search']['latitude'],
@@ -199,48 +195,34 @@ Crouton.prototype.renderMap = function() {
}
})
};
-CroutonMap.prototype.render = function() {
+CroutonMap.prototype.showMap = function() {
+}
+CroutonMap.prototype.render = function(domElementName) {
+ self = this;
+ self.domElementName = domElementName;
this.loadGapi('croutonMap.renderMap');
}
-CroutonMap.prototype.initialize = function(meetingData, formatsData, handlebarMapOptions=[]) {
+CroutonMap.prototype.initialize = function(domElementName, meetingData, formatsData, handlebarMapOptions=null) {
this.meetingData = meetingData;
this.formatsData = formatsData;
this.handlebarMapOptions = handlebarMapOptions;
+ this.domElementName = domElementName;
this.loadGapi('croutonMap.initMap');
}
-CroutonMap.prototype.embed = function(meetingData, formatsData) {
- this.meetingData = meetingData;
- this.formatsData = formatsData;
- this.loadGapi('croutonMap.mapPage');
-}
CroutonMap.prototype.initMap = function(callback) {
var self = this;
if (self.map == null) {
- jQuery("#bmlt-tabs").before("
");
- var mapOpt = { zoom: 3 };
- if (self.handlebarMapOptions.length > 0) mapOpt = {
+ var mapOpt = { zoom: 3, maxZoom: 17 };
+ if (self.handlebarMapOptions) mapOpt = {
center: new google.maps.LatLng(self.handlebarMapOptions.lat, self.handlebarMapOptions.lng),
zoom: self.handlebarMapOptions.zoom,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
- self.map = new google.maps.Map(document.getElementById('bmlt-map'), mapOpt );
- }
-
- jQuery("#bmlt-map").removeClass("hide");
- self.fillMap(callback);
-}
-CroutonMap.prototype.mapPage = function(callback) {
- var self = this;
- if (self.map == null) {
- self.map = new google.maps.Map(document.getElementById('byfield_embeddedMapPage'), { zoom: 3, maxZoom: 17 } );
+ self.map = new google.maps.Map(document.getElementById(self.domElementName), mapOpt );
}
self.fillMap(callback);
}
-CroutonMap.prototype.fillMap = function(callback, filteredIds=null) {
- if (typeof crouton_external_map !== 'undefined') {
- crouton_external_map.filterFromCrouton(filteredIds);
- return;
- }
+CroutonMap.prototype.fillMap = function(filteredIds=null) {
var self = this;
if (self.map == null) return;
self.clearAllMapObjects();
@@ -370,8 +352,6 @@ CroutonMap.prototype.fillMap = function(callback, filteredIds=null) {
maxZoom: self.config['map_max_zoom'],
zoomOnClick: false
});
-
- if (callback !== undefined && isFunction(callback)) callback();
};
/**
diff --git a/croutonjs/src/js/crouton-core.js b/croutonjs/src/js/crouton-core.js
index a5059e6..93319c2 100644
--- a/croutonjs/src/js/crouton-core.js
+++ b/croutonjs/src/js/crouton-core.js
@@ -278,7 +278,10 @@ function Crouton(config) {
jQuery('.nav-tabs a[href="#tab' + day_id + '"]').tab('show');
self.showPage("#" + day_id);
};
-
+ self.dayTabFromId = function(id) {
+ day_id = self.meetingData.find((m)=>m.id_bigint == id).weekday_tinyint;
+ self.dayTab(day_id);
+ };
self.showPage = function (id) {
jQuery(id).removeClass("hide").addClass("show");
};
diff --git a/croutonjs/src/js/crouton-localization.js b/croutonjs/src/js/crouton-localization.js
index 7396a9e..fe52134 100644
--- a/croutonjs/src/js/crouton-localization.js
+++ b/croutonjs/src/js/crouton-localization.js
@@ -41,7 +41,8 @@ function CroutonLocalization(language) {
"share": "share",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
- 'css-floatdirection': ''
+ 'css-floatdirection': '',
+ 'tabular': "Tabular",
},
"de-DE":{
"days_of_the_week": ["", "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
@@ -79,6 +80,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "Teilen",
+ 'tabular': "Tabularisch",
"no_meetings_for_this_day": "Keine Meetings an diesem Tag.",
'css-textalign': '',
'css-floatdirection': ''
@@ -119,6 +121,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -159,6 +162,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -199,6 +203,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -239,6 +244,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -266,6 +272,7 @@ function CroutonLocalization(language) {
"common_needs": "Common Needs",
"meeting_count": "Weekly Meetings:",
"venue_types": "Venue Types",
+ 'tabular': "Tabular",
"venue_type_choices": {
IN_PERSON: "In Person",
VIRTUAL: "Virtual",
@@ -321,6 +328,7 @@ function CroutonLocalization(language) {
"share": "share",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
+ 'tabular': "Tabular",
'css-floatdirection': ''
},
"fa-IR": {
@@ -359,6 +367,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': 'style="text-align:right;"',
'css-floatdirection': 'style="float:right;"'
@@ -399,6 +408,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -439,6 +449,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "Condividi",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -479,6 +490,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -519,6 +531,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -559,6 +572,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "Compartilhar",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -599,6 +613,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
@@ -639,6 +654,7 @@ function CroutonLocalization(language) {
GS: "Group Support Forum"
},
"share": "share",
+ 'tabular': "Tabular",
"no_meetings_for_this_day": "No meetings for this day.",
'css-textalign': '',
'css-floatdirection': ''
diff --git a/croutonjs/src/templates/header.hbs b/croutonjs/src/templates/header.hbs
index 786c935..34be277 100644
--- a/croutonjs/src/templates/header.hbs
+++ b/croutonjs/src/templates/header.hbs
@@ -10,8 +10,8 @@
{{/each}}
{{#if this.config.map_page}}
-
-
+
+
{{/if}}
{{#if this.config.has_days}}
From b8ffe3d8bfeb64d3d8795c36dcd00d79296e32a9 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 9 Oct 2023 21:50:01 +0200
Subject: [PATCH 19/38] Improve default meeting-details page
---
crouton.php | 12 ++-
partials/default_meeting_details.html | 101 ++++++++++++++------------
2 files changed, 65 insertions(+), 48 deletions(-)
diff --git a/crouton.php b/crouton.php
index a5ac2a4..1deaf22 100644
--- a/crouton.php
+++ b/crouton.php
@@ -366,6 +366,9 @@ public function sharedRender()
public function tabbedUi($atts, $content = null)
{
+ if (isset($_GET['meeting-id'])) {
+ return do_shortcode($this->getDefaultMeetingDetailsPageContents());
+ }
return sprintf('%s
%s
', $this->sharedRender(), $this->renderTable($atts));
}
public function bmltHandlebar($atts, $template = null)
@@ -541,13 +544,17 @@ public function adminMenuLink()
'filterPluginActions'
), 10, 2);
}
+ private function getDefaultMeetingDetailsPageContents()
+ {
+ return file_get_contents(plugin_dir_path(__FILE__) . "partials/default_meeting_details.html");
+ }
public function createMeetingDetailsPage($page, $title = "Meeting Details")
{
$create_message = '';
$meeting_details_id = (strlen($this->options[$page]) > 0) ? url_to_postid($this->options[$page]) : 0;
if (strlen($this->options[$page]) > 0 && $meeting_details_id === 0) {
if (isset($_POST['create_default_page'])) {
- $contents = file_get_contents(plugin_dir_path(__FILE__) . "partials/default_meeting_details.html");
+ $contents = $this->getDefaultMeetingDetailsPageContents();
$slug = basename(parse_url($this->options[$page], PHP_URL_PATH));
$post_details = array(
'post_title' => $title,
@@ -1106,6 +1113,9 @@ public function getCroutonJsConfig($atts)
$params['extra_meetings'] = $extra_meetings_array;
+ if (empty($params['meeting_details_href'])) {
+ $params['meeting_details_href'] = $_SERVER["REQUEST_URI"];
+ }
$params['force_rootserver_in_querystring'] = ($params['root_server'] !== $this->options['root_server']);
$params = apply_filters('crouton_configuration', $params);
$mapParams['theme'] = $params['theme'];
diff --git a/partials/default_meeting_details.html b/partials/default_meeting_details.html
index 7c4a5b7..35c1a96 100644
--- a/partials/default_meeting_details.html
+++ b/partials/default_meeting_details.html
@@ -1,48 +1,55 @@
[bmlt_handlebar]
-
{{this.formatted_day}} {{this.start_time_formatted}} - {{this.end_time_formatted}}: {{this.meeting_name}}
-{{{comments}}}
-
-{{#isInPersonOrHybrid this}}
- {{{crouton_map}}}
-
Location:
- {{#isTemporarilyClosed this}}
-
{{temporarilyClosed this}}
- {{/isTemporarilyClosed}}
-
{{{this.location_text}}}
-
{{this.formatted_address}}
-
{{{this.formatted_location_info}}}
-
-{{/isInPersonOrHybrid}}
-
-{{#isVirtualOrHybrid this}}
-
Join this meeting online:
- {{#if virtual_meeting_link}}
-
{{webLinkify this.virtual_meeting_link}}
- {{#if show_qrcode}}
-
{{qrCode virtual_meeting_link}}
- {{/if}}
- {{/if}}
- {{#if this.phone_meeting_number}}
-
{{phoneLinkify this.phone_meeting_number}}
- {{#if this.show_qrcode}}
-
{{qrCode this.phone_meeting_number}}
- {{/if}}
- {{/if}}
- {{#if this.virtual_meeting_additional_info}}
- {{this.virtual_meeting_additional_info}}
- {{/if}}
-
-{{/isVirtualOrHybrid}}
-
-{{#if formats_expanded}}
-
Meeting Formats
-
- {{#each formats_expanded}}
- {{description}}
- {{/each}}
-
-
-{{/if}}
-
Kontakt:
-This meeting is in
{{serviceBodyName}}
-[/bmlt_handlebar]
\ No newline at end of file
+
+
+ {{this.formatted_day}} {{this.start_time_formatted}} - {{this.end_time_formatted}}: {{this.meeting_name}}
+
+
+
+ {{#isInPersonOrHybrid this}}
+ {{{crouton_map}}}
+
+
+ Location:
+ {{#isTemporarilyClosed this}}
+ {{temporarilyClosed this}}
+ {{/isTemporarilyClosed}}
+ {{{this.location_text}}}
+ {{this.formatted_address}}
+ {{{this.formatted_location_info}}}
+ ' {{getWord "google_directions"}}
'
+
+ {{/isInPersonOrHybrid}}
+ {{#isVirtualOrHybrid this}}
+ Join this meeting online:
+ {{#if virtual_meeting_link}}
+ {{webLinkify this.virtual_meeting_link}}
+ {{#if show_qrcode}}
+ {{qrCode virtual_meeting_link}}
+ {{/if}}
+ {{/if}}
+ {{#if this.phone_meeting_number}}
+ {{phoneLinkify this.phone_meeting_number}}
+ {{#if this.show_qrcode}}
+ {{qrCode this.phone_meeting_number}}
+ {{/if}}
+ {{/if}}
+ {{#if this.virtual_meeting_additional_info}}
+ {{this.virtual_meeting_additional_info}}
+ {{/if}}
+
+ {{/isVirtualOrHybrid}}
+
+ {{#if formats_expanded}}
+ Meeting Formats
+
+ {{#each formats_expanded}}
+ {{description}}
+ {{/each}}
+
+
+ {{/if}}
+ Kontakt:
+ This meeting is in {{serviceBodyName}}
+
+
+
[/bmlt_handlebar]
\ No newline at end of file
From aad2e82c1cfe5394f6a90c303cc8661a2bdb89c2 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Tue, 10 Oct 2023 22:55:03 +0200
Subject: [PATCH 20/38] small fixes
---
crouton.php | 6 +++++-
croutonjs/src/js/crouton-map.js | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/crouton.php b/crouton.php
index 1deaf22..ef89819 100644
--- a/crouton.php
+++ b/crouton.php
@@ -182,6 +182,9 @@ public function hasShortcode()
if (count($split) > 1) {
$this->hasMap = true;
}
+ if ($_GET['meeting-id']) {
+ $this->hasMap = true;
+ }
}
if ($shortcode[2] === 'bmlt_handlebar') {
$this->hasMap = true;
@@ -403,7 +406,8 @@ private function getMapInitialization($mapConfig)
"crouton_map_create_control",
$externalMap,
isset($config['language']) ? substr($config['language'], 0, 2) : 'en',
- "croutonMap"
+ "croutonMap",
+ (empty($params['meeting_details_href'])) ? $_SERVER["REQUEST_URI"] : $params['meeting_details_href']
);
}
}
diff --git a/croutonjs/src/js/crouton-map.js b/croutonjs/src/js/crouton-map.js
index 39fe7c6..162eeeb 100644
--- a/croutonjs/src/js/crouton-map.js
+++ b/croutonjs/src/js/crouton-map.js
@@ -279,6 +279,9 @@ CroutonMap.prototype.fillMap = function(filteredIds=null) {
infoWindow.setContent(marker.desc);
infoWindow.open(self.map, marker);
});
+ infoWindow.addListener('closeclick', function() {
+ jQuery(".bmlt-data-row > td").removeClass("rowHighlight");
+ });
// Add some markers to the map.
filteredMeetings.map(function (location, i) {
var marker_html = '
';
From ec63d9b1576af88616e3cb77a4bfe5f93d6d9a89 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Wed, 11 Oct 2023 09:58:45 +0200
Subject: [PATCH 21/38] Update crouton.php
---
crouton.php | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/crouton.php b/crouton.php
index ef89819..bff8c19 100644
--- a/crouton.php
+++ b/crouton.php
@@ -175,15 +175,16 @@ public function hasShortcode()
foreach ($matches as $shortcode) {
if ($shortcode[2] === 'bmlt_tabs') {
- // This is a bad-smell. It is a side effect.
- // Also, it seems wrong to output this HTML during the enqueue scripts phase, but that's how 3.15 worked
- echo ' Fetching...
';
- $split = explode("show_map", $shortcode[3]);
- if (count($split) > 1) {
- $this->hasMap = true;
- }
if ($_GET['meeting-id']) {
$this->hasMap = true;
+ } else {
+ // This is a bad-smell. It is a side effect.
+ // Also, it seems wrong to output this HTML during the enqueue scripts phase, but that's how 3.15 worked
+ echo ' Fetching...
';
+ $split = explode("show_map", $shortcode[3]);
+ if (count($split) > 1) {
+ $this->hasMap = true;
+ }
}
}
if ($shortcode[2] === 'bmlt_handlebar') {
@@ -407,7 +408,7 @@ private function getMapInitialization($mapConfig)
$externalMap,
isset($config['language']) ? substr($config['language'], 0, 2) : 'en',
"croutonMap",
- (empty($params['meeting_details_href'])) ? $_SERVER["REQUEST_URI"] : $params['meeting_details_href']
+ $this->options['meeting_details_href']
);
}
}
@@ -1120,6 +1121,8 @@ public function getCroutonJsConfig($atts)
if (empty($params['meeting_details_href'])) {
$params['meeting_details_href'] = $_SERVER["REQUEST_URI"];
}
+ $this->options['meeting_details_href'] = $params['meeting_details_href'];
+
$params['force_rootserver_in_querystring'] = ($params['root_server'] !== $this->options['root_server']);
$params = apply_filters('crouton_configuration', $params);
$mapParams['theme'] = $params['theme'];
From c5467a1f6f4ca5d76ffe6e3d668d049b25972604 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Sun, 15 Oct 2023 23:55:59 +0200
Subject: [PATCH 22/38] Use CodeMirror on existing Admin Components
---
crouton.php | 17 +-
croutonjs/src/js/crouton-localization.js | 48 +-
css/codemirror.css | 344 +
css/show-hint.css | 37 +
js/bmlt_tabs_admin.js | 16 +
js/codemirror/codemirror.js | 9874 ++++++++++++++++++++++
js/codemirror/css-hint.js | 66 +
js/codemirror/css.js | 862 ++
js/codemirror/handlebars.js | 70 +
js/codemirror/matchbrackets.js | 160 +
js/codemirror/multiplex.js | 136 +
js/codemirror/show-hint.js | 523 ++
js/codemirror/simple.js | 216 +
js/codemirror/xml.js | 417 +
14 files changed, 12767 insertions(+), 19 deletions(-)
create mode 100644 css/codemirror.css
create mode 100644 css/show-hint.css
create mode 100644 js/codemirror/codemirror.js
create mode 100644 js/codemirror/css-hint.js
create mode 100644 js/codemirror/css.js
create mode 100644 js/codemirror/handlebars.js
create mode 100644 js/codemirror/matchbrackets.js
create mode 100644 js/codemirror/multiplex.js
create mode 100644 js/codemirror/show-hint.js
create mode 100644 js/codemirror/simple.js
create mode 100644 js/codemirror/xml.js
diff --git a/crouton.php b/crouton.php
index bff8c19..c7af689 100644
--- a/crouton.php
+++ b/crouton.php
@@ -123,7 +123,6 @@ public function __construct()
add_action("admin_notices", array(&$this, "isRootServerMissing"));
add_action("admin_enqueue_scripts", array(&$this, "enqueueBackendFiles"), 500);
add_action("admin_menu", array(&$this, "adminMenuLink"));
- add_filter('wp_editor_settings', array(&$this, "disableTinyMCE"), 100, 2);
} else {
// Front end
add_action("wp_enqueue_scripts", array(&$this, "enqueueFrontendFiles"));
@@ -256,6 +255,18 @@ public function enqueueBackendFiles($hook)
wp_enqueue_script('common');
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script("crouton-default-templates", plugin_dir_url(__FILE__) . "croutonjs/src/js/crouton-default-templates.js", array('jquery'), filemtime(plugin_dir_path(__FILE__) . "croutonjs/src/js/crouton-default-templates.js"), true);
+
+ wp_enqueue_style("codemirror", plugin_dir_url(__FILE__) . "css/codemirror.css", false, "5.65.15", 'all');
+ wp_enqueue_style("codemirror", plugin_dir_url(__FILE__) . "css/show-hint.css", false, "5.65.15", 'all');
+ wp_enqueue_script('codemirror', plugins_url('js/codemirror/codemirror.js', __FILE__), array('jquery'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/codemirror.js"), false);
+ wp_enqueue_script('codemirror-simple', plugins_url('js/codemirror/simple.js', __FILE__), array('codemirror'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/simple.js"), false);
+ wp_enqueue_script('codemirror-multiplex', plugins_url('js/codemirror/multiplex.js', __FILE__), array('codemirror-simple'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/multiplex.js"), false);
+ wp_enqueue_script('codemirror-matchbrackets', plugins_url('js/codemirror/matchbrackets.js', __FILE__), array('codemirror-multiplex'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/matchbrackets.js"), false);
+ wp_enqueue_script('codemirror-xml', plugins_url('js/codemirror/xml.js', __FILE__), array('codemirror-multiplex'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/xml.js"), false);
+ wp_enqueue_script('codemirror-handlebars', plugins_url('js/codemirror/handlebars.js', __FILE__), array('codemirror-xml'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/handlebars.js"), false);
+ wp_enqueue_script('codemirror-css', plugins_url('js/codemirror/css.js', __FILE__), array('codemirror'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/css.js"), false);
+ wp_enqueue_script('showhint', plugins_url('js/codemirror/show-hint.js', __FILE__), array('codemirror'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/show-hint.js"), false);
+ wp_enqueue_script('csshint', plugins_url('js/codemirror/css-hint.js', __FILE__), array('showhint'), filemtime(plugin_dir_path(__FILE__) . "js/codemirror/css-hint.js"), false);
}
}
@@ -845,7 +856,7 @@ public function adminOptionsPage()
This allows a customization of the meeting data template. A list of available fields are here here .)
-
-
Meeting Detail Pages
-
Link to pages where the [bmlt_handlebar] tag is used to insert information about a particular meeting, in more detail and in an
- easier to read format than is possible in the crouton table. Use the partial {{> meetingLink this}} to insert into a template.
-
-
-
Include Extra Meetings
@@ -863,13 +797,8 @@ public function adminOptionsPage()
@@ -885,13 +814,31 @@ public function adminOptionsPage()
+
+
+
Meeting Details Page
+
This allows a customization of the view of the meeting data that you get when you click on the meeting name. A list of available fields are here here .)
+
+
diff --git a/croutonjs/src/js/crouton-core.js b/croutonjs/src/js/crouton-core.js
index 93319c2..55ad21c 100644
--- a/croutonjs/src/js/crouton-core.js
+++ b/croutonjs/src/js/crouton-core.js
@@ -72,6 +72,8 @@ function Crouton(config) {
observer_template: croutonDefaultTemplates.observer_template,
meeting_count_template: croutonDefaultTemplates.meeting_count_template,
meeting_link_template: croutonDefaultTemplates.meeting_link_template,
+ meetingpage_title_template: croutonDefaultTemplates.meetingpage_title_template,
+ meetingpage_contents_template: croutonDefaultTemplates.meetingpage_contents_template,
};
self.setConfig(config);
@@ -525,6 +527,8 @@ function Crouton(config) {
crouton_Handlebars.registerPartial("meetingDataTemplate", self.config['meeting_data_template']);
crouton_Handlebars.registerPartial("metaDataTemplate", self.config['metadata_template']);
crouton_Handlebars.registerPartial("observerTemplate", self.config['observer_template']);
+ crouton_Handlebars.registerPartial("meetingpageTitleTemplate", self.config['meetingpage_title_template']);
+ crouton_Handlebars.registerPartial("meetingpageContentsTemplate", self.config['meetingpage_contents_template']);
crouton_Handlebars.registerPartial("meetingCountTemplate", self.config['meeting_count_template']);
crouton_Handlebars.registerPartial("meetingLink", self.config['meeting_link_template']);
diff --git a/croutonjs/src/js/crouton-default-templates.js b/croutonjs/src/js/crouton-default-templates.js
index a4aa21d..2325b73 100644
--- a/croutonjs/src/js/crouton-default-templates.js
+++ b/croutonjs/src/js/crouton-default-templates.js
@@ -63,5 +63,57 @@ var croutonDefaultTemplates = {
"{{else}}",
"{{this.meeting_name}}",
"{{/if}}"
- ].join('\n')
+ ].join('\n'),
+ meetingpage_title_template: [
+ "{{this.formatted_day}} {{this.start_time_formatted}} - {{this.end_time_formatted}}: {{this.meeting_name}}"
+ ].join('\n'),
+
+ meetingpage_contents_template:
+ `
+ {{#isInPersonOrHybrid this}}
+ {{{crouton_map}}}
+
+
+ Location:
+ {{#isTemporarilyClosed this}}
+ {{temporarilyClosed this}}
+ {{/isTemporarilyClosed}}
+ {{{this.location_text}}}
+ {{this.formatted_address}}
+ {{{this.formatted_location_info}}}
+ ' {{getWord "google_directions"}}
'
+
+ {{/isInPersonOrHybrid}}
+ {{#isVirtualOrHybrid this}}
+ Join this meeting online:
+ {{#if virtual_meeting_link}}
+ {{webLinkify this.virtual_meeting_link}}
+ {{#if show_qrcode}}
+ {{qrCode virtual_meeting_link}}
+ {{/if}}
+ {{/if}}
+ {{#if this.phone_meeting_number}}
+ {{phoneLinkify this.phone_meeting_number}}
+ {{#if this.show_qrcode}}
+ {{qrCode this.phone_meeting_number}}
+ {{/if}}
+ {{/if}}
+ {{#if this.virtual_meeting_additional_info}}
+ {{this.virtual_meeting_additional_info}}
+ {{/if}}
+
+ {{/isVirtualOrHybrid}}
+
+ {{#if formats_expanded}}
+ Meeting Formats
+
+ {{#each formats_expanded}}
+ {{description}}
+ {{/each}}
+
+
+ {{/if}}
+ Kontakt:
+ This meeting is in {{serviceBodyName}}
+ `,
}
diff --git a/css/codemirror.css b/css/codemirror.css
index f4d5718..1658d7c 100644
--- a/css/codemirror.css
+++ b/css/codemirror.css
@@ -6,6 +6,8 @@
height: 300px;
color: black;
direction: ltr;
+ border: 1px solid black;
+ height: auto;
}
/* PADDING */
@@ -161,7 +163,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
/* See overflow: hidden in .CodeMirror */
margin-bottom: -50px; margin-right: -50px;
padding-bottom: 50px;
- height: 100%;
+ height: auto;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
z-index: 0;
diff --git a/js/bmlt_tabs_admin.js b/js/bmlt_tabs_admin.js
index d90ae63..546b7c7 100644
--- a/js/bmlt_tabs_admin.js
+++ b/js/bmlt_tabs_admin.js
@@ -35,7 +35,11 @@ function numbersonly(myfield, e, dec)
else
return false;
};
-
+function resetCodemirrorToDefault(textAreaId) {
+ console.log("in Function");
+ let cm = jQuery('#'+textAreaId).next()[0].CodeMirror;
+ cm.setValue(croutonDefaultTemplates[textAreaId]);
+}
jQuery(document).ready(function($) {
var aggregator = "https://aggregator.bmltenabled.org/main_server";
$("#accordion").accordion({
@@ -99,10 +103,13 @@ jQuery(document).ready(function($) {
trigger: 'click'
});
jQuery('.handlebarsCode').each(function(i,textArea) {
- CodeMirror.fromTextArea(textArea, {
+ let template = textArea.value;
+ textArea.value = template.replace("___DEFAULT___", croutonDefaultTemplates[textArea.id]);
+ textArea.dataset.codeMirror = CodeMirror.fromTextArea(textArea, {
matchBrackets: true,
lineNumbers: true,
mode: {name: 'handlebars', base: 'text/html'},
+ viewportMargin: Infinity,
indentUnit: 4,
indentWithTabs: true
});
@@ -115,13 +122,3 @@ jQuery(document).ready(function($) {
});
});
});
-function show_create_detail_option(me) {
- if (me.value && me.value.trim().length > 0) {
- document.getElementById('meeting_details_options').innerHTML =
- '
' +
- '
If page doesn\'t exist, create it. '
- ;
- } else {
- document.getElementById('meeting_details_options').innerHTML = '';
- }
-}
diff --git a/partials/default_meeting_details.html b/partials/default_meeting_details.html
index 35c1a96..6d33650 100644
--- a/partials/default_meeting_details.html
+++ b/partials/default_meeting_details.html
@@ -1,55 +1,9 @@
[bmlt_handlebar]
- {{this.formatted_day}} {{this.start_time_formatted}} - {{this.end_time_formatted}}: {{this.meeting_name}}
+ {{> meetingpageTitleTemplate this}}
-
- {{#isInPersonOrHybrid this}}
- {{{crouton_map}}}
-
-
- Location:
- {{#isTemporarilyClosed this}}
- {{temporarilyClosed this}}
- {{/isTemporarilyClosed}}
- {{{this.location_text}}}
- {{this.formatted_address}}
- {{{this.formatted_location_info}}}
- ' {{getWord "google_directions"}}
'
-
- {{/isInPersonOrHybrid}}
- {{#isVirtualOrHybrid this}}
- Join this meeting online:
- {{#if virtual_meeting_link}}
- {{webLinkify this.virtual_meeting_link}}
- {{#if show_qrcode}}
- {{qrCode virtual_meeting_link}}
- {{/if}}
- {{/if}}
- {{#if this.phone_meeting_number}}
- {{phoneLinkify this.phone_meeting_number}}
- {{#if this.show_qrcode}}
- {{qrCode this.phone_meeting_number}}
- {{/if}}
- {{/if}}
- {{#if this.virtual_meeting_additional_info}}
- {{this.virtual_meeting_additional_info}}
- {{/if}}
-
- {{/isVirtualOrHybrid}}
-
- {{#if formats_expanded}}
- Meeting Formats
-
- {{#each formats_expanded}}
- {{description}}
- {{/each}}
-
-
- {{/if}}
- Kontakt:
- This meeting is in {{serviceBodyName}}
-
+ {{> meetingpageContentsTemplate this}}
[/bmlt_handlebar]
\ No newline at end of file
From 38e19613f6d9abf5cad528490a0249eec611d3b0 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 16 Oct 2023 18:59:15 +0200
Subject: [PATCH 24/38] Documentation
---
crouton.php | 64 +++++++++++++++++++++++++++++++++++---
partials/_instructions.php | 44 ++------------------------
readme.txt | 6 ++++
3 files changed, 67 insertions(+), 47 deletions(-)
diff --git a/crouton.php b/crouton.php
index 0f20658..0fa07d0 100644
--- a/crouton.php
+++ b/crouton.php
@@ -5,7 +5,7 @@
Description: A tabbed based display for showing meeting information.
Author: bmlt-enabled
Author URI: https://bmlt.app
-Version: 3.17.0
+Version: 3.17.1
*/
/* Disallow direct access to the plugin file */
if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
@@ -253,6 +253,7 @@ public function enqueueBackendFiles($hook)
wp_enqueue_script('bmlt-tabs-admin', plugins_url('js/bmlt_tabs_admin.js', __FILE__), array('jquery'), filemtime(plugin_dir_path(__FILE__) . "js/bmlt_tabs_admin.js"), false);
wp_enqueue_script("tooltipster", plugin_dir_url(__FILE__) . "js/jquery.tooltipster.min.js", array('jquery'), "1.2", true);
wp_enqueue_script('common');
+ add_thickbox();
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script("crouton-default-templates", plugin_dir_url(__FILE__) . "croutonjs/src/js/crouton-default-templates.js", array('jquery'), filemtime(plugin_dir_path(__FILE__) . "croutonjs/src/js/crouton-default-templates.js"), true);
@@ -746,6 +747,41 @@ public function adminOptionsPage()
+
Include Extra Meetings
@@ -787,7 +823,9 @@ public function adminOptionsPage()
Meeting Data Template
-
This allows a customization of the meeting data template. A list of available fields are here here .)
+
This allows a customization of the meeting data template. A list of available fields are
+
+ .
@@ -804,7 +842,9 @@ public function adminOptionsPage()
Metadata Template
-
This allows a customization of the metadata template (3rd column). A list of available fields are here here .)
+
This allows a customization of the metadata template (3rd column). A list of available fields are
+
+ .
@@ -821,7 +861,9 @@ public function adminOptionsPage()
Meeting Details Page
-
This allows a customization of the view of the meeting data that you get when you click on the meeting name. A list of available fields are here here .)
+
This allows a customization of the view of the meeting data that you get when you click on the meeting name. A list of available fields are
+
+ .
Title
@@ -929,7 +971,19 @@ public function saveAdminOptions()
update_option($this->optionsName, $this->options);
return;
}
-
+ /**
+ * @param $root_server
+ * @return array
+ */
+ public function getAllFields($root_server)
+ {
+ try {
+ $results = wp_remote_get($root_server . "/client_interface/json/?switcher=GetFieldKeys");
+ return json_decode(wp_remote_retrieve_body($results), true);
+ } catch (Exception) {
+ return [];
+ }
+ }
/**
* @param $root_server
* @return string
diff --git a/partials/_instructions.php b/partials/_instructions.php
index b565b47..1975f00 100644
--- a/partials/_instructions.php
+++ b/partials/_instructions.php
@@ -264,12 +264,13 @@
You can specify the maximum zoom level at which clustering is enabled, 15 is the default. This may be desirable with smaller data sets in which you don't want to cluster at all.
[bmlt_tabs show_map="1" max_zoom_level="7"]
The Google API Key must be entered on the crouton settings page for this to work. You must have the 'Google Maps JavaScript API' enabled on your key. For more information on setting up and configuring a Google Maps API key check out this blog article https://bmlt.app/google-api-key/
+ As an alternative to using google maps, you may install and activate the plugin "bmlt-meeting-map". In the settings for this plugin, you may select Open Street Maps, or any other standard conform map tile service. Upon activation, crouton companion maps will use this functionality, rather than the native google maps.
Map Search
With this shortcode you can have crouton start with a map search with auto radius search. The default for the base shortcode is to detect your location and display the ~50 closest meetings (no regard to distance).
[crouton_map]
-
The configurable options are as below to add to this shortcode (in addition to any other ones that you'd normally use on [bmlt_tabs]
+
The configurable options are as below to add to this shortcode (in addition to any other ones that you'd normally use on [bmlt_tabs])
[crouton_map map_search_auto="false"] - specifies you do NOT want to automatically use your current latitude and longitude to find meetings (default: true).
[crouton_map map_search_location="Greensboro, NC"] - specifies the starting search location on the map (default: none).
[crouton_map map_search_coordinates_search="true"] - specifies the starting search coordinates on the map, will use (and require) the latitude and longitude settings as mentioned here. (default: none).
@@ -277,47 +278,6 @@
[crouton_map map_search_zoom="10"] - specifies the starting zoom level on the map (default: 10).
[crouton_map map_search_width="-50"] - specifies how many meetings to return, a positive integer means how many miles or kilometers to search. A negative integer indicates the closest number of meetings from that point with no distance limits. (default: -50 [the fifty closest meetings to the point selected]).
The Google API Key must be entered on the crouton settings page for this to work. You must have the 'Google Maps JavaScript API' enabled on your key. For more information on setting up and configuring a Google Maps API key check out this blog article https://bmlt.app/google-api-key/
-
-
Create Meeting-Detail Pages
-
-
With this shortcode you can insert a HandlebarJS template into your page.
-
[bmlt_handlebar]
-
If the page is called with a query string including "meeting-id=your meeting here "
- the default BMLT root server will be accessed to obtain the meeting information used when evaluating the template. The Meeting Data template, and all other templates and helpers
- used by Crouton are also available for use within the [bmlt-handlebar] tag.
-
For instance, to put the meeting name as the title of the page, you could have
- [bmlt_handlebar]<H1>{{this.meeting_name}}</H1>[/bmlt_handlebar]
-
-
-
In addition to the fields returned by the root server, the following fields are calculated and made available as part of the meeting data.
-
- start_time_formatted
- end_time_formatted
- formatted_day
- formats_expanded - which contains:
-
- id
- key
- name
- description
- type
-
-
- venue_type
- venue_type_name
- formatted_address
- formatted_location_info
- serviceBodyUrl
- serviceBodyPhone
- serviceBodyName
- serviceBodyDescription
- serviceBodyContactEmail (must be comfigured in root server)
- serviceBodyType
-
-
-
To include a crouton map into the meeting details, use the "crouton_map" helper function, ie, {{{crouton_map}}}.
- Note the triple brackets. A initial zoom factor (from 2 to 17) may be given as an option, eg, {{{crouton_map zoom=16}}}. Default zoom is 14.
-
Extending Crouton
diff --git a/readme.txt b/readme.txt
index 0e5b220..f29913e 100644
--- a/readme.txt
+++ b/readme.txt
@@ -36,6 +36,12 @@ https://demo.bmlt.app/crouton
== Changelog ==
+= 3.17.1 =
+* Meeting Detail Pages are now the Crouton Page, with meeting-id in the query string. No need for separate pages
+* Meeting Detail Pages can now be edited from the crouton admin/settings page.
+* All Handlebar Templates edited using codemirror
+* Thickbox used to show the values available in templates.
+
= 3.17.0 =
* Fix bug where extra meetings were not recognised
* Maps can be embedded, so that users can switch between table and map views, rather than needing to scroll.
From bfc0e5d444fac06d33b204960ff3fa21b25e755c Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Tue, 17 Oct 2023 15:25:19 +0200
Subject: [PATCH 25/38] bug fixes, docu
---
crouton.php | 192 +++++++++++---------------
partials/default_meeting_details.html | 18 ++-
2 files changed, 95 insertions(+), 115 deletions(-)
diff --git a/crouton.php b/crouton.php
index 0fa07d0..7b42bca 100644
--- a/crouton.php
+++ b/crouton.php
@@ -158,11 +158,10 @@ public function __construct()
&$this,
"bmltHandlebar"
));
- add_filter('the_content', array(&$this, "disableWpautop"), 0);
}
}
- public function hasShortcode()
+ private function hasShortcode()
{
$post_to_check = get_post(get_the_ID());
$post_content = $post_to_check->post_content ?? '';
@@ -206,7 +205,7 @@ public function isRootServerMissing()
));
}
- public function clearAdminMessage()
+ private function clearAdminMessage()
{
remove_action("admin_notices", array(
&$this,
@@ -219,29 +218,6 @@ public function Crouton()
// phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
$this->__construct();
}
- public function disableTinyMCE($settings, $editor_id)
- {
- if ($editor_id === 'content' && get_post_meta(get_the_ID(), '_crouton_disable_tinyMCE', true)) {
- $settings['tinymce'] = false;
- $settings['quicktags'] = false;
- $settings['media_buttons'] = false;
- }
-
- return $settings;
- }
- public function disableWpautop($content)
- {
- if (get_post_meta(get_the_ID(), '_crouton_disable_tinyMCE')) {
- remove_filter('the_content', 'wpautop');
- }
- return $content;
- }
- public function includeToString($file)
- {
- ob_start();
- include($file);
- return ob_get_clean();
- }
public function enqueueBackendFiles($hook)
{
@@ -291,34 +267,7 @@ public function enqueueFrontendFiles()
}
}
- public function getNameFromServiceBodyID($serviceBodyID)
- {
- $bmlt_search_endpoint = wp_remote_get($this->options['root_server'] . "/client_interface/json/?switcher=GetServiceBodies", Crouton::HTTP_RETRIEVE_ARGS);
- $serviceBodies = json_decode(wp_remote_retrieve_body($bmlt_search_endpoint));
- foreach ($serviceBodies as $serviceBody) {
- if ($serviceBody->id == $serviceBodyID) {
- return $serviceBody->name;
- }
- }
- }
- public function getMeetingsJson($url)
- {
- $results = wp_remote_get($url, Crouton::HTTP_RETRIEVE_ARGS);
- $httpcode = wp_remote_retrieve_response_code($results);
- $response_message = wp_remote_retrieve_response_message($results);
- if ($httpcode != 200 && $httpcode != 302 && $httpcode != 304 && ! empty($response_message)) {
- echo "
Problem Connecting to BMLT Root Server: $url
";
- return 0;
- }
- $result = wp_remote_retrieve_body($results);
- if ($result == null || count(json_decode($result)) == 0) {
- echo "
No Meetings were Found: $url
";
- return 0;
- }
- return $result;
- }
-
- public function getCustomQuery($custom_query)
+ private function getCustomQuery($custom_query)
{
if (isset($_GET['custom_query'])) {
return $_GET['custom_query'];
@@ -331,7 +280,7 @@ public function getCustomQuery($custom_query)
}
}
- public function testRootServer($root_server)
+ private function testRootServer($root_server)
{
$args = array(
'timeout' => '10',
@@ -364,7 +313,7 @@ public function doQuit($message = '')
return $message;
}
- public function sharedRender()
+ private function sharedRender()
{
$output = "";
if (isset($_GET['this_title'])) {
@@ -426,7 +375,7 @@ private function getMapInitialization($mapConfig)
}
return $externalMap;
}
- public function getInitializeCroutonBlock($config, $mapConfig)
+ private function getInitializeCroutonBlock($config, $mapConfig)
{
if (!$this->croutonBlockInitialized) {
$this->croutonBlockInitialized = true;
@@ -437,12 +386,12 @@ public function getInitializeCroutonBlock($config, $mapConfig)
}
}
- public function renderTable($atts)
+ private function renderTable($atts)
{
return $this->getInitializeCroutonBlock(...$this->getCroutonJsConfig($atts)) . "";
}
- public function renderMap($atts)
+ private function renderMap($atts)
{
if ($atts == null) {
$atts = array();
@@ -473,7 +422,7 @@ public function renderMap($atts)
return $this->getInitializeCroutonBlock(...$this->getCroutonJsConfig($atts));
}
- public function initCrouton($atts)
+ private function initCrouton($atts)
{
return $this->getInitializeCroutonBlock(...$this->getCroutonJsConfig($atts));
}
@@ -584,6 +533,8 @@ public function adminOptionsPage()
$this->options['strict_datafields'] = isset($_POST['strict_datafields']);
$this->options["int_start_day_id"] = intval($_POST["int_start_day_id"]);
$this->options['native_lang'] = trim($_POST['native_lang']);
+ $this->options['meeting_details_href'] = trim($_POST['meeting_details_href']);
+ $this->options['virtual_meeting_details_href'] = trim($_POST['virtual_meeting_details_href']);
$this->options['custom_query'] = $_POST['custom_query'];
$this->options['custom_css'] = isset($_POST['custom_css']) ? str_replace('\\', '', $_POST['custom_css']) : "";
$this->options['meeting_data_template'] = isset($_POST['meeting_data_template']) ? str_replace('\\', '', $_POST['meeting_data_template']) : "";
@@ -648,13 +599,15 @@ public function adminOptionsPage()
@@ -821,6 +774,40 @@ public function adminOptionsPage()
+