display loan duration, change div to span for IE madness
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 12 Jan 2011 04:42:25 +0000 (04:42 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Wed, 12 Jan 2011 04:42:25 +0000 (04:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1190 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/integration/uwindsor.py
conifer/syrup/models.py
conifer/templates/components/site.xhtml
conifer/templates/site_detail.xhtml

index 89bf065..72a11a6 100644 (file)
@@ -105,6 +105,7 @@ def _item_status(bib_id):
             lib = desk = avail = 0
            dueinfo = ''
             callno = ''
+            circmod = ''
             for org, callnum, loc, stats in counts:
                if len(callno) == 0:
                        callno = callnum
@@ -123,12 +124,14 @@ def _item_status(bib_id):
                we want to return the resource that will be returned first if
                already checked out
                """
-                if loc == RESERVES_DESK_NAME and avail == 0:
-                       for copyid in copyids:
-                               circinfo = E1(OPENSRF_FLESHED2_CALL, copyid)
-                               circs = circinfo.get("circulations")
-                               if circs and avail==0:
-                                       if len(circs) > 0:
+               for copyid in copyids:
+                       circinfo = E1(OPENSRF_FLESHED2_CALL, copyid)
+                       if loc == RESERVES_DESK_NAME: 
+                               if len(circmod) == 0:
+                                       circmod = circinfo.get("circ_modifier")
+                               if avail == 0:
+                                       circs = circinfo.get("circulations")
+                                       if circs and len(circs) > 0:
                                                circ = circs[0]
                                                rawdate = circ.get("due_date")
                                                #remove offset info, %z is flakey for some reason
@@ -143,7 +146,7 @@ def _item_status(bib_id):
                                                        dueinfo = time.strftime(DUE_FORMAT,earliestdue)
                                                        callno = callnum
                                        
-            return (lib, desk, avail, callno, dueinfo)
+            return (lib, desk, avail, callno, dueinfo, circmod)
        except:
            print "due date/call problem: ", bib_id
             print "*** print_exc:"
index 5cf5c7b..3cabd0b 100644 (file)
@@ -750,7 +750,7 @@ class Item(BaseModel):
         if not stat:
             return (False, 'Status information not available.')
         else:
-            lib, desk, avail, callno, dueinfo = stat
+            lib, desk, avail, callno, dueinfo, circmod = stat
             return (avail > 0,
                     '%d of %d copies available at reserves desk; '
                     '%d total copies in library system'
index 90021eb..4d6e70a 100644 (file)
@@ -39,11 +39,25 @@ searchtext = _('search this site...')
       ?>
       <div class="availability" py:if="item.item_type == 'PHYS'">
        <a href="${item.item_url()}">
-       <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo) = stat"
+       <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod) = stat"
             class="${_avail &gt; 0 and 'available' or 'unavailable'}"
             title="${_avail} of ${_desk} copies available at reserves desk; ${_lib} total copies in library system">
           <div>${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})</div>
           <div py:if="_dueinfo">DUE: ${_dueinfo}</div>
+          <div py:if="_circmod">
+               <span py:if="_circmod == 'RSV2'">2 Hour Loan</span>
+               <span py:if="_circmod == 'RSV3'">3 Hour Loan</span>
+               <span py:if="_circmod == 'RSV4'">4 Hour Loan</span>
+               <span py:if="_circmod == 'RSV7'">7 Hour Loan</span>
+                <span py:if="_circmod == 'RESERVE 1 DAY'">1 Day Loan</span>
+                <span py:if="_circmod == 'RESERVE 1 HOUR'">1 Hour Loan</span>
+                <span py:if="_circmod == 'RESERVE 14 DAY'">14 Day Loan</span>
+                <span py:if="_circmod == 'RESERVE 2 DAY'">2 Day Loan</span>
+                <span py:if="_circmod == 'RESERVE 2 HOUR'">2 Hour Loan</span>
+                <span py:if="_circmod == 'RESERVE 3 DAY'">3 Day Loan</span>
+                <span py:if="_circmod == 'RESERVE 4 HOUR'">4 Hour Loan</span>
+                <span py:if="_circmod == 'RESERVE 7 DAY'">7 Day Loan</span>
+          </div>
          <div class="callnumber">${_callno}</div>
                  </div>
                  <div py:if="not valid" class="unavailable">
index 0573436..c7e7e58 100644 (file)
@@ -30,9 +30,10 @@ is_joinable = site.is_joinable_by(request.user)
     <p py:if="not item_tree">
       There are no items associated with this site yet.
     </p>
-    <div id="treepanel">
+    <!-- possible fix for outrageous spacing in IE 8 -->
+    <span id="treepanel">
       ${show_tree(item_tree, edit=is_editor)}
-    </div>
+    </span>
     <div py:if="is_editor">${add_subs()}</div>