allow clone+edit of existing stage3 reports
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Dec 2005 21:02:19 +0000 (21:02 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 28 Dec 2005 21:02:19 +0000 (21:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2544 dcc99617-32d9-48b4-a31d-7c20da2025e4

22 files changed:
Open-ILS/src/reporter/templates/dashboard.ttk
Open-ILS/src/reporter/templates/stage2.ttk
Open-ILS/src/reporter/templates/stage3.ttk
Open-ILS/src/reporter/templates/widgets/comparative-timerange.month
Open-ILS/src/reporter/templates/widgets/lib-choose.dropdown
Open-ILS/src/reporter/templates/widgets/lib-choose.multiselect
Open-ILS/src/reporter/templates/widgets/relative-timerange.day
Open-ILS/src/reporter/templates/widgets/relative-timerange.month
Open-ILS/src/reporter/templates/widgets/relative-timerange.week
Open-ILS/src/reporter/templates/widgets/relative-timerange.year
Open-ILS/src/reporter/templates/widgets/specific-timerange.day
Open-ILS/src/reporter/templates/widgets/specific-timerange.month
Open-ILS/src/reporter/templates/widgets/specific-timerange.multimonth
Open-ILS/src/reporter/templates/widgets/specific-timerange.multiweek
Open-ILS/src/reporter/templates/widgets/specific-timerange.multiyear
Open-ILS/src/reporter/templates/widgets/specific-timerange.week
Open-ILS/src/reporter/templates/widgets/specific-timerange.year
Open-ILS/src/reporter/templates/widgets/string-choose.dropdown
Open-ILS/src/reporter/templates/widgets/string-choose.multiselect
Open-ILS/src/reporter/templates/widgets/string-input.exact
Open-ILS/src/reporter/templates/widgets/string-input.initial-substring
Open-ILS/src/reporter/templates/widgets/string-input.multistring

index 361e535..c1e9421 100644 (file)
@@ -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;
index 39b80a8..6535509 100644 (file)
@@ -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');
 
                '<br/><center><b>Report Name:</b>';
-               INCLUDE text name='reportname' size="50";
+               rname = '';
+               IF report;
+                       rname = report.reportname _ ' (COPY)';
+               END;
+               INCLUDE text name='reportname' size="50" value=rname;
                '</center><br/><br/>';
                '<script language="javascript">filters["reportname"] = "Report Name";</script>';
 
@@ -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<br/>';
@@ -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;
+
                '<br/><br/><b>Pivot Column:</b> ';
                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;
                '<br/><br/>';
 
@@ -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";
                                        %]
                                                <script language="javascript">
                                                        outputs['[% "output:$classname:$pid" %]'] = '[% "Per group count of $plabel" %]';
-                                                       Widget.Select.addOption('output_order','[% "output:$classname:$pid" %]', '[% "Per group count of $plabel" %]');
+                                                       [% IF !report %]
+                                                       Widget.Select.addOption(
+                                                               'output_order',
+                                                               '[% "output:$classname:$pid" %]', 
+                                                               '[% "Per group count of $plabel" %]'
+                                                       );
+                                                       [% END %]
                                                </script>
                                        [%
                                "Per group count of $plabel<br/><br/>";
@@ -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<br>';
                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' : '');
                                %]
                                        <script language="javascript">
                                                outputs['[% "output:$t:$fid" %]'] = '[% fname %]';
@@ -550,22 +630,22 @@ BLOCK show_filter_atts;
                                END;
 
                                WRAPPER select id="xform:type:$t:$fid" name="xform:type:$t:$fid" onchange="show_hide_params(this)";
-                                       INCLUDE option value='' content='None' selected=1;
+                                       INCLUDE option value='' content='None' selected=(report.xform.type.$t.$fid == '' ? 1 : 0);
                                        FOR xform = dtype_xform_map.$dtype;
                                                xform_label = dtype_xforms.$xform.label;
                                                IF dtype_xforms.$xform.param;
                                                        xform_label = "$xform_label (*)";
                                                END;
-                                               INCLUDE option value=xform content=xform_label;
+                                               INCLUDE option value=xform content=xform_label selected=(report.xform.type.$t.$fid == xform ? 1 : 0);
                                        END;
                                END;
 
                                %]
 
                                <br/>
-                               <span id="hide-param:xform:type:[% t %]:[% fid %]" style="visibility: hidden;">
+                               <span id="hide-param:xform:type:[% t %]:[% fid %]" [% 'style="visibility: hidden;"' IF !report.xform.param.$t.$fid %] >
                                        <small><super>*</super>Output Tranformation Parameter: </small>
-                                       [% INCLUDE text name="xform:param:$t:$fid" %]
+                                       [% INCLUDE text name="xform:param:$t:$fid" value=report.xform.param.$t.$fid %]
                                </span>
 
                                [%
index 26d9f57..5bed698 100644 (file)
@@ -285,6 +285,8 @@ BLOCK view_stage3;
                                WRAPPER html/cell style="border:solid gray 1px;";
                                        INCLUDE anchor content='Refresh' href=CGI.url('-path', 1) _ '?id=' _ rpt.id;
                                        '&nbsp;&nbsp;&nbsp;';
+                                       INCLUDE anchor content='Clone and Edit' href='stage2?action=edit&id=' _ rpt.stage2 _ '&report=' _ rpt.id;
+                                       '&nbsp;&nbsp;&nbsp;';
                                        IF user.id == rpt.owner;
                                                INCLUDE anchor content='Run again' href=CGI.url('-path', 1) _ '?action=rerun&id=' _ rpt.id;
                                                '&nbsp;&nbsp;&nbsp;';
index 1f339e7..bf1e979 100644 (file)
@@ -4,8 +4,12 @@ PROCESS inputs;
 
 WRAPPER select name=input_prefix _ ":target";
        count = 1;
+       def = 1;
+       IF current_value.target;
+               def = current_value.target;
+       END;
        WHILE count < 37;
-               INCLUDE option value=count selected=(count == 1 ? 1 : 0);
+               INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
@@ -14,8 +18,12 @@ END;
 
 WRAPPER select name=input_prefix _ ":compare";
        count = 1;
+       def = 12;
+       IF current_value.compare;
+               def = current_value.compare;
+       END;
        WHILE count < 37;
-               INCLUDE option value=count selected=(count == 12 ? 1 : 0);
+               INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
index c84eb13..4d27a51 100644 (file)
@@ -62,6 +62,11 @@ BLOCK next_level;
                        x = x - 1;
                END;
 
+               selected = '';
+               IF current_value == f.id;
+                       selected = 'selected';
+               END;
+
                INCLUDE option value=f.id content=f.name content=val _ f.name id='dr_' _ f.id;
                INCLUDE next_level parent_ou = f.id;
        END;
index 05c57b6..eb0d8fa 100644 (file)
@@ -34,8 +34,13 @@ org_unit_type = DBI.tie('actor.org_unit_type', 'id')
 WRAPPER select name=input_prefix multi="multi" onchange='change_multihier_' _ table_alias _ '(this);';
        depth = 0;
        FOR f = DBI.query(root);
-               INCLUDE option value=f.id content=f.name;
-               INCLUDE next_level parent_ou = f.id depth;
+               sel = 0;
+               FOR v = current_value;
+                       sel = 1 IF v == f.id;
+                       LAST;
+               END;
+               INCLUDE option value=f.id content=f.name selected=sel;
+               INCLUDE next_level parent_ou = f.id;
        END;
 END;
 
@@ -63,7 +68,14 @@ BLOCK next_level;
                        x = x - 1;
                END;
 
-               INCLUDE option value=f.id content=f.name content=val _ f.name id='mh_' _ f.id;
+               selected = '';
+               FOR v = current_value;
+                       IF v == f.id;
+                               selected = 'selected';
+                               LAST;
+                       END;
+               END;
+               INCLUDE option value=f.id content=val _ f.name id='mh_' _ f.id;
                INCLUDE next_level parent_ou = f.id;
        END;
 END;
index a4d5f15..8dc510c 100644 (file)
@@ -4,8 +4,12 @@ PROCESS inputs;
 
 WRAPPER select name=input_prefix;
        count = 1;
+       def = 1;
+       IF current_value;
+               def = current_value;
+       END;
        WHILE count < 366;
-               INCLUDE option value=count;
+               INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
index 1a3384f..cc48031 100644 (file)
@@ -4,8 +4,11 @@ PROCESS inputs;
 
 WRAPPER select name=input_prefix;
        count = 1;
+        IF current_value;
+                def = current_value;
+        END;
        WHILE count < 37;
-               INCLUDE option value=count;
+                INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
index 5aea847..04efe7d 100644 (file)
@@ -4,8 +4,11 @@ PROCESS inputs;
 
 WRAPPER select name=input_prefix;
        count = 1;
+        IF current_value;
+                def = current_value;
+        END;
        WHILE count < 53;
-               INCLUDE option value=count;
+                INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
index 1b47134..d60ff1b 100644 (file)
@@ -4,8 +4,11 @@ PROCESS inputs;
 
 WRAPPER select name=input_prefix;
        count = 1;
+        IF current_value;
+                def = current_value;
+        END;
        WHILE count < 37;
-               INCLUDE option value=count;
+                INCLUDE option value=count selected=(count == def ? 1 : 0);
                count = count + 1;
        END;
 END;
index 7ca6382..17d017d 100644 (file)
@@ -12,15 +12,19 @@ WRAPPER html/table ;
                INCLUDE html/cell content='Day';
        END;
 
+       y = (current_value.year ? current_value.year : start.year);
+       m = (current_value.month ? current_value.month : start.month);
+       d = (current_value.day ? current_value.day : start.day);
+
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':year' size=4 value=start.year;
+                       INCLUDE text name=input_prefix _ ':year' size=4 value=y;
                END;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':month' size=4 value=start.month;
+                       INCLUDE text name=input_prefix _ ':month' size=4 value=m;
                END;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':day' size=4 value=start.day;
+                       INCLUDE text name=input_prefix _ ':day' size=4 value=d;
                END;
        END;
 
index 65f2dd9..408da28 100644 (file)
@@ -15,10 +15,20 @@ WRAPPER html/table ;
 
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':start-year' size=4 value=start.year;
+                       v = start.year;
+                       f = 'start-year';
+                       IF current_value.$f;
+                               v = current_value.$f;
+                       END;
+                       INCLUDE text name=input_prefix _ ':start-year' size=4 value=v;
                END;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':start-month' size=4 value=start.month;
+                       v = start.month;
+                       f = 'start-month';
+                       IF current_value.$f;
+                               v = current_value.$f;
+                       END;
+                       INCLUDE text name=input_prefix _ ':start-month' size=4 value=v;
                END;
        END;
 
index 0d02bd8..40264db 100644 (file)
@@ -16,12 +16,22 @@ WRAPPER html/table ;
                INCLUDE html/cell content='Month';
        END;
 
+       syl = 'start-year';
+       sml = 'start-month';
+       eyl = 'end-year';
+       eml = 'end-month';
+
+       sy = (current_value.$syl ? current_value.$syl : start.year);
+       sm = (current_value.$sml ? current_value.$sml : start.month);
+       ey = (current_value.$eyl ? current_value.$eyl : end.year);
+       em = (current_value.$eml ? current_value.$eml : end.month);
+
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':start-year' size=4 value=start.year;
+                       INCLUDE text name=input_prefix _ ':start-year' size=4 value=sy;
                END;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':start-month' size=4 value=start.month;
+                       INCLUDE text name=input_prefix _ ':start-month' size=4 value=sm;
                END;
        END;
 
@@ -36,10 +46,10 @@ WRAPPER html/table ;
 
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':end-year' size=4 value=end.year;
+                       INCLUDE text name=input_prefix _ ':end-year' size=4 value=ey;
                END;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':end-month' size=4 value=end.month;
+                       INCLUDE text name=input_prefix _ ':end-month' size=4 value=em;
                END;
        END;
 END;
index 68ac827..642a127 100644 (file)
@@ -10,7 +10,7 @@ WRAPPER html/table;
        WRAPPER html/row;
                WRAPPER html/cell;
                        'Year: ';
-                       INCLUDE name=input_prefix _ ':year' text size=4 value=start.year;
+                       INCLUDE name=input_prefix _ ':year' text size=4 value=(current_value.year ? current_value.year : start.year);
                END;
        END;
 
@@ -20,6 +20,10 @@ WRAPPER html/table;
                        WRAPPER select name=input_prefix _ ':start';
                                count = 1;
                                WHILE count < 53;
+                                       selected = 0;
+                                       IF count == current_value.start;
+                                               selected = 1;
+                                       END;
                                        INCLUDE option value=count;
                                        count = count + 1;
                                END;
@@ -33,6 +37,10 @@ WRAPPER html/table;
                        WRAPPER select name=input_prefix _ ':end';
                                count = 1;
                                WHILE count < 53;
+                                       selected = 0;
+                                       IF count == current_value.end;
+                                               selected = 1;
+                                       END;
                                        INCLUDE option value=count;
                                        count = count + 1;
                                END;
index 744a678..c845134 100644 (file)
@@ -13,11 +13,12 @@ WRAPPER html/table ;
 
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix _ ':year' size=4 value=start.year;
+                       INCLUDE text name=input_prefix _ ':year' size=4 value=(current_value.year ? current_value.year : start.year);
                END;
                WRAPPER html/cell;
                        'For ';
-                       INCLUDE text name=input_prefix _ ':year-count' value=2;
+                       ycl = 'year-count';
+                       INCLUDE text name=input_prefix _ ':year-count' value=(current_value.$ycl ? current_value.$ycl : 2);
                        ' years';
                END;
        END;
index a6f7086..ec75376 100644 (file)
@@ -13,6 +13,10 @@ INCLUDE name=input_prefix _ ':year' text size=4 value=start.year;
 WRAPPER select name=input_prefix _ ':week';
        count = 1;
        WHILE count < 54;
+               selected = 0;
+               IF count == current_value.week;
+                       selected = 1;
+               END;
                INCLUDE option value=count;
                count = count + 1;
        END;
index a7746e4..34bd338 100644 (file)
@@ -13,7 +13,7 @@ WRAPPER html/table ;
 
        WRAPPER html/row;
                WRAPPER html/cell;
-                       INCLUDE text name=input_prefix size=4 value=start.year;
+                       INCLUDE text name=input_prefix size=4 value=(current_value ? current_value : start.year);
                END;
        END;
 
index 8619b4b..d7d923c 100644 (file)
@@ -10,6 +10,10 @@ WRAPPER select name=input_prefix;
        INCLUDE option value='' content='Select One';
        INCLUDE option value='' content='----------';
        FOR f = DBI.query(q);
+               selected == 0;
+               IF f.$fieldname == current_value;
+                       selected = 1;
+               END;
                INCLUDE option value=f.$fieldname;
        END;
 END;
index f51b6a1..158962d 100644 (file)
@@ -8,6 +8,13 @@ q = 'SELECT DISTINCT ' _ fieldname _ ' FROM ' _ table.findvalue('tablename') _ '
 
 WRAPPER select name=input_prefix multi=1 size=10;
        FOR f = DBI.query(q);
+               selected = 0;
+               FOR v = current_value;
+                       IF v == f.$fieldname;
+                               selected = 1;
+                               LAST;
+                       END;
+               END;
                INCLUDE option value=f.$fieldname;
        END;
 END;
index 23a56dc..1dae31a 100644 (file)
@@ -1,4 +1,4 @@
 [%
 PROCESS inputs;
-INCLUDE text name=input_prefix size=20;
+INCLUDE text name=input_prefix size=20 value=current_value;
 %]