diff --git a/crouton.php b/crouton.php index 97e27e99..d86e8ad8 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.11.12 +Version: 3.11.13 */ /* Disallow direct access to the plugin file */ if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { diff --git a/croutonjs/src/js/crouton-core.js b/croutonjs/src/js/crouton-core.js index a97e6e31..c04bcab6 100644 --- a/croutonjs/src/js/crouton-core.js +++ b/croutonjs/src/js/crouton-core.js @@ -1086,10 +1086,10 @@ function getFalseResult(options, ctx) { return options.inverse !== undefined ? options.inverse(ctx) : false; } -function getMasterFormatId(code) { +function getMasterFormatId(code, data) { for (var f = 0; f < crouton.masterFormatCodes.length; f++) { var format = crouton.masterFormatCodes[f]; - if (format['key_string'] === code) { + if (format['key_string'] === code && format['root_server_uri'] === data['root_server_uri']) { return format['id']; } } @@ -1113,22 +1113,22 @@ crouton_Handlebars.registerHelper('formatDataPointer', function(str) { }); crouton_Handlebars.registerHelper('isVirtual', function(data, options) { - return ((inArray(getMasterFormatId('HY'), getFormats(data)) && !inArray(getMasterFormatId('TC'), getFormats(data))) - || inArray(getMasterFormatId('VM'), getFormats(data))) + return ((inArray(getMasterFormatId('HY', data), getFormats(data)) && !inArray(getMasterFormatId('TC', data), getFormats(data))) + || inArray(getMasterFormatId('VM', data), getFormats(data))) && (data['virtual_meeting_link'] || data['phone_meeting_number']) ? getTrueResult(options, this) : getFalseResult(options, this); }); crouton_Handlebars.registerHelper('isHybrid', function(data, options) { - return inArray(getMasterFormatId('HY'), getFormats(data)) + return inArray(getMasterFormatId('HY', data), getFormats(data)) && (data['virtual_meeting_link'] || data['phone_meeting_number']) ? getTrueResult(options, this) : getFalseResult(options, this); }); crouton_Handlebars.registerHelper('isTemporarilyClosed', function(data, options) { - return inArray(getMasterFormatId('TC'), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this); + return inArray(getMasterFormatId('TC', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this); }); crouton_Handlebars.registerHelper('isNotTemporarilyClosed', function(data, options) { - return !inArray(getMasterFormatId('TC'), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this); + return !inArray(getMasterFormatId('TC', data), getFormats(data)) ? getTrueResult(options, this) : getFalseResult(options, this); }); crouton_Handlebars.registerHelper('hasFormats', function(formats, data, options) { @@ -1143,24 +1143,24 @@ crouton_Handlebars.registerHelper('hasFormats', function(formats, data, options) }); crouton_Handlebars.registerHelper('temporarilyClosed', function(data, options) { - if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('TC')) !== undefined) { - return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('TC'))['description']; + if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('TC', data)) !== undefined) { + return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('TC', data))['description']; } else { return "FACILITY IS TEMPORARILY CLOSED"; } }); crouton_Handlebars.registerHelper('meetsVirtually', function(data, options) { - if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('VM')) !== undefined) { - return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('VM'))['description']; + if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('VM', data)) !== undefined) { + return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('VM', data))['description']; } else { return "MEETS VIRTUALLY"; } }); crouton_Handlebars.registerHelper('meetsHybrid', function(data, options) { - if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('HY')) !== undefined) { - return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('HY'))['description']; + if (data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('HY', data)) !== undefined) { + return data['formats_expanded'].getArrayItemByObjectKeyValue('id', getMasterFormatId('HY', data))['description']; } else { return "MEETS VIRTUALLY AND IN PERSON"; } diff --git a/readme.txt b/readme.txt index e1d420d1..03b08fd7 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: na, meeting list, meeting finder, maps, recovery, addiction, webservant, b Requires at least: 4.0 Required PHP: 5.6 Tested up to: 5.4.1 -Stable tag: 3.11.12 +Stable tag: 3.11.13 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html crouton implements a Tabbed UI for BMLT. @@ -36,6 +36,9 @@ https://demo.bmlt.app/crouton == Changelog == += 3.11.13 = +* Fix for regressions of descriptions with tomato. + = 3.11.12 = * Fix for descriptions for VM, TC, and HY in non-English languages.