|
@@ -233,21 +233,21 @@ class Form
|
|
|
}
|
|
|
if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata)) {
|
|
|
$tmp = explode(':', $typeofdata);
|
|
|
- $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
|
|
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
|
|
|
} elseif (preg_match('/^(integer)/', $typeofdata)) {
|
|
|
$tmp = explode(':', $typeofdata);
|
|
|
$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
|
|
|
- $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
|
|
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
|
|
|
} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
|
|
|
$tmp = explode(':', $typeofdata);
|
|
|
$valuetoshow = price2num($editvalue ? $editvalue : $value);
|
|
|
- $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
|
|
|
+ $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
|
|
|
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
|
|
|
$tmp = explode(':', $typeofdata);
|
|
|
- $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
|
|
|
+ $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
|
|
|
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor'
|
|
|
$tmp = explode(':', $typeofdata);
|
|
|
- $cols = $tmp[2];
|
|
|
+ $cols = (empty($tmp[2]) ? '' : $tmp[2]);
|
|
|
$morealt = '';
|
|
|
if (preg_match('/%/', $cols)) {
|
|
|
$morealt = ' style="width: '.$cols.'"';
|
|
@@ -255,7 +255,7 @@ class Form
|
|
|
}
|
|
|
|
|
|
$valuetoshow = ($editvalue ? $editvalue : $value);
|
|
|
- $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
|
|
|
+ $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
|
|
|
// textarea convert automatically entities chars into simple chars.
|
|
|
// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwig is off.
|
|
|
$valuetoshow = str_replace('&', '&', $valuetoshow);
|
|
@@ -277,7 +277,7 @@ class Form
|
|
|
} elseif (preg_match('/^ckeditor/', $typeofdata)) {
|
|
|
$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
|
- $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), (isset($tmp[8]) ? ($tmp[8] ?true:false) : true), true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100'));
|
|
|
+ $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
|
|
|
$ret .= $doleditor->Create(1);
|
|
|
}
|
|
|
if (empty($notabletag)) {
|