Index: /extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- /extensions/event_cats/admin/template/autolog_new.js	(revision 7827)
+++ /extensions/event_cats/admin/template/autolog_new.js	(revision 7828)
@@ -17,10 +17,10 @@
 var ec_selected_old_group       = false;
 var ec_validity_on              = false;
-var m_offset                    = 0;
+var m_offset                    = 0; /* // Inutile a priori
 var valid_annee                 = 0;
 var valid_mois                  = 0;
 var valid_date                  = 0;
 var valid_heures                = 0;
-var valid_minutes               = 0;
+var valid_minutes               = 0; */
 var valid_timestamp             = 0;
 var ec_err                      = '';
@@ -61,5 +61,4 @@
 var validity_date               = maintenant;
 
-
 function de(ec_id) {
   return document.getElementById(ec_id);
@@ -68,5 +67,5 @@
 function ec_add_0(s) {
   var s2 = String(s);
-  return (s2.length == 1) ? "0" + s2 : s2 ;
+  return (s2.length == 1) ? "0" + s2 : s2;
 }
 
@@ -704,66 +703,55 @@
 }
 
-function ec_update_ts() { /*
-  if (de('ec_valid_date_on_id').checked == '')
+/* // Inutile a priori
+function ec_update_ts(c) {
+  if (c && de('ec_valid_date_on_id').checked == '')
    de('ec_valid_date_on_id').checked = 'checked';
-  valid_annee     = Number(de('ec_validity_year_id').value);
-  valid_mois      = de('ec_validity_month_id').selectedIndex;
-  valid_date      = de('ec_validity_day_id').selectedIndex;
-  valid_heures    = Number(de('ec_validity_time_id').value.match(/^\d+/));
-  valid_minutes   = Number(de('ec_validity_time_id').value.match(/\d+$/));
-  validity_date.setFullYear(valid_annee);
-  validity_date.setMonth(valid_mois);
-  validity_date.setDate(valid_date);
-  validity_date.setHours(valid_heures);
-  validity_date.setMinutes(valid_minutes);
+  valid_timestamp = validity_date.getTime();
+  // For tests purpose, must be removed
+  de('ec_span_tst_id').innerHTML = 'valid_timestamp&nbsp;: ' + valid_timestamp;
+  // For tests purpose, must be removed
+}
+*/
+
+function ec_add_time(v2, k) {
+  var v = (isNaN(v2)) ? 0 : Number(v2);
+  var m = 0;
+  if (v < 0) v = 0;
+  validity_date.setFullYear(de('ec_validity_year_id').value);
+  validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1);
+  validity_date.setDate(de('ec_validity_day_id').selectedIndex);
+  validity_date.setHours(de('ec_validity_time_id').value.match(/^\d+/));
+  validity_date.setMinutes(de('ec_validity_time_id').value.match(/\d+$/));
   validity_date.setSeconds(0);
   validity_date.setMilliseconds(0);
   valid_timestamp = validity_date.getTime();
-  // For tests purpose, must be removed
-  de('ec_span_tst_id').innerHTML = 'valid_timestamp&nbsp;: ' + valid_timestamp;
-  // For tests purpose, must be removed */
-}
-
-function ec_update_date(v2, k) { // Validity period cannot be less than one minute
-  var v = (isNaN(v2)) ? 0 : Number(v2);
-  if (v < 0) v = 0;
   switch (k) {
-    case 0  :
-      valid_timestamp += v * 60000;
-      validity_date.setTime(valid_timestamp);
+    case 0  : // minute(s)
+      validity_date.setTime(valid_timestamp + (v *    60000));
     break;
-    case 1  :
-      valid_timestamp += v * 3600000;
-      validity_date.setTime(valid_timestamp);
+    case 1  : // hour(s)
+      validity_date.setTime(valid_timestamp + (v *  3600000));
     break;
-    case 2  :
-      valid_timestamp += v * 86400000;
-      validity_date.setTime(valid_timestamp);
+    case 2  : // day(s)
+      validity_date.setTime(valid_timestamp + (v * 86400000));
     break;
-    case 3  :
-      valid_annee  = Number(de('ec_validity_year_id').value);
-      var m        = de('ec_validity_month_id').selectedIndex + v;
-      valid_mois   = m % 12;
-      valid_annee += Math.floor(m / 12);
-      validity_date.setFullYear(valid_annee);
-      validity_date.setMonth(valid_mois);
-      valid_timestamp = validity_date.getTime();
+    case 3  : // month(s)
+      m = de('ec_validity_month_id').selectedIndex + v;
+      validity_date.setFullYear(
+        Number(de('ec_validity_year_id').value) + Math.floor(m / 12)
+      );
+      validity_date.setMonth(m % 12); // % : modulo
     break;
-    case 4  :
-      valid_annee  = Number(de('ec_validity_year_id').value) + v;
-      validity_date.setFullYear(valid_annee);
-      valid_timestamp = validity_date.getTime();
+    case 4  : // year(s)
+      validity_date.setFullYear(Number(de('ec_validity_year_id').value) + v);
     break;
   }
-  valid_annee   = validity_date.getFullYear();
-  valid_mois    = validity_date.getMonth();
-  valid_date    = validity_date.getDate();
-  valid_heures  = validity_date.getHours();
-  valid_minutes = validity_date.getMinutes();
-  de("ec_validity_year_id").value          = valid_annee;
-  de("ec_validity_month_id").selectedIndex = valid_mois - 1;
-  de("ec_validity_day_id").selectedIndex   = valid_date - 1;
+  de("ec_validity_year_id").value          = validity_date.getFullYear();
+  de("ec_validity_month_id").selectedIndex = validity_date.getMonth() + 1;
+  de("ec_validity_day_id").selectedIndex   = validity_date.getDate();
   de("ec_validity_time_id").value          =
-   ec_add_0(valid_heures) + ":" + ec_add_0(valid_minutes);
+   ec_add_0(validity_date.getHours()) +
+   ":" +
+   ec_add_0(validity_date.getMinutes());
 }
 
@@ -803,5 +791,19 @@
   de('ec_input_action_home').checked              = 'checked';
   de('ec_input_action_home').checked              = '';
-  
+  de("ec_min_year_id").value                      = maintenant.getFullYear();
+  de("ec_min_month_id").selectedIndex             = maintenant.getMonth() + 1;
+  de("ec_min_day_id").selectedIndex               = maintenant.getDate();
+  de("ec_validity_year_id").value                 = maintenant.getFullYear();
+  de("ec_validity_month_id").selectedIndex        = maintenant.getMonth() + 1;
+  de("ec_validity_day_id").selectedIndex          = maintenant.getDate();
+  de("ec_validity_time_id").value                 =
+   ec_add_0(maintenant.getHours()) +
+   ":" +
+   ec_add_0(maintenant.getMinutes());
+  pwg_initialization_datepicker("#ec_min_day_id", "#ec_min_month_id",
+   "#ec_min_year_id", "#ec_min_date_id", null, null, null);
+  pwg_initialization_datepicker("#ec_validity_day_id", 
+   "#ec_validity_month_id", "#ec_validity_year_id", "#ec_linked_date_id",
+   null, "#ec_min_date_id", null);
   
   if (ec_is_creation) { // Entry creation
Index: /extensions/event_cats/admin/template/autolog_new.tpl
===================================================================
--- /extensions/event_cats/admin/template/autolog_new.tpl	(revision 7827)
+++ /extensions/event_cats/admin/template/autolog_new.tpl	(revision 7828)
@@ -324,9 +324,9 @@
   <fieldset>
     <legend style = "font-weight:bold;">Date de validité</legend>
-    
     <table style = "margin-left: 0px; text-align:left;">
       <tr>
+        
         <td style="vertical-align:top; margin-top:0;">
-          <p style = "text-align: left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt;">
+          <p style = "text-align: left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt; font-weight: bold;">
             <label for = "ec_valid_date_on_id">
               <input type = "checkbox" name = "ec_valid_date_on" id = "ec_valid_date_on_id">
@@ -338,22 +338,22 @@
           </p>
           <p style = "text-align:left;">
-            <select id = "ec_validity_day_id" name = "ec_validity_day" {* onchange = "ec_update_ts();" *} >
+            <select id = "ec_validity_day_id" name = "ec_validity_day">
               <option value = "0">——</option>
               {section name=day start=1 loop=32}
-                <option value = "{$smarty.section.day.index}" {if $smarty.section.day.index == 14} selected = "selected" {/if} >
+                <option value = "{$smarty.section.day.index}">
                   {$smarty.section.day.index}
                 </option>
               {/section}
             </select>
-            <select id = "ec_validity_month_id" name = "ec_validity_month" {* onchange = "ec_update_ts();" *} >
-              {html_options options=$month_list selected=11}
+            <select id = "ec_validity_month_id" name = "ec_validity_month">
+              {html_options options=$month_list}
             </select>
-            <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4" value = "2010" {* onchange = "ec_update_ts();" *} >
-            <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" size = "5" maxlength = "5" value = "22:50" {* onchange = "ec_update_ts();" *} >
+            <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4">
+            <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" size = "5" maxlength = "5">
             <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled">
           </p>
           <p style = "text-align:left;">
             <input id = "ec_date_add_btn_id" type = "button" value = "Ajouter"
-             onclick = "ec_update_date(document.getElementById('ec_date_add_val_id').value, document.getElementById('ec_date_add_kind_id').selectedIndex);">&nbsp;
+             onclick = "ec_add_time(document.getElementById('ec_date_add_val_id').value, document.getElementById('ec_date_add_kind_id').selectedIndex);">&nbsp;
             <input id = "ec_date_add_val_id" type = "text" size = "5" maxlength = "5" value = "">&nbsp;
             <select id = "ec_date_add_kind_id" name = "ec_date_add_kind">
@@ -365,6 +365,53 @@
             </select>
           </p>
+          <p>
+            <table>
+              <tr>
+                <td style = "text-align:right; vertical-align:top; font-weight:bold;">
+                  <label for = "ec_notify_id">
+                    <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled">
+                    Lorsque le code<br>
+                    a expiré, notifier
+                  </label>
+                </td>
+                <td style = "text-align:left;">
+                  <ul style = "list-style-type:none; list-style-position:inside; padding-left: 0.5em;">
+                    <li style = "margin-bottom:0;">
+                      <label for = "ec_notify_user_id">
+                        <input type = "checkbox" name = "ec_notify_user" id = "ec_notify_user_id">
+                        l'utilisateur
+                      </label>
+                    </li>
+                    <li style = "margin-bottom:0;">
+                      <label for = "ec_notify_webm_id">
+                        <input type = "checkbox" name = "ec_notify_webm" id = "ec_notify_webm_id">
+                        le webmestre
+                      </label>
+                    </li>
+                    <li style = "margin-bottom:0;">
+                      <label for = "ec_notify_admins_id">
+                        <input type = "checkbox" name = "ec_notify_admins" id = "ec_notify_admins_id">
+                        tous les administrateurs
+                      </label>
+                    </li>
+                  </ul>
+                </td>
+              </tr>
+            </table>
+          </p>
           <p style = "display:none;">
             <!-- jQuery datepicker : voir http://fr.piwigo.org/forum/viewtopic.php?id=19042 -->
+            <select id = "ec_min_day_id" name = "ec_min_day">
+              <option value = "0">——</option>
+              {section name=day start=1 loop=32}
+                <option value = "{$smarty.section.day.index}" {if $smarty.section.day.index == 14} selected = "selected" {/if} >
+                  {$smarty.section.day.index}
+                </option>
+              {/section}
+            </select>
+            <select id = "ec_min_month_id" name = "ec_min_month">
+              {html_options options=$month_list selected=11}
+            </select>
+            <input id = "ec_min_year_id" name = "ec_min_year" type = "text" size = "4" maxlength = "4" value = "2010" >
             <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" size = "10" disabled = "disabled">
           </p>
@@ -375,11 +422,13 @@
           {* <!-- /For tests purpose ; must be removed --> *}
         </td>
+        
         <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td> {* <!-- sorry :-\ --> *}
-        <td>
+        
+        <td style="vertical-align:top; margin-top:0;">
           <table>
             <tr>
               <td style = "text-align:right; vertical-align:top; font-weight:bold;">
-                Page à utiliser après<br>
-                expiration du code
+                Page à affecter au<br>
+                code une fois expiré
               </td>
               <td style = "text-align:left;">
@@ -428,8 +477,4 @@
 <script type = "text/javascript" src = "{$RACINE_URL}{$EVNTCATS_PATH}admin/template/autolog_new.js"></script>
 <script type = "text/javascript"><!--
-  pwg_initialization_datepicker("#ec_validity_day_id", "#ec_validity_month_id",
-   "#ec_validity_year_id", "#ec_min_date_id", null, null, null);
-  pwg_initialization_datepicker("#ec_validity_day_id", "#ec_validity_month_id",
-   "#ec_validity_year_id", "#ec_linked_date_id", null, "#ec_min_date_id", null);
   ec_is_creation                          = {if $ec_is_creation}true{else}false{/if};
   ec_validity_on                          = {if $ec_validity_on}true{else}false{/if};
