From: erickson Date: Mon, 18 Feb 2008 16:55:07 +0000 (+0000) Subject: ContextItem()'s now retain the full object with a new .value attribute for storing... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7ddffd2e9391ed96fab274a371317e6af0abc62c;p=Evergreen.git ContextItem()'s now retain the full object with a new .value attribute for storing the value There is no longer the underscore postfix variable notation for storing the contextobject Got rid of the Util context in favor of direct module imports in the templates (less indirection) git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8762 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py index d320542a77..53b593dce4 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py @@ -79,7 +79,7 @@ class AcqContext(SubContext): self.picklist_entry_marc_html = ContextItem() def postinit(self): - self.prefix = "%s/acq" % Context.get_context().core.prefix + self.prefix.value = "%s/acq" % Context.get_context().core.prefix.value Context.apply_sub_context('acq', AcqContext) diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py index 020d69d129..10837074ba 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py @@ -14,7 +14,7 @@ class FundController(BaseController): def _retrieve_fund(self, r, ses, fund_id): ''' Retrieves a fund object with summary and fleshse the org field ''' fund = ses.request('open-ils.acq.fund.retrieve', - r.ctx.core.authtoken, fund_id, {"flesh_summary":1}).recv().content() + r.ctx.core.authtoken.value, fund_id, {"flesh_summary":1}).recv().content() Event.parse_and_raise(fund) fund.org(OrgUtil.get_org_unit(fund.org())) # flesh the org return fund @@ -22,17 +22,19 @@ class FundController(BaseController): def view(self, **kwargs): r = RequestMgr() - r.ctx.core.org_tree = OrgUtil.fetch_org_tree() + r.ctx.core.org_tree.value = OrgUtil.fetch_org_tree() fund_id = kwargs['id'] ses = ClientSession(oils.const.OILS_APP_ACQ) fund = ses.request('open-ils.acq.fund.retrieve', - r.ctx.core.authtoken, fund_id, + r.ctx.core.authtoken.value, fund_id, {"flesh_summary":1, 'flesh_allocations':1, 'flesh_allocation_sources':1}).recv().content() Event.parse_and_raise(fund) - fund.org(OrgUtil.get_org_unit(fund.org())) # flesh the org - r.ctx.acq.fund = fund + org_unit = OrgUtil.get_org_unit(fund.org()) + fund.org(org_unit) + + r.ctx.acq.fund.value = fund return r.render('acq/financial/view_fund.html') def list(self): @@ -40,11 +42,11 @@ class FundController(BaseController): ses = ClientSession(oils.const.OILS_APP_ACQ) funds = ses.request( 'open-ils.acq.fund.org.retrieve', - r.ctx.core.authtoken, None, {"flesh_summary":1}).recv().content() + r.ctx.core.authtoken.value, None, {"flesh_summary":1}).recv().content() Event.parse_and_raise(funds) for f in funds: f.org(OrgUtil.get_org_unit(f.org())) - r.ctx.acq.fund_list = funds + r.ctx.acq.fund_list.value = funds return r.render('acq/financial/list_funds.html') @@ -52,16 +54,16 @@ class FundController(BaseController): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) - if r.ctx.acq.fund_name: # create then display the fund + if r.ctx.acq.fund_name.value: # create then display the fund fund = osrf.net_obj.NetworkObject.acqf() - fund.name(r.ctx.acq.fund_name) - fund.org(r.ctx.acq.fund_org) - fund.year(r.ctx.acq.fund_year) - fund.currency_type(r.ctx.acq.fund_currency_type) + fund.name(r.ctx.acq.fund_name.value) + fund.org(r.ctx.acq.fund_org.value) + fund.year(r.ctx.acq.fund_year.value) + fund.currency_type(r.ctx.acq.fund_currency_type.value) fund_id = ses.request('open-ils.acq.fund.create', - r.ctx.core.authtoken, fund).recv().content() + r.ctx.core.authtoken.value, fund).recv().content() Event.parse_and_raise(fund_id) return redirect_to(controller='acq/fund', action='view', id=fund_id) @@ -71,8 +73,8 @@ class FundController(BaseController): types = ses.request( 'open-ils.acq.currency_type.all.retrieve', - r.ctx.core.authtoken).recv().content() - r.ctx.acq.currency_types = Event.parse_and_raise(types) + r.ctx.core.authtoken.value).recv().content() + r.ctx.acq.currency_types.value = Event.parse_and_raise(types) if tree is None: @@ -84,38 +86,38 @@ class FundController(BaseController): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) - if r.ctx.acq.fund_allocation_source: + if r.ctx.acq.fund_allocation_source.value: return self._allocate(r, ses) - fund = self._retrieve_fund(r, ses, r.ctx.acq.fund_id) + fund = self._retrieve_fund(r, ses, r.ctx.acq.fund_id.value) source_list = ses.request( 'open-ils.acq.funding_source.org.retrieve', - r.ctx.core.authtoken, None, {'limit_perm':'MANAGE_FUNDING_SOURCE', 'flesh_summary':1}).recv().content() + r.ctx.core.authtoken.value, None, {'limit_perm':'MANAGE_FUNDING_SOURCE', 'flesh_summary':1}).recv().content() Event.parse_and_raise(source_list) - r.ctx.acq.fund = fund - r.ctx.acq.fund_source_list = source_list + r.ctx.acq.fund.value = fund + r.ctx.acq.fund_source_list.value = source_list return r.render('acq/financial/create_fund_allocation.html') def _allocate(self, r, ses): ''' Create a new fund_allocation ''' alloc = osrf.net_obj.NetworkObject.acqfa() - alloc.funding_source(r.ctx.acq.fund_allocation_source) - alloc.fund(r.ctx.acq.fund_allocation_fund) + alloc.funding_source(r.ctx.acq.fund_allocation_source.value) + alloc.fund(r.ctx.acq.fund_allocation_fund.value) - if r.ctx.acq.fund_allocation_amount: - alloc.amount(r.ctx.acq.fund_allocation_amount) + if r.ctx.acq.fund_allocation_amount.value: + alloc.amount(r.ctx.acq.fund_allocation_amount.value) else: - alloc.percent(r.ctx.acq.fund_allocation_percent) - alloc.note(r.ctx.acq.fund_allocation_note) + alloc.percent(r.ctx.acq.fund_allocation_percent.value) + alloc.note(r.ctx.acq.fund_allocation_note.value) alloc_id = ses.request( - 'open-ils.acq.fund_allocation.create', r.ctx.core.authtoken, alloc).recv().content() + 'open-ils.acq.fund_allocation.create', r.ctx.core.authtoken.value, alloc).recv().content() Event.parse_and_raise(alloc_id) - return redirect_to(controller='acq/fund', action='view', id=r.ctx.acq.fund_allocation_fund) + return redirect_to(controller='acq/fund', action='view', id=r.ctx.acq.fund_allocation_fund.value) 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 6c2037dd34..8c9b0419e2 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund_source.py @@ -14,15 +14,15 @@ class FundSourceController(BaseController): def view(self, **kwargs): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) - r.ctx.core.org_tree = OrgUtil.fetch_org_tree() + r.ctx.core.org_tree.value = OrgUtil.fetch_org_tree() source = ses.request( 'open-ils.acq.funding_source.retrieve', - r.ctx.core.authtoken, kwargs.get('id'), {"flesh_summary":1}).recv().content() + r.ctx.core.authtoken.value, kwargs.get('id'), {"flesh_summary":1}).recv().content() Event.parse_and_raise(source) source.owner(OrgUtil.get_org_unit(source.owner())) # flesh the owner - r.ctx.acq.fund_source = source + r.ctx.acq.fund_source.value = source return r.render('acq/financial/view_fund_source.html') def list(self): @@ -31,10 +31,10 @@ class FundSourceController(BaseController): sources = ses.request( 'open-ils.acq.funding_source.org.retrieve', - r.ctx.core.authtoken, None, {"flesh_summary":1}).recv().content() + r.ctx.core.authtoken.value, None, {"flesh_summary":1}).recv().content() Event.parse_and_raise(sources) - r.ctx.acq.fund_source_list = sources + r.ctx.acq.fund_source_list.value = sources for source in sources: source.owner(OrgUtil.get_org_unit(source.owner())) @@ -45,25 +45,25 @@ class FundSourceController(BaseController): r = RequestMgr() fund_mgr = oilsweb.lib.acq.fund.FundMgr(r) - if r.ctx.acq.fund_source_name: + if r.ctx.acq.fund_source_name.value: source = osrf.net_obj.NetworkObject.acqfs() - source.name(r.ctx.acq.fund_source_name) - source.owner(r.ctx.acq.fund_source_owner) - source.currency_type(r.ctx.acq.fund_source_currency_type) + source.name(r.ctx.acq.fund_source_name.value) + source.owner(r.ctx.acq.fund_source_owner.value) + source.currency_type(r.ctx.acq.fund_source_currency_type.value) source_id = fund_mgr.create_fund_source(source) return redirect_to(controller='acq/fund_source', action='view', id=source_id) perm_orgs = ClientSession.atomic_request( 'open-ils.actor', 'open-ils.actor.user.work_perm.highest_org_set', - r.ctx.core.authtoken, 'CREATE_FUNDING_SOURCE'); + r.ctx.core.authtoken.value, 'CREATE_FUNDING_SOURCE'); if len(perm_orgs) == 0: return _("Insufficient Permissions") # XXX Return a perm failure template - r.ctx.core.perm_tree['CREATE_FUNDING_SOURCE'] = OrgUtil.get_union_tree(perm_orgs) - r.ctx.core.high_perm_orgs['CREATE_FUNDING_SOURCE'] = perm_orgs - r.ctx.acq.currency_types = fund_mgr.fetch_currency_types() + r.ctx.core.perm_tree.value['CREATE_FUNDING_SOURCE'] = OrgUtil.get_union_tree(perm_orgs) + r.ctx.core.high_perm_orgs.value['CREATE_FUNDING_SOURCE'] = perm_orgs + r.ctx.acq.currency_types.value = fund_mgr.fetch_currency_types() return r.render('acq/financial/create_fund_source.html') @@ -71,22 +71,22 @@ class FundSourceController(BaseController): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) - if r.ctx.acq.fund_source_credit_amount: + if r.ctx.acq.fund_source_credit_amount.value: credit = osrf.net_obj.NetworkObject.acqfscred() - credit.funding_source(r.ctx.acq.fund_source_id) - credit.amount(r.ctx.acq.fund_source_credit_amount) - credit.note(r.ctx.acq.fund_source_credit_note) + credit.funding_source(r.ctx.acq.fund_source_id.value) + credit.amount(r.ctx.acq.fund_source_credit_amount.value) + credit.note(r.ctx.acq.fund_source_credit_note.value) status = ses.request( 'open-ils.acq.funding_source_credit.create', - r.ctx.core.authtoken, credit).recv().content() + r.ctx.core.authtoken.value, credit).recv().content() status = Event.parse_and_raise(status) - return redirect_to(controller='acq/fund_source', action='view', id=r.ctx.acq.fund_source_id) + return redirect_to(controller='acq/fund_source', action='view', id=r.ctx.acq.fund_source_id.value) source = ses.request('open-ils.acq.funding_source.retrieve', - r.ctx.core.authtoken, r.ctx.acq.fund_source_id, {"flesh_summary":1}).recv().content() - r.ctx.acq.fund_source = Event.parse_and_raise(source) + r.ctx.core.authtoken.value, r.ctx.acq.fund_source_id.value, {"flesh_summary":1}).recv().content() + r.ctx.acq.fund_source.value = Event.parse_and_raise(source) source.owner(OrgUtil.get_org_unit(source.owner())) return r.render('acq/financial/create_funding_source_credit.html') diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py index 8b314422a2..6366cb964d 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py @@ -17,20 +17,20 @@ class PicklistController(BaseController): r = RequestMgr() pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id']) pl_manager.retrieve() - pl_manager.retrieve_entries(flesh_provider=True, offset=r.ctx.acq.offset, limit=r.ctx.acq.limit) - r.ctx.acq.picklist = pl_manager.picklist - r.ctx.acq.picklist_list = pl_manager.retrieve_list() + pl_manager.retrieve_entries(flesh_provider=True, offset=r.ctx.acq.offset.value, limit=r.ctx.acq.limit.value) + r.ctx.acq.picklist.value = pl_manager.picklist + r.ctx.acq.picklist_list.value = pl_manager.retrieve_list() return r.render('acq/picklist/view.html') def create(self, **kwargs): r = RequestMgr() - if r.ctx.acq.picklist_name: + if r.ctx.acq.picklist_name.value: picklist = osrf.net_obj.NetworkObject.acqpl() - picklist.name(r.ctx.acq.picklist_name) - picklist.owner(r.ctx.core.user.id()) + picklist.name(r.ctx.acq.picklist_name.value) + picklist.owner(r.ctx.core.user.value.id()) picklist_id = ClientSession.atomic_request( oils.const.OILS_APP_ACQ, - 'open-ils.acq.picklist.create', r.ctx.core.authtoken, picklist) + 'open-ils.acq.picklist.create', r.ctx.core.authtoken.value, picklist) Event.parse_and_raise(picklist_id) return redirect_to(controller='acq/picklist', action='view', id=picklist_id) return r.render('acq/picklist/create.html') @@ -41,30 +41,30 @@ class PicklistController(BaseController): entry = pl_manager.retrieve_entry(kwargs.get('id'), flesh=1, flesh_provider=True) pl_manager.id = entry.picklist() picklist = pl_manager.retrieve() - r.ctx.acq.picklist = pl_manager.picklist - r.ctx.acq.picklist_entry = entry - r.ctx.acq.picklist_entry_marc_html = oilsweb.lib.bib.marc_to_html(entry.marc()) + r.ctx.acq.picklist.value = pl_manager.picklist + r.ctx.acq.picklist_entry.value = entry + r.ctx.acq.picklist_entry_marc_html.value = oilsweb.lib.bib.marc_to_html(entry.marc()) return r.render('acq/picklist/view_entry.html') def list(self): r = RequestMgr() pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r) - r.ctx.acq.picklist_list = pl_manager.retrieve_list() + r.ctx.acq.picklist_list.value = pl_manager.retrieve_list() return r.render('acq/picklist/view_list.html') def search(self): r = RequestMgr() - r.ctx.acq.z39_sources = oilsweb.lib.acq.search.fetch_z39_sources(r.ctx) + r.ctx.acq.z39_sources.value = oilsweb.lib.acq.search.fetch_z39_sources(r.ctx) sc = {} - for data in r.ctx.acq.z39_sources.values(): + for data in r.ctx.acq.z39_sources.value.values(): for key, val in data['attrs'].iteritems(): sc[key] = val.get('label') or key - r.ctx.acq.search_classes = sc + r.ctx.acq.search_classes.value = sc keys = sc.keys() keys.sort() - r.ctx.acq.search_classes_sorted = keys + r.ctx.acq.search_classes_sorted.value = keys return r.render('acq/picklist/search.html') @@ -95,7 +95,7 @@ class PicklistController(BaseController): ses.connect() page = None - if r.ctx.acq.picklist_action == 'move_selected': + if r.ctx.acq.picklist_action.value == 'move_selected': page = self._move_selected(r, ses) if not page: @@ -106,20 +106,20 @@ class PicklistController(BaseController): def _move_selected(self, r, ses): ''' Moves the selected picklist entry's to the destination picklist ''' - for entry_id in r.ctx.acq.picklist_entry_id_list: + for entry_id in r.ctx.acq.picklist_entry_id_list.value: entry = ses.request( 'open-ils.acq.picklist_entry.retrieve', - r.ctx.core.authtoken, entry_id).recv().content() + r.ctx.core.authtoken.value, entry_id).recv().content() entry = Event.parse_and_raise(entry) - entry.picklist(r.ctx.acq.picklist_dest_id) + entry.picklist(r.ctx.acq.picklist_dest_id.value) status = ses.request( 'open-ils.acq.picklist_entry.update', - r.ctx.core.authtoken, entry).recv().content() + r.ctx.core.authtoken.value, entry).recv().content() Event.parse_and_raise(status) - return redirect_to(controller='acq/picklist', action='view', id=r.ctx.acq.picklist_dest_id) + return redirect_to(controller='acq/picklist', action='view', id=r.ctx.acq.picklist_dest_id.value) diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py index 7a3a5a7b03..770a04a55c 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py @@ -14,10 +14,10 @@ class ProviderController(BaseController): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) provider = ses.request('open-ils.acq.provider.retrieve', - r.ctx.core.authtoken, kwargs.get('id')).recv().content() + r.ctx.core.authtoken.value, kwargs.get('id')).recv().content() Event.parse_and_raise(provider) provider.owner(OrgUtil.get_org_unit(provider.owner())) - r.ctx.acq.provider = provider + r.ctx.acq.provider.value = provider return r.render('acq/financial/view_provider.html') @@ -25,15 +25,15 @@ class ProviderController(BaseController): r = RequestMgr() ses = ClientSession(oils.const.OILS_APP_ACQ) - if r.ctx.acq.provider_name: # create then display the provider + if r.ctx.acq.provider_name.value: # create then display the provider provider = NetworkObject.acqpro() - provider.name(r.ctx.acq.provider_name) - provider.owner(r.ctx.acq.provider_owner) - provider.currency_type(r.ctx.acq.provider_currency_type) + provider.name(r.ctx.acq.provider_name.value) + provider.owner(r.ctx.acq.provider_owner.value) + provider.currency_type(r.ctx.acq.provider_currency_type.value) provider_id = ses.request('open-ils.acq.provider.create', - r.ctx.core.authtoken, provider).recv().content() + r.ctx.core.authtoken.value, provider).recv().content() Event.parse_and_raise(provider_id) return redirect_to(controller='acq/provider', action='view', id=provider_id) @@ -43,8 +43,8 @@ class ProviderController(BaseController): types = ses.request( 'open-ils.acq.currency_type.all.retrieve', - r.ctx.core.authtoken).recv().content() - r.ctx.acq.currency_types = Event.parse_and_raise(types) + r.ctx.core.authtoken.value).recv().content() + r.ctx.acq.currency_types.value = Event.parse_and_raise(types) if tree is None: @@ -57,10 +57,10 @@ class ProviderController(BaseController): ses = ClientSession(oils.const.OILS_APP_ACQ) providers = ses.request( 'open-ils.acq.provider.org.retrieve', - r.ctx.core.authtoken, None, {"flesh_summary":1}).recv().content() + r.ctx.core.authtoken.value, None, {"flesh_summary":1}).recv().content() Event.parse_and_raise(providers) for f in providers: f.owner(OrgUtil.get_org_unit(f.owner())) - r.ctx.acq.provider_list = providers + r.ctx.acq.provider_list.value = providers return r.render('acq/financial/list_providers.html') diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py b/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py index 578806e0cb..66a03f208b 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py @@ -15,7 +15,7 @@ class AdminContext(SubContext): self.mode = ContextItem(default_value='view') self.prefix = ContextItem() def postinit(self): - self.prefix = "%s/admin" % Context.get_context().core.prefix + self.prefix.value = "%s/admin" % Context.get_context().core.prefix.value Context.apply_sub_context('adm', AdminContext) @@ -23,11 +23,11 @@ class AdminController(BaseController): def init(self, obj_type, obj_id=None): r = RequestMgr() - r.ctx.adm.object_class = obj_type - meta = r.ctx.adm.object_meta = oils.utils.idl.IDLParser.get_class(obj_type) + r.ctx.adm.object_class.value = obj_type + meta = r.ctx.adm.object_meta.value = oils.utils.idl.IDLParser.get_class(obj_type) if obj_id is not None: - r.ctx.adm.object = osrf.ses.ClientSession.atomic_request( + r.ctx.adm.object.value = osrf.ses.ClientSession.atomic_request( 'open-ils.cstore', 'open-ils.cstore.direct.%s.retrieve' % meta.fieldmapper.replace('::', '.'), obj_id) @@ -39,22 +39,22 @@ class AdminController(BaseController): def view(self, **kwargs): r = self.init(kwargs['type'], kwargs['id']) - r.ctx.adm.mode = 'view' + r.ctx.adm.mode.value = 'view' return r.render('admin/object.html') def update(self, **kwargs): r = self.init(kwargs['type'], kwargs['id']) - r.ctx.adm.mode = 'update' + r.ctx.adm.mode.value = 'update' return r.render('admin/object.html') def create(self, **kwargs): r = self.init(kwargs['type']) - r.ctx.adm.mode = 'create' + r.ctx.adm.mode.value = 'create' return r.render('admin/object.html') def delete(self, **kwargs): r = self.init(kwargs['type'], kwargs['id']) - r.ctx.adm.mode = 'delete' + r.ctx.adm.mode.value = 'delete' return r.render('admin/object.html') diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/base.py b/Open-ILS/web/oilsweb/oilsweb/controllers/base.py index 26b4bfb8ff..ee21fc69d3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/base.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/base.py @@ -9,7 +9,7 @@ log = logging.getLogger(__name__) class BaseContext(SubContext): def postinit(self): - self.prefix = "%s/base" % Context.get_context().core.prefix + self.prefixvalue = "%s/base" % Context.get_context().core.prefix.value Context.apply_sub_context('base', BaseContext) diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py index 1cb33627ed..6816481cf8 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/__init__.py @@ -28,26 +28,13 @@ class CoreContext(SubContext): self.perm_tree = ContextItem(default_value={}) def postinit(self): - self.prefix = pylons.config['oils_prefix'] - self.media_prefix = pylons.config['oils_media_prefix'] - self.ac_prefix = pylons.config['oils_added_content_prefix'] - self.skin = 'default' # XXX - self.theme = 'default' # XXX + self.prefix.value = pylons.config['oils_prefix'] + self.media_prefix.value = pylons.config['oils_media_prefix'] + self.ac_prefix.value = pylons.config['oils_added_content_prefix'] + self.skin.value = 'default' # XXX + self.theme.value = 'default' # XXX usermgr = oilsweb.lib.user.User(self) usermgr.fetch_user() #self.work_orgs = usermgr.fetch_work_orgs() Context.apply_sub_context('core', CoreContext) - - -class UtilContext(SubContext): - ''' The UtilContext maintains a set of general use functions ''' - 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.apply_sub_context('util', UtilContext) - - diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py index 0a6a1d8cdb..af5a4c2801 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py @@ -10,28 +10,28 @@ class FundMgr(object): def fetch_currency_types(self): types = self.ses.request( 'open-ils.acq.currency_type.all.retrieve', - self.request_mgr.ctx.core.authtoken).recv().content() + self.request_mgr.ctx.core.authtoken.value).recv().content() oils.event.Event.parse_and_raise(types) return types def retrieve(self, fund_id): fund = self.ses.request( 'open-ils.acq.fund.retrieve', - self.request_mgr.ctx.core.authtoken, fund_id).recv().content() + self.request_mgr.ctx.core.authtoken.value, fund_id).recv().content() oils.event.Event.parse_and_raise(fund) return fund def retrieve_org_funds(self, limit_perm=None): funds = self.ses.request( 'open-ils.acq.fund.org.retrieve', - self.request_mgr.ctx.core.authtoken, None, limit_perm).recv().content() + self.request_mgr.ctx.core.authtoken.value, None, limit_perm).recv().content() oils.event.Event.parse_and_raise(funds) return funds def create_fund(self, fund): fund_id = self.ses.request( 'open-ils.acq.fund.create', - self.request_mgr.ctx.core.authtoken, fund).recv().content() + self.request_mgr.ctx.core.authtoken.value, fund).recv().content() oils.event.Event.parse_and_raise(fund_id) return fund_id @@ -39,14 +39,14 @@ class FundMgr(object): def retrieve_fund_source(self, source_id): source = self.ses.request( 'open-ils.acq.funding_source.retrieve', - self.request_mgr.ctx.core.authtoken, source_id).recv().content() + self.request_mgr.ctx.core.authtoken.value, source_id).recv().content() oils.event.Event.parse_and_raise(source) return source def retrieve_org_fund_sources(self, options=None): sources = self.ses.request( 'open-ils.acq.funding_source.org.retrieve', - self.request_mgr.ctx.core.authtoken, None, options).recv().content() + self.request_mgr.ctx.core.authtoken.value, None, options).recv().content() oils.event.Event.parse_and_raise(sources) return sources @@ -54,14 +54,14 @@ class FundMgr(object): def create_fund_source(self, source): source_id = self.ses.request( 'open-ils.acq.funding_source.create', - self.request_mgr.ctx.core.authtoken, source).recv().content() + self.request_mgr.ctx.core.authtoken.value, source).recv().content() oils.event.Event.parse_and_raise(source_id) return source_id def create_allocation(self, alloc): alloc_id = self.ses.request( 'open-ils.acq.fund_allocation.create', - self.request_mgr.ctx.core.authtoken, alloc).recv().content() + self.request_mgr.ctx.core.authtoken.value, alloc).recv().content() oils.event.Event.parse_and_raise(alloc_id) return alloc_id diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py index 31e1a68b85..23ac6c5963 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py @@ -13,7 +13,7 @@ class PicklistMgr(object): def retrieve(self): picklist = self.ses.request( 'open-ils.acq.picklist.retrieve', - self.request_mgr.ctx.core.authtoken, self.id, {'flesh_entry_count':1}).recv().content() + self.request_mgr.ctx.core.authtoken.value, self.id, {'flesh_entry_count':1}).recv().content() oils.event.Event.parse_and_raise(picklist) self.picklist = picklist @@ -33,14 +33,14 @@ class PicklistMgr(object): picklist_id = picklist_id or self.id status = self.ses.request( 'open-ils.acq.picklist.delete', - self.request_mgr.ctx.core.authtoken, picklist_id).recv().content() + self.request_mgr.ctx.core.authtoken.value, picklist_id).recv().content() oils.event.Event.parse_and_raise(status) return status def delete_entry(self, entry_id): status = self.ses.request( 'open-ils.acq.picklist_entry.delete', - self.request_mgr.ctx.core.authtoken, entry_id).recv().content() + self.request_mgr.ctx.core.authtoken.value, entry_id).recv().content() oils.event.Event.parse_and_raise(status) return status @@ -49,7 +49,7 @@ class PicklistMgr(object): # grab the picklist entries entries = self.ses.request( 'open-ils.acq.picklist_entry.picklist.retrieve', - self.request_mgr.ctx.core.authtoken, + self.request_mgr.ctx.core.authtoken.value, self.picklist.id(), { "offset" : kwargs.get('offset'), @@ -64,7 +64,7 @@ class PicklistMgr(object): if entry.provider(): provider = self.ses.request( 'open-ils.acq.provider.retrieve', - self.request_mgr.ctx.core.authtoken, + self.request_mgr.ctx.core.authtoken.value, entry.provider()).recv().content() entry.provider(provider) @@ -74,7 +74,7 @@ class PicklistMgr(object): ''' Returns my list of picklist objects ''' list = self.ses.request( 'open-ils.acq.picklist.user.retrieve', - self.request_mgr.ctx.core.authtoken, {'flesh_entry_count':1}).recv().content() + self.request_mgr.ctx.core.authtoken.value, {'flesh_entry_count':1}).recv().content() oils.event.Event.parse_and_raise(list) usermgr = oilsweb.lib.user.User(self.request_mgr.ctx.core) @@ -95,13 +95,13 @@ class PicklistMgr(object): args = {'flesh': kwargs.get('flesh')} entry = self.ses.request( 'open-ils.acq.picklist_entry.retrieve', - self.request_mgr.ctx.core.authtoken, entry_id, args).recv().content() + self.request_mgr.ctx.core.authtoken.value, entry_id, args).recv().content() oils.event.Event.parse_and_raise(entry) if kwargs.get('flesh_provider'): if entry.provider(): provider = self.ses.request( 'open-ils.acq.provider.retrieve', - self.request_mgr.ctx.core.authtoken, + self.request_mgr.ctx.core.authtoken.value, entry.provider()).recv().content() entry.provider(provider) @@ -112,18 +112,18 @@ class PicklistMgr(object): # find and delete any existing picklist with the requested name data = self.ses.request( 'open-ils.acq.picklist.name.retrieve', - self.request_mgr.ctx.core.authtoken, pl_name).recv() + self.request_mgr.ctx.core.authtoken.value, pl_name).recv() if data: self.delete(data.content().id()) # create the new one picklist = osrf.net_obj.NetworkObject.acqpl() picklist.name(pl_name) - picklist.owner(self.request_mgr.ctx.core.user.id()) + picklist.owner(self.request_mgr.ctx.core.user.value.id()) picklist = self.ses.request( 'open-ils.acq.picklist.create', - self.request_mgr.ctx.core.authtoken, picklist).recv().content() + self.request_mgr.ctx.core.authtoken.value, picklist).recv().content() oils.event.Event.parse_and_raise(picklist) return picklist @@ -131,7 +131,7 @@ class PicklistMgr(object): def create_entry(self, entry): status = self.ses.request( 'open-ils.acq.picklist_entry.create', - self.request_mgr.ctx.core.authtoken, entry).recv().content() + self.request_mgr.ctx.core.authtoken.value, entry).recv().content() oils.event.Event.parse_and_raise(status) return status diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py b/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py index 0aa7b1f67d..3421010a2a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py @@ -12,12 +12,12 @@ def fetch_z39_sources(ctx): if _z_sources: return _z_sources _z_sources = osrf.ses.ClientSession.atomic_request( - oils.const.OILS_APP_SEARCH, EG_Z39_SOURCES, ctx.core.authtoken) + oils.const.OILS_APP_SEARCH, EG_Z39_SOURCES, ctx.core.authtoken.value) return _z_sources def multi_search(request_mgr, search): ses = osrf.ses.ClientSession(oils.const.OILS_APP_SEARCH) - req = ses.request(EG_Z39_SEARCH, request_mgr.ctx.core.authtoken, search) + req = ses.request(EG_Z39_SEARCH, request_mgr.ctx.core.authtoken.value, search) pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(request_mgr) picklist_id = pl_manager.create_or_replace("") @@ -45,18 +45,18 @@ def compile_multi_search(request_mgr): 'username' : [], 'password' : [], 'search' : {}, - 'limit' : request_mgr.ctx.acq.limit, - 'offset' : request_mgr.ctx.acq.offset + 'limit' : request_mgr.ctx.acq.limit.value, + 'offset' : request_mgr.ctx.acq.offset.value } # collect the sources and credentials - for src in request_mgr.ctx.acq.search_source: + for src in request_mgr.ctx.acq.search_source.value: search['service'].append(src) search['username'].append("") # XXX config values? in-db? search['password'].append("") # XXX config values? in-db? # collect the search classes - for cls in request_mgr.ctx.acq.search_class: + for cls in request_mgr.ctx.acq.search_class.value: if request_mgr.request.params[cls]: search['search'][cls] = request_mgr.request.params[cls] diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/context.py b/Open-ILS/web/oilsweb/oilsweb/lib/context.py index 5a4afd82af..6e91511088 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/context.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/context.py @@ -16,6 +16,7 @@ class ContextItem(object): self.qname = None self.multi = kwargs.get('multi') self.session = kwargs.get('session') + self.value = self.default_value class SubContext(object): ''' A SubContext is a class-specific context object that lives inside the global context object ''' @@ -43,7 +44,7 @@ class Context(object): q = '' for f in self._fields: if f.cgi_name and not f.session: - val = getattr(getattr(self, f.app), f.name) + val = f.value if val != f.default_value: if isinstance(val, list): for v in val: @@ -59,7 +60,7 @@ class Context(object): from oilsweb.lib.base import session for f in self._fields: if f.cgi_name and f.session: - val = getattr(getattr(self, f.app), f.name) + val = f.value if val is not None and val != f.default_value: session[f.cgi_name] = val @@ -97,29 +98,20 @@ class Context(object): # session cache, and finally see if the data is in a cookie. If # no data is found, use the default # ------------------------------------------------------------------- - set = False if item.cgi_name: if item.cgi_name in req.params: if item.multi: - setattr(getattr(c, app), name, req.params.getall(item.cgi_name)) + item.value = req.params.getall(item.cgi_name) else: - setattr(getattr(c, app), name, req.params[item.cgi_name]) - set = True + item.value = req.params[item.cgi_name] else: if item.session: if item.cgi_name in session: - setattr(getattr(c, app), name, session[item.cgi_name]) + item.value = session[item.cgi_name] set = True else: if item.cgi_name in req.cookies: - setattr(getattr(c, app), name, req.cookies[item.cgi_name]) - set = True - - if not set: - setattr(getattr(c, app), name, item.default_value) - - # store the metatdata at _ - setattr(getattr(c, app), "%s_" % name, item) + item.value = req.cookies[item.cgi_name] # run postinit after all contexts have been loaded for app in _subContexts.keys(): @@ -127,4 +119,3 @@ class Context(object): ctx.postinit() return c - diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/request.py b/Open-ILS/web/oilsweb/oilsweb/lib/request.py index eeb5e502c0..94c2b55ba7 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/request.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/request.py @@ -38,8 +38,8 @@ class RequestMgr(object): would be 'base/dashboard.html' ''' self.finalize() - self.ctx.core.page = tpath - return pylons.templating.render('oils/%s/%s' % (self.ctx.core.skin, tpath)) + self.ctx.core.page.value = tpath + return pylons.templating.render('oils/%s/%s' % (self.ctx.core.skin.value, tpath)) diff --git a/Open-ILS/web/oilsweb/oilsweb/lib/user.py b/Open-ILS/web/oilsweb/oilsweb/lib/user.py index 523da7171c..420131f0c4 100644 --- a/Open-ILS/web/oilsweb/oilsweb/lib/user.py +++ b/Open-ILS/web/oilsweb/oilsweb/lib/user.py @@ -21,63 +21,63 @@ class User(object): 'staff', pylons.config['oils_demo_workstation']) oils.event.Event.parse_and_raise(evt) - self.ctx.authtoken = evt['payload']['authtoken'] + self.ctx.authtoken.value = evt['payload']['authtoken'] def fetch_user(self): ''' Grab the logged in user and their workstation ''' - if not self.ctx.authtoken: + if not self.ctx.authtoken.value: self.try_auto_login() - if not self.ctx.authtoken: + if not self.ctx.authtoken.value: raise AuthException(_('No authentication token provided')) - self.ctx.user = osrf.ses.ClientSession.atomic_request( + self.ctx.user.value = osrf.ses.ClientSession.atomic_request( 'open-ils.auth', - 'open-ils.auth.session.retrieve', self.ctx.authtoken) + 'open-ils.auth.session.retrieve', self.ctx.authtoken.value) - evt = oils.event.Event.parse_event(self.ctx.user) + evt = oils.event.Event.parse_event(self.ctx.user.value) if evt and evt.text_code == 'NO_SESSION': - # our authtoken has timed out. See if we can autologin + # our authtoken.value has timed out. See if we can autologin self.try_auto_login() - if not self.ctx.authtoken: + if not self.ctx.authtoken.value: raise AuthException(_('No authentication token provided')) - self.ctx.user = osrf.ses.ClientSession.atomic_request( + self.ctx.user.value = osrf.ses.ClientSession.atomic_request( 'open-ils.auth', - 'open-ils.auth.session.retrieve', self.ctx.authtoken) - oils.event.Event.parse_and_raise(self.ctx.user) + 'open-ils.auth.session.retrieve', self.ctx.authtoken.value) + oils.event.Event.parse_and_raise(self.ctx.user.value) - self.ctx.workstation = oils.utils.csedit.CSEditor().retrieve_actor_workstation(self.ctx.user.wsid()) - if not self.ctx.workstation: + self.ctx.workstation.value = oils.utils.csedit.CSEditor().retrieve_actor_workstation(self.ctx.user.value.wsid()) + if not self.ctx.workstation.value: raise AuthException(_('No workstation found')) def fetch_work_orgs(self): work_orgs = osrf.ses.ClientSession.atomic_request( 'open-ils.actor', 'open-ils.actor.user.get_work_ous.ids', - self.ctx.authtoken) + self.ctx.authtoken.value) oils.event.Event.parse_and_raise(work_orgs) return work_orgs def highest_work_perm_set(self, perm): perm_orgs = osrf.ses.ClientSession.atomic_request( 'open-ils.actor', - 'open-ils.actor.user.work_perm.highest_org_set', self.ctx.authtoken, perm); - self.ctx.high_perm_orgs[perm] = perm_orgs + 'open-ils.actor.user.work_perm.highest_org_set', self.ctx.authtoken.value, perm); + self.ctx.high_perm_orgs.value[perm] = perm_orgs return perm_orgs def highest_work_perm_tree(self, perm): perm_orgs = self.highest_work_perm_set(perm) if len(perm_orgs) == 0: return None - self.ctx.perm_tree[perm] = oils.org.OrgUtil.get_union_tree(perm_orgs) - return self.ctx.perm_tree[perm] + self.ctx.perm_tree.value[perm] = oils.org.OrgUtil.get_union_tree(perm_orgs) + return self.ctx.perm_tree.value[perm] def fetch_user_setting(self, setting): setting = osrf.ses.ClientSession.atomic_request( oils.const.OILS_APP_ACTOR, 'open-ils.actor.patron.settings.retrieve', - self.ctx.authtoken, self.ctx.user.id(), setting) + self.ctx.authtoken.value, self.ctx.user.value.id(), setting) oils.event.Event.parse_and_raise(setting) return setting diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html index ac086c0a7d..58df3f704a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html @@ -24,7 +24,7 @@ <%def name='block_body_content()'/> <%def name='block_css()'> - - + + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html index b656485c06..546c20b914 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund.html @@ -5,29 +5,31 @@ <%def name="page_title()">${_('Create Fund')} <%def name="block_content()"> -
+<% from oils.org import OrgUtil %> + + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html index d6c6232bfe..a6e36d391a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_fund_allocation.html @@ -5,22 +5,22 @@ <%def name="page_title()">${_('Create Funding Allocation')} <%def name="block_content()"> - +
${_('Fund Name')} - +
${_('Fund Owner')} ${widget.org_select( - c.oils.acq.fund_org_.cgi_name, - c.oils.core.perm_tree['ADMIN_FUND'], c.oils.core.workstation.id(), - c.oils.util.get_min_org_depth(c.oils.core.high_perm_orgs['ADMIN_FUND']))} + c.oils.acq.fund_org.cgi_name, + c.oils.core.perm_tree.value['ADMIN_FUND'], c.oils.core.workstation.id(), + OrgUtil.get_min_depth.value(c.oils.core.high_perm_orgs['ADMIN_FUND']))}
${_('Fund Currency Type')} - + % for type in c.oils.acq.currency_types.value: % endfor @@ -36,7 +38,7 @@
${_('Fund Year')} - +
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 4a2b5f8d9b..dde12c4d8b 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 @@ -5,29 +5,31 @@ <%def name="page_title()">${_('Create Funding Source')} <%def name="block_content()"> - +<% from oils.org import OrgUtil %> + +
${_('Fund')} - - ${c.oils.acq.fund.name()} - ${c.oils.acq.fund.org().shortname()} + + ${c.oils.acq.fund.value.name()} + ${c.oils.acq.fund.value.org().shortname()}
${_('Funding Source')} - + % for source in c.oils.acq.fund_source_list.value: <% source_label = _('%(name)s (balance = %(b)s)') % {'name':source.name(), 'b': source.summary()['balance']} %> % endfor @@ -30,19 +30,19 @@
${_('Allocation Amount')} - +
${_('Allocation Percent')} - +
${_('Note')} - +
${_('Funding Source Name')} - +
${_('Funding Source Owner')} ${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.high_perm_orgs['CREATE_FUNDING_SOURCE']))} + c.oils.acq.fund_source_owner.cgi_name, + c.oils.core.perm_tree.value['CREATE_FUNDING_SOURCE'], c.oils.core.workstation.value.id(), + OrgUtil.get_min_depth(c.oils.core.high_perm_orgs.value['CREATE_FUNDING_SOURCE']))}
${_('Funding Source Currency Type')} - + % for type in c.oils.acq.currency_types.value: % endfor diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_funding_source_credit.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_funding_source_credit.html index 7a7549b36d..a2ca324136 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_funding_source_credit.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_funding_source_credit.html @@ -7,10 +7,10 @@ <%def name="page_title()">${_('Create Funding Source Credit')} <%def name="block_content()"> -<% source = c.oils.acq.fund_source %> +<% source = c.oils.acq.fund_source.value %> - - + + @@ -22,12 +22,12 @@ - + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html index f891bbc2f7..e46efa6875 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html @@ -5,29 +5,31 @@ <%def name="page_title()">${_('Create Provider')} <%def name="block_content()"> - +<% from oils.org import OrgUtil %> + +
${_('Amount')}
${_('Note')} - +
- % for source in c.oils.acq.fund_source_list: + % for source in c.oils.acq.fund_source_list.value: - + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html index 5dd22eee57..a0e5710e23 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html @@ -7,7 +7,7 @@ @@ -22,9 +22,9 @@ - % for fund in c.oils.acq.fund_list: + % for fund in c.oils.acq.fund_list.value: - + diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html index 82adb2c542..b1f45c0670 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html @@ -7,7 +7,7 @@ @@ -21,9 +21,9 @@ - % for provider in c.oils.acq.provider_list: + % for provider in c.oils.acq.provider_list.value: - + 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 4745c4abeb..aa5e2b3640 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,11 +1,11 @@ # -*- coding: utf-8 -*- 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 index 745b437d20..a39ac0d21a 100644 --- 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 @@ -4,12 +4,12 @@ <%def name="page_title()">${_('View Fund')} <%def name="block_content()"> -<% fund = c.oils.acq.fund %> +<% fund = c.oils.acq.fund.value %> 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 d2575fb847..8f12de9a99 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 @@ -4,12 +4,12 @@ <%def name="page_title()">${_('View Funding Source')} <%def name="block_content()"> -<% source = c.oils.acq.fund_source %> +<% source = c.oils.acq.fund_source.value %>
${source.name()}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html index 1c2ff873a6..aa856b0087 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html @@ -4,7 +4,7 @@ <%def name="page_title()">${_('View Provider')} <%def name="block_content()"> -<% provider = c.oils.acq.provider %> +<% provider = c.oils.acq.provider.value %>
${provider.name()}
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 76068dad23..07c9e4f37c 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 @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- -% if c.oils.core.page.startswith('acq/picklist'): +% if c.oils.core.page.value.startswith('acq/picklist'):
<%include file='picklist/navigate.html'/>
% endif -% if c.oils.core.page.startswith('acq/financial'): +% if c.oils.core.page.value.startswith('acq/financial'):
<%include file='financial/navigate.html'/>
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/create.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/create.html index f6d7e612f6..51c4933edb 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/create.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/create.html @@ -4,13 +4,13 @@ <%def name="page_title()">${_('Create Picklist')} <%def name="block_content()"> - +
${_('Provider Name')} - +
${_('Provider Owner')} ${widget.org_select( - c.oils.acq.provider_owner_.cgi_name, - c.oils.core.perm_tree['ADMIN_PROVIDER'], c.oils.core.workstation.id(), - c.oils.util.get_min_org_depth(c.oils.core.high_perm_orgs['ADMIN_PROVIDER']))} + c.oils.acq.provider_owner.cgi_name, + c.oils.core.perm_tree.value['ADMIN_PROVIDER'], c.oils.core.workstation.value.id(), + OrgUtil.get_min_depth(c.oils.core.high_perm_orgs.value['ADMIN_PROVIDER']))}
${_('Provider Currency Type')} - + % for type in c.oils.acq.currency_types.value: % endfor 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 3c71a6ecd9..789b8b3b9f 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 @@ -7,7 +7,7 @@ @@ -22,9 +22,9 @@
${source.name()}${source.name()} ${source.owner().name()} ${source.currency_type()} ${source.summary()['balance']}
${fund.name()}${fund.name()} ${fund.org().name()} ${fund.year()} ${fund.summary()['combined_balance']}
${provider.name()}${provider.name()} ${provider.owner().name()} ${provider.currency_type()}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.html index a082d1e09e..68893babfa 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.html @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_entry_summary.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_entry_summary.html index d9d0fef09d..ac71e855b9 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_entry_summary.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_entry_summary.html @@ -2,12 +2,12 @@ ${_('Picklist Entry')}
<% - provider = c.oils.acq.picklist_entry.provider() or '' + provider = c.oils.acq.picklist_entry.provider.value() or '' if provider: provider.name() - meta = _("Source %(data)s") % {"data":c.oils.acq.picklist_entry.source_label()} + meta = _("Source %(data)s") % {"data":c.oils.acq.picklist_entry.value.source_label()} meta2 = _("Provider %(data)s") % {"data":provider} - meta3 = _("Create date %(data)s") % {"data":c.oils.acq.picklist_entry.create_time()} - meta4 = _("Last update time %(data)s") % {"data":c.oils.acq.picklist_entry.edit_time()} + meta3 = _("Create date %(data)s") % {"data":c.oils.acq.picklist_entry.value.create_time()} + meta4 = _("Last update time %(data)s") % {"data":c.oils.acq.picklist_entry.value.edit_time()} %>
${meta}
${meta2}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_summary.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_summary.html index be617a2426..a775fad84d 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_summary.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/picklist_summary.html @@ -1,9 +1,9 @@
- ${_('Picklist')} ${c.oils.acq.picklist.name()} + ${_('Picklist')} ${c.oils.acq.picklist.value.name()}
<% - meta = _("Create date %(date)s") % {"date":c.oils.acq.picklist.create_time()} - meta2 = _("Last updated %(date)s") % {"date":c.oils.acq.picklist.edit_time()} + meta = _("Create date %(date)s") % {"date":c.oils.acq.picklist.value.create_time()} + meta2 = _("Last updated %(date)s") % {"date":c.oils.acq.picklist.value.edit_time()} %>
${meta}
${meta2}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html index 8195e328b8..b5c39e16da 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html @@ -3,19 +3,19 @@ <%def name="page_title()">${_('Evergreen Acquisitions Search')} <%def name="block_content()"> - +
${_('Search Sources')}
    -
  • ${_('Evergreen Catalog')}
  • ${_("Z39.50 Sources")}
      - % for src,cfg in c.oils.acq.z39_sources.iteritems(): + % for src,cfg in c.oils.acq.z39_sources.value.iteritems():
    • - + ${src} ${cfg["host"]}:${cfg["db"]} % if cfg['auth'] == 't': * @@ -30,19 +30,19 @@
      ${_('Search Fields')}
${_('Picklist Name')} - +
- % for cls in c.oils.acq.search_classes_sorted: + % for cls in c.oils.acq.search_classes_sorted.value: - + % endfor
${c.oils.acq.search_classes[cls]}${c.oils.acq.search_classes.value[cls]} - +
${_('Results Per Source')} - diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html index a786b32080..8b1141766c 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html @@ -8,8 +8,13 @@ <%include file='picklist_summary.html'/> - - +<% + import oilsweb.lib.bib + from oilsweb.lib.acq.picklist import PicklistMgr +%> + + + @@ -17,27 +22,27 @@
- % for entry in c.oils.acq.picklist.entries(): + % for entry in c.oils.acq.picklist.value.entries(): - + - % endfor diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_entry.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_entry.html index 89bacdb833..86265171d3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_entry.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_entry.html @@ -6,7 +6,7 @@ <%include file='picklist_summary.html'/> <%include file='picklist_entry_summary.html'/>
<% - c.oils.acq.offset = int(c.oils.acq.offset) - c.oils.acq.limit = int(c.oils.acq.limit) + c.oils.acq.offset.value = int(c.oils.acq.offset.value) + c.oils.acq.limit.value = int(c.oils.acq.limit.value) # set up the paging info paging = _('Entries %(offset)s - %(limit)s') % { - 'offset': c.oils.acq.offset + 1, - 'limit': c.oils.acq.limit + c.oils.acq.offset + 'offset': c.oils.acq.offset.value + 1, + 'limit': c.oils.acq.limit.value + c.oils.acq.offset.value } %> ${paging} - % if c.oils.acq.offset > 0: - « + % if c.oils.acq.offset.value > 0: + « % endif - » + » - - - % for list in c.oils.acq.picklist_list: + % for list in c.oils.acq.picklist_list.value: % endfor @@ -48,32 +53,32 @@
+ src='${c.oils.core.ac_prefix.value}/jacket/small/${oilsweb.lib.bib.scrub_isbn(PicklistMgr.find_entry_attr(entry, "isbn"))}'/> - ${c.oils.acq.find_entry_attr(entry, "title")} + ${PicklistMgr.find_entry_attr(entry, "title")} % if entry.provider(): ${entry.provider().name()} % endif
${c.oils.acq.find_entry_attr(entry, "author")} + ${PicklistMgr.find_entry_attr(entry, "author")}
- ${c.oils.acq.find_entry_attr(entry, "isbn")} | - ${c.oils.acq.find_entry_attr(entry, "pubdate")} | - ${c.oils.acq.find_entry_attr(entry, "pagination")} - ${_('Delete')} + ${PicklistMgr.find_entry_attr(entry, "isbn")} | + ${PicklistMgr.find_entry_attr(entry, "pubdate")} | + ${PicklistMgr.find_entry_attr(entry, "pagination")} + ${_('Delete')}
- % for attr in c.oils.acq.picklist_entry.attributes(): + % for attr in c.oils.acq.picklist_entry.value.attributes(): - % for picklist in c.oils.acq.picklist_list: + % for picklist in c.oils.acq.picklist_list.value: - + - + % endfor diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/navigate.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/navigate.html index fbbc9c5693..b860b865d7 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/navigate.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/navigate.html @@ -1,17 +1,17 @@ - ${_('Search')} + ${_('Search')} -% if c.oils.adm.mode != 'create' and c.oils.core.page != 'admin/index.html': +% if c.oils.adm.mode.value != 'create' and c.oils.core.page.value != 'admin/index.html': - ${_('Create')} + ${_('Create')} - % if c.oils.adm.mode != 'update': + % if c.oils.adm.mode.value != 'update': - ${_('Update')} + ${_('Update')} % endif - ${_('Delete')} + ${_('Delete')} % endif diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/object.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/object.html index dee4f1eb33..1d07182157 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/object.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/object.html @@ -4,31 +4,31 @@ <%def name="page_title()">${_('Evergreen Admin')} <%def name="block_content()"> -
${c.oils.adm.object_meta.label}
- % if c.oils.adm.mode == 'delete': +
${c.oils.adm.object_meta.value.label}
+ % if c.oils.adm.mode.value == 'delete':
<% ## Why does doing this inline (inside ${...}) give me a syntax error???? - string = _("Are you sure you want to delete %(cls)s with id %(id)d?") % {"cls":c.oils.adm.object_class, "id":c.oils.adm.object.id()} + string = _("Are you sure you want to delete %(cls)s with id %(id)d?") % {"cls":c.oils.adm.object_class.value, "id":c.oils.adm.object.value.id()} %> ${string}
% else:
${attr.attr_name()} @@ -20,7 +20,7 @@
- ${unicode(c.oils.acq.picklist_entry_marc_html, 'utf-8')} + ${unicode(c.oils.acq.picklist_entry_marc_html.value, 'utf-8')}
diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html index 433fc32b81..1280f1314c 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html @@ -6,7 +6,7 @@
${_('My Picklists')}
@@ -22,13 +22,13 @@
${picklist.name()}${picklist.name()} ${picklist.create_time()} ${picklist.edit_time()} ${picklist.entry_count()}${_('Delete')}${_('Delete')}
- % for fieldmeta in [ f for f in c.oils.adm.object_meta.fields if not f.virtual]: + % for fieldmeta in [ f for f in c.oils.adm.object_meta.value.fields if not f.virtual]:
${fieldmeta.label} - % if c.oils.adm.mode == 'update': + % if c.oils.adm.mode.value == 'update': (${fieldmeta.rpt_datatype}) - ${widget.load(fieldmeta.rpt_datatype,fieldmeta.name, getattr(c.oils.adm.object, fieldmeta.name)())} + ${widget.load(fieldmeta.rpt_datatype,fieldmeta.name, getattr(c.oils.adm.object.value, fieldmeta.name)())} % else: - % if c.oils.adm.mode == 'create': + % if c.oils.adm.mode.value == 'create': % else: - % if c.oils.adm.mode == 'view': - ${unicode(getattr(c.oils.adm.object, fieldmeta.name)())} + % if c.oils.adm.mode.value == 'view': + ${unicode(getattr(c.oils.adm.object.value, fieldmeta.name)())} % endif % endif % endif 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 89dbb18d0e..19dd43cdea 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 @@ -1,15 +1,19 @@ - + + <%def name='org_draw_node(node, indent=0, selected=None, disable_depth=-1)'> + <% import oils.org %>