[open-ils-commits] r8458 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib lib/acq public/oils/media/css/skin
public/oils/media/css/theme templates/oils/default
templates/oils/default/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 12:26:32 EST 2008
Author: erickson
Date: 2008-01-22 12:00:04 -0500 (Tue, 22 Jan 2008)
New Revision: 8458
Added:
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/acq/financial/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.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.css
Log:
added basic fund create interface, much more to come on that
added a common template directory, currently has a widgets file for common widgets
implemented an org-tree selector widget
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 16:34:56 UTC (rev 8457)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-01-22 17:00:04 UTC (rev 8458)
@@ -18,11 +18,6 @@
self.offset = ContextItem(cgi_name='acq.os', default_value=0)
self.limit = ContextItem(cgi_name='acq.li', default_value=10)
- #self.search_cache_key = ContextItem(cgi_name='acq.sk')
- #self.record_id = ContextItem(cgi_name='acq.ri')
- #self.record = ContextItem(cgi_name='acq.r')
- #self.picklist_item = ContextItem(cgi_name='acq.pi', multi=True)
-
# -------------------------------------------------------------
# shared objects and data
self.prefix = ContextItem()
@@ -35,6 +30,11 @@
self.picklist_id_list = ContextItem() # list of picklist objects
self.picklist_entry = ContextItem() # picklist_entry object
+ self.currency_types = 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')
+
# -------------------------------------------------------------
# utility functions
self.find_entry_attr = ContextItem(
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-01-22 17:00:04 UTC (rev 8458)
@@ -0,0 +1,28 @@
+from oilsweb.lib.base import *
+import pylons
+from oilsweb.lib.request import RequestMgr
+import oilsweb.lib.acq.fund
+import osrf.net_obj
+import oils.org
+
+class FundController(BaseController):
+
+ def view(self, **kwargs):
+ return 'view %s' % kwargs['id']
+
+ def create(self):
+ r = RequestMgr()
+ fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
+
+ if r.ctx.acq.fund_name:
+ fund = osrf.net_obj.NetworkObject.acqfund()
+ fund.name(r.ctx.acq.fund_name)
+ 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)
+
+ r.ctx.acq.currency_types = fund_mgr.fetch_currency_types()
+ r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
+ return r.render('acq/financial/create_fund.html')
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py 2008-01-22 16:34:56 UTC (rev 8457)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py 2008-01-22 17:00:04 UTC (rev 8458)
@@ -26,6 +26,7 @@
self.workstation = ContextItem() # workstation object
self.page = ContextItem() # the current page
self.use_demo = ContextItem(cgi_name='demo') # use the demo login
+ self.org_tree = ContextItem() # full org tree
def postinit(self):
self.prefix = pylons.config['oils_prefix']
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py 2008-01-22 17:00:04 UTC (rev 8458)
@@ -0,0 +1,24 @@
+import osrf.ses, osrf.net_obj
+import oils.const, oils.utils.utils, oils.event
+
+class FundMgr(object):
+ ''' Fund utility class '''
+ def __init__(self, request_mgr, **kwargs):
+ self.request_mgr = request_mgr
+ self.ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
+
+ def fetch_currency_types(self):
+ types = self.ses.request(
+ 'open-ils.acq.currency_type.all.retrieve',
+ self.request_mgr.ctx.core.authtoken).recv().content()
+ oils.event.Event.parse_and_raise(types)
+ return types
+
+ def create_fund(self, fund):
+ fund_id = self.ses.request(
+ 'open-ils.acq.fund.create',
+ self.request_mgr.ctx.core.authtoken, fund).recv().content()
+ oils.event.Event.parse_and_raise(fund_id)
+ return fund_id
+
+
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-22 16:34:56 UTC (rev 8457)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default.css 2008-01-22 17:00:04 UTC (rev 8458)
@@ -26,4 +26,9 @@
.oils-base-sub-navigate-block { text-align: center; padding: 3px; margin-bottom: 10px;}
.oils-base-sub-navigate-block span { padding: 3px; }
+/* general purpose form table */
+.oils-admin-table { width: 100%; }
+.oils-admin-table td { padding: 4px; }
+.oils-admin-label { width: 20%; }
+
.label { margin: 1px; }
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default.css 2008-01-22 16:34:56 UTC (rev 8457)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default.css 2008-01-22 17:00:04 UTC (rev 8458)
@@ -19,3 +19,6 @@
.oils-base-sub-navigate-block span:hover { background: #6BA160; }
.label { font-weight: bold; }
+
+.oils-admin-table td { border-bottom: 1px solid #5E5E5E; }
+.oils-admin-label { font-weight: bold; }
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html 2008-01-22 17:00:04 UTC (rev 8458)
@@ -0,0 +1,41 @@
+# -*- 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>
+ <input type='text' size='42' name='${c.oils.acq.fund_name_.cgi_name}'/>
+ </td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+ <td>
+ ${widget.org_select(c.oils.acq.fund_owner_.cgi_name)}
+ <b>* ADD PERM FILTER HERE *</b>
+ </td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+ <td>
+ <select name='${c.oils.acq.fund_currency_type_.cgi_name}'>
+ % for type in c.oils.acq.currency_types:
+ <option value='${type.code()}'>${type.label()}</option>
+ % endfor
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan='2'>
+ <input type='submit' value='${_("Create Fund")}'/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>
+</%def>
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html 2008-01-22 17:00:04 UTC (rev 8458)
@@ -0,0 +1,31 @@
+<!-- vim:set filetype=mako: -->
+
+<!--
+ Define some common widgets
+-->
+
+<%def name='org_draw_node(node, indent=0)'>
+ <option value='${node.id()}'>
+ % for i in range(indent):
+   
+ % endfor
+ ${node.name()} (${node.shortname()})
+ </option>
+ <% indent += 1 %>
+ % for child in node.children():
+ ${org_draw_node(child, indent)}
+ % endfor
+
+</%def>
+
+<%def name='org_select(select_name, tree=None)'>
+ <!-- Draws a select dropdown of the org tree provided
+ with indentation based on org depth -->
+ <%
+ if tree is None:
+ tree = c.oils.core.org_tree
+ %>
+ <select name='${select_name}'>
+ ${org_draw_node(tree, 0)}
+ </select>
+</%def>
More information about the open-ils-commits
mailing list