Changeset 7864


Ignore:
Timestamp:
Nov 24, 2010, 1:10:15 AM (10 years ago)
Author:
LucMorizur
Message:

Validity date presentation somehow finished now

Location:
extensions/event_cats/admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/admin/autolog_new.inc.php

    r7832 r7864  
    119119  "))) == 0),
    120120  'month_list'             => $month_list,
     121  'ec_days'                => $lang['day'],
    121122  'ec_current_day'         => intval(date('j')),
    122123  'ec_current_month'       => intval(date('n')),
  • extensions/event_cats/admin/template/autolog_new.js

    r7849 r7864  
    1717var ec_selected_old_group       = false;
    1818var ec_validity_on              = false;
     19var ec_validity_day_length      = 0;
    1920var ec_err                      = '';
    2021var ec_selected_img             = '';
     
    4344var ec_duplic_codes             = new Array();
    4445var ec_lists_temp               = new Array();
     46var ec_validity_days            = new Array();
    4547var ec_lists                    = new Array();
    4648    ec_lists['code']            = new Array();
     
    697699
    698700function ec_get_validity() {
     701  validity_date.setMilliseconds(0);
     702  validity_date.setSeconds(0);
     703  validity_date.setMinutes(de('ec_validity_time_id').value.match(/\d+$/));
     704  validity_date.setHours(de('ec_validity_time_id').value.match(/^\d+/));
     705  validity_date.setDate(de('ec_validity_day_id').selectedIndex);
     706  validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1);
    699707  validity_date.setFullYear(de('ec_validity_year_id').value);
    700   validity_date.setMonth(de('ec_validity_month_id').selectedIndex - 1);
    701   validity_date.setDate(de('ec_validity_day_id').selectedIndex);
    702   validity_date.setHours(de('ec_validity_time_id').value.match(/^\d+/));
    703   validity_date.setMinutes(de('ec_validity_time_id').value.match(/\d+$/));
     708}
     709
     710function ec_set_validity() {
     711  validity_date.setMilliseconds(0);
    704712  validity_date.setSeconds(0);
    705   validity_date.setMilliseconds(0);
    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  de('ec_validity_year_id').value          = validity_date.getFullYear();
     714  de('ec_validity_month_id').selectedIndex = validity_date.getMonth() + 1;
     715  de('ec_validity_day_id').selectedIndex   = validity_date.getDate();
     716  de('ec_validity_time_id').value          =
    713717   ec_add_0(validity_date.getHours()) +
    714    ":" +
     718   ':' +
    715719   ec_add_0(validity_date.getMinutes());
     720  de('ec_validity_sel_day').value          =
     721   ec_validity_days[validity_date.getDay()];
    716722}
    717723
    718724function ec_validity_check_min() {
    719725  var tp = new Date();
     726  tp.setMilliseconds(0);
     727  tp.setSeconds(0);
    720728  maintenant = tp;
    721729  tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that
     
    728736  de("ec_min_day_id").selectedIndex   = tp.getDate();
    729737  ec_get_validity();
    730   if (Number(validity_date.getTime()) < Number(tp.getTime())) {
    731     validity_date = tp;
    732     ec_set_validity();
    733   }
     738  if (Number(validity_date.getTime()) < Number(tp.getTime()))
     739   validity_date = tp;
     740  ec_set_validity();
    734741}
    735742
    736743function ec_mark_now() {
    737744  maintenant = new Date();
    738   validity_date.setTime(maintenant.getTime() + 120000); // Validity
    739   // [date & time] cannot be less than two minutes
     745  validity_date.setTime(maintenant.getTime() + 120000); // See two minutes
     746   // explanation in function ec_validity_check_min
    740747  ec_set_validity();
    741748}
     
    782789  var ts = 0;
    783790  maintenant = tp;
    784   tp.setTime(maintenant.getTime() + 120000); // PHP will not allow that
    785   // [date & time] is less than [one minute more than current [date & time]].
    786   // Thus considering processing time, JavaScript should not allow a date
    787   // less than [two minutes more than current [date & time]] (due to the fact
    788   // that base unit for this value is one minute).
     791  tp.setTime(maintenant.getTime() + 120000); // See two minutes
     792   // explanation in function ec_validity_check_min
    789793  ec_get_validity();
    790794  validity_date.setHours(v);
     
    832836  de('ec_input_action_home').checked              = 'checked';
    833837  de('ec_input_action_home').checked              = '';
     838  for (var i = 0; i <= 6; i++)
     839   ec_validity_day_length =
     840    (ec_validity_days[i].length > ec_validity_day_length) ?
     841     ec_validity_days[i].length : ec_validity_day_length;
     842  ec_validity_day_length++;
     843  de('ec_validity_sel_day').size                  = ec_validity_day_length;
    834844  ec_mark_now();
    835845  ec_validity_set_min();
     
    846856      ec_validity_check_min();
    847857    });
     858    $('#ec_validity_sel_day').css(
     859      'backgroundColor', $('#content').css('backgroundColor')
     860    );
    848861  });
    849862 
  • extensions/event_cats/admin/template/autolog_new.tpl

    r7847 r7864  
    317317        _ check if initialize validity date with JS is doable ;   DONE
    318318        _ check if ' onchange = "ec_update_ts();" ' can be used ; DONE
    319         _ implement JS ;
     319        _ implement JS ; DONE
    320320        _ implement PHP ;
    321321        _ commit, and drink a pint!
     
    335335              {'Activate'|@translate}
    336336            </label>
     337          </p>
     338          <p style = "text-align:left;{* padding:0.5em; border:1px solid #666666; *}">
     339            <input type = "text" id = "ec_validity_sel_day" style = "text-align:right; border:none;" disabled = "disabled">&nbsp;
     340            <select id = "ec_validity_day_id" name = "ec_validity_day" class = "ec_datepicker">
     341              <option value = "0">--</option>
     342              {section name=day start=1 loop=32}
     343                <option value = "{$smarty.section.day.index}">
     344                  {$smarty.section.day.index}
     345                </option>
     346              {/section}
     347            </select>
     348            <select id = "ec_validity_month_id" name = "ec_validity_month" class = "ec_datepicker">
     349              {html_options options=$month_list}
     350            </select>
     351            <input id = "ec_validity_year_id" name = "ec_validity_year" type = "text" size = "4"
     352             maxlength = "4" style = "text-align:right; " class = "ec_datepicker">
     353            <input id = "ec_validity_time_id" name = "ec_validity_time" type = "text" class = "ec_datepicker"
     354             size = "5" maxlength = "5" title = "{'Hours field tooltip'|@translate}" style = "text-align:right; ">
     355            <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled">
    337356          </p>
    338357          <p style = "text-align:left;">
     
    348367              {/section}
    349368            </select>
    350           </p>
    351           <p style = "text-align:left;">
    352             <select id = "ec_validity_day_id" name = "ec_validity_day" class = "ec_datepicker">
    353               <option value = "0">--</option>
    354               {section name=day start=1 loop=32}
    355                 <option value = "{$smarty.section.day.index}">
    356                   {$smarty.section.day.index}
    357                 </option>
    358               {/section}
    359             </select>
    360             <select id = "ec_validity_month_id" name = "ec_validity_month" class = "ec_datepicker">
    361               {html_options options=$month_list}
    362             </select>
    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;">
    366             <input id = "ec_linked_date_id" name = "ec_linked_date_id" type = "hidden" size = "10" disabled = "disabled">
    367369          </p>
    368370          <p style = "text-align:left;">
     
    490492  ec_is_creation                          = {if $ec_is_creation}true{else}false{/if};
    491493  ec_validity_on                          = {if $ec_validity_on}true{else}false{/if};
    492   valid_timestamp                         = 0{$valid_timestamp};
    493494  ec_up_code_lbl_forced_txt               = "{'Forced'|@translate}";
    494495  ec_JS_message['ec_gen_user_act_miss']   = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}";
     
    517518  {/if}
    518519  {foreach from = $ec_lists.ec_table item = ec_val name = listloop}
    519     ec_lists_temp[{$smarty.foreach.listloop.index}]  =
     520    ec_lists_temp[{$smarty.foreach.listloop.index}] =
    520521     "{$ec_val.id};{$ec_val.code};{$ec_val.user_id};{$ec_val.action};{$ec_val.arg1};{$ec_val.arg2};{$ec_val.forced};{$ec_val.comment}";
     522  {/foreach}
     523  {foreach from = $ec_days item = ec_day name = listloop}
     524    ec_validity_days[{$smarty.foreach.listloop.index}] = "{$ec_day}";
    521525  {/foreach}
    522526  ec_build_ec_lists();
  • extensions/event_cats/admin/template/footer.inc.tpl

    r7832 r7864  
    1111    ec_help_banner_in_foot = true;
    1212  //--></script>
    13   <div id = "ec_help_banner0" style = "border-top: 1px solid #000000; border-bottom: 1px solid #000000;">
     13  <div id = "ec_help_banner0" style = "border-top: 1px solid #666666; border-bottom: 1px solid #666666;">
    1414    <div id = "ec_help_banner1" style = "text-align:left; display:block;"></div>
    1515  </div>
  • extensions/event_cats/admin/template/header.inc.tpl

    r7832 r7864  
    2929{if !isset($ec_help_banner_in_foot)}
    3030  <div id = "ec_help_banner0">
    31     <div style = "text-align:right; font-style:italic; border-top: 1px solid #000000;">
     31    <div style = "text-align:right; font-style:italic; border-top: 1px solid #666666;">
    3232      {'Help banner'|@translate}&nbsp;
    3333      <label for = "ec_help_banner_1" onclick = "ec_mark_help('ec_help_banner_1');">
     
    4141      </label>
    4242    </div>
    43     <span id = "ec_help_banner1" style = "text-align:left; display:block; border-bottom: 1px solid #000000;"></span>
     43    <span id = "ec_help_banner1" style = "text-align:left; display:block; border-bottom: 1px solid #666666; padding-bottom:0.5em;"></span>
    4444  </div>
    4545{/if}
Note: See TracChangeset for help on using the changeset viewer.