";
}
print "";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 08c5afd4b85..648938a7c8c 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -74,20 +74,24 @@ class Form
* @param string $paramkey Key of parameter for Url (unique if there is several parameter to show). In most cases "id".
* @param string $paramvalue Value of parameter for Url
* @param boolean $perm Permission to allow button to edit parameter
- * @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day' or 'datepicker', ...)
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz', 'select:xxx'...)
* @return string HTML edit field
- * TODO no GET or POST in class file, use a param
*/
function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string')
{
- global $langs;
- $ret='';
- $ret.='
';
- $ret.=$langs->trans($text);
- $ret.='
';
- if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
';
+ return $ret;
+ }
}
/**
@@ -95,51 +99,67 @@ class Form
*
* @param string $text Text of label (not used in this function)
* @param string $htmlname Name of select field
- * @param string $preselected Value to show/edit
+ * @param string $value Value to show/edit
* @param string $paramkey Key of parameter (unique if there is several parameter to show). In most cases "id".
* @param boolean $perm Permission to allow button to edit parameter
- * @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day' or 'datepicker', ...)
- * @param string $editvalue Use this value instead $preselected
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:rows:cols', 'select:xxx'...)
+ * @param string $editvalue When in edit mode, use this value as $value instead of value
* @return string HTML edit field
- * TODO no GET or POST in class file, use a param
*/
- function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='')
+ function editfieldval($text,$htmlname,$value,$paramkey,$paramvalue,$perm,$typeofdata='string',$editvalue='')
{
- global $langs,$db;
+ global $conf,$langs,$db;
$ret='';
- if (GETPOST('action') == 'edit'.$htmlname)
+
+ // When option to edit inline is activated
+ if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
- $ret.="\n";
- $ret.=''."\n";
+ $ret.=$this->editInPlace($value, $htmlname, $perm, $typeofdata);
}
else
{
- if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1);
- elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($preselected,'day');
- elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($preselected);
- else $ret.=$preselected;
+ if (GETPOST('action') == 'edit'.$htmlname)
+ {
+ $ret.="\n";
+ $ret.=''."\n";
+ }
+ else
+ {
+ if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
+ elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
+ elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($value);
+ else $ret.=$value;
+ }
}
return $ret;
}
@@ -150,11 +170,10 @@ class Form
* @param string $value Value to show/edit
* @param string $htmlname DIV ID (field name)
* @param int $condition Condition to edit
- * @param string $inputType Type of input
- * @param string $inputOption Input option
+ * @param string $inputType Type of input ('numeric', 'datepicker', 'textarea', 'ckeditor:dolibarr_zzz', 'select:xxx')
* @return string HTML edit in place
*/
- function editInPlace($value, $htmlname, $condition, $inputType='textarea', $inputOption='')
+ function editInPlace($value, $htmlname, $condition, $inputType='textarea')
{
global $conf;
@@ -162,21 +181,30 @@ class Form
// Check parameters
if ($inputType == 'textarea') $value = dol_nl2br($value);
- else if ($inputType == 'numeric') $value = price($value);
+ else if (preg_match('/^numeric/',$inputType)) $value = price($value);
else if ($inputType == 'datepicker') $value = dol_print_date($value, 'day');
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
{
- if ($inputType == 'datepicker')
+ if (preg_match('/^(string|email|numeric)/',$inputType))
+ {
+ $tmp=explode(':',$inputType);
+ $inputType=$tmp[0]; $inputOption=$tmp[1];
+ }
+ if ($inputType == 'datepicker')
{
$out.= ''; // Use for timestamp format
}
- else if ($inputType == 'select' && ! empty($inputOption))
+ else if (preg_match('/^select/',$inputType))
{
+ $tmp=explode(':',$inputType);
+ $inputType=$tmp[0]; $inputOption=$tmp[1];
$out.= '';
}
- else if ($inputType == 'ckeditor' && ! empty($inputOption))
+ else if (preg_match('/^ckeditor/',$inputType))
{
+ $tmp=explode(':',$inputType);
+ $inputType=$tmp[0]; $inputOption=$tmp[1];
if (! empty($conf->fckeditor->enabled))
{
$out.= '';
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 38a150a52a4..027d8fba2ce 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -816,11 +816,9 @@ else if ($id > 0 || ! empty($ref))
// Description (must be a textarea and not html must be allowed (used in list view)
print '