[open-ils-commits] r17809 - trunk/Open-ILS/web/js/dojo/openils (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Sep 18 13:54:00 EDT 2010
Author: miker
Date: 2010-09-18 13:53:56 -0400 (Sat, 18 Sep 2010)
New Revision: 17809
Modified:
trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
Log:
add pre- and post-render callback capabilities to BibTemplate
Modified: trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-09-18 14:43:07 UTC (rev 17808)
+++ trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js 2010-09-18 17:53:56 UTC (rev 17809)
@@ -110,6 +110,14 @@
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 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*/}
+ });
+
var templated = slot.getAttribute('templated') == 'true';
if (debug) alert('BibTemplate debug -- slot ' + (templated ? 'is' : 'is not') + ' templated');
if (templated) {
@@ -147,6 +155,12 @@
}
delete(slot_handler);
+
+ // Do post-render stuff
+ dojo.forEach(post_render_callbacks, function (cb) {
+ try { (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(cb.innerHTML) ))(item_list,BT,bib,slot) } catch (e) {/*meh*/}
+ });
+
} catch (e) {
if (debug) {
alert('BibTemplate Error: ' + e + '\n' + dojo.toJson(e));
More information about the open-ils-commits
mailing list