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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 28 15:58:42 EST 2010


Author: gfawcett
Date: 2010-12-28 15:58:37 -0500 (Tue, 28 Dec 2010)
New Revision: 1137

Added:
   servres/trunk/conifer/templates/item/common_metadata.xhtml
Modified:
   servres/trunk/conifer/TODO
   servres/trunk/conifer/syrup/views/items.py
   servres/trunk/conifer/templates/item/item_add_elec.xhtml
   servres/trunk/conifer/templates/item/item_add_url.xhtml
Log:
ELEC and URL items both have extended (ERes-like) metadata.

Modified: servres/trunk/conifer/TODO
===================================================================
--- servres/trunk/conifer/TODO	2010-12-28 20:39:44 UTC (rev 1136)
+++ servres/trunk/conifer/TODO	2010-12-28 20:58:37 UTC (rev 1137)
@@ -1,19 +1,15 @@
 NEW:
 
-* add URL form should have same metadata as ELEC form (except for copyright status)
+* add Joan's new text
 
-* why are .focus() calls not working properly?
+* write up some documentation
 
-* edit URL item fails with error. KeyError: author2
+* review CLEW integration. KISS.
 
-* add Joan's new text
+* why are .focus() calls not working properly?
 
-* write up some documentation
-
 * add/remove individuals in course sites
 
-* review CLEW integration. KISS.
-
 CRITICAL:
 
 IMPORTANT:
@@ -76,3 +72,8 @@
 * factor out hardcoded references to the EG server.
 
 * add new staff member
+
+* add URL form should have same metadata as ELEC form (except for copyright status)
+
+* edit URL item fails with error. KeyError: author2
+

Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py	2010-12-28 20:39:44 UTC (rev 1136)
+++ servres/trunk/conifer/syrup/views/items.py	2010-12-28 20:58:37 UTC (rev 1137)
@@ -88,6 +88,7 @@
 
     if request.method != 'POST':
         item = models.Item()    # dummy object
+        item.item_type = item_type
         return g.render('item/item_add_%s.xhtml' % item_type.lower(),
                         **locals())
     else:

Added: servres/trunk/conifer/templates/item/common_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/common_metadata.xhtml	                        (rev 0)
+++ servres/trunk/conifer/templates/item/common_metadata.xhtml	2010-12-28 20:58:37 UTC (rev 1137)
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/"
+      py:strip="True">
+<?python
+if bool(item.id):
+   authors = [a.strip() for a in item.author.split(';')]
+else:
+   authors = []
+if len(authors) < 2:
+   authors.extend([''] * (2 - len(authors)))
+
+?>
+    <tbody py:def="common_table()" py:strip="True">
+      <tr><th>Title of document</th><td><input type="text" name="title" value="${item.title}"/></td></tr>
+      <tr><th>Title of source</th><td><input type="text" name="source_title" value="${item.source_title}"/></td></tr>
+      <tr py:for="n, author in enumerate(authors)">
+	<th>Author #${n+1}</th><td><input type="text" name="author${n+1}" value="${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>
+      <tr><th>Volume</th><td><input type="text" name="volume" value="${item.volume}"/></td></tr>
+      <tr><th>Issue</th><td><input type="text" name="issue" value="${item.issue}"/></td></tr>
+      <tr><th>Pages</th><td><input type="text" name="pages" value="${item.pages}"/></td></tr>
+      <tr><th>ISBN</th><td><input type="text" name="isbn" value="${item.isbn}"/></td></tr>
+      <tr py:if="user.is_staff and item.item_type == 'ELEC'">
+	<th>Copyright Status</th>
+	<td>
+	  <select name="copyright_status">
+	    <option py:for="k,v in item.COPYRIGHT_STATUS_CHOICES"
+		    py:attrs="{'selected': item.copyright_status==k or None}"
+		    value="${k}"
+		    py:content="v"/>
+	  </select>
+	</td>
+      </tr>
+    </tbody>
+
+</html>
\ No newline at end of file

Modified: servres/trunk/conifer/templates/item/item_add_elec.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_elec.xhtml	2010-12-28 20:39:44 UTC (rev 1136)
+++ servres/trunk/conifer/templates/item/item_add_elec.xhtml	2010-12-28 20:58:37 UTC (rev 1137)
@@ -2,18 +2,13 @@
 is_edit = bool(item.id)
 title = is_edit and _('Electronic document: Metadata') or _('Add a new electronic document')
 site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
-if is_edit:
-   authors = [a.strip() for a in item.author.split(';')]
-else:
-   authors = []
-if len(authors) < 2:
-   authors.extend([''] * (2 - len(authors)))
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
       xmlns:py="http://genshi.edgewall.org/">
   <xi:include href="../master.xhtml"/>
   <xi:include href="../components/site.xhtml"/>
+  <xi:include href="common_metadata.xhtml"/>
   <head>
     <title>${title}</title>
     <script type="text/javascript">
@@ -29,36 +24,11 @@
     ${offer_to_delete(item)}
     <h2>${title}</h2>
 
-    <tbody py:def="common_table()" py:strip="True">
-      <tr><th>Title of document</th><td><input type="text" name="title" value="${item.title}"/></td></tr>
-      <tr><th>Title of source</th><td><input type="text" name="source_title" value="${item.source_title}"/></td></tr>
-      <tr py:for="n, author in enumerate(authors)">
-	<th>Author #${n+1}</th><td><input type="text" name="author${n+1}" value="${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>
-      <tr><th>Volume</th><td><input type="text" name="volume" value="${item.volume}"/></td></tr>
-      <tr><th>Issue</th><td><input type="text" name="issue" value="${item.issue}"/></td></tr>
-      <tr><th>Pages</th><td><input type="text" name="pages" value="${item.pages}"/></td></tr>
-      <tr><th>ISBN</th><td><input type="text" name="isbn" value="${item.isbn}"/></td></tr>
-      <tr py:if="user.is_staff">
-	<th>Copyright Status</th>
-	<td>
-	  <select name="copyright_status">
-	    <option py:for="k,v in item.COPYRIGHT_STATUS_CHOICES"
-		    py:attrs="{'selected': item.copyright_status==k or None}"
-		    value="${k}"
-		    py:content="v"/>
-	  </select>
-	</td>
-      </tr>
-    </tbody>
-
     <div py:if="not is_edit">
       <form action=".?item_type=${item_type}" method="POST"
 	    enctype="multipart/form-data">
 	<table class="metadata_table">
-	  ${common_table()}
+	  ${common_table(item)}
 	  <tr><th>File</th><td><input type="file" name="file"/></td></tr>
 	</table>
 	<p><input type="submit" value="Upload file and Create item"/>

Modified: servres/trunk/conifer/templates/item/item_add_url.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_url.xhtml	2010-12-28 20:39:44 UTC (rev 1136)
+++ servres/trunk/conifer/templates/item/item_add_url.xhtml	2010-12-28 20:58:37 UTC (rev 1137)
@@ -8,6 +8,7 @@
       xmlns:py="http://genshi.edgewall.org/">
   <xi:include href="../master.xhtml"/>
   <xi:include href="../components/site.xhtml"/>
+  <xi:include href="common_metadata.xhtml"/>
   <head>
     <title>${title}</title>
     <script type="text/javascript">
@@ -24,14 +25,10 @@
     <h2>${title}</h2>
     <form action=".?item_type=${item_type}" method="POST">
       <table class="metadata_table">
-	<tr><th>Title</th><td><input type="text" name="title" value="${item.title}"/></td></tr>
+	<tbody>
 	<tr><th>URL</th><td><input type="text" name="url" value="${item.url}"/></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>
+	</tbody>
+	${common_table()}
       </table>
     <div py:if="item.marcxml">
       <p id="marcdatashow"><a href="javascript:void($('#marcdata').toggle());">Display MARC Record</a></p>



More information about the open-ils-commits mailing list