1 oilsRptSetSubClass('oilsRptWidget', 'oilsRptObject');
2 oilsRptWidget.OILS_RPT_TRANSFORM_WIDGET = 0;
3 oilsRptWidget.OILS_RPT_OPERATION_WIDGET = 1;
5 function oilsRptWidget(args) {
7 this.dest = elem('input',{type:'text'});
10 oilsRptWidget.prototype.initWidget = function(args) {
13 this.node = args.node;
14 this.type = args.type;
15 this.action = args.action;
16 this.column = args.column;
19 oilsRptWidget.prototype.getValue = function() {
20 return this.dest.value;
23 oilsRptWidget.prototype.draw = function() {
24 appendClear(this.node, this.dest);
27 /* ----------------------------------------------------------- */
29 /* multiple input boxes */
30 oilsRptSetSubClass('oilsRptMultiInputWidget', 'oilsRptWidget');
31 function oilsRptMultiInputWidget(args) {
32 this.initInputWidget(args);
35 oilsRptMultiInputWidget.prototype.initInputWidget = function(args) {
37 this.initWidget(args);
38 this.count = (args.count) ? args.count : 2;
40 for( var i = 0; i < this.count; i++ )
41 this.dest.push(elem('input',{type:'text',size:10}));
44 oilsRptMultiInputWidget.prototype.getValue = function() {
46 for( var i = 0; i < this.dest.length; i++ )
47 vals.push(this.dest[i].value);
51 oilsRptMultiInputWidget.prototype.draw = function() {
52 removeChildren(this.node);
53 for( var i = 0; i < this.dest.length; i++ ) {
55 this.node.appendChild(this.label[i]);
56 this.node.appendChild(this.dest[i]);
60 oilsRptMultiInputWidget.prototype.setLabels = function(labels) {
67 /* ----------------------------------------------------------- */
69 oilsRptSetSubClass('oilsRptMultiWidget', 'oilsRptWidget');
70 function oilsRptMultiWidget(args) {
71 this.initMultiWidget(args);
74 oilsRptMultiWidget.prototype.initMultiWidget = function(args) {
76 this.initWidget(args);
77 this.dest = elem('select',
78 {multiple:'multiple','class':'oils_rpt_small_info_selector'});
82 this.addButton = elem('input',{type:'submit',value:"Add"})
83 this.addButton.onclick = this.getSourceCollector();
84 this.delButton = elem('input',{type:'submit',value:"Del"})
85 this.delButton.onclick = function(){obj.removeSelected()};
88 oilsRptMultiWidget.prototype.getValue = function() {
90 for( var i = 0; i < this.dest.options.length; i++ )
91 vals.push(this.dest.options[i].value);
95 oilsRptMultiWidget.prototype.removeSelected = function() {
96 oilsDelSelectedItems(this.dest);
99 oilsRptMultiWidget.prototype.addItem = function(name, val) {
100 for( var i = 0; i < this.dest.options.length; i++ ) {
101 if( this.dest.options[i].value == val )
104 insertSelectorVal(this.dest, -1, name, val);
107 oilsRptMultiWidget.prototype.setSource = function(src) {
111 oilsRptMultiWidget.prototype.drawMultiWidget = function() {
112 appendClear(this.node, this.source);
113 this.node.appendChild(elem('br'))
114 this.node.appendChild(this.addButton);
115 this.node.appendChild(this.delButton);
116 this.node.appendChild(elem('br'))
117 this.node.appendChild(this.dest);
121 /* ----------------------------------------------------------- */
123 oilsRptSetSubClass('oilsRptInputMultiWidget', 'oilsRptMultiWidget');
124 function oilsRptInputMultiWidget(args) {
125 this.initInputMultiWidget(args);
127 oilsRptInputMultiWidget.prototype.initInputMultiWidget = function(args) {
129 this.initMultiWidget(args);
130 this.setSource(elem('input',{type:'text'}));
133 oilsRptInputMultiWidget.prototype.draw = function() {
134 this.drawMultiWidget();
137 oilsRptInputMultiWidget.prototype.getSourceCollector = function() {
140 obj.addItem(obj.source.value, obj.source.value);
145 /* ----------------------------------------------------------- */
147 oilsRptSetSubClass('oilsRptSelectorMultiWidget', 'oilsRptMultiWidget');
148 function oilsRptSelectorMultiWidget(args) {
149 this.initSelectorMultiWidget(args);
151 oilsRptSelectorMultiWidget.prototype.initSelectorMultiWidget = function(args) {
153 this.initMultiWidget(args);
155 elem('select',{multiple:'multiple', 'class':'oils_rpt_small_info_selector'}));
158 oilsRptSelectorMultiWidget.prototype.getSourceCollector = function() {
161 for( var i = 0; i < obj.source.options.length; i++ ) {
162 if( obj.source.options[i].selected )
163 obj.addItem(obj.source.options[i].innerHTML,
164 obj.source.options[i].value);
169 /* ----------------------------------------------------------- */
171 oilsRptSetSubClass('oilsRptRemoteWidget', 'oilsRptSelectorMultiWidget');
172 function oilsRptRemoteWidget(args) {
173 this.initRemoteWidget(args);
175 oilsRptRemoteWidget.prototype.initRemoteWidget = function(args) {
177 this.initSelectorMultiWidget(args);
178 this.selector = args.selector;
181 oilsRptRemoteWidget.prototype.draw = function() {
186 oilsRptRemoteWidget.prototype.setFetch = function(func) {
191 /* --------------------------------------------------------------------- */
193 /* standalone org widget */
194 function oilsRptMyOrgsWidget(node, orgid) {
199 oilsRptMyOrgsWidget.prototype.draw = function() {
200 var req = new Request(OILS_RPT_FETCH_ORG_FULL_PATH, this.orgid);
203 function(r) { obj.drawWidget(r.getResultObject()); }
208 oilsRptMyOrgsWidget.prototype.drawWidget = function(orglist) {
210 for( var i = 0; i < orglist.length; i++ ) {
211 var org = orglist[i];
212 var opt = insertSelectorVal( this.node, -1,
213 org.name(), org.id(), null, findOrgDepth(org) );
214 if( org.id() == this.orgid )
219 oilsRptMyOrgsWidget.prototype.getValue = function() {
220 return getSelectorVal(this.node);
223 /* --------------------------------------------------------------------- */
225 oilsRptSetSubClass('oilsRptOrgMultiSelect','oilsRptSelectorMultiWidget');
226 function oilsRptOrgMultiSelect(args) {
227 this.initSelectorMultiWidget(args);
230 oilsRptOrgMultiSelect.prototype.draw = function(org) {
231 if(!org) org = globalOrgTree;
232 var opt = insertSelectorVal( this.source, -1,
233 org.shortname(), org.id(), null, findOrgDepth(org) );
234 if( org.id() == oilsRptCurrentOrg )
236 if( org.children() ) {
237 for( var c = 0; c < org.children().length; c++ )
238 this.draw(org.children()[c]);
240 this.drawMultiWidget();