mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Possibilit de choisir le gestionnaire de popup date
This commit is contained in:
parent
8551052e02
commit
1d52199fa6
|
|
@ -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 '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("DisablePopupCalendar").'</td><td>';
|
||||
$html->selectyesnonum('disable_popup_calendar',$conf->global->MAIN_DISABLE_POPUP_CALENDAR);
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("UsePopupCalendar").'</td><td>';
|
||||
$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 '</td></tr>';
|
||||
|
||||
print '</table><br>';
|
||||
|
|
@ -214,21 +216,23 @@ else
|
|||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>';
|
||||
print ($conf->global->MAIN_SHOW_BUGTRACK_LINK?$langs->trans("yes"):$langs->trans("no"))."</td></tr>";
|
||||
print yn($conf->global->MAIN_SHOW_BUGTRACK_LINK)."</td></tr>";
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowWorkBoard").'</td><td>';
|
||||
print ($conf->global->MAIN_SHOW_WORKBOARD?$langs->trans("yes"):$langs->trans("no"))."</td></tr>";
|
||||
print yn($conf->global->MAIN_SHOW_WORKBOARD)."</td></tr>";
|
||||
|
||||
// Disable javascript
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("DisableJavascript").'</td><td>';
|
||||
print ($conf->global->MAIN_DISABLE_JAVASCRIPT?$langs->trans("yes"):$langs->trans("no"))."</td></tr>";
|
||||
print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td></tr>";
|
||||
|
||||
// Disable popup calendar
|
||||
// Calendrier en popup
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("DisablePopupCalendar").'</td><td>';
|
||||
print ($conf->global->MAIN_DISABLE_POPUP_CALENDAR?$langs->trans("yes"):$langs->trans("no"))."</td></tr>";
|
||||
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("UsePopupCalendar").'</td><td>';
|
||||
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 "</td></tr>";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1623,27 +1623,42 @@ class Form
|
|||
*/
|
||||
if ($conf->use_javascript && $conf->use_popup_calendar && $h==0 && $m==0)
|
||||
{
|
||||
|
||||
if ($langs->defaultlang != "")
|
||||
{
|
||||
print '<script language="javascript">';
|
||||
print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"';
|
||||
print '</script>';
|
||||
// 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 '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"> ';
|
||||
print '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||
//$base=DOL_URL_ROOT.'/theme/'.$conf->theme.'/';
|
||||
$base=DOL_URL_ROOT.'/lib/';
|
||||
print ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$conf->format_date_short_java.'\');">'.img_object($langs->trans("SelectDate"),'calendar').'</button>';
|
||||
print '<input type="hidden" name="'.$prefix.'day" value="'.$sday.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'month" value="'.$month.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'year" value="'.$syear.'">'."\n";
|
||||
}
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_calendar.js"></script>';
|
||||
//$timearray=getDate($set_time);
|
||||
// print '<br>'.$timearray['mon'];
|
||||
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
||||
if($formated_date=="?") $formated_date="";
|
||||
print '<input id="'.$prefix.'" type="text" name="'.$prefix.'" size="10" value="'.$formated_date.'"> ';
|
||||
print '<input type="hidden" name="'.$prefix.'day" value="'. $sday.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'year" value="'. $syear.'">'."\n";
|
||||
if($form_name =="")
|
||||
print '<A HREF="javascript:showCalendar(document.forms[3].'.$prefix.')">'.img_cal().'</a>';
|
||||
else
|
||||
print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'.img_cal().'</a>';
|
||||
|
||||
{
|
||||
// Calendrier popup version defaut
|
||||
if ($langs->defaultlang != "")
|
||||
{
|
||||
print '<script language="javascript">';
|
||||
print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"';
|
||||
print '</script>';
|
||||
}
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_calendar.js"></script>';
|
||||
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
||||
if($formated_date=="?") $formated_date="";
|
||||
print '<input id="'.$prefix.'" type="text" name="'.$prefix.'" size="10" value="'.$formated_date.'"> ';
|
||||
print '<input type="hidden" name="'.$prefix.'day" value="'. $sday.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
|
||||
print '<input type="hidden" name="'.$prefix.'year" value="'. $syear.'">'."\n";
|
||||
if($form_name =="")
|
||||
print '<A HREF="javascript:showCalendar(document.forms[3].'.$prefix.')">'.img_cal().'</a>';
|
||||
else
|
||||
print '<A HREF="javascript:showCalendar(document.forms[\''.$form_name.'\'].'.$prefix.')">'.img_cal().'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
139
htdocs/lib/datepicker.php
Normal file
139
htdocs/lib/datepicker.php
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
/* Copyright (C) phpBSM
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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;
|
||||
}
|
||||
?>
|
||||
<table class="dp" cellspacing="0" cellpadding="0" border=0>
|
||||
<tr>
|
||||
<td colspan=6 class="dpHead"><?php echo date("F, Y", $thedate) ?></td>
|
||||
<td class="dpHead"><button type="buttton" class="dpInvisibleButtons" id="DPCancel" onClick="closeDPBox();">X</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dpButtons" onClick="loadMonth('<?php echo $dolibarr_main_url_root.'/lib/' ?>','<?php echo $month?>','<?php echo $year-1?>','<?php echo $xyz ?>')"><<</td>
|
||||
<td class="dpButtons" onClick="loadMonth('<?php echo $dolibarr_main_url_root.'/lib/' ?>','<?php if($month==1) echo "12"; else echo $month-1?>','<?php if($month==1) echo $year-1; else echo $year?>','<?php echo $xyz ?>')"><</td>
|
||||
<td colspan=3 class="dpButtons" onClick="loadMonth('<?php echo $dolibarr_main_url_root.'/lib/' ?>','<?php echo date('m',$today)?>','<?php echo $todayArray["year"]?>','<?php echo $xyz ?>')"><?php echo $langs->trans("Today") ?></td>
|
||||
<td class="dpButtons" onClick="loadMonth('<?php echo $dolibarr_main_url_root.'/lib/' ?>','<?php if($month==12) echo "1"; else echo $month+1?>','<?php if($month==12) echo $year+1; else echo $year;?>','<?php echo $xyz ?>')">></td>
|
||||
<td class="dpButtons" onClick="loadMonth('<?php echo $dolibarr_main_url_root.'/lib/' ?>','<?php echo $month?>','<?php echo $year+1?>','<?php echo $xyz ?>')">>></td>
|
||||
</tr>
|
||||
<tr class="dpDayNames">
|
||||
<td width="14.286%">S</td>
|
||||
<td width="14.286%">M</td>
|
||||
<td width="14.286%">T</td>
|
||||
<td width="14.286%">W</td>
|
||||
<td width="14.286%">R</td>
|
||||
<td width="14.286%">F</td>
|
||||
<td width="14.286%">S</td>
|
||||
</tr>
|
||||
<?php
|
||||
$firstdate=getdate($thedate);
|
||||
$mydate=$firstdate;
|
||||
while($firstdate["month"]==$mydate["month"])
|
||||
{
|
||||
if($mydate["wday"]==0) echo "<TR class=\"dpWeek\">";
|
||||
if($firstdate==$mydate){
|
||||
// firstdate, so we may have to put in blanks
|
||||
echo "<TR class=\"dpWeek\">";
|
||||
for($i=0;$i<$mydate["wday"];$i++)
|
||||
echo "<TD> </TD>";
|
||||
}
|
||||
|
||||
$dayclass="dpReg";
|
||||
if($thedate==$selDate) $dayclass="dpSelected";
|
||||
elseif($thedate==$today) $dayclass="dpToday";
|
||||
|
||||
// Sur click dans calendrier, appelle fonction dpClickDay
|
||||
echo "<TD class=\"".$dayclass."\" onMouseOver=\"dpHighlightDay(".$mydate["year"].",".date("n",$thedate).",".$mydate["mday"].")\" onClick=\"dpClickDay(".$mydate["year"].",".date("n",$thedate).",".$mydate["mday"].")\">".sprintf("%02s",$mydate["mday"])."</TD>";
|
||||
|
||||
if($mydate["wday"]==6) echo "</tr>";
|
||||
$thedate=strtotime("tomorrow",$thedate);
|
||||
$mydate=getdate($thedate);
|
||||
}
|
||||
|
||||
if($mydate["wday"]!=0){
|
||||
for($i=6;$i>=$mydate["wday"];$i--)
|
||||
echo "<TD> </TD>";
|
||||
echo "</TR";
|
||||
}
|
||||
?>
|
||||
<tr><td id="dpExp" class="dpExplanation" colspan="7"><?php
|
||||
if($selDate)
|
||||
{
|
||||
$tempDate=getdate($selDate);
|
||||
print $tempDate["month"]." ";
|
||||
print sprintf("%02s",$tempDate["mday"]);
|
||||
print ", ".$tempDate["year"];
|
||||
}
|
||||
else
|
||||
print "Click a Date";
|
||||
?></td></tr>
|
||||
</table>
|
||||
<?php
|
||||
}//end function
|
||||
?>
|
||||
|
|
@ -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";
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user