Changeset 7847
- Timestamp:
- Nov 23, 2010, 12:58:57 AM (13 years ago)
- Location:
- extensions/event_cats
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/template/autolog_new.js
r7832 r7847 17 17 var ec_selected_old_group = false; 18 18 var ec_validity_on = false; 19 var m_offset = 0; /* // Inutile a priori20 var valid_annee = 0;21 var valid_mois = 0;22 var valid_date = 0;23 var valid_heures = 0;24 var valid_minutes = 0; */25 var valid_timestamp = 0;26 19 var ec_err = ''; 27 20 var ec_selected_img = ''; … … 703 696 } 704 697 705 /* // Inutile a priori 706 function ec_update_ts(c) { 707 if (c && de('ec_valid_date_on_id').checked == '') 708 de('ec_valid_date_on_id').checked = 'checked'; 709 valid_timestamp = validity_date.getTime(); 710 // For tests purpose, must be removed 711 de('ec_span_tst_id').innerHTML = 'valid_timestamp : ' + valid_timestamp; 712 // For tests purpose, must be removed 713 } 714 */ 715 716 function ec_add_time(v2, k) { 717 var v = (isNaN(v2)) ? 0 : Number(v2); 718 var m = 0; 719 if (v < 0) v = 0; 698 function ec_get_validity() { 720 699 validity_date.setFullYear(de('ec_validity_year_id').value); 721 700 validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1); … … 725 704 validity_date.setSeconds(0); 726 705 validity_date.setMilliseconds(0); 727 valid_timestamp = validity_date.getTime(); 706 } 707 708 function ec_set_validity() { 709 de("ec_validity_year_id").value = validity_date.getFullYear(); 710 de("ec_validity_month_id").selectedIndex = validity_date.getMonth() + 1; 711 de("ec_validity_day_id").selectedIndex = validity_date.getDate(); 712 de("ec_validity_time_id").value = 713 ec_add_0(validity_date.getHours()) + 714 ":" + 715 ec_add_0(validity_date.getMinutes()); 716 } 717 718 function ec_mark_now() { 719 maintenant = new Date(); 720 validity_date.setTime(maintenant.getTime() + 120000); // Validity 721 // [date & time] cannot be less than two minutes 722 ec_set_validity(); 723 } 724 725 function ec_validity_check_min() { 726 var tp = new Date(); 727 maintenant = tp; 728 tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that 729 // [date & time] is less than [one minute more than current [date & time]]. 730 // Thus considering processing time, JavaScript should not allow a date 731 // less than [two minutes more than current [date & time]] (due to the fact 732 // that base unit for this value is one minute). 733 de("ec_min_year_id").value = tp.getFullYear(); 734 de("ec_min_month_id").selectedIndex = tp.getMonth() + 1; 735 de("ec_min_day_id").selectedIndex = tp.getDate(); 736 ec_get_validity(); 737 if (Number(validity_date.getTime()) < Number(tp.getTime())) { 738 validity_date = tp; 739 ec_set_validity(); 740 } 741 } 742 743 function ec_validity_set_min() { 744 ec_validity_check_min(); 745 // Run again this whole function after 1 mn 746 window.setTimeout("ec_validity_set_min()", 60000); 747 } 748 749 function ec_add_time(v2, k) { 750 var m = 0; var ts = 0; 751 var v = (isNaN(v2)) ? 0 : Number(v2); 752 if (v < 0) v = 0; 753 ec_get_validity(); 754 ts = Number(validity_date.getTime()); 728 755 switch (k) { 729 756 case 0 : // minute(s) 730 validity_date.setTime( valid_timestamp+ (v * 60000));757 validity_date.setTime(ts + (v * 60000)); 731 758 break; 732 759 case 1 : // hour(s) 733 validity_date.setTime( valid_timestamp+ (v * 3600000));760 validity_date.setTime(ts + (v * 3600000)); 734 761 break; 735 762 case 2 : // day(s) 736 validity_date.setTime( valid_timestamp+ (v * 86400000));763 validity_date.setTime(ts + (v * 86400000)); 737 764 break; 738 765 case 3 : // month(s) 739 m = de('ec_validity_month_id').selectedIndex + v;766 m = Number(de('ec_validity_month_id').selectedIndex + v); 740 767 validity_date.setFullYear( 741 768 Number(de('ec_validity_year_id').value) + Math.floor(m / 12) … … 747 774 break; 748 775 } 749 de("ec_validity_year_id").value = validity_date.getFullYear(); 750 de("ec_validity_month_id").selectedIndex = validity_date.getMonth() + 1; 751 de("ec_validity_day_id").selectedIndex = validity_date.getDate(); 752 de("ec_validity_time_id").value = 753 ec_add_0(validity_date.getHours()) + 754 ":" + 755 ec_add_0(validity_date.getMinutes()); 776 ec_set_validity(); 777 } 778 779 function ec_valid_set_time_to(v) { 780 var tp = new Date(); 781 var ts = 0; 782 maintenant = tp; 783 tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that 784 // [date & time] is less than [one minute more than current [date & time]]. 785 // Thus considering processing time, JavaScript should not allow a date 786 // less than [two minutes more than current [date & time]] (due to the fact 787 // that base unit for this value is one minute). 788 ec_get_validity(); 789 validity_date.setHours(v); 790 validity_date.setMinutes(0); 791 ts = Number(validity_date.getTime()); 792 if (ts < Number(tp.getTime())) 793 validity_date.setTime(ts + 86400000); // Add 1 day 794 ec_set_validity(); 795 ec_validity_check_min(); 756 796 } 757 797 … … 774 814 ec_selected_user = '-1'; 775 815 ec_selected_code = '-1'; 776 m_offset= maintenant.getTimezoneOffset();816 de('ec_valid_offset_id').value = maintenant.getTimezoneOffset(); 777 817 de('ec_style_forced_id').innerHTML = ec_up_code_lbl_forced_txt; 778 818 de('ec_act1_id').value = ec_default_action; … … 791 831 de('ec_input_action_home').checked = 'checked'; 792 832 de('ec_input_action_home').checked = ''; 793 de("ec_min_year_id").value = maintenant.getFullYear(); 794 de("ec_min_month_id").selectedIndex = maintenant.getMonth() + 1; 795 de("ec_min_day_id").selectedIndex = maintenant.getDate(); 796 de("ec_validity_year_id").value = maintenant.getFullYear(); 797 de("ec_validity_month_id").selectedIndex = maintenant.getMonth() + 1; 798 de("ec_validity_day_id").selectedIndex = maintenant.getDate(); 799 de("ec_validity_time_id").value = 800 ec_add_0(maintenant.getHours()) + 801 ":" + 802 ec_add_0(maintenant.getMinutes()); 833 ec_mark_now(); 834 ec_validity_set_min(); 803 835 pwg_initialization_datepicker("#ec_min_day_id", "#ec_min_month_id", 804 836 "#ec_min_year_id", "#ec_min_date_id", null, null, null); … … 806 838 "#ec_validity_month_id", "#ec_validity_year_id", "#ec_linked_date_id", 807 839 null, "#ec_min_date_id", null); 840 $(document).ready(function(){ 841 $('.ui-datepicker').click(function(){ 842 ec_validity_check_min(); 843 }); 844 $('.ec_datepicker').change(function(){ 845 ec_validity_check_min(); 846 }); 847 }); 808 848 809 849 if (ec_is_creation) { // Entry creation -
extensions/event_cats/admin/template/autolog_new.tpl
r7835 r7847 8 8 {* <!-- Remove a strange unwanted line at the bottom of the screen --> *} 9 9 {html_head} {literal} 10 <link rel = "stylesheet" type = "text/css" href = "{$RACINE_URL}themes/default/js/ui/theme/ui.datepicker.css"> 10 11 <style type = "text/css"> #ui-datepicker-div { display:none; } </style> 11 12 {/literal} {/html_head} … … 329 330 330 331 <td style="vertical-align:top; margin-top:0;"> 331 <p style = "text-align: 332 <p style = "text-align:left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt; font-weight: bold;"> 332 333 <label for = "ec_valid_date_on_id"> 333 334 <input type = "checkbox" name = "ec_valid_date_on" id = "ec_valid_date_on_id"> … … 337 338 <p style = "text-align:left;"> 338 339 <input id = "ec_date_today_btn_id" type = "button" value = "{'Now + 2 mn'|@translate}" 339 class = "submit" title = "{'Now button tooltip'|@translate}" onclick = ""> 340 class = "submit" title = "{'Now button tooltip'|@translate}" onclick = "ec_mark_now();"> — 341 <input id = "ec_set_time_to_btn_id" type = "button" value = "{'Set time to'|@translate}" 342 class = "submit" onclick = "ec_valid_set_time_to(document.getElementById('ec_set_time_to_id').selectedIndex);"> 343 <select id = "ec_set_time_to_id" name = "ec_set_time_to" onchange = "ec_valid_set_time_to(this.selectedIndex);"> 344 {section name=time start=0 loop=24} 345 <option label = "{if strlen($smarty.section.time.index) lt 2}0{/if}{$smarty.section.time.index}:00" value = "{$smarty.section.time.index}"> 346 {if strlen($smarty.section.time.index) lt 2}0{/if}{$smarty.section.time.index}:00 347 </option> 348 {/section} 349 </select> 340 350 </p> 341 351 <p style = "text-align:left;"> 342 <select id = "ec_validity_day_id" name = "ec_validity_day" >352 <select id = "ec_validity_day_id" name = "ec_validity_day" class = "ec_datepicker"> 343 353 <option value = "0">--</option> 344 354 {section name=day start=1 loop=32} … … 348 358 {/section} 349 359 </select> 350 <select id = "ec_validity_month_id" name = "ec_validity_month" >360 <select id = "ec_validity_month_id" name = "ec_validity_month" class = "ec_datepicker"> 351 361 {html_options options=$month_list} 352 362 </select> 353 <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4"> 354 <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" size = "5" maxlength = "5" title = "{'Hours field tooltip'|@translate}"> 363 <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4" style = "text-align:right;" class = "ec_datepicker"> 364 <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" class = "ec_datepicker" 365 size = "5" maxlength = "5" title = "{'Hours field tooltip'|@translate}" style = "text-align:right;"> 355 366 <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled"> 356 367 </p> … … 358 369 <input id = "ec_date_add_btn_id" type = "button" value = "{'Add'|@translate}" title = "{'Add button tooltip'|@translate}" class = "submit" 359 370 onclick = "ec_add_time(document.getElementById('ec_date_add_val_id').value, document.getElementById('ec_date_add_kind_id').selectedIndex);"> 360 <input id = "ec_date_add_val_id" type = "text" size = "5" maxlength = "5" value = "" > 371 <input id = "ec_date_add_val_id" type = "text" size = "5" maxlength = "5" value = "" style = "text-align:right;"> 361 372 <select id = "ec_date_add_kind_id" name = "ec_date_add_kind"> 362 373 <option label = "{'Minutes'|@translate}" value = "minutes">{'Minutes'|@translate}</option> … … 367 378 </select> 368 379 </p> 369 <p> 370 <table> 371 <tr> 372 <td style = "text-align:right; vertical-align:top; font-weight:bold;"> 373 <label for = "ec_notify_id" title = "{'Notify label tooltip'|@translate}"> 374 <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled"> 375 {'Do notify'|@translate} 376 </label> 377 </td> 378 <td style = "text-align:left;"> 379 <ul style = "list-style-type:none; list-style-position:inside; padding-left: 0.5em;"> 380 <li style = "margin-bottom:0;"> 381 <label for = "ec_notify_user_id"> 382 <input type = "checkbox" name = "ec_notify_user" id = "ec_notify_user_id"> 383 {'The user'|@translate} 384 </label> 385 </li> 386 <li style = "margin-bottom:0;"> 387 <label for = "ec_notify_webm_id"> 388 <input type = "checkbox" name = "ec_notify_webm" id = "ec_notify_webm_id"> 389 {'The webmaster'|@translate} 390 </label> 391 </li> 392 <li style = "margin-bottom:0;"> 393 <label for = "ec_notify_admins_id"> 394 <input type = "checkbox" name = "ec_notify_admins" id = "ec_notify_admins_id"> 395 {'All administrators'|@translate} 396 </label> 397 </li> 398 </ul> 399 </td> 400 </tr> 401 </table> 402 </p> 380 <br> 381 <table> 382 <tr> 383 <td style = "text-align:right; vertical-align:top; font-weight:bold;"> 384 <label for = "ec_notify_id" title = "{'Notify label tooltip'|@translate}"> 385 <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled"> 386 {'Do notify'|@translate} 387 </label> 388 </td> 389 <td style = "text-align:left;"> 390 <ul style = "list-style-type:none; list-style-position:inside; padding-left:0.5em;"> 391 <li style = "margin-bottom:0;"> 392 <label for = "ec_notify_user_id"> 393 <input type = "checkbox" name = "ec_notify_user" id = "ec_notify_user_id"> 394 {'The user'|@translate} 395 </label> 396 </li> 397 <li style = "margin-bottom:0;"> 398 <label for = "ec_notify_webm_id"> 399 <input type = "checkbox" name = "ec_notify_webm" id = "ec_notify_webm_id"> 400 {'The webmaster'|@translate} 401 </label> 402 </li> 403 <li style = "margin-bottom:0;"> 404 <label for = "ec_notify_admins_id"> 405 <input type = "checkbox" name = "ec_notify_admins" id = "ec_notify_admins_id"> 406 {'All administrators'|@translate} 407 </label> 408 </li> 409 </ul> 410 </td> 411 </tr> 412 </table> 403 413 <p style = "display:none;"> 404 414 <!-- jQuery datepicker: see (french) http://fr.piwigo.org/forum/viewtopic.php?id=19042 --> … … 415 425 </select> 416 426 <input id = "ec_min_year_id" name = "ec_min_year" type = "text" size = "4" maxlength = "4"> 417 <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" size = "10" disabled = "disabled"> 427 <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" disabled = "disabled"> 428 <input id = "ec_valid_offset_id" name = "ec_valid_offset" type = "text"> 418 429 </p> 419 430 {* <!-- For tests purpose; must be removed --> *} -
extensions/event_cats/language/en_UK/plugin.lang.php
r7835 r7847 84 84 $lang['Now + 2 mn'] = 'Now + 2 mn'; 85 85 $lang['Now button tooltip'] = 'Validity period can\'t be less than 1 mn. Considering processing time, 2 mn are required here.'; 86 $lang['Set time to'] = 'Set time to'; 86 87 $lang['Hours field tooltip'] = 'Format: hh:mm or h:m'; 87 88 $lang['Add'] = 'Add'; … … 97 98 $lang['The webmaster'] = 'the webmaster'; 98 99 $lang['All administrators'] = 'all administrators'; 99 $lang['Page once code outdated'] = 'Page to use once<br>the codehas expired';100 $lang['Page once code outdated'] = 'Page to assign to the code,<br>once it has expired'; 100 101 101 102 // Duplication page -
extensions/event_cats/language/fr_FR/plugin.lang.php
r7835 r7847 83 83 $lang['Activate'] = 'Activer'; 84 84 $lang['Now + 2 mn'] = 'Maintenant + 2 mn'; 85 $lang['Now button tooltip'] = 'La période de validité est forcément d\'au moins 1 mn. Avec les temps de traitement, 2 mn sont nécessaires ici.'; 85 $lang['Now button tooltip'] = 'La période de validité ne peut être inférieure à 1 mn. Compte tenu des temps de traitement, 2 mn sont nécessaires ici.'; 86 $lang['Set time to'] = 'Régler l\'heure à'; 86 87 $lang['Hours field tooltip'] = 'Format : hh:mm ou h:m'; 87 88 $lang['Add'] = 'Ajouter'; … … 97 98 $lang['The webmaster'] = 'le webmestre'; 98 99 $lang['All administrators'] = 'tous les administrateurs'; 99 $lang['Page once code outdated'] = 'Page à affecter au <br>code une foisexpiré';100 $lang['Page once code outdated'] = 'Page à affecter au code,<br>une fois qu\'il a expiré'; 100 101 101 102 // Duplication page
Note: See TracChangeset
for help on using the changeset viewer.