[open-ils-commits] r211 - in servres/trunk/conifer: syrup templates (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Mar 22 21:06:11 EDT 2009


Author: gfawcett
Date: 2009-03-22 21:06:10 -0400 (Sun, 22 Mar 2009)
New Revision: 211

Modified:
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/graham_z3950_test.xhtml
Log:
added search-form (@prefix-style query) to /syrup/graham_z3950_test/


Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-03-23 01:06:07 UTC (rev 210)
+++ servres/trunk/conifer/syrup/views.py	2009-03-23 01:06:10 UTC (rev 211)
@@ -244,18 +244,20 @@
     return g.render('z3950_test.xhtml', res_str=res_str)
 
 def graham_z3950_test(request):
+    query = request.GET.get('query', '@and "Denis" "Gravel"')
     from conifer.libsystems.z3950 import yaz_search
     from conifer.libsystems.evergreen.item_status import lookup_availability
-    host, db, query = ('dwarf.cs.uoguelph.ca:2210', 'conifer', '@and "Denis" "Gravel"')
+    host, db, query = ('dwarf.cs.uoguelph.ca:2210', 'conifer', query)
     #host, db, query = ('z3950.loc.gov:7090', 'VOYAGER', '@attr 1=4 @attr 4=1 "dylan"')
     results = yaz_search.search(host, db, query)
     for result in results:
         bibid = result.get('901c')
         if bibid:
-            avail = lookup_availability(bibid)
+            # it would be better to do these asynchronously.
+            avail = lookup_availability(bibid) 
             if avail:
                 result['avail'] = avail
-    return g.render('graham_z3950_test.xhtml', results=results)
+    return g.render('graham_z3950_test.xhtml', results=results, query=query)
 
 def browse(request, browse_option=''):
     #the defaults should be moved into a config file or something...

Modified: servres/trunk/conifer/templates/graham_z3950_test.xhtml
===================================================================
--- servres/trunk/conifer/templates/graham_z3950_test.xhtml	2009-03-23 01:06:07 UTC (rev 210)
+++ servres/trunk/conifer/templates/graham_z3950_test.xhtml	2009-03-23 01:06:10 UTC (rev 211)
@@ -21,6 +21,10 @@
 </head>
 <body>
     <h1>${title}</h1>
+    <form method="GET" action=".">
+      <input type="text" name="query" value="${query}" style="font-size: larger;"/>
+      <input type="submit" value="Search"/>
+    </form>
     <p><a href="javascript:$('.lesser').show(); void(0);">show more detail</a></p>
     <table py:for="res in results" style="margin: 1em 0; border: black 1px solid;">
       <?python 



More information about the open-ils-commits mailing list