From 13756a19787268c62f76b6dc4714fdc66d575b84 Mon Sep 17 00:00:00 2001 From: rub Date: Thu, 2 Oct 2008 18:51:02 +0000 Subject: Purpose of datepicker with jQuery. Fix button without action (thanks to P@t for console.log). Add all known_script. Improve code. git-svn-id: http://piwigo.org/svn/trunk@2639 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/template/goto/include/datepicker.inc.tpl | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'admin/template') diff --git a/admin/template/goto/include/datepicker.inc.tpl b/admin/template/goto/include/datepicker.inc.tpl index ebd6b0fea..360a2e0d7 100644 --- a/admin/template/goto/include/datepicker.inc.tpl +++ b/admin/template/goto/include/datepicker.inc.tpl @@ -1,5 +1,7 @@ {* $Id$ *} -{known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.datepicker.js"} +{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} +{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"} +{known_script id="jquery.ui.datepicker" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.datepicker.packed.js"} {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"} {html_head} @@ -30,18 +32,8 @@ function pwg_initialization_datepicker(day, month, year, linked_date, min_linked m = array_date[1]; d = array_date[2]; - var daysInMonth = 32 - new Date($(year).val(), $(month).val() - 1, 32).getDate(); - - $(day + " option").attr("disabled", ""); - $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled"); - - if ($(day).val() > daysInMonth) { - $(day).val(daysInMonth); - } - $(linked_date).val(pwg_get_fmt_datepicker(day, month, year)); - cancel = false; if ((min_linked_date != null) && ($(min_linked_date).datepicker("getDate") != null)) { cancel = ($(min_linked_date).datepicker("getDate") > $(linked_date).datepicker("getDate")); @@ -50,7 +42,11 @@ function pwg_initialization_datepicker(day, month, year, linked_date, min_linked { cancel = ($(max_linked_date).datepicker("getDate") < $(linked_date).datepicker("getDate")); } - + else + { + cancel = false; + } + if (cancel) { $(year).val(y); @@ -59,6 +55,12 @@ function pwg_initialization_datepicker(day, month, year, linked_date, min_linked // check again pwg_check_date(); } + else + { + var daysInMonth = 32 - new Date($(year).val(), $(month).val() - 1, 32).getDate(); + $(day + " option").attr("disabled", ""); + $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled"); + } } jQuery().ready(function(){ @@ -82,7 +84,6 @@ function pwg_initialization_datepicker(day, month, year, linked_date, min_linked } else { - console.log("none"); return {}; } }, @@ -117,6 +118,9 @@ function pwg_initialization_datepicker(day, month, year, linked_date, min_linked { pwg_check_date(); }); + + // In order to desable element of list + pwg_check_date(); }); } -- cgit v1.2.3