ELEC and URL items both have extended (ERes-like) metadata.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 28 Dec 2010 20:58:37 +0000 (20:58 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Tue, 28 Dec 2010 20:58:37 +0000 (20:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1137 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/TODO
conifer/syrup/views/items.py
conifer/templates/item/common_metadata.xhtml [new file with mode: 0644]
conifer/templates/item/item_add_elec.xhtml
conifer/templates/item/item_add_url.xhtml

index 73c9f2d..ed81f48 100644 (file)
@@ -1,19 +1,15 @@
 NEW:
 
-* add URL form should have same metadata as ELEC form (except for copyright status)
-
-* why are .focus() calls not working properly?
-
-* edit URL item fails with error. KeyError: author2
-
 * add Joan's new text
 
 * write up some documentation
 
-* add/remove individuals in course sites
-
 * review CLEW integration. KISS.
 
+* why are .focus() calls not working properly?
+
+* add/remove individuals in course sites
+
 CRITICAL:
 
 IMPORTANT:
@@ -76,3 +72,8 @@ RECENTLY DONE:
 * 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
+
index 4e4ffdd..0aa34eb 100644 (file)
@@ -88,6 +88,7 @@ def item_add(request, site_id, item_id):
 
     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:
diff --git a/conifer/templates/item/common_metadata.xhtml b/conifer/templates/item/common_metadata.xhtml
new file mode 100644 (file)
index 0000000..819ffde
--- /dev/null
@@ -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
index e9ca402..4149c1c 100644 (file)
@@ -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 @@ if len(authors) < 2:
     ${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"/>
index 60f9577..8f5629e 100644 (file)
@@ -8,6 +8,7 @@ site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
       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 @@ site.title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
     <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>