diff zpt/HTML_list_tables.zpt @ 4:e3ee1f358fe6

new version that doesn't use ZSQLExtend but the database connection more directly. new templates to go with that (returned data structures are different)
author casties
date Mon, 07 Jun 2010 14:02:17 +0000
parents 61a3764cd5fb
children
line wrap: on
line diff
--- a/zpt/HTML_list_tables.zpt	Wed Jun 02 15:44:03 2010 +0000
+++ b/zpt/HTML_list_tables.zpt	Mon Jun 07 14:02:17 2010 +0000
@@ -1,19 +1,19 @@
-<html tal:define="format python:request.get('format','table')">
+<html tal:define="format python:request.get('format','table'); element_id python:request.get('element_id',None)">
   <head>
+    <meta http-equiv="content-type" content="text/html;charset=utf-8">
     <title tal:content="template/title">The title</title>
-    <meta http-equiv="content-type" content="text/html;charset=utf-8">
   </head>
   <body>
     <h2>List of tables for schema <span tal:replace="options/schema"/></h2>
     <tal:block tal:condition="python:format=='select'">
-    <select id="tables">
-      <option tal:repeat="tbl options/data" tal:content="tbl/relname"/>
+    <select tal:attributes="id element_id">
+      <option tal:repeat="tbl options/data/rows" tal:content="python:tbl[0]"/>
     </select>
     </tal:block>
     <tal:block tal:condition="python:format=='table'">
-    <table id="tables">
-      <tr tal:repeat="tbl options/data">
-	<td><a tal:attributes="href tbl/relname" tal:content="tbl/relname"/></td>
+    <table tal:attributes="id element_id">
+      <tr tal:repeat="row options/data/rows">
+        <td><a tal:define="tbl python:row[0]" tal:attributes="href tbl" tal:content="tbl"/></td>
       </tr>
     </table>
     </tal:block>