From 6a58d3ebb9fc536ba8c16a374787077f21b94c89 Mon Sep 17 00:00:00 2001 From: "wurblzap%gmail.com" <> Date: Fri, 3 Aug 2007 03:38:37 +0000 Subject: Bug 380187 – Bugzilla should support RADIUS authentication. Patch by Marc Schumann ; r=mkanat, a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/params.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 js/params.js (limited to 'js') diff --git a/js/params.js b/js/params.js new file mode 100755 index 000000000..453740799 --- /dev/null +++ b/js/params.js @@ -0,0 +1,61 @@ +/* The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is the Bugzilla Bug Tracking System. + * + * The Initial Developer of the Original Code is Marc Schumann. + * Portions created by Marc Schumann are Copyright (c) 2007 Marc Schumann. + * All rights reserved. + * + * Contributor(s): Marc Schumann + */ + +function sortedList_moveItem(paramName, direction, separator) { + var select = document.getElementById('select_' + paramName); + var inputField = document.getElementById('input_' + paramName); + var currentIndex = select.selectedIndex; + var newIndex = currentIndex + direction; + var optionCurrentIndex; + var optionNewIndex; + + /* Return if no selection */ + if (currentIndex < 0) return; + /* Return if trying to move upward out of list */ + if (newIndex < 0) return; + /* Return if trying to move downward out of list */ + if (newIndex >= select.length) return; + + /* Move selection */ + optionNewIndex = select.options[newIndex]; + optionCurrentIndex = select.options[currentIndex]; + /* Because some browsers don't accept the same option object twice in a + * selection list, we need to put a blank option here first */ + select.options[newIndex] = new Option(); + select.options[currentIndex] = optionNewIndex; + select.options[newIndex] = optionCurrentIndex; + select.selectedIndex = newIndex; + populateInputField(select, inputField, separator); +} + +function populateInputField(select, inputField, separator) { + var i; + var stringRepresentation = ''; + + for (i = 0; i < select.length; i++) { + if (select.options[i].value == separator) { + break; + } + if (stringRepresentation != '') { + stringRepresentation += ','; + } + stringRepresentation += select.options[i].value; + } + inputField.value = stringRepresentation; +} -- cgit v1.2.3-24-g4f1b