mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
Allows to move multiple columns in selection list (#18357).
Patch by Filou Centrinov. git-svn-id: http://svn.redmine.org/redmine/trunk@13610 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
043c2c92da
commit
cbf10b0eb8
@ -7,13 +7,16 @@ function addOption(theSel, theText, theValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function swapOptions(theSel, index1, index2) {
|
function swapOptions(theSel, index1, index2) {
|
||||||
var text, value;
|
var text, value, selected;
|
||||||
text = theSel.options[index1].text;
|
text = theSel.options[index1].text;
|
||||||
value = theSel.options[index1].value;
|
value = theSel.options[index1].value;
|
||||||
|
selected = theSel.options[index1].selected;
|
||||||
theSel.options[index1].text = theSel.options[index2].text;
|
theSel.options[index1].text = theSel.options[index2].text;
|
||||||
theSel.options[index1].value = theSel.options[index2].value;
|
theSel.options[index1].value = theSel.options[index2].value;
|
||||||
|
theSel.options[index1].selected = theSel.options[index2].selected;
|
||||||
theSel.options[index2].text = text;
|
theSel.options[index2].text = text;
|
||||||
theSel.options[index2].value = value;
|
theSel.options[index2].value = value;
|
||||||
|
theSel.options[index2].selected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteOption(theSel, theIndex) {
|
function deleteOption(theSel, theIndex) {
|
||||||
@ -44,40 +47,54 @@ function moveOptions(theSelFrom, theSelTo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function moveOptionUp(theSel) {
|
function moveOptionUp(theSel) {
|
||||||
var index = theSel.selectedIndex;
|
var indexTop = 0;
|
||||||
if (index > 0) {
|
for(var s=0; s<theSel.length; s++) {
|
||||||
swapOptions(theSel, index-1, index);
|
if (theSel.options[s].selected) {
|
||||||
theSel.selectedIndex = index-1;
|
if (s > indexTop) {
|
||||||
|
swapOptions(theSel, s-1, s);
|
||||||
|
}
|
||||||
|
indexTop++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveOptionTop(theSel) {
|
function moveOptionTop(theSel) {
|
||||||
var index = theSel.selectedIndex;
|
var indexTop = 0;
|
||||||
|
for(var s=0; s<theSel.length; s++) {
|
||||||
if (index > 0) {
|
if (theSel.options[s].selected) {
|
||||||
for (i=index; i>0; i--) {
|
if (s > indexTop) {
|
||||||
|
for (var i=s; i>indexTop; i--) {
|
||||||
swapOptions(theSel, i-1, i);
|
swapOptions(theSel, i-1, i);
|
||||||
}
|
}
|
||||||
theSel.selectedIndex = 0;
|
}
|
||||||
|
indexTop++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveOptionDown(theSel) {
|
function moveOptionDown(theSel) {
|
||||||
var index = theSel.selectedIndex;
|
var indexBottom = theSel.length - 1;
|
||||||
if (index < theSel.length - 1) {
|
for(var s=indexBottom; s>=0; s--) {
|
||||||
swapOptions(theSel, index, index+1);
|
if (theSel.options[s].selected) {
|
||||||
theSel.selectedIndex = index+1;
|
if (s < indexBottom) {
|
||||||
|
swapOptions(theSel, s+1, s);
|
||||||
|
}
|
||||||
|
indexBottom--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveOptionBottom(theSel) {
|
function moveOptionBottom(theSel) {
|
||||||
var index = theSel.selectedIndex;
|
var indexBottom = theSel.length - 1;
|
||||||
var indexTop = theSel.length - 1;
|
for(var s=indexBottom; s>=0; s--) {
|
||||||
if (index < theSel.length - 1) {
|
if (theSel.options[s].selected) {
|
||||||
for (i=index; i<indexTop; i++) {
|
if (s < indexBottom) {
|
||||||
|
for (i=s; i<indexBottom; i++) {
|
||||||
swapOptions(theSel, i+1, i);
|
swapOptions(theSel, i+1, i);
|
||||||
}
|
}
|
||||||
theSel.selectedIndex = indexTop;
|
}
|
||||||
|
indexBottom--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user