Fix: sparation des diffrents traitements Ajax
This commit is contained in:
parent
1fe933fa17
commit
8fec487ccf
@ -332,7 +332,7 @@ class Form
|
||||
print '</div>';
|
||||
print '<div id="hint" class="autocomplete"></div>';
|
||||
print '<script type="text/javascript">';
|
||||
print 'new Ajax.Autocompleter(\'pays\',\'hint\',\''.DOL_URL_ROOT.'/ajaxresponse.php\',{method: \'post\',paramName: \'pays\',indicator: \'indicator1\',afterUpdateElement: ac_return});';
|
||||
print 'new Ajax.Autocompleter(\'pays\',\'hint\',\''.DOL_URL_ROOT.'/societe/ajaxcountries.php\',{method: \'post\',paramName: \'pays\',indicator: \'indicator1\',afterUpdateElement: ac_return});';
|
||||
print '</script>';
|
||||
}
|
||||
else
|
||||
@ -741,7 +741,7 @@ class Form
|
||||
print $langs->trans("Label").':<input type="text" size="16" name="ajkeylabel'.$htmlname.'" id="ajkeylabel'.$htmlname.'">';
|
||||
print '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
|
||||
print '<script type="text/javascript">';
|
||||
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
||||
print 'var url = \''.DOL_URL_ROOT.'/product/ajaxproducts.php\';';
|
||||
print 'new Form.Element.Observer($("ajkeyref'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keyref="+$("ajkeyref'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
||||
print 'new Form.Element.Observer($("ajkeylabel'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keylabel="+$("ajkeylabel'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
||||
print '</script>';
|
||||
|
||||
50
htdocs/product/ajaxproducts.php
Normal file
50
htdocs/product/ajaxproducts.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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/product/ajaxproducts.php
|
||||
\brief Fichier de reponse sur evenement Ajax
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require('../master.inc.php');
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("main");
|
||||
|
||||
//header("Content-type: text/html; charset=UTF-8");
|
||||
header("Content-type: text/html; charset=iso-8859-1");
|
||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||
print "\n<html>";
|
||||
print "\n<body>";
|
||||
|
||||
|
||||
// Generation liste de produits
|
||||
if(isset($_GET['keyref']) && !empty($_GET['keyref']) || isset($_GET['keylabel']) && !empty($_GET['keylabel']))
|
||||
{
|
||||
$form = new Form($db);
|
||||
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]);
|
||||
}
|
||||
|
||||
print "</body>";
|
||||
print "</html>";
|
||||
?>
|
||||
@ -21,15 +21,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/ajaxresponse.php
|
||||
\file htdocs/societe/ajaxcountries.php
|
||||
\brief Fichier de reponse sur evenement Ajax
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require('./master.inc.php');
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("main");
|
||||
require('../master.inc.php');
|
||||
|
||||
//header("Content-type: text/html; charset=UTF-8");
|
||||
header("Content-type: text/html; charset=iso-8859-1");
|
||||
@ -37,15 +34,6 @@ print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ww
|
||||
print "\n<html>";
|
||||
print "\n<body>";
|
||||
|
||||
|
||||
// Generation liste de produits
|
||||
if(isset($_GET['keyref']) && !empty($_GET['keyref']) || isset($_GET['keylabel']) && !empty($_GET['keylabel']))
|
||||
{
|
||||
$form = new Form($db);
|
||||
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]);
|
||||
}
|
||||
|
||||
|
||||
// Generation liste des pays
|
||||
if(isset($_POST['pays']) && !empty($_POST['pays']))
|
||||
{
|
||||
@ -59,11 +47,11 @@ if(isset($_POST['pays']) && !empty($_POST['pays']))
|
||||
if ($resql)
|
||||
{
|
||||
print '<ul>';
|
||||
while($data = mysql_fetch_assoc($resql))
|
||||
while($pays = $db->fetch_object($resql))
|
||||
{
|
||||
print '<li>';
|
||||
print stripslashes($data['libelle']);
|
||||
print '<span class="informal" style="display:none">'.$data['rowid'].'-idcache</span>';
|
||||
print stripslashes($pays->libelle);
|
||||
print '<span class="informal" style="display:none">'.$pays->rowid.'-idcache</span>';
|
||||
print '</li>';
|
||||
}
|
||||
print '</ul>';
|
||||
BIN
htdocs/theme/eldy/img/ajaxworking.gif
Normal file
BIN
htdocs/theme/eldy/img/ajaxworking.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in New Issue
Block a user