[open-ils-commits] r8470 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: controllers/acq lib/acq templates/oils/default/acq/financial templates/oils/default/common

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jan 22 16:44:36 EST 2008


Author: erickson
Date: 2008-01-22 16:18:07 -0500 (Tue, 22 Jan 2008)
New Revision: 8470

Added:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
Log:
added basic fund create and view

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-22 20:12:47 UTC (rev 8469)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py	2008-01-22 21:18:07 UTC (rev 8470)
@@ -31,6 +31,7 @@
         self.picklist_entry = ContextItem() # picklist_entry object
 
         self.currency_types = ContextItem()
+        self.fund = ContextItem()
         self.fund_name = ContextItem(cgi_name='acq.fn')
         self.fund_currency_type = ContextItem(cgi_name='acq.fc')
         self.fund_owner = ContextItem(cgi_name='acq.fo')

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-01-22 20:12:47 UTC (rev 8469)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-01-22 21:18:07 UTC (rev 8470)
@@ -8,8 +8,17 @@
 class FundController(BaseController):
 
     def view(self, **kwargs):
-        return 'view %s' % kwargs['id']
+        r = RequestMgr()
+        r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
+        fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
+        fund = fund_mgr.retrieve(kwargs.get('id'))
+        fund.owner(oils.org.OrgUtil.get_org_unit(fund.owner())) # flesh the owner
+        r.ctx.acq.fund = fund
+        return r.render('acq/financial/view_fund.html')
 
+    def list(self):
+        pass
+
     def create(self):
         r = RequestMgr()
         fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
@@ -20,7 +29,7 @@
             fund.owner(r.ctx.acq.fund_owner)
             fund.currency_type(r.ctx.acq.fund_currency_type)
             fund_id = fund_mgr.create_fund(fund)
-            redirect_to(controller='acq/fund', action='view', id=fund_id)
+            return redirect_to(controller='acq/fund', action='view', id=fund_id)
 
         r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()
         r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-01-22 20:12:47 UTC (rev 8469)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py	2008-01-22 21:18:07 UTC (rev 8470)
@@ -14,6 +14,13 @@
         oils.event.Event.parse_and_raise(types)
         return types
 
+    def retrieve(self, fund_id):
+        status = self.ses.request(
+            'open-ils.acq.fund.retrieve', 
+            self.request_mgr.ctx.core.authtoken, fund_id).recv().content()
+        oils.event.Event.parse_and_raise(status)
+        return status
+
     def create_fund(self, fund):
         fund_id = self.ses.request(
             'open-ils.acq.fund.create', 

Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	2008-01-22 21:18:07 UTC (rev 8470)
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
+<%def name="block_content()">
+
+<form action='${c.oils.acq.prefix}/fund/create' method='POST'>
+    <table class='oils-admin-table'>
+        <tbody>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Name')}</td>
+                <td>${c.oils.acq.fund.name()}</td>
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+                <td>${c.oils.acq.fund.owner().name()}</td> 
+            </tr>
+            <tr>
+                <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+                <td>${c.oils.acq.fund.currency_type()}</td> 
+            </tr>
+        </tbody>
+    </table>
+</form>
+</%def>

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html	2008-01-22 20:12:47 UTC (rev 8469)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html	2008-01-22 21:18:07 UTC (rev 8470)
@@ -4,8 +4,12 @@
     Define some common widgets 
 -->
 
-<%def name='org_draw_node(node, indent=0)'>
-    <option value='${node.id()}'>
+<%def name='org_draw_node(node, indent=0, selected=None)'>
+    <option value='${node.id()}'
+    % if selected == node.id():
+        selected='selected'
+    %endif
+    >
         % for i in range(indent):
             &#160;&#160;
         % endfor
@@ -18,7 +22,7 @@
         
 </%def>
 
-<%def name='org_select(select_name, tree=None)'>
+<%def name='org_select(select_name, tree=None, selected=None)'>
     <!-- Draws a select dropdown of the org tree provided
         with indentation based on org depth -->
     <%
@@ -26,6 +30,6 @@
             tree = c.oils.core.org_tree
     %>
     <select name='${select_name}'>
-        ${org_draw_node(tree, 0)}
+        ${org_draw_node(tree, 0, selected)}
     </select>
 </%def>



More information about the open-ils-commits mailing list