diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index a169ec7aa61..657b2eb46a0 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -335,11 +335,6 @@ else if ($id) $soc = new Societe($db); if ($object->socid) $soc->fetch($object->socid); - - if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $user->rights->deplacement->creer) - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxeditinplace.tpl.php'); - } print ''; diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js new file mode 100644 index 00000000000..a09e97049fa --- /dev/null +++ b/htdocs/core/js/editinplace.js @@ -0,0 +1,82 @@ +// Copyright (C) 2011 Regis Houssin +// +// Script javascript that contains functions for edit in place +// +// \file htdocs/core/js/editinplace.js +// \brief File that include javascript functions for edit in place + + +$(document).ready(function() { + $(document).ready(function() { + var element = $('#element').html(); + var table_element = $('#table_element').html(); + var fk_element = $('#fk_element').html(); + + $('.edit_area').editable(urlSaveInPlace, { + type : 'textarea', + rows : 4, + id : 'field', + tooltip : tooltipInPlace, + cancel : cancelInPlace, + submit : submitInPlace, + indicator : indicatorInPlace, + loadurl : urlLoadInPlace, + loaddata : { + type: 'textarea', + element: element, + table_element: table_element, + fk_element: fk_element + }, + submitdata : { + type: 'textarea', + element: element, + table_element: table_element, + fk_element: fk_element + } + }); + $('.edit_text').editable(urlSaveInPlace, { + type : 'text', + id : 'field', + width : 300, + tooltip : tooltipInPlace, + cancel : cancelInPlace, + submit : submitInPlace, + indicator : indicatorInPlace, + loadurl : urlLoadInPlace, + loaddata : { + type: 'text', + element: element, + table_element: table_element, + fk_element: fk_element + }, + submitdata : { + type: 'text', + element: element, + table_element: table_element, + fk_element: fk_element + } + }); + $('.edit_numeric').editable(urlSaveInPlace, { + type : 'text', + id : 'field', + width : 100, + tooltip : tooltipInPlace, + cancel : cancelInPlace, + submit : submitInPlace, + indicator : indicatorInPlace, + loadurl : urlLoadInPlace, + loaddata : { + type: 'numeric', + element: element, + table_element: table_element, + fk_element: fk_element + }, + submitdata : { + type: 'numeric', + element: element, + table_element: table_element, + fk_element: fk_element + } + }); + }); +}); \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1a76c69ca17..c70c05d3d5c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -585,6 +585,14 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p $out.="\n"; if (! $notab) $out.="\n".'
'."\n"; + + // Parameters for edit in place + if (! empty($GLOBALS['object'])) + { + $out.=''."\n"; + $out.=''."\n"; + $out.=''."\n"; + } return $out; } diff --git a/htdocs/core/tpl/ajaxeditinplace.tpl.php b/htdocs/core/tpl/ajaxeditinplace.tpl.php deleted file mode 100644 index 5502c4508d5..00000000000 --- a/htdocs/core/tpl/ajaxeditinplace.tpl.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * 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, see . - * - */ -?> - - - - \ No newline at end of file diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 786691cd36c..37622508641 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -785,11 +785,6 @@ else if ($id > 0 || ! empty($ref)) $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.$_GET["line_id"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); if ($ret == 'html') print '
'; } - - if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $user->rights->ficheinter->creer) - { - include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxeditinplace.tpl.php'); - } print '
'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index cd81033134d..e5bc61c25eb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -924,7 +924,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // jQuery jnotify if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) print ''."\n"; // jQuery jeditable - if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print ''."\n"; + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) + { + print ''."\n"; + print ''."\n"; + print ''."\n"; + } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT)) {