[open-ils-commits] r8758 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq templates/oils/default/acq/financial
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 15 14:42:13 EST 2008
Author: erickson
Date: 2008-02-15 14:12:28 -0500 (Fri, 15 Feb 2008)
New Revision: 8758
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html
Log:
adding provider files
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-02-15 19:12:28 UTC (rev 8758)
@@ -0,0 +1,66 @@
+from oilsweb.lib.base import *
+from oilsweb.lib.request import RequestMgr
+from osrf.ses import ClientSession
+from osrf.net_obj import NetworkObject
+from oils.event import Event
+from oils.org import OrgUtil
+from oilsweb.lib.user import User
+import oils.const
+
+
+class ProviderController(BaseController):
+
+ def view(self, **kwargs):
+ 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()
+ Event.parse_and_raise(provider)
+ provider.owner(OrgUtil.get_org_unit(provider.owner()))
+ r.ctx.acq.provider = provider
+ return r.render('acq/financial/view_provider.html')
+
+
+ def create(self):
+ r = RequestMgr()
+ ses = ClientSession(oils.const.OILS_APP_ACQ)
+
+ if r.ctx.acq.provider_name: # 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_id = ses.request('open-ils.acq.provider.create',
+ r.ctx.core.authtoken, provider).recv().content()
+ Event.parse_and_raise(provider_id)
+
+ return redirect_to(controller='acq/provider', action='view', id=provider_id)
+
+ usermgr = User(r.ctx.core)
+ tree = usermgr.highest_work_perm_tree('ADMIN_PROVIDER')
+
+ 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)
+
+
+ if tree is None:
+ return _("Insufficient Permissions") # XXX Return a perm failure template
+
+ return r.render('acq/financial/create_provider.html')
+
+ def list(self):
+ r = RequestMgr()
+ 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()
+ Event.parse_and_raise(providers)
+ for f in providers:
+ f.owner(OrgUtil.get_org_unit(f.owner()))
+ r.ctx.acq.provider_list = providers
+ return r.render('acq/financial/list_providers.html')
+
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/create_provider.html 2008-02-15 19:12:28 UTC (rev 8758)
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+<!-- vim:set filetype=mako: -->
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Create Provider')}</%def>
+<%def name="block_content()">
+
+<form action='${c.oils.acq.prefix}/provider/create' method='POST'>
+ <table class='oils-admin-table'>
+ <tbody>
+ <tr>
+ <td class='oils-admin-label'>${_('Provider Name')}</td>
+ <td>
+ <input type='text' size='42' name='${c.oils.acq.provider_name_.cgi_name}'/>
+ </td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Provider Owner')}</td>
+ <td>
+ ${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']))}
+ </td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Provider Currency Type')}</td>
+ <td>
+ <select name='${c.oils.acq.provider_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 Provider")}'/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</form>
+</%def>
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_providers.html 2008-02-15 19:12:28 UTC (rev 8758)
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('Providers')}</%def>
+<%def name="block_content()">
+
+<div id='oils-acq-list-header' class='container'>
+ <div id='oils-acq-list-header-label'>${_('Providers')}</div>
+ <div id='oils-acq-list-header-create'>
+ <a href='${c.oils.acq.prefix}/provider/create'>${_('New Provider')}</a>
+ </div>
+</div>
+
+
+<table class='oils-admin-table'>
+ <thead>
+ <tr>
+ <td>${_('Name')}</td>
+ <td>${_('Owner')}</td>
+ <td>${_('Currency Type')}</td>
+ </tr>
+ </thead>
+ <tbody>
+ % for provider in c.oils.acq.provider_list:
+ <tr>
+ <td><a href='${c.oils.acq.prefix}/provider/view/${provider.id()}'>${provider.name()}</a></td>
+ <td>${provider.owner().name()}</td>
+ <td>${provider.currency_type()}</td>
+ </tr>
+ %endfor
+ </tbody>
+</table>
+</%def>
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_provider.html 2008-02-15 19:12:28 UTC (rev 8758)
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget'/>
+<%def name="page_title()">${_('View Provider')}</%def>
+<%def name="block_content()">
+
+<% provider = c.oils.acq.provider %>
+
+<div id='oils-acq-list-header' class='container'>
+ <div id='oils-acq-list-header-label'>${provider.name()}</div>
+</div>
+
+<table class='oils-admin-table'>
+ <tbody>
+ <tr>
+ <td class='oils-admin-label'>${_('Owner')}</td>
+ <td>${provider.owner().name()}</td>
+ </tr>
+ <tr>
+ <td class='oils-admin-label'>${_('Currency')}</td>
+ <td>${provider.currency_type()}</td>
+ </tr>
+ </tbody>
+</table>
+</%def>
More information about the open-ils-commits
mailing list