[open-ils-commits] r8451 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: controllers/acq lib/acq public/oils/media/css/skin public/oils/media/css/theme/default templates/oils/default templates/oils/default/acq/picklist

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jan 21 16:38:06 EST 2008


Author: erickson
Date: 2008-01-21 16:11:50 -0500 (Mon, 21 Jan 2008)
New Revision: 8451

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html
Log:
added basic picklist and entry delete.  indicating in header of auto-login is turned on

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-01-21 21:11:50 UTC (rev 8451)
@@ -32,6 +32,7 @@
 
         self.picklist = ContextItem() # picklist object
         self.picklist_list = ContextItem() # list of picklist objects
+        self.picklist_id_list = ContextItem() # list of picklist objects
         self.picklist_entry = ContextItem() # picklist_entry object
 
         # -------------------------------------------------------------

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py	2008-01-21 21:11:50 UTC (rev 8451)
@@ -54,35 +54,19 @@
         r = RequestMgr()
         picklist_id = oilsweb.lib.acq.search.multi_search(
             r, oilsweb.lib.acq.search.compile_multi_search(r))
-        return redirect_to('view/%d' % int(picklist_id))
+        return redirect_to(controller='acq/picklist', action='view', id=picklist_id)
 
-    '''
-    def rdetails(self):
+    def delete(self, **kwargs):
         r = RequestMgr()
-        rec_id = r.ctx.acq.record_id
-        cache_key = r.ctx.acq.search_cache_key
+        pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id'])
+        pl_manager.delete()
+        return redirect_to(controller='acq/picklist', action='list')
 
-        results = osrf.cache.CacheClient().get(cache_key)
-        rec = self._find_cached_record(results, rec_id)
-        if rec:
-            r.ctx.acq.record = rec
-            r.ctx.acq.record_html = oilsweb.lib.bib.marc_to_html(rec['marcxml'])
-            return r.render('acq/picklist/rdetails.html')
-        return 'exception -> no record'
 
-
-    def create_picklist(self):  
+    def delete_entry(self, **kwargs):
         r = RequestMgr()
-        if not isinstance(r.ctx.acq.picklist_item, list):
-            r.ctx.acq.picklist_item = [r.ctx.acq.picklist_item]
-
-        results = osrf.cache.CacheClient().get(r.ctx.acq.search_cache_key)
-
-        records = []
-        for cache_id in r.ctx.acq.picklist_item:
-            rec = self._find_cached_record(results, cache_id)
-            records.append(rec)
-
-        c.oils_acq_records = records # XXX
-        return r.render('acq/picklist/view.html')
-'''
+        pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r)
+        entry_id = kwargs['id']
+        entry = pl_manager.retrieve_entry(entry_id)
+        pl_manager.delete_entry(entry_id)
+        return redirect_to(controller='acq/picklist', action='view', id=entry.picklist())

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py	2008-01-21 21:11:50 UTC (rev 8451)
@@ -9,7 +9,6 @@
         self.ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
 
     def retrieve(self):
-
         picklist = self.ses.request(
             'open-ils.acq.picklist.retrieve', 
             self.request_mgr.ctx.core.authtoken, self.id).recv().content()
@@ -17,6 +16,22 @@
         oils.event.Event.parse_and_raise(picklist)
         self.picklist = picklist
 
+    def delete(self, picklist_id=None):
+        picklist_id = picklist_id or self.id
+        status = self.ses.request(
+            'open-ils.acq.picklist.delete',
+            self.request_mgr.ctx.core.authtoken, picklist_id).recv().content()
+        oils.event.Event.parse_and_raise(status)
+        return status
+
+    def delete_entry(self, entry_id):
+        status = self.ses.request(
+            'open-ils.acq.picklist_entry.delete',
+            self.request_mgr.ctx.core.authtoken, entry_id).recv().content()
+        oils.event.Event.parse_and_raise(status)
+        return status
+
+
     def retrieve_entries(self, **kwargs):
         # grab the picklist entries
         entries = self.ses.request(
@@ -74,20 +89,18 @@
             'open-ils.acq.picklist.name.retrieve',
             self.request_mgr.ctx.core.authtoken, pl_name).recv()
         if data:
-            picklist = data.content()
-            status = self.ses.request(
-                'open-ils.acq.picklist.delete',
-                self.request_mgr.ctx.core.authtoken, picklist.id()).recv().content()
-            oils.event.Event.parse_and_raise(status)
+            self.delete(data.content().id())
         
         # create the new one
         picklist = osrf.net_obj.NetworkObject.acqpl()
         picklist.name(pl_name)
         picklist.owner(self.request_mgr.ctx.core.user.id()) 
+
         picklist = self.ses.request(
             'open-ils.acq.picklist.create',
             self.request_mgr.ctx.core.authtoken, picklist).recv().content()
         oils.event.Event.parse_and_raise(picklist)
+
         return picklist
 
     def create_entry(self, entry):

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css	2008-01-21 21:11:50 UTC (rev 8451)
@@ -18,6 +18,7 @@
 #oils-base-navigate-table td { width: 100%; }
 #oils-base-sidebar-block { width: 15%; vertical-align: top; float:left;}
 
+#oils-base-header-auto-login { padding-right: 20px; }
 #oils-base-header-block { width: 100%; text-align: right; margin-top: 0px; padding-bottom: 4px;}
 #oils-base-footer-block { width: 100%; text-align: center; vertical-align: bottom;}
 

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css	2008-01-21 21:11:50 UTC (rev 8451)
@@ -25,6 +25,7 @@
 .oils-acq-picklist-records-phys_desc-row { border-bottom: 1px solid #6BA160; }
 .oils-acq-picklist-picklist-td { border-style: solid; border-color: #A1A1A1; border-width: 0px 1px 0px 1px; } 
 .oils-acq-picklist-records-service-td { font-size: 85%; }
+.oils-acq-picklist-entry-delete-link { font-size: 85%; }
 
 /* entry display */
 #oils-acq-picklist-entry-marc-block { border: 1px solid #6BA160; }

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html	2008-01-21 21:11:50 UTC (rev 8451)
@@ -52,6 +52,7 @@
             ${c.oils.acq.find_entry_attr(entry, "isbn")} |
             ${c.oils.acq.find_entry_attr(entry, "pubdate")} |
             ${c.oils.acq.find_entry_attr(entry, "pagination")}
+            <a class='oils-acq-picklist-entry-delete-link' href='${c.oils.acq.prefix}/picklist/delete_entry/${entry.id()}'>${_('Delete')}</a>
         </td>
     </tr>
     % endfor

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html	2008-01-21 21:11:50 UTC (rev 8451)
@@ -11,6 +11,8 @@
             <td>${_('Name')}</td>
             <td>${_('Create Time')}</td>
             <td>${_('Edit Time')}</td>
+            <td/>
+            <td/>
         </tr>
     </thead>
     <tbody>
@@ -19,6 +21,7 @@
         <td><a href='${c.oils.acq.prefix}/picklist/view/${picklist.id()}'>${picklist.name()}</a></td>
         <td>${picklist.create_time()}</td>
         <td>${picklist.edit_time()}</td>
+        <td><a href='${c.oils.acq.prefix}/picklist/delete/${picklist.id()}'>${_('Delete')}</a></td>
     </tr>
     % endfor
     </tbody>

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html	2008-01-21 17:31:02 UTC (rev 8450)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/header.html	2008-01-21 21:11:50 UTC (rev 8451)
@@ -1,5 +1,15 @@
 # -*- coding: utf-8 -*-
 <div id='oils-base-header-content-div'>
+    <% 
+        import pylons
+        if 'oils_demo_user' in pylons.config:
+            auto_login = True
+        else:
+            auto_login = False
+    %>
+    % if auto_login:
+        <span id='oils-base-header-auto-login'>${_('Auto-login is enabled')}</span>|
+    % endif
     <span id='oils-base-header-user-info'>
         ${c.oils.core.user.usrname()} / ${c.oils.core.workstation.name()}
     </span>



More information about the open-ils-commits mailing list