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 oilsRptSetSubClass('oilsRptMultiInputWidget', 'oilsRptWidget');
30 function oilsRptMultiInputWidget(args) {
31 this.initInputWidget(args);
34 oilsRptMultiInputWidget.prototype.initInputWidget = function(args) {
36 this.initWidget(args);
37 this.count = (args.count) ? args.count : 2;
39 for( var i = 0; i < this.count; i++ )
40 this.dest.push(elem('input',{type:'text'}));
43 oilsRptMultiInputWidget.prototype.getValue = function() {
45 for( var i = 0; i < this.dest.length; i++ )
46 vals.push(this.dest.value);
50 oilsRptMultiInputWidget.prototype.draw = function() {
51 removeChildren(this.node);
52 for( var i = 0; i < this.dest.length; i++ ) {
53 this.node.appendChild(this.label[i]);
54 this.node.appendChild(this.dest[i]);
58 oilsRptMultiInputWidget.prototype.setLabels = function(labels) {
65 /* ----------------------------------------------------------- */
67 oilsRptSetSubClass('oilsRptMultiWidget', 'oilsRptWidget');
68 function oilsRptMultiWidget(args) {
69 this.initMultiWidget(args);
72 oilsRptMultiWidget.prototype.initMultiWidget = function(args) {
74 this.initWidget(args);
75 this.dest = elem('select',
76 {multiple:'multiple','class':'oils_rpt_small_info_selector'});
80 this.addButton = elem('input',{type:'submit',value:"Add"})
81 this.addButton.onclick = this.getSourceCollector();
82 this.delButton = elem('input',{type:'submit',value:"Del"})
83 this.delButton.onclick = function(){obj.removeSelected()};
86 oilsRptMultiWidget.prototype.getValue = function() {
88 for( var i = 0; i < this.dest.options.length; i++ )
89 vals.push(this.dest.options[i].value);
93 oilsRptMultiWidget.prototype.removeSelected = function() {
94 oilsDelSelectedItems(this.dest);
97 oilsRptMultiWidget.prototype.addItem = function(name, val) {
98 for( var i = 0; i < this.dest.options.length; i++ ) {
99 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'}));
133 oilsRptInputMultiWidget.prototype.addItem = function(name, val) {
134 //this.addItem(name, val);
135 this.source.value = "";
140 oilsRptInputMultiWidget.prototype.getSourceCollector = function() {
143 obj.addItem(obj.source.value, obj.source.value);
147 /* ----------------------------------------------------------- */
149 oilsRptSetSubClass('oilsRptSelectorMultiWidget', 'oilsRptMultiWidget');
150 function oilsRptSelectorMultiWidget(args) {
151 this.initSelectorMultiWidget(args);
153 oilsRptSelectorMultiWidget.prototype.initSelectorMultiWidget = function(args) {
155 this.initMultiWidget(args);
157 elem('select',{multiple:'multiple', 'class':'oils_rpt_small_info_selector'}));
160 oilsRptSelectorMultiWidget.prototype.getSourceCollector = function() {
163 for( var i = 0; i < obj.source.options.length; i++ ) {
164 if( obj.source.options[i].selected )
165 obj.addItem(obj.source.options[i].innerHTML,
166 obj.source.options[i].value);
171 /* ----------------------------------------------------------- */
173 oilsRptSetSubClass('oilsRptRemoteWidget', 'oilsRptSelectorMultiWidget');
174 function oilsRptRemoteWidget(args) {
175 this.initRemoteWidget(args);
177 oilsRptRemoteWidget.prototype.initRemoteWidget = function(args) {
179 this.initSelectorMultiWidget(args);
180 this.selector = args.selector;
183 oilsRptRemoteWidget.prototype.draw = function() {
188 oilsRptRemoteWidget.prototype.setFetch = function(func) {
193 /* --------------------------------------------------------------------- */
195 /* standalone org widget */
196 function oilsRptMyOrgsWidget(node, orgid) {
201 oilsRptMyOrgsWidget.prototype.draw = function() {
202 var req = new Request(OILS_RPT_FETCH_ORG_FULL_PATH, this.orgid);
205 function(r) { obj.drawWidget(r.getResultObject()); }
210 oilsRptMyOrgsWidget.prototype.drawWidget = function(orglist) {
212 for( var i = 0; i < orglist.length; i++ ) {
213 var org = orglist[i];
214 var opt = insertSelectorVal( this.node, -1,
215 org.name(), org.id(), null, findOrgDepth(org) );
216 if( org.id() == this.orgid )
221 oilsRptMyOrgsWidget.prototype.getValue = function() {
222 return getSelectorVal(this.node);
225 /* --------------------------------------------------------------------- */
227 oilsRptSetSubClass('oilsRptOrgMultiSelect','oilsRptSelectorMultiWidget');
228 function oilsRptOrgMultiSelect(args) {
229 this.initSelectorMultiWidget(args);
232 oilsRptOrgMultiSelect.prototype.draw = function(org) {
233 if(!org) org = globalOrgTree;
234 var opt = insertSelectorVal( this.source, -1,
235 org.shortname(), org.id(), null, findOrgDepth(org) );
236 if( org.id() == oilsRptCurrentOrg )
238 if( org.children() ) {
239 for( var c = 0; c < org.children().length; c++ )
240 this.draw(org.children()[c]);
242 this.drawMultiWidget();
246 oilsRptOrgMultiSelectWidget.prototype.getSourceCollector = function() {
249 for( var i = 0; i < obj.source.options.length; i++ )
250 obj.addItem(obj.source.options.name, obj.source.options.value);
256 oilsRptOrgMultiSelect.prototype.getValue = function() {
257 return getSelectedList(this.select);