[open-ils-commits] r9554 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq templates/oils/default/acq/picklist
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon May 12 10:23:45 EDT 2008
Author: erickson
Date: 2008-05-12 10:23:43 -0400 (Mon, 12 May 2008)
New Revision: 9554
Removed:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html
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/navigate.js
Log:
fully moving to new dojo-ized bib_search interface. removing python code that does the same thing
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-05-11 14:39:35 UTC (rev 9553)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-05-12 14:23:43 UTC (rev 9554)
@@ -92,7 +92,6 @@
'items': items
})
-
def list(self):
r = RequestMgr()
pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r)
@@ -105,31 +104,10 @@
r.ctx.acq.picklist_list.value = pl_manager.retrieve_list(all=True)
return r.render('acq/picklist/view_listall.html')
- def search(self):
- r = RequestMgr()
- r.ctx.acq.z39_sources.value = oilsweb.lib.acq.search.fetch_z39_sources(r.ctx)
-
- sc = {}
- 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.value = sc
- keys = sc.keys()
- keys.sort()
- r.ctx.acq.search_classes_sorted.value = keys
-
- return r.render('acq/picklist/search.html')
-
def bib_search(self):
r = RequestMgr()
return r.render('acq/picklist/bib_search.html')
- def do_search(self):
- r = RequestMgr()
- picklist_id = oilsweb.lib.acq.search.multi_search(
- r, oilsweb.lib.acq.search.compile_multi_search(r))
- return redirect_to(controller='acq/picklist', action='view', id=picklist_id)
-
def delete(self, **kwargs):
r = RequestMgr()
pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id'])
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py 2008-05-11 14:39:35 UTC (rev 9553)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/search.py 2008-05-12 14:23:43 UTC (rev 9554)
@@ -1,64 +0,0 @@
-import os, md5, time
-import pylons.config
-import osrf.ses, osrf.net_obj
-import oils.const, oilsweb.lib.acq.picklist
-
-EG_Z39_SOURCES = 'open-ils.search.z3950.retrieve_services'
-EG_Z39_SEARCH = 'open-ils.search.z3950.search_class'
-_z_sources = None
-
-def fetch_z39_sources(ctx):
- global _z_sources
- if _z_sources:
- return _z_sources
- _z_sources = osrf.ses.ClientSession.atomic_request(
- 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.value, search)
-
- pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(request_mgr)
- picklist_id = pl_manager.create_or_replace("")
-
- while not req.complete:
- resp = req.recv()
- if not resp:
- break
-
- res = resp.content()
- for record in res['records']:
- lineitem = osrf.net_obj.NetworkObject.jub()
- lineitem.picklist(picklist_id)
- lineitem.source_label(res['service'])
- lineitem.marc(record['marcxml'])
- lineitem.eg_bib_id(record.get('bibid'))
- pl_manager.create_lineitem(lineitem)
-
- return picklist_id
-
-def compile_multi_search(request_mgr):
-
- search = {
- 'service' : [],
- 'username' : [],
- 'password' : [],
- 'search' : {},
- '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.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.value:
- if request_mgr.request.params[cls]:
- search['search'][cls] = request_mgr.request.params[cls]
-
- return search
-
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.js 2008-05-11 14:39:35 UTC (rev 9553)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/navigate.js 2008-05-12 14:23:43 UTC (rev 9554)
@@ -5,7 +5,7 @@
},
{
label : "${_('Search Titles')}",
- dest : 'acq/picklist/search',
+ dest : 'acq/picklist/bib_search',
id : 'acq-picklist-search'
}
Deleted: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html 2008-05-11 14:39:35 UTC (rev 9553)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/search.html 2008-05-12 14:23:43 UTC (rev 9554)
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-<%inherit file='../base.html'/>
-<%def name="page_title()">${_('Evergreen Acquisitions Search')}</%def>
-
-<%def name="block_content()">
- <form method='GET' action='${c.oils.acq.prefix.value}/picklist/do_search'>
- <div id='oils-acq-search-block' class='container'>
- <div id='oils-acq-search-sources-block'>
- <div id='oils-acq-search-sources-label'>${_('Search Sources')}</div>
- <ul id='oils-acq-search-sources-list'>
- <li><input type='checkbox' name='${c.oils.acq.search_source.cgi_name}'
- value='native-evergreen-catalog'>${_('Evergreen Catalog')}</input></li>
- <li>
- <div class='oils-acq-search-subsources-label'>${_("Z39.50 Sources")}</div>
- <ul class='oils-acq-search-sources-sublist'>
- % for src,cfg in c.oils.acq.z39_sources.value.iteritems():
- <li>
- <input type='checkbox' name='${c.oils.acq.search_source.cgi_name}' value='${src}'>
- ${src} ${cfg["host"]}:${cfg["db"]}
- % if cfg['auth'] == 't':
- <span class='oils-acq-search-source-auth'>*</span>
- % endif
- </input>
- </li>
- % endfor
- </ul>
- </li>
- </ul>
- </div>
- <div id='oils-acq-search-form-block'>
- <div id='oils-acq-search-fields-label'>${_('Search Fields')}</div>
- <table id='oils-acq-search-fields-table'>
- % for cls in c.oils.acq.search_classes_sorted.value:
- <tr class='oils-acq-search-form-row'>
- <td class='oils-acq-search-form-label'>${c.oils.acq.search_classes.value[cls]}</td>
- <td class='oils-acq-search-form-input'>
- <input name='${cls}' size='24'/>
- <input type='hidden' name='${c.oils.acq.search_class.cgi_name}' value='${cls}'/>
- </td>
- </tr>
- % endfor
- <tr>
- <td>${_('Results Per Source')}</td>
- <td>
- <select name='${c.oils.acq.limit.cgi_name}'>
- <option value='5'>5</option>
- <option value='10' selected='selected'>10</option>
- <option value='15'>15</option>
- <option value='20'>20</option>
- </select>
- </td>
- </tr>
- </table>
- <div id='oils-acq-search-fields-submit-block'>
- <input type='submit' value='${_("Submit")}'/>
- </div>
- </div>
- </div>
- </form>
-</%def>
-
More information about the open-ils-commits
mailing list