DOM.oils_rpt_report_editor_save.disabled = false;
unHideMe(DOM.oils_rpt_report_editor_save);
- unHideMe(DOM.oils_rpt_report_editor_save_new);
unHideMe(DOM.oils_rpt_report_editor_cancel);
hideMe(DOM.oils_rpt_report_editor_exit);
+
+ }
+
+ // avoid showing save-as-new for new reports, since the
+ // regular save button acts as save-as-new
+ if (rpt && !this.readonly) {
+ unHideMe(DOM.oils_rpt_report_editor_save_new);
+ } else {
+ hideMe(DOM.oils_rpt_report_editor_save_new);
}
this.paramEditor = new oilsRptParamEditor(
oilsRptReportEditor.prototype.exit = function() {
- oilsRptCurrentFolderManager.draw();
- this.folderWindow.draw();
+ unHideMe(DOM.oils_rpt_folder_window_contents_table);
+ unHideMe(DOM.oils_rpt_folder_table_right_td);
+ hideMe(DOM.oils_rpt_folder_table_alt_td);
+ hideMe(DOM.oils_rpt_editor_div);
}
}
oilsRptTextWidget.prototype.draw = function() {
this.node.appendChild(this.dest);
- // TODO: untested
if (this.seedValue) {
this.dest.value = this.seedValue;
this.dest.onchange(); // validation
--------------------------------------------------------------------- */
function oilsRptBoolWidget(args) {
this.node = args.node;
- this.seedValue = arg.value;
+ this.seedValue = args.value;
this.selector = elem('select');
insertSelectorVal(this.selector, -1,'True','t');
insertSelectorVal(this.selector, -1,'False','f');
oilsRptBoolWidget.prototype.draw = function() {
this.node.appendChild(this.selector);
- if (this.seedValue) // TODO: untested
+ if (this.seedValue)
setSelector(this.selector, this.seedValue);
}
if(!org) org = globalOrgTree;
var opt = insertSelectorVal( this.selector, -1,
org.shortname(), org.id(), null, findOrgDepth(org) );
- if( org.id() == oilsRptCurrentOrg )
+ if( org.id() == oilsRptCurrentOrg && !this.seedValue)
opt.selected = true;
/* sometimes we need these choices
this.node.appendChild(this.count);
this.node.appendChild(this.type);
- if (this.seedValue) { // TODO: test me
- var parts = this.seedValue.split(/ /);
- setSelector(this.count, parts[0]);
- setSelector(this.type, parts[1]);
+ if (this.seedValue) {
+ // e.g. "2months"
+ var count = this.seedValue.match(/(\d+)([^\d]+)/)[1];
+ var type = this.seedValue.match(/(\d+)([^\d]+)/)[2];
+ setSelector(this.count, count);
+ setSelector(this.type, type);
}
}
this.node.appendChild(this.selector);
var obj = this;
- if (this.seedValue) // TODO: test me
+ if (this.seedValue)
setSelector(this.selector, this.seedValue);
}
function oilsRptTruncPicker(args) {
this.node = args.node;
this.type = args.type;
- this.seedValue = args.value; // TODO: FINISH
+ this.seedValue = args.value;
this.realSpan = elem('span');
this.relSpan = elem('span');
hideMe(this.relSpan);
hideMe(obj.realSpan);
}
}
+
+ if (seed = this.seedValue) {
+ if (typeof seed == 'string') {
+ this.calWidget.value = seed;
+ } else {
+ // relative date transform
+ if (seed.transform.match(/relative/)) {
+ setSelector(this.selector, 2)
+ setSelector(this.numberPicker.selector,
+ Math.abs(seed.params[0]));
+ unHideMe(this.relSpan);
+ hideMe(this.realSpan);
+ }
+ }
+ }
}
oilsRptTruncPicker.prototype.getValue = function() {