Perf: Quelques optimisations du code.
This commit is contained in:
parent
378b25240c
commit
4a37906ee4
@ -15,14 +15,12 @@
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/ihm.php
|
||||
\brief Page de configuration de l'interface homme machine
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
@ -37,24 +37,40 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
||||
|
||||
require_once("../master.inc.php");
|
||||
|
||||
$langs->load("main");
|
||||
|
||||
|
||||
// URL http://mydolibarr/lib/datepicker.php?mode=test&m=10&y=2038 can be used for tests
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n";
|
||||
print '<html><head>';
|
||||
if (isset($_GET["mode"]) && $_GET["mode"] == 'test')
|
||||
{
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n";
|
||||
print '<html><head>';
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_head.js"></script>'."\n";
|
||||
print '</head><body>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'."\n";
|
||||
print '<html><head><title>Calendar</title></head><body>'."\n";
|
||||
print '<title>Calendar</title>';
|
||||
}
|
||||
// Define tradMonths javascript array
|
||||
$tradTemp=array($langs->trans("January"),
|
||||
$langs->trans("February"),
|
||||
$langs->trans("March"),
|
||||
$langs->trans("April"),
|
||||
$langs->trans("May"),
|
||||
$langs->trans("June"),
|
||||
$langs->trans("July"),
|
||||
$langs->trans("August"),
|
||||
$langs->trans("September"),
|
||||
$langs->trans("October"),
|
||||
$langs->trans("November"),
|
||||
$langs->trans("December")
|
||||
);
|
||||
print '<script language="javascript" type="text/javascript">';
|
||||
print 'var tradMonths = '.php2js($tradTemp).';';
|
||||
print '</script>'."\n";
|
||||
print '</head><body>'."\n";
|
||||
|
||||
|
||||
$langs->load("main");
|
||||
|
||||
$qualified=true;
|
||||
|
||||
if (! isset($_GET["sd"])) $_GET["sd"]="00000000";
|
||||
@ -216,4 +232,43 @@ function displayBox($selectedDate,$month,$year){
|
||||
</table>
|
||||
<?php
|
||||
}//end function
|
||||
|
||||
|
||||
/*
|
||||
* \brief Convertit une variable php en variable javascript
|
||||
* \param var variable php
|
||||
* \return result variable javascript
|
||||
*/
|
||||
function php2js($var)
|
||||
{
|
||||
if (is_array($var))
|
||||
{
|
||||
$array = array();
|
||||
foreach ($var as $a_var)
|
||||
{
|
||||
$array[] = php2js($a_var);
|
||||
}
|
||||
$result = "[" . join(",", $array) . "]";
|
||||
return $result;
|
||||
}
|
||||
else if (is_bool($var))
|
||||
{
|
||||
$result = $var ? "true" : "false";
|
||||
return $result;
|
||||
}
|
||||
else if (is_int($var) || is_integer($var) || is_double($var) || is_float($var))
|
||||
{
|
||||
$result = $var;
|
||||
return $result;
|
||||
}
|
||||
else if (is_string($var))
|
||||
{
|
||||
$result = "\"" . addslashes(stripslashes($var)) . "\"";
|
||||
return $result;
|
||||
}
|
||||
// autres cas: objets, on ne les gére pas
|
||||
$result = FALSE;
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -2807,42 +2807,6 @@ function make_substitutions($chaine,$substitutionarray)
|
||||
return $chaine;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Convertit une variable php en variable javascript
|
||||
* \param var variable php
|
||||
* \return result variable javascript
|
||||
*/
|
||||
function php2js($var)
|
||||
{
|
||||
if (is_array($var))
|
||||
{
|
||||
$array = array();
|
||||
foreach ($var as $a_var)
|
||||
{
|
||||
$array[] = php2js($a_var);
|
||||
}
|
||||
$result = "[" . join(",", $array) . "]";
|
||||
return $result;
|
||||
}
|
||||
else if (is_bool($var))
|
||||
{
|
||||
$result = $var ? "true" : "false";
|
||||
return $result;
|
||||
}
|
||||
else if (is_int($var) || is_integer($var) || is_double($var) || is_float($var))
|
||||
{
|
||||
$result = $var;
|
||||
return $result;
|
||||
}
|
||||
else if (is_string($var))
|
||||
{
|
||||
$result = "\"" . addslashes(stripslashes($var)) . "\"";
|
||||
return $result;
|
||||
}
|
||||
// autres cas: objets, on ne les gére pas
|
||||
$result = FALSE;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Formate l'affichage de date de début et de fin
|
||||
|
||||
@ -667,14 +667,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0)
|
||||
print '<link rel="stylesheet" type="text/css" title="default" href="'.DOL_URL_ROOT.'/'.$conf->css.'">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" media="print" href="'.DOL_URL_ROOT.'/theme/print.css">'."\n";
|
||||
|
||||
// Style sheets pour la class Window
|
||||
if (! $disablejs && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/default.css">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alphacube.css">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alert.css">'."\n";
|
||||
}
|
||||
|
||||
// Definition en alternate style sheet des feuilles de styles les plus maintenues
|
||||
// Les navigateurs qui supportent sont rares. Plus aucun connu.
|
||||
/*
|
||||
@ -694,38 +686,24 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0)
|
||||
if (! $disablejs && $conf->use_javascript_ajax)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/lib/ajax.lib.php';
|
||||
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/lib/prototype.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/effects.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/controls.js"></script>'."\n";
|
||||
// TODO As-ton besoin des ces 2 js ?
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/window.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/tooltip.js"></script>'."\n";
|
||||
|
||||
}
|
||||
|
||||
// TODO Voir si on peut pas virer ca
|
||||
if (! $disablejs && $conf->use_javascript_ajax)
|
||||
{
|
||||
// Define tradMonths javascript array
|
||||
$tradTemp=Array($langs->trans("January"),
|
||||
$langs->trans("February"),
|
||||
$langs->trans("March"),
|
||||
$langs->trans("April"),
|
||||
$langs->trans("May"),
|
||||
$langs->trans("June"),
|
||||
$langs->trans("July"),
|
||||
$langs->trans("August"),
|
||||
$langs->trans("September"),
|
||||
$langs->trans("October"),
|
||||
$langs->trans("November"),
|
||||
$langs->trans("December")
|
||||
);
|
||||
print '<script language="javascript" type="text/javascript">';
|
||||
print 'var tradMonths = '.php2js($tradTemp).';';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
// This one is required for all Ajax features
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/lib/prototype.js"></script>'."\n";
|
||||
// This one is required fox boxes
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js"></script>'."\n";
|
||||
|
||||
// Those ones are required only with option "confirm by ajax popup"
|
||||
if ($conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/default.css">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alphacube.css">'."\n";
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/window/alert.css">'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/effects.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/controls.js"></script>'."\n";
|
||||
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/window.js"></script>'."\n";
|
||||
//print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/window/tooltip.js"></script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</head>\n";
|
||||
}
|
||||
|
||||
@ -236,13 +236,13 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.urlencode($pdir.$viewfilename).'&action=confirm_delete&confirm=yes';
|
||||
print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeletePicture').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeletePicture').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
}
|
||||
print img_delete().'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
}
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
.overlay_alert {
|
||||
background-color: #ACBCBB;
|
||||
filter:alpha(opacity=60);
|
||||
-moz-opacity: 0.6;
|
||||
opacity: 0.6;
|
||||
background-color: #DDDDDD;
|
||||
filter: alpha(opacity=50); /*Does not respect CSS standard */
|
||||
-moz-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.alert_nw {
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
.overlay_dialog {
|
||||
background-color: #666666;
|
||||
filter:alpha(opacity=60);
|
||||
-moz-opacity: 0.6;
|
||||
opacity: 0.6;
|
||||
filter: alpha(opacity=50); /* Does not respect CSS standard */
|
||||
-moz-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.overlay___invisible__ {
|
||||
background-color: #666666;
|
||||
filter:alpha(opacity=0);
|
||||
background-color: #666666;
|
||||
filter: alpha(opacity=0);
|
||||
-moz-opacity: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user