| @@ -1,224 +1,226 @@ | ||
| 1 | -tinyMCEPopup.requireLangPack(); | |
| 2 | - | |
| 3 | -var TimedContentDialog = { | |
| 4 | - init : function() { | |
| 5 | - jQuery('#do_client_show').click( | |
| 6 | - function() { | |
| 7 | - if (jQuery(this).is(':checked')) { | |
| 8 | - jQuery('#client_show_minutes').removeAttr('disabled'); | |
| 9 | - jQuery('#client_show_seconds').removeAttr('disabled'); | |
| 10 | - jQuery('#client_show_fade').removeAttr('disabled'); | |
| 11 | - } else { | |
| 12 | - jQuery('#client_show_minutes').prop('disabled', 'disabled'); | |
| 13 | - jQuery('#client_show_seconds').prop('disabled', 'disabled'); | |
| 14 | - jQuery('#client_show_fade').prop('disabled', 'disabled'); | |
| 15 | - } | |
| 16 | - } | |
| 17 | - ); | |
| 18 | - | |
| 19 | - jQuery('#do_client_hide').click( | |
| 20 | - function() { | |
| 21 | - if (jQuery(this).is(':checked')) { | |
| 22 | - jQuery('#client_hide_minutes').removeAttr('disabled'); | |
| 23 | - jQuery('#client_hide_seconds').removeAttr('disabled'); | |
| 24 | - jQuery('#client_hide_fade').removeAttr('disabled'); | |
| 25 | - } else { | |
| 26 | - jQuery('#client_hide_minutes').prop('disabled', 'disabled'); | |
| 27 | - jQuery('#client_hide_seconds').prop('disabled', 'disabled'); | |
| 28 | - jQuery('#client_hide_fade').prop('disabled', 'disabled'); | |
| 29 | - } | |
| 30 | - } | |
| 31 | - ); | |
| 32 | - | |
| 33 | - var today = new Date(); | |
| 34 | - | |
| 35 | - jQuery('#do_server_show').click( | |
| 36 | - function() { | |
| 37 | - if (jQuery(this).is(':checked')) { | |
| 38 | - jQuery('#server_show_date').removeAttr('disabled'); | |
| 39 | - jQuery('#server_show_time').removeAttr('disabled'); | |
| 40 | - jQuery('#server_show_date').datepicker( | |
| 41 | - { | |
| 42 | - changeMonth: true, | |
| 43 | - changeYear: true | |
| 44 | - } | |
| 45 | - ); | |
| 46 | - jQuery('#server_show_time').timepicker( | |
| 47 | - { | |
| 48 | - defaultTime: 'now' | |
| 49 | - } | |
| 50 | - ); | |
| 51 | - } else { | |
| 52 | - jQuery('#server_show_date').prop('disabled', 'disabled'); | |
| 53 | - jQuery('#server_show_time').prop('disabled', 'disabled'); | |
| 54 | - } | |
| 55 | - } | |
| 56 | - ); | |
| 57 | - | |
| 58 | - jQuery('#do_server_hide').click( | |
| 59 | - function() { | |
| 60 | - if (jQuery(this).is(':checked')) { | |
| 61 | - jQuery('#server_hide_date').removeAttr('disabled'); | |
| 62 | - jQuery('#server_hide_time').removeAttr('disabled'); | |
| 63 | - jQuery('#server_hide_date').datepicker( | |
| 64 | - { | |
| 65 | - changeMonth: true, | |
| 66 | - changeYear: true | |
| 67 | - } | |
| 68 | - ); | |
| 69 | - jQuery('#server_hide_time').timepicker( | |
| 70 | - { | |
| 71 | - defaultTime: 'now' | |
| 72 | - } | |
| 73 | - ); | |
| 74 | - } else { | |
| 75 | - jQuery('#server_hide_date').prop('disabled', 'disabled'); | |
| 76 | - jQuery('#server_hide_time').prop('disabled', 'disabled'); | |
| 77 | - } | |
| 78 | - } | |
| 79 | - ); | |
| 80 | - | |
| 81 | - jQuery.each( rules, function( key, value ) { | |
| 82 | - jQuery('select#rules_list').append( '<option value="' + value['ID'] + '">' + value['title'] + '</option>\n' ); | |
| 83 | - }); | |
| 84 | - jQuery( "select#rules_list" ).change( function() { | |
| 85 | - jQuery( "select#rules_list option:selected" ).each( function() { | |
| 86 | - var id = jQuery( this ).val(); | |
| 87 | - jQuery.each( rules, function( key, value ) { | |
| 88 | - if ( id == value['ID'] ) | |
| 89 | - jQuery( "span#rules_desc" ).html( value['desc'] ); | |
| 90 | - }); | |
| 91 | - if ( id < 0 ) { | |
| 92 | - jQuery('select#rules_list').prop('disabled', 'disabled'); | |
| 93 | - jQuery('#TimedContentDialogRules #insert').prop('disabled', 'disabled'); | |
| 94 | - } | |
| 95 | - | |
| 96 | - }); | |
| 97 | - }).trigger( "change" ); | |
| 98 | - | |
| 99 | - }, | |
| 100 | - | |
| 101 | - client_action : function() { | |
| 102 | - // Get settings from the dialog and build the arguments for the shortcode | |
| 103 | - var show_args = ""; | |
| 104 | - var hide_args = ""; | |
| 105 | - var display_args = ""; | |
| 106 | - | |
| 107 | - var sm = Math.abs(parseInt(jQuery('#client_show_minutes').val())); | |
| 108 | - var ss = Math.abs(parseInt(jQuery('#client_show_seconds').val())); | |
| 109 | - var sf = Math.abs(parseInt(jQuery('#client_show_fade').val())); | |
| 110 | - if (isNaN(sm)) sm = 0; if (isNaN(ss)) ss = 0; if (isNaN(sf)) sf = 0; | |
| 111 | - | |
| 112 | - var hm = Math.abs(parseInt(jQuery('#client_hide_minutes').val())); | |
| 113 | - var hs = Math.abs(parseInt(jQuery('#client_hide_seconds').val())); | |
| 114 | - var hf = Math.abs(parseInt(jQuery('#client_hide_fade').val())); | |
| 115 | - if (isNaN(hm)) hm = 0; if (isNaN(hs)) hs = 0; if (isNaN(hf)) hf = 0; | |
| 116 | - | |
| 117 | - st = (sm * 60) + ss; ht = (hm * 60) + hs; | |
| 118 | - | |
| 119 | - if (jQuery('#client_display_tag_div').prop('checked')) | |
| 120 | - display_args = " display=\"div\""; | |
| 121 | - else | |
| 122 | - display_args = " display=\"span\""; | |
| 123 | - | |
| 124 | - if (jQuery('#do_client_show').prop('checked')) { | |
| 125 | - if (st > 0) | |
| 126 | - show_args = " show=\"" + sm + ":" + ss + ":" + sf + "\""; | |
| 127 | - else { | |
| 128 | - tinyMCEPopup.alert(errorMessages.clientNoShow); | |
| 129 | - return; | |
| 130 | - } | |
| 131 | - } | |
| 132 | - if (jQuery('#do_client_hide').prop('checked')) { | |
| 133 | - if (ht > 0) | |
| 134 | - hide_args = " hide=\"" + hm + ":" + hs + ":" + hf + "\""; | |
| 135 | - else { | |
| 136 | - tinyMCEPopup.alert(errorMessages.clientNoHide); | |
| 137 | - return; | |
| 138 | - } | |
| 139 | - } | |
| 140 | - | |
| 141 | - if (jQuery('#do_client_show').prop('checked') && jQuery('#do_client_hide').prop('checked') && (st >= ht)) { | |
| 142 | - tinyMCEPopup.alert(errorMessages.clientHideBeforeShow); | |
| 143 | - return; | |
| 144 | - } | |
| 145 | - | |
| 146 | - if (!(jQuery('#do_client_show').prop('checked') || jQuery('#do_client_hide').prop('checked'))) { | |
| 147 | - tinyMCEPopup.alert(errorMessages.clientNoAction); | |
| 148 | - return; | |
| 149 | - } | |
| 150 | - // Insert the contents from the input into the document | |
| 151 | - tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.client + ' ' + show_args + hide_args + display_args + ']{$selection}[/' + tags.client + ']'); | |
| 152 | - tinyMCEPopup.close(); | |
| 153 | - }, | |
| 154 | - | |
| 155 | - server_action : function() { | |
| 156 | - // Get settings from the dialog and build the arguments for the shortcode | |
| 157 | - var show_args = ""; | |
| 158 | - var hide_args = ""; | |
| 159 | - var debug_args = ""; | |
| 160 | - | |
| 161 | - var sd = jQuery('#server_show_date').val(); | |
| 162 | - var hd = jQuery('#server_hide_date').val(); | |
| 163 | - var st = jQuery('#server_show_time').val(); | |
| 164 | - var ht = jQuery('#server_hide_time').val(); | |
| 165 | - var tz = jQuery('#server_tz option:selected').val(); | |
| 166 | - var s_Date = new Date(sd + " " + st); | |
| 167 | - var h_Date = new Date(hd + " " + ht); | |
| 168 | - | |
| 169 | - if (jQuery('#do_server_show').prop('checked')) { | |
| 170 | - show_args = " show=\"" + sd + " " + st + " " + tz + "\""; | |
| 171 | - } | |
| 172 | - if (jQuery('#do_server_hide').prop('checked')) { | |
| 173 | - hide_args = " hide=\"" + hd + " " + ht + " " + tz + "\""; | |
| 174 | - } | |
| 175 | - if (jQuery('#server_debug').prop('checked')) { | |
| 176 | - debug_args = " debug=\"true\""; | |
| 177 | - } | |
| 178 | - | |
| 179 | - if (jQuery('#do_server_show').prop('checked') && (sd.length == 0)) { | |
| 180 | - tinyMCEPopup.alert(errorMessages.serverNoShowDate); | |
| 181 | - return; | |
| 182 | - } | |
| 183 | - | |
| 184 | - if (jQuery('#do_server_hide').prop('checked') && (hd.length == 0)) { | |
| 185 | - tinyMCEPopup.alert(errorMessages.serverNoHideDate); | |
| 186 | - return; | |
| 187 | - } | |
| 188 | - | |
| 189 | - if (jQuery('#do_server_show').prop('checked') && (st.length == 0)) { | |
| 190 | - tinyMCEPopup.alert(errorMessages.serverNoShowTime); | |
| 191 | - return; | |
| 192 | - } | |
| 193 | - | |
| 194 | - if (jQuery('#do_server_hide').prop('checked') && (ht.length == 0)) { | |
| 195 | - tinyMCEPopup.alert(errorMessages.serverNoHideTime); | |
| 196 | - return; | |
| 197 | - } | |
| 198 | - | |
| 199 | - if (jQuery('#do_server_show').prop('checked') && jQuery('#do_server_hide').prop('checked') && (s_Date >= h_Date)) { | |
| 200 | - tinyMCEPopup.alert(errorMessages.serverHideBeforeShow); | |
| 201 | - return; | |
| 202 | - } | |
| 203 | - | |
| 204 | - if (!(jQuery('#do_server_show').prop('checked') || jQuery('#do_server_hide').prop('checked'))) { | |
| 205 | - tinyMCEPopup.alert(errorMessages.serverNoAction); | |
| 206 | - return; | |
| 207 | - } | |
| 208 | - | |
| 209 | - // Insert the contents from the input into the document | |
| 210 | - tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.server + ' ' + show_args + hide_args + debug_args + ']{$selection}[/' + tags.server + ']'); | |
| 211 | - tinyMCEPopup.close(); | |
| 212 | - }, | |
| 213 | - | |
| 214 | - rules_action : function() { | |
| 215 | - // Get settings from the dialog and build the arguments for the shortcode | |
| 216 | - var rule_args = " id=\"" + jQuery('select#rules_list option:selected').val() + "\""; | |
| 217 | - | |
| 218 | - // Insert the contents from the input into the document | |
| 219 | - tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.rule + ' ' + rule_args + ']{$selection}[/' + tags.rule + ']'); | |
| 220 | - tinyMCEPopup.close(); | |
| 221 | - } | |
| 222 | -}; | |
| 223 | - | |
| 224 | -tinyMCEPopup.onInit.add(TimedContentDialog.init, TimedContentDialog); | |
| 1 | +tinyMCEPopup.requireLangPack(); | |
| 2 | + | |
| 3 | +var TimedContentDialog = { | |
| 4 | + init : function() { | |
| 5 | + jQuery('#do_client_show').click( | |
| 6 | + function() { | |
| 7 | + if (jQuery(this).is(':checked')) { | |
| 8 | + jQuery('#client_show_minutes').removeAttr('disabled'); | |
| 9 | + jQuery('#client_show_seconds').removeAttr('disabled'); | |
| 10 | + jQuery('#client_show_fade').removeAttr('disabled'); | |
| 11 | + } else { | |
| 12 | + jQuery('#client_show_minutes').prop('disabled', 'disabled'); | |
| 13 | + jQuery('#client_show_seconds').prop('disabled', 'disabled'); | |
| 14 | + jQuery('#client_show_fade').prop('disabled', 'disabled'); | |
| 15 | + } | |
| 16 | + } | |
| 17 | + ); | |
| 18 | + | |
| 19 | + jQuery('#do_client_hide').click( | |
| 20 | + function() { | |
| 21 | + if (jQuery(this).is(':checked')) { | |
| 22 | + jQuery('#client_hide_minutes').removeAttr('disabled'); | |
| 23 | + jQuery('#client_hide_seconds').removeAttr('disabled'); | |
| 24 | + jQuery('#client_hide_fade').removeAttr('disabled'); | |
| 25 | + } else { | |
| 26 | + jQuery('#client_hide_minutes').prop('disabled', 'disabled'); | |
| 27 | + jQuery('#client_hide_seconds').prop('disabled', 'disabled'); | |
| 28 | + jQuery('#client_hide_fade').prop('disabled', 'disabled'); | |
| 29 | + } | |
| 30 | + } | |
| 31 | + ); | |
| 32 | + | |
| 33 | + var today = new Date(); | |
| 34 | + | |
| 35 | + jQuery('#do_server_show').click( | |
| 36 | + function() { | |
| 37 | + if (jQuery(this).is(':checked')) { | |
| 38 | + jQuery('#server_show_date').removeAttr('disabled'); | |
| 39 | + jQuery('#server_show_time').removeAttr('disabled'); | |
| 40 | + jQuery('#server_show_date').datepicker( | |
| 41 | + { | |
| 42 | + changeMonth: true, | |
| 43 | + changeYear: true, | |
| 44 | + dateFormat: datepickParam.dateFormat | |
| 45 | + } | |
| 46 | + ); | |
| 47 | + jQuery('#server_show_time').timepicker( | |
| 48 | + { | |
| 49 | + defaultTime: 'now' | |
| 50 | + } | |
| 51 | + ); | |
| 52 | + } else { | |
| 53 | + jQuery('#server_show_date').prop('disabled', 'disabled'); | |
| 54 | + jQuery('#server_show_time').prop('disabled', 'disabled'); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + ); | |
| 58 | + | |
| 59 | + jQuery('#do_server_hide').click( | |
| 60 | + function() { | |
| 61 | + if (jQuery(this).is(':checked')) { | |
| 62 | + jQuery('#server_hide_date').removeAttr('disabled'); | |
| 63 | + jQuery('#server_hide_time').removeAttr('disabled'); | |
| 64 | + jQuery('#server_hide_date').datepicker( | |
| 65 | + { | |
| 66 | + changeMonth: true, | |
| 67 | + changeYear: true, | |
| 68 | + dateFormat: datepickParam.dateFormat | |
| 69 | + } | |
| 70 | + ); | |
| 71 | + jQuery('#server_hide_time').timepicker( | |
| 72 | + { | |
| 73 | + defaultTime: 'now' | |
| 74 | + } | |
| 75 | + ); | |
| 76 | + } else { | |
| 77 | + jQuery('#server_hide_date').prop('disabled', 'disabled'); | |
| 78 | + jQuery('#server_hide_time').prop('disabled', 'disabled'); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + ); | |
| 82 | + | |
| 83 | + jQuery.each( rules, function( key, value ) { | |
| 84 | + jQuery('select#rules_list').append( '<option value="' + value['ID'] + '">' + value['title'] + '</option>\n' ); | |
| 85 | + }); | |
| 86 | + jQuery( "select#rules_list" ).change( function() { | |
| 87 | + jQuery( "select#rules_list option:selected" ).each( function() { | |
| 88 | + var id = jQuery( this ).val(); | |
| 89 | + jQuery.each( rules, function( key, value ) { | |
| 90 | + if ( id == value['ID'] ) | |
| 91 | + jQuery( "span#rules_desc" ).html(value['desc']); | |
| 92 | + }); | |
| 93 | + if ( id < 0 ) { | |
| 94 | + jQuery('select#rules_list').prop('disabled', 'disabled'); | |
| 95 | + jQuery('#TimedContentDialogRules #insert').prop('disabled', 'disabled'); | |
| 96 | + } | |
| 97 | + | |
| 98 | + }); | |
| 99 | + }).trigger( "change" ); | |
| 100 | + | |
| 101 | + }, | |
| 102 | + | |
| 103 | + client_action : function() { | |
| 104 | + // Get settings from the dialog and build the arguments for the shortcode | |
| 105 | + var show_args = ""; | |
| 106 | + var hide_args = ""; | |
| 107 | + var display_args = ""; | |
| 108 | + | |
| 109 | + var sm = Math.abs(parseInt(jQuery('#client_show_minutes').val())); | |
| 110 | + var ss = Math.abs(parseInt(jQuery('#client_show_seconds').val())); | |
| 111 | + var sf = Math.abs(parseInt(jQuery('#client_show_fade').val())); | |
| 112 | + if (isNaN(sm)) sm = 0; if (isNaN(ss)) ss = 0; if (isNaN(sf)) sf = 0; | |
| 113 | + | |
| 114 | + var hm = Math.abs(parseInt(jQuery('#client_hide_minutes').val())); | |
| 115 | + var hs = Math.abs(parseInt(jQuery('#client_hide_seconds').val())); | |
| 116 | + var hf = Math.abs(parseInt(jQuery('#client_hide_fade').val())); | |
| 117 | + if (isNaN(hm)) hm = 0; if (isNaN(hs)) hs = 0; if (isNaN(hf)) hf = 0; | |
| 118 | + | |
| 119 | + st = (sm * 60) + ss; ht = (hm * 60) + hs; | |
| 120 | + | |
| 121 | + if (jQuery('#client_display_tag_div').prop('checked')) | |
| 122 | + display_args = " display=\"div\""; | |
| 123 | + else | |
| 124 | + display_args = " display=\"span\""; | |
| 125 | + | |
| 126 | + if (jQuery('#do_client_show').prop('checked')) { | |
| 127 | + if (st > 0) | |
| 128 | + show_args = " show=\"" + sm + ":" + ss + ":" + sf + "\""; | |
| 129 | + else { | |
| 130 | + tinyMCEPopup.alert(errorMessages.clientNoShow); | |
| 131 | + return; | |
| 132 | + } | |
| 133 | + } | |
| 134 | + if (jQuery('#do_client_hide').prop('checked')) { | |
| 135 | + if (ht > 0) | |
| 136 | + hide_args = " hide=\"" + hm + ":" + hs + ":" + hf + "\""; | |
| 137 | + else { | |
| 138 | + tinyMCEPopup.alert(errorMessages.clientNoHide); | |
| 139 | + return; | |
| 140 | + } | |
| 141 | + } | |
| 142 | + | |
| 143 | + if (jQuery('#do_client_show').prop('checked') && jQuery('#do_client_hide').prop('checked') && (st >= ht)) { | |
| 144 | + tinyMCEPopup.alert(errorMessages.clientHideBeforeShow); | |
| 145 | + return; | |
| 146 | + } | |
| 147 | + | |
| 148 | + if (!(jQuery('#do_client_show').prop('checked') || jQuery('#do_client_hide').prop('checked'))) { | |
| 149 | + tinyMCEPopup.alert(errorMessages.clientNoAction); | |
| 150 | + return; | |
| 151 | + } | |
| 152 | + // Insert the contents from the input into the document | |
| 153 | + tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.client + ' ' + show_args + hide_args + display_args + ']{$selection}[/' + tags.client + ']'); | |
| 154 | + tinyMCEPopup.close(); | |
| 155 | + }, | |
| 156 | + | |
| 157 | + server_action : function() { | |
| 158 | + // Get settings from the dialog and build the arguments for the shortcode | |
| 159 | + var show_args = ""; | |
| 160 | + var hide_args = ""; | |
| 161 | + var debug_args = ""; | |
| 162 | + | |
| 163 | + var sd = jQuery('#server_show_date').val(); | |
| 164 | + var hd = jQuery('#server_hide_date').val(); | |
| 165 | + var st = jQuery('#server_show_time').val(); | |
| 166 | + var ht = jQuery('#server_hide_time').val(); | |
| 167 | + var tz = jQuery('#server_tz option:selected').val(); | |
| 168 | + var s_Date = new Date(sd + " " + st); | |
| 169 | + var h_Date = new Date(hd + " " + ht); | |
| 170 | + | |
| 171 | + if (jQuery('#do_server_show').prop('checked')) { | |
| 172 | + show_args = " show=\"" + sd + " " + st + " " + tz + "\""; | |
| 173 | + } | |
| 174 | + if (jQuery('#do_server_hide').prop('checked')) { | |
| 175 | + hide_args = " hide=\"" + hd + " " + ht + " " + tz + "\""; | |
| 176 | + } | |
| 177 | + if (jQuery('#server_debug').prop('checked')) { | |
| 178 | + debug_args = " debug=\"true\""; | |
| 179 | + } | |
| 180 | + | |
| 181 | + if (jQuery('#do_server_show').prop('checked') && (sd.length == 0)) { | |
| 182 | + tinyMCEPopup.alert(errorMessages.serverNoShowDate); | |
| 183 | + return; | |
| 184 | + } | |
| 185 | + | |
| 186 | + if (jQuery('#do_server_hide').prop('checked') && (hd.length == 0)) { | |
| 187 | + tinyMCEPopup.alert(errorMessages.serverNoHideDate); | |
| 188 | + return; | |
| 189 | + } | |
| 190 | + | |
| 191 | + if (jQuery('#do_server_show').prop('checked') && (st.length == 0)) { | |
| 192 | + tinyMCEPopup.alert(errorMessages.serverNoShowTime); | |
| 193 | + return; | |
| 194 | + } | |
| 195 | + | |
| 196 | + if (jQuery('#do_server_hide').prop('checked') && (ht.length == 0)) { | |
| 197 | + tinyMCEPopup.alert(errorMessages.serverNoHideTime); | |
| 198 | + return; | |
| 199 | + } | |
| 200 | + | |
| 201 | + if (jQuery('#do_server_show').prop('checked') && jQuery('#do_server_hide').prop('checked') && (s_Date >= h_Date)) { | |
| 202 | + tinyMCEPopup.alert(errorMessages.serverHideBeforeShow); | |
| 203 | + return; | |
| 204 | + } | |
| 205 | + | |
| 206 | + if (!(jQuery('#do_server_show').prop('checked') || jQuery('#do_server_hide').prop('checked'))) { | |
| 207 | + tinyMCEPopup.alert(errorMessages.serverNoAction); | |
| 208 | + return; | |
| 209 | + } | |
| 210 | + | |
| 211 | + // Insert the contents from the input into the document | |
| 212 | + tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.server + ' ' + show_args + hide_args + debug_args + ']{$selection}[/' + tags.server + ']'); | |
| 213 | + tinyMCEPopup.close(); | |
| 214 | + }, | |
| 215 | + | |
| 216 | + rules_action : function() { | |
| 217 | + // Get settings from the dialog and build the arguments for the shortcode | |
| 218 | + var rule_args = " id=\"" + jQuery('select#rules_list option:selected').val() + "\""; | |
| 219 | + | |
| 220 | + // Insert the contents from the input into the document | |
| 221 | + tinyMCEPopup.editor.execCommand('mceReplaceContent', false, '[' + tags.rule + ' ' + rule_args + ']{$selection}[/' + tags.rule + ']'); | |
| 222 | + tinyMCEPopup.close(); | |
| 223 | + } | |
| 224 | +}; | |
| 225 | + | |
| 226 | +tinyMCEPopup.onInit.add(TimedContentDialog.init, TimedContentDialog); | |