[open-ils-commits] r9005 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq templates/oils/default/acq/picklist
templates/oils/default/common
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 13 21:22:30 EDT 2008
Author: djfiander
Date: 2008-03-13 20:48:58 -0400 (Thu, 13 Mar 2008)
New Revision: 9005
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
Log:
We can now edit the provider of a lineitem
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-03-13 18:32:10 UTC (rev 9004)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-03-14 00:48:58 UTC (rev 9005)
@@ -11,6 +11,7 @@
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):
@@ -55,7 +56,9 @@
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 list(self):
@@ -142,6 +145,17 @@
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)
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html 2008-03-13 18:32:10 UTC (rev 9004)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html 2008-03-14 00:48:58 UTC (rev 9005)
@@ -1,3 +1,4 @@
+<%namespace file='../../common/widgets.html' name='widget' />
<div id='oils-acq-lineitem-header'>
${_('Picklist Entry')}
<div class='oils-acq-lineitem-attributes'>
@@ -2,11 +3,24 @@
<%
- provider = c.oils.acq.lineitem.value.provider() or ''
- if provider: provider.name()
- meta = _("Source %(data)s") % {"data":c.oils.acq.lineitem.value.source_label()}
- meta2 = _("Provider %(data)s") % {"data":provider}
- meta3 = _("Create date %(data)s") % {"data":c.oils.acq.lineitem.value.create_time()}
- meta4 = _("Last update time %(data)s") % {"data":c.oils.acq.lineitem.value.edit_time()}
+ provider_map = [(provider.id(), provider.name()) for provider in c.oils.acq.provider_list.value]
+
+ provider = c.oils.acq.lineitem.value.provider()
+ if provider:
+ provider = provider.id()
+ meta = _("Source %s") % c.oils.acq.lineitem.value.source_label()
+ meta3 = _("Create date %s") % c.oils.acq.lineitem.value.create_time()
+ meta4 = _("Last update time %s") % c.oils.acq.lineitem.value.edit_time()
%>
<div>${meta}</div>
- <div>${meta2}</div>
+ <div>
+ <form method="post"
+ action="${c.oils.acq.prefix.value}/picklist/update_lineitem">
+ ${_("Provider")}
+ ${widget.build_selector(c.oils.acq.provider_id.cgi_name, provider_map, provider)}
+ <button name="${c.oils.acq.lineitem_id.cgi_name}"
+ value="${c.oils.acq.lineitem.value.id()}">
+ ${_("Update")}
+ </button>
+
+ </form>
+ </div>
<div>${meta3}</div>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html 2008-03-13 18:32:10 UTC (rev 9004)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html 2008-03-14 00:48:58 UTC (rev 9005)
@@ -1,36 +1,19 @@
# -*- coding: utf-8 -*-
<%inherit file='../base.html'/>
+<%namespace file='../../common/widgets.html' name='widget' />
<%namespace file='picklist_summary.html' name='picklist' />
<%def name="page_title()">${_('Evergreen Picklist Entry')}</%def>
<%def name="block_content()">
-${picklist.summary(c.oils.acq.picklist.value, link=True)}
-
-<%include file='lineitem_summary.html'/>
-
<%
fund_map = [(fund.id(), fund.name()) for fund in c.oils.acq.fund_list.value]
- selection_prefix = "<select name='" + c.oils.acq.fund_id.cgi_name + "'>\n"
- selection_suffix = "\n</select>"
- option_format = "<option %s value='%s'>%s</option>"
+%>
- def fund_selection(selected_id):
- if not selected_id:
- optionlist = ["<option value='' selected='selected'>%s</option>\n" % _("-- Select Fund --")]
- else:
- optionlist = []
+${picklist.summary(c.oils.acq.picklist.value, link=True)}
- for (id, name) in fund_map:
- if id == selected_id:
- sel = "selected='selected'"
- else:
- sel = ""
+<%include file='lineitem_summary.html'/>
- optionlist.append(option_format % (sel, id, name))
-
- return selection_prefix + "\n".join(optionlist) + selection_suffix
-%>
<table id='oils-acq-lineitem-summary'>
% for attr in c.oils.acq.lineitem.value.attributes():
<tr>
@@ -56,10 +39,10 @@
action="${c.oils.acq.prefix.value}/picklist/update_lineitem">
<input type="hidden"
name="${c.oils.acq.lineitem_id.cgi_name}"
- value="${c.oils.acq.lineitem.value.id()}">
+ value="${c.oils.acq.lineitem.value.id()}" />
<button name='${c.oils.acq.lineitem_detail_id.cgi_name}'
value='${detail.id()}'>${_("Update")}</button>
- ${fund_selection(detail.fund())}
+ ${widget.build_selector(c.oils.acq.fund_id.cgi_name, fund_map, detail.fund())}
</form>
</td>
<td>${detail.owning_lib() or ' '}</td>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html 2008-03-13 18:32:10 UTC (rev 9004)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/widgets.html 2008-03-14 00:48:58 UTC (rev 9005)
@@ -74,3 +74,25 @@
<a href='?${c.oils.acq.offset.cgi_name}=${end}'>»</a>
% endif
</%def>
+
+<%def name='build_selector(name, optionmap, chosen=None)'>
+ <div style='display:none'>
+ NAME '${name}'
+ CHOSEN ${chosen}
+ OPTIONMAP ${optionmap}
+ </div>
+ <select name="${name}">
+
+ %if not selected:
+ <option value="" selected="selected">${_("-- Select --")}</option>
+ %endif
+
+ %for (id, name) in optionmap:
+ <option value="${id}"
+ %if id == chosen:
+ selected='selected'
+ %endif
+ >${name}</option>
+ %endfor
+ </select>
+</%def>
More information about the open-ils-commits
mailing list