Changeset 2639


Ignore:
Timestamp:
Oct 2, 2008, 8:51:02 PM (16 years ago)
Author:
rub
Message:

Purpose of datepicker with jQuery.

Fix button without action (thanks to P@t for console.log).
Add all known_script.
Improve code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/template/goto/include/datepicker.inc.tpl

    r2635 r2639  
    11{* $Id$ *}
    2 {known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.datepicker.js"}
     2{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
     3{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
     4{known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.datepicker.packed.js"}
    35{known_script id="jquery.ui.datepicker-$lang_info.code" src=$ROOT_URL|@cat:"template-common/lib/ui/i18n/ui.datepicker-"|@cat:$lang_info.code|@cat:".js"}
    46
     
    3133    d = array_date[2];
    3234
    33     var daysInMonth = 32 - new Date($(year).val(), $(month).val() - 1, 32).getDate();
    34 
    35     $(day + " option").attr("disabled", "");
    36     $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled");
    37 
    38     if ($(day).val() > daysInMonth) {
    39         $(day).val(daysInMonth);
    40     }
    41 
    4235    $(linked_date).val(pwg_get_fmt_datepicker(day, month, year));
    4336
    44     cancel = false;
    4537    if ((min_linked_date != null) && ($(min_linked_date).datepicker("getDate") != null))
    4638    {
     
    5143      cancel = ($(max_linked_date).datepicker("getDate") < $(linked_date).datepicker("getDate"));
    5244    }
    53    
     45    else
     46    {
     47      cancel = false;
     48    }
     49
    5450    if (cancel)
    5551    {
     
    5955      // check again
    6056      pwg_check_date();
     57    }
     58    else
     59    {
     60      var daysInMonth = 32 - new Date($(year).val(), $(month).val() - 1, 32).getDate();
     61      $(day + " option").attr("disabled", "");
     62      $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled");
    6163    }
    6264  }
     
    8385            else
    8486            {
    85               console.log("none");
    8687              return {};
    8788            }
     
    118119        pwg_check_date();
    119120      });
     121
     122    // In order to desable element of list
     123    pwg_check_date();
    120124   });
    121125
Note: See TracChangeset for help on using the changeset viewer.