1 <script language="javascript">
3 function field_add_remove (x) {
6 Widget.Select.addOption('output_order',field, outputs[field]);
7 Widget.Select.addOption('pivot_col',field, outputs[field]);
9 Widget.Select.removeOption('output_order',field);
10 Widget.Select.removeOption('pivot_col',field);
16 if ( typeof Widget == "undefined" ) Widget = {};
18 if ( typeof Widget.Select == "undefined" ) Widget.Select = {};
20 Widget.Select.VERSION = '0.01';
23 Widget.Select.selectAll = function (source){
24 if (typeof(source) != 'object') source = document.getElementById(source);
25 var l = source.options.length;
26 for (var j=0; j<l; j++){
27 source.options[j].selected = true;
32 Widget.Select.selectNone = function(source){
33 if (typeof(source) != 'object') source = document.getElementById(source);
34 var l = source.options.length;
35 for (var j=0; j<l; j++){
36 source.options[j].selected = false;
41 Widget.Select.invertSelection = function(source){
42 if (typeof(source) != 'object') source = document.getElementById(source);
43 var l = source.options.length;
44 for (var j=0; j<l; j++){
45 source.options[j].selected = ! source.options[j].selected;
49 Widget.Select._moveOption = function(e, source, s_idx, target){
52 opt.selected = e.selected;
53 target.options[target.options.length] = opt;
54 source.options[s_idx] = null;
58 Widget.Select.moveSelectedOptionsUp = function(source){
59 if (typeof(source) != 'object') source = document.getElementById(source);
60 var l = source.options.length;
61 for (var j=0; j<l; j++){
63 var e = source.options[0];
65 Widget.Select._moveOption(e, source, 0, source, l);
71 var f= source.options[1];
72 if (!f.selected) break;
73 Widget.Select._moveOption(f, source, 1, source, l);
77 Widget.Select._moveOption(e, source, 0, source, l);
83 Widget.Select.moveSelectedOptionsDown = function(source){
84 if (typeof(source) != 'object') source = document.getElementById(source);
85 var l = source.options.length;
87 for (var j=0; j<l; j++){
88 var e = source.options[0];
91 for (var i=1;i<l-j; i++){
92 var f = source.options[i];
94 Widget.Select._moveOption(f, source, i, source, l);
107 Widget.Select._moveOption(e, source, 0, source, l);
115 Widget.Select.moveSelectedOptionsTo = function(source, target){
116 if (typeof(source) != 'object') source = document.getElementById(source);
117 if (typeof(target) != 'object') target = document.getElementById(target);
118 for (var i=0; i<source.options.length; i++){
119 var e = source.options[i];
121 Widget.Select._moveOption(e,source, i, target, target.options.length);
132 Widget.Select.addOption = function (target,val,l) {
133 if (typeof(target) != 'object') target = document.getElementById(target);
134 target.options[target.options.length] = new Option( l, val );
137 Widget.Select.removeOption = function (target, val) {
138 if (typeof(target) != 'object') target = document.getElementById(target);
139 var l = target.options.length;
140 for ( var i = 0; i<l; i++) {
141 if (target.options[i].value == val) {
142 target.options[i] = null;