From 5fe088334ce007cfc6fd101e0e3478c311741084 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 25 Oct 2011 19:03:12 +0200 Subject: [PATCH] Qual: move ajax response in /core/ajax directory --- COPYRIGHT | 1 + htdocs/boxes.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/core/{ajaxbox.php => ajax/box.php} | 4 ++-- .../core/{ajaxconstantonoff.php => ajax/constantonoff.php} | 4 ++-- htdocs/core/{ajaxfileupload.php => ajax/fileupload.php} | 5 ++--- htdocs/core/ajax/index.php | 1 + htdocs/core/{ajaxrow.php => ajax/row.php} | 4 ++-- htdocs/core/{ajaxsecurity.php => ajax/security.php} | 4 ++-- htdocs/core/{ajaxziptown.php => ajax/ziptown.php} | 4 ++-- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 4 ++-- htdocs/core/tpl/ajaxrow.tpl.php | 2 +- .../triggers/interface_modPaypal_PaypalWorkflow.class.php | 4 ++-- htdocs/paypal/admin/paypal.php | 2 +- 16 files changed, 24 insertions(+), 23 deletions(-) rename htdocs/core/{ajaxbox.php => ajax/box.php} (96%) rename htdocs/core/{ajaxconstantonoff.php => ajax/constantonoff.php} (95%) rename htdocs/core/{ajaxfileupload.php => ajax/fileupload.php} (99%) create mode 100644 htdocs/core/ajax/index.php rename htdocs/core/{ajaxrow.php => ajax/row.php} (96%) rename htdocs/core/{ajaxsecurity.php => ajax/security.php} (95%) rename htdocs/core/{ajaxziptown.php => ajax/ziptown.php} (98%) diff --git a/COPYRIGHT b/COPYRIGHT index 667aacab8df..7065c0b9adc 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -26,6 +26,7 @@ jQuery 1.6.4 GPL and MIT Licence Yes JS library jQuery UI 1.8.16 GPL and MIT Licence Yes JS library plugin UI jQuery Flot 0.7 MIT Licence Yes JS library to build graph jQuery JCrop 0.9.8 MIT Licence Yes JS library plugin Crop (to crop images) +jQuery jeditable 1.7.1 MIT Licence Yes JS library plugin jeditable (to edit in place) jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15) jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows) jQuery jNotify 1.1.00 Apache Software License 2.0 ? JS library plugin jNotify (to use ajax popups) diff --git a/htdocs/boxes.php b/htdocs/boxes.php index 3df4d552bb2..97608f107d9 100644 --- a/htdocs/boxes.php +++ b/htdocs/boxes.php @@ -135,7 +135,7 @@ function printBoxesArea($user,$areacode) print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'."\n"; //print 'alert(\'boxorder=\' + boxorder);'; print 'var userid = \''.$user->id.'\';'."\n"; - print 'jQuery.get(\'core/ajaxbox.php?boxorder=\'+boxorder+\'&userid=\'+'.$user->id.');'."\n"; + print 'jQuery.get(\'core/ajax/box.php?boxorder=\'+boxorder+\'&userid=\'+'.$user->id.');'."\n"; print '}'."\n"; print ''."\n"; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index cf2943d0404..b780aef1713 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -223,7 +223,7 @@ if ($action == 'valid') if ($action == 'set_thirdparty') { - $object->updateObjectField('facture',$id,'fk_soc',$socid); + $object->setValueFrom('facture',$id,'fk_soc',$socid); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit; diff --git a/htdocs/core/ajaxbox.php b/htdocs/core/ajax/box.php similarity index 96% rename from htdocs/core/ajaxbox.php rename to htdocs/core/ajax/box.php index 07a7edc0f18..0ee675434b9 100644 --- a/htdocs/core/ajaxbox.php +++ b/htdocs/core/ajax/box.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/ajaxbox.php + * \file htdocs/core/ajax/box.php * \brief File to return Ajax response on Box move */ @@ -28,7 +28,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -require('../main.inc.php'); +require('../../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/boxes.php"); diff --git a/htdocs/core/ajaxconstantonoff.php b/htdocs/core/ajax/constantonoff.php similarity index 95% rename from htdocs/core/ajaxconstantonoff.php rename to htdocs/core/ajax/constantonoff.php index 65db9fb3ff8..c6aeab1ac61 100644 --- a/htdocs/core/ajaxconstantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/core/ajaxconstantonoff.php + * \file htdocs/core/ajax/constantonoff.php * \brief File to set or del an on/off constant */ @@ -27,7 +27,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -require('../main.inc.php'); +require('../../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); diff --git a/htdocs/core/ajaxfileupload.php b/htdocs/core/ajax/fileupload.php similarity index 99% rename from htdocs/core/ajaxfileupload.php rename to htdocs/core/ajax/fileupload.php index 5a066d8b783..0d0820d3176 100644 --- a/htdocs/core/ajaxfileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/ajaxfileupload.php + * \file htdocs/core/ajax/fileupload.php * \brief File to return Ajax response on file upload */ @@ -33,8 +33,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) -require("../main.inc.php"); - +require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"); diff --git a/htdocs/core/ajax/index.php b/htdocs/core/ajax/index.php new file mode 100644 index 00000000000..7db0dd9ebf9 --- /dev/null +++ b/htdocs/core/ajax/index.php @@ -0,0 +1 @@ +Url not available \ No newline at end of file diff --git a/htdocs/core/ajaxrow.php b/htdocs/core/ajax/row.php similarity index 96% rename from htdocs/core/ajaxrow.php rename to htdocs/core/ajax/row.php index 9556a9d3668..882a28f9c42 100644 --- a/htdocs/core/ajaxrow.php +++ b/htdocs/core/ajax/row.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/core/ajaxrow.php + * \file htdocs/core/ajax/row.php * \brief File to return Ajax response on Row move */ @@ -27,7 +27,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -require('../main.inc.php'); +require('../../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php"); diff --git a/htdocs/core/ajaxsecurity.php b/htdocs/core/ajax/security.php similarity index 95% rename from htdocs/core/ajaxsecurity.php rename to htdocs/core/ajax/security.php index 9cdf885734c..13ef292c3eb 100644 --- a/htdocs/core/ajaxsecurity.php +++ b/htdocs/core/ajax/security.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/core/ajaxsecurity.php + * \file htdocs/core/ajax/security.php * \brief File for return security data */ @@ -27,7 +27,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); -require('../main.inc.php'); +require('../../main.inc.php'); /* * View diff --git a/htdocs/core/ajaxziptown.php b/htdocs/core/ajax/ziptown.php similarity index 98% rename from htdocs/core/ajaxziptown.php rename to htdocs/core/ajax/ziptown.php index c83ef3cb61f..52eeafb4c8a 100644 --- a/htdocs/core/ajaxziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/core/ajaxziptown.php + * \file htdocs/core/ajax/ziptown.php * \ingroup core * \brief File to return Ajax response on zipcode or town request */ @@ -29,7 +29,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); -require('../main.inc.php'); +require('../../main.inc.php'); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php"); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 0eaaa8b2222..f878dee86c3 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -628,7 +628,7 @@ class FormCompany $size=''; if (!empty($fieldsize)) $size='size="'.$fieldsize.'"'; - if ($conf->use_javascript_ajax && empty($disableautocomplete)) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajaxziptown.php')."\n"; + if ($conf->use_javascript_ajax && empty($disableautocomplete)) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; $out.= ''."\n"; return $out; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index df036a26f59..a2256cc229f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -810,7 +810,7 @@ class FormFile '; print '
'; - print '
'; + print ''; print ''; print ''; print '
'; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index ab8b5228899..3b3eec1eb48 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -234,7 +234,7 @@ function ajax_constantonoff($code,$input=array()) // Set constant $( "#set_'.$code.'" ).click(function() { - $.get( "'.DOL_URL_ROOT.'/core/ajaxconstantonoff.php", { + $.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", { action: \'set\', name: \''.$code.'\' }, @@ -256,7 +256,7 @@ function ajax_constantonoff($code,$input=array()) // Del constant $( "#del_'.$code.'" ).click(function() { - $.get( "'.DOL_URL_ROOT.'/core/ajaxconstantonoff.php", { + $.get( "'.DOL_URL_ROOT.'/core/ajax/constantonoff.php", { action: \'del\', name: \''.$code.'\' }, diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index ef15dd62a04..ca7dee493b2 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -36,7 +36,7 @@ jQuery(document).ready(function(){ var table_element_line = "table_element_line; ?>"; var fk_element = "fk_element; ?>"; var element_id = "id; ?>"; - jQuery.get("/core/ajaxrow.php", + jQuery.get("/core/ajax/row.php", { roworder: roworder, table_element_line: table_element_line, diff --git a/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php index 22a814989c0..370d47305b3 100644 --- a/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php +++ b/htdocs/core/triggers/interface_modPaypal_PaypalWorkflow.class.php @@ -123,10 +123,10 @@ class InterfacePaypalWorkflow if ($ret < 0) return -1; // Add payer id - $soc->updateObjectField('societe', $obj->socid, 'ref_int', $object->payerID); + $soc->setValueFrom('societe', $obj->socid, 'ref_int', $object->payerID); // Add transaction id - $obj->updateObjectField($obj->table_element,$obj->id,'ref_int',$object->resArray["TRANSACTIONID"]); + $obj->setValueFrom($obj->table_element,$obj->id,'ref_int',$object->resArray["TRANSACTIONID"]); } diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index f9ad8560629..e54ad7f30c8 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -112,7 +112,7 @@ if ($conf->use_javascript_ajax) }); $("#generate_token").click(function() { - $.get( "'.DOL_URL_ROOT.'/core/ajaxsecurity.php", { + $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", { action: \'getrandompassword\', generic: true },