[open-ils-commits] r17812 - trunk/Open-ILS/web/js/dojo/openils (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Sep 18 15:06:39 EDT 2010
Author: miker
Date: 2010-09-18 15:06:34 -0400 (Sat, 18 Sep 2010)
New Revision: 17812
Modified:
trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
Log:
more callbacks, this time pre- and post-query
Modified: trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-09-18 17:55:42 UTC (rev 17811)
+++ trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-09-18 19:06:34 UTC (rev 17812)
@@ -99,6 +99,16 @@
var item_limit = parseInt(slot.getAttribute('limit'));
var item_offset = parseInt(slot.getAttribute('offset')) || 0;
+ var pre_render_callbacks = dojo.query( '*[type=opac/call-back+pre-render]', slot );
+ var post_render_callbacks = dojo.query( '*[type=opac/call-back+post-render]', slot );
+ var pre_query_callbacks = dojo.query( '*[type=opac/call-back+pre-query]', slot );
+ var post_query_callbacks = dojo.query( '*[type=opac/call-back+post-query]', slot );
+
+ // Do pre-query stuff
+ dojo.forEach(pre_query_callbacks, function (cb) {
+ try { (new Function( 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(BT,bib,slot) } catch (e) {/*meh*/}
+ });
+
var item_list = dojo.query(
slot.getAttribute('query'),
bib
@@ -107,12 +117,15 @@
if (item_limit) {
if (debug) alert('BibTemplate debug -- item list limit/offset requested: ' + item_limit + '/' + item_offset);
if (item_list.length) item_list = BT.subsetNL(item_list, item_offset, item_offset + item_limit);
- if (!item_list.length) return;
}
- var pre_render_callbacks = dojo.query( '*[type=opac/call-back+pre-render]', slot );
- var post_render_callbacks = dojo.query( '*[type=opac/call-back+post-render]', slot );
+ // Do post-query stuff, only if there's an item list!
+ dojo.forEach(post_query_callbacks, function (cb) {
+ try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/}
+ });
+ if (!item_list.length) return;
+
// Do pre-render stuff
dojo.forEach(pre_render_callbacks, function (cb) {
try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/}
More information about the open-ils-commits
mailing list