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'}));
44 oilsRptMultiInputWidget.prototype.getValue = function() {
46 for( var i = 0; i < this.dest.length; i++ )
47 vals.push(this.dest.value);
51 oilsRptMultiInputWidget.prototype.draw = function() {
52 removeChildren(this.node);
53 for( var i = 0; i < this.dest.length; i++ ) {
54 this.node.appendChild(this.label[i]);
55 this.node.appendChild(this.dest[i]);
59 oilsRptMultiInputWidget.prototype.setLabels = function(labels) {
66 /* ----------------------------------------------------------- */
68 oilsRptSetSubClass('oilsRptMultiWidget', 'oilsRptWidget');
69 function oilsRptMultiWidget(args) {
70 this.initMultiWidget(args);
73 oilsRptMultiWidget.prototype.initMultiWidget = function(args) {
75 this.initWidget(args);
76 this.dest = elem('select',
77 {multiple:'multiple','class':'oils_rpt_small_info_selector'});
81 this.addButton = elem('input',{type:'submit',value:"Add"})
82 this.addButton.onclick = this.getSourceCollector();
83 this.delButton = elem('input',{type:'submit',value:"Del"})
84 this.delButton.onclick = function(){obj.removeSelected()};
87 oilsRptMultiWidget.prototype.getValue = function() {
89 for( var i = 0; i < this.dest.options.length; i++ )
90 vals.push(this.dest.options[i].value);
94 oilsRptMultiWidget.prototype.removeSelected = function() {
95 oilsDelSelectedItems(this.dest);
98 oilsRptMultiWidget.prototype.addItem = function(name, val) {
99 for( var i = 0; i < this.dest.options.length; i++ ) {
100 if( this.dest.options[i].value == val )
103 insertSelectorVal(this.dest, -1, name, val);
106 oilsRptMultiWidget.prototype.setSource = function(src) {
110 oilsRptMultiWidget.prototype.drawMultiWidget = function() {
111 appendClear(this.node, this.source);
112 this.node.appendChild(elem('br'))
113 this.node.appendChild(this.addButton);
114 this.node.appendChild(this.delButton);
115 this.node.appendChild(elem('br'))
116 this.node.appendChild(this.dest);
120 /* ----------------------------------------------------------- */
122 oilsRptSetSubClass('oilsRptInputMultiWidget', 'oilsRptMultiWidget');
123 function oilsRptInputMultiWidget(args) {
124 this.initInputMultiWidget(args);
126 oilsRptInputMultiWidget.prototype.initInputMultiWidget = function(args) {
128 this.initMultiWidget(args);
129 this.setSource(elem('input',{type:'text'}));
132 oilsRptInputMultiWidget.prototype.draw = function() {
133 this.drawMultiWidget();
136 oilsRptInputMultiWidget.prototype.getSourceCollector = function() {
139 obj.addItem(obj.source.value, obj.source.value);
144 /* ----------------------------------------------------------- */
146 oilsRptSetSubClass('oilsRptSelectorMultiWidget', 'oilsRptMultiWidget');
147 function oilsRptSelectorMultiWidget(args) {
148 this.initSelectorMultiWidget(args);
150 oilsRptSelectorMultiWidget.prototype.initSelectorMultiWidget = function(args) {
152 this.initMultiWidget(args);
154 elem('select',{multiple:'multiple', 'class':'oils_rpt_small_info_selector'}));
157 oilsRptSelectorMultiWidget.prototype.getSourceCollector = function() {
160 for( var i = 0; i < obj.source.options.length; i++ ) {
161 if( obj.source.options[i].selected )
162 obj.addItem(obj.source.options[i].innerHTML,
163 obj.source.options[i].value);
168 /* ----------------------------------------------------------- */
170 oilsRptSetSubClass('oilsRptRemoteWidget', 'oilsRptSelectorMultiWidget');
171 function oilsRptRemoteWidget(args) {
172 this.initRemoteWidget(args);
174 oilsRptRemoteWidget.prototype.initRemoteWidget = function(args) {
176 this.initSelectorMultiWidget(args);
177 this.selector = args.selector;
180 oilsRptRemoteWidget.prototype.draw = function() {
185 oilsRptRemoteWidget.prototype.setFetch = function(func) {
190 /* --------------------------------------------------------------------- */
192 /* standalone org widget */
193 function oilsRptMyOrgsWidget(node, orgid) {
198 oilsRptMyOrgsWidget.prototype.draw = function() {
199 var req = new Request(OILS_RPT_FETCH_ORG_FULL_PATH, this.orgid);
202 function(r) { obj.drawWidget(r.getResultObject()); }
207 oilsRptMyOrgsWidget.prototype.drawWidget = function(orglist) {
209 for( var i = 0; i < orglist.length; i++ ) {
210 var org = orglist[i];
211 var opt = insertSelectorVal( this.node, -1,
212 org.name(), org.id(), null, findOrgDepth(org) );
213 if( org.id() == this.orgid )
218 oilsRptMyOrgsWidget.prototype.getValue = function() {
219 return getSelectorVal(this.node);
222 /* --------------------------------------------------------------------- */
224 oilsRptSetSubClass('oilsRptOrgMultiSelect','oilsRptSelectorMultiWidget');
225 function oilsRptOrgMultiSelect(args) {
226 this.initSelectorMultiWidget(args);
229 oilsRptOrgMultiSelect.prototype.draw = function(org) {
230 if(!org) org = globalOrgTree;
231 var opt = insertSelectorVal( this.source, -1,
232 org.shortname(), org.id(), null, findOrgDepth(org) );
233 if( org.id() == oilsRptCurrentOrg )
235 if( org.children() ) {
236 for( var c = 0; c < org.children().length; c++ )
237 this.draw(org.children()[c]);
239 this.drawMultiWidget();