From: erickson Date: Mon, 4 Feb 2008 17:48:50 +0000 (+0000) Subject: repaired some labels. gave org-tree widget ability to disable orgs below a certain... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=28805a8666ac18edfb9941d7a113633564039135;p=Evergreen.git repaired some labels. gave org-tree widget ability to disable orgs below a certain depth, plugged in some fund source permission checks git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8608 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py index 9400986faf..ea31dc14e0 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py @@ -38,7 +38,19 @@ class FundSourceController(BaseController): source_id = fund_mgr.create_fund_source(source) return redirect_to(controller='acq/fund_source', action='view', id=source_id) - r.ctx.acq.currency_types = fund_mgr.fetch_currency_types() + perm_orgs = osrf.ses.ClientSession.atomic_request( + 'open-ils.actor', + 'open-ils.actor.user.work_perm.highest_org_set', + r.ctx.core.authtoken, 'CREATE_FUNDING_SOURCE'); + + if len(perm_orgs) == 0: + return _("Insufficient Permissions") # XXX Return a perm failure template + r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree() + r.ctx.core.perm_tree['CREATE_FUNDING_SOURCE'] = oils.org.OrgUtil.get_union_tree(perm_orgs) + r.ctx.core.perm_orgs['CREATE_FUNDING_SOURCE'] = perm_orgs + r.ctx.acq.currency_types = fund_mgr.fetch_currency_types() return r.render('acq/financial/create_fund_source.html') + + diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py index b4e2c9cc82..f9ca5d0731 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py @@ -28,6 +28,12 @@ class CoreContext(SubContext): self.org_tree = ContextItem() # full org tree self.page = ContextItem() # the current page + # place to store perm org sets + self.perm_orgs = ContextItem(default_value={}) + + # place to store slim perm org trees + self.perm_tree = ContextItem(default_value={}) + def postinit(self): self.prefix = pylons.config['oils_prefix'] self.media_prefix = pylons.config['oils_media_prefix'] @@ -65,6 +71,17 @@ class CoreContext(SubContext): 'open-ils.auth', 'open-ils.auth.session.retrieve', self.authtoken) + evt = oils.event.Event.parse_event(self.user) + if evt and evt.text_code == 'NO_SESSION': + # our authtoken has timed out. If we have the ability + # to loin, go ahead and try + self.doLogin() + self.user = osrf.ses.ClientSession.atomic_request( + 'open-ils.auth', + 'open-ils.auth.session.retrieve', self.authtoken) + oils.event.Event.parse_and_raise(self.user) + + if not self.user: raise AuthException(_('No user found with authtoken %(self.authtoken)s')) self.workstation = oils.utils.csedit.CSEditor().retrieve_actor_workstation(self.user.wsid()) @@ -90,6 +107,9 @@ class UtilContext(SubContext): def __init__(self): import oilsweb.lib.bib self.scrub_isbn = ContextItem(default_value=oilsweb.lib.bib.scrub_isbn) + self.get_org_type = ContextItem(default_value=oils.org.OrgUtil.get_org_type) + self.get_min_org_depth = ContextItem(default_value=oils.org.OrgUtil.get_min_depth) Context.applySubContext('util', UtilContext) + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html index 36f20dae56..f2d1f25736 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html @@ -1,27 +1,30 @@ # -*- coding: utf-8 -*- + <%inherit file='../base.html'/> <%namespace file='../../common/widgets.html' name='widget'/> -<%def name="page_title()">${_('Evergreen Create Fund')} +<%def name="page_title()">${_('Create Fund Source')} <%def name="block_content()">
- + - + - + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html index cc1df2f0ff..672b305c4b 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- <%inherit file='../base.html'/> <%namespace file='../../common/widgets.html' name='widget'/> -<%def name="page_title()">${_('Evergreen Create Fund')} +<%def name="page_title()">${_('Create Fund Source')} <%def name="block_content()">
${_('Fund Name')}${_('Fund Source Name')}
${_('Fund Onwer')}${_('Fund Source Onwer')} - ${widget.org_select(c.oils.acq.fund_source_owner_.cgi_name)} - * ADD PERM FILTER HERE * + ${widget.org_select( + c.oils.acq.fund_source_owner_.cgi_name, + c.oils.core.perm_tree['CREATE_FUNDING_SOURCE'], c.oils.core.workstation.id(), + c.oils.util.get_min_org_depth(c.oils.core.perm_orgs['CREATE_FUNDING_SOURCE']))}
${_('Fund Currency Type')}${_('Fund Source Currency Type')}
- +
- - - + + + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html index a66b86b59c..aee41d99d8 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html index 1266e63956..ee9078fab0 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- <%inherit file='../base.html'/> <%namespace file='../../common/widgets.html' name='widget'/> -<%def name="page_title()">${_('Evergreen Create Fund')} +<%def name="page_title()">${_('Create Fund Source')} <%def name="block_content()">
${_('Fund Name')}${_('Fund Owner')}${_('Fund Currency Type')}${_('Fund Source Name')}${_('Fund Source Owner')}${_('Fund Source Currency Type')}
- + - + - + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html index 518dc7b0b4..5a65f2c191 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html @@ -11,7 +11,7 @@ % endif
- ${_('Funds')} + ${_('Funds')} 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 3829fbe299..0a2fcbb025 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,11 +4,14 @@ Define some common widgets --> -<%def name='org_draw_node(node, indent=0, selected=None)'> +<%def name='org_draw_node(node, indent=0, selected=None, disable_depth=-1)'>
${_('Fund Name')}${_('Fund Source Name')} ${c.oils.acq.fund_source.name()}
${_('Fund Onwer')}${_('Fund Source Onwer')} ${c.oils.acq.fund_source.owner().name()}
${_('Fund Currency Type')}${_('Fund Source Currency Type')} ${c.oils.acq.fund_source.currency_type()}