1 <script language="javascript">
3 function field_add_remove (x) {
6 Widget.Select.addOption('output_order',field, outputs[field]);
8 Widget.Select.removeOption('output_order',field);
13 if ( typeof Widget == "undefined" ) Widget = {};
15 if ( typeof Widget.Select == "undefined" ) Widget.Select = {};
17 Widget.Select.VERSION = '0.01';
20 Widget.Select.selectAll = function (source){
21 if (typeof(source) != 'object') source = document.getElementById(source);
22 var l = source.options.length;
23 for (var j=0; j<l; j++){
24 source.options[j].selected = true;
29 Widget.Select.selectNone = function(source){
30 if (typeof(source) != 'object') source = document.getElementById(source);
31 var l = source.options.length;
32 for (var j=0; j<l; j++){
33 source.options[j].selected = false;
38 Widget.Select.invertSelection = function(source){
39 if (typeof(source) != 'object') source = document.getElementById(source);
40 var l = source.options.length;
41 for (var j=0; j<l; j++){
42 source.options[j].selected = ! source.options[j].selected;
46 Widget.Select._moveOption = function(e, source, s_idx, target){
49 opt.selected = e.selected;
50 target.options[target.options.length] = opt;
51 source.options[s_idx] = null;
55 Widget.Select.moveSelectedOptionsUp = function(source){
56 if (typeof(source) != 'object') source = document.getElementById(source);
57 var l = source.options.length;
58 for (var j=0; j<l; j++){
60 var e = source.options[0];
62 Widget.Select._moveOption(e, source, 0, source, l);
68 var f= source.options[1];
69 if (!f.selected) break;
70 Widget.Select._moveOption(f, source, 1, source, l);
74 Widget.Select._moveOption(e, source, 0, source, l);
80 Widget.Select.moveSelectedOptionsDown = function(source){
81 if (typeof(source) != 'object') source = document.getElementById(source);
82 var l = source.options.length;
84 for (var j=0; j<l; j++){
85 var e = source.options[0];
88 for (var i=1;i<l-j; i++){
89 var f = source.options[i];
91 Widget.Select._moveOption(f, source, i, source, l);
104 Widget.Select._moveOption(e, source, 0, source, l);
112 Widget.Select.moveSelectedOptionsTo = function(source, target){
113 if (typeof(source) != 'object') source = document.getElementById(source);
114 if (typeof(target) != 'object') target = document.getElementById(target);
115 for (var i=0; i<source.options.length; i++){
116 var e = source.options[i];
118 Widget.Select._moveOption(e,source, i, target, target.options.length);
129 Widget.Select.addOption = function (target,val,l) {
130 if (typeof(target) != 'object') target = document.getElementById(target);
131 target.options[target.options.length] = new Option( l, val );
134 Widget.Select.removeOption = function (target, val) {
135 if (typeof(target) != 'object') target = document.getElementById(target);
136 var l = target.options.length;
137 for ( var i = 0; i<l; i++) {
138 if (target.options[i].value == val) {
139 target.options[i] = null;