2
0
forked from Wavyzz/dolibarr

Fix: missing row and col parameters

This commit is contained in:
Regis Houssin
2012-10-23 09:30:48 +02:00
parent 92656e2b4f
commit 30430953de
4 changed files with 254 additions and 237 deletions

View File

@@ -292,8 +292,8 @@ class Form
{ {
$tmp=explode(':',$inputType); $tmp=explode(':',$inputType);
$inputType=$tmp[0]; $inputType=$tmp[0];
if (! empty($tmp[1])) $rows=$tmp[1]; $rows=($tmp[1]?$tmp[1]:'8');
if (! empty($tmp[2])) $cols=$tmp[2]; $cols=($tmp[2]?$tmp[2]:'80');
} }
else if (preg_match('/^ckeditor/',$inputType)) else if (preg_match('/^ckeditor/',$inputType))
{ {
@@ -320,6 +320,10 @@ class Form
if (! empty($savemethod)) $out.= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; if (! empty($savemethod)) $out.= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
if (! empty($ext_element)) $out.= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; if (! empty($ext_element)) $out.= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
if (! empty($success)) $out.= '<input id="success_'.$htmlname.'" value="'.$success.'" type="hidden"/>'."\n"; if (! empty($success)) $out.= '<input id="success_'.$htmlname.'" value="'.$success.'" type="hidden"/>'."\n";
if ($inputType == 'textarea') {
$out.= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
$out.= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
}
$out.= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; $out.= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
$out.= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(! empty($editvalue) ? $editvalue : $value).'</span>'."\n"; $out.= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(! empty($editvalue) ? $editvalue : $value).'</span>'."\n";
@@ -1480,7 +1484,7 @@ class Form
$outval.=$objRef.' ('.$objRefFourn.') - '; $outval.=$objRef.' ('.$objRefFourn.') - ';
$opt.=dol_trunc($objp->label,18).' - '; $opt.=dol_trunc($objp->label,18).' - ';
$outval.=dol_trunc($label,18).' - '; $outval.=dol_trunc($label,18).' - ';
if (! empty($objp->idprodfournprice)) if (! empty($objp->idprodfournprice))
{ {
$currencytext=$langs->trans("Currency".$conf->currency); $currencytext=$langs->trans("Currency".$conf->currency);
@@ -1505,7 +1509,7 @@ class Form
$opt.= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding $opt.= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Units"); $outval.=$langs->transnoentities("Units");
} }
if ($objp->quantity >= 1) if ($objp->quantity >= 1)
{ {
$opt.=" (".price($objp->unitprice).' '.$currencytext."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding $opt.=" (".price($objp->unitprice).' '.$currencytext."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
@@ -1533,8 +1537,8 @@ class Form
$outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier"); $outval.=$langs->transnoentities("NoPriceDefinedForThisSupplier");
} }
$opt .= "</option>\n"; $opt .= "</option>\n";
// Add new entry // Add new entry
// "key" value of json key array is used by jQuery automatically as selected value // "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box // "label" value of json key array is used by jQuery automatically as text for combo box
@@ -1548,7 +1552,7 @@ class Form
//var_dump($outval); var_dump(utf8_check($outval)); var_dump(json_encode($outval)); //var_dump($outval); var_dump(utf8_check($outval)); var_dump(json_encode($outval));
//$outval=array('label'=>'ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/ Unité (20,00 Euros/unité)'); //$outval=array('label'=>'ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/ Unité (20,00 Euros/unité)');
//var_dump($outval); var_dump(utf8_check($outval)); var_dump(json_encode($outval)); //var_dump($outval); var_dump(utf8_check($outval)); var_dump(json_encode($outval));
$i++; $i++;
} }
$outselect.='</select>'; $outselect.='</select>';

View File

@@ -26,48 +26,51 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html(); var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html(); var fk_element = $('#jeditable_fk_element').html();
$('.editval_textarea').editable(urlSaveInPlace, { if ($('.editval_textarea').length > 0) {
type : 'textarea', $('.editval_textarea').editable(urlSaveInPlace, {
rows : 4, type : 'textarea',
id : 'field', rows : $('#textarea_' + $('.editval_textarea').attr('id').substr(8) + '_rows').val(),
tooltip : tooltipInPlace, cols : $('#textarea_' + $('.editval_textarea').attr('id').substr(8) + '_cols').val(),
placeholder : '&nbsp;', id : 'field',
cancel : cancelInPlace, tooltip : tooltipInPlace,
submit : submitInPlace, placeholder : '&nbsp;',
indicator : indicatorInPlace, cancel : cancelInPlace,
loadurl : urlLoadInPlace, submit : submitInPlace,
loaddata : function(result, settings) { indicator : indicatorInPlace,
return getParameters(this, 'textarea'); loadurl : urlLoadInPlace,
}, loaddata : function(result, settings) {
submitdata : function(result, settings) { return getParameters(this, 'textarea');
return getParameters(this, 'textarea');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_textarea').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}, },
function () { submitdata : function(result, settings) {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); return getParameters(this, 'textarea');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.editkey_textarea').click(function() { $('.editkey_textarea').hover(
$('#viewval_' + $(this).attr('id')).click(); function () {
}); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
$('.viewval_textarea.active').click(function() { },
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}); }
$('.editkey_textarea').click(function() { );
$('#viewval_' + $(this).attr('id')).hide(); $('.editkey_textarea').click(function() {
$('#editval_' + $(this).attr('id')).show().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();
});
}
if (typeof ckeditorConfig != 'undefined') { if (typeof ckeditorConfig != 'undefined') {
$('.editval_ckeditor').editable(urlSaveInPlace, { $('.editval_ckeditor').editable(urlSaveInPlace, {
@@ -120,204 +123,214 @@ $(document).ready(function() {
}); });
} }
$('.editval_string').editable(urlSaveInPlace, { if ($('.editval_string').length > 0) {
type : 'text', $('.editval_string').editable(urlSaveInPlace, {
id : 'field', type : 'text',
width : 300, id : 'field',
tooltip : tooltipInPlace, width : 300,
placeholder : placeholderInPlace, tooltip : tooltipInPlace,
cancel : cancelInPlace, placeholder : placeholderInPlace,
submit : submitInPlace, cancel : cancelInPlace,
indicator : indicatorInPlace, submit : submitInPlace,
submitdata : function(result, settings) { indicator : indicatorInPlace,
return getParameters(this, 'string'); submitdata : function(result, settings) {
}, return getParameters(this, 'string');
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_string').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}, },
function () { callback : function(result, settings) {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.editkey_string').click(function() { $('.editkey_string').hover(
$( '#viewval_' + $(this).attr('id') ).click(); function () {
}); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
$('.viewval_string.active').click(function() { },
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}); }
$('.editkey_string').click(function() { );
$('#viewval_' + $(this).attr('id')).hide(); $('.editkey_string').click(function() {
$('#editval_' + $(this).attr('id')).show().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, { if ($('.editval_numeric').length > 0) {
type : 'text', $('.editval_numeric').editable(urlSaveInPlace, {
id : 'field', type : 'text',
width : 100, id : 'field',
tooltip : tooltipInPlace, width : 100,
placeholder : placeholderInPlace, tooltip : tooltipInPlace,
cancel : cancelInPlace, placeholder : placeholderInPlace,
submit : submitInPlace, cancel : cancelInPlace,
indicator : indicatorInPlace, submit : submitInPlace,
submitdata : function(result, settings) { indicator : indicatorInPlace,
return getParameters(this, 'numeric'); submitdata : function(result, settings) {
}, return getParameters(this, 'numeric');
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_numeric').hover(
function () {
$( '#viewval_' + $(this).attr('id') ).addClass("viewval_hover");
}, },
function () { callback : function(result, settings) {
$( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover"); getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.editkey_numeric').click(function() { $('.editkey_numeric').hover(
$( '#viewval_' + $(this).attr('id') ).click(); function () {
}); $( '#viewval_' + $(this).attr('id') ).addClass("viewval_hover");
$('.viewval_numeric.active').click(function() { },
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover");
}); }
$('.editkey_numeric').click(function() { );
$('#viewval_' + $(this).attr('id')).hide(); $('.editkey_numeric').click(function() {
$('#editval_' + $(this).attr('id')).show().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, { if ($('.editval_datepicker').length > 0) {
type : 'datepicker', $('.editval_datepicker').editable(urlSaveInPlace, {
id : 'field', type : 'datepicker',
onblur : 'ignore', id : 'field',
tooltip : tooltipInPlace, onblur : 'ignore',
placeholder : '&nbsp;', tooltip : tooltipInPlace,
cancel : cancelInPlace, placeholder : '&nbsp;',
submit : submitInPlace, cancel : cancelInPlace,
indicator : indicatorInPlace, submit : submitInPlace,
submitdata : function(result, settings) { indicator : indicatorInPlace,
return getParameters(this, 'datepicker'); submitdata : function(result, settings) {
}, return getParameters(this, 'datepicker');
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_datepicker').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}, },
function () { callback : function(result, settings) {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.viewval_datepicker.active').click(function() { $('.editkey_datepicker').hover(
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}); },
$('.editkey_datepicker').click(function() { function () {
$('#viewval_' + $(this).attr('id')).hide(); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
$('#editval_' + $(this).attr('id')).show().click(); }
}); );
$('.viewval_datepicker.active').click(function() {
$('#viewval_' + $(this).attr('id').substr(8)).hide();
$('#editval_' + $(this).attr('id').substr(8)).show().click();
});
$('.editkey_datepicker').click(function() {
$('#viewval_' + $(this).attr('id')).hide();
$('#editval_' + $(this).attr('id')).show().click();
});
}
$('.editval_select').editable(urlSaveInPlace, { if ($('.editval_select').length > 0) {
type : 'select', $('.editval_select').editable(urlSaveInPlace, {
id : 'field', type : 'select',
onblur : 'ignore', id : 'field',
cssclass : 'flat', onblur : 'ignore',
tooltip : tooltipInPlace, cssclass : 'flat',
placeholder : '&nbsp;', tooltip : tooltipInPlace,
cancel : cancelInPlace, placeholder : '&nbsp;',
submit : submitInPlace, cancel : cancelInPlace,
indicator : indicatorInPlace, submit : submitInPlace,
loadurl : urlLoadInPlace, indicator : indicatorInPlace,
loaddata : function(result, settings) { loadurl : urlLoadInPlace,
return getParameters(this, 'select'); loaddata : function(result, settings) {
}, return getParameters(this, 'select');
submitdata : function(result, settings) {
return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_select').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}, },
function () { submitdata : function(result, settings) {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.viewval_select.active').click(function() { $('.editkey_select').hover(
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}); },
$('.editkey_select').click(function() { function () {
$('#viewval_' + $(this).attr('id')).hide(); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
$('#editval_' + $(this).attr('id')).show().click(); }
}); );
$('.viewval_select.active').click(function() {
$('#viewval_' + $(this).attr('id').substr(8)).hide();
$('#editval_' + $(this).attr('id').substr(8)).show().click();
});
$('.editkey_select').click(function() {
$('#viewval_' + $(this).attr('id')).hide();
$('#editval_' + $(this).attr('id')).show().click();
});
}
// for test only (not stable) // for test only (not stable)
$('.editval_autocomplete').editable(urlSaveInPlace, { if ($('.editval_autocomplete').length > 0) {
type : 'autocomplete', $('.editval_autocomplete').editable(urlSaveInPlace, {
id : 'field', type : 'autocomplete',
width : 300, id : 'field',
onblur : 'ignore', width : 300,
tooltip : tooltipInPlace, onblur : 'ignore',
placeholder : '&nbsp;', tooltip : tooltipInPlace,
cancel : cancelInPlace, placeholder : '&nbsp;',
submit : submitInPlace, cancel : cancelInPlace,
indicator : indicatorInPlace, submit : submitInPlace,
autocomplete : { indicator : indicatorInPlace,
source : urlLoadInPlace, autocomplete : {
data : function(result, settings) { source : urlLoadInPlace,
return getParameters(this, 'select'); data : function(result, settings) {
} return getParameters(this, 'select');
}, }
submitdata : function(result, settings) {
return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_autocomplete').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}, },
function () { submitdata : function(result, settings) {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover"); return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
} }
); });
$('.viewval_autocomplete.active').click(function() { $('.editkey_autocomplete').hover(
$('#viewval_' + $(this).attr('id').substr(8)).hide(); function () {
$('#editval_' + $(this).attr('id').substr(8)).show().click(); $('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
}); },
$('.editkey_autocomplete').click(function() { function () {
$('#viewval_' + $(this).attr('id')).hide(); $('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
$('#editval_' + $(this).attr('id')).show().click(); }
}); );
$('.viewval_autocomplete.active').click(function() {
$('#viewval_' + $(this).attr('id').substr(8)).hide();
$('#editval_' + $(this).attr('id').substr(8)).show().click();
});
$('.editkey_autocomplete').click(function() {
$('#viewval_' + $(this).attr('id')).hide();
$('#editval_' + $(this).attr('id')).show().click();
});
}
function getParameters(obj, type) { function getParameters(obj, type) {
var htmlname = $(obj).attr('id').substr(8); var htmlname = $(obj).attr('id').substr(8);

View File

@@ -447,22 +447,22 @@ function dol_escape_htmltag($stringtoescape,$keepb=0)
} }
/** /**
* Convert a string to lower. Never use strtolower because it does not works with UTF8 strings. * Convert a string to lower. Never use strtolower because it does not works with UTF8 strings.
* *
* @param string $utf8_string String to encode * @param string $utf8_string String to encode
* @return string String converted * @return string String converted
*/ */
function dol_strtolower($utf8_string) function dol_strtolower($utf8_string)
{ {
return mb_strtolower($utf8_string, "UTF-8"); return mb_strtolower($utf8_string, "UTF-8");
} }
/** /**
* Convert a string to upper. Never use strtolower because it does not works with UTF8 strings. * Convert a string to upper. Never use strtolower because it does not works with UTF8 strings.
* *
* @param string $utf8_string String to encode * @param string $utf8_string String to encode
* @return string String converted * @return string String converted
*/ */
function dol_strtoupper($utf8_string) function dol_strtoupper($utf8_string)
{ {

View File

@@ -912,7 +912,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr><td valign="top">'; print '<tr><td valign="top">';
print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea');
print '</td><td colspan="3">'; print '</td><td colspan="3">';
print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';