[edit in place] Add edit_text and edit_numeric
This commit is contained in:
parent
5be8bb87a2
commit
e2b539ee7d
@ -362,7 +362,8 @@ else if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km/Price
|
// Km/Price
|
||||||
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td>'.$object->km.'</td></tr>';
|
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td>';
|
||||||
|
print '<td><div class="edit_numeric" id="km">'.$object->km.'</div></td></tr>';
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
||||||
|
|||||||
@ -25,7 +25,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
|||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','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");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
|
||||||
@ -46,6 +46,13 @@ if((isset($_POST['field']) && ! empty($_POST['field'])) && (isset($_POST['table_
|
|||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$value = trim($_POST['value']);
|
$value = trim($_POST['value']);
|
||||||
|
if ($_POST['type'] == 'numeric')
|
||||||
|
{
|
||||||
|
$value = price2num($value);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! is_numeric($value)) $value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$ret=$object->setValueFrom($_POST['table_element'], $_POST['fk_element'], $_POST['field'], $value);
|
$ret=$object->setValueFrom($_POST['table_element'], $_POST['fk_element'], $_POST['field'], $value);
|
||||||
if ($ret > 0) echo (! empty($value) ? dol_nl2br($value) : ' ');
|
if ($ret > 0) echo (! empty($value) ? dol_nl2br($value) : ' ');
|
||||||
|
|||||||
@ -30,11 +30,51 @@ $(document).ready(function() {
|
|||||||
submit : '<?php echo $langs->trans('Ok'); ?>',
|
submit : '<?php echo $langs->trans('Ok'); ?>',
|
||||||
indicator : '<img src="<?php echo DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif"; ?>">',
|
indicator : '<img src="<?php echo DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif"; ?>">',
|
||||||
loadurl : '<?php echo DOL_URL_ROOT.'/core/ajax/loadinplace.php'; ?>',
|
loadurl : '<?php echo DOL_URL_ROOT.'/core/ajax/loadinplace.php'; ?>',
|
||||||
loaddata : {
|
loaddata : {
|
||||||
|
type: 'textarea',
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
},
|
},
|
||||||
submitdata : {
|
submitdata : {
|
||||||
|
type: 'textarea',
|
||||||
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.edit_text').editable('<?php echo DOL_URL_ROOT.'/core/ajax/saveinplace.php'; ?>', {
|
||||||
|
type : 'text',
|
||||||
|
id : 'field',
|
||||||
|
tooltip : '<?php echo $langs->trans('ClickToEdit'); ?>',
|
||||||
|
cancel : '<?php echo $langs->trans('Cancel'); ?>',
|
||||||
|
submit : '<?php echo $langs->trans('Ok'); ?>',
|
||||||
|
indicator : '<img src="<?php echo DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif"; ?>">',
|
||||||
|
loadurl : '<?php echo DOL_URL_ROOT.'/core/ajax/loadinplace.php'; ?>',
|
||||||
|
loaddata : {
|
||||||
|
type: 'text',
|
||||||
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
|
},
|
||||||
|
submitdata : {
|
||||||
|
type: 'text',
|
||||||
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.edit_numeric').editable('<?php echo DOL_URL_ROOT.'/core/ajax/saveinplace.php'; ?>', {
|
||||||
|
type : 'text',
|
||||||
|
id : 'field',
|
||||||
|
tooltip : '<?php echo $langs->trans('ClickToEdit'); ?>',
|
||||||
|
cancel : '<?php echo $langs->trans('Cancel'); ?>',
|
||||||
|
submit : '<?php echo $langs->trans('Ok'); ?>',
|
||||||
|
indicator : '<img src="<?php echo DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif"; ?>">',
|
||||||
|
loadurl : '<?php echo DOL_URL_ROOT.'/core/ajax/loadinplace.php'; ?>',
|
||||||
|
loaddata : {
|
||||||
|
type: 'numeric',
|
||||||
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
|
},
|
||||||
|
submitdata : {
|
||||||
|
type: 'numeric',
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
table_element: "<?php echo $object->table_element; ?>",
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
fk_element: "<?php echo $object->id; ?>"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1657,7 +1657,7 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover {
|
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1863,7 +1863,7 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover {
|
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1813,7 +1813,7 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover {
|
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1713,8 +1713,8 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover {
|
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user