1 sdump('D_OPAC','Loading opac.js\n');
3 var OPAC_URL = "http://spacely.georgialibraries.org:8080/";
7 /* listen for page changes */
8 var progressListener = new Object();
9 progressListener.onProgressChange = function(){}
10 progressListener.onLocationChange = function(){}
11 progressListener.onStatusChange = function(){}
12 progressListener.onSecurityChange = function(){}
13 progressListener.QueryInterface = function qi(iid) { return this; }
14 progressListener.onStateChange =
15 function client_statechange ( webProgress, request, stateFlags, status) {
16 if( stateFlags == 131088 ) set_opac_vars();
21 function opac_init(p) {
22 sdump('D_OPAC',"Initing OPAC\n");
24 p.opac_iframe = p.w.document.getElementById('opac_opac_iframe');
25 p.opac_iframe.addProgressListener(progressListener,
26 Components.interfaces.nsIWebProgress.NOTIFY_ALL );
27 p.opac_iframe.setAttribute("src", OPAC_URL)
30 /* shoves data into the OPAC's space */
31 function set_opac_vars() {
32 var p = opac_page_thing;
33 p.opac_iframe = p.w.document.getElementById('opac_opac_iframe');
34 p.opac_iframe.contentWindow.IAMXUL = true;
35 p.opac_iframe.contentWindow.makeXULLink = makeXULLink;
36 p.opac_iframe.contentWindow.xulG = mw.G;
39 /* build a XUL specific link within the OPAC.
40 @param type The type of link to build
41 @param node The DOM node (<a>..</a>, most likely) whose onclick you wish to set
42 @param thing The data need to set the action for the specific type. For
43 example, 'thing' is the record id for 'marc' and 'copy' types.
45 function makeXULLink(type, node, thing) {
47 var p = opac_page_thing;
51 node.onclick = function(thing) {
53 p.w.app_shell, 'new_tab', 'main_tabbox',
54 { 'find_this_id' : thing } ).find_this_id = thing;
59 node.onclick = function(thing) {
61 p.w.app_shell, 'new_tab', 'main_tabbox',
62 { 'find_this_id' : thing }).find_this_id = thing;
69 /* --------------------------------------------------------------------------
71 -------------------------------------------------------------------------- */
72 function opac_build_navigation(p) {
73 p.webForward = function webForward() {
75 if(p.opac_iframe.webNavigation.canGoForward)
76 p.opac_iframe.webNavigation.goForward();
78 sdump('D_OPAC','goForward error: ' + js2JSON(E) + '\n');
82 p.webBack = function webBack() {
84 if(p.opac_iframe.webNavigation.canGoBack)
85 p.opac_iframe.webNavigation.goBack();
87 sdump('D_OPAC','goBack error: ' + js2JSON(E) + '\n');
97 /* --------------------------------------------------------------------------
99 -------------------------------------------------------------------------- */
102 function opac_build_callbacks(p) {
103 p.xulEvtRecordResultDisplayed = function(ui_obj, record) {
104 ui_obj.addItem("Edit MARC", function() {
106 p.w.app_shell, 'new_tab', 'main_tabbox', {
107 'find_this_id' : record.doc_id()
109 ).find_this_id = record.doc_id();
113 ui_obj.addItem("Open Copy Browser", function() {
115 p.w.app_shell, 'new_tab', 'main_tabbox', {
116 'find_this_id' : record.doc_id()
118 ).find_this_id = record.doc_id();
124 p.xulEvtMRResultDisplayed = function(ui_obj, record) {
125 sdump('D_OPAC',"xulEvtMRRsultsDisplayed()\n");
129 p.xulEvtRecordDetailDisplayed = function(ui_obj, record) {
130 ui_obj.addItem("Edit MARC", function() {
132 p.w.app_shell, 'new_tab', 'main_tabbox', {
133 'find_this_id' : record.doc_id()
135 ).find_this_id = record.doc_id();
139 ui_obj.addItem("Open Copy Browser", function() {
141 p.w.app_shell, 'new_tab', 'main_tabbox', {
142 'find_this_id' : record.doc_id()
144 ).find_this_id = record.doc_id();
149 p.xulEvtViewMARC = function( node, record ) {
150 node.onclick = p.buildViewMARCWindow(record);
155 p.buildViewMARCWindow = function(record) {
157 debug("Setting up view marc with record " + record.doc_id());
159 var func = function() { marc_view(p.w.app_shell,record.doc_id()); }