[open-ils-commits] r913 - in servres/trunk/conifer: . static syrup syrup/views templates templates/components templates/item (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 14 20:54:48 EDT 2010


Author: gfawcett
Date: 2010-07-14 20:54:47 -0400 (Wed, 14 Jul 2010)
New Revision: 913

Modified:
   servres/trunk/conifer/genshi_namespace.py
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/syrup/views/_common.py
   servres/trunk/conifer/syrup/views/items.py
   servres/trunk/conifer/syrup/views/sites.py
   servres/trunk/conifer/templates/browse_index.xhtml
   servres/trunk/conifer/templates/components/site.xhtml
   servres/trunk/conifer/templates/edit_site_permissions.xhtml
   servres/trunk/conifer/templates/item/item_add_elec.xhtml
   servres/trunk/conifer/templates/item/item_add_heading.xhtml
   servres/trunk/conifer/templates/item/item_add_phys.xhtml
   servres/trunk/conifer/templates/item/item_add_url.xhtml
   servres/trunk/conifer/templates/item/item_delete_confirm.xhtml
   servres/trunk/conifer/templates/item/item_heading_detail.xhtml
   servres/trunk/conifer/templates/item/item_metadata.xhtml
   servres/trunk/conifer/templates/site_detail.xhtml
Log:
Create site, view site, add items to site mostly working again

The 'about/metadata' item links are not working yet. I need to
refactor the add-item forms quite a bit, esp. wrt. consistent metadata
entry.

The site-permissions screen is still a farce, and needs to be
rewritten to address the new membership-group model.

Modified: servres/trunk/conifer/genshi_namespace.py
===================================================================
--- servres/trunk/conifer/genshi_namespace.py	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/genshi_namespace.py	2010-07-15 00:54:47 UTC (rev 913)
@@ -3,6 +3,7 @@
 # Toplevel definitions in this module will be available in when
 # rendering a Genshi template.
 
+import itertools
 from itertools import cycle
 from conifer.syrup import models
 import django.forms

Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/static/main.css	2010-07-15 00:54:47 UTC (rev 913)
@@ -16,6 +16,9 @@
 	font-family: inherit;
 	vertical-align: baseline;
 }
+
+li { margin-left: 16px; }
+
 /* remember to define focus styles! */
 :focus {
 	outline: 0;
@@ -25,9 +28,7 @@
 	color: black;
 	background: white;
 }
-ol, ul {
-	list-style: none;
-}
+
 /* tables still need 'cellspacing="0"' in the markup */
 table {
 	border-collapse: separate;
@@ -73,6 +74,7 @@
     background-color: #448;
 }
 
+
 #header div#search {
     float: right;
     margin: 0;
@@ -92,12 +94,12 @@
 tbody td, tbody th { vertical-align: top; }
 
 #footer {  
-    margin: 12px;
-    padding-bottom: 12px;
-    background-color: #ddf; 
-    color: black;
-    border-bottom: white 10px solid;
+    margin: 0;
+    padding-top: 16px;
+    color: #eee;
+    font-size: small;
 }
+#footer a { color: white; text-decoration: underline; }
 
 /* heading sizes and colours. */
 
@@ -122,7 +124,7 @@
 .action a { font-weight: bold; }
 
 #tabbar { margin: 18px 0; padding: 0; clear: both; }
-#tabbar li { display: inline; }
+#tabbar li { display: inline; margin: 0; }
 #tabbar li a { padding: 15px 18px 5px 18px; background-color: #ddf; color: black; text-decoration: none; }
 #tabbar li a:hover { background-color: #fc8; }
 
@@ -157,7 +159,7 @@
 #sidepanel { width: 183px; float: right; text-align: right;}
 #sidepanel div { margin: 6px 0; }
 
-#treepanel { width: 740px; }
+#treepanel { width: 740px; margin-top: 24px; }
 
 .helptext { 
     margin-top: 30px; font-size: 90%;
@@ -205,6 +207,7 @@
 
 .itemtree li.item_HEADING { 
     list-style-image: url(tango/folder.png);
+    margin-top: 24px;
 }
 .itemtree li.item_HEADING > a { 
     color: navy; 
@@ -215,7 +218,7 @@
 }
 
 li.item_HEADING .headingmainline  a.mainlink {
-    border-bottom: #aaa 1px solid; 
+    font-size: large; color: navy;
 }
 
 li.item_HEADING  .headingmainline a.mainlink:hover {

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/syrup/models.py	2010-07-15 00:54:47 UTC (rev 913)
@@ -167,7 +167,10 @@
         unique_together = (('course', 'term', 'owner'))
 
     def __unicode__(self):
-        return u'%s %s %s' % (self.course, self.term, self.owner)
+        return u'%s: %s (%s, %s)' % (
+            self.course.code, self.course.name,
+            self.owner.last_name or self.owner.username,
+            self.term)
 
     def list_display(self):
         if self.code:
@@ -200,7 +203,8 @@
         for item in items:
             dct.setdefault(item.parent_heading, []).append(item)
         for lst in dct.values():
-            lst.sort(key=lambda item: item.sort_order) # sort in place
+            # TODO: what's the sort order?
+            lst.sort(key=lambda item: (item.item_type=='HEADING', item.title)) # sort in place
         # walk the tree
         out = []
         def walk(parent, accum):
@@ -239,11 +243,11 @@
         return Membership.objects.filter(group__site=self)
 
     def get_students(self):
-        return self.memberships(role='STUDT').order_by(
+        return self.members().filter(role='STUDT').order_by(
             'user__last_name', 'user__first_name')
 
     def get_instructors(self):
-        return self.memberships(role='INSTR').order_by(
+        return self.members().filter(role='INSTR').order_by(
             'user__last_name', 'user__first_name')
 
     def can_edit(self, user):
@@ -252,7 +256,7 @@
         if user.id == self.owner_id:
             return True
         try:
-            mbr = self.members.get(user=user)
+            mbr = self.members().get(user=user)
         except Member.DoesNotExist:
             return False
         return mbr.role in (u'INSTR', u'ASSIST')
@@ -268,7 +272,7 @@
     def is_member(self, user):
         assert user
         return user.id == self.owner_id \
-            or self.members.filter(user=user).exists()
+            or self.members().filter(user=user).exists()
 
 #------------------------------------------------------------
 # User membership in sites

Modified: servres/trunk/conifer/syrup/views/_common.py
===================================================================
--- servres/trunk/conifer/syrup/views/_common.py	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/syrup/views/_common.py	2010-07-15 00:54:47 UTC (rev 913)
@@ -113,6 +113,7 @@
     # I use a raw SQL query here because I want the lookup to be as
     # fast as possible. Caching would help too, but let's try this
     # first. (todo, review later.)
+    return True               #  TODO: fixme!!!!
     query = ('select count(*) from syrup_member '
              'where user_id=%s and site_id=%s ')
     if where:

Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/syrup/views/items.py	2010-07-15 00:54:47 UTC (rev 913)
@@ -70,19 +70,12 @@
 
     if request.method != 'POST':
         item = models.Item()    # dummy object
-        metadata_formset = metadata_formset_class(queryset=item.metadata_set.all())
         return g.render('item/item_add_%s.xhtml' % item_type.lower(),
                         **locals())
     else:
         # fixme, this will need refactoring. But not yet.
         author = request.user.get_full_name() or request.user.username
         item = models.Item()    # dummy object
-        metadata_formset = metadata_formset_class(request.POST, queryset=item.metadata_set.all())
-        assert metadata_formset.is_valid()
-        def do_metadata(item):
-            for obj in [obj for obj in metadata_formset.cleaned_data if obj]: # ignore empty dicts
-                if not obj.get('DELETE'):
-                    item.metadata_set.create(name=obj['name'], value=obj['value'])
             
         if item_type == 'HEADING':
             title = request.POST.get('title', '').strip()
@@ -93,13 +86,10 @@
                 item = models.Item(
                     site=site,
                     item_type='HEADING',
-                    sort_order = next_order,
                     parent_heading=parent_item,
                     title=title,
                     )
                 item.save()
-                do_metadata(item)
-                item.save()
         elif item_type == 'URL':
             title = request.POST.get('title', '').strip()
             url = request.POST.get('url', '').strip()
@@ -111,12 +101,9 @@
                     site=site,
                     item_type='URL',
                     parent_heading=parent_item,
-                    sort_order = next_order,
                     title=title,
                     url = url)
                 item.save()
-                do_metadata(item)
-                item.save()
         elif item_type == 'ELEC':
             title = request.POST.get('title', '').strip()
             upload = request.FILES.get('file')
@@ -127,14 +114,11 @@
                 site=site,
                 item_type='ELEC',
                 parent_heading=parent_item,
-                sort_order = next_order,
                 title=title,
                 fileobj_mimetype = upload.content_type,
                 )
             item.fileobj.save(upload.name, upload)
             item.save()
-            do_metadata(item)
-            item.save()
         else:
             raise NotImplementedError
 
@@ -157,11 +141,6 @@
         site = parent_item.site
         siblings = site.item_set.filter(parent_heading=parent_item)
 
-    try:
-        next_order = 1 + max(i.sort_order for i in siblings)
-    except:
-        next_order = 0
-
     #----------
 
     if request.method != 'POST':
@@ -202,17 +181,20 @@
         else:
             dct = dict(item_type='PHYS')
 
+        try:
+            pubdate = dublin.get('dc:date')
+            pubdate = re.search('^([0-9]+)', pubdate).group(1)
+            pubdate = '%d-01-01' % int(pubdate)
+        except:
+            pubdate = None
+
         item = site.item_set.create(parent_heading=parent_item,
-                                      sort_order=next_order,
-                                      title=dublin.get('dc:title','Untitled'),
-                                      **dct)
+                                    title=dublin.get('dc:title','Untitled'),
+                                    author=dublin.get('dc:creator'),
+                                    publisher=dublin.get('dc:publisher',''),
+                                    published=pubdate,
+                                    **dct)
         item.save()
-
-        for dc, value in dublin.items():
-            md = item.metadata_set.create(item=item, name=dc, value=value)
-        # store the whole darn MARC-dict as well (JSON)
-        item.metadata_set.create(item=item, name='syrup:marc', value=raw_pickitem)
-        item.save()
         return HttpResponseRedirect('../../../%d/meta' % item.id)
 
 #------------------------------------------------------------
@@ -226,11 +208,8 @@
     parent_item = item.parent_heading
 
     if request.method != 'POST':
-        metadata_formset = metadata_formset_class(queryset=item.metadata_set.all())
         return g.render(template, **locals())
     else:
-        metadata_formset = metadata_formset_class(request.POST, queryset=item.metadata_set.all())
-        assert metadata_formset.is_valid()
         if 'file' in request.FILES:
             # this is a 'replace-current-file' action.
             upload = request.FILES.get('file')
@@ -239,11 +218,6 @@
         else:
             # generally update the item.
             [setattr(item, k, v) for (k,v) in request.POST.items()]
-            # generally update the metadata
-            item.metadata_set.all().delete()
-            for obj in [obj for obj in metadata_formset.cleaned_data if obj]: # ignore empty dicts
-                if not obj.get('DELETE'):
-                    item.metadata_set.create(name=obj['name'], value=obj['value'])
                     
         item.save()
         return HttpResponseRedirect(item.parent_url())
@@ -289,7 +263,8 @@
     # get at the ints.
     new_order = [int(n.split('_')[1]) for n in new_order]
     print >> sys.stderr, new_order
-    the_items = list(site.item_set.filter(parent_heading=parent_heading).order_by('sort_order'))
+    # TODO .orderBy, now there is no sort_order.
+    the_items = list(site.item_set.filter(parent_heading=parent_heading))
     # sort the items by position in new_order
     the_items.sort(key=lambda item: new_order.index(item.id))
     for newnum, item in enumerate(the_items):

Modified: servres/trunk/conifer/syrup/views/sites.py
===================================================================
--- servres/trunk/conifer/syrup/views/sites.py	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/syrup/views/sites.py	2010-07-15 00:54:47 UTC (rev 913)
@@ -159,7 +159,7 @@
             access = POST.get('access')
             site.access = access
             # drop all provided users. fixme, this could be optimized to do add/drops.
-            models.Membership.objects.filter(site=site, provided=True).delete()
+            #models.Membership.objects.filter(site=site, provided=True).delete()
             if site.access == u'STUDT':
                 initial_sections = site.sections()
                 # add the 'new section' if any

Modified: servres/trunk/conifer/templates/browse_index.xhtml
===================================================================
--- servres/trunk/conifer/templates/browse_index.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/browse_index.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,5 +1,8 @@
 <?python
-title = _('Browse the Reserves')
+title = _('All Reserves, by Department')
+
+sites = models.Site.objects.order_by('course__department__name', 'course__code', 'owner__last_name').select_related()
+blocks = itertools.groupby(sites, lambda s: s.course.department)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -10,8 +13,21 @@
 </head>
 <body>
   <h1>${title}</h1> 
-  (Note: some reserve materials may require you
+  <div py:if="user.is_anonymous()">
+    (Note: some reserve materials may require you
     to <a href="${ROOT}/accounts/login/?next=${ROOT}/">log in</a>)
+  </div>
+
+    
+    <div py:for="(dept, ss) in blocks">
+      <h2>${dept}</h2>
+      <p py:for="site in ss" style="margin-left: 16px;">
+	<a href="${site.site_url()}">${site}</a>
+      </p>
+
+    </div>
+
+    <div style="background-color: #dcc; margin: 16px; padding: 8px;">
     <h2>Choose from one of the options below:</h2>
     <div class="itemadd">
     <ul>
@@ -22,6 +38,7 @@
 		href="departments">Browse by Department</a></li>
     </ul>
     </div>
+    </div>
   <div class="gap"/>
 </body>
 </html>

Modified: servres/trunk/conifer/templates/components/site.xhtml
===================================================================
--- servres/trunk/conifer/templates/components/site.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/components/site.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -18,8 +18,8 @@
   <div py:def="site_banner(site)" py:strip="True">
     <div id="sitebanner">
       ${site_search(site)}
-      <div class="deptident">${site.department}</div>
-      <h1><a href="${site.site_url()}"><span py:if="site.code">${site.code}: </span>${site.title}</a></h1>
+      <div class="deptident">${site.course.department} &bull; ${site.term.name}</div>
+      <h1><a href="${site.site_url()}"><span py:if="site.course">${site.course.code}: </span>${site.course.name}</a></h1>
     </div>
   </div>
   

Modified: servres/trunk/conifer/templates/edit_site_permissions.xhtml
===================================================================
--- servres/trunk/conifer/templates/edit_site_permissions.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/edit_site_permissions.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,6 +1,6 @@
 <?python
 title = _('Edit site permissions')
-instructors = [m for m in models.Member.objects.filter(site=site) if m.role in ('PROXY', 'INSTR')]
+instructors = site.get_instructors()
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -64,38 +64,7 @@
     </div>
     <div id="STUDT_panel" class="specific">
       <h3>Course section numbers</h3>
-	<?python
-	  current_sections = course.sections()
-	  my_sections = [s for s in models.campus.sections_taught_by(user.username) if not s in current_sections]
-	  ct_sections = [s for s in models.campus.sections_for_code_and_term(course.code, course.term.code) \
-                         if not s in current_sections]
-          encode = lambda t,c,s: models.section_encode_safe((t,c,s))
-	?>
-      <table class="pagetable">
-	<thead>
-	  <tr>
-	    <th>Associated section</th><th>Remove?</th>
-	  </tr>
-	</thead>
-	<tbody>	    
-	<tr py:for="(term, code, sec) in current_sections">
-	  <td>${code}, section ${sec}, in term ${term}</td>
-	  <td><input type="checkbox" name="remove_section_${encode(term,code,sec)}"/></td>
-	</tr>
-	</tbody>
-      </table>
-      <p>Add section: 
-      <select name="add_section">
-	<option value="">--------</option>
-	<optgroup py:for="label, sections in ((_('My Courses'), my_sections), (_('%s in term %s') % (course.code, course.term), ct_sections))"
-		  label="${label}" py:if="sections">
-	  <option py:for="(term, code, sec) in sections"
-		  value="${encode(term,code,sec)}">
-	    ${code}, section ${sec}, in term ${term}
-	  </option>
-	</optgroup>
-	</select>
-      </p>
+      <p>Not implemented yet.</p>
     </div>
     <p><input type="submit" name="action_save_student" value="Save changes to student access"/></p>
 

Modified: servres/trunk/conifer/templates/item/item_add_elec.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_elec.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_add_elec.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,7 +1,7 @@
 <?python
 is_edit = bool(item.id)
 title = is_edit and _('Edit an electronic document') or _('Add a new electronic document')
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -13,7 +13,6 @@
     <script type="text/javascript">
       $(function() {$('input[name="title"]').focus();});
     </script>
-    ${item_metadata_formset_header()}
   </head>
   <body>
     ${site_banner(site)}
@@ -29,7 +28,6 @@
 	  value="${item.title}"/></td></tr>
 	  <tr><th>File</th><td><input type="file" name="file"/></td></tr>
 	</table>
-	${item_metadata_formset()}
 	<p><input type="submit" value="Upload file and Create item"/>
 	${go_back_link()}
 	</p>
@@ -41,8 +39,13 @@
 	<table class="metadata_table">
 	  <tr><th>Title of document</th><td><input type="text" name="title"
 	  value="${item.title}"/></td></tr>
+ 	  <tr><th>Author</th><td><input type="text" name="author"
+	  value="${item.author}"/></td></tr>
+	  <tr><th>Publisher</th><td><input type="text" name="publisher"
+	  value="${item.publisher}"/></td></tr>
+	  <tr><th>Published</th><td><input type="text" name="published"
+	  value="${item.published}"/></td></tr>
 	</table>
-	${item_metadata_formset()}
 	<p><input type="submit" value="Update title and metadata"/></p>
       </form>
       <h2>File contents</h2>

Modified: servres/trunk/conifer/templates/item/item_add_heading.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_heading.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_add_heading.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,7 +1,7 @@
 <?python
 is_edit = bool(item.id)
 title = is_edit and _('Edit a subheading') or _('Add a new subheading')
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -13,7 +13,6 @@
     <script type="text/javascript">
       $(function() {$('input[name="title"]').focus();});
     </script>
-    ${item_metadata_formset_header()}
   </head>
   <body>
     ${site_banner(site)}
@@ -27,7 +26,6 @@
 	       value="${item.title}"/>
 	</td></tr>
       </table>
-      ${item_metadata_formset()}
       <p>
 	<input py:if="not is_edit" type="submit" value="Add heading"/>
 	<input py:if="is_edit" type="submit" value="Update heading"/>

Modified: servres/trunk/conifer/templates/item/item_add_phys.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_phys.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_add_phys.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,7 +1,7 @@
 <?python
 is_edit = bool(item.id)
 title = is_edit and _('Edit a physical-item request') or _('Add a physical-item request')
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -19,7 +19,6 @@
     ${nested_title(parent_item)}
     <div id="sidepanel">${offer_to_delete(item)}</div>
     <h2>${title}</h2>
-
     <form action=".?item_type=${item_type}" method="POST">
       <table class="metadata_table">
 	<tr>
@@ -28,7 +27,6 @@
 	</tr>
       </table>
       <h2>Metadata</h2>
-      ${item_metadata_formset(show_more=False)}
       <p>
     	<input py:if="not is_edit" type="submit" value="Add heading"/>
     	<input py:if="is_edit" type="submit" value="Update physical-item request"/>

Modified: servres/trunk/conifer/templates/item/item_add_url.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_url.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_add_url.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,7 +1,7 @@
 <?python
 is_edit = bool(item.id)
 title = is_edit and _('Edit a URL') or _('Add a new URL')
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -13,7 +13,6 @@
     <script type="text/javascript">
       $(function() {$('input[name="title"]').focus();});
     </script>
-    ${item_metadata_formset_header()}
   </head>
   <body>
     ${site_banner(site)}
@@ -25,7 +24,6 @@
 	<tr><th>Title</th><td><input type="text" name="title" value="${item.title}"/></td></tr>
 	<tr><th>URL</th><td><input type="text" name="url" value="${item.url}"/></td></tr>
       </table>
-      ${item_metadata_formset()}
       <p>
 	<input py:if="not is_edit" type="submit" value="Add URL"/>
 	<input py:if="is_edit" type="submit" value="Update URL"/>

Modified: servres/trunk/conifer/templates/item/item_delete_confirm.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_delete_confirm.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_delete_confirm.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,5 +1,5 @@
 <?python
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site_title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 hier = item.hierarchy()[:-1]
 if item.item_type == 'HEADING':
     title = _('Delete this heading?')
@@ -7,7 +7,6 @@
 else:
     title = _('Delete this item?')
     children = []
-metadata = item.metadata_set.all()
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"

Modified: servres/trunk/conifer/templates/item/item_heading_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_heading_detail.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_heading_detail.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,7 +1,7 @@
 <?python
 site = item.site
 title = item.title
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site_title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 is_editor = site.can_edit(request.user)
 item_tree = site.item_tree(subtree=item)
 ?>

Modified: servres/trunk/conifer/templates/item/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_metadata.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/item/item_metadata.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,10 +1,8 @@
 <?python
 from django.utils.simplejson import loads
-site_title = '%s: %s (%s)' % (site.code, site.title, site.term)
+site_title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 hier = item.hierarchy()[:-1]
 title = item.title
-smallint = item.smallint()
-metadata = item.metadata_set.all()
 is_editor = site.can_edit(request.user)
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
@@ -40,9 +38,6 @@
 	  py:with="avail, status = item.describe_physical_item_status()">
 	<th>Status</th><td><div class="${avail and 'available' or 'unavailable'}">${status}</div></td>
       </tr>
-      <tr py:if="smallint">
-	<th>Small Number</th><td>${smallint}</td>
-      </tr>
       <tr py:if="item.url"><th>URL</th><td><a href="${item.url}">${item.url}</a></td></tr>
     </table>
     <div py:if="item.item_type=='ELEC'">
@@ -53,7 +48,8 @@
 	<tr><th/><td><a class="bigdownload" href="${item.item_url()}">Download</a></td></tr>
       </table>
     </div>
-    <div py:if="metadata">
+    <h2>TODO: get metadata back...</h2>
+    <div py:if="False and metadata">
       <h2 class="metadata_subhead">Additional metadata</h2>
       <table class="metadata_table">
 	<tr py:for="attr in metadata">

Modified: servres/trunk/conifer/templates/site_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/site_detail.xhtml	2010-07-15 00:54:42 UTC (rev 912)
+++ servres/trunk/conifer/templates/site_detail.xhtml	2010-07-15 00:54:47 UTC (rev 913)
@@ -1,5 +1,5 @@
 <?python
-title = '%s: %s (%s)' % (site.code, site.title, site.term)
+title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 item_tree = site.item_tree()
 is_editor = site.can_edit(request.user)
 is_joinable = site.is_joinable_by(request.user)



More information about the open-ils-commits mailing list