Feature #18101 » sort_in_tceforms.diff
class.t3lib_tceforms.php 2008-09-21 00:10:10.000000000 +0200 | ||
---|---|---|
$icons['L'][]='<a href="#" onclick="setFormValueManipulate(\''.$fName.'\',\'Up\'); return false;">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/up.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_move_up')).' />'.
|
||
'</a>';
|
||
|
||
$icons['L'][]='<a href="#" onclick="setFormValueManipulate(\''.$fName.'\',\'SortUp\'); return false;">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/sort_up.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_sort')).' />'.
|
||
'</a>';
|
||
$icons['L'][]='<a href="#" onclick="setFormValueManipulate(\''.$fName.'\',\'SortDown\'); return false;">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/sort_down.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_sort')).' />'.
|
||
'</a>';
|
||
$icons['L'][]='<a href="#" onclick="setFormValueManipulate(\''.$fName.'\',\'Down\'); return false;">'.
|
||
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/down.gif','width="14" height="14"').' border="0" '.t3lib_BEfunc::titleAltAttrib($this->getLL('l_move_down')).' />'.
|
||
'</a>';
|
||
... | ... | |
var localArray_V = new Array();
|
||
var localArray_L = new Array();
|
||
var localArray_S = new Array();
|
||
var localArray = new Array();
|
||
var fObjSel = formObj[fName+"_list"];
|
||
var l=fObjSel.length;
|
||
var c=0;
|
||
... | ... | |
}
|
||
}
|
||
c=l; // Restore length value in "c"
|
||
}
|
||
}
|
||
// Changed by Eduard Renger
|
||
if (type=="SortUp" || type=="SortDown") {
|
||
c=0;
|
||
for (a=0;a<l;a++) {
|
||
|
||
localArray[c] = new Array();
|
||
localArray[c][0]=fObjSel.options[a].value;
|
||
localArray[c][1]=fObjSel.options[a].text;
|
||
if (fObjSel.options[a].selected==1) {
|
||
localArray[c][2]=1;
|
||
} else {
|
||
localArray[c][2]=0;
|
||
}
|
||
c++;
|
||
}
|
||
if (type=="SortUp") {
|
||
localArray.sort(sortUpByValue);
|
||
} else {
|
||
localArray.sort(sortDownByValue);
|
||
}
|
||
fObjSel.length = c;
|
||
for (a=0;a<c;a++) {
|
||
fObjSel.options[a].value = localArray[a][0];
|
||
fObjSel.options[a].text = localArray[a][1];
|
||
fObjSel.options[a].selected = localArray[a][2];
|
||
}
|
||
} else {
|
||
// Transfer items in temporary storage to list object:
|
||
fObjSel.length = c;
|
||
for (a=0;a<c;a++) {
|
||
fObjSel.options[a].value = localArray_V[a];
|
||
fObjSel.options[a].text = localArray_L[a];
|
||
fObjSel.options[a].selected = localArray_S[a];
|
||
}
|
||
}
|
||
|
||
setHiddenFromList(fObjSel,formObj[fName]);
|
||
'.$this->TBE_EDITOR_fieldChanged_func.'
|
||
}
|
||
}
|
||
// Function to sort values
|
||
function sortUpByValue(a, b) {
|
||
var x = a[1].toLowerCase();
|
||
var y = b[1].toLowerCase();
|
||
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
||
}
|
||
function sortDownByValue(a, b) {
|
||
var x = a[1].toLowerCase();
|
||
var y = b[1].toLowerCase();
|
||
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
|
||
}
|
||
function setFormValue_getFObj(fName) { //
|
||
var formObj = '.$formObj.';
|
||
if (formObj) {
|