annotate .svn/pristine/bf/bffd91ecf4c0b23f00fb9bb59916391c678fcfd5.svn-base @ 1516:b450a9d58aed redmine-2.4

Update to Redmine SVN revision 13356 on 2.4-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:28:31 +0100
parents 261b3d9a4903
children
rev   line source
Chris@1464 1 var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
Chris@1464 2
Chris@1464 3 function addOption(theSel, theText, theValue) {
Chris@1464 4 var newOpt = new Option(theText, theValue);
Chris@1464 5 var selLength = theSel.length;
Chris@1464 6 theSel.options[selLength] = newOpt;
Chris@1464 7 }
Chris@1464 8
Chris@1464 9 function swapOptions(theSel, index1, index2) {
Chris@1464 10 var text, value;
Chris@1464 11 text = theSel.options[index1].text;
Chris@1464 12 value = theSel.options[index1].value;
Chris@1464 13 theSel.options[index1].text = theSel.options[index2].text;
Chris@1464 14 theSel.options[index1].value = theSel.options[index2].value;
Chris@1464 15 theSel.options[index2].text = text;
Chris@1464 16 theSel.options[index2].value = value;
Chris@1464 17 }
Chris@1464 18
Chris@1464 19 function deleteOption(theSel, theIndex) {
Chris@1464 20 var selLength = theSel.length;
Chris@1464 21 if (selLength > 0) {
Chris@1464 22 theSel.options[theIndex] = null;
Chris@1464 23 }
Chris@1464 24 }
Chris@1464 25
Chris@1464 26 function moveOptions(theSelFrom, theSelTo) {
Chris@1464 27 var selLength = theSelFrom.length;
Chris@1464 28 var selectedText = new Array();
Chris@1464 29 var selectedValues = new Array();
Chris@1464 30 var selectedCount = 0;
Chris@1464 31 var i;
Chris@1464 32 for (i = selLength - 1; i >= 0; i--) {
Chris@1464 33 if (theSelFrom.options[i].selected) {
Chris@1464 34 selectedText[selectedCount] = theSelFrom.options[i].text;
Chris@1464 35 selectedValues[selectedCount] = theSelFrom.options[i].value;
Chris@1464 36 deleteOption(theSelFrom, i);
Chris@1464 37 selectedCount++;
Chris@1464 38 }
Chris@1464 39 }
Chris@1464 40 for (i = selectedCount - 1; i >= 0; i--) {
Chris@1464 41 addOption(theSelTo, selectedText[i], selectedValues[i]);
Chris@1464 42 }
Chris@1464 43 if (NS4) history.go(0);
Chris@1464 44 }
Chris@1464 45
Chris@1464 46 function moveOptionUp(theSel) {
Chris@1464 47 var index = theSel.selectedIndex;
Chris@1464 48 if (index > 0) {
Chris@1464 49 swapOptions(theSel, index-1, index);
Chris@1464 50 theSel.selectedIndex = index-1;
Chris@1464 51 }
Chris@1464 52 }
Chris@1464 53
Chris@1464 54 function moveOptionDown(theSel) {
Chris@1464 55 var index = theSel.selectedIndex;
Chris@1464 56 if (index < theSel.length - 1) {
Chris@1464 57 swapOptions(theSel, index, index+1);
Chris@1464 58 theSel.selectedIndex = index+1;
Chris@1464 59 }
Chris@1464 60 }
Chris@1464 61
Chris@1464 62 // OK
Chris@1464 63 function selectAllOptions(id) {
Chris@1464 64 var select = $('#'+id);
Chris@1464 65 select.children('option').attr('selected', true);
Chris@1464 66 }