summaryrefslogtreecommitdiff
path: root/tko/save_query.cgi
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-06-06 17:42:09 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2008-06-06 17:42:09 +0000
commit3b306a7a17e379c208d9e5a5a29e5885072250ef (patch)
tree92843c9fbd469c679f210033aa4c02bf40daab22 /tko/save_query.cgi
parente53eb53f6d521d00105e5d14212345bf88c1f378 (diff)
Improvements of query history:
a) User shall be able to delete query from the history b) Link "Back to Autotest" on query history page c) Display history starting with the most recent queries Signed-off-by: Vladimir Samarskiy <vsamarsk@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1650 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/save_query.cgi')
-rw-r--r--tko/save_query.cgi37
1 files changed, 27 insertions, 10 deletions
diff --git a/tko/save_query.cgi b/tko/save_query.cgi
index c3485da6..80c91fc2 100644
--- a/tko/save_query.cgi
+++ b/tko/save_query.cgi
@@ -36,18 +36,35 @@ def log_query():
raise QueryHistoryError("Could not save query")
+def delete_query(time_stamp):
+ ## query is marked for delete by time stamp
+ db_obj = db.db()
+ data_to_delete = {'time_created':time_stamp}
+ try:
+ db_obj.delete('query_history', data_to_delete)
+ except Exception:
+ raise QueryHistoryError("Could not delete query")
+
+
def body():
- log_query()
- print '<b>%s</b><br><br>' % "Your query has been saved"
- print 'time: %s<br>' % tm
- print 'comments: %s<br><br>' % comment
- print '<table><tr align="center">'
- print '<td align="center">'
+ if not 'delete' in dict_url.keys():
+ log_query()
+ print '<b>%s</b><br><br>' % "Your query has been saved"
+ print 'time: %s<br>' % tm
+ print 'comments: %s<br><br>' % comment
+ else:
+ ## key 'delete' has arg value of time_stamp
+ ## which identifies the query to be deleted
+ time_stamp = dict_url['delete']
+ delete_query(time_stamp)
+ print '<b>%s</b><br><br>' % "Your query has been deleted"
+
print '<a href="query_history.cgi">View saved queries</a>&nbsp;&nbsp;'
- print '</td>'
- print '<td align="center">'
- print '<a href="%s">Back to Autotest</a><br>' % HTTP_REFERER
- print '</td>'
+ print '<br><br>'
+ if not 'delete' in dict_url.keys():
+ print '<a href="%s">Back to Autotest</a><br>' % HTTP_REFERER
+ else:
+ print '<a href="compose_query.cgi">Autotest Results</a><br>'
def main():