forked from Wavyzz/dolibarr
Fix: move ajax tpl to js for uniform code
This commit is contained in:
@@ -336,11 +336,6 @@ else if ($id)
|
|||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($object->socid) $soc->fetch($object->socid);
|
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 '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
|||||||
82
htdocs/core/js/editinplace.js
Normal file
82
htdocs/core/js/editinplace.js
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
// Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -586,6 +586,14 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
|
|||||||
|
|
||||||
if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
|
if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
|
||||||
|
|
||||||
|
// Parameters for edit in place
|
||||||
|
if (! empty($GLOBALS['object']))
|
||||||
|
{
|
||||||
|
$out.='<div id="element" class="hidden">'.$GLOBALS['object']->element.'</div>'."\n";
|
||||||
|
$out.='<div id="table_element" class="hidden">'.$GLOBALS['object']->table_element.'</div>'."\n";
|
||||||
|
$out.='<div id="fk_element" class="hidden">'.$GLOBALS['object']->id.'</div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE FOR JQUERY -->
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('.edit_area').editable('<?php echo DOL_URL_ROOT.'/core/ajax/saveinplace.php'; ?>', {
|
|
||||||
type : 'textarea',
|
|
||||||
rows : 4,
|
|
||||||
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: 'textarea',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
|
||||||
},
|
|
||||||
submitdata : {
|
|
||||||
type: 'textarea',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
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',
|
|
||||||
width : 300,
|
|
||||||
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',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
|
||||||
},
|
|
||||||
submitdata : {
|
|
||||||
type: 'text',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
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',
|
|
||||||
width : 100,
|
|
||||||
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',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
|
||||||
},
|
|
||||||
submitdata : {
|
|
||||||
type: 'numeric',
|
|
||||||
element: "<?php echo $object->element; ?>",
|
|
||||||
table_element: "<?php echo $object->table_element; ?>",
|
|
||||||
fk_element: "<?php echo $object->id; ?>"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<!-- END PHP TEMPLATE FOR JQUERY -->
|
|
||||||
@@ -786,11 +786,6 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $user->rights->ficheinter->creer)
|
|
||||||
{
|
|
||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxeditinplace.tpl.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
|||||||
@@ -924,7 +924,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
// jQuery jnotify
|
// jQuery jnotify
|
||||||
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n";
|
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js"></script>'."\n";
|
||||||
// jQuery jeditable
|
// jQuery jeditable
|
||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min'.$ext.'"></script>'."\n";
|
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
||||||
|
{
|
||||||
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min'.$ext.'"></script>'."\n";
|
||||||
|
print '<script type="text/javascript">'."\n";
|
||||||
|
print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
|
||||||
|
print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
|
||||||
|
print 'var tooltipInPlace = \''.$langs->trans('ClickToEdit').'\';'."\n";
|
||||||
|
print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n";
|
||||||
|
print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n";
|
||||||
|
print 'var indicatorInPlace = \'<img src="'.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/editinplace.js"></script>'."\n";
|
||||||
|
}
|
||||||
// Flot
|
// Flot
|
||||||
if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT))
|
if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user