[open-ils-commits] SPAM: r8608 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib 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
Mon Feb 4 13:17:07 EST 2008
Author: erickson
Date: 2008-02-04 12:48:50 -0500 (Mon, 04 Feb 2008)
New Revision: 8608
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
Log:
repaired some labels. gave org-tree widget ability to disable orgs below a certain depth, plugged in some fund source permission checks
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py 2008-02-04 17:48:50 UTC (rev 8608)
@@ -38,7 +38,19 @@
source_id = fund_mgr.create_fund_source(source)
return redirect_to(controller='acq/fund_source', action='view', id=source_id)
+ 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()
- r.ctx.core.org_tree = oils.org.OrgUtil.fetch_org_tree()
return r.render('acq/financial/create_fund_source.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-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py 2008-02-04 17:48:50 UTC (rev 8608)
@@ -28,6 +28,12 @@
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 @@
'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 @@
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)
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_source.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -1,27 +1,30 @@
# -*- coding: utf-8 -*-
+<!-- vim:set filetype=mako: -->
<%inherit file='../base.html'/>
<%namespace file='../../common/widgets.html' name='widget'/>
-<%def name="page_title()">${_('Evergreen Create Fund')}</%def>
+<%def name="page_title()">${_('Create Fund Source')}</%def>
<%def name="block_content()">
<form action='${c.oils.acq.prefix}/fund_source/create' method='POST'>
<table class='oils-admin-table'>
<tbody>
<tr>
- <td class='oils-admin-label'>${_('Fund Name')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Name')}</td>
<td>
<input type='text' size='42' name='${c.oils.acq.fund_source_name_.cgi_name}'/>
</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Onwer')}</td>
<td>
- ${widget.org_select(c.oils.acq.fund_source_owner_.cgi_name)}
- <b>* ADD PERM FILTER HERE *</b>
+ ${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']))}
</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Currency Type')}</td>
<td>
<select name='${c.oils.acq.fund_source_currency_type_.cgi_name}'>
% for type in c.oils.acq.currency_types:
@@ -32,7 +35,7 @@
</tr>
<tr>
<td colspan='2'>
- <input type='submit' value='${_("Create Fund")}'/>
+ <input type='submit' value='${_("Create Fund Source")}'/>
</td>
</tr>
</tbody>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_fund_sources.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -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>
+<%def name="page_title()">${_('Create Fund Source')}</%def>
<%def name="block_content()">
<table class='oils-admin-table'>
<thead>
<tr>
- <td>${_('Fund Name')}</td>
- <td>${_('Fund Owner')}</td>
- <td>${_('Fund Currency Type')}</td>
+ <td>${_('Fund Source Name')}</td>
+ <td>${_('Fund Source Owner')}</td>
+ <td>${_('Fund Source Currency Type')}</td>
</tr>
</thead>
<tbody>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/navigate.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
<div class='oils-base-navigate-item'>
- <a href='${c.oils.core.prefix}/acq/fund_source/list'>${_('My Fund Sources')}</a>
+ <a href='${c.oils.core.prefix}/acq/fund_source/list'>${_('Fund Sources')}</a>
</div>
<div class='oils-base-navigate-item'>
- <a href='${c.oils.core.prefix}/acq/fund_source/create'>${_('Create Fund Source')}</a>
+ <a href='${c.oils.core.prefix}/acq/fund_source/create'>${_('New Fund Source')}</a>
</div>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund_source.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -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>
+<%def name="page_title()">${_('Create Fund Source')}</%def>
<%def name="block_content()">
<form action='${c.oils.acq.prefix}/fund_source/create' method='POST'>
<table class='oils-admin-table'>
<tbody>
<tr>
- <td class='oils-admin-label'>${_('Fund Name')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Name')}</td>
<td>${c.oils.acq.fund_source.name()}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Onwer')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Onwer')}</td>
<td>${c.oils.acq.fund_source.owner().name()}</td>
</tr>
<tr>
- <td class='oils-admin-label'>${_('Fund Currency Type')}</td>
+ <td class='oils-admin-label'>${_('Fund Source Currency Type')}</td>
<td>${c.oils.acq.fund_source.currency_type()}</td>
</tr>
</tbody>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html 2008-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -11,7 +11,7 @@
</div>
% endif
<div class='oils-base-navigate-item'>
- <a href='${c.oils.core.prefix}/acq/fundsource/list'>${_('Funds')}</a>
+ <a href='${c.oils.core.prefix}/acq/fund_source/list'>${_('Funds')}</a>
<!--
<a href='${c.oils.core.prefix}/acq/fund/list'>${_('Funds')}</a>
-->
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-02-04 16:48:55 UTC (rev 8607)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html 2008-02-04 17:48:50 UTC (rev 8608)
@@ -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)'>
<option value='${node.id()}'
% if selected == node.id():
selected='selected'
- %endif
+ % endif
+ % if c.oils.util.get_org_type(node).depth() < disable_depth:
+ disabled='disabled'
+ % endif
>
% for i in range(indent):
  
@@ -22,7 +25,7 @@
</%def>
-<%def name='org_select(select_name, tree=None, selected=None)'>
+<%def name='org_select(select_name, tree=None, selected=None, disable_depth=-1)'>
<!-- Draws a select dropdown of the org tree provided
with indentation based on org depth -->
<%
@@ -30,6 +33,6 @@
tree = c.oils.core.org_tree
%>
<select name='${select_name}'>
- ${org_draw_node(tree, 0, selected)}
+ ${org_draw_node(tree, 0, selected, disable_depth)}
</select>
</%def>
More information about the open-ils-commits
mailing list