From bcfeae13c7d193b9f55c9dfa1e87d766e645f024 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 22 Jan 2008 21:18:07 +0000 Subject: [PATCH] added basic fund create and view git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8470 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../oilsweb/oilsweb/controllers/acq/__init__.py | 1 + .../web/oilsweb/oilsweb/controllers/acq/fund.py | 13 +++++++++-- Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py | 7 ++++++ .../oils/default/acq/financial/view_fund.html | 25 ++++++++++++++++++++++ .../templates/oils/default/common/widgets.html | 12 +++++++---- 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py index bcdd7cf806..cca275515a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py @@ -31,6 +31,7 @@ class AcqContext(SubContext): 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') diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py index cfc92f988a..411425880d 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py @@ -8,7 +8,16 @@ import oils.org 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() @@ -20,7 +29,7 @@ class FundController(BaseController): 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() diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py index 215097af08..dcbe6fcdc0 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py @@ -14,6 +14,13 @@ class FundMgr(object): 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', diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html new file mode 100644 index 0000000000..4ee52c8056 --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html @@ -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 name="block_content()"> + +
+ + + + + + + + + + + + + + + +
${_('Fund Name')}${c.oils.acq.fund.name()}
${_('Fund Onwer')}${c.oils.acq.fund.owner().name()}
${_('Fund Currency Type')}${c.oils.acq.fund.currency_type()}
+
+ diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html index 11f1db4ab3..3829fbe299 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html @@ -4,8 +4,12 @@ Define some common widgets --> -<%def name='org_draw_node(node, indent=0)'> -