diff --git a/admin/js/bmlt_meeting_list.js b/admin/js/bmlt_meeting_list.js index 870792c..eebeddc 100644 --- a/admin/js/bmlt_meeting_list.js +++ b/admin/js/bmlt_meeting_list.js @@ -1,31 +1,4 @@ -var s = document.getElementById('extra_meetings').options, - l = [], - d = ''; -for(i = 0;i < s.length;i++) { - column = s[i].text.split(';'); - for(j = 0;j < column.length;j++) { - if(!l[j]) { - l[j] = 0; - } - if(column[j].length > l[j]) { - l[j] = column[j].length; - } - } -} -for(i = 0;i < s.length;i++) { - column = s[i].text.split(';'); - temp_line = ''; - for(j = 0;j < column.length;j++) { - t = (l[j] - column[j].length); - d = '\u00a0'; - for(k = 0;k < t;k++) { - d += '\u00a0'; - } - temp_line += column[j] + d; - } - s[i].text = temp_line; -} -var $ml = jQuery.noConflict +var $ml = jQuery.noConflict jQuery(document).ready( function($ml) { $ml(".connecting").hide(); @@ -164,22 +137,6 @@ jQuery(document).ready( } } ); - $ml('#root-server-button').bind( - 'click', function(e) { - e.preventDefault(); - $ml('#root-server-video').bPopup( - { - transition: 'slideIn', - closeClass: 'b-close', - onClose: function() { - for(var player in mejs.players) { - mejs.players[player].media.stop(); - } - } - } - ); - } - ); $ml('.my-tooltip').each(function(i,e) { $ml(e).tooltipster( { @@ -281,7 +238,6 @@ jQuery(document).ready( ); $ml("#subgrouping").click( function() { - var user_defined_sub = false; $ml('.user_defined_headings').hide(); if($ml("#meeting_sort").val() === 'user_defined') { $ml('.user_defined_headings').show(); @@ -293,105 +249,41 @@ jQuery(document).ready( } } ); - var time_clock_val = $ml('input[name=time_clock]:checked').val(); - if(time_clock_val == '24') { - $ml('#option3').hide(); - $ml('label[for=option3]').hide(); - } else if(time_clock_val == '24fr') { - $ml('#option3').hide(); - $ml('label[for=option3]').hide(); - } else { - $ml('#option3').show(); - $ml('label[for=option3]').show(); - } - $ml("#two").click( - function() { - var time_clock_val = $ml('input[name=time_clock]:checked').val(); - if(time_clock_val == '24') { - $ml('label[for=option1]').html('20:00'); - $ml('label[for=option2]').html('20:00 - 21:00'); - $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - } else if(time_clock_val == '24fr') { - $ml('label[for=option1]').html('20h00'); - $ml('label[for=option2]').html('20h00 - 21h00'); - $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - } else { - $ml('#option3').show(); - $ml('label[for=option1]').html('8:00 PM'); - $ml('label[for=option2]').html('8:00 PM - 9:00 PM'); - $ml('label[for=option3]').html('8 - 9 PM'); - } + function calcTimeDisplay(hasEndTime) { + let clock = $ml('input[name=time_clock]:checked').val(); + let removeSpaces = $ml('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'; } - ); - $ml("#four").click( - function() { - var time_clock_val = $ml('input[name=time_clock]:checked').val(); - if(time_clock_val == '24') { - $ml('label[for=option1]').html('20:00'); - $ml('label[for=option2]').html('20:00-21:00'); - $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - } else if(time_clock_val == '24fr') { - $ml('#option3').hide(); - $ml('label[for=option1]').html('20h00'); - $ml('label[for=option2]').html('20h00-21h00'); - $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - } else { - $ml('#option3').show(); - $ml('label[for=option1]').html('8:00PM'); - $ml('label[for=option2]').html('8:00PM-9:00PM'); - $ml('label[for=option3]').html('8-9PM'); - } + if (hasEndTime==2) { + startTime += ' - '+endTime; } - ); - $ml("#time_clock12").click( - function() { - var remove_space_val = $ml('input[name=remove_space]:checked').val(); - $ml('#option3').show(); - $ml('label[for=option3]').show(); - if(remove_space_val == '1') { - $ml('label[for=option1]').html('8:00PM'); - $ml('label[for=option2]').html('8:00PM-9:00PM'); - $ml('label[for=option3]').html('8-9PM'); - } else { - $ml('label[for=option1]').html('8:00 PM'); - $ml('label[for=option2]').html('8:00 PM - 9:00 PM'); - $ml('label[for=option3]').html('8 - 9 PM'); - } + if (hasEndTime==3) { + startTime = clock=='12' ? '8 - 9' : ''; } - ); - $ml("#time_clock24").click( - function() { - var remove_space_val = $ml('input[name=remove_space]:checked').val(); - $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - if(remove_space_val == '1') { - $ml('label[for=option1]').html('20:00'); - $ml('label[for=option2]').html('20:00-21:00'); - } else { - $ml('label[for=option1]').html('20:00'); - $ml('label[for=option2]').html('20:00 - 21:00'); - } + if (removeSpaces!="0") { + startTime = startTime.replaceAll(' ',''); } - ); - $ml("#time_clock24fr").click( - function() { - var remove_space_val = $ml('input[name=remove_space]:checked').val(); + return startTime; + } + function setTimeOptionText() { + $ml('label[for=option1]').html(calcTimeDisplay(1)); + $ml('label[for=option2]').html(calcTimeDisplay(2)); + $ml('label[for=option3]').html(calcTimeDisplay(3)); + if ($ml('input[name=time_clock]:checked').val()!='12') { + if ($ml('input[name=time_clock]:checked').val()==3) + $ml('#option2').prop('checked', true); $ml('#option3').hide(); - $ml('label[for=option3]').html(''); - if(remove_space_val == '1') { - $ml('label[for=option1]').html('20h00'); - $ml('label[for=option2]').html('20h00-21h00'); - } else { - $ml('label[for=option1]').html('20h00'); - $ml('label[for=option2]').html('20h00 - 21h00'); - } - } - ); - var page_fold_val = $ml('input[name=page_fold]:checked').val(); + } else $ml('#option3').show(); + }; + setTimeOptionText(); + $ml('.recalcTimeLabel').on('click', setTimeOptionText); function bookletControlsShowHide() { $ml('#landscape').prop("checked", true); $ml('.booklet').show(); @@ -447,22 +339,6 @@ jQuery(document).ready( $ml(".ctrl_key").hide(); } ); - /* - $ml("#extra_meetings").select2({ - //tags: "true", - placeholder: "Select Meetings", - containerCssClass: 'tpx-select2-container select2-container-lg', - dropdownCssClass: 'tpx-select2-drop', - dropdownAutoWidth: true, - allowClear: true, - width: "100%", - /* dropdownParent: $ml('.exactCenter'), */ - /* minimumResultsForSearch: 1, */ - /* closeOnSelect: false, */ - /* escapeMarkup: function (markup) { return markup; } - }).maximizeSelect2Height({cushion: 100}); - $ml('.select2-choices').css('background-image','none').css('background-color','#111111 !important'); - */ $ml("#meeting-list-tabs").tabs( { active: 0 diff --git a/admin/partials/_bmlt_server_setup.php b/admin/partials/_bmlt_server_setup.php index ac71210..26de019 100644 --- a/admin/partials/_bmlt_server_setup.php +++ b/admin/partials/_bmlt_server_setup.php @@ -99,12 +99,9 @@ connected && Bread::getOption('extra_meetings_enabled') == 1) { $extra_meetings_array = Bread_Bmlt::get_all_meetings(); - foreach ($extra_meetings_array as $extra_meeting) { - $extra_meeting_x = explode('|||', $extra_meeting); - $extra_meeting_id = trim(Bread::arraySafeGet($extra_meeting_x, 3)); - $extra_meeting_display = substr(Bread::arraySafeGet($extra_meeting_x), 0, 30) . ';' . Bread::arraySafeGet($extra_meeting_x, 1) . ';' . Bread::arraySafeGet($extra_meeting_x, 2); ?> - - $descr) { + $selected = Bread::getOption('extra_meetings') != '' && in_array($id, Bread::getOption('extra_meetings')) ? 'selected="selected"' : ''; + echo ""; } } ?> diff --git a/admin/partials/_layout_setup.php b/admin/partials/_layout_setup.php index 12d2786..5ea9fa7 100644 --- a/admin/partials/_layout_setup.php +++ b/admin/partials/_layout_setup.php @@ -176,7 +176,7 @@
- > + >Enable Protection
diff --git a/admin/partials/_meetings_setup.php b/admin/partials/_meetings_setup.php index 8918485..8fca326 100644 --- a/admin/partials/_meetings_setup.php +++ b/admin/partials/_meetings_setup.php @@ -236,56 +236,34 @@

Start Time Format(?)

-
-
>
+
>
>
- -
- -
- + +
>
-
>
+
>
>
- -
- -
- +
>
-
>
+
>
>
diff --git a/includes/class-bread-bmlt.php b/includes/class-bread-bmlt.php index 407186f..e61f14e 100644 --- a/includes/class-bread-bmlt.php +++ b/includes/class-bread-bmlt.php @@ -38,7 +38,12 @@ private static function get(string $url) : WP_Error | array } return wp_remote_get($url, $args); } - public static function get_all_meetings() + /** + * Gets all the meetins in the root server as an array with id=>string. Used to select extra meetings. + * + * @return array + */ + public static function get_all_meetings(): array { $lang = Bread_Bmlt::get_bmlt_server_lang(); $result = 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"); @@ -55,7 +60,7 @@ public static function get_all_meetings() } $value['start_time'] = date("g:iA", strtotime($value['start_time'])); - $all_meetings[] = $value['meeting_name'].'||| ['.Bread::getday($value['weekday_tinyint'], true, $lang).'] ['.$value['start_time'].']||| ['.$area_name.']||| ['.$value['id_bigint'].']'; + $all_meetings[$value['id_bigint']] = $value['meeting_name'].' - '.Bread::getday($value['weekday_tinyint'], true, $lang).' '.$value['start_time'].' in '.$area_name.' at '.$value['location_text']; } return $all_meetings; diff --git a/includes/class-bread.php b/includes/class-bread.php index cdac30c..1b583f7 100644 --- a/includes/class-bread.php +++ b/includes/class-bread.php @@ -497,7 +497,7 @@ public static function getday($day, $abbreviate = false, $language = 'en') if ($abbreviate) { $key = "WKDYS"; } - return mb_convert_encoding(Bread::$instance->translate[$language][$key][$day], 'UTF-8', mb_list_encodings()); + return Bread::$instance->translate[$language][$key][$day]; } function fillUnsetOption($option, $default) {