Changeset 7828 for extensions/event_cats/admin/template
- Timestamp:
- Nov 21, 2010, 4:47:29 PM (14 years ago)
- Location:
- extensions/event_cats/admin/template
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/event_cats/admin/template/autolog_new.js
r7810 r7828 17 17 var ec_selected_old_group = false; 18 18 var ec_validity_on = false; 19 var m_offset = 0; 19 var m_offset = 0; /* // Inutile a priori 20 20 var valid_annee = 0; 21 21 var valid_mois = 0; 22 22 var valid_date = 0; 23 23 var valid_heures = 0; 24 var valid_minutes = 0; 24 var valid_minutes = 0; */ 25 25 var valid_timestamp = 0; 26 26 var ec_err = ''; … … 61 61 var validity_date = maintenant; 62 62 63 64 63 function de(ec_id) { 65 64 return document.getElementById(ec_id); … … 68 67 function ec_add_0(s) { 69 68 var s2 = String(s); 70 return (s2.length == 1) ? "0" + s2 : s2 69 return (s2.length == 1) ? "0" + s2 : s2; 71 70 } 72 71 … … 704 703 } 705 704 706 function ec_update_ts() { /* 707 if (de('ec_valid_date_on_id').checked == '') 705 /* // Inutile a priori 706 function ec_update_ts(c) { 707 if (c && de('ec_valid_date_on_id').checked == '') 708 708 de('ec_valid_date_on_id').checked = 'checked'; 709 valid_annee = Number(de('ec_validity_year_id').value); 710 valid_mois = de('ec_validity_month_id').selectedIndex; 711 valid_date = de('ec_validity_day_id').selectedIndex; 712 valid_heures = Number(de('ec_validity_time_id').value.match(/^\d+/)); 713 valid_minutes = Number(de('ec_validity_time_id').value.match(/\d+$/)); 714 validity_date.setFullYear(valid_annee); 715 validity_date.setMonth(valid_mois); 716 validity_date.setDate(valid_date); 717 validity_date.setHours(valid_heures); 718 validity_date.setMinutes(valid_minutes); 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; 720 validity_date.setFullYear(de('ec_validity_year_id').value); 721 validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1); 722 validity_date.setDate(de('ec_validity_day_id').selectedIndex); 723 validity_date.setHours(de('ec_validity_time_id').value.match(/^\d+/)); 724 validity_date.setMinutes(de('ec_validity_time_id').value.match(/\d+$/)); 719 725 validity_date.setSeconds(0); 720 726 validity_date.setMilliseconds(0); 721 727 valid_timestamp = validity_date.getTime(); 722 // For tests purpose, must be removed723 de('ec_span_tst_id').innerHTML = 'valid_timestamp : ' + valid_timestamp;724 // For tests purpose, must be removed */725 }726 727 function ec_update_date(v2, k) { // Validity period cannot be less than one minute728 var v = (isNaN(v2)) ? 0 : Number(v2);729 if (v < 0) v = 0;730 728 switch (k) { 731 case 0 : 732 valid_timestamp += v * 60000; 733 validity_date.setTime(valid_timestamp); 729 case 0 : // minute(s) 730 validity_date.setTime(valid_timestamp + (v * 60000)); 734 731 break; 735 case 1 : 736 valid_timestamp += v * 3600000; 737 validity_date.setTime(valid_timestamp); 732 case 1 : // hour(s) 733 validity_date.setTime(valid_timestamp + (v * 3600000)); 738 734 break; 739 case 2 : 740 valid_timestamp += v * 86400000; 741 validity_date.setTime(valid_timestamp); 735 case 2 : // day(s) 736 validity_date.setTime(valid_timestamp + (v * 86400000)); 742 737 break; 743 case 3 : 744 valid_annee = Number(de('ec_validity_year_id').value); 745 var m = de('ec_validity_month_id').selectedIndex + v; 746 valid_mois = m % 12; 747 valid_annee += Math.floor(m / 12); 748 validity_date.setFullYear(valid_annee); 749 validity_date.setMonth(valid_mois); 750 valid_timestamp = validity_date.getTime(); 738 case 3 : // month(s) 739 m = de('ec_validity_month_id').selectedIndex + v; 740 validity_date.setFullYear( 741 Number(de('ec_validity_year_id').value) + Math.floor(m / 12) 742 ); 743 validity_date.setMonth(m % 12); // % : modulo 751 744 break; 752 case 4 : 753 valid_annee = Number(de('ec_validity_year_id').value) + v; 754 validity_date.setFullYear(valid_annee); 755 valid_timestamp = validity_date.getTime(); 745 case 4 : // year(s) 746 validity_date.setFullYear(Number(de('ec_validity_year_id').value) + v); 756 747 break; 757 748 } 758 valid_annee = validity_date.getFullYear(); 759 valid_mois = validity_date.getMonth(); 760 valid_date = validity_date.getDate(); 761 valid_heures = validity_date.getHours(); 762 valid_minutes = validity_date.getMinutes(); 763 de("ec_validity_year_id").value = valid_annee; 764 de("ec_validity_month_id").selectedIndex = valid_mois - 1; 765 de("ec_validity_day_id").selectedIndex = valid_date - 1; 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(); 766 752 de("ec_validity_time_id").value = 767 ec_add_0(valid_heures) + ":" + ec_add_0(valid_minutes); 753 ec_add_0(validity_date.getHours()) + 754 ":" + 755 ec_add_0(validity_date.getMinutes()); 768 756 } 769 757 … … 803 791 de('ec_input_action_home').checked = 'checked'; 804 792 de('ec_input_action_home').checked = ''; 805 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()); 803 pwg_initialization_datepicker("#ec_min_day_id", "#ec_min_month_id", 804 "#ec_min_year_id", "#ec_min_date_id", null, null, null); 805 pwg_initialization_datepicker("#ec_validity_day_id", 806 "#ec_validity_month_id", "#ec_validity_year_id", "#ec_linked_date_id", 807 null, "#ec_min_date_id", null); 806 808 807 809 if (ec_is_creation) { // Entry creation -
extensions/event_cats/admin/template/autolog_new.tpl
r7811 r7828 324 324 <fieldset> 325 325 <legend style = "font-weight:bold;">Date de validité</legend> 326 327 326 <table style = "margin-left: 0px; text-align:left;"> 328 327 <tr> 328 329 329 <td style="vertical-align:top; margin-top:0;"> 330 <p style = "text-align: left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt; ">330 <p style = "text-align: left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt; font-weight: bold;"> 331 331 <label for = "ec_valid_date_on_id"> 332 332 <input type = "checkbox" name = "ec_valid_date_on" id = "ec_valid_date_on_id"> … … 338 338 </p> 339 339 <p style = "text-align:left;"> 340 <select id = "ec_validity_day_id" name = "ec_validity_day" {* onchange = "ec_update_ts();" *}>340 <select id = "ec_validity_day_id" name = "ec_validity_day"> 341 341 <option value = "0">——</option> 342 342 {section name=day start=1 loop=32} 343 <option value = "{$smarty.section.day.index}" {if $smarty.section.day.index == 14} selected = "selected" {/if}>343 <option value = "{$smarty.section.day.index}"> 344 344 {$smarty.section.day.index} 345 345 </option> 346 346 {/section} 347 347 </select> 348 <select id = "ec_validity_month_id" name = "ec_validity_month" {* onchange = "ec_update_ts();" *}>349 {html_options options=$month_list selected=11}348 <select id = "ec_validity_month_id" name = "ec_validity_month"> 349 {html_options options=$month_list} 350 350 </select> 351 <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4" value = "2010" {* onchange = "ec_update_ts();" *}>352 <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" size = "5" maxlength = "5" value = "22:50" {* onchange = "ec_update_ts();" *}>351 <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4"> 352 <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" size = "5" maxlength = "5"> 353 353 <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled"> 354 354 </p> 355 355 <p style = "text-align:left;"> 356 356 <input id = "ec_date_add_btn_id" type = "button" value = "Ajouter" 357 onclick = "ec_ update_date(document.getElementById('ec_date_add_val_id').value, document.getElementById('ec_date_add_kind_id').selectedIndex);"> 357 onclick = "ec_add_time(document.getElementById('ec_date_add_val_id').value, document.getElementById('ec_date_add_kind_id').selectedIndex);"> 358 358 <input id = "ec_date_add_val_id" type = "text" size = "5" maxlength = "5" value = ""> 359 359 <select id = "ec_date_add_kind_id" name = "ec_date_add_kind"> … … 365 365 </select> 366 366 </p> 367 <p> 368 <table> 369 <tr> 370 <td style = "text-align:right; vertical-align:top; font-weight:bold;"> 371 <label for = "ec_notify_id"> 372 <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled"> 373 Lorsque le code<br> 374 a expiré, notifier 375 </label> 376 </td> 377 <td style = "text-align:left;"> 378 <ul style = "list-style-type:none; list-style-position:inside; padding-left: 0.5em;"> 379 <li style = "margin-bottom:0;"> 380 <label for = "ec_notify_user_id"> 381 <input type = "checkbox" name = "ec_notify_user" id = "ec_notify_user_id"> 382 l'utilisateur 383 </label> 384 </li> 385 <li style = "margin-bottom:0;"> 386 <label for = "ec_notify_webm_id"> 387 <input type = "checkbox" name = "ec_notify_webm" id = "ec_notify_webm_id"> 388 le webmestre 389 </label> 390 </li> 391 <li style = "margin-bottom:0;"> 392 <label for = "ec_notify_admins_id"> 393 <input type = "checkbox" name = "ec_notify_admins" id = "ec_notify_admins_id"> 394 tous les administrateurs 395 </label> 396 </li> 397 </ul> 398 </td> 399 </tr> 400 </table> 401 </p> 367 402 <p style = "display:none;"> 368 403 <!-- jQuery datepicker : voir http://fr.piwigo.org/forum/viewtopic.php?id=19042 --> 404 <select id = "ec_min_day_id" name = "ec_min_day"> 405 <option value = "0">——</option> 406 {section name=day start=1 loop=32} 407 <option value = "{$smarty.section.day.index}" {if $smarty.section.day.index == 14} selected = "selected" {/if} > 408 {$smarty.section.day.index} 409 </option> 410 {/section} 411 </select> 412 <select id = "ec_min_month_id" name = "ec_min_month"> 413 {html_options options=$month_list selected=11} 414 </select> 415 <input id = "ec_min_year_id" name = "ec_min_year" type = "text" size = "4" maxlength = "4" value = "2010" > 369 416 <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" size = "10" disabled = "disabled"> 370 417 </p> … … 375 422 {* <!-- /For tests purpose ; must be removed --> *} 376 423 </td> 424 377 425 <td> </td><td> </td><td> </td> {* <!-- sorry :-\ --> *} 378 <td> 426 427 <td style="vertical-align:top; margin-top:0;"> 379 428 <table> 380 429 <tr> 381 430 <td style = "text-align:right; vertical-align:top; font-weight:bold;"> 382 Page à utiliser après<br>383 expiration du code431 Page à affecter au<br> 432 code une fois expiré 384 433 </td> 385 434 <td style = "text-align:left;"> … … 428 477 <script type = "text/javascript" src = "{$RACINE_URL}{$EVNTCATS_PATH}admin/template/autolog_new.js"></script> 429 478 <script type = "text/javascript"><!-- 430 pwg_initialization_datepicker("#ec_validity_day_id", "#ec_validity_month_id",431 "#ec_validity_year_id", "#ec_min_date_id", null, null, null);432 pwg_initialization_datepicker("#ec_validity_day_id", "#ec_validity_month_id",433 "#ec_validity_year_id", "#ec_linked_date_id", null, "#ec_min_date_id", null);434 479 ec_is_creation = {if $ec_is_creation}true{else}false{/if}; 435 480 ec_validity_on = {if $ec_validity_on}true{else}false{/if};
Note: See TracChangeset
for help on using the changeset viewer.