Changeset 2680 for trunk/admin


Ignore:
Timestamp:
Oct 7, 2008, 9:18:55 PM (16 years ago)
Author:
rub
Message:

jQuery Datepicker:

o use id for selector
o check radio button on change date

Location:
trunk/admin/template/goto
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/template/goto/element_set_global.tpl

    r2678 r2680  
    55{literal}
    66<script type="text/javascript">
    7   pwg_initialization_datepicker("select[name=date_creation_day]", "select[name=date_creation_month]", "input[name=date_creation_year]", "input[name=date_creation_linked_date]");
     7  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
    88</script>
    99{/literal}
     
    146146          <label><input type="radio" name="date_creation_action" value="unset" /> {'unset'|@translate}</label>
    147147          <label><input type="radio" name="date_creation_action" value="set" id="date_creation_action_set" /> {'set to'|@translate}</label>
    148           <select onchange="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_day">
     148          <select id="date_creation_day" name="date_creation_day">
    149149             <option value="0">--</option>
    150150            {section name=day start=1 loop=32}
     
    152152            {/section}
    153153          </select>
    154           <select onchange="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_month">
     154          <select id="date_creation_month" name="date_creation_month">
    155155            {html_options options=$month_list selected=$DATE_CREATION_MONTH}
    156156          </select>
    157           <input onchange="document.getElementById('date_creation_action_set').checked = true;"
     157          <input id="date_creation_year"
    158158                 name="date_creation_year"
    159159                 type="text"
     
    161161                 maxlength="4"
    162162                 value="{$DATE_CREATION_YEAR}" />
    163           <input name="date_creation_linked_date" type="hidden" size="10" disabled="disabled"/>
     163          <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled"/>
    164164        </td>
    165165      </tr>
  • trunk/admin/template/goto/element_set_unit.tpl

    r2674 r2680  
    5555        <label><input type="radio" name="date_creation_action-{$element.ID}" value="set" id="date_creation_action_set-{$element.ID}" /> {'set to'|@translate}</label>
    5656
    57         <select onmousedown="document.getElementById('date_creation_action_set-{$element.ID}').checked = true;" name="date_creation_day-{$element.ID}">
     57        <select id="date_creation_day-{$element.ID}" name="date_creation_day-{$element.ID}">
    5858                <option value="0">--</option>
    5959           {section name=day start=1 loop=32}
     
    6161           {/section}
    6262        </select>
    63         <select onmousedown="document.getElementById('date_creation_action_set-{$element.ID}').checked = true;" name="date_creation_month-{$element.ID}">
     63        <select id="date_creation_month-{$element.ID}" name="date_creation_month-{$element.ID}">
    6464          {html_options options=$month_list selected=$element.DATE_CREATION_MONTH}
    6565        </select>
    66         <input onmousedown="document.getElementById('date_creation_action_set-{$element.ID}').checked = true;"
     66        <input id="date_creation_year-{$element.ID}"
    6767               name="date_creation_year-{$element.ID}"
    6868               type="text"
     
    7070               maxlength="4"
    7171               value="{$element.DATE_CREATION_YEAR}" />
    72         <input name="date_creation_linked_date-{$element.ID}" type="hidden" size="10" disabled="disabled"/>
     72        <input id="date_creation_linked_date-{$element.ID}" name="date_creation_linked_date-{$element.ID}" type="hidden" size="10" disabled="disabled"/>
    7373        <script type="text/javascript">
    74           pwg_initialization_datepicker("select[name=date_creation_day-{$element.ID}]", "select[name=date_creation_month-{$element.ID}]", "input[name=date_creation_year-{$element.ID}]", "input[name=date_creation_linked_date-{$element.ID}]");
     74          pwg_initialization_datepicker("#date_creation_day-{$element.ID}", "#date_creation_month-{$element.ID}", "#date_creation_year-{$element.ID}", "#date_creation_linked_date-{$element.ID}", "#date_creation_action_set-{$element.ID}");
    7575        </script>
    7676      </td>
  • trunk/admin/template/goto/history.tpl

    r2632 r2680  
    55{literal}
    66<script type="text/javascript">
    7   pwg_initialization_datepicker("select[name=start_day]", "select[name=start_month]", "input[name=start_year]", "input[name=start_linked_date]", null, "input[name=end_linked_date]");
    8   pwg_initialization_datepicker("select[name=end_day]", "select[name=end_month]", "input[name=end_year]", "input[name=end_linked_date]", "input[name=start_linked_date]", null);
     7  pwg_initialization_datepicker("#start_day", "#start_month", "#start_year", "#start_linked_date", null, null, "#end_linked_date");
     8  pwg_initialization_datepicker("#end_day", "#end_month", "#end_year", "#end_linked_date", null, "#start_linked_date", null);
    99</script>
    1010{/literal}
     
    2020    <li><label>{'search_date_from'|@translate}</label></li>
    2121    <li>
    22       <select name="start_day">
     22      <select id="start_day" name="start_day">
    2323        <option value="0">--</option>
    2424        {section name=day start=1 loop=32}
     
    2626        {/section}
    2727      </select>
    28       <select name="start_month">
     28      <select id="start_month" name="start_month">
    2929      {html_options options=$month_list selected=$START_MONTH_SELECTED}
    3030      </select>
    31       <input name="start_year" value="{$START_YEAR}" type="text" size="4" maxlength="4" >
    32       <input name="start_linked_date" type="hidden" size="10" disabled="disabled"/>
     31      <input id="start_year" name="start_year" value="{$START_YEAR}" type="text" size="4" maxlength="4" >
     32      <input id="start_linked_date" name="start_linked_date" type="hidden" size="10" disabled="disabled"/>
    3333    </li>
    3434  </ul>
     
    3636    <li><label>{'search_date_to'|@translate}</label></li>
    3737    <li>
    38       <select name="end_day">
     38      <select id="end_day" name="end_day">
    3939        <option value="0">--</option>
    4040        {section name=day start=1 loop=32}
     
    4242        {/section}
    4343      </select>
    44       <select name="end_month">
     44      <select id="end_month" name="end_month">
    4545      {html_options options=$month_list selected=$END_MONTH_SELECTED}
    4646      </select>
    47       <input name="end_year" value="{$END_YEAR}" type="text" size="4" maxlength="4" >
    48       <input name="end_linked_date" type="hidden" size="10" disabled="disabled"/>
     47      <input id="end_year" name="end_year" value="{$END_YEAR}" type="text" size="4" maxlength="4" >
     48      <input id="end_linked_date" name="end_linked_date" type="hidden" size="10" disabled="disabled"/>
    4949    </li>
    5050  </ul>
  • trunk/admin/template/goto/include/datepicker.inc.tpl

    r2676 r2680  
    2121// day, month, year: selectors of visible date controls
    2222// linked_date: selector of hidden linked dates control
     23// checked_on_change: selector of control to change "checked" attribut
    2324// min_linked_date: selector of hidden linked date control witch give min value
    2425// max_linked_date: selector of hidden linked date control witch give max value
    25 function pwg_initialization_datepicker(day, month, year, linked_date, min_linked_date, max_linked_date)
     26function pwg_initialization_datepicker(day, month, year, linked_date, checked_on_change, min_linked_date, max_linked_date)
    2627{
     28  // Action on change date value
     29  function pwg_on_date_change()
     30  {
     31    pwg_check_date();
     32    if (checked_on_change != null)
     33    {
     34      $(checked_on_change).attr("checked", "true");
     35    }
     36  }
     37
    2738  // Prevent selection of invalid dates through the select controls
    2839  function pwg_check_date()
     
    104115              $(day).val(array_date[2]);
    105116            }
    106             pwg_check_date();
     117            pwg_on_date_change();
    107118        },
    108119      showOn: "both",
     
    118129      function ()
    119130      {
    120         pwg_check_date();
     131        pwg_on_date_change();
    121132      });
    122133
    123134    // In order to desable element of list
     135    // In order to init linked input
    124136    pwg_check_date();
    125137   });
  • trunk/admin/template/goto/picture_modify.tpl

    r2674 r2680  
    66{literal}
    77<script type="text/javascript">
    8   pwg_initialization_datepicker("select[name=date_creation_day]", "select[name=date_creation_month]", "input[name=date_creation_year]", "input[name=date_creation_linked_date]");
     8  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
    99</script>
    1010{/literal}
     
    9797          <label><input type="radio" name="date_creation_action" value="unset" /> {'unset'|@translate}</label>
    9898          <input type="radio" name="date_creation_action" value="set" id="date_creation_action_set" /> {'set to'|@translate}
    99           <select onmousedown="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_day">
     99          <select id="date_creation_day" name="date_creation_day">
    100100            <option value="0">--</option>
    101101            {section name=day start=1 loop=32}
     
    103103            {/section}
    104104          </select>
    105           <select onmousedown="document.getElementById('date_creation_action_set').checked = true;" name="date_creation_month">
     105          <select id="date_creation_month" name="date_creation_month">
    106106            {html_options options=$month_list selected=$DATE_CREATION_MONTH_VALUE}
    107107          </select>
    108           <input onmousedown="document.getElementById('date_creation_action_set').checked = true;"
     108          <input id="date_creation_year"
    109109                 name="date_creation_year"
    110110                 type="text"
     
    112112                 maxlength="4"
    113113                 value="{$DATE_CREATION_YEAR_VALUE}" />
    114           <input name="date_creation_linked_date" type="hidden" size="10" disabled="disabled"/>
     114          <input id="date_creation_linked_date" name="date_creation_linked_date" type="hidden" size="10" disabled="disabled"/>
    115115        </td>
    116116      </tr>
Note: See TracChangeset for help on using the changeset viewer.