[open-ils-commits] r300 - in servres/trunk/conifer: . templates templates/feeds (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 7 21:43:43 EDT 2009


Author: gfawcett
Date: 2009-04-07 21:43:41 -0400 (Tue, 07 Apr 2009)
New Revision: 300

Modified:
   servres/trunk/conifer/genshi_support.py
   servres/trunk/conifer/settings.py
   servres/trunk/conifer/templates/browse_index.xhtml
   servres/trunk/conifer/templates/course_detail.xhtml
   servres/trunk/conifer/templates/edit_course.xhtml
   servres/trunk/conifer/templates/edit_course_permissions.xhtml
   servres/trunk/conifer/templates/feeds/course_feed_index.xhtml
   servres/trunk/conifer/templates/item_heading_detail.xhtml
   servres/trunk/conifer/templates/item_relocate.xhtml
   servres/trunk/conifer/templates/master.xhtml
   servres/trunk/conifer/templates/prefs.xhtml
   servres/trunk/conifer/templates/tabbar.xhtml
   servres/trunk/conifer/templates/tabbar_anonymous.xhtml
Log:
fixed more absolute-root problems. Introduced ROOT global Genshi variable.

ROOT can be used in templates: it has the value of the CGI variable
SCRIPT_NAME, so we can use it to determine what the root-prefix of the
app is.

Modified: servres/trunk/conifer/genshi_support.py
===================================================================
--- servres/trunk/conifer/genshi_support.py	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/genshi_support.py	2009-04-08 01:43:41 UTC (rev 300)
@@ -37,6 +37,7 @@
 def _inject_django_things_into_namespace(request, ns):
     ns['_'] = _
     ns['request'] = request
+    ns['ROOT']    = request.META['SCRIPT_NAME']
     ns['user'] = getattr(request, 'user', None)
     ns.update(genshi_namespace.__dict__)
 

Modified: servres/trunk/conifer/settings.py
===================================================================
--- servres/trunk/conifer/settings.py	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/settings.py	2009-04-08 01:43:41 UTC (rev 300)
@@ -5,6 +5,8 @@
 
 import os
 
+os.environ['PYTHON_EGG_CACHE'] = '/tmp/eggs'
+
 BASE_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
 HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
 

Modified: servres/trunk/conifer/templates/browse_index.xhtml
===================================================================
--- servres/trunk/conifer/templates/browse_index.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/browse_index.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -11,7 +11,7 @@
 <body>
   <h1>${title}</h1> 
   (Note: some course materials may require you
-    to <a href="/syrup/accounts/login/?next=/syrup/">log in</a>)
+    to <a href="${ROOT}/accounts/login/?next=${ROOT}/">log in</a>)
     <h2>Choose from one of the options below:</h2>
     <ul>
         <li><a href="courses">Browse by Course Name</a></li>

Modified: servres/trunk/conifer/templates/course_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/course_detail.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/course_detail.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -10,7 +10,7 @@
   <xi:include href="components/course.xhtml"/>
   <head>
     <title>${title}</title>
-    <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+    <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
   </head>
   <body>
     ${course_banner(course)}

Modified: servres/trunk/conifer/templates/edit_course.xhtml
===================================================================
--- servres/trunk/conifer/templates/edit_course.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/edit_course.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -11,7 +11,7 @@
 <xi:include href="components/course.xhtml"/>
 <head>
   <title>${title}</title>
-  <script type="text/javascript" src="/syrup/static/edit_course.js"/>
+  <script type="text/javascript" src="${ROOT}/static/edit_course.js"/>
 </head>
 <body>
   <div py:if="instance.id">${course_banner(instance)}</div>

Modified: servres/trunk/conifer/templates/edit_course_permissions.xhtml
===================================================================
--- servres/trunk/conifer/templates/edit_course_permissions.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/edit_course_permissions.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -9,7 +9,7 @@
   <xi:include href="components/course.xhtml"/>
 <head>
   <title>${title}</title>
-  <script type="text/javascript" src="/syrup/static/edit_course_permissions.js"/>
+  <script type="text/javascript" src="${ROOT}/static/edit_course_permissions.js"/>
 </head>
 <body>
   ${course_banner(course)}

Modified: servres/trunk/conifer/templates/feeds/course_feed_index.xhtml
===================================================================
--- servres/trunk/conifer/templates/feeds/course_feed_index.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/feeds/course_feed_index.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -8,7 +8,7 @@
   <xi:include href="../components/course.xhtml"/>
   <head>
     <title>${title}</title>
-    <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+    <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
   </head>
   <body>
     ${course_banner(course)}

Modified: servres/trunk/conifer/templates/item_heading_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_heading_detail.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/item_heading_detail.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -12,7 +12,7 @@
   <xi:include href="components/course.xhtml"/>
    <head>
     <title>${title}</title>
-    <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+    <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
   </head>
   <body>
     ${course_banner(course)}

Modified: servres/trunk/conifer/templates/item_relocate.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_relocate.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/item_relocate.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -8,7 +8,7 @@
   <xi:include href="components/course.xhtml"/>
    <head>
     <title>${title}</title>
-    <script type="text/javascript" src="/syrup/static/menublocks.js"/>
+    <script type="text/javascript" src="${ROOT}/static/menublocks.js"/>
   </head>
   <body>
     ${course_banner(course)}

Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/master.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -2,7 +2,6 @@
 app_name = _('Syrup E-Reserve System')
 search = _('search...')
 import os
-rooted = lambda url: request.META['SCRIPT_NAME'] + url
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:py="http://genshi.edgewall.org/"
@@ -12,10 +11,10 @@
     <head py:attrs="select('@*')"
 	  py:with="t=list(select('title/text()'))">
       <title>${app_name}<py:if test="t">: ${t}</py:if></title>
-    <link rel="stylesheet" type="text/css" href="${rooted('/static/main.css')}"/>
-    <script type="text/javascript" src="${rooted('/static/jquery/js/jquery-1.3.2.min.js')}"/>
-    <script type="text/javascript" src="${rooted('/static/jquery/js/jquery-ui-1.7.1.custom.min.js')}"/>
-    <script type="text/javascript" src="${rooted('/static/jquery/js/jquery.tablesorter.min.js')}"/>
+    <link rel="stylesheet" type="text/css" href="${ROOT}/static/main.css"/>
+    <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery-1.3.2.min.js"/>
+    <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery-ui-1.7.1.custom.min.js"/>
+    <script type="text/javascript" src="${ROOT}/static/jquery/js/jquery.tablesorter.min.js"/>
     ${select('*[local-name()!="title"]')}
     </head>
   </py:match>
@@ -27,7 +26,7 @@
 	  ${os.getpid()}
 	  ${app_name}
 	</div>
-	<img src="${rooted('/static/institution-logo.png')}" style="height: 50;"/>
+	<img src="${ROOT}/static/institution-logo.png" style="height: 50;"/>
       </div>
         <!--
       <div id="header" py:if="user.is_authenticated()">
@@ -35,7 +34,7 @@
         -->
       <div id="header">
         <div id="search">
-            <form method="get" action="${rooted('/search')}" 
+            <form method="get" action="${ROOT}/search" 
                 onsubmit="if(q.value.replace(/^\s*/, '').replace(/\s*$/, '') =='') return false;"
             >
             <input id="q" name="q" maxlength="100" size="25" type="text" 
@@ -45,13 +44,13 @@
         </div>
       <span py:if="user.is_authenticated()">
 	<strong style="padding-right: 18;">Welcome, ${user.first_name or user.username}!</strong>
-	<a href="${rooted('/accounts/logout')}">Log Out</a>
-	&bull; <a href="${rooted('/prefs/')}">Preferences</a>
+	<a href="${ROOT}/accounts/logout">Log Out</a>
+	&bull; <a href="${ROOT}/prefs/">Preferences</a>
       </span>
       <span py:if="not user.is_authenticated()">
 	<strong style="padding-right: 18;">Welcome!</strong>
-	<a class="loginbutton" href="${rooted('/accounts/login/')}">Log In</a>
-	&bull; <a href="${rooted('/prefs/')}">Preferences</a>
+	<a class="loginbutton" href="${ROOT}/accounts/login/">Log In</a>
+	&bull; <a href="${ROOT}/prefs/}">Preferences</a>
       </span>
     </div>
       <xi:include py:if="user.is_authenticated()" href="tabbar.xhtml"/>

Modified: servres/trunk/conifer/templates/prefs.xhtml
===================================================================
--- servres/trunk/conifer/templates/prefs.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/prefs.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -13,7 +13,7 @@
 <h1>${title}</h1>
 <h2>Preferred Language</h2>
 <form action="../i18n/setlang/" method="post">
-<input name="next" type="hidden" value="/syrup/" />
+<input name="next" type="hidden" value="${ROOT}/" />
 <select name="language">
 <option py:for="code,descr in settings.LANGUAGES"
 	value="${code}">${_(descr)}</option>

Modified: servres/trunk/conifer/templates/tabbar.xhtml
===================================================================
--- servres/trunk/conifer/templates/tabbar.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/tabbar.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -7,13 +7,13 @@
     use one for now
 -->
 <ul id="tabbar">
-  <li><a href="${rooted('/')}">Home</a></li>
-  <li><a href="${rooted('/browse/')}">Browse</a></li>
-  <li class="active"><a href="${rooted('/course/')}">My Courses</a></li>
+  <li><a href="${ROOT}/">Home</a></li>
+  <li><a href="${ROOT}/browse/">Browse</a></li>
+  <li class="active"><a href="${ROOT}/course/">My Courses</a></li>
   <div py:strip="True"
        py:if="request.user.is_staff">
-    <li><a href="${rooted('/admin/')}">Admin Options</a></li>
-    <li><a href="${rooted('/phys/')}">Physical Items</a></li>
+    <li><a href="${ROOT}/admin/">Admin Options</a></li>
+    <li><a href="${ROOT}/phys/">Physical Items</a></li>
   </div>
 </ul>
 </html>

Modified: servres/trunk/conifer/templates/tabbar_anonymous.xhtml
===================================================================
--- servres/trunk/conifer/templates/tabbar_anonymous.xhtml	2009-04-07 03:36:04 UTC (rev 299)
+++ servres/trunk/conifer/templates/tabbar_anonymous.xhtml	2009-04-08 01:43:41 UTC (rev 300)
@@ -7,7 +7,7 @@
     use one for now
 -->
 <ul id="tabbar">
-  <li><a href="/syrup/">Home</a></li>
-  <li><a href="/syrup/browse/">Browse</a></li>
+  <li><a href="${ROOT}/">Home</a></li>
+  <li><a href="${ROOT}/browse/">Browse</a></li>
 </ul>
 </html>



More information about the open-ils-commits mailing list