From b4d5ea95c59e9498790e65a201646b8f5b6f39ab Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 28 Dec 2005 21:02:19 +0000 Subject: [PATCH] allow clone+edit of existing stage3 reports git-svn-id: svn://svn.open-ils.org/ILS/trunk@2544 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/templates/dashboard.ttk | 6 +- Open-ILS/src/reporter/templates/stage2.ttk | 128 ++++++++++++++---- Open-ILS/src/reporter/templates/stage3.ttk | 2 + .../widgets/comparative-timerange.month | 12 +- .../templates/widgets/lib-choose.dropdown | 5 + .../templates/widgets/lib-choose.multiselect | 18 ++- .../templates/widgets/relative-timerange.day | 6 +- .../widgets/relative-timerange.month | 5 +- .../templates/widgets/relative-timerange.week | 5 +- .../templates/widgets/relative-timerange.year | 5 +- .../templates/widgets/specific-timerange.day | 10 +- .../widgets/specific-timerange.month | 14 +- .../widgets/specific-timerange.multimonth | 18 ++- .../widgets/specific-timerange.multiweek | 10 +- .../widgets/specific-timerange.multiyear | 5 +- .../templates/widgets/specific-timerange.week | 4 + .../templates/widgets/specific-timerange.year | 2 +- .../templates/widgets/string-choose.dropdown | 4 + .../widgets/string-choose.multiselect | 7 + .../templates/widgets/string-input.exact | 2 +- .../widgets/string-input.initial-substring | 2 +- .../widgets/string-input.multistring | 2 +- 22 files changed, 220 insertions(+), 52 deletions(-) diff --git a/Open-ILS/src/reporter/templates/dashboard.ttk b/Open-ILS/src/reporter/templates/dashboard.ttk index 361e535251..c1e9421efa 100644 --- a/Open-ILS/src/reporter/templates/dashboard.ttk +++ b/Open-ILS/src/reporter/templates/dashboard.ttk @@ -36,7 +36,7 @@ BLOCK summary; INCLUDE html/cell colspan=2 align='center' - content=link(content='Schedule a new report',href='bradboard?detail=report_template_tree') + content=link(content='Schedule a new report',href='dashboard?detail=report_template_tree') style='border-bottom:1px solid black'; END; WRAPPER html/row; @@ -47,7 +47,7 @@ BLOCK summary; END; WRAPPER html/row; INCLUDE html/cell - content=link(content='Active reports',href='bradboard?detail=mycompletereports') + content=link(content='Active reports',href='dashboard?detail=mycompletereports') align='center' style='border-bottom:1px solid black'; END; @@ -58,7 +58,7 @@ BLOCK summary; END; WRAPPER html/row; INCLUDE html/cell - content=link(content='Manage scheduled reports',href='bradboard?detail=myreports') + content=link(content='Manage scheduled reports',href='dashboard?detail=myreports') align='center' style='border-bottom:1px solid black'; END; diff --git a/Open-ILS/src/reporter/templates/stage2.ttk b/Open-ILS/src/reporter/templates/stage2.ttk index 39b80a84dd..65355091de 100644 --- a/Open-ILS/src/reporter/templates/stage2.ttk +++ b/Open-ILS/src/reporter/templates/stage2.ttk @@ -14,6 +14,7 @@ WRAPPER html/html; PROCESS select_sorter.js; templates = DBI.tie('reporter.stage2', 'id') + reports = DBI.tie('reporter.stage3', 'id') tmpl = {}; @@ -22,15 +23,18 @@ WRAPPER html/html; tmpl = templates.$tid; END; - IF CGI.param('action') == 'save'; - PROCESS save_stage2; - ELSIF CGI.param('action') == 'edit'; - PROCESS edit_stage2; - ELSIF CGI.param('action') == 'run'; - PROCESS run_stage2; - ELSE; - PROCESS view_stage2; - END; + IF CGI.param('action') == 'save'; + PROCESS save_stage2; + ELSIF CGI.param('action') == 'edit'; + rid = CGI.param('report'); + r = reports.$rid; + report = utils.JSON2perl( r.params ); + PROCESS run_stage2; + ELSIF CGI.param('action') == 'run'; + PROCESS run_stage2; + ELSE; + PROCESS view_stage2; + END; END; INCLUDE footer.ttk; END; @@ -280,7 +284,11 @@ BLOCK run_stage2; INCLUDE hidden name='stage2' value=CGI.param('id'); '
Report Name:'; - INCLUDE text name='reportname' size="50"; + rname = ''; + IF report; + rname = report.reportname _ ' (COPY)'; + END; + INCLUDE text name='reportname' size="50" value=rname; '


'; ''; @@ -291,14 +299,34 @@ BLOCK run_stage2; END; WRAPPER html/row; WRAPPER html/cell rowspan=3 width="25%"; - INCLUDE select multi=1 size=5 id='output_order' name='output_order'; + WRAPPER select multi=1 size=5 id='output_order' name='output_order'; + FOR column = report.output_order; + parts = column.split(':'); + xpath = '/reporter/tables/table[@id="' _ parts.1 _ '"]/fields/field[@name="' _ parts.2 _ '"]'; + IF parts.1 != params.stage1; + xpath = '//*[@id="' _ parts.1 _ '"]/@table'; + name = config.findvalue(xpath); + xpath = '/reporter/tables/table[@id="' _ name _ '"]/fields/field[@name="' _ parts.2 _ '"]'; + END; + node = config.findnodes(xpath); + IF node.findvalue('@primary') == 'true' && parts.1 == params.stage1; + INCLUDE option value=column content='Per group count -- ' _ node.findvalue('description'); + ELSE; + INCLUDE option value=column content=node.findvalue('description'); + END; + END; + END; END; WRAPPER html/cell; INCLUDE anchor href='javascript:void(0);' content='Up' onclick="Widget.Select.moveSelectedOptionsUp('output_order')"; END; WRAPPER html/cell align="right"; - INCLUDE checkbox name='output_format' value='csv' checked='checked'; + checked = 'checked'; + IF report.output_format.grep('csv') == 0; + checked = ''; + END; + INCLUDE checkbox name='output_format' value='csv'; END; INCLUDE html/cell content="CSV" align="left"; END; @@ -308,14 +336,22 @@ BLOCK run_stage2; END; WRAPPER html/cell align="right"; - INCLUDE checkbox name='output_format' value='excel' checked='checked'; + checked = 'checked'; + IF report.output_format.grep('excel') == 0; + checked = ''; + END; + INCLUDE checkbox name='output_format' value='excel'; END; INCLUDE html/cell content="Excel" align="left"; END; WRAPPER html/row; INCLUDE html/cell; WRAPPER html/cell align="right" valign='top'; - INCLUDE checkbox name='output_format' value='html' checked='checked'; + checked = 'checked'; + IF report.output_format.grep('html') == 0; + checked = ''; + END; + INCLUDE checkbox name='output_format' value='html'; END; WRAPPER html/cell align="left"; 'HTML
'; @@ -325,18 +361,30 @@ BLOCK run_stage2; END; WRAPPER html/row; WRAPPER html/cell; - INCLUDE checkbox name='html_graph_type' value='bar' checked=1; + checked = 'checked'; + IF report.output_format.grep('bar') == 0; + checked = ''; + END; + INCLUDE checkbox name='html_graph_type' value='bar'; END; INCLUDE html/cell content='Bar'; END; WRAPPER html/row; WRAPPER html/cell; - INCLUDE checkbox name='html_graph_type' value='pie' checked=1; + checked = 'checked'; + IF report.output_format.grep('pie') == 0; + checked = ''; + END; + INCLUDE checkbox name='html_graph_type' value='pie'; END; INCLUDE html/cell content='Pie'; END; WRAPPER html/row; WRAPPER html/cell; + checked = ''; + IF report.output_format.grep('line'); + checked = 'checked'; + END; INCLUDE checkbox name='html_graph_type' value='line'; END; INCLUDE html/cell content='Line'; @@ -346,9 +394,25 @@ BLOCK run_stage2; END; END; + checked = 0; + '

Pivot Column: '; WRAPPER select id='pivot_col' name='pivot_col'; INCLUDE option value='' content='No Pivot'; + FOR column = report.output_order; + parts = column.split(':'); + xpath = '/reporter/tables/table[@id="' _ parts.1 _ '"]/fields/field[@name="' _ parts.2 _ '"]/description'; + IF parts.1 != params.stage1; + xpath = '//*[@id="' _ parts.1 _ '"]/@table'; + name = config.findvalue(xpath); + xpath = '/reporter/tables/table[@id="' _ name _ '"]/fields/field[@name="' _ parts.2 _ '"]/description'; + END; + selected = 0; + IF column == report.pivot_col; + selected = 1; + END; + INCLUDE option value=column content=config.findvalue(xpath); + END; END; '

'; @@ -410,6 +474,8 @@ BLOCK run_stage2; table_alias = t; input_prefix = "filter:$t:$fieldname:$famname:$widgetname"; + current_value = report.filter.$t.$fieldname.$famname.$widgetname; + logme(current_value); INCLUDE $w_file widget_family=fam; CATCH; @@ -444,12 +510,22 @@ BLOCK run_stage2; WRAPPER html/row; WRAPPER html/cell align='left' style="padding-left: 50px;"; - INCLUDE checkbox checked='checked' name="output:$classname:$pid" value="include" onclick="field_add_remove(this)"; + INCLUDE checkbox + checked=(report.output.$classname.$pid == 'include' ? 'checked' : '') + name="output:$classname:$pid" + value="include" + onclick="field_add_remove(this)"; INCLUDE hidden name="xform:type:$classname:$pid" value="count_dist"; %] [% "Per group count of $plabel

"; @@ -475,7 +551,7 @@ BLOCK run_stage2; END; - INCLUDE checkbox name="publicreport" value="t"; + INCLUDE checkbox name="publicreport" value="t" checked=(report.publicreport == 't' ? 'checked' : ''); 'Public Report
'; INCLUDE submit name="action" value="Run Now"; INCLUDE submit name="action" value="Schedule"; @@ -532,7 +608,11 @@ BLOCK show_filter_atts; WRAPPER html/row; WRAPPER html/cell align='left' col=bg_color style="padding-left: 50px;"; - INCLUDE checkbox name="output:$t:$fid" value="include" onclick="field_add_remove(this)"; + INCLUDE checkbox + name="output:$t:$fid" + value="include" + onclick="field_add_remove(this)" + checked=(report.output.$t.$fid == 'include' ? 'checked' : ''); %]