1 <script language="javascript">
3 function show_hide_params (sel) {
4 var span = document.getElementById('hide-param:' + sel.name);
5 if (sel.options[sel.selectedIndex].textContent.match(/\(*\)/)) {
6 span.style.visibility = 'visible';
8 span.style.visibility = 'hidden';
14 function field_add_remove (x) {
17 Widget.Select.addOption('output_order',field, outputs[field]);
18 Widget.Select.addOption('pivot_col',field, outputs[field]);
20 Widget.Select.removeOption('output_order',field);
21 Widget.Select.removeOption('pivot_col',field);
27 if ( typeof Widget == "undefined" ) Widget = {};
29 if ( typeof Widget.Select == "undefined" ) Widget.Select = {};
31 Widget.Select.VERSION = '0.01';
34 Widget.Select.selectAll = function (source){
35 if (typeof(source) != 'object') source = document.getElementById(source);
36 var l = source.options.length;
37 for (var j=0; j<l; j++){
38 source.options[j].selected = true;
43 Widget.Select.selectNone = function(source){
44 if (typeof(source) != 'object') source = document.getElementById(source);
45 var l = source.options.length;
46 for (var j=0; j<l; j++){
47 source.options[j].selected = false;
52 Widget.Select.invertSelection = function(source){
53 if (typeof(source) != 'object') source = document.getElementById(source);
54 var l = source.options.length;
55 for (var j=0; j<l; j++){
56 source.options[j].selected = ! source.options[j].selected;
60 Widget.Select._moveOption = function(e, source, s_idx, target){
63 opt.selected = e.selected;
64 target.options[target.options.length] = opt;
65 source.options[s_idx] = null;
69 Widget.Select.moveSelectedOptionsUp = function(source){
70 if (typeof(source) != 'object') source = document.getElementById(source);
71 var l = source.options.length;
72 for (var j=0; j<l; j++){
74 var e = source.options[0];
76 Widget.Select._moveOption(e, source, 0, source, l);
82 var f= source.options[1];
83 if (!f.selected) break;
84 Widget.Select._moveOption(f, source, 1, source, l);
88 Widget.Select._moveOption(e, source, 0, source, l);
94 Widget.Select.moveSelectedOptionsDown = function(source){
95 if (typeof(source) != 'object') source = document.getElementById(source);
96 var l = source.options.length;
98 for (var j=0; j<l; j++){
99 var e = source.options[0];
102 for (var i=1;i<l-j; i++){
103 var f = source.options[i];
105 Widget.Select._moveOption(f, source, i, source, l);
118 Widget.Select._moveOption(e, source, 0, source, l);
126 Widget.Select.moveSelectedOptionsTo = function(source, target){
127 if (typeof(source) != 'object') source = document.getElementById(source);
128 if (typeof(target) != 'object') target = document.getElementById(target);
129 for (var i=0; i<source.options.length; i++){
130 var e = source.options[i];
132 Widget.Select._moveOption(e,source, i, target, target.options.length);
143 Widget.Select.addOption = function (target,val,l) {
144 if (typeof(target) != 'object') target = document.getElementById(target);
145 target.options[target.options.length] = new Option( l, val );
148 Widget.Select.removeOption = function (target, val) {
149 if (typeof(target) != 'object') target = document.getElementById(target);
150 var l = target.options.length;
151 for ( var i = 0; i<l; i++) {
152 if (target.options[i].value == val) {
153 target.options[i] = null;