Index: extensions/event_cats/admin/template/autolog_new.js
===================================================================
--- extensions/event_cats/admin/template/autolog_new.js	(revision 7835)
+++ extensions/event_cats/admin/template/autolog_new.js	(revision 7847)
@@ -17,11 +17,4 @@
 var ec_selected_old_group       = false;
 var ec_validity_on              = false;
-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_timestamp             = 0;
 var ec_err                      = '';
 var ec_selected_img             = '';
@@ -703,19 +696,5 @@
 }
 
-/* // 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_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;
+function ec_get_validity() {
   validity_date.setFullYear(de('ec_validity_year_id').value);
   validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1);
@@ -725,17 +704,65 @@
   validity_date.setSeconds(0);
   validity_date.setMilliseconds(0);
-  valid_timestamp = validity_date.getTime();
+}
+
+function ec_set_validity() {
+  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(validity_date.getHours()) +
+   ":" +
+   ec_add_0(validity_date.getMinutes());
+}
+
+function ec_mark_now() {
+  maintenant = new Date();
+  validity_date.setTime(maintenant.getTime() + 120000); // Validity
+  // [date & time] cannot be less than two minutes
+  ec_set_validity();
+}
+
+function ec_validity_check_min() {
+  var tp = new Date();
+  maintenant = tp;
+  tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that
+  // [date & time] is less than [one minute more than current [date & time]].
+  // Thus considering processing time, JavaScript should not allow a date
+  // less than [two minutes more than current [date & time]] (due to the fact
+  // that base unit for this value is one minute).
+  de("ec_min_year_id").value          = tp.getFullYear();
+  de("ec_min_month_id").selectedIndex = tp.getMonth() + 1;
+  de("ec_min_day_id").selectedIndex   = tp.getDate();
+  ec_get_validity();
+  if (Number(validity_date.getTime()) < Number(tp.getTime())) {
+    validity_date = tp;
+    ec_set_validity();
+  }
+}
+
+function ec_validity_set_min() {
+  ec_validity_check_min();
+  // Run again this whole function after 1 mn
+  window.setTimeout("ec_validity_set_min()", 60000);
+}
+
+function ec_add_time(v2, k) {
+  var m = 0; var ts = 0;
+  var v = (isNaN(v2)) ? 0 : Number(v2);
+  if (v < 0) v = 0;
+  ec_get_validity();
+  ts = Number(validity_date.getTime());
   switch (k) {
     case 0  : // minute(s)
-      validity_date.setTime(valid_timestamp + (v *    60000));
+      validity_date.setTime(ts + (v *    60000));
     break;
     case 1  : // hour(s)
-      validity_date.setTime(valid_timestamp + (v *  3600000));
+      validity_date.setTime(ts + (v *  3600000));
     break;
     case 2  : // day(s)
-      validity_date.setTime(valid_timestamp + (v * 86400000));
+      validity_date.setTime(ts + (v * 86400000));
     break;
     case 3  : // month(s)
-      m = de('ec_validity_month_id').selectedIndex + v;
+      m = Number(de('ec_validity_month_id').selectedIndex + v);
       validity_date.setFullYear(
         Number(de('ec_validity_year_id').value) + Math.floor(m / 12)
@@ -747,11 +774,24 @@
     break;
   }
-  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(validity_date.getHours()) +
-   ":" +
-   ec_add_0(validity_date.getMinutes());
+  ec_set_validity();
+}
+
+function ec_valid_set_time_to(v) {
+  var tp = new Date();
+  var ts = 0;
+  maintenant = tp;
+  tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that
+  // [date & time] is less than [one minute more than current [date & time]].
+  // Thus considering processing time, JavaScript should not allow a date
+  // less than [two minutes more than current [date & time]] (due to the fact
+  // that base unit for this value is one minute).
+  ec_get_validity();
+  validity_date.setHours(v);
+  validity_date.setMinutes(0);
+  ts = Number(validity_date.getTime());
+  if (ts < Number(tp.getTime()))
+   validity_date.setTime(ts + 86400000); // Add 1 day
+  ec_set_validity();
+  ec_validity_check_min();
 }
 
@@ -774,5 +814,5 @@
   ec_selected_user                                = '-1';
   ec_selected_code                                = '-1';
-  m_offset                                   = maintenant.getTimezoneOffset();
+  de('ec_valid_offset_id').value             = maintenant.getTimezoneOffset();
   de('ec_style_forced_id').innerHTML              = ec_up_code_lbl_forced_txt;
   de('ec_act1_id').value                          = ec_default_action;
@@ -791,14 +831,6 @@
   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());
+  ec_mark_now();
+  ec_validity_set_min();
   pwg_initialization_datepicker("#ec_min_day_id", "#ec_min_month_id",
    "#ec_min_year_id", "#ec_min_date_id", null, null, null);
@@ -806,4 +838,12 @@
    "#ec_validity_month_id", "#ec_validity_year_id", "#ec_linked_date_id",
    null, "#ec_min_date_id", null);
+  $(document).ready(function(){
+    $('.ui-datepicker').click(function(){
+      ec_validity_check_min();
+    });
+    $('.ec_datepicker').change(function(){
+      ec_validity_check_min();
+    });
+  });
   
   if (ec_is_creation) { // Entry creation
Index: extensions/event_cats/admin/template/autolog_new.tpl
===================================================================
--- extensions/event_cats/admin/template/autolog_new.tpl	(revision 7835)
+++ extensions/event_cats/admin/template/autolog_new.tpl	(revision 7847)
@@ -8,4 +8,5 @@
 {* <!-- Remove a strange unwanted line at the bottom of the screen --> *}
 {html_head} {literal}
+  <link rel = "stylesheet" type = "text/css" href = "{$RACINE_URL}themes/default/js/ui/theme/ui.datepicker.css">
   <style type = "text/css"> #ui-datepicker-div { display:none; } </style>
 {/literal} {/html_head}
@@ -329,5 +330,5 @@
         
         <td style="vertical-align:top; margin-top:0;">
-          <p style = "text-align: left; padding-bottom: 1em; padding-top: 0; margin-top: 0pt; font-weight: bold;">
+          <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">
@@ -337,8 +338,17 @@
           <p style = "text-align:left;">
             <input id = "ec_date_today_btn_id" type = "button" value = "{'Now + 2 mn'|@translate}"
-             class = "submit" title = "{'Now button tooltip'|@translate}" onclick = "">
+             class = "submit" title = "{'Now button tooltip'|@translate}" onclick = "ec_mark_now();">&nbsp;—&nbsp;
+            <input id = "ec_set_time_to_btn_id" type = "button" value = "{'Set time to'|@translate}"
+             class = "submit" onclick = "ec_valid_set_time_to(document.getElementById('ec_set_time_to_id').selectedIndex);">&nbsp;
+            <select id = "ec_set_time_to_id" name = "ec_set_time_to" onchange = "ec_valid_set_time_to(this.selectedIndex);">
+              {section name=time start=0 loop=24}
+                <option label = "{if strlen($smarty.section.time.index) lt 2}0{/if}{$smarty.section.time.index}:00" value = "{$smarty.section.time.index}">
+                  {if strlen($smarty.section.time.index) lt 2}0{/if}{$smarty.section.time.index}:00
+                </option>
+              {/section}
+            </select>
           </p>
           <p style = "text-align:left;">
-            <select id = "ec_validity_day_id" name = "ec_validity_day">
+            <select id = "ec_validity_day_id" name = "ec_validity_day" class = "ec_datepicker">
               <option value = "0">--</option>
               {section name=day start=1 loop=32}
@@ -348,9 +358,10 @@
               {/section}
             </select>
-            <select id = "ec_validity_month_id" name = "ec_validity_month">
+            <select id = "ec_validity_month_id" name = "ec_validity_month" class = "ec_datepicker">
               {html_options options=$month_list}
             </select>
-            <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" title = "{'Hours field tooltip'|@translate}">
+            <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4" maxlength = "4" style = "text-align:right;" class = "ec_datepicker">
+            <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" class = "ec_datepicker"
+             size = "5" maxlength = "5" title = "{'Hours field tooltip'|@translate}" style = "text-align:right;">
             <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled">
           </p>
@@ -358,5 +369,5 @@
             <input id = "ec_date_add_btn_id" type = "button" value = "{'Add'|@translate}" title = "{'Add button tooltip'|@translate}" class = "submit"
              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;
+            <input id = "ec_date_add_val_id" type = "text" size = "5" maxlength = "5" value = "" style = "text-align:right;">&nbsp;
             <select id = "ec_date_add_kind_id" name = "ec_date_add_kind">
               <option label = "{'Minutes'|@translate}" value = "minutes">{'Minutes'|@translate}</option>
@@ -367,38 +378,37 @@
             </select>
           </p>
-          <p>
-            <table>
-              <tr>
-                <td style = "text-align:right; vertical-align:top; font-weight:bold;">
-                  <label for = "ec_notify_id" title = "{'Notify label tooltip'|@translate}">
-                    <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled">
-                    {'Do notify'|@translate}
-                  </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">
-                        {'The user'|@translate}
-                      </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">
-                        {'The webmaster'|@translate}
-                      </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">
-                        {'All administrators'|@translate}
-                      </label>
-                    </li>
-                  </ul>
-                </td>
-              </tr>
-            </table>
-          </p>
+          <br>
+          <table>
+            <tr>
+              <td style = "text-align:right; vertical-align:top; font-weight:bold;">
+                <label for = "ec_notify_id" title = "{'Notify label tooltip'|@translate}">
+                  <input type = "checkbox" name = "ec_notify" id = "ec_notify_id" disabled = "disabled">
+                  {'Do notify'|@translate}
+                </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">
+                      {'The user'|@translate}
+                    </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">
+                      {'The webmaster'|@translate}
+                    </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">
+                      {'All administrators'|@translate}
+                    </label>
+                  </li>
+                </ul>
+              </td>
+            </tr>
+          </table>
           <p style = "display:none;">
             <!-- jQuery datepicker: see (french) http://fr.piwigo.org/forum/viewtopic.php?id=19042 -->
@@ -415,5 +425,6 @@
             </select>
             <input id = "ec_min_year_id" name = "ec_min_year" type = "text" size = "4" maxlength = "4">
-            <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" size = "10" disabled = "disabled">
+            <input id = "ec_min_date_id" name = "ec_min_date_id" type = "hidden" disabled = "disabled">
+            <input id = "ec_valid_offset_id" name = "ec_valid_offset" type = "text">
           </p>
           {* <!-- For tests purpose; must be removed --> *}
Index: extensions/event_cats/language/en_UK/plugin.lang.php
===================================================================
--- extensions/event_cats/language/en_UK/plugin.lang.php	(revision 7835)
+++ extensions/event_cats/language/en_UK/plugin.lang.php	(revision 7847)
@@ -84,4 +84,5 @@
 $lang['Now + 2 mn']                = 'Now + 2 mn';
 $lang['Now button tooltip']        = 'Validity period can\'t be less than 1 mn. Considering processing time, 2 mn are required here.';
+$lang['Set time to']               = 'Set time to';
 $lang['Hours field tooltip']       = 'Format: hh:mm or h:m';
 $lang['Add']                       = 'Add';
@@ -97,5 +98,5 @@
 $lang['The webmaster']             = 'the webmaster';
 $lang['All administrators']        = 'all administrators';
-$lang['Page once code outdated']   = 'Page to use once<br>the code has expired';
+$lang['Page once code outdated']   = 'Page to assign to the code,<br>once it has expired';
 
 // Duplication page
Index: extensions/event_cats/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 7835)
+++ extensions/event_cats/language/fr_FR/plugin.lang.php	(revision 7847)
@@ -83,5 +83,6 @@
 $lang['Activate']                  = 'Activer';
 $lang['Now + 2 mn']                = 'Maintenant + 2 mn';
-$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.';
+$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.';
+$lang['Set time to']               = 'Régler l\'heure à';
 $lang['Hours field tooltip']       = 'Format : hh:mm ou h:m';
 $lang['Add']                       = 'Ajouter';
@@ -97,5 +98,5 @@
 $lang['The webmaster']             = 'le webmestre';
 $lang['All administrators']        = 'tous les administrateurs';
-$lang['Page once code outdated']   = 'Page à affecter au<br>code une fois expiré';
+$lang['Page once code outdated']   = 'Page à affecter au code,<br>une fois qu\'il a expiré';
 
 // Duplication page
