diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 13705e82e9f..c56bdf347e7 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -249,8 +249,7 @@ print "\n"; dol_htmloutput_mesg($mesg); - llxFooter(); $db->close(); -?> +?> \ No newline at end of file diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 3df794bba82..fce385ea57e 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -1,21 +1,21 @@ * Copyright (C) 2004-2012 Laurent Destailleur -* Copyright (C) 2005-2011 Regis Houssin -* -* 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 . -*/ + * Copyright (C) 2005-2011 Regis Houssin + * + * 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 . + */ /** * \file htdocs/compta/deplacement/fiche.php diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 5a1865223e9..17c909b9c3f 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -50,7 +50,7 @@ if((isset($_GET['field']) && ! empty($_GET['field'])) $ext_element = GETPOST('ext_element'); //$ext_table_element = GETPOST('ext_table_element'); //$ext_fk_element = GETPOST('ext_fk_element'); - $field = substr(GETPOST('field'), 4); // remove prefix val_ + $field = substr(GETPOST('field'), 8); // remove prefix val_ $type = GETPOST('type'); $loadmethod = (GETPOST('loadmethod') ? GETPOST('loadmethod') : 'getValueFrom'); diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index ae6313012fd..fb80c1bd7fb 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -51,11 +51,12 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) $ext_element = GETPOST('ext_element'); //$ext_table_element = GETPOST('ext_table_element'); //$ext_fk_element = GETPOST('ext_fk_element'); - $field = substr(GETPOST('field'), 4); // remove prefix val_ + $field = substr(GETPOST('field'), 8); // remove prefix val_ $value = GETPOST('value'); $type = GETPOST('type'); $savemethodname = (GETPOST('savemethod') ? GETPOST('savemethod') : 'setValueFrom'); + $view=''; $format='text'; $return=array(); $error=0; @@ -98,6 +99,7 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) { $loadmethodname = 'load_cache_'.GETPOST('loadmethod'); $loadcachename = 'cache_'.GETPOST('loadmethod'); + $loadviewname = 'view_'.GETPOST('loadmethod'); $form = new Form($db); if (method_exists($form, $loadmethodname)) @@ -107,6 +109,12 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) { $loadcache = $form->$loadcachename; $value = $loadcache[$newvalue]; + + if (! empty($form->$loadviewname)) + { + $loadview = $form->$loadviewname; + $view = $loadview[$newvalue]; + } } else { @@ -124,6 +132,12 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) { $loadcache = $object->$loadcachename; $value = $loadcache[$newvalue]; + + if (! empty($object->$loadviewname)) + { + $loadview = $object->$loadviewname; + $view = $loadview[$newvalue]; + } } else { @@ -151,6 +165,7 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) else if ($type == 'textarea') $value = dol_nl2br($newvalue); $return['value'] = $value; + $return['view'] = (! empty($view) ? $view : $value); } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f8557ac744f..8a5ac8db2ea 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -130,7 +130,7 @@ class Form // When option to edit inline is activated if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) { - $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $extObject, $success); + $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $success); } else { @@ -194,11 +194,12 @@ class Form * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit * @param string $inputType Type of input ('numeric', 'datepicker', 'textarea', 'ckeditor:dolibarr_zzz', 'select:xxx') + * @param string $editvalue When in edit mode, use this value as $value instead of value * @param object $extObject External object * @param string $success Success message * @return string HTML edit in place */ - private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $extObject=null, $success=null) + private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $success=null) { global $conf; @@ -211,12 +212,13 @@ class Form if ($condition) { - $element = false; - $table_element = false; - $fk_element = false; - $loadmethod = false; - $savemethod = false; - $ext_element = false; + $element = false; + $table_element = false; + $fk_element = false; + $loadmethod = false; + $savemethod = false; + $ext_element = false; + $button_only = false; //$ext_table_element = false; //$ext_fk_element = false; @@ -253,6 +255,7 @@ class Form $tmp=explode(':',$inputType); $inputType=$tmp[0]; $loadmethod=$tmp[1]; if (! empty($tmp[2])) $savemethod=$tmp[2]; + if (! empty($tmp[3])) $button_only=true; } else if (preg_match('/^ckeditor/',$inputType)) { @@ -281,8 +284,9 @@ class Form if (! empty($success)) $out.= ''."\n"; //$out.= ''."\n"; //$out.= ''."\n"; - - $out.= '
'.$value.'
'."\n"; + + $out.= '
'.$value.'
'."\n"; + $out.= '
'.(! empty($editvalue) ? $editvalue : $value).'
'."\n"; } else { diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js index 503bb47ba26..82ae02ff129 100644 --- a/htdocs/core/js/editinplace.js +++ b/htdocs/core/js/editinplace.js @@ -37,27 +37,39 @@ $(document).ready(function() { indicator : indicatorInPlace, loadurl : urlLoadInPlace, loaddata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('textarea', htmlname); }, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('textarea', htmlname); }, callback : function(result, settings) { getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_textarea').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_textarea').attr('id').substr(8)).show(); } }); $('.editkey_textarea').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); $('.editkey_textarea').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $('#viewval_' + $(this).attr('id')).click(); + }); + $('.viewval_textarea.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); + $('.editkey_textarea').click(function() { + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); $('.editval_ckeditor').editable(urlSaveInPlace, { @@ -74,23 +86,35 @@ $(document).ready(function() { toolbar: $('#ckeditor_toolbar').val() }, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('ckeditor', htmlname); }, callback : function(result, settings) { getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_ckeditor').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_ckeditor').attr('id').substr(8)).show(); } }); $('.editkey_ckeditor').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); $('.editkey_ckeditor').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $( '#viewval_' + $(this).attr('id') ).click(); + }); + $('.viewval_ckeditor.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); + $('.editkey_ckeditor').click(function() { + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); $('.editval_string').editable(urlSaveInPlace, { @@ -103,23 +127,35 @@ $(document).ready(function() { submit : submitInPlace, indicator : indicatorInPlace, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('string', htmlname); }, callback : function(result, settings) { getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_string').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_string').attr('id').substr(8)).show(); } }); $('.editkey_string').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); $('.editkey_string').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $( '#viewval_' + $(this).attr('id') ).click(); + }); + $('.viewval_string.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); + $('.editkey_string').click(function() { + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); $('.editval_numeric').editable(urlSaveInPlace, { @@ -132,30 +168,35 @@ $(document).ready(function() { submit : submitInPlace, indicator : indicatorInPlace, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('numeric', htmlname); }, callback : function(result, settings) { - var obj = $.parseJSON(result); - - if (obj.error) { - $(this).html(this.revert); - $.jnotify(obj.error, "error", true); - } else { - $(this).html(obj.value); - } + getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_numeric').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_numeric').attr('id').substr(8)).show(); } }); $('.editkey_numeric').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $( '#viewval_' + $(this).attr('id') ).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover"); } ); $('.editkey_numeric').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $( '#viewval_' + $(this).attr('id') ).click(); + }); + $('.viewval_numeric.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); + $('.editkey_numeric').click(function() { + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); $('.editval_datepicker').editable(urlSaveInPlace, { @@ -168,23 +209,32 @@ $(document).ready(function() { submit : submitInPlace, indicator : indicatorInPlace, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('datepicker', htmlname); }, callback : function(result, settings) { getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_datepicker').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_datepicker').attr('id').substr(8)).show(); } }); $('.editkey_datepicker').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); + $('.viewval_datepicker.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); $('.editkey_datepicker').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); $('.editval_select').editable(urlSaveInPlace, { @@ -199,39 +249,48 @@ $(document).ready(function() { indicator : indicatorInPlace, loadurl : urlLoadInPlace, loaddata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('select', htmlname); }, submitdata : function(result, settings) { - var htmlname = $(this).attr('id').substr(4); + var htmlname = $(this).attr('id').substr(8); return getParameters('select', htmlname); }, - callback : function(result, settings) { + callback : function(result, settings) { getResult(this, result); + }, + onreset : function(result, settings) { + $('#editval_' + $('.editval_select').attr('id').substr(8)).hide(); + $('#viewval_' + $('.editval_select').attr('id').substr(8)).show(); } }); $('.editkey_select').hover( function () { - $( '#val_' + $(this).attr('id') ).addClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).addClass("viewval_hover"); }, function () { - $( '#val_' + $(this).attr('id') ).removeClass("editval_hover"); + $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); } ); + $('.viewval_select.active').click(function() { + $('#viewval_' + $(this).attr('id').substr(8)).hide(); + $('#editval_' + $(this).attr('id').substr(8)).show().click(); + }); $('.editkey_select').click(function() { - $( '#val_' + $(this).attr('id') ).click(); + $('#viewval_' + $(this).attr('id')).hide(); + $('#editval_' + $(this).attr('id')).show().click(); }); function getParameters(type, htmlname) { - var element = $( '#element_' + htmlname ).val(); - var table_element = $( '#table_element_' + htmlname ).val(); - var fk_element = $( '#fk_element_' + htmlname ).val(); - var loadmethod = $( '#loadmethod_' + htmlname ).val(); - var savemethod = $( '#savemethod_' + htmlname ).val(); - var ext_element = $( '#ext_element_' + htmlname ).val(); + var element = $('#element_' + htmlname).val(); + var table_element = $('#table_element_' + htmlname).val(); + var fk_element = $('#fk_element_' + htmlname).val(); + var loadmethod = $('#loadmethod_' + htmlname).val(); + var savemethod = $('#savemethod_' + htmlname).val(); + var ext_element = $('#ext_element_' + htmlname).val(); + var timestamp = $('#timestamp').val(); //var ext_table_element = $( '#ext_table_element_' + htmlname ).val(); //var ext_fk_element = $( '#ext_fk_element_' + htmlname ).val(); - var timestamp = $('#timestamp').val(); return { type: type, @@ -253,12 +312,15 @@ $(document).ready(function() { $(obj).html(obj.revert); $.jnotify(res.error, "error", true); } else { - var htmlname = $(obj).attr('id').substr(4); + var htmlname = $(obj).attr('id').substr(8); var success = $( '#success_' + htmlname ).val(); if (success != undefined) { $.jnotify(success, "ok"); } $(obj).html(res.value); + $(obj).hide(); + $('#viewval_' + htmlname).html(res.view); + $('#viewval_' + htmlname).show(); } } diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 364aaba3ffd..b1e3e622902 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1670,12 +1670,17 @@ table.cal_event td { border: 0px; padding-: 0px; padding-: 0px; padding-: 0px; padding-: 0px; padding-