From cb4cbdcc23d0203fcd77923a299be0f16cd58238 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2006 00:56:18 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Possibilit=E9=20de=20choisir=20le=20gest?= =?UTF-8?q?ionnaire=20de=20popup=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/ihm.php | 2 +- htdocs/lib/lib_head.js | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index b7ad5cd542d..fcaf2d10091 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index 38b7c24dee0..04a21566e4c 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -117,12 +117,31 @@ function closeDPBox() function dpChangeDay(dateFieldID,format) { showDP.datefieldID=dateFieldID; - var thefield=getObjectFromID(dateFieldID); + + var thefield=getObjectFromID(showDP.datefieldID); + var thefieldday=getObjectFromID(showDP.datefieldID+"day"); + var thefieldmonth=getObjectFromID(showDP.datefieldID+"month"); + var thefieldyear=getObjectFromID(showDP.datefieldID+"year"); var date=getDateFromFormat(thefield.value,format); - - if (date) dpClickDay(date.getFullYear(),date.getMonth()+1,date.getDate(),format) - else dpClickDay(0,0,0,format); + if (date) + { + thefieldday.value=date.getDate(); + if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); + thefieldmonth.value=date.getMonth()+1; + if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); + thefieldyear.value=date.getFullYear(); + if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + } + else + { + thefieldday.value=''; + if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); + thefieldmonth.value=''; + if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); + thefieldyear.value=''; + if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); + } } function dpClickDay(year,month,day,format) @@ -138,7 +157,7 @@ function dpClickDay(year,month,day,format) dt.setDate(day); thefield.value=formatDate(dt,format); -// if(thefield.onchange) thefield.onchange.call(thefield); + if(thefield.onchange) thefield.onchange.call(thefield); thefieldday.value=day; if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);