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);
$inputType=$tmp[0];
if (! empty($tmp[1])) $rows=$tmp[1];
if (! empty($tmp[2])) $cols=$tmp[2];
$rows=($tmp[1]?$tmp[1]:'8');
$cols=($tmp[2]?$tmp[2]:'80');
}
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($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 ($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="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.') - ';
$opt.=dol_trunc($objp->label,18).' - ';
$outval.=dol_trunc($label,18).' - ';
if (! empty($objp->idprodfournprice))
{
$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
$outval.=$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)
{
$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");
}
$opt .= "</option>\n";
// Add new entry
// "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
@@ -1548,7 +1552,7 @@ class Form
//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é)');
//var_dump($outval); var_dump(utf8_check($outval)); var_dump(json_encode($outval));
$i++;
}
$outselect.='</select>';

View File

@@ -26,48 +26,51 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html();
$('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea',
rows : 4,
id : 'field',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
loadurl : urlLoadInPlace,
loaddata : function(result, settings) {
return getParameters(this, 'textarea');
},
submitdata : function(result, settings) {
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");
if ($('.editval_textarea').length > 0) {
$('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea',
rows : $('#textarea_' + $('.editval_textarea').attr('id').substr(8) + '_rows').val(),
cols : $('#textarea_' + $('.editval_textarea').attr('id').substr(8) + '_cols').val(),
id : 'field',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
loadurl : urlLoadInPlace,
loaddata : function(result, settings) {
return getParameters(this, 'textarea');
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
submitdata : function(result, settings) {
return getParameters(this, 'textarea');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.editkey_textarea').click(function() {
$('#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();
});
});
$('.editkey_textarea').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.editkey_textarea').click(function() {
$('#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') {
$('.editval_ckeditor').editable(urlSaveInPlace, {
@@ -120,204 +123,214 @@ $(document).ready(function() {
});
}
$('.editval_string').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 300,
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
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");
if ($('.editval_string').length > 0) {
$('.editval_string').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 300,
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
submitdata : function(result, settings) {
return getParameters(this, 'string');
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.editkey_string').click(function() {
$( '#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();
});
});
$('.editkey_string').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.editkey_string').click(function() {
$( '#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, {
type : 'text',
id : 'field',
width : 100,
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
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");
if ($('.editval_numeric').length > 0) {
$('.editval_numeric').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 100,
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
submitdata : function(result, settings) {
return getParameters(this, 'numeric');
},
function () {
$( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover");
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.editkey_numeric').click(function() {
$( '#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();
});
});
$('.editkey_numeric').hover(
function () {
$( '#viewval_' + $(this).attr('id') ).addClass("viewval_hover");
},
function () {
$( '#viewval_' + $(this).attr('id') ).removeClass("viewval_hover");
}
);
$('.editkey_numeric').click(function() {
$( '#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, {
type : 'datepicker',
id : 'field',
onblur : 'ignore',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
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");
if ($('.editval_datepicker').length > 0) {
$('.editval_datepicker').editable(urlSaveInPlace, {
type : 'datepicker',
id : 'field',
onblur : 'ignore',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
submitdata : function(result, settings) {
return getParameters(this, 'datepicker');
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.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();
});
});
$('.editkey_datepicker').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.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, {
type : 'select',
id : 'field',
onblur : 'ignore',
cssclass : 'flat',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
loadurl : urlLoadInPlace,
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");
if ($('.editval_select').length > 0) {
$('.editval_select').editable(urlSaveInPlace, {
type : 'select',
id : 'field',
onblur : 'ignore',
cssclass : 'flat',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
loadurl : urlLoadInPlace,
loaddata : function(result, settings) {
return getParameters(this, 'select');
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
submitdata : function(result, settings) {
return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.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();
});
});
$('.editkey_select').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.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)
$('.editval_autocomplete').editable(urlSaveInPlace, {
type : 'autocomplete',
id : 'field',
width : 300,
onblur : 'ignore',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
autocomplete : {
source : urlLoadInPlace,
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");
if ($('.editval_autocomplete').length > 0) {
$('.editval_autocomplete').editable(urlSaveInPlace, {
type : 'autocomplete',
id : 'field',
width : 300,
onblur : 'ignore',
tooltip : tooltipInPlace,
placeholder : '&nbsp;',
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
autocomplete : {
source : urlLoadInPlace,
data : function(result, settings) {
return getParameters(this, 'select');
}
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
submitdata : function(result, settings) {
return getParameters(this, 'select');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
);
$('.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();
});
});
$('.editkey_autocomplete').hover(
function () {
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.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) {
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.
*
*
* @param string $utf8_string String to encode
* @return string String converted
* @return string String converted
*/
function dol_strtolower($utf8_string)
{
return mb_strtolower($utf8_string, "UTF-8");
}
/**
/**
* Convert a string to upper. Never use strtolower because it does not works with UTF8 strings.
*
*
* @param string $utf8_string String to encode
* @return string String converted
* @return string String converted
*/
function dol_strtoupper($utf8_string)
{

View File

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