Save query on request.

     a) Add to TKO UI a form containing button [SaveQuery] and edit control for 
optional comments
     b) On saveQuery request TKO make sure that user's cookies contain a unique 
user's id
     c) ... and then write into table query_history in TKO: time stamp, comment,
 uid, url of the query
     d) Make sure user can read saved queries back ( can read only own queries )
compose_query.cgi - added a form that supports user's request to save current qu
ery
save_query.cgi - saves the query
query_history.cgi - shows saved queries by this user
unique_cookie.py - common cookie related function: set/get user's unique id
006_add_table_query_history.py - database migration. New table introduced for qu
ery history.

Signed-off-by: Vladimir Samarskiy <vsamarsk@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1523 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/compose_query.cgi b/tko/compose_query.cgi
index 5fef8b8..c5a29cb 100755
--- a/tko/compose_query.cgi
+++ b/tko/compose_query.cgi
@@ -47,6 +47,19 @@
 </tr>
 </table>
 </form>
+<form action="save_query.cgi" method="get">
+<table border="0">
+<tr>
+ <td>Name your query:&nbsp;&nbsp;</td>
+  <td>
+    <input type="text" name="label" size="15" value="">
+  </td>
+  <td align="center">&nbsp;<input type="submit" value="Save Query">
+  </td>
+ <td>&nbsp;&nbsp;<a href="query_history.cgi">View saved queries</a></td>
+</tr>
+</table>
+</form>
 """
 
 
@@ -210,7 +223,8 @@
 		key = base + ' p%d' % (idx)
 		if not map.has_key(key):
 			map[key] = map_kernel_base(base) + ' p%d' % (idx)
-		map[key] += '<br>+<span title="' + name + '">' + name[0:25] + '</span>'
+		map[key] += ('<br>+<span title="' + name + '">' +
+			     name[0:25] + '</span>')
 
 	return map
 
@@ -309,7 +323,7 @@
 				box_data = test_data.data[x][y]
 			except:
 				cur_row.append(display.box(None, None, 
-							row_label=y, column_label=x))
+					       row_label=y, column_label=x))
 				continue
 			job_tag = test_data.data[x][y].job_tag
 			if job_tag:
@@ -317,9 +331,9 @@
 			else:
 				link = construct_link(x, y)
 
-			cur_row.append(display.status_precounted_box(db_obj,
-			                                             box_data,
-			                                             link, y, x))
+			apnd = display.status_precounted_box(db_obj, box_data,
+							     link, y, x)
+			cur_row.append(apnd)
 		matrix.append(cur_row)
 	return matrix
 
@@ -339,8 +353,10 @@
 	display.print_table(gen_matrix())
 	print display.color_keys_row()
 	total_wall_time = time.time() - total_wall_time_start
-	print '<p style="font-size:x-small;">sql access wall time = %s secs, \
-		 total wall time = %s secs</p>' % (sql_wall_time, total_wall_time)
+	perf_info = '<p style="font-size:x-small;">'
+	perf_info += 'sql access wall time = %s secs,' % sql_wall_time
+	perf_info += 'total wall time = %s secs</p>' % total_wall_time
+	print perf_info
 	print '</body></html>'
 
 main()