[open-ils-commits] SPAM: r10006 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers controllers/acq lib templates/oils/default
templates/oils/default/acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 9 17:01:05 EDT 2008
Author: erickson
Date: 2008-07-09 17:01:02 -0400 (Wed, 09 Jul 2008)
New Revision: 10006
Removed:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq_admin.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/admin.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/admin/
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/funding_source.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/menu.html
Log:
deleted a pile of old test python code.
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,5 +1,4 @@
from oilsweb.lib.context import Context, SubContext, ContextItem
-import oilsweb.lib.acq.picklist
# ----------------------------------------------------------------
# Define the CGI params for this application
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,7 +1,7 @@
from oilsweb.lib.base import *
import pylons
from oilsweb.lib.request import RequestMgr
-import oilsweb.lib.acq.fund, oilsweb.lib.user
+import oilsweb.lib.user
import osrf.net_obj
import oils.const
from osrf.ses import ClientSession
@@ -11,15 +11,6 @@
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.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
-
-
def view(self, **kwargs):
r = RequestMgr()
r.ctx.acq.fund_id = kwargs['id']
@@ -28,74 +19,4 @@
def list(self):
return RequestMgr().render('acq/financial/list_funds.html')
- def create(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- 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.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.value, fund).recv().content()
- Event.parse_and_raise(fund_id)
-
- return redirect_to(controller='acq/fund', action='view', id=fund_id)
-
- usermgr = oilsweb.lib.user.User(r.ctx.core)
- tree = usermgr.highest_work_perm_tree('ADMIN_FUND')
-
- types = ses.request(
- 'open-ils.acq.currency_type.all.retrieve',
- r.ctx.core.authtoken.value).recv().content()
- r.ctx.acq.currency_types.value = Event.parse_and_raise(types)
-
-
- if tree is None:
- return _("Insufficient Permissions") # XXX Return a perm failure template
-
- return r.render('acq/financial/create_fund.html')
-
- def allocate(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
-
- if r.ctx.acq.fund_allocation_source.value:
- return self._allocate(r, ses)
-
- fund = self._retrieve_fund(r, ses, r.ctx.acq.fund_id.value)
-
- source_list = ses.request(
- 'open-ils.acq.funding_source.org.retrieve.atomic',
- 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.value = fund
- r.ctx.acq.funding_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.value)
- alloc.fund(r.ctx.acq.fund_allocation_fund.value)
-
- 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.value)
- alloc.note(r.ctx.acq.fund_allocation_note.value)
-
- alloc_id = ses.request(
- '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.value)
-
-
-
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/funding_source.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/funding_source.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/funding_source.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,14 +1,12 @@
from oilsweb.lib.base import *
import pylons
from oilsweb.lib.request import RequestMgr
-import oilsweb.lib.acq.fund
import osrf.net_obj
import oils.const
from osrf.ses import ClientSession
from oils.event import Event
from oils.org import OrgUtil
-
class FundingSourceController(BaseController):
def view(self, **kwargs):
@@ -19,53 +17,4 @@
def list(self):
return RequestMgr().render('acq/financial/list_funding_sources.html')
- def create(self):
- r = RequestMgr()
- fund_mgr = oilsweb.lib.acq.fund.FundMgr(r)
-
- if r.ctx.acq.funding_source_name.value:
- source = osrf.net_obj.NetworkObject.acqfs()
- source.name(r.ctx.acq.funding_source_name.value)
- source.owner(r.ctx.acq.funding_source_owner.value)
- source.currency_type(r.ctx.acq.funding_source_currency_type.value)
- source_id = fund_mgr.create_funding_source(source)
- return redirect_to(controller='acq/funding_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.value, 'CREATE_FUNDING_SOURCE');
-
- if len(perm_orgs) == 0:
- return _("Insufficient Permissions") # XXX Return a perm failure template
-
- 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_funding_source.html')
-
-
- def create_credit(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
-
- if r.ctx.acq.funding_source_credit_amount.value:
-
- credit = osrf.net_obj.NetworkObject.acqfscred()
- credit.funding_source(r.ctx.acq.funding_source_id.value)
- credit.amount(r.ctx.acq.funding_source_credit_amount.value)
- credit.note(r.ctx.acq.funding_source_credit_note.value)
-
- status = ses.request(
- 'open-ils.acq.funding_source_credit.create',
- r.ctx.core.authtoken.value, credit).recv().content()
- status = Event.parse_and_raise(status)
- return redirect_to(controller='acq/funding_source', action='view', id=r.ctx.acq.funding_source_id.value)
-
- source = ses.request('open-ils.acq.funding_source.retrieve',
- r.ctx.core.authtoken.value, r.ctx.acq.funding_source_id.value, {"flesh_summary":1}).recv().content()
- r.ctx.acq.funding_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')
-
-
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -10,11 +10,7 @@
from osrf.ses import ClientSession
from oils.event import Event
from oils.org import OrgUtil
-
from oilsweb.lib.request import RequestMgr
-from oilsweb.lib.acq.fund import FundMgr
-from oilsweb.lib.acq.picklist import PicklistMgr
-from oilsweb.lib.acq import provider_mgr
class PicklistController(BaseController):
@@ -23,67 +19,6 @@
r.ctx.acq.picklist.value = kwargs['id']
return r.render('acq/picklist/view.html')
- def create(self, **kwargs):
- r = RequestMgr()
- if r.ctx.acq.picklist_name.value:
- picklist = osrf.net_obj.NetworkObject.acqpl()
- 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.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')
-
- def view_lineitem(self, **kwargs):
- r = RequestMgr()
- pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r)
- fmgr = FundMgr(r)
- lineitem = pl_manager.retrieve_lineitem(kwargs.get('id'),
- flesh_attrs=1,
- flesh_provider=1,
- flesh_li_details=1)
- pl_manager.id = lineitem.picklist()
- picklist = pl_manager.retrieve()
- r.ctx.acq.picklist.value = pl_manager.picklist
- r.ctx.acq.lineitem.value = lineitem
- r.ctx.acq.lineitem_marc_html.value = oilsweb.lib.bib.marc_to_html(lineitem.marc())
-
- r.ctx.acq.provider_list.value = provider_mgr.list(r)
- r.ctx.acq.fund_list.value = fmgr.retrieve_org_funds()
-
- return r.render('acq/picklist/view_lineitem.html')
-
-
- def json(self, **kwargs):
- r = RequestMgr()
- pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id'])
- pl_manager.retrieve()
- pl_manager.retrieve_lineitems(flesh_provider=True,
- sort_attr="author",
- sort_dir="asc")
-
- items = []
- for title in pl_manager.picklist.entries():
- label = ''.join(PicklistMgr.find_lineitem_attr(title, x) for x in ("title", "publisher", "pubdate", "pagination", "isbn", "price"))
- item = {
- 'id': title.id(),
- 'copies': title.item_count(),
- 'title': PicklistMgr.find_lineitem_attr(title, "title"),
- 'isbn': PicklistMgr.find_lineitem_attr(title, "isbn"),
- 'price': PicklistMgr.find_lineitem_attr(title, "price"),
- 'provider': PicklistMgr.find_lineitem_attr(title, "provider"),
- 'label': label
- }
- items.append(item)
-
- pylons.response.headers["Content-type"] = "text/x-json"
- return simplejson.dumps({'identifier': 'id',
- 'label': 'label',
- 'items': items
- })
-
def list(self):
r = RequestMgr()
return r.render('acq/picklist/view_list.html')
@@ -96,147 +31,4 @@
r = RequestMgr()
return r.render('acq/picklist/bib_search.html')
- def delete(self, **kwargs):
- r = RequestMgr()
- pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id'])
- pl_manager.delete()
- return redirect_to(controller='acq/picklist', action='list')
-
-
- def delete_lineitem(self, **kwargs):
- r = RequestMgr()
- pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r)
- lineitem_id = kwargs['id']
- lineitem = pl_manager.retrieve_lineitem(lineitem_id)
- pl_manager.delete_lineitem(lineitem_id)
- return redirect_to(controller='acq/picklist', action='view', id=lineitem.picklist())
-
- def update(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- ses.connect()
- page = None
-
- if r.ctx.acq.lineitem_id:
- page = self._update_lineitem_count(r, ses)
- elif r.ctx.acq.picklist_action.value == 'move_selected':
- page = self._move_selected(r, ses)
-
- if not page:
- page = redirect_to(controller='acq/picklist', action='list')
-
- ses.disconnect()
- return page
-
- def update_lineitem(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- ses.connect()
-
- if r.ctx.acq.lineitem_detail_id.value:
- # update fund assignment, etc
- detail = ses.request('open-ils.acq.lineitem_detail.retrieve',
- r.ctx.core.authtoken.value,
- r.ctx.acq.lineitem_detail_id.value).recv().content()
- detail = Event.parse_and_raise(detail)
-
- # Update all the fields that are editable via the form
- detail.fund(r.ctx.acq.fund_id.value)
-
- detail = ses.request('open-ils.acq.lineitem_detail.update',
- r.ctx.core.authtoken.value,
- detail).recv().content()
- Event.parse_and_raise(detail)
- elif r.ctx.acq.provider_id.value:
- lineitem = ses.request('open-ils.acq.lineitem.retrieve',
- r.ctx.core.authtoken.value,
- r.ctx.acq.lineitem_id.value).recv().content()
- lineitem = Event.parse_and_raise(lineitem)
-
- lineitem.provider(r.ctx.acq.provider_id.value)
- lineitem = ses.request('open-ils.acq.lineitem.update',
- r.ctx.core.authtoken.value,
- lineitem).recv().content()
- Event.parse_and_raise(lineitem)
-
- return redirect_to(controller='acq/picklist', action='view_lineitem',
- id=r.ctx.acq.lineitem_id.value)
-
- def approve_lineitem(self):
- r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- ses.connect
-
- li = ses.request('open-ils.acq.lineitem.retrieve',
- r.ctx.core.authtoken.value,
- r.ctx.acq.lineitem_id.value).Recv().content()
- li = Event.parse_and_raise(li)
-
- li.state("approved")
-
- li = ses.request('open-ils.acq.lineitem.update',
- r.ctx.core.authtoken.value,
- li).recv().content()
- li = Event.parse_and_raise(li)
-
- return redirect_to(controller='acq/picklist', action='view',
- id=r.ctx.acq.picklist_id.value)
-
- def _update_lineitem_count(self, r, ses):
- ''' Updates # of copies to order for single lineitem '''
-
- picklist_id = r.ctx.acq.picklist_source_id.value
- lineitem_id = r.ctx.acq.lineitem_id.value
- new_count = int(r.ctx.acq.lineitem_item_count.value)
-
- lineitem = ses.request('open-ils.acq.lineitem.retrieve',
- r.ctx.core.authtoken.value,
- lineitem_id, {'flesh_li_details':1}).recv().content()
- lineitem = Event.parse_and_raise(lineitem)
-
- # Make sure the lineitem count is correct.
- lineitem.item_count(len(lineitem.lineitem_details()))
-
- # Can't remove detail records yet
- assert (lineitem.item_count() <= new_count), "Can't delete detail records"
-
- for i in range(new_count - lineitem.item_count()):
- detail = osrf.net_obj.NetworkObject.acqlid()
- detail.lineitem(lineitem.id())
- detail = ses.request('open-ils.acq.lineitem_detail.create',
- r.ctx.core.authtoken.value,
- detail, dict())
- Event.parse_and_raise(detail)
-
- if (lineitem.item_count() != new_count):
- # Update the number of detail records
- lineitem.item_count(new_count)
-
- lineitem = ses.request('open-ils.acq.lineitem.update',
- r.ctx.core.authtoken.value, lineitem)
- Event.parse_and_raise(lineitem)
-
- # fail()
- return redirect_to(controller='acq/picklist', action='view',
- id=picklist_id)
-
- def _move_selected(self, r, ses):
- ''' Moves the selected picklist lineitem's to the destination picklist '''
- for lineitem_id in r.ctx.acq.lineitem_id_list.value:
-
- lineitem = ses.request(
- 'open-ils.acq.lineitem.retrieve',
- r.ctx.core.authtoken.value, lineitem_id).recv().content()
- lineitem = Event.parse_and_raise(lineitem)
-
- lineitem.picklist(r.ctx.acq.picklist_dest_id.value)
-
- status = ses.request(
- 'open-ils.acq.lineitem.update',
- r.ctx.core.authtoken.value, lineitem).recv().content()
- Event.parse_and_raise(status)
-
- return redirect_to(controller='acq/picklist', action='view',
- id=r.ctx.acq.picklist_dest_id.value)
-
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,6 +1,5 @@
from oilsweb.lib.base import *
from oilsweb.lib.request import RequestMgr
-from oilsweb.lib.acq import provider_mgr
import oilsweb.lib.user
import osrf.net_obj
import oils.const
@@ -8,25 +7,9 @@
from oils.event import Event
from oils.org import OrgUtil
import mx.DateTime.ISO
-import oilsweb.lib.acq.po_manager
-from oilsweb.lib.acq.picklist import PicklistMgr
-from oilsweb.lib.acq.fund import FundMgr
class PoController(BaseController):
- # Render list of Purchase Orders
- def list(self, **kwargs):
- r = RequestMgr()
- po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r)
- po_list = po_mgr.retrieve_po_list()
- provider_map = dict()
- for po in po_list:
- if not (po.provider() in provider_map):
- provider_map[po.provider()] = provider_mgr.retrieve(r, po.provider()).name()
- po.provider(provider_map[po.provider()])
- r.ctx.acq.po_list.value = po_list
- return r.render('acq/po/view_po_list.html')
-
# Render display of individual PO: list of line items
def view(self, **kwargs):
r = RequestMgr()
@@ -37,77 +20,6 @@
r = RequestMgr()
return r.render('acq/po/li_search.html')
- # Create PO from contents of picklist
- def create(self, **kwargs):
- r = RequestMgr()
- if not r.ctx.acq.picklist_source_id.value:
- plmgr = PicklistMgr(r,
- picklist_id=r.ctx.acq.picklist_source_id.value)
- r.ctx.acq.picklist_list.value = plmgr.retrieve_list(r)
-
- r.ctx.acq.fund_list.value = FundMgr(r).retrieve_org_funds()
- provider_list = provider_mgr.list(r)
- for p in provider_list:
- p.owner(OrgUtil.get_org_unit(p.owner()))
- r.ctx.acq.provider_list.value = provider_list
- return r.render('acq/po/create.html')
-
- po = osrf.net_obj.NetworkObject.acqpo()
- po.owner(r.ctx.core.user.value.id())
- po.provider(r.ctx.acq.provider_id.value)
- po.default_fund(r.ctx.acq.fund_id.value)
-
- po_id = ClientSession.atomic_request(oils.const.OILS_APP_ACQ,
- 'open-ils.acq.purchase_order.create',
- r.ctx.core.authtoken.value, po)
- Event.parse_and_raise(po_id)
-
- plmgr = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=r.ctx.acq.picklist_source_id.value)
-
- plmgr.retrieve()
- plmgr.retrieve_lineitems(idlist=1)
-
- for pl_item in plmgr.picklist.entries():
- po_lineitem = osrf.net_obj.NetworkObject.acqpoli()
- po_lineitem.purchase_order(po_id)
- po_lineitem_id = ClientSession.atomic_request(oils.const.OILS_APP_ACQ,
- 'open-ils.acq.po_lineitem.create',
- r.ctx.core.authtoken.value,
- po_lineitem,
- { 'picklist_entry': pl_item})
- Event.parse_and_raise(po_lineitem_id)
-
- return redirect_to(controller='acq/po', action='view', id=po_id)
-
- # Render individual line item: list of detail info
- def view_lineitem(self, **kwargs):
- r = RequestMgr()
- po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r, liid=kwargs['id'])
- po_mgr.retrieve_lineitem()
- r.ctx.acq.po_li.value = po_mgr.li
-
- summary = dict()
- for det in po_mgr.li.lineitem_details():
- fund = det.fund().name()
- try:
- summary[fund] += 1
- except LookupError:
- summary[fund] = 1
- r.ctx.acq.po_li_sum.value = summary
-
- po_mgr.id = po_mgr.li.purchase_order()
- po_mgr.retrieve(flesh_lineitems=0)
- r.ctx.acq.po.value = po_mgr.po
-
- return r.render('acq/po/view_lineitem.html')
-
- def delete(self, **kwargs):
- r = RequestMgr()
- ClientSession.atomic_request(oils.const.OILS_APP_ACQ,
- 'open-ils.acq.purchase_order.delete',
- r.ctx.core.authtoken.value, kwargs['id'])
- return r.render('acq/po/list')
-
def search(self):
r = RequestMgr()
return r.render('acq/po/search.html')
@@ -171,5 +83,3 @@
return redirect_to(controller='acq/po', action='view', id=po_id)
return r.render('acq/po/marc_upload.html')
-
-
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,6 +1,5 @@
from oilsweb.lib.base import *
from oilsweb.lib.request import RequestMgr
-from oilsweb.lib.acq import provider_mgr
from osrf.ses import ClientSession
from osrf.net_obj import NetworkObject
from oils.event import Event
@@ -8,7 +7,6 @@
from oilsweb.lib.user import User
import oils.const
-
class ProviderController(BaseController):
def view(self, **kwargs):
@@ -16,49 +14,7 @@
r.ctx.acq.provider_id = kwargs['id']
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.value: # create then display the provider
-
- provider = NetworkObject.acqpro()
- 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.value, 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.value).recv().content()
- r.ctx.acq.currency_types.value = 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')
-
- ''' Pure Python version
def list(self):
- r = RequestMgr()
- providers = provider_mgr.list(r)
- for f in providers:
- f.owner(OrgUtil.get_org_unit(f.owner()))
- r.ctx.acq.provider_list.value = providers
- return r.render('acq/financial/list_providers.html')
- '''
-
-
- def list(self):
return RequestMgr().render('acq/financial/list_providers.html')
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq_admin.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq_admin.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq_admin.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,41 +0,0 @@
-import logging
-
-from oilsweb.lib.base import *
-import pylons, os
-import oilsweb.lib.context
-import oilsweb.lib.util
-import oilsweb.lib.acq.search
-from oilsweb.lib.context import Context, SubContext, ContextItem
-
-import oils.utils.csedit
-import osrf.log
-import osrf.system
-from oils.utils.idl import IDLParser
-from oils.utils.csedit import oilsLoadCSEditor
-
-def oilsConnect(config, configContext):
- """Connects to the opensrf network, parses the IDL file, and loads the CSEditor"""
- osrf.system.connect(config, configContext)
- IDLParser.parse()
- oilsLoadCSEditor()
-
-log = logging.getLogger(__name__)
-
-class AcqAdminController(BaseController):
-
- def index(self):
- """
- List the acquisition objects that we're allowed to administer
- """
-
- import pprint
-
- # Parse IDL and render as links for viewing the objects, perhaps?
- c.oils = oilsweb.lib.context.Context.init(request, response)
- c.request = request
- oilsConnect('/openils/conf/opensrf_core.xml', 'config.opensrf')
- c.idl = oils.utils.idl.IDLParser.get_parser()
- c.csedit = oils.utils.csedit.CSEditor()
- c.registry = osrf.net_obj.OBJECT_REGISTRY
- return render('oils/%s/acq/admin.html' % c.oils.core.skin)
-
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/admin.py 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,60 +0,0 @@
-from oilsweb.lib.request import RequestMgr
-from oilsweb.lib.base import *
-import oilsweb.lib.util
-from oilsweb.lib.context import Context, SubContext, ContextItem
-import oils.utils.idl
-import oils.utils.csedit
-import osrf.ses
-
-class AdminContext(SubContext):
- ''' Define the CGI/Context params for this application '''
- def __init__(self):
- self.object = ContextItem()
- self.object_class = ContextItem()
- self.object_meta = ContextItem()
- self.mode = ContextItem(default_value='view')
- self.prefix = ContextItem()
- def postinit(self):
- self.prefix.value = "%s/admin" % Context.get_context().core.prefix.value
-
-Context.apply_sub_context('adm', AdminContext)
-
-class AdminController(BaseController):
-
- def init(self, obj_type, obj_id=None):
- r = RequestMgr()
- 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.value = osrf.ses.ClientSession.atomic_request(
- 'open-ils.cstore',
- 'open-ils.cstore.direct.%s.retrieve' %
- meta.fieldmapper.replace('::', '.'), obj_id)
- return r
-
- def index(self):
- r = RequestMgr()
- return r.render('admin/index.html')
-
- def view(self, **kwargs):
- r = self.init(kwargs['type'], kwargs['id'])
- 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.value = 'update'
- return r.render('admin/object.html')
-
- def create(self, **kwargs):
- r = self.init(kwargs['type'])
- 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.value = 'delete'
- return r.render('admin/object.html')
-
-
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/admin.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/admin.html 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/admin.html 2008-07-09 21:01:02 UTC (rev 10006)
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-<%inherit file='../base.html'/>
-<%def name="page_title()">${_('Evergreen Acquisitions Administration ')}</%def>
-<%def name="block_content()">
-<h1>${_('Evergreen Acquisitions Administration ')}</h1>
-<pre>
-
- Check for a session key in GET dictionary object:
- % if c.request.GET.has_key('ses'):
- SESSION = ${c.request.GET['ses']}
- % else:
- NO SESSION
- % endif
-
- Try some sample method calls - no session appears to be required,
- possibly because I'm performing the connect in acq_admin.py
- <%
- csd = c.csedit.retrieve_acq_exchange_rate(1)
- eur = c.csedit.retrieve_acq_exchange_rate(2)
- %>
- csd = c.csedit.retrieve_acq_exchange_rate(1)
- csd.to_currency()
- Result = ${csd.to_currency()}
-
- eur = c.csedit.retrieve_acq_exchange_rate(2)
- eur.to_currency()
- Result = ${eur.to_currency()}
-
- Iterate through the acq schema registry objects, dumping interesting info
- that we should be able to wrap into a series of links and forms for
- administrative purposes.
-
- Registry:
- % for key in sorted(c.registry):
- % if c.idl.IDLObject.has_key(key) and str(c.idl.IDLObject[key]['tablename'])[0:4] == 'acq.':
- registry hint: ${key}
- tablename : ${c.idl.IDLObject[key]['tablename']}
- controller : ${c.idl.IDLObject[key]['controller']}
- virtual : ${c.idl.IDLObject[key]['virtual']}
- fieldmapper : ${c.idl.IDLObject[key]['fieldmapper']}
- KEYS
- %for regkey in c.registry[key].keys:
- ${regkey}
- % endfor
-
- % endif
- % endfor
-
- List the callable methods in the CSEditor object, more for interest than anything else:
-
- CSEditor object:
- % for att in [att for att in dir(c.csedit) if callable(getattr(c.csedit, att)) and att[0:2] != '__']:
- ${att}
- % endfor
-
-
-</pre>
-</%def>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/menu.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/menu.html 2008-07-09 20:29:43 UTC (rev 10005)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/menu.html 2008-07-09 21:01:02 UTC (rev 10006)
@@ -16,12 +16,14 @@
</div>
</div>
+ <!--
<div dojoType="dijit.form.DropDownButton">
<span>${('Serials')}</span>
<div dojoType="dijit.Menu">
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy" onClick="alert('not yet...');">Test</div>
</div>
</div>
+ -->
<div dojoType="dijit.form.DropDownButton">
More information about the open-ils-commits
mailing list