diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 6544ea7b769..b7ad5cd542d 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -52,7 +52,7 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update') dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"]); dolibarr_set_const($db, "SIZE_LISTE_LIMIT", $_POST["size_liste_limit"]); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["disable_javascript"]); - dolibarr_set_const($db, "MAIN_DISABLE_POPUP_CALENDAR", $_POST["disable_popup_calendar"]); + dolibarr_set_const($db, "MAIN_POPUP_CALENDAR", $_POST["popup_calendar"]); dolibarr_set_const($db, "MAIN_SHOW_BUGTRACK_LINK", $_POST["bugtrack"]); dolibarr_set_const($db, "MAIN_SHOW_WORKBOARD", $_POST["workboard"]); @@ -123,8 +123,10 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Désactiver le calendrier popup $var=!$var; - print ''.$langs->trans("DisablePopupCalendar").''; - $html->selectyesnonum('disable_popup_calendar',$conf->global->MAIN_DISABLE_POPUP_CALENDAR); + print ''.$langs->trans("UsePopupCalendar").''; + $liste_popup_calendar=array('0'=>$langs->trans("No"),'eldy'=>$langs->trans("Yes").' (style eldy)','andre'=>$langs->trans("Yes").' (style andre)'); + $html->select_array('popup_calendar',$liste_popup_calendar,$conf->global->MAIN_POPUP_CALENDAR); + print ' ('.$langs->trans("AvailableOnlyIfJavascriptNotDisabled").')'; print ''; print '
'; @@ -214,21 +216,23 @@ else $var=!$var; print ''.$langs->trans("ShowBugTrackLink").''; - print ($conf->global->MAIN_SHOW_BUGTRACK_LINK?$langs->trans("yes"):$langs->trans("no")).""; + print yn($conf->global->MAIN_SHOW_BUGTRACK_LINK).""; $var=!$var; print ''.$langs->trans("ShowWorkBoard").''; - print ($conf->global->MAIN_SHOW_WORKBOARD?$langs->trans("yes"):$langs->trans("no")).""; + print yn($conf->global->MAIN_SHOW_WORKBOARD).""; // Disable javascript $var=!$var; print ''.$langs->trans("DisableJavascript").''; - print ($conf->global->MAIN_DISABLE_JAVASCRIPT?$langs->trans("yes"):$langs->trans("no")).""; + print yn($conf->global->MAIN_DISABLE_JAVASCRIPT).""; - // Disable popup calendar + // Calendrier en popup $var=!$var; - print ''.$langs->trans("DisablePopupCalendar").''; - print ($conf->global->MAIN_DISABLE_POPUP_CALENDAR?$langs->trans("yes"):$langs->trans("no")).""; + print ''.$langs->trans("UsePopupCalendar").''; + if ($conf->global->MAIN_DISABLE_JAVASCRIPT) print $langs->trans("No").' ('.$langs->trans("JavascriptDisabled").')'; + else print ($conf->global->MAIN_POPUP_CALENDAR?$langs->trans("Yes").' (style '.$conf->global->MAIN_POPUP_CALENDAR.')':$langs->trans("No")); + print ""; print '
'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 73e7bf1ac80..61e27fed171 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1623,27 +1623,42 @@ class Form */ if ($conf->use_javascript && $conf->use_popup_calendar && $h==0 && $m==0) { - - if ($langs->defaultlang != "") - { - print ''; + // Calendrier popup version eldy + if ("$conf->use_popup_calendar" == "eldy") // Laissé conf->use_popup_calendar entre quote + { + //print "e".$conf->format_date_short; + $timearray=getDate($set_time); + $formated_date=dolibarr_print_date($set_time,$conf->format_date_short); + print ' '; + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; } - print ''; - //$timearray=getDate($set_time); - // print '
'.$timearray['mon']; - $formated_date=dolibarr_print_date($set_time,$conf->format_date_short); - if($formated_date=="?") $formated_date=""; - print ' '; - print ''."\n"; - print ''."\n"; - print ''."\n"; - if($form_name =="") - print ''.img_cal().''; else - print ''.img_cal().''; - + { + // Calendrier popup version defaut + if ($langs->defaultlang != "") + { + print ''; + } + print ''; + $formated_date=dolibarr_print_date($set_time,$conf->format_date_short); + if($formated_date=="?") $formated_date=""; + print ' '; + print ''."\n"; + print ''."\n"; + print ''."\n"; + if($form_name =="") + print ''.img_cal().''; + else + print ''.img_cal().''; + } } /* diff --git a/htdocs/lib/datepicker.php b/htdocs/lib/datepicker.php new file mode 100644 index 00000000000..2c1bb2ba785 --- /dev/null +++ b/htdocs/lib/datepicker.php @@ -0,0 +1,139 @@ + + * This file is a modified version of datepicker.php from phpBSM + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/lib/datepicker.php + \brief Fichier de gestion de la popup de selection de date eldy + \version $Revision$ +*/ + +require_once("../conf/conf.php"); +require_once("../master.inc.php"); +$langs->trans("main"); + +if(!isset($_GET["cm"])) $_GET["cm"]="shw"; +if(!isset($_GET["sd"])) $_GET["sd"]="00000000"; + +switch($_GET["cm"]) +{ + case "shw": + displayBox($_GET["sd"],$_GET["m"],$_GET["y"]); + break; +} + + + +function xyzToUnixTimestamp($mysqldate){ + $year=substr($mysqldate,0,4); + $month=substr($mysqldate,4,2); + $day=substr($mysqldate,6,2); + $unixtimestamp=mktime(0,0,0,$month,$day,$year); + return $unixtimestamp; +} + +function displayBox($selectedDate,$month,$year){ + global $dolibarr_main_url_root,$langs; + $langs->load("main"); + + //print "$selectedDate,$month,$year"; + $thedate=mktime(0,0,0,$month,1,$year); + $today=mktime(0,0,0); + $todayArray=getdate($today); + if($selectedDate != "00000000") + { + $selDate=xyzToUnixTimestamp($selectedDate); + $xyz=date("Ymd",$selDate); + } + else + { + $selDate=0; + $xyz=0; + } +?> + + + + + + + + + + + + + + + + + + + + + + "; + if($firstdate==$mydate){ + // firstdate, so we may have to put in blanks + echo ""; + for($i=0;$i<$mydate["wday"];$i++) + echo ""; + } + + $dayclass="dpReg"; + if($thedate==$selDate) $dayclass="dpSelected"; + elseif($thedate==$today) $dayclass="dpToday"; + + // Sur click dans calendrier, appelle fonction dpClickDay + echo ""; + + if($mydate["wday"]==6) echo ""; + $thedate=strtotime("tomorrow",$thedate); + $mydate=getdate($thedate); + } + + if($mydate["wday"]!=0){ + for($i=6;$i>=$mydate["wday"];$i--) + echo ""; + echo " + +
<<','','')"><','')">trans("Today") ?>','','')">>>>
SMTWRFS
 ".sprintf("%02s",$mydate["mday"])."
 
+ \ No newline at end of file diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 76e4b3e82d2..86318ea7f00 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -348,8 +348,8 @@ $conf->use_javascript=1; if (isset($conf->global->MAIN_DISABLE_JAVASCRIPT)) $conf->use_javascript=! $conf->global->MAIN_DISABLE_JAVASCRIPT; // conf->use_popup_calendar -$conf->use_popup_calendar=1; -if (isset($conf->global->MAIN_DISABLE_POPUP_CALENDAR)) $conf->use_popup_calendar=! $conf->global->MAIN_DISABLE_POPUP_CALENDAR; +$conf->use_popup_calendar="eldy"; +if (isset($conf->global->MAIN_POPUP_CALENDAR)) $conf->use_popup_calendar=$conf->global->MAIN_POPUP_CALENDAR; // conf->monnaie if (! $conf->global->MAIN_MONNAIE) $conf->global->MAIN_MONNAIE='EUR'; @@ -434,6 +434,7 @@ if (defined("MAIN_MAIL_NEW_SUBJECT")) // \todo Mettre format dans fichier langue $conf->format_date_text_short="%d %b %Y"; $conf->format_date_short="%d/%m/%Y"; +$conf->format_date_short_java="dd/MM/yyyy"; /*