[open-ils-commits] r16372 - in trunk: . Open-ILS/web/js/dojo/openils (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun May 2 21:03:27 EDT 2010


Author: miker
Date: 2010-05-02 21:03:25 -0400 (Sun, 02 May 2010)
New Revision: 16372

Modified:
   trunk/
   trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
Log:
add the ability to run in sync mode; prevent use of cached unapi data; add the slot as a well-known param to format and value handlers


Property changes on: trunk
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2010-05-02 21:01:26.194999933 -0400
committer: Mike Rylander <miker at esilibrary.com>
properties: 
	branch-nick: trunk

   + timestamp: 2010-05-02 21:03:22.411999941 -0400
committer: Mike Rylander <miker at esilibrary.com>
properties: 
	branch-nick: trunk

Name: bzr:revision-id:v4
   - 11741 phasefx at batrepo-20091014063041-ama3i5s87ziqohxo
11742 phasefx at batrepo-20091014063644-pn3a6urkw3uxgr6n
12108 phasefx at batrepo-20091120084700-lavt73oserscgalf
12166 jason at esilibrary.com-20091202233906-g8kh2kh3qmmz66r1
12184 jason at esilibrary.com-20091204161020-0dqezh01c05btffh
12198 jason at esilibrary.com-20091208140008-eofwdbn2u8dxk2kk
12199 jason at esilibrary.com-20091208155412-4qdzy8sgs51vm0yq
12215 jason at esilibrary.com-20091209133642-bp8mb3tc5vpoc1ij
12220 jason at esilibrary.com-20091209143447-i1st1to8ln4hhwyb
12231 jason at esilibrary.com-20091209221438-vv4crqppm8ajj3dr
12804 jason at esilibrary.com-20100324194046-jza2ic2dlpq8txhc
12946 miker at esilibrary.com-20100402183612-8xznj35wfohk7zyu
12955 miker at esilibrary.com-20100403141037-h8d57ryrmkkg9yhb
12971 miker at whirly-20100405202254-aztbsf3p3eey9e8e
12997 miker at esilibrary.com-20100408154146-zodwuxxizwf0y449
13010 miker at miker-msi-20100409021618-5f0ohbg5cgi5pai0
13014 miker at esilibrary.com-20100409135406-mitf09aw1srnps3g
13022 miker at esilibrary.com-20100412144909-fc4bx1n80ac0z8ox
13023 miker at esilibrary.com-20100412145629-92g9jts2k8yqsm38
13152 miker at esilibrary.com-20100503010126-67i6kclipxip27du

   + 11741 phasefx at batrepo-20091014063041-ama3i5s87ziqohxo
11742 phasefx at batrepo-20091014063644-pn3a6urkw3uxgr6n
12108 phasefx at batrepo-20091120084700-lavt73oserscgalf
12166 jason at esilibrary.com-20091202233906-g8kh2kh3qmmz66r1
12184 jason at esilibrary.com-20091204161020-0dqezh01c05btffh
12198 jason at esilibrary.com-20091208140008-eofwdbn2u8dxk2kk
12199 jason at esilibrary.com-20091208155412-4qdzy8sgs51vm0yq
12215 jason at esilibrary.com-20091209133642-bp8mb3tc5vpoc1ij
12220 jason at esilibrary.com-20091209143447-i1st1to8ln4hhwyb
12231 jason at esilibrary.com-20091209221438-vv4crqppm8ajj3dr
12804 jason at esilibrary.com-20100324194046-jza2ic2dlpq8txhc
12946 miker at esilibrary.com-20100402183612-8xznj35wfohk7zyu
12955 miker at esilibrary.com-20100403141037-h8d57ryrmkkg9yhb
12971 miker at whirly-20100405202254-aztbsf3p3eey9e8e
12997 miker at esilibrary.com-20100408154146-zodwuxxizwf0y449
13010 miker at miker-msi-20100409021618-5f0ohbg5cgi5pai0
13014 miker at esilibrary.com-20100409135406-mitf09aw1srnps3g
13022 miker at esilibrary.com-20100412144909-fc4bx1n80ac0z8ox
13023 miker at esilibrary.com-20100412145629-92g9jts2k8yqsm38
13152 miker at esilibrary.com-20100503010126-67i6kclipxip27du
13153 miker at esilibrary.com-20100503010322-3ri56680p7bf4o26

Name: bzr:text-parents
   - Open-ILS/web/js/dojo/openils/BibTemplate.js	svn-v4:dcc99617-32d9-48b4-a31d-7c20da2025e4:trunk:16245

   + 

Modified: trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js	2010-05-03 01:01:29 UTC (rev 16371)
+++ trunk/Open-ILS/web/js/dojo/openils/BibTemplate.js	2010-05-03 01:03:25 UTC (rev 16372)
@@ -31,6 +31,7 @@
             this.record = kwargs.record;
             this.org_unit = kwargs.org_unit || '-';
             this.depth = kwargs.depth;
+            this.sync = kwargs.sync == true;
             this.locale = kwargs.locale || OpenSRF.locale || 'en-US';
 
             this.mode = 'biblio-record_entry';
@@ -43,6 +44,7 @@
         },
 
         render : function() {
+
             var all_slots = dojo.query('*[type^=opac/slot-data]', this.root);
             var default_datatype = this.default_datatype;
         
@@ -65,7 +67,6 @@
         
             for (var datatype in slots) {
 
-                //(function (slot_list,dtype,mode,rec,org) {
                 (function (args) {
                     var BT = args.renderer;
 
@@ -87,6 +88,8 @@
                     dojo.xhrGet({
                         url: '/opac/extras/unapi?id=' + uri + '&format=' + args.dtype + '&locale=' + BT.locale,
                         handleAs: 'xml',
+                        sync: BT.sync,
+                        preventCache: true,
                         load: function (bib) {
 
                             dojo.forEach(args.slot_list, function (slot) {
@@ -99,7 +102,7 @@
                                     bib
                                 );
 
-                                if (item_limit) item_list = item_list.splice(parseInt(item_offset),parseInt(item_limit));
+                                if (parseInt(item_limit)) item_list = item_list.splice(parseInt(item_offset),parseInt(item_limit));
                                 if (!item_list.length) return;
 
                                 var templated = slot.getAttribute('templated') == 'true';
@@ -112,7 +115,7 @@
                                     ).orphan().forEach(function(x) {
                                         dojo.setObject(
                                             x.getAttribute('name'),
-                                            (new Function( 'item_list', 'BT', 'slotXML', unescape(x.innerHTML) ))(item_list,BT,bib),
+                                            (new Function( 'item_list', 'BT', 'slotXML', 'slot', unescape(x.innerHTML) ))(item_list,BT,bib,slot),
                                             template_values
                                         );
                                     });
@@ -121,11 +124,11 @@
                                 }
 
                                 var handler_node = dojo.query( '*[type=opac/slot-format]', slot )[0];
-                                if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'item', dojox.data.dom.textContent(handler_node) || handler_node.innerHTML);
-                                else slot_handler = new Function('item_list', 'BT', 'slotXML', 'item','return dojox.data.dom.textContent(item) || item.innerHTML;');
+                                if (handler_node) slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item', dojox.data.dom.textContent(handler_node) || handler_node.innerHTML);
+                                else slot_handler = new Function('item_list', 'BT', 'slotXML', 'slot', 'item','return dojox.data.dom.textContent(item) || item.innerHTML;');
             
                                 if (item_list.length) {
-                                    var content = dojo.map(item_list, dojo.partial(slot_handler,item_list,BT,bib)).join(joiner);
+                                    var content = dojo.map(item_list, dojo.partial(slot_handler,item_list,BT,bib,slot)).join(joiner);
                                     if (templated) handler_node.parentNode.replaceChild( dojo.doc.createTextNode( content ), handler_node );
                                     else slot.innerHTML = content;
                                 }
@@ -141,6 +144,7 @@
             }
 
             return true;
+
         }
     });
 



More information about the open-ils-commits mailing list