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

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 12 20:35:42 EST 2010


Author: gfawcett
Date: 2010-11-12 20:35:41 -0500 (Fri, 12 Nov 2010)
New Revision: 1064

Modified:
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/templates/item/item_metadata.xhtml
Log:
force ELEC document links to go to Meta page, not directly to download.

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2010-11-12 04:32:46 UTC (rev 1063)
+++ servres/trunk/conifer/syrup/models.py	2010-11-13 01:35:41 UTC (rev 1064)
@@ -598,18 +598,22 @@
 
     def needs_meta_link(self):
         """Should an 'About' link be displayed for this item?"""
-        return self.item_type in ('ELEC', 'URL')
+        return self.item_type in ('URL',)
 
-    def item_url(self, suffix='', force_local_url=False):
-        # I'm not fond of this being here. I think I'll leave this and
-        # site_url non-implemented, and monkey-patch them in views.py.
-        req = get_request()
-        prefix = req.META['SCRIPT_NAME']
-        if self.item_type == 'ELEC' and suffix == '':
+    def item_download_url(self):
+        if self.item_type != 'ELEC':
+            return None
+        else:
+            req = get_request()
+            prefix = req.META['SCRIPT_NAME']
             return '%s/site/%d/item/%d/dl/%s' % (
                 prefix, self.site_id, self.id,
                 self.fileobj.name.split('/')[-1])
-        if self.item_type == 'URL' and suffix == '' and not force_local_url:
+            
+    def item_url(self, suffix=''):
+        req = get_request()
+        prefix = req.META['SCRIPT_NAME']
+        if self.item_type == 'URL' and suffix == '':
             return self.url
         else:
             return '%s/site/%d/item/%d/%s' % (

Modified: servres/trunk/conifer/templates/item/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_metadata.xhtml	2010-11-12 04:32:46 UTC (rev 1063)
+++ servres/trunk/conifer/templates/item/item_metadata.xhtml	2010-11-13 01:35:41 UTC (rev 1064)
@@ -48,7 +48,7 @@
       <table class="metadata_table">
 	<tr><th>Content type</th><td>${item.fileobj_mimetype}</td></tr>
 	<tr><th>Size</th><td>${item.fileobj.size} bytes</td></tr>
-	<tr><th/><td><a class="bigdownload" href="${item.item_url()}">Download</a></td></tr>
+	<tr><th/><td><a class="bigdownload" href="${item.item_download_url()}">Download</a></td></tr>
       </table>
     </div>
     <div py:if="item.marcxml">



More information about the open-ils-commits mailing list