From 0b6e1dfe9536a216f770a0447714c6d4c3342f6a Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 27 Dec 2005 22:44:34 +0000 Subject: [PATCH] reports can now be rescheduled and disabled git-svn-id: svn://svn.open-ils.org/ILS/trunk@2540 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/clark-kent.pl | 1 + Open-ILS/src/reporter/config.sql | 2 + Open-ILS/src/reporter/templates/dashboard.ttk | 8 +++- Open-ILS/src/reporter/templates/stage3.ttk | 44 ++++++++++++++++++- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 77bf3b480c..fb55b11696 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -61,6 +61,7 @@ INSERT INTO reporter.output ( stage3, state ) SELECT id, 'wait' FROM reporter.stage3 WHERE runtime <= $1 + AND NOT disable AND ( ( recurrence = '0 seconds'::INTERVAL AND ( id NOT IN ( SELECT stage3 FROM reporter.output ) diff --git a/Open-ILS/src/reporter/config.sql b/Open-ILS/src/reporter/config.sql index 373cb8fc72..dabff185ca 100644 --- a/Open-ILS/src/reporter/config.sql +++ b/Open-ILS/src/reporter/config.sql @@ -52,6 +52,8 @@ CREATE TABLE reporter.stage3 ( initially deferred, params text not null, owner int not null, + disable bool not null + default false, pub bool not null default false, create_date timestamp with time zone not null diff --git a/Open-ILS/src/reporter/templates/dashboard.ttk b/Open-ILS/src/reporter/templates/dashboard.ttk index 9c0a02b86d..6cc2233653 100644 --- a/Open-ILS/src/reporter/templates/dashboard.ttk +++ b/Open-ILS/src/reporter/templates/dashboard.ttk @@ -183,12 +183,18 @@ BLOCK show_reports; WRAPPER html/row; p = utils.JSON2perl( report.params ); + + rtime = report.runtime.chunk(19).0; + IF report.disable; + rtime = rtime _ '
(Disabled)'; + END; + INCLUDE html/cell content=(report.pub ? 'Y' : 'N') col=bg style='border:solid gray 1px;' align='center'; INCLUDE html/cell content=link(content=p.reportname,href="stage3?id=$rid") col=bg style='border:solid gray 1px;'; INCLUDE html/cell nowrap='nowrap' content=report.create_date.chunk(19).0 col=bg style='border:solid gray 1px;'; INCLUDE html/cell nowrap='nowrap' - content=report.runtime.chunk(19).0 + content=rtime col=bg style='border:solid gray 1px;'; INCLUDE html/cell content=run_count.get.count col=bg style='border:solid gray 1px;'; diff --git a/Open-ILS/src/reporter/templates/stage3.ttk b/Open-ILS/src/reporter/templates/stage3.ttk index f9193ac407..26d9f5785d 100644 --- a/Open-ILS/src/reporter/templates/stage3.ttk +++ b/Open-ILS/src/reporter/templates/stage3.ttk @@ -37,6 +37,12 @@ WRAPPER html/html; WRAPPER html/body; IF CGI.param('action') == 'Schedule'; PROCESS schedule_stage3; + ELSIF CGI.param('action') == 'enable_stage3'; + PROCESS enable; + ELSIF CGI.param('action') == 'disable_stage3'; + PROCESS disable; + ELSIF CGI.param('action') == 'Reschedule'; + PROCESS resched; ELSIF CGI.param('action') == 'Save'; PROCESS save_stage3; ELSIF CGI.param('action') == 'delete_stage3'; @@ -212,6 +218,24 @@ BLOCK delete_output; INCLUDE view_stage3; END; +BLOCK enable; + q = DBI.prepare( 'UPDATE reporter.stage3 SET disable = FALSE WHERE id = ?' ); + CALL q.execute(CGI.param('id')); + INCLUDE view_stage3; +END; + +BLOCK disable; + q = DBI.prepare( 'UPDATE reporter.stage3 SET disable = TRUE WHERE id = ?' ); + CALL q.execute(CGI.param('id')); + INCLUDE view_stage3; +END; + +BLOCK resched; + q = DBI.prepare( 'UPDATE reporter.stage3 SET runtime = ? WHERE id = ?' ); + CALL q.execute(CGI.param('newtime'), CGI.param('id')); + INCLUDE view_stage3; +END; + BLOCK rerun; q = DBI.prepare( 'UPDATE reporter.stage3 SET rerun = TRUE WHERE id = ?' ); CALL q.execute(rpt.id); @@ -236,11 +260,21 @@ BLOCK view_stage3; END; WRAPPER html/row; INCLUDE html/cell content="Creation Time" style="border:solid gray 1px;"; - INCLUDE html/cell content=rpt.create_date style="border:solid gray 1px;"; + INCLUDE html/cell content=rpt.create_date.chunk(19).0 style="border:solid gray 1px;"; END; WRAPPER html/row; INCLUDE html/cell content="Scheduled Run Time" style="border:solid gray 1px;"; - INCLUDE html/cell content=rpt.runtime style="border:solid gray 1px;"; + IF user.id == rpt.owner; + WRAPPER html/cell style="border:solid gray 1px;"; + WRAPPER form method="post"; + INCLUDE hidden name="id" value=rpt.id; + INCLUDE text name="newtime" value=rpt.runtime.chunk(19).0; + INCLUDE submit name="action" value="Reschedule"; + END; + END; + ELSE; + INCLUDE html/cell content=rpt.runtime style="border:solid gray 1px;"; + END; END; WRAPPER html/row; INCLUDE html/cell content="Recurrence Interval" style="border:solid gray 1px;"; @@ -254,6 +288,12 @@ BLOCK view_stage3; IF user.id == rpt.owner; INCLUDE anchor content='Run again' href=CGI.url('-path', 1) _ '?action=rerun&id=' _ rpt.id; '   '; + IF rpt.disable; + INCLUDE anchor content='Enable' href=CGI.url('-path', 1) _ '?action=enable_stage3&id=' _ rpt.id; + ELSE; + INCLUDE anchor content='Disable' href=CGI.url('-path', 1) _ '?action=disable_stage3&id=' _ rpt.id; + END; + '   '; INCLUDE anchor content='Delete' href=CGI.url('-path', 1) _ '?action=delete_stage3&id=' _ rpt.id; '   '; END; -- 2.43.2