From 9dbfdf0db7d2f412450fe971eb8fce1e264e959a Mon Sep 17 00:00:00 2001 From: berick Date: Wed, 13 Apr 2011 10:46:32 -0400 Subject: [PATCH] inisial staff client integration in record details page w/ new staff js file; move footer and other js loading to their own templates; hide top-nav pane (my account summary) for embedded mode; load slim version of marc html (no external css; no print button) --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 2 +- Open-ILS/web/js/ui/default/opac/simple.js | 2 +- Open-ILS/web/js/ui/default/opac/staff.js | 22 +++++++++++++ Open-ILS/web/templates/default/opac/parts/base.tt2 | 38 +++------------------- .../web/templates/default/opac/parts/footer.tt2 | 10 ++++++ Open-ILS/web/templates/default/opac/parts/js.tt2 | 24 ++++++++++++++ .../web/templates/default/opac/parts/topnav.tt2 | 2 ++ 7 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 Open-ILS/web/js/ui/default/opac/staff.js create mode 100644 Open-ILS/web/templates/default/opac/parts/footer.tt2 create mode 100644 Open-ILS/web/templates/default/opac/parts/js.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 0290d88b51..f636744eea 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -131,7 +131,7 @@ sub mk_marc_html { # could be optimized considerably by performing the xslt on the already fetched record return $U->simplereq( 'open-ils.search', - 'open-ils.search.biblio.record.html', $rec_id); + 'open-ils.search.biblio.record.html', $rec_id, 1); } 1; diff --git a/Open-ILS/web/js/ui/default/opac/simple.js b/Open-ILS/web/js/ui/default/opac/simple.js index 7124d039db..776dfef1bd 100644 --- a/Open-ILS/web/js/ui/default/opac/simple.js +++ b/Open-ILS/web/js/ui/default/opac/simple.js @@ -1,4 +1,4 @@ -/* Keep this dead simple. No dojo. Call nothing via onload. */ +/* Keep this dead simple. No dojo. */ function $(s) { return document.getElementById(s); } function removeClass(node, cls) { if (!node || !node.className) return; diff --git a/Open-ILS/web/js/ui/default/opac/staff.js b/Open-ILS/web/js/ui/default/opac/staff.js new file mode 100644 index 0000000000..abb8ce83d3 --- /dev/null +++ b/Open-ILS/web/js/ui/default/opac/staff.js @@ -0,0 +1,22 @@ +/* staff client integration functions */ +function debug(msg){dump(msg+'\n')} +var eventCache={}; +function attachEvt(scope, name, action) { + if(!eventCache[scope]) eventCache[scope] = {}; + if(!eventCache[scope][name]) eventCache[scope][name] = []; + eventCache[scope][name].push(action); +} +function runEvt(scope, name) { + debug('running event '+scope+':'+name); + var args = Array.prototype.slice.call(arguments).slice(2); + if(eventCache[scope]) { + var evt = eventCache[scope][name]; + for(var i in evt) {evt[i].apply(evt[i], args);} + } +} +window.onload = function() { + // record details page events + var rec = location.href.match(/\/opac\/record\/(\d+)/); + if(rec && rec[1]) { runEvt('rdetail', 'recordRetrieved', rec[1]); } + // fire other events the staff client is expecting... +} diff --git a/Open-ILS/web/templates/default/opac/parts/base.tt2 b/Open-ILS/web/templates/default/opac/parts/base.tt2 index 488c21d2c6..d54a7e0090 100644 --- a/Open-ILS/web/templates/default/opac/parts/base.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/base.tt2 @@ -5,42 +5,14 @@ [% IF ctx.authtime %] [% END %] - - - [% l('Catalog - King County Library - [_1]', ctx.page_title) %] + + + [% l('Catalog - [_1]', ctx.page_title) %] - [% BLOCK html_head; END; # provide a default that can be overridden -%] - [%- PROCESS html_head -%] [% content %] - - - - - + [% INCLUDE 'default/opac/parts/footer.tt2' %] + [% INCLUDE 'default/opac/parts/js.tt2' %] diff --git a/Open-ILS/web/templates/default/opac/parts/footer.tt2 b/Open-ILS/web/templates/default/opac/parts/footer.tt2 new file mode 100644 index 0000000000..9ab3ace033 --- /dev/null +++ b/Open-ILS/web/templates/default/opac/parts/footer.tt2 @@ -0,0 +1,10 @@ + + diff --git a/Open-ILS/web/templates/default/opac/parts/js.tt2 b/Open-ILS/web/templates/default/opac/parts/js.tt2 new file mode 100644 index 0000000000..4f7771db1e --- /dev/null +++ b/Open-ILS/web/templates/default/opac/parts/js.tt2 @@ -0,0 +1,24 @@ + + + + +[% IF ctx.is_staff %] + +[% END %] + + + + + diff --git a/Open-ILS/web/templates/default/opac/parts/topnav.tt2 b/Open-ILS/web/templates/default/opac/parts/topnav.tt2 index 15a98af292..ab467c8703 100644 --- a/Open-ILS/web/templates/default/opac/parts/topnav.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/topnav.tt2 @@ -1,3 +1,4 @@ +[% IF !ctx.is_staff %]