Make code easier to understand

This commit is contained in:
Laurent Destailleur 2010-08-22 15:46:34 +00:00
parent 119f6d79dc
commit 783a66b4fc
5 changed files with 3039 additions and 3005 deletions

File diff suppressed because it is too large Load Diff

View File

@ -147,9 +147,11 @@ function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
}
/**
* \brief Get value of field, do Ajax process and return result
* \param htmlname nom et id du champ
* \param url chemin du fichier de reponse : /chemin/fichier.php
* \brief Get value of field, do Ajax process and return result. Use jQuery.
* \param selected Preselected value
* \param htmlname Name of html field
* \param url Path of source file to get values: /path/ajaxpage.php
* \param option Not used
* \return string script complet
*/
function ajax_autocompleter2($selected='', $htmlname, $url, $option='')
@ -157,15 +159,20 @@ function ajax_autocompleter2($selected='', $htmlname, $url, $option='')
$script = '<input type="hidden" name="'.$htmlname.'_id" id="'.$htmlname.'_id" value="'.$selected.'" />';
$script.= '<script type="text/javascript">';
$script.= '$(function() {
$("#birds").autocomplete({
source: "'.$url.'",
minLength: 2,
extraParams: {
'.$htmlname.': function() { return $("#birds").val(); }
}
$script.= 'jQuery(function() {
jQuery("input#'.$htmlname.'").autocomplete({
source: "'.$url.($option?'?'.$option:'').'",
delay: 300,
minLength: 1,
select: function(event, ui) {
alert(\'ee\');
jQuery("#state_id").val(ui.item.id);
}
});
});';
// source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"],
$script.= '</script>';
return $script;

View File

@ -24,19 +24,16 @@
* \version $Id$
*/
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (empty($_GET['keysearch']) && ! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
if (empty($_GET['keysearch']) && ! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php');
$langs->load("products");
$langs->load("main");
@ -46,6 +43,12 @@ $langs->load("main");
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
//top_htmlhead("", "", 1); // Disabled. An ajax return must not include html header.
//print '<body class="nocellnopadd">'."\n";

View File

@ -25,13 +25,12 @@
* \version $Id$
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
require('../main.inc.php');
@ -40,6 +39,12 @@ require('../main.inc.php');
* View
*/
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
//top_htmlhead("", "", 1, 1); // Disabled. An ajax return must not include html header.
//print '<body id="mainbody">';

View File

@ -23,11 +23,12 @@
* \version $Id$
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
require('../main.inc.php');
@ -36,6 +37,12 @@ require('../main.inc.php');
* View
*/
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
//top_htmlhead("", "", 1, 1); // Disabled. An ajax return must not include html header.
//print '<body id="mainbody">';