From cda76c89664ecaf1adabe5aeae2218bffff14d19 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Tue, 26 May 2026 23:19:11 +0200
Subject: [PATCH 01/17] Create AJAX mechanism
---
includes/class-bread-bmlt.php | 97 ++++++++++++++++----
includes/class-bread.php | 6 +-
public/class-bread-content-generator.php | 12 +--
public/class-bread-public.php | 96 +++++++++++++-------
public/css/bread-public.css | 4 -
public/js/bread-public.js | 67 +++++++-------
public/js/fetch-jsonp.js | 111 +++++++++++++++++++++++
7 files changed, 295 insertions(+), 98 deletions(-)
delete mode 100644 public/css/bread-public.css
create mode 100644 public/js/fetch-jsonp.js
diff --git a/includes/class-bread-bmlt.php b/includes/class-bread-bmlt.php
index 90ca05e1..90235be7 100644
--- a/includes/class-bread-bmlt.php
+++ b/includes/class-bread-bmlt.php
@@ -14,9 +14,9 @@ function __construct($bread)
$this->bread = $bread;
}
- public function get_configured_root_server_request($url, $raw = false)
+ private function get_configured_root_server_request($url, $raw = false)
{
- $results = $this->bread->bmlt()->get($this->bread->getOption('root_server') . "/" . $url);
+ $results = $this->get($this->bread->getOption('root_server') . "/$url");
if ($raw) {
return $results;
}
@@ -24,7 +24,7 @@ public function get_configured_root_server_request($url, $raw = false)
}
public function get_formats_by_language(string $lang)
{
- return $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetFormats&lang_enum=$lang");
+ return $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats&lang_enum=$lang");
}
/**
* Undocumented function
@@ -57,10 +57,10 @@ private function get(string $url): WP_Error | array
*/
public function get_all_meetings(): array
{
- $lang = $this->bread->bmlt()->get_bmlt_server_lang();
- $result = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults&data_field_key=weekday_tinyint,start_time,service_body_bigint,id_bigint,meeting_name,location_text,email_contact&sort_keys=meeting_name,service_body_bigint,weekday_tinyint,start_time");
+ $lang = $this->get_bmlt_server_lang();
+ $result = $this->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults&data_field_key=weekday_tinyint,start_time,service_body_bigint,id_bigint,meeting_name,location_text,email_contact&sort_keys=meeting_name,service_body_bigint,weekday_tinyint,start_time");
- $unique_areas = $this->bread->bmlt()->get_areas();
+ $unique_areas = $this->get_areas();
$all_meetings = array();
foreach ($result as $value) {
foreach ($unique_areas as $unique_area) {
@@ -79,7 +79,7 @@ public function get_all_meetings(): array
}
public function get_fieldkeys()
{
- $ret = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetFieldKeys");
+ $ret = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFieldKeys");
return is_null($ret) ? array() : $ret;
}
private $standard_keys = array(
@@ -108,7 +108,7 @@ public function get_fieldkeys()
);
public function get_nonstandard_fieldkeys()
{
- $all_fks = $this->bread->bmlt()->get_fieldkeys();
+ $all_fks = $this->get_fieldkeys();
$ret = array();
foreach ($all_fks as $fk) {
if (!in_array($fk['key'], $this->standard_keys)) {
@@ -131,7 +131,7 @@ public function get_areas()
if (!empty($this->unique_areas)) {
return $this->unique_areas;
}
- $result = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetServiceBodies");
+ $result = $this->get_configured_root_server_request("client_interface/json/?switcher=GetServiceBodies");
$this->unique_areas = array();
foreach ($result as $value) {
@@ -149,15 +149,80 @@ public function get_areas()
return $this->unique_areas;
}
+ public function generateMainQuery($json = 'json')
+ {
+ $sort_keys = 'weekday_tinyint,start_time,meeting_name';
+ $get_used_formats = '&get_used_formats';
+ $select_language = '';
+ if ($this->bread->getOption('weekday_language') != $this->get_bmlt_server_lang()) {
+ $select_language = '&lang_enum=' . substr($this->bread->getOption('weekday_language'), 0, 2);
+ }
+ $services = $this->generateDefaultQuery();
+ if (isset($_GET['custom_query'])) {
+ $services = $_GET['custom_query'];
+ } elseif ($this->bread->getOption('custom_query') !== '') {
+ $services = $this->bread->getOption('custom_query');
+ }
+ if ($this->bread->getOption('used_format_1') == '') {
+ return "client_interface/$json/?switcher=GetSearchResults$services&sort_keys=$sort_keys$get_used_formats$select_language";
+ } else {
+ return "client_interface/$json/?switcher=GetSearchResults$services&sort_keys=$sort_keys&get_used_formats&formats[]=" . $this->bread->getOption('used_format_1') . $select_language;
+ }
+ }
+ public function doMainQuery()
+ {
+ return $this->get_configured_root_server_request($this->generateMainQuery());
+ }
+ public function generateExtraMeetingQuery($json = 'json')
+ {
+ if (empty($this->bread->getOption('extra_meetings'))) {
+ return null;
+ }
+ $sort_keys = 'weekday_tinyint,start_time,meeting_name';
+ $get_used_formats = '&get_used_formats';
+ $select_language = '';
+ $extras = "";
+ foreach ((array)$this->bread->getOption('extra_meetings') as $value) {
+ $data = array(" [", "]");
+ $value = str_replace($data, "", $value);
+ $extras .= "&meeting_ids[]=" . $value;
+ }
+
+ return "client_interface/$json/?switcher=GetSearchResults&sort_keys=" . $sort_keys . "" . $extras . "" . $get_used_formats . $select_language;
+ }
+ public function doExtraMeetingQuery()
+ {
+ return $this->get_configured_root_server_request($this->generateExtraMeetingQuery());
+ }
+ public function generateAdditionalListQuery($json = 'json')
+ {
+ if (!empty($this->options['additional_list_custom_query'])) {
+ $sort_order = $this->bread->getOption('additional_list_sort_order');
+ if ($sort_order == 'same') {
+ $sort_order = 'weekday_tinyint,start_time';
+ }
+ $services = $this->bread->getOption('additional_list_custom_query');
+ return "client_interface/$json/?switcher=GetSearchResults$services&sort_keys=$sort_order";
+ }
+ return null;
+ }
+ public function doAdditionalListQuery()
+ {
+ $url = $this->generateAdditionalListQuery();
+ if ($url == null) {
+ return [];
+ }
+ return $this->get_configured_root_server_request($url);
+ }
/**
* Gets the default language of the root server.
*
* @return string 2 character string ISO standard for the language.
*/
- public function get_bmlt_server_lang(): string
+ private function get_bmlt_server_lang(): string
{
if ($this->bmlt_server_lang == '') {
- $result = $this->bread->bmlt()->testRootServer();
+ $result = $this->testRootServer();
if (!($result && is_array($result) && is_array($result[0]))) {
return 'en';
}
@@ -174,9 +239,9 @@ public function get_bmlt_server_lang(): string
public function testRootServer(string $override_root_server = null): array|bool
{
if ($override_root_server == null) {
- $results = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetServerInfo", true);
+ $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetServerInfo", true);
} else {
- $results = $this->bread->bmlt()->get($override_root_server . "/client_interface/json/?switcher=GetServerInfo", true);
+ $results = $this->get($override_root_server . "client_interface/json/?switcher=GetServerInfo", true);
}
if ($results instanceof WP_Error) {
$this->connection_error = $results->get_error_message();
@@ -199,8 +264,8 @@ public function testRootServer(string $override_root_server = null): array|bool
public function getFormatsForSelect(bool $all = false): array
{
if ($all) {
- $results = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetFormats");
- $this->bread->bmlt()->sortBySubkey($results, 'key_string');
+ $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats");
+ $this->sortBySubkey($results, 'key_string');
return $results;
}
$area_data = explode(',', $this->bread->getOption('service_body_1'));
@@ -215,7 +280,7 @@ public function getFormatsForSelect(bool $all = false): array
} else {
$queryUrl = "client_interface/json/?switcher=GetSearchResults$services&get_formats_only";
}
- $results = $this->bread->bmlt()->get_configured_root_server_request($queryUrl);
+ $results = $this->get_configured_root_server_request($queryUrl);
$results = empty($service_body_id) ? $results : $results['formats'];
$this->sortBySubkey($results, 'key_string');
return $results;
diff --git a/includes/class-bread.php b/includes/class-bread.php
index 94da3290..0ddf8250 100644
--- a/includes/class-bread.php
+++ b/includes/class-bread.php
@@ -305,7 +305,7 @@ public function &getConfigurationForSettingId($current_setting)
if ($current_setting < 1) {
$current_setting = is_admin() ? 1 : $this->requested_setting;
}
- if (is_array($this->allSettings[$current_setting])) {
+ if ($this->allSettings && !empty($this->allSettings[$current_setting]) && is_array($this->allSettings[$current_setting])) {
$this->options = $this->allSettings[$current_setting];
} else {
$this->optionsName = $this->generateOptionName($current_setting);
@@ -529,6 +529,8 @@ private function define_public_hooks()
$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
$this->loader->add_action('plugins_loaded', $plugin_public, 'bmlt_meeting_list');
+ $this->loader->add_action('wp_ajax_bread_preload_action', $plugin_public, 'bread_preload');
+ $this->loader->add_action('wp_ajax_nopriv_bread_preload_action', $plugin_public, 'bread_preload');
}
/**
@@ -721,7 +723,7 @@ private function upgrade_settings(): void
|| $this->options['meeting_sort'] === 'weekday_city'
|| $this->options['meeting_sort'] === 'weekday_county'
|| $this->options['meeting_sort'] === 'day')) {
- $this->options['weekday_language'] = $this->bmlt()->get_bmlt_server_lang();
+ $this->options['weekday_language'] = 'en';
}
if ($this->options['page_fold'] == 'half') {
if ($this->options['page_size'] == 'A5') {
diff --git a/public/class-bread-content-generator.php b/public/class-bread-content-generator.php
index 7dc8d125..6d6596b3 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -580,17 +580,7 @@ function write_additional_meetinglist()
* If we are selecting the meetings in the second list based on some format, we don't need another BMLT query.
*/
if (empty($this->options['additional_list_format_key'])) {
- $additional_list_query = true;
- $sort_order = $this->options['additional_list_sort_order'];
- if ($sort_order == 'same') {
- $sort_order = 'weekday_tinyint,start_time';
- }
- $services = $this->bread->bmlt()->generateDefaultQuery();
- if (!empty($this->options['additional_list_custom_query'])) {
- $services = $this->options['additional_list_custom_query'];
- }
- $additional_list_query = "client_interface/json/?switcher=GetSearchResults$services&sort_keys=$sort_order";
- $additional_meetinglist_result = $this->bread->bmlt()->get_configured_root_server_request($additional_list_query);
+ $additional_meetinglist_result = $this->bread->bmlt()->doAdditionalListQuery();
$this->adjust_timezone($additional_meetinglist_result, $this->target_timezone);
}
if ($additional_list_query || $this->options['weekday_language'] != $this->options['additional_list_language']) {
diff --git a/public/class-bread-public.php b/public/class-bread-public.php
index 4f3e9cd6..a990e014 100644
--- a/public/class-bread-public.php
+++ b/public/class-bread-public.php
@@ -67,6 +67,10 @@ public function __construct($plugin_name, $version, $bread)
$this->version = $version;
$this->bread = $bread;
$this->options = $bread->getOptions();
+ add_shortcode('bread_button', array(
+ &$this,
+ "doBreadButton"
+ ));
}
/**
@@ -76,7 +80,6 @@ public function __construct($plugin_name, $version, $bread)
*/
public function enqueue_styles()
{
- wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/bread-public.css', array(), $this->version, 'all');
}
/**
@@ -86,9 +89,64 @@ public function enqueue_styles()
*/
public function enqueue_scripts()
{
- wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/bread-public.js', array('jquery'), $this->version, false);
+ if (($current = $this->doPreloading()) > 0) {
+ wp_enqueue_script('fetch-jsonp', plugin_dir_url(__FILE__) . 'js/fetch-jsonp.js', array(), $this->version, true);
+ wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/bread-public.js', array('jquery','fetch-jsonp'), $this->version, true);
+ wp_localize_script($this->plugin_name, 'bread_ajax_obj', [
+ 'ajaxurl' => admin_url('admin-ajax.php'),
+ 'nonce' => wp_create_nonce('bread-ajax-nonce'),
+ 'config' => $this->generatePreloadConfiguration($current)
+ ]);
+ }
+ }
+ /**
+ * Check if the shortcode is being used on this page.
+ *
+ * @return boolean
+ */
+ private function doPreloading(): int
+ {
+ $post_to_check = get_post(get_the_ID());
+ $post_content = $post_to_check->post_content ?? '';
+ $tags = ['bread_button'];
+ preg_match_all('/' . get_shortcode_regex($tags) . '/', $post_content, $matches, PREG_SET_ORDER);
+ if (empty($matches)) {
+ return -1;
+ }
+ foreach ($matches as $shortcode) {
+ switch ($shortcode[2]) {
+ case 'bread_button':
+ $atts = shortcode_parse_atts($shortcode[3]);
+ return intval($atts['current_meeting_list']);
+ }
+ }
+ return -1;
+ }
+ private function generatePreloadConfiguration(int $id): array
+ {
+ $options = $this->bread->getConfigurationForSettingId($id);
+ return [
+ 'root_server' => $options['root_server'],
+ 'main_query' => $this->bread->bmlt()->generateMainQuery('jsonp'),
+ 'extra_meetings_query' => $this->bread->bmlt()->generateExtraMeetingQuery('jsonp'),
+ 'additional_list_query' => $this->bread->bmlt()->generateAdditionalListQuery('jsonp'),
+ 'weekday_language' => $options['weekday_language'],
+ 'additional_list_language' => $options['additional_list_language'],
+ ];
+ }
+ public function doBreadButton($atts)
+ {
+ $label = $atts['label'] ?? 'Generate PDF';
+ return ''.$label.' ';
+ }
+ public function bread_preload()
+ {
+ if (! wp_verify_nonce($_POST['nonce'], 'bread-ajax-nonce')) {
+ die;
+ }
+ $preload = json_decode(stripslashes($_POST['preload']));
+ wp_send_json_success('Success!');
}
-
public function bmlt_meeting_list($atts = null, $content = null)
{
if (!$this->bread->generatingMeetingList()) {
@@ -175,23 +233,7 @@ public function bmlt_meeting_list($atts = null, $content = null)
) {
$this->drawLinesSeperatingColumns($mode, $mpdf_init_options['format'], $default_font);
}
- $sort_keys = 'weekday_tinyint,start_time,meeting_name';
- $get_used_formats = '&get_used_formats';
- $select_language = '';
- if ($this->options['weekday_language'] != $this->bread->bmlt()->get_bmlt_server_lang()) {
- $select_language = '&lang_enum=' . $this->getSingleLanguage($this->options['weekday_language']);
- }
- $services = $this->bread->bmlt()->generateDefaultQuery();
- if (isset($_GET['custom_query'])) {
- $services = $_GET['custom_query'];
- } elseif ($this->options['custom_query'] !== '') {
- $services = $this->options['custom_query'];
- }
- if ($this->options['used_format_1'] == '') {
- $result = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults$services&sort_keys=$sort_keys$get_used_formats$select_language");
- } elseif ($this->options['used_format_1'] != '') {
- $result = $this->bread->bmlt()->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults$services&sort_keys=$sort_keys&get_used_formats&formats[]=" . $this->options['used_format_1'] . $select_language);
- }
+ $result = $this->bread->bmlt()->doMainQuery();
if ($result == null) {
echo "
@@ -98,20 +87,12 @@ function Bread_bmlt_server_setup_page_render(Bread_AdminDisplay $breadAdmin)
(?)
isConnected() && $bread->getOption('extra_meetings_enabled') == 1) {?>
-
diff --git a/admin/partials/_meetings_setup.php b/admin/partials/_meetings_setup.php
index 15223b89..8099750a 100644
--- a/admin/partials/_meetings_setup.php
+++ b/admin/partials/_meetings_setup.php
@@ -109,16 +109,6 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
getOption('main_grouping') == 'location_sub_province' ? 'selected' : '') ?> value="location_sub_province">
getOption('main_grouping') == 'location_city_subsection' ? 'selected' : '') ?> value="location_city_subsection">
getOption('main_grouping') == 'location_province' ? 'selected' : '') ?> value="location_province">
- bmlt()->get_nonstandard_fieldkeys();
- foreach ($fks as $fk) {
- $selected = '';
- if ($fk['key'] == $bread->getOption('main_grouping')) {
- $selected = 'selected';
- }
- echo '
' . esc_html($fk['description']) . ' ';
- }
- ?>
@@ -130,15 +120,6 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
getOption('subgrouping') == 'location_sub_province' ? 'selected' : '') ?> value="location_sub_province">
getOption('subgrouping') == 'location_city_subsection' ? 'selected' : '') ?> value="location_city_subsection">
getOption('subgrouping') == 'location_province' ? 'selected' : '') ?> value="location_province">
- getOption('subgrouping')) {
- $selected = 'selected';
- }
- echo '' . esc_html($fk['description']) . ' ';
- }
- ?>
@@ -282,22 +263,6 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
- isConnected()) {
- echo 'Not Used ';
- $used_formats = $bread->bmlt()->getFormatsForSelect(false);
- foreach ($used_formats as $format) {
- $selected = '';
- if ($format['id'] == $bread->getOption('used_format_1')) {
- $selected = 'selected';
- }
- $id = $format['id'];
- $str = esc_html($format['name_string']);
- echo "" . esc_html($str) . " ";
- }
- } else { ?>
-
@@ -312,19 +277,8 @@ function Bread_meetings_setup_page_render(Bread_AdminDisplay $breadAdmin)
- isConnected()) { ?>
getOption('additional_list_format_key') == '@Virtual@' ? 'selected' : '' ?>>
getOption('additional_list_format_key') == '@F2F@' ? 'selected' : '' ?>>
- bmlt()->getFormatsForSelect(true);
- $countmax = count($used_formats);
- for ($count = 0; $count < $countmax; $count++) {
- if ($used_formats[$count]['key_string'] == $bread->getOption('additional_list_format_key')) { ?>
-
-
-
-
diff --git a/admin/partials/bread-admin-display.php b/admin/partials/bread-admin-display.php
index e927d3c9..32706c3a 100644
--- a/admin/partials/bread-admin-display.php
+++ b/admin/partials/bread-admin-display.php
@@ -61,43 +61,6 @@ public function getServerVersion()
{
return $this->server_version;
}
- public function select_service_bodies()
- {
- for ($i = 1; $i <= 5; $i++) { ?>
-
:
- connected) {
- $this->select_service_body_options($i);
- } else { ?>
-
-
-
- Not Used
- unique_areas as $area) {
- $area_data = explode(',', $area);
- $area_name = $this->bread->arraySafeGet($area_data);
- $area_id = $this->bread->arraySafeGet($area_data, 1);
- $area_parent = $this->bread->arraySafeGet($area_data, 2);
- $area_parent_name = $this->bread->arraySafeGet($area_data, 3);
- $descr = $area_name . " (" . $area_id . ") " . $area_parent_name . " (" . $area_parent . ")";
- $selected = '';
- $sb = esc_html($this->bread->getOption("service_body_$i"));
- $area_selected = explode(',', $sb);
- if ($this->bread->arraySafeGet($area_selected) != "Not Used" && $area_id == $this->bread->arraySafeGet($area_selected, 1)) {
- $selected = 'selected';
- } ?>
- value="">
diff --git a/bmlt-meeting-list.php b/bmlt-meeting-list.php
index 3be9b1ae..ef93c6c5 100644
--- a/bmlt-meeting-list.php
+++ b/bmlt-meeting-list.php
@@ -11,7 +11,7 @@
* Plugin Name: Bread
* Plugin URI: https://bmlt.app
* Description: Maintains and generates PDF Meeting Lists from BMLT.
- * Version: 2.9.15
+ * Version: 2.10.0
* Author: bmlt-enabled
* Author URI: https://bmlt.app/
* License: GPL-2.0+
@@ -30,7 +30,7 @@
* Start at version 2.8.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
-define('BREAD_VERSION', '2.9.13');
+define('BREAD_VERSION', '2.10.0');
/**
* The code that runs during plugin activation.
diff --git a/includes/class-bread-bmlt.php b/includes/class-bread-bmlt.php
index 961a1b9f..6c9acb2c 100644
--- a/includes/class-bread-bmlt.php
+++ b/includes/class-bread-bmlt.php
@@ -28,7 +28,9 @@ private function get_configured_root_server_request($url, $raw = false)
}
public function get_formats_by_language(string $lang)
{
- if ($this->preloaded !== null) return $this->preloaded['allFormats'][substr($lang, 0, 2)];
+ if ($this->preloaded !== null) {
+ return $this->preloaded['allFormats'][substr($lang, 0, 2)];
+ }
return $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats&lang_enum=$lang");
}
/**
@@ -55,77 +57,6 @@ private function get(string $url): WP_Error | array
}
return wp_remote_get($url, $args);
}
- /**
- * Gets all the meetins in the root server as an array with id=>string. Used to select extra meetings.
- *
- * @return array
- */
- public function get_all_meetings(): array
- {
- $lang = $this->get_bmlt_server_lang();
- $result = $this->get_configured_root_server_request("client_interface/json/?switcher=GetSearchResults&data_field_key=weekday_tinyint,start_time,service_body_bigint,id_bigint,meeting_name,location_text,email_contact&sort_keys=meeting_name,service_body_bigint,weekday_tinyint,start_time");
-
- $unique_areas = $this->get_areas();
- $all_meetings = array();
- foreach ($result as $value) {
- foreach ($unique_areas as $unique_area) {
- $area_data = explode(',', $unique_area);
- $area_id = $this->bread->arraySafeGet($area_data, 1);
- if ($area_id === $value['service_body_bigint']) {
- $area_name = $this->bread->arraySafeGet($area_data);
- }
- }
-
- $value['start_time'] = gmdate("g:iA", strtotime($value['start_time']));
- $all_meetings[$value['id_bigint']] = wp_strip_all_tags($value['meeting_name'] . ' - ' . $this->bread->getday($value['weekday_tinyint'], true, $lang) . ' ' . $value['start_time'] . ' in ' . $area_name . ' at ' . $value['location_text']);
- }
-
- return $all_meetings;
- }
- public function get_fieldkeys()
- {
- $ret = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFieldKeys");
- return is_null($ret) ? array() : $ret;
- }
- private $standard_keys = array(
- "id_bigint",
- "worldid_mixed",
- "service_body_bigint",
- "weekday_tinyint",
- "start_time",
- "duration_time",
- "formats",
- "lang_enum",
- "longitude",
- "latitude",
- "meeting_name" . "location_text",
- "location_info",
- "location_street",
- "location_city_subsection",
- "location_neighborhood",
- "location_municipality",
- "location_sub_province",
- "location_province",
- "location_postal_code_1",
- "location_nation",
- "comments",
- "zone"
- );
- public function get_nonstandard_fieldkeys()
- {
- $all_fks = $this->get_fieldkeys();
- $ret = array();
- foreach ($all_fks as $fk) {
- if (!in_array($fk['key'], $this->standard_keys)) {
- $ret[] = $fk;
- }
- }
- $ext_fields = apply_filters("Bread_Enrich_Meeting_Data", array(), array());
- foreach ($ext_fields as $key => $value) {
- $ret[] = array("key" => $key, "description" => $key);
- }
- return $ret;
- }
/**
* Generates a list of service bodies to be used in the admin UI's drop downs.
*
@@ -177,7 +108,9 @@ public function generateMainQuery($json = 'json')
}
public function doMainQuery()
{
- if ($this->preloaded !== null) return $this->preloaded['mainResults'];
+ if ($this->preloaded !== null) {
+ return $this->preloaded['mainResults'];
+ }
return $this->get_configured_root_server_request($this->generateMainQuery());
}
public function generateExtraMeetingQuery($json = 'json')
@@ -199,7 +132,9 @@ public function generateExtraMeetingQuery($json = 'json')
}
public function doExtraMeetingQuery()
{
- if ($this->preloaded !== null) return $this->preloaded['extraMeetings'];
+ if ($this->preloaded !== null) {
+ return $this->preloaded['extraMeetings'];
+ }
return $this->get_configured_root_server_request($this->generateExtraMeetingQuery());
}
public function generateAdditionalListQuery($json = 'json')
@@ -220,7 +155,9 @@ public function doAdditionalListQuery()
if ($url == null) {
return [];
}
- if ($this->preloaded !== null) return $this->preloaded['additionalListMeetings'];
+ if ($this->preloaded !== null) {
+ return $this->preloaded['additionalListMeetings'];
+ }
return $this->get_configured_root_server_request($url);
}
/**
@@ -264,36 +201,6 @@ public function testRootServer(string $override_root_server = null): array|bool
return json_decode(wp_remote_retrieve_body($results), true);
}
- /**
- * This is used from the AdminUI, not to generate the meeting list.
- *
- * @param boolean $all should we get all the formats defined in the root server, or only those used in the service body. This respects the option recurse_service_bodies but only the first service body.
- * @return array the formats
- */
- public function getFormatsForSelect(bool $all = false): array
- {
- if ($all) {
- $results = $this->get_configured_root_server_request("client_interface/json/?switcher=GetFormats");
- $this->sortBySubkey($results, 'key_string');
- return $results;
- }
- $area_data = explode(',', $this->bread->getOption('service_body_1'));
- $service_body_id = $this->bread->arraySafeGet($area_data, 1);
- if ($this->bread->getOption('recurse_service_bodies') == 1) {
- $services = '&recursive=1&services[]=' . $service_body_id;
- } else {
- $services = '&services[]=' . $service_body_id;
- }
- if (empty($service_body_id)) {
- $queryUrl = "client_interface/json/?switcher=GetFormats";
- } else {
- $queryUrl = "client_interface/json/?switcher=GetSearchResults$services&get_formats_only";
- }
- $results = $this->get_configured_root_server_request($queryUrl);
- $results = empty($service_body_id) ? $results : $results['formats'];
- $this->sortBySubkey($results, 'key_string');
- return $results;
- }
/**
* Convenient front end to array_multisort. Sorts the array in place.
*
@@ -325,27 +232,14 @@ public function generateDefaultQuery(): string
// only the name of the service body. So we cache the value so it only
// needs to be called once.
if (!$this->default_query) {
- $this->default_query = $this->addServiceBody('service_body_1');
- $this->default_query .= $this->addServiceBody('service_body_2');
- $this->default_query .= $this->addServiceBody('service_body_3');
- $this->default_query .= $this->addServiceBody('service_body_4');
- $this->default_query .= $this->addServiceBody('service_body_5');
- }
- return $this->default_query;
- }
- private function addServiceBody($service_body_name)
- {
- if (false === ($this->bread->getOption($service_body_name) == 'Not Used')) {
- $area_data = explode(',', $this->bread->getOption($service_body_name));
- $area = $this->bread->arraySafeGet($area_data);
- $this->bread->setOption($service_body_name, ($area == 'NOT USED' ? '' : $area));
- $service_body_id = $this->bread->arraySafeGet($area_data, 1);
- if ($this->bread->getOption('recurse_service_bodies') == 1) {
- return '&recursive=1&services[]=' . $service_body_id;
- } else {
- return '&services[]=' . $service_body_id;
+ $this->default_query = ($this->bread->getOption('recurse_service_bodies') == 1) ? '&recursive=1' : '';
+ for ($i=0; $ibread->getOption('service_bodies')); $i++) {
+ $area_data = explode(',', $this->bread->getOption('service_bodies')[$i]);
+ $service_body_id = $this->bread->arraySafeGet($area_data, 1);
+ $this->default_query .= '&services[]=' . $service_body_id;
}
}
+ return $this->default_query;
}
public function parse_field($text)
{
diff --git a/includes/class-bread.php b/includes/class-bread.php
index cd80cc11..0903908f 100644
--- a/includes/class-bread.php
+++ b/includes/class-bread.php
@@ -780,7 +780,7 @@ private function upgrade_settings(): void
$this->renamed_option('asm_language', 'additional_list_language');
$this->renamed_option('asm_custom_query', 'additional_list_custom_query');
$this->renamed_option('asm_template_content', 'additional_list_template_content');
- if (!isset($this->options['bread_version']) || $this->options['bread_version'] < '2.8') {
+ if ($this->versionLessThan('2.8')) {
if (($this->options['page_fold'] == 'half' || $this->options['page_fold'] == 'full') && trim($this->options['last_page_content']) !== '') {
$this->options['custom_section_content'] = $this->options['last_page_content'];
$this->options['custom_section_font_size'] = $this->options['last_page_font_size'];
@@ -790,8 +790,51 @@ private function upgrade_settings(): void
unset($this->options['last_page_font_size']);
}
}
+ if ($this->versionLessThan('2.10')) {
+ $this->options['service_bodies'] = [];
+ if (!empty($this->options['service_body_1']) && $this->options['service_body_1'] != 'Not Used') {
+ $this->options['service_bodies'][] = $this->options['service_body_1'];
+ }
+ if (!empty($this->options['service_body_2']) && $this->options['service_body_2'] != 'Not Used') {
+ $this->options['service_bodies'][] = $this->options['service_body_2'];
+ }
+ if (!empty($this->options['service_body_3']) && $this->options['service_body_3'] != 'Not Used') {
+ $this->options['service_bodies'][] = $this->options['service_body_3'];
+ }
+ if (!empty($this->options['service_body_4']) && $this->options['service_body_4'] != 'Not Used') {
+ $this->options['service_bodies'][] = $this->options['service_body_4'];
+ }
+ if (!empty($this->options['service_body_5']) && $this->options['service_body_5'] != 'Not Used') {
+ $this->options['service_bodies'][] = $this->options['service_body_5'];
+ }
+ unset($this->options['service_body_1']);
+ unset($this->options['service_body_2']);
+ unset($this->options['service_body_3']);
+ unset($this->options['service_body_4']);
+ unset($this->options['service_body_5']);
+ }
$this->options['bread_version'] = BREAD_VERSION;
}
+ private function versionLessThan($version): bool
+ {
+ if (empty($this->options['bread_version'])) {
+ return true;
+ }
+ $current = explode('.', $this->options['bread_version']);
+ $test = explode('.', $version);
+ for ($i=0; $i= count($test)) {
+ return false;
+ }
+ if (intval($current[$i]) > intval($test[$i])) {
+ return false;
+ }
+ if (intval($current[$i]) < intval($test[$i])) {
+ return true;
+ }
+ }
+ return false;
+ }
private function renamed_option(string $old, string $new)
{
if (!empty($this->options[$old])) {
diff --git a/public/class-bread-content-generator.php b/public/class-bread-content-generator.php
index 6d6596b3..3c597224 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -122,7 +122,7 @@ function __construct(Mpdf $mpdf, Bread $bread, array $result_meetings, Bread_For
'[page_break]
' => ' ',
'[page_break]' => ' ',
'' => ' ',
- "[area]" => strtoupper($this->options['service_body_1']),
+ "[area]" => strtoupper($this->options['service_bodies'][0]),
'[new_column]
' => ' ',
'[new_column]
' => ' ',
'[new_column]' => ' ',
@@ -133,12 +133,12 @@ function __construct(Mpdf $mpdf, Bread $bread, array $result_meetings, Bread_For
"[month]" => strtoupper(gmdate("F")),
"[day]" => strtoupper(gmdate("j")),
"[year]" => strtoupper(gmdate("Y")),
- "[service_body]" => strtoupper($this->options['service_body_1']),
- "[service_body_1]" => strtoupper($this->options['service_body_1']),
- "[service_body_2]" => strtoupper($this->options['service_body_2']),
- "[service_body_3]" => strtoupper($this->options['service_body_3']),
- "[service_body_4]" => strtoupper($this->options['service_body_4']),
- "[service_body_5]" => strtoupper($this->options['service_body_5']),
+ "[service_body]" => strtoupper($this->options['service_bodies'][0]),
+ "[service_body_1]" => strtoupper($this->options['service_bodies'][0]),
+ "[service_body_2]" => (count($this->options['service_bodies']) > 1) ? strtoupper($this->options['service_bodies'][1]) : 'Not Used',
+ "[service_body_3]" => (count($this->options['service_bodies']) > 2) ? strtoupper($this->options['service_bodies'][2]) : 'Not Used',
+ "[service_body_4]" => (count($this->options['service_bodies']) > 3) ? strtoupper($this->options['service_bodies'][3]) : 'Not Used',
+ "[service_body_5]" => (count($this->options['service_bodies']) > 4) ? strtoupper($this->options['service_bodies'][4]) : 'Not Used',
);
$this->shortcodes = apply_filters("Bread_Section_Shortcodes", $this->shortcodes, $this->bread->bmlt()->get_areas(), $formatsManager->getFormatsUsed());
diff --git a/public/class-bread-public.php b/public/class-bread-public.php
index 4e06b87b..cf9c4e4a 100644
--- a/public/class-bread-public.php
+++ b/public/class-bread-public.php
@@ -163,7 +163,7 @@ public function bmlt_meeting_list()
echo 'bread Error: BMLT Server missing. Please go to Settings -> bread and verify BMLT Server
';
exit;
}
- if ($this->options['service_body_1'] == 'Not Used' && true === ($this->options['custom_query'] == '')) {
+ if (count($this->options['service_bodies']) == 0 && true === ($this->options['custom_query'] == '')) {
echo 'bread Error: Service Body 1 missing from configuration. Please go to Settings -> bread and verify Service Body Contact the bread administrator and report this problem!
';
exit;
}
@@ -301,7 +301,7 @@ public function bmlt_meeting_list()
$transient_key = $this->bread->get_TransientKey($this->bread->getRequestedSetting());
set_transient($transient_key, $content, intval($this->options['cache_time']) * HOUR_IN_SECONDS);
}
- $FilePath = apply_filters("Bread_Download_Name", $this->get_FilePath(), $this->options['service_body_1'], $this->bread->getSettingName($this->bread->getRequestedSetting()));
+ $FilePath = apply_filters("Bread_Download_Name", $this->get_FilePath(), $this->options['service_bodies'][0], $this->bread->getSettingName($this->bread->getRequestedSetting()));
$this->mpdf->Output($FilePath, 'I');
}
foreach ($import_streams as $FilePath => $stream) {
From 49317099f0e86cee604d53968f9cec085e757633 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Sat, 30 May 2026 17:12:12 +0200
Subject: [PATCH 04/17] live extra-meetings
---
.github/workflows/pull-requests.yml | 2 +-
admin/js/bmlt_meeting_list.js | 1026 ++++++++++++++-----------
admin/partials/_bmlt_server_setup.php | 7 +-
3 files changed, 565 insertions(+), 470 deletions(-)
diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml
index 20f8d809..32cf7166 100644
--- a/.github/workflows/pull-requests.yml
+++ b/.github/workflows/pull-requests.yml
@@ -32,7 +32,7 @@ jobs:
unzip "${BUILD_DIR}/${ZIP_FILENAME}" -d "./bread"
- name: Run plugin check
- uses: wordpress/plugin-check-action@v1
+ uses: wordpress/plugin-check-action@v1.0.6
with:
build-dir: "./bread"
exclude-directories: 'vendor'
diff --git a/admin/js/bmlt_meeting_list.js b/admin/js/bmlt_meeting_list.js
index a0134626..0b39bd26 100644
--- a/admin/js/bmlt_meeting_list.js
+++ b/admin/js/bmlt_meeting_list.js
@@ -1,506 +1,600 @@
-
-jQuery(document).ready(
- function($) {
- $(".connecting").hide();
- $(".saving").hide();
- $(".bmlt-accordion").accordion(
- {
- heightStyle: "content",
- active: false,
- collapsible: true
- }
- );
- $(".bmlt_color").spectrum({preferredFormat: 'hex', showInput: true, showPalette: false});
- $("#col_color").on("click", () => $("#triggerSet").spectrum("set", this.val()));
- $("#bmlt_meeting_list_options").on(
- "keypress", function(event) {
- if(event.which == 13 && !event.shiftKey) {
- event.preventDefault();
- return false;
- }
- }
- );
- $(".gears-working").click(
- function(e) {
- $(".saving").show();
- }
- );
- $('input[name="submit_import_file"]').on(
- 'click', function(e) {
- e.preventDefault();
- var import_file_val = $('input[name=import_file]').val();
- if(import_file_val == false) {
- $('#nofileModal').dialog('open');
- } else {
- $('#basicModal').dialog('open');
- }
- }
- );
- $("#nofileModal").dialog(
- {
- autoOpen: false,
- modal: true,
- buttons: {
- Ok: function() {
- $(this).dialog("close");
- }
- }
- }
- );
- $('#basicModal').dialog({
- autoOpen: false,
- width: 'auto',
- title: "Are you sure?",
- modal: true,
- buttons: {
- "Confirm": function(e) {
- $(this).dialog('close');
- $(".saving").show();
- $('#form_import_file').submit();
- },
- "Cancel": function() {
- $(this).dialog('close');
- }
- }
- });
- $('.my-tooltip').each(function(i, e) {
- $(e).tooltipster(
- {
- contentAsHTML: true,
- theme: 'tooltipster-noir',
- trigger: 'click'
- }
- )
- });
- $("#meeting-list-tabs").tabs(
- {
- active: 0
- }
- );
- $('#meeting-list-tabs').tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
- $("#container").removeClass('hide');
- var meeting_sort_val = $("#meeting_sort").val();
- $('.borough_by_suffix').hide();
- $('.county_by_suffix').hide();
- if(meeting_sort_val === 'borough_county') {
- $('.borough_by_suffix').show();
- $('.county_by_suffix').show();
- } else if(meeting_sort_val === 'borough') {
- $('.borough_by_suffix').show();
- } else if(meeting_sort_val === 'county') {
- $('.county_by_suffix').show();
- }
- $('.neighborhood_by_suffix').hide();
- $('.city_by_suffix').hide();
- if(meeting_sort_val === 'neighborhood_city') {
- $('.neighborhood_by_suffix').show();
- $('.city_by_suffix').show();
- }
- var user_defined_sub = false;
- $('.user_defined_headings').hide();
- if(meeting_sort_val === 'user_defined') {
- $('.user_defined_headings').show();
- if($("#subgrouping").val() != '') {
- user_defined_sub = true;
- }
- }
- if(meeting_sort_val == 'weekday_area'
- || meeting_sort_val == 'weekday_city'
- || meeting_sort_val == 'weekday_county'
- || meeting_sort_val == 'state'
- || user_defined_sub
- ) {
- $('.show_subheader').show();
- } else {
- $('.show_subheader').hide();
- }
- $("#suppress_heading").click(
- function() {
- var val = $("#suppress_heading:checked").val();
- if(val == 1) {
- $("#header_options_div").hide();
- } else {
- $("#header_options_div").show();
- }
- }
- );
- $("#meeting_sort").change(
- function() {
- var meeting_sort_val = $("#meeting_sort").val();
- $('.borough_by_suffix').hide();
- $('.county_by_suffix').hide();
- $('.neighborhood_by_suffix').hide();
- $('.city_by_suffix').hide();
- if(meeting_sort_val === 'borough_county') {
- $('.borough_by_suffix').show();
- $('.county_by_suffix').show();
- } else if(meeting_sort_val === 'borough') {
- $('.borough_by_suffix').show();
- } else if(meeting_sort_val === 'county') {
- $('.county_by_suffix').show();
- }
- if(meeting_sort_val === 'neighborhood_city') {
- $('.neighborhood_by_suffix').show();
- $('.city_by_suffix').show();
- }
- var user_defined_sub = false;
- $('.user_defined_headings').hide();
- if(meeting_sort_val === 'user_defined') {
- $('.user_defined_headings').show();
- if($("#subgrouping").val() != '') {
- user_defined_sub = true;
- }
- }
- if(meeting_sort_val == 'weekday_area'
- || meeting_sort_val == 'weekday_city'
- || meeting_sort_val == 'weekday_county'
- || meeting_sort_val == 'state'
- || user_defined_sub
- ) {
- $('.show_subheader').show();
- } else {
- $('.show_subheader').hide();
- }
- }
- );
- $("#subgrouping").click(
- function() {
- $('.user_defined_headings').hide();
- if($("#meeting_sort").val() === 'user_defined') {
- $('.user_defined_headings').show();
- if($("#subgrouping").val() != '') {
- $('.show_subheader').show();
- } else {
- $('.show_subheader').hide();
- }
- }
- }
- );
- function calcTimeDisplay(hasEndTime) {
- let clock = $('input[name=time_clock]:checked').val();
- let removeSpaces = $('input[name=remove_space]:checked').val()
- let startTime = '8:00 PM';
- let endTime = '9:00 PM';
- if(clock == '24') {
- startTime = '20:00';
- endTime = '21:00';
- } else if(clock == '24fr') {
- startTime = '20h00';
- endTime = '21h00';
- }
- if(hasEndTime == 2) {
- startTime += ' - ' + endTime;
- }
- if(hasEndTime == 3) {
- startTime = clock == '12' ? '8 - 9' : '';
- }
- if(removeSpaces != "0") {
- startTime = startTime.replaceAll(' ', '');
- }
- return startTime;
- }
- function setTimeOptionText() {
- $('label[for=option1]').html(calcTimeDisplay(1));
- $('label[for=option2]').html(calcTimeDisplay(2));
- $('label[for=option3]').html(calcTimeDisplay(3));
- if($('input[name=time_clock]:checked').val() != '12') {
- if($('input[name=time_clock]:checked').val() == 3)
- $('#option2').prop('checked', true);
- $('#option3').hide();
- } else $('#option3').show();
- };
- setTimeOptionText();
- $('.recalcTimeLabel').on('click', setTimeOptionText);
- function bookletControlsShowHide() {
- $('#half').prop('checked') && $('#landscape').prop("checked", true);
- $('#full').prop('checked') && $('#portrait').prop("checked", true);
- $('.booklet').show();
- $('.single-page').hide();
- $('#half').prop('checked') && $('#A6').hide();
- $('#half').prop('checked') && $('#A6').hide();
- $('#half').prop('checked') && $("label[for=A6]").hide();
- }
- function singlePageControlsShowHide() {
- $('.booklet').hide();
- $('.single-page').show();
- }
- $('.single-page-check').on('click', singlePageControlsShowHide);
- $('.booklet-check').on('click', bookletControlsShowHide);
- $('input[name=page_fold]:checked').hasClass('booklet-check') && bookletControlsShowHide();
- $('input[name=page_fold]:checked').hasClass('single-page-check') && singlePageControlsShowHide();
- $("#service_bodies").select2();
- $('#extra_meetings').select2(
- {
- placeholder: "Select extra meetings",
- }
- );
- $("#bread_author_select").select2(
- {
- placeholder: "Select authors",
- }
- );
- $('.bread-select').on("change", function (e) {
- const self = $(this);
- const field = self.parent().find('.select2-search--inline');
- field.css('display', (self.val().length == 0 ? 'contents' : 'block'));
- field.find('input').css('width', (self.val().length == 0 ? '100%' : 'auto'));
- });
- $("#meeting-list-tabs").tabs(
- {
- active: 0
- }
- );
- $("#meeting-list-tabs-wrapper").removeClass('hide');
- // Define friendly index name
- var index = 'key';
- // Define friendly data store name
- var dataStore = window.sessionStorage;
- // Start magic!
- try {
- // getter: Fetch previous value
- var oldIndex = dataStore.getItem(index);
- } catch(e) {
- // getter: Always default to first tab in error state
- var oldIndex = 0;
- }
- $('#meeting-list-tabs').tabs(
- {
- // The zero-based index of the panel that is active (open)
- active: oldIndex,
- // Triggered after a tab has been activated
- activate: function(event, ui) {
- // Get future value
- var newIndex = ui.newTab.parent().children().index(ui.newTab);
- // Set future value
- dataStore.setItem(index, newIndex)
- }
- }
- );
- var aggregator = "https://aggregator.bmltenabled.org/main_server";
- $(window).on(
- "load", function() {
- if($('#use_aggregator').is(':checked')) {
- $("#root_server").prop("readonly", true);
- }
- }
- );
- $('#use_aggregator').click(
- function() {
- if($(this).is(':checked')) {
- $("#root_server").val(aggregator);
- $("#root_server").prop("readonly", true);
- } else {
- $("#root_server").val("");
- $("#root_server").prop("readonly", false);
- }
- }
- );
- var rootServerValue = $('#root_server').val();
- if(~rootServerValue.indexOf(aggregator)) {
- $("#use_aggregator").prop("checked", true);
- }
- $(".service_body_select").select2({
- width: "40%"
+jQuery(document).ready(function ($) {
+ $(".connecting").hide();
+ $(".saving").hide();
+ $(".bmlt-accordion").accordion({
+ heightStyle: "content",
+ active: false,
+ collapsible: true,
+ });
+ $(".bmlt_color").spectrum({
+ preferredFormat: "hex",
+ showInput: true,
+ showPalette: false,
+ });
+ $("#col_color").on("click", () =>
+ $("#triggerSet").spectrum("set", this.val()),
+ );
+ $("#bmlt_meeting_list_options").on("keypress", function (event) {
+ if (event.which == 13 && !event.shiftKey) {
+ event.preventDefault();
+ return false;
+ }
+ });
+ $(".gears-working").click(function (e) {
+ $(".saving").show();
+ });
+ $('input[name="submit_import_file"]').on("click", function (e) {
+ e.preventDefault();
+ var import_file_val = $("input[name=import_file]").val();
+ if (import_file_val == false) {
+ $("#nofileModal").dialog("open");
+ } else {
+ $("#basicModal").dialog("open");
+ }
+ });
+ $("#nofileModal").dialog({
+ autoOpen: false,
+ modal: true,
+ buttons: {
+ Ok: function () {
+ $(this).dialog("close");
+ },
+ },
+ });
+ $("#basicModal").dialog({
+ autoOpen: false,
+ width: "auto",
+ title: "Are you sure?",
+ modal: true,
+ buttons: {
+ Confirm: function (e) {
+ $(this).dialog("close");
+ $(".saving").show();
+ $("#form_import_file").submit();
+ },
+ Cancel: function () {
+ $(this).dialog("close");
+ },
+ },
+ });
+ $(".my-tooltip").each(function (i, e) {
+ $(e).tooltipster({
+ contentAsHTML: true,
+ theme: "tooltipster-noir",
+ trigger: "click",
+ });
+ });
+ $("#meeting-list-tabs").tabs({
+ active: 0,
+ });
+ $("#meeting-list-tabs")
+ .tabs()
+ .addClass("ui-tabs-vertical ui-helper-clearfix");
+ $("#container").removeClass("hide");
+ var meeting_sort_val = $("#meeting_sort").val();
+ $(".borough_by_suffix").hide();
+ $(".county_by_suffix").hide();
+ if (meeting_sort_val === "borough_county") {
+ $(".borough_by_suffix").show();
+ $(".county_by_suffix").show();
+ } else if (meeting_sort_val === "borough") {
+ $(".borough_by_suffix").show();
+ } else if (meeting_sort_val === "county") {
+ $(".county_by_suffix").show();
+ }
+ $(".neighborhood_by_suffix").hide();
+ $(".city_by_suffix").hide();
+ if (meeting_sort_val === "neighborhood_city") {
+ $(".neighborhood_by_suffix").show();
+ $(".city_by_suffix").show();
+ }
+ var user_defined_sub = false;
+ $(".user_defined_headings").hide();
+ if (meeting_sort_val === "user_defined") {
+ $(".user_defined_headings").show();
+ if ($("#subgrouping").val() != "") {
+ user_defined_sub = true;
+ }
+ }
+ if (
+ meeting_sort_val == "weekday_area" ||
+ meeting_sort_val == "weekday_city" ||
+ meeting_sort_val == "weekday_county" ||
+ meeting_sort_val == "state" ||
+ user_defined_sub
+ ) {
+ $(".show_subheader").show();
+ } else {
+ $(".show_subheader").hide();
+ }
+ $("#suppress_heading").click(function () {
+ var val = $("#suppress_heading:checked").val();
+ if (val == 1) {
+ $("#header_options_div").hide();
+ } else {
+ $("#header_options_div").show();
+ }
+ });
+ $("#meeting_sort").change(function () {
+ var meeting_sort_val = $("#meeting_sort").val();
+ $(".borough_by_suffix").hide();
+ $(".county_by_suffix").hide();
+ $(".neighborhood_by_suffix").hide();
+ $(".city_by_suffix").hide();
+ if (meeting_sort_val === "borough_county") {
+ $(".borough_by_suffix").show();
+ $(".county_by_suffix").show();
+ } else if (meeting_sort_val === "borough") {
+ $(".borough_by_suffix").show();
+ } else if (meeting_sort_val === "county") {
+ $(".county_by_suffix").show();
+ }
+ if (meeting_sort_val === "neighborhood_city") {
+ $(".neighborhood_by_suffix").show();
+ $(".city_by_suffix").show();
+ }
+ var user_defined_sub = false;
+ $(".user_defined_headings").hide();
+ if (meeting_sort_val === "user_defined") {
+ $(".user_defined_headings").show();
+ if ($("#subgrouping").val() != "") {
+ user_defined_sub = true;
+ }
+ }
+ if (
+ meeting_sort_val == "weekday_area" ||
+ meeting_sort_val == "weekday_city" ||
+ meeting_sort_val == "weekday_county" ||
+ meeting_sort_val == "state" ||
+ user_defined_sub
+ ) {
+ $(".show_subheader").show();
+ } else {
+ $(".show_subheader").hide();
+ }
+ });
+ $("#subgrouping").click(function () {
+ $(".user_defined_headings").hide();
+ if ($("#meeting_sort").val() === "user_defined") {
+ $(".user_defined_headings").show();
+ if ($("#subgrouping").val() != "") {
+ $(".show_subheader").show();
+ } else {
+ $(".show_subheader").hide();
+ }
+ }
+ });
+ function calcTimeDisplay(hasEndTime) {
+ let clock = $("input[name=time_clock]:checked").val();
+ let removeSpaces = $("input[name=remove_space]:checked").val();
+ let startTime = "8:00 PM";
+ let endTime = "9:00 PM";
+ if (clock == "24") {
+ startTime = "20:00";
+ endTime = "21:00";
+ } else if (clock == "24fr") {
+ startTime = "20h00";
+ endTime = "21h00";
+ }
+ if (hasEndTime == 2) {
+ startTime += " - " + endTime;
+ }
+ if (hasEndTime == 3) {
+ startTime = clock == "12" ? "8 - 9" : "";
+ }
+ if (removeSpaces != "0") {
+ startTime = startTime.replaceAll(" ", "");
+ }
+ return startTime;
+ }
+ function setTimeOptionText() {
+ $("label[for=option1]").html(calcTimeDisplay(1));
+ $("label[for=option2]").html(calcTimeDisplay(2));
+ $("label[for=option3]").html(calcTimeDisplay(3));
+ if ($("input[name=time_clock]:checked").val() != "12") {
+ if ($("input[name=time_clock]:checked").val() == 3)
+ $("#option2").prop("checked", true);
+ $("#option3").hide();
+ } else $("#option3").show();
+ }
+ setTimeOptionText();
+ $(".recalcTimeLabel").on("click", setTimeOptionText);
+ function bookletControlsShowHide() {
+ $("#half").prop("checked") && $("#landscape").prop("checked", true);
+ $("#full").prop("checked") && $("#portrait").prop("checked", true);
+ $(".booklet").show();
+ $(".single-page").hide();
+ $("#half").prop("checked") && $("#A6").hide();
+ $("#half").prop("checked") && $("#A6").hide();
+ $("#half").prop("checked") && $("label[for=A6]").hide();
+ }
+ function singlePageControlsShowHide() {
+ $(".booklet").hide();
+ $(".single-page").show();
+ }
+ $(".single-page-check").on("click", singlePageControlsShowHide);
+ $(".booklet-check").on("click", bookletControlsShowHide);
+ $("input[name=page_fold]:checked").hasClass("booklet-check") &&
+ bookletControlsShowHide();
+ $("input[name=page_fold]:checked").hasClass("single-page-check") &&
+ singlePageControlsShowHide();
+ $("#service_bodies").select2();
+ $("#extra_meetings").select2({
+ placeholder: "Select extra meetings",
+ });
+ $("#bread_author_select").select2({
+ placeholder: "Select authors",
+ });
+ $(".bread-select").on("change", function (e) {
+ const self = $(this);
+ const field = self.parent().find(".select2-search--inline");
+ field.css("display", self.val().length == 0 ? "contents" : "block");
+ field
+ .find("input")
+ .css("width", self.val().length == 0 ? "100%" : "auto");
+ });
+ $("#meeting-list-tabs").tabs({
+ active: 0,
+ });
+ $("#meeting-list-tabs-wrapper").removeClass("hide");
+ // Define friendly index name
+ var index = "key";
+ // Define friendly data store name
+ var dataStore = window.sessionStorage;
+ // Start magic!
+ try {
+ // getter: Fetch previous value
+ var oldIndex = dataStore.getItem(index);
+ } catch (e) {
+ // getter: Always default to first tab in error state
+ var oldIndex = 0;
+ }
+ $("#meeting-list-tabs").tabs({
+ // The zero-based index of the panel that is active (open)
+ active: oldIndex,
+ // Triggered after a tab has been activated
+ activate: function (event, ui) {
+ // Get future value
+ var newIndex = ui.newTab.parent().children().index(ui.newTab);
+ // Set future value
+ dataStore.setItem(index, newIndex);
+ },
+ });
+ var aggregator = "https://aggregator.bmltenabled.org/main_server";
+ $(window).on("load", function () {
+ if ($("#use_aggregator").is(":checked")) {
+ $("#root_server").prop("readonly", true);
+ }
+ });
+ $("#use_aggregator").click(function () {
+ if ($(this).is(":checked")) {
+ $("#root_server").val(aggregator);
+ $("#root_server").prop("readonly", true);
+ } else {
+ $("#root_server").val("");
+ $("#root_server").prop("readonly", false);
+ }
+ });
+ var rootServerValue = $("#root_server").val();
+ if (~rootServerValue.indexOf(aggregator)) {
+ $("#use_aggregator").prop("checked", true);
+ }
+ $(".service_body_select").select2({
+ width: "40%",
});
$(".theme_select").select2({
- width: "20%"
+ width: "20%",
});
$("#select_filters").select2({
- width: "60%"
+ width: "60%",
});
$("#extra_meetings").select2({
width: "60%",
placeholder: "Select Extra Meetings",
});
- handle_error = function(context, error) {
+ handle_error = function (context, error) {
console.log(error);
- }
- ask_bmlt = function(context, query, success, fail) {
- const url = $('#'+context.root_server).val()+"/client_interface/jsonp/?"+query;
- fetchJsonp(url)
- .then((response) => {
- if (response.ok) {
- return response.json();
- }
- return Promise.reject(response); // 2. reject instead of throw
- })
- .then((json) => {
- success(context, json);
- return json;
- })
- .catch((response) => {
- fail(context, response)
- return false;
- })
- }
- test_root_server = function() {
- const context = {
- root_server: 'root_server',
- service_bodies: 'service_bodies',
- service_bodies_selected: bread_admin.service_bodies_selected
- }
- if(!$('#root_server').val()) {
- $('#connected_message').hide();
- $('#disconnected_message').hide();
- fill_service_bodies(context, []);
- fill_extra_meetings(context, []);
+ };
+ ask_bmlt = function (context, query, success, fail) {
+ const url =
+ $("#" + context.root_server).val() +
+ "/client_interface/jsonp/?" +
+ query;
+ fetchJsonp(url)
+ .then((response) => {
+ if (response.ok) {
+ return response.json();
+ }
+ return Promise.reject(response); // 2. reject instead of throw
+ })
+ .then((json) => {
+ success(context, json);
+ return json;
+ })
+ .catch((response) => {
+ fail(context, response);
+ return false;
+ });
+ };
+ const admin_context = {
+ root_server: "root_server",
+ service_bodies: "service_bodies",
+ service_bodies_selected: bread_admin.service_bodies_selected,
+ };
+ test_root_server = function () {
+ if (!$("#root_server").val()) {
+ $("#connected_message").hide();
+ $("#disconnected_message").hide();
+ fill_service_bodies(admin_context, []);
+ fill_extra_meetings(admin_context, []);
return;
}
- ask_bmlt(context, "switcher=GetServerInfo",
+ ask_bmlt(
+ admin_context,
+ "switcher=GetServerInfo",
(context, info) => {
- $('#server_version').html(info[0].version);
- $('#connected_message').show();
- $('#disconnected_message').hide();
- ask_bmlt(context, 'switcher=GetServiceBodies', fill_service_bodies, handle_error);
- if($('#extra_meetings_enabled').is(':checked')) {
- $("#extra_meetings_select").hide();
- $("#fetching_meetings").show();
- ask_bmlt(context, 'switcher=GetSearchResults', fill_extra_meetings, handle_error);
- } else {
- fill_extra_meetings([], []);
- }
+ $("#server_version").html(info[0].version);
+ $("#connected_message").show();
+ $("#disconnected_message").hide();
+ ask_bmlt(
+ context,
+ "switcher=GetServiceBodies",
+ fill_service_bodies,
+ handle_error,
+ );
+ query_extra_meetings(context);
},
(context, error) => {
- console.log(error)
- $('#connected_message').hide();
- $('#disconnected_message').show();
+ console.log(error);
+ $("#connected_message").hide();
+ $("#disconnected_message").show();
fill_service_bodies(context, []);
fill_extra_meetings(context, []);
- }
+ },
);
- }
- test_root_server();
- write_service_body_with_childern = function(context, options, sb, parents, my_parent, level) {
- let prefix = '';
- for(i = 0;i < level;i++) prefix += '-';
- const sbVal = [sb.name, sb.id, sb.parent_id, my_parent].join(',');
- const option = '' + prefix + sb.name + '(' + sb.id +
- ') '
+ };
+ query_extra_meetings = function (context) {
+ if ($("#extra_meetings_enabled").is(":checked")) {
+ $("#extra_meetings_select").hide();
+ $("#fetching_meetings").show();
+ ask_bmlt(
+ context,
+ "switcher=GetSearchResults",
+ fill_extra_meetings,
+ handle_error,
+ );
+ } else {
+ fill_extra_meetings(context, []);
+ }
+ };
+ test_root_server();
+ $("#extra_meetings_enabled").on("change", function () {
+ query_extra_meetings(admin_context);
+ });
+ write_service_body_with_childern = function (
+ context,
+ options,
+ sb,
+ parents,
+ my_parent,
+ level,
+ ) {
+ let prefix = "";
+ for (i = 0; i < level; i++) prefix += "-";
+ const sbVal = [sb.name, sb.id, sb.parent_id, my_parent].join(",");
+ const option =
+ '" +
+ prefix +
+ sb.name +
+ "(" +
+ sb.id +
+ ") ";
options.push(option);
found = parents.find((p) => p.id == sb.id);
- if(typeof found !== 'undefined')
- found.children.forEach((child) =>
- options = write_service_body_with_childern(context, options, child, parents, sb.name, level + 1));
+ if (typeof found !== "undefined")
+ found.children.forEach(
+ (child) =>
+ (options = write_service_body_with_childern(
+ context,
+ options,
+ child,
+ parents,
+ sb.name,
+ level + 1,
+ )),
+ );
return options;
- }
- fill_service_bodies = function(context, service_bodies) {
- service_bodies = service_bodies.sort((a, b) => a.name.localeCompare(b.name));
- const roots = service_bodies.filter((sb) => sb.parent_id == '0');
+ };
+ fill_service_bodies = function (context, service_bodies) {
+ service_bodies = service_bodies.sort((a, b) =>
+ a.name.localeCompare(b.name),
+ );
+ const roots = service_bodies.filter((sb) => sb.parent_id == "0");
const parents = service_bodies.reduce((carry, item) => {
const found = carry.find((p) => p.id == item.parent_id);
- if(found) {
+ if (found) {
found.children.push(item);
} else {
- carry.push({id: item.parent_id, children: [item]})
+ carry.push({ id: item.parent_id, children: [item] });
}
return carry;
}, []);
let options = [];
roots.forEach((sb) => {
- options = write_service_body_with_childern(context, options, sb, parents, 'ROOT', 0);
+ options = write_service_body_with_childern(
+ context,
+ options,
+ sb,
+ parents,
+ "ROOT",
+ 0,
+ );
});
- $('#'+context.service_bodies).html(options.join(''));
+ $("#" + context.service_bodies).html(options.join(""));
- query_used_formats(context)
- }
- root_server_keypress = function(event) {
- if(event.code == 'Enter') {
+ query_used_formats(context);
+ };
+ root_server_keypress = function (event) {
+ if (event.code == "Enter") {
this.test_root_server();
event.preventDefault();
}
return true;
- }
- fill_extra_meetings = function(context, extra_meetings_array) {
+ };
+ fill_extra_meetings = function (context, extra_meetings_array) {
$("#fetching_meetings").hide();
- if($('#extra_meetings_enabled').is(':checked')) {
- $("#extra_meetings_select").show();
-
+ if ($("#extra_meetings_enabled").is(":checked")) {
+ $("#extra_meetings").next(".select2-container").show();
+ $("#extra_meetings_hint").show();
} else {
- $("#extra_meetings_select").hide();
+ $("#extra_meetings").next(".select2-container").hide();
+ $("#extra_meetings_hint").hide();
+ }
+ const options = extra_meetings_array.map(
+ (extra_meeting) =>
+ '" +
+ extra_meeting.meeting_name +
+ " [" +
+ extra_meeting.weekday_tinyint +
+ "][" +
+ extra_meeting.start_time +
+ "][" +
+ extra_meeting.location_municipality +
+ "][" +
+ extra_meeting.service_body_bigint +
+ "] ",
+ );
+ $("#extra_meetings").html(options.join(""));
+ };
+ fill_formats = function (context, formats) {
+ const select = (key) =>
+ bread_admin.used_format == key ? "selected" : "";
+ const options = formats.formats.reduce(
+ (carry, item) => {
+ carry.push(
+ '" +
+ item.name_string +
+ " ",
+ );
+ return carry;
+ },
+ ['All Meetings '],
+ );
+ $("#used_format_1").html(options.join(""));
+ fill_additional_list_formats(context, formats);
+ };
+ fill_additional_list_formats = function (context, formats) {
+ const select = (key) =>
+ bread_admin.additional_list_format_key == key ? "selected" : "";
+ const options = formats.formats.reduce(
+ (carry, item) => {
+ carry.push(
+ '" +
+ item.name_string +
+ " ",
+ );
+ return carry;
+ },
+ [
+ 'Not Used ',
+ 'Virtual Meetings ',
+ 'In-Person Meetings ',
+ ],
+ );
+ $("#additional_list_format_key").html(options.join(""));
+ };
+ query_used_formats = function (context) {
+ const serviceBodies = $("#service_bodies")
+ .val()
+ .map((s) => s.split(",")[1]);
+ if (serviceBodies.length == 0) {
+ fill_formats(context, []);
+ return;
}
- const options = extra_meetings_array.map((extra_meeting) =>
- '' +
- extra_meeting.meeting_name + ' [' + extra_meeting.weekday_tinyint + '][' + extra_meeting.start_time + '][' + extra_meeting.location_municipality + '][' + extra_meeting.service_body_bigint + '] ');
- $('#extra_meetings').html(options.join(''));
- }
- fill_formats = function(context, formats) {
- const select = (key) => (bread_admin.used_format==key) ? 'selected' : ''
- const options = formats.formats.reduce((carry,item) => {
- carry.push(''+item.name_string+' ');
- return carry;
- }, ['All Meetings ']);
- $('#used_format_1').html(options.join(''));
- fill_additional_list_formats(context, formats)
- }
- fill_additional_list_formats = function(context, formats) {
- const select = (key) => (bread_admin.additional_list_format_key==key) ? 'selected' : ''
- const options = formats.formats.reduce((carry,item) => {
- carry.push(''+item.name_string+' ');
- return carry;
- }, ['Not Used ',
- 'Virtual Meetings ',
- 'In-Person Meetings ',
- ]);
- $('#additional_list_format_key').html(options.join(''));
- }
- query_used_formats = function(context) {
- const serviceBodies = $('#service_bodies').val().map((s)=>s.split(',')[1])
- if (serviceBodies.length == 0) {
- fill_formats(context, []);
- return;
- }
- const query = serviceBodies.reduce((carry, item) => {
- return carry + "&services[]=" + item
- }, $("#recurse_service_bodies").is(':checked') ? '&recursive=1' : '')
- ask_bmlt(context, "switcher=GetSearchResults&get_formats_only"+query, fill_formats, handle_error);
- }
-/**
- * Get Tab Key
- */
-function getTabKey(href) {
- return href.replace('#', '');
-}
-/**
- * Hide all tabs
- */
-function hideAllTabs() {
- tabs.each(function() {
- var href = getTabKey(jQuery(this).attr('href'));
- jQuery('#' + href).hide();
- });
-}
-/**
- * Activate Tab
- */
-function activateTab(tab) {
- var href = getTabKey(tab.attr('href'));
- tabs.removeClass('nav-tab-active');
- tab.addClass('nav-tab-active');
- jQuery('#' + href).show();
-}
- var activeTab, firstTab;
- // First load, activate first tab or tab with nav-tab-active class
- firstTab = false;
- activeTab = false;
- tabs = $('a.nav-tab');
- hideAllTabs();
- tabs.each(function() {
- var href = $(this).attr('href').replace('#', '');
- if(!firstTab) {
- firstTab = $(this);
- }
- if($(this).hasClass('nav-tab-active')) {
- activeTab = $(this);
- }
- });
- if(!activeTab) {
- activeTab = firstTab;
- }
- activateTab(activeTab);
- //Click tab
- tabs.click(function(e) {
- e.preventDefault();
- hideAllTabs();
- activateTab($(this));
- });
+ const query = serviceBodies.reduce(
+ (carry, item) => {
+ return carry + "&services[]=" + item;
+ },
+ $("#recurse_service_bodies").is(":checked") ? "&recursive=1" : "",
+ );
+ ask_bmlt(
+ context,
+ "switcher=GetSearchResults&get_formats_only" + query,
+ fill_formats,
+ handle_error,
+ );
+ };
+ /**
+ * Get Tab Key
+ */
+ function getTabKey(href) {
+ return href.replace("#", "");
+ }
+ /**
+ * Hide all tabs
+ */
+ function hideAllTabs() {
+ tabs.each(function () {
+ var href = getTabKey(jQuery(this).attr("href"));
+ jQuery("#" + href).hide();
+ });
+ }
+ /**
+ * Activate Tab
+ */
+ function activateTab(tab) {
+ var href = getTabKey(tab.attr("href"));
+ tabs.removeClass("nav-tab-active");
+ tab.addClass("nav-tab-active");
+ jQuery("#" + href).show();
+ }
+ var activeTab, firstTab;
+ // First load, activate first tab or tab with nav-tab-active class
+ firstTab = false;
+ activeTab = false;
+ tabs = $("a.nav-tab");
+ hideAllTabs();
+ tabs.each(function () {
+ var href = $(this).attr("href").replace("#", "");
+ if (!firstTab) {
+ firstTab = $(this);
+ }
+ if ($(this).hasClass("nav-tab-active")) {
+ activeTab = $(this);
+ }
+ });
+ if (!activeTab) {
+ activeTab = firstTab;
+ }
+ activateTab(activeTab);
+ //Click tab
+ tabs.click(function (e) {
+ e.preventDefault();
+ hideAllTabs();
+ activateTab($(this));
+ });
});
diff --git a/admin/partials/_bmlt_server_setup.php b/admin/partials/_bmlt_server_setup.php
index 311113b3..a82c522c 100644
--- a/admin/partials/_bmlt_server_setup.php
+++ b/admin/partials/_bmlt_server_setup.php
@@ -86,11 +86,12 @@ function Bread_bmlt_server_setup_page_render(Bread_AdminDisplay $breadAdmin)
(?)
- isConnected() && $bread->getOption('extra_meetings_enabled') == 1) {?>
+
+ Fetching meetings from server...
+
-
-
+
emptyOption('extra_meetings_enabled') && $bread->getOption('extra_meetings_enabled') == 1 ? 'checked' : '') ?> />
From c38c90dbf064059dd721c43494e1900eaed53b6b Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Sat, 30 May 2026 17:39:36 +0200
Subject: [PATCH 05/17] Trying to get plugin checker to run
---
.github/workflows/pull-requests.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml
index 32cf7166..1f86e598 100644
--- a/.github/workflows/pull-requests.yml
+++ b/.github/workflows/pull-requests.yml
@@ -6,7 +6,7 @@ on:
jobs:
lint:
- runs-on: ubuntu-22.04
+ runs-on: ubuntu24/20260518.149
env:
PLUGIN: bread
BUILD_DIR: build
@@ -32,7 +32,7 @@ jobs:
unzip "${BUILD_DIR}/${ZIP_FILENAME}" -d "./bread"
- name: Run plugin check
- uses: wordpress/plugin-check-action@v1.0.6
+ uses: wordpress/plugin-check-action@v1
with:
build-dir: "./bread"
exclude-directories: 'vendor'
From c260422bc38ce7e28eb125ae43f8b6c10360d950 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Sat, 30 May 2026 21:00:57 +0200
Subject: [PATCH 06/17] Removed plugin-checker until bug is fixed
---
.github/workflows/pull-requests.yml | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml
index 1f86e598..86e9e4d1 100644
--- a/.github/workflows/pull-requests.yml
+++ b/.github/workflows/pull-requests.yml
@@ -6,7 +6,7 @@ on:
jobs:
lint:
- runs-on: ubuntu24/20260518.149
+ runs-on: ubuntu-22.04
env:
PLUGIN: bread
BUILD_DIR: build
@@ -30,11 +30,10 @@ jobs:
echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV
PROD=1 make build
unzip "${BUILD_DIR}/${ZIP_FILENAME}" -d "./bread"
-
- - name: Run plugin check
- uses: wordpress/plugin-check-action@v1
- with:
- build-dir: "./bread"
- exclude-directories: 'vendor'
- categories: 'plugin_repo'
- ignore-warnings: true
+# Removed until https://github.com/WordPress/plugin-check-action/issues/579 is fixed
+# - name: Run plugin check
+# uses: wordpress/plugin-check-action@v1
+# with:
+# exclude-directories: 'vendor'
+# categories: 'plugin_repo'
+# ignore-warnings: true
From 585d48eb8443f3b159cd2b078bd28adc729e22fc Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Sun, 31 May 2026 20:11:56 +0200
Subject: [PATCH 07/17] Avoid namespace conflicts with wizard
---
admin/js/bmlt_meeting_list.js | 62 +++++++--------
admin/js/bread-wizard.js | 125 ++++++++++++++++++++-----------
admin/partials/_bread_wizard.php | 12 +--
3 files changed, 114 insertions(+), 85 deletions(-)
diff --git a/admin/js/bmlt_meeting_list.js b/admin/js/bmlt_meeting_list.js
index 0b39bd26..b6f68ef3 100644
--- a/admin/js/bmlt_meeting_list.js
+++ b/admin/js/bmlt_meeting_list.js
@@ -292,12 +292,12 @@
width: "60%",
placeholder: "Select Extra Meetings",
});
- handle_error = function (context, error) {
+ handle_error = function (error) {
console.log(error);
};
- ask_bmlt = function (context, query, success, fail) {
+ ask_bmlt = function (query, success, fail) {
const url =
- $("#" + context.root_server).val() +
+ $("#root_server").val() +
"/client_interface/jsonp/?" +
query;
fetchJsonp(url)
@@ -308,71 +308,62 @@
return Promise.reject(response); // 2. reject instead of throw
})
.then((json) => {
- success(context, json);
+ success(json);
return json;
})
.catch((response) => {
- fail(context, response);
+ fail(response);
return false;
});
};
- const admin_context = {
- root_server: "root_server",
- service_bodies: "service_bodies",
- service_bodies_selected: bread_admin.service_bodies_selected,
- };
test_root_server = function () {
if (!$("#root_server").val()) {
$("#connected_message").hide();
$("#disconnected_message").hide();
- fill_service_bodies(admin_context, []);
- fill_extra_meetings(admin_context, []);
+ fill_service_bodies([]);
+ fill_extra_meetings([]);
return;
}
ask_bmlt(
- admin_context,
"switcher=GetServerInfo",
- (context, info) => {
+ (info) => {
$("#server_version").html(info[0].version);
$("#connected_message").show();
$("#disconnected_message").hide();
ask_bmlt(
- context,
"switcher=GetServiceBodies",
fill_service_bodies,
handle_error,
);
- query_extra_meetings(context);
+ query_extra_meetings();
},
- (context, error) => {
+ (error) => {
console.log(error);
$("#connected_message").hide();
$("#disconnected_message").show();
- fill_service_bodies(context, []);
- fill_extra_meetings(context, []);
+ fill_service_bodies([]);
+ fill_extra_meetings([]);
},
);
};
- query_extra_meetings = function (context) {
+ query_extra_meetings = function () {
if ($("#extra_meetings_enabled").is(":checked")) {
$("#extra_meetings_select").hide();
$("#fetching_meetings").show();
ask_bmlt(
- context,
"switcher=GetSearchResults",
fill_extra_meetings,
handle_error,
);
} else {
- fill_extra_meetings(context, []);
+ fill_extra_meetings([]);
}
};
test_root_server();
$("#extra_meetings_enabled").on("change", function () {
- query_extra_meetings(admin_context);
+ query_extra_meetings();
});
write_service_body_with_childern = function (
- context,
options,
sb,
parents,
@@ -386,7 +377,7 @@
'
" +
@@ -401,7 +392,6 @@
found.children.forEach(
(child) =>
(options = write_service_body_with_childern(
- context,
options,
child,
parents,
@@ -411,7 +401,7 @@
);
return options;
};
- fill_service_bodies = function (context, service_bodies) {
+ fill_service_bodies = function (service_bodies) {
service_bodies = service_bodies.sort((a, b) =>
a.name.localeCompare(b.name),
);
@@ -428,7 +418,6 @@
let options = [];
roots.forEach((sb) => {
options = write_service_body_with_childern(
- context,
options,
sb,
parents,
@@ -436,9 +425,9 @@
0,
);
});
- $("#" + context.service_bodies).html(options.join(""));
+ $("#service_bodies").html(options.join(""));
- query_used_formats(context);
+ query_used_formats();
};
root_server_keypress = function (event) {
if (event.code == "Enter") {
@@ -447,7 +436,7 @@
}
return true;
};
- fill_extra_meetings = function (context, extra_meetings_array) {
+ fill_extra_meetings = function (extra_meetings_array) {
$("#fetching_meetings").hide();
if ($("#extra_meetings_enabled").is(":checked")) {
$("#extra_meetings").next(".select2-container").show();
@@ -478,7 +467,7 @@
);
$("#extra_meetings").html(options.join(""));
};
- fill_formats = function (context, formats) {
+ fill_formats = function (formats) {
const select = (key) =>
bread_admin.used_format == key ? "selected" : "";
const options = formats.formats.reduce(
@@ -497,9 +486,9 @@
[' All Meetings '],
);
$("#used_format_1").html(options.join(""));
- fill_additional_list_formats(context, formats);
+ fill_additional_list_formats(formats);
};
- fill_additional_list_formats = function (context, formats) {
+ fill_additional_list_formats = function (formats) {
const select = (key) =>
bread_admin.additional_list_format_key == key ? "selected" : "";
const options = formats.formats.reduce(
@@ -527,12 +516,12 @@
);
$("#additional_list_format_key").html(options.join(""));
};
- query_used_formats = function (context) {
+ query_used_formats = function () {
const serviceBodies = $("#service_bodies")
.val()
.map((s) => s.split(",")[1]);
if (serviceBodies.length == 0) {
- fill_formats(context, []);
+ fill_formats({formats: []});
return;
}
const query = serviceBodies.reduce(
@@ -542,7 +531,6 @@
$("#recurse_service_bodies").is(":checked") ? "&recursive=1" : "",
);
ask_bmlt(
- context,
"switcher=GetSearchResults&get_formats_only" + query,
fill_formats,
handle_error,
diff --git a/admin/js/bread-wizard.js b/admin/js/bread-wizard.js
index c9f9422d..f137c056 100644
--- a/admin/js/bread-wizard.js
+++ b/admin/js/bread-wizard.js
@@ -1,6 +1,24 @@
jQuery(document).ready(function($){
- var BreadWizard = function() {
- BreadWizard.prototype.ajax_submit = function() {
+ window.BreadWizard = {};
+ BreadWizard.ask_bmlt = function(query, success, fail) {
+ const url = $("#wizard_root_server").val()+"/client_interface/jsonp/?"+query;
+ fetchJsonp(url)
+ .then((response) => {
+ if (response.ok) {
+ return response.json();
+ }
+ return Promise.reject(response); // 2. reject instead of throw
+ })
+ .then((json) => {
+ success(json);
+ return json;
+ })
+ .catch((response) => {
+ fail(response)
+ return false;
+ })
+ }
+ BreadWizard.ajax_submit = function() {
$(".saving").show();
var myform = document.getElementById("wizard_form");
var formData = new FormData(myform);
@@ -15,16 +33,14 @@ jQuery(document).ready(function($){
return response.json();
})
.then((resp) => {
- finalInstructions(resp);
+ BreadWizard.finalInstructions(resp);
})
.catch((error) => {
// Handle error
console.log("error ", error);
});
}
- var href;
- var setting;
- finalInstructions = function(response) {
+ BreadWizard.finalInstructions = function(response) {
$(".saving").hide();
$('#wizard-before-create').hide();
$('#wizard-after-create').show();
@@ -34,37 +50,32 @@ jQuery(document).ready(function($){
const tag = '
'+href+' ';
$('#wizard-show-link').html(tag);
}
- BreadWizard.prototype.generate_meeting_list = function() {
+ BreadWizard.generate_meeting_list = function() {
window.open(href, '_blank').focus();
}
- BreadWizard.prototype.redo_layout = function() {
+ BreadWizard.redo_layout = function() {
$('#wizard_setting_id').val(setting);
$('#bread-wizard').smartWizard("goToStep", 2);
}
- BreadWizard.prototype.test_root_server = function() {
- const context = {
- root_server: 'wizard_root_server',
- service_bodies: 'wizard_service_bodies',
- service_bodies_selected: []
- }
- ask_bmlt(context, "switcher=GetServerInfo",
- (context, info) => {
+ BreadWizard.test_root_server = function() {
+ BreadWizard.ask_bmlt("switcher=GetServerInfo",
+ (info) => {
$('#wizard_root_server_result').removeClass('invalid-feedback dashicons-dismiss')
.addClass('valid-feedback dashicons-before dashicons-yes-alt').html($('#wizard_connected_message').html()+info[0].version);
},
- (context, error) => {
+ (error) => {
$('#wizard_root_server_result').removeClass('valid-feedback dashicons-yes-alt')
.addClass('invalid-feedback dashicons-before dashicons-dismiss').html($('#wizard_disconnected_message').html());
});
}
- BreadWizard.prototype.root_server_keypress = function(event) {
+ BreadWizard.root_server_keypress = function(event) {
if (event.code == 'Enter') this.test_root_server();
}
- BreadWizard.prototype.root_server_changed = function() {
+ BreadWizard.root_server_changed = function() {
$('#wizard_root_server_result').removeClass('valid-feedback').addClass('invalid-feedback dashicons-before dashicons-dismiss')
.html($('#wizard_testnow_message').html());
}
- BreadWizard.prototype.finish = function() {
+ BreadWizard.finish = function() {
$('#bread-wizard').smartWizard("reset");
var form = document.createElement("form");
form.method = "POST";
@@ -77,8 +88,44 @@ jQuery(document).ready(function($){
document.body.appendChild(form);
form.submit();
}
- var hasVirtualMeetings = false;
- layout_options = function(meetings) {
+ BreadWizard.write_service_body_with_childern = function(options, sb, parents, my_parent, level) {
+ let prefix = '';
+ for (i=0; i
'+prefix+sb.name+'');
+ found = parents.find((p) => p.id == sb.id);
+ if (typeof found !== 'undefined')
+ found.children.forEach((child) =>
+ options = write_service_body_with_childern(options, child, parents, sb.name, level+1));
+ return options;
+ }
+ BreadWizard.fill_service_bodies = function(service_bodies) {
+ service_bodies = service_bodies.sort((a,b) => a.name.localeCompare(b.name));
+ const roots = service_bodies.filter((sb) => sb.parent_id=='0');
+ const parents = service_bodies.reduce((carry,item) => {
+ const found = carry.find((p) => p.id == item.parent_id);
+ if (found) {
+ found.children.push(item);
+ } else {
+ carry.push({id: item.parent_id, children:[item]})
+ }
+ return carry;
+ }, []);
+ let options = [];
+ roots.forEach((sb) => {
+ options = BreadWizard.write_service_body_with_childern(options, sb, parents, 'ROOT', 0);
+ });
+ $('#wizard_service_bodies').html(options.join(''));
+ }
+ BreadWizard.fill_formats = function(formats) {
+ const options = formats.reduce((carry,item) => {
+ carry.push('Only '+item.name_string+' ');
+ return carry;
+ }, ['All Meetings ']);
+ $('#wizard_format_filter').html(options.join(''));
+ }
+ BreadWizard.hasVirtualMeetings = false;
+ BreadWizard.layout_options = function(meetings) {
const meeting_count = meetings.length;
hasVirtualMeetings = meetings.some((m) => m.formats.split(',').some(format => ['VM','HY'].includes(format)));
$('#wizard_meeting_count').html(meeting_count);
@@ -87,7 +134,7 @@ jQuery(document).ready(function($){
const name = (group.maxSize == '99999') ? 'Very Large Fellowships' : 'Approx. '+group.maxSize+' meetings';
carry.push('');
group.configurations.reduce((carryGroup, item, idx) => {
- carryGroup.push(...getOptionsFromFilename(group.maxSize, item, idx, layouts));
+ carryGroup.push(...BreadWizard.getOptionsFromFilename(group.maxSize, item, idx, layouts));
return carryGroup;
}, carry);
carry.push(' ');
@@ -95,7 +142,7 @@ jQuery(document).ready(function($){
}, []);
$('#wizard_layout').html(options.join(''));
}
- getOptionsFromFilename = function(size, filename, idx, layouts) {
+ BreadWizard.getOptionsFromFilename = function(size, filename, idx, layouts) {
const type = filename.split('-');
const fold = type[0];
const orientation = type[1];
@@ -107,7 +154,7 @@ jQuery(document).ready(function($){
return carry;
},[]);
}
- lang_options = function() {
+ BreadWizard.lang_options = function() {
const options = breadTranslations.reduce((carry,item)=>{
const selected = (item.key==='en') ? ' selected' : '';
carry.push(''+item.name+' ')
@@ -119,20 +166,15 @@ jQuery(document).ready(function($){
$('#wizard-virtual-meeting-section').hide();
}
}
- wizard_handle_error = function(error) {
+ BreadWizard.handle_error = function(error) {
console.log(error);
$('#bread-wizard').smartWizard("goToStep", 0);
}
- BreadWizard.prototype.getContent = function(idx, stepDirection, stepPosition, selStep, callback) {
- const context = {
- root_server: 'wizard_root_server',
- service_bodies: 'wizard_service_bodies',
- service_bodies_selected: []
- }
+ BreadWizard.getContent = function(idx, stepDirection, stepPosition, selStep, callback) {
switch(idx) {
case 1:
- ask_bmlt(context, 'switcher=GetServiceBodies', fill_service_bodies, wizard_handle_error);
- ask_bmlt(context, 'switcher=GetFormats', fill_formats, wizard_handle_error);
+ BreadWizard.ask_bmlt('switcher=GetServiceBodies', BreadWizard.fill_service_bodies, BreadWizard.handle_error);
+ BreadWizard.ask_bmlt('switcher=GetFormats', BreadWizard.fill_formats, BreadWizard.handle_error);
break;
case 2:
const services = $('#wizard_service_bodies').val().reduce((carry,item) => {
@@ -141,12 +183,12 @@ jQuery(document).ready(function($){
}, '&recursive=1');
const formats = (Number($('#wizard_format_filter').val()) > 0) ? '&formats='+$('#wizard_format_filter').val() : '';
- ask_bmlt(context, 'switcher=GetSearchResults'+services+formats, layout_options, wizard_handle_error);
+ BreadWizard.ask_bmlt('switcher=GetSearchResults'+services+formats, BreadWizard.layout_options, BreadWizard.handle_error);
break;
case 3:
- lang_options();
+ BreadWizard.lang_options();
case 4:
- if ($("wizard_layout").val()=='') wizard_handle_error('Layout not defined');
+ if ($("wizard_layout").val()=='') handle_error('Layout not defined');
$('#wizard-before-create').show();
$('#wizard-after-create').hide();
default:
@@ -154,8 +196,7 @@ jQuery(document).ready(function($){
}
callback();
}
- };
- window.breadWizard = new BreadWizard();
+
// SmartWizard initialize
$('#bread-wizard').smartWizard(
@@ -169,9 +210,9 @@ jQuery(document).ready(function($){
anchor: {
enableNavigation: false,
},
- getContent: breadWizard.getContent
+ getContent: BreadWizard.getContent
}
- );
+ )
// Initialize the leaveStep event
$("#bread-wizard").on("leaveStep", function(e, anchorObject, currentStepIndex, nextStepIndex, stepDirection) {
switch(currentStepIndex) {
@@ -194,4 +235,4 @@ jQuery(document).ready(function($){
max_selected_options:5,
width: "62%"
});
-});
\ No newline at end of file
+})
diff --git a/admin/partials/_bread_wizard.php b/admin/partials/_bread_wizard.php
index 0daa1a13..fdf835d4 100644
--- a/admin/partials/_bread_wizard.php
+++ b/admin/partials/_bread_wizard.php
@@ -53,8 +53,8 @@
Do I have the BMLT? to find your BMLT server', 'bread')) ?>
-
+ onKeypress="BreadWizard.root_server_keypress(event)" onChange="BreadWizard.root_server_changed()" />
+
@@ -150,19 +150,19 @@
From dfbc919b322d2e7a0dcdd856be1934ccbdd71fc8 Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 1 Jun 2026 13:05:36 +0200
Subject: [PATCH 08/17] small fixes
---
admin/class-bread-admin.php | 1 -
admin/js/bread-wizard.js | 18 +++++++++---------
includes/class-bread.php | 1 +
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/admin/class-bread-admin.php b/admin/class-bread-admin.php
index 944c18a5..e8da09b0 100644
--- a/admin/class-bread-admin.php
+++ b/admin/class-bread-admin.php
@@ -78,7 +78,6 @@ public function enqueue_styles($hook)
wp_enqueue_style("select2", plugin_dir_url(__FILE__) . "css/select2.min.css", false, BREAD_VERSION, 'all');
wp_enqueue_style("smartWizard-dots", plugin_dir_url(__FILE__) . "css/smart_wizard_dots.css", false, BREAD_VERSION, 'all');
}
-
/**
* Register the JavaScript for the admin area.
*
diff --git a/admin/js/bread-wizard.js b/admin/js/bread-wizard.js
index f137c056..476c45eb 100644
--- a/admin/js/bread-wizard.js
+++ b/admin/js/bread-wizard.js
@@ -44,17 +44,17 @@ jQuery(document).ready(function($){
$(".saving").hide();
$('#wizard-before-create').hide();
$('#wizard-after-create').show();
- href = window.location.href.substring(0, window.location.href.indexOf('/wp-admin'));
- setting = response.result.setting;
- href = href+"?current-meeting-list="+setting;
- const tag = ''+href+' ';
+ BreadWizard.href = window.location.href.substring(0, window.location.href.indexOf('/wp-admin'));
+ BreadWizard.setting = response.result.setting;
+ BreadWizard.href = href+"?current-meeting-list="+BreadWizard.setting;
+ const tag = '
'+BreadWizard.href+' ';
$('#wizard-show-link').html(tag);
}
BreadWizard.generate_meeting_list = function() {
- window.open(href, '_blank').focus();
+ window.open(BreadWizard.href, '_blank').focus();
}
BreadWizard.redo_layout = function() {
- $('#wizard_setting_id').val(setting);
+ $('#wizard_setting_id').val(BreadWizard.setting);
$('#bread-wizard').smartWizard("goToStep", 2);
}
BreadWizard.test_root_server = function() {
@@ -83,7 +83,7 @@ jQuery(document).ready(function($){
var input = document.createElement("input");
input.type = "hidden";
input.name = "current-meeting-list";
- input.value = setting;
+ input.value = BreadWizard.setting;
form.appendChild(input);
document.body.appendChild(form);
form.submit();
@@ -96,7 +96,7 @@ jQuery(document).ready(function($){
found = parents.find((p) => p.id == sb.id);
if (typeof found !== 'undefined')
found.children.forEach((child) =>
- options = write_service_body_with_childern(options, child, parents, sb.name, level+1));
+ options = BreadWizard.write_service_body_with_childern(options, child, parents, sb.name, level+1));
return options;
}
BreadWizard.fill_service_bodies = function(service_bodies) {
@@ -127,7 +127,7 @@ jQuery(document).ready(function($){
BreadWizard.hasVirtualMeetings = false;
BreadWizard.layout_options = function(meetings) {
const meeting_count = meetings.length;
- hasVirtualMeetings = meetings.some((m) => m.formats.split(',').some(format => ['VM','HY'].includes(format)));
+ BreadWizard.hasVirtualMeetings = meetings.some((m) => m.formats.split(',').some(format => ['VM','HY'].includes(format)));
$('#wizard_meeting_count').html(meeting_count);
const layouts = breadLayouts.find((layouts) => meeting_count <= Number(layouts.maxSize));
const options = breadLayouts.reduce((carry,group) => {
diff --git a/includes/class-bread.php b/includes/class-bread.php
index 0903908f..4090252a 100644
--- a/includes/class-bread.php
+++ b/includes/class-bread.php
@@ -682,6 +682,7 @@ private function fillUnsetOptionsInner()
$this->fillUnsetStringOption('used_format_1', '');
$this->fillUnsetOption('base_font', 'dejavusanscondensed');
$this->fillUnsetOption('colorspace', 0);
+ $this->fillUnsetArrayOption('service_bodies', []);
$this->fillUnsetOption('recurse_service_bodies', 1);
$this->fillUnsetOption('extra_meetings_enabled', 0);
$this->fillUnsetOption('include_protection', 0);
From 5863996bdf571ee4bf300d905e92d6804572236d Mon Sep 17 00:00:00 2001
From: otrok7 <50595291+otrok7@users.noreply.github.com>
Date: Mon, 1 Jun 2026 17:58:14 +0200
Subject: [PATCH 09/17] small fixes
---
admin/partials/bread-admin-display.php | 21 ---------------------
includes/class-bread-bmlt.php | 5 +----
public/class-bread-content-generator.php | 12 ++++++------
public/class-bread-public.php | 4 ++--
4 files changed, 9 insertions(+), 33 deletions(-)
diff --git a/admin/partials/bread-admin-display.php b/admin/partials/bread-admin-display.php
index 32706c3a..aeedc854 100644
--- a/admin/partials/bread-admin-display.php
+++ b/admin/partials/bread-admin-display.php
@@ -32,26 +32,6 @@ function __construct($admin)
{
$this->admin = $admin;
$this->bread = $admin->get_bread_instance();
- $this->refresh_status();
- }
- private function refresh_status()
- {
- $serverInfo = $this->bread->bmlt()->testRootServer();
- $this->connected = is_array($serverInfo) && array_key_exists("version", $serverInfo[0]) ? $serverInfo[0]["version"] : '';
- if ($this->connected) {
- $this->unique_areas = $this->bread->bmlt()->get_areas();
- asort($this->unique_areas);
- if ($serverInfo[0]["aggregator_mode_enabled"] ?? false) {
- $this->server_version = "
".__('Using Tomato Server', 'bread')."";
- } elseif ($this->connected) {
- /* translators: string is the version number of the BMLT Server */
- $this->server_version = "
".sprintf(__('Your BMLT Server is running %s', 'bread'), esc_html($this->connected)). "";
- }
- }
- }
- public function isConnected()
- {
- return $this->connected;
}
public function getBreadInstance()
{
@@ -122,7 +102,6 @@ function admin_options_page($filename = '')
- refresh_status(); ?>
diff --git a/includes/class-bread-bmlt.php b/includes/class-bread-bmlt.php
index 6c9acb2c..722f8ac4 100644
--- a/includes/class-bread-bmlt.php
+++ b/includes/class-bread-bmlt.php
@@ -90,10 +90,7 @@ public function generateMainQuery($json = 'json')
{
$sort_keys = 'weekday_tinyint,start_time,meeting_name';
$get_used_formats = '&get_used_formats';
- $select_language = '';
- if ($this->bread->getOption('weekday_language') != $this->get_bmlt_server_lang()) {
- $select_language = '&lang_enum=' . substr($this->bread->getOption('weekday_language'), 0, 2);
- }
+ $select_language = '&lang_enum=' . substr($this->bread->getOption('weekday_language'), 0, 2);
$services = $this->generateDefaultQuery();
if (isset($_GET['custom_query'])) {
$services = $_GET['custom_query'];
diff --git a/public/class-bread-content-generator.php b/public/class-bread-content-generator.php
index 3c597224..b6115746 100644
--- a/public/class-bread-content-generator.php
+++ b/public/class-bread-content-generator.php
@@ -133,12 +133,12 @@ function __construct(Mpdf $mpdf, Bread $bread, array $result_meetings, Bread_For
"[month]" => strtoupper(gmdate("F")),
"[day]" => strtoupper(gmdate("j")),
"[year]" => strtoupper(gmdate("Y")),
- "[service_body]" => strtoupper($this->options['service_bodies'][0]),
- "[service_body_1]" => strtoupper($this->options['service_bodies'][0]),
- "[service_body_2]" => (count($this->options['service_bodies']) > 1) ? strtoupper($this->options['service_bodies'][1]) : 'Not Used',
- "[service_body_3]" => (count($this->options['service_bodies']) > 2) ? strtoupper($this->options['service_bodies'][2]) : 'Not Used',
- "[service_body_4]" => (count($this->options['service_bodies']) > 3) ? strtoupper($this->options['service_bodies'][3]) : 'Not Used',
- "[service_body_5]" => (count($this->options['service_bodies']) > 4) ? strtoupper($this->options['service_bodies'][4]) : 'Not Used',
+ "[service_body]" => explode(',', strtoupper($this->options['service_bodies'][0]))[0],
+ "[service_body_1]" => explode(',', strtoupper($this->options['service_bodies'][0]))[0],
+ "[service_body_2]" => (count($this->options['service_bodies']) > 1) ? explode(',', strtoupper($this->options['service_bodies'][1]))[0] : 'Not Used',
+ "[service_body_3]" => (count($this->options['service_bodies']) > 2) ? explode(',', strtoupper($this->options['service_bodies'][2]))[0] : 'Not Used',
+ "[service_body_4]" => (count($this->options['service_bodies']) > 3) ? explode(',', strtoupper($this->options['service_bodies'][3]))[0] : 'Not Used',
+ "[service_body_5]" => (count($this->options['service_bodies']) > 4) ? explode(',', strtoupper($this->options['service_bodies'][4]))[0] : 'Not Used',
);
$this->shortcodes = apply_filters("Bread_Section_Shortcodes", $this->shortcodes, $this->bread->bmlt()->get_areas(), $formatsManager->getFormatsUsed());
diff --git a/public/class-bread-public.php b/public/class-bread-public.php
index cf9c4e4a..4243646e 100644
--- a/public/class-bread-public.php
+++ b/public/class-bread-public.php
@@ -135,7 +135,7 @@ private function generatePreloadConfiguration(int $id): array
public function doBreadButton($atts)
{
$label = $atts['label'] ?? 'Generate PDF';
- $id = $atts['current-meeting-list'] ?? "1";
+ $id = $atts['current_meeting_list'] ?? "1";
return "