Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git

into develop

Conflicts:
	htdocs/admin/syslog.php
This commit is contained in:
Laurent Destailleur 2012-02-23 03:32:19 +01:00
commit c5325e94cc
10 changed files with 180 additions and 80 deletions

View File

@ -249,8 +249,7 @@ print "</form>\n";
dol_htmloutput_mesg($mesg);
llxFooter();
$db->close();
?>
?>

View File

@ -1,21 +1,21 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/deplacement/fiche.php

View File

@ -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');

View File

@ -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
{

View File

@ -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.= '<input id="success_'.$htmlname.'" value="'.$success.'" type="hidden"/>'."\n";
//$out.= '<input id="ext_table_element_'.$htmlname.'" value="'.$ext_table_element.'" type="hidden"/>'."\n";
//$out.= '<input id="ext_fk_element_'.$htmlname.'" value="'.$ext_fk_element.'" type="hidden"/>'."\n";
$out.= '<div id="val_'.$htmlname.'" class="editval_'.$inputType.'">'.$value.'</div>'."\n";
$out.= '<div id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</div>'."\n";
$out.= '<div id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(! empty($editvalue) ? $editvalue : $value).'</div>'."\n";
}
else
{

View File

@ -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();
}
}

View File

@ -1670,12 +1670,17 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_string:hover, .editval_email:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
.editval_textarea.active:hover, .editval_ckeditor.active:hover, .editval_string.active:hover, .editval_email.active:hover, .editval_numeric.active:hover, .editval_select.active:hover, .editval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.editval_hover {
.viewval_textarea.active:hover, .viewval_ckeditor.active:hover, .viewval_string.active:hover, .viewval_email.active:hover, .viewval_numeric.active:hover, .viewval_select.active:hover, .viewval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.viewval_hover {
background: white;
}

View File

@ -1869,12 +1869,17 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_string:hover, .editval_email:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
.editval_textarea.active:hover, .editval_ckeditor.active:hover, .editval_string.active:hover, .editval_email.active:hover, .editval_numeric.active:hover, .editval_select.active:hover, .editval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.editval_hover {
.viewval_textarea.active:hover, .viewval_ckeditor.active:hover, .viewval_string.active:hover, .viewval_email.active:hover, .viewval_numeric.active:hover, .viewval_select.active:hover, .viewval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.viewval_hover {
background: white;
}

View File

@ -1805,12 +1805,17 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_string:hover, .editval_email:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
.editval_textarea.active:hover, .editval_ckeditor.active:hover, .editval_string.active:hover, .editval_email.active:hover, .editval_numeric.active:hover, .editval_select.active:hover, .editval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.editval_hover {
.viewval_textarea.active:hover, .viewval_ckeditor.active:hover, .viewval_string.active:hover, .viewval_email.active:hover, .viewval_numeric.active:hover, .viewval_select.active:hover, .viewval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.viewval_hover {
background: white;
}

View File

@ -1978,12 +1978,17 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_string:hover, .editval_email:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
.editval_textarea.active:hover, .editval_ckeditor.active:hover, .editval_string.active:hover, .editval_email.active:hover, .editval_numeric.active:hover, .editval_select.active:hover, .editval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.editval_hover {
.viewval_textarea.active:hover, .viewval_ckeditor.active:hover, .viewval_string.active:hover, .viewval_email.active:hover, .viewval_numeric.active:hover, .viewval_select.active:hover, .viewval_datepicker.active:hover {
background: white;
cursor: pointer;
}
.viewval_hover {
background: white;
}