+oilsReport.prototype.gatherTemplateParams = function() {
+ var arr = this.__gatherTemplateParams(this.def.where, 'where');
+ arr.concat(this.__gatherTemplateParams(this.def.having, 'having'));
+ _debug("template params: " + js2JSON(arr));
+ return arr;
+}
+
+oilsReport.prototype.__gatherTemplateParams = function(arr, type) {
+
+ if(!arr) return [];
+ var params = [];
+
+ for( var i = 0; i < arr.length; i++ ) {
+
+ var obj = arr[i];
+ var node = obj.condition;
+ var op = oilsRptObjectKeys(node)[0];
+ var key = node[op];
+
+ /** if this is a dynamic param, skip it */
+ if( key && key.match(/::.*/) ) continue;
+
+ _debug("template params: op = " + op + ", value = " + js2JSON(key));
+
+ params.push( {
+ key : key, /* key == value, since this is not a dynamic param */
+ op : op,
+ value : key,
+ column : obj.column,
+ path : obj.path,
+ type : type,
+ relation : obj.relation,
+ field : field
+ });
+ }
+
+ return params;
+}
+
par.widget = this.buildWidget(par, $n(row, 'widget'));
par.widget.draw();
}
+
+ /** draw the pre-defined template params so the user will know
+ what params are already set */
+ var tparams = this.report.gatherTemplateParams();
+
+ for( var p = 0; p < params.length; p++ ) {
+ var par = tparams[p];
+ var row = oilsRptParamEditor.row.cloneNode(true);
+ this.tbody.appendChild(row);
+ $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path)));
+ $n(row, 'transform').appendChild(text(OILS_RPT_TRANSFORMS[par.column.transform].label));
+ $n(row, 'action').appendChild(text(OILS_RPT_FILTERS[par.op].label));
+ par.widget = this.buildWidget(par, $n(row, 'widget'));
+ par.widget.draw();
+ }
}
oilsRptParamEditor.prototype.buildWidget = function(param, node) {
case 'not in':
widgetArgs.inputWidget = atomicWidget;
return new oilsRptSetWidget(widgetArgs);
+ case 'is':
+ case 'is not':
+ return new oilsRptNullWidget(widgetArgs);
case 'between':
case 'not between':
widgetArgs.startWidget = atomicWidget;
/* ---------------------------------------------------------------------
Relative dates widget
--------------------------------------------------------------------- */
+
+function oilsRptNullWidget(args) {
+ this.node = args.node;
+ this.type = args.type;
+}
+oilsRptNullWidget.prototype.draw = function() {}
+oilsRptNullWidget.prototype.getValue = function() {
+ return null;
+}
+
+/* ---------------------------------------------------------------------
+ Relative dates widget
+ --------------------------------------------------------------------- */
function oilsRptTruncPicker(args) {
this.node = args.node;
this.type = args.type;