.oils_rpt_tree_link_ref {
color: #A52A2A;
/*color: darkblue;*/
- font-family: courier;
+ /*font-family: courier; */
}
+.oils_rpt_invalid_input {
+ background: red;
+}
+
/* adds an item to the display window */
-function oilsAddRptDisplayItem(path, name, tform) {
+function oilsAddRptDisplayItem(path, name, tform, params) {
if( ! oilsAddSelectorItem(oilsRptDisplaySelector, path, name) )
return;
if( tform ) {
sel.column = {};
- sel.column[tform] = oilsRptPathCol(path);
+ if( params ) {
+ params.unshift(oilsRptPathCol(path));
+ sel.column[tform] = params;
+ } else {
+ sel.column[tform] = oilsRptPathCol(path);
+ }
} else { sel.column = oilsRptPathCol(path); }
oilsRpt.def.select.push(sel);
var d = list[j];
var col = i.column;
- /* if this columsn has a transform, it will be an object { tform => column } */
+ /* if this columsn has a transform,
+ it will be an object { tform => column } */
if( typeof col != 'string' )
for( var c in col ) col = col[c];
+ /* if this transform requires params, the column
+ will be the first item in the param set array */
+ if( typeof col != 'string' ) col = col[0];
+
if( oilsRptPathRel(d) == i.relation && oilsRptPathCol(d) == col ) {
var param = (i.alias) ? i.alias.match(/::PARAM\d*/) : null;
if( param ) delete oilsRpt.params[param];
function oilsRptDrawTransformWindow(path, col, cls, field) {
appendClear(DOM.oils_rpt_tform_label, text(oilsRptMakeLabel(path)));
DOM.oils_rpt_tform_label_input.value = oilsRptMakeLabel(path);
+ var dtype = field.datatype;
DOM.oils_rpt_tform_submit.onclick =
function(){
- var tform = oilsRptGetTform();
+ var tform = oilsRptGetTform(dtype);
+ _debug('found tform: ' + js2JSON(tform));
+ var params = getRptTformParams(dtype, tform);
+ _debug('found tform params: ' + js2JSON(params));
tform = (tform == 'raw') ? null : tform;
- oilsAddRptDisplayItem(path, DOM.oils_rpt_tform_label_input.value, tform)
+ oilsAddRptDisplayItem(path, DOM.oils_rpt_tform_label_input.value, tform, params )
};
DOM.oils_rpt_tform_label_input.focus();
DOM.oils_rpt_tform_label_input.select();
oilsRptHideTformFields();
- _debug("Transforming item with datatype "+field.datatype);
- unHideMe($('oils_rpt_tform_'+field.datatype+'_div'));
- unHideMe($('oils_rpt_tform_'+field.datatype+'_raw'));
- $('oils_rpt_tform_'+field.datatype+'_raw').checked = true;
+ _debug("Transforming item with datatype "+dtype);
+ unHideMe($('oils_rpt_tform_'+dtype+'_div'));
+ $('oils_rpt_tform_all_raw').checked = true;
}
function oilsRptHideTformFields() {
- for( var t in oilsRptTransforms ) {
+ for( var t in oilsRptTransforms )
hideMe($('oils_rpt_tform_'+t+'_div'));
- for( var i in oilsRptTransforms[t] ) {
- _debug('oils_rpt_tform_'+t+'_'+oilsRptTransforms[t][i]);
- $('oils_rpt_tform_'+t+'_'+oilsRptTransforms[t][i]).checked = false;
- }
- }
}
-function oilsRptGetTform() {
- for( var t in oilsRptTransforms )
- for( var i in oilsRptTransforms[t] )
- if( $('oils_rpt_tform_'+t+'_'+oilsRptTransforms[t][i]).checked )
- return oilsRptTransforms[t][i];
+function oilsRptGetTform(datatype) {
+ for( var i in oilsRptTransforms[datatype] )
+ if( $('oils_rpt_tform_'+datatype+'_'+oilsRptTransforms[datatype][i]).checked )
+ return oilsRptTransforms[datatype][i];
+ for( var i in oilsRptTransforms.all )
+ if( $('oils_rpt_tform_all_'+oilsRptTransforms.all[i]).checked )
+ return oilsRptTransforms.all[i];
return null;
}
-;
+function getRptTformParams(type, tform) {
+ switch(type) {
+ case 'timestamp':
+ switch(tform) {
+ case 'months_ago':
+ return [DOM.oils_rpt_tform_timestamp_months_ago_input.value];
+ case 'quarters_ago':
+ return [DOM.oils_rpt_tform_timestamp_quarters_ago_input.value];
+ }
+ case 'string' :
+ switch(tform) {
+ case 'substring' :
+ return [];
+ }
+ }
+}
+
+
<input size='28' id='oils_rpt_tform_label_input'/>
<div class='oils_rpt_tform_window'>
<div style='margin-bottom: 10px;'>Select how this field should be displayed:</div>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_all_raw'/> Raw Data <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_all_count'/> Count <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_all_count_distinct'/> Count Distinct <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_all_min'/> Min <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_all_max'/> Max <br/>
<!--#include virtual="oils_rpt_tform_string.xhtml"-->
<!--#include virtual="oils_rpt_tform_date.xhtml"-->
<!--#include virtual="oils_rpt_tform_numeric.xhtml"-->
<div id='oils_rpt_tform_timestamp_div' class='hide_me'>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_raw'/> Raw Timestamp <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_month_trunc'/> Month Trunc <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_months_ago' /> Months Ago <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_quarters_ago'/> Quarters Ago <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_age'/> Age <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_count'/> Count <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_count_distinct'/> Count Distinct <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_min'/> Min <br/>
- <input type='radio' name='oils_rpt_tform_timestamp' id='oils_rpt_tform_timestamp_max'/> Max <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_timestamp_month_trunc'/> Month Trunc <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_timestamp_months_ago'/>
+ <select id='oils_rpt_tform_timestamp_months_ago_selector' style='padding: 0px;'
+ onchange='DOM.oils_rpt_tform_timestamp_months_ago_input.value=getSelectorVal(this);'>
+ <option value='1'>1</option>
+ <option value='2'>2</option>
+ <option value='3'>3</option>
+ <option value='4'>4</option>
+ <option value='5'>5</option>
+ <option value='6'>6</option>
+ <option value='7'>7</option>
+ <option value='8'>8</option>
+ <option value='9'>9</option>
+ <option value='10'>10</option>
+ <option value='11'>11</option>
+ <option value='12'>12</option>
+ <option value='18'>18</option>
+ <option value='24'>24</option>
+ </select>
+ <input type='text' size='3' maxlength='3' id='oils_rpt_tform_timestamp_months_ago_input' style='padding:0px' value='1'/>
+ <span>Month(s) Ago</span>
+ <br/>
+
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_timestamp_quarters_ago'/>
+ <select id='oils_rpt_tform_timestamp_quarters_ago_selector' style='padding:0px'
+ onchange='DOM.oils_rpt_tform_timestamp_quarters_ago_input.value=getSelectorVal(this);'>
+ <option value='1'>1</option>
+ <option value='2'>2</option>
+ <option value='3'>3</option>
+ <option value='4'>4</option>
+ <option value='5'>5</option>
+ <option value='6'>6</option>
+ <option value='7'>7</option>
+ <option value='8'>8</option>
+ <option value='9'>9</option>
+ <option value='10'>10</option>
+ <option value='11'>11</option>
+ <option value='12'>12</option>
+ </select>
+ <input type='text' size='3' maxlength='3' id='oils_rpt_tform_timestamp_quarters_ago_input' style='padding:0px' value='1'/>
+ <span>Quarter(s) Ago</span>
+ <br/>
+
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_timestamp_age'/> Age <br/>
</div>
<div id='oils_rpt_tform_numeric_div'>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_raw'/> Full Data <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_sum'/> Full Data <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_average'/> Full Data <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_count'/> Count <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_count_distinct'/> Count Distinct <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_min'/> Min <br/>
- <input type='radio' name='oils_rpt_tform_numeric' id='oils_rpt_tform_numeric_max'/> Max <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_numeric_sum'/> Sum <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_numeric_average'/> Average <br/>
</div>
<div id='oils_rpt_tform_string_div'>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_raw'/> Full Data <br/>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_count'/> Count <br/>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_count_distinct'/> Count Distinct <br/>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_min'/> Min <br/>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_max'/> Max <br/>
- <input type='radio' name='oils_rpt_tform_string' id='oils_rpt_tform_string_substring'/> Substring <br/>
+ <input type='radio' name='oils_rpt_tform_input' id='oils_rpt_tform_string_substring'/> Substring <br/>
</div>
};
/* for ease of use, shove everything in the 'all' slot into the other tforms */
+/*
for( var t in oilsRptTransforms ) {
if( t == 'all' ) continue;
for( var a in oilsRptTransforms['all'] )
oilsRptTransforms[t].push( oilsRptTransforms['all'][a] );
}
delete oilsRptTransforms.all;
+*/
+/* --------------------------------------------------- */
+
+
+/*
+var oilsRptRegexClasses = {
+ 'number' : /\d+/
+}
+*/