when logged in, default to org unit 1 when no org unit has been manually selected...
[evergreen-equinox.git] / Open-ILS / web / opac / skin / kcls / xml / common / js_shared.xml
1 /*
2 Run this here so it's the first event fired after 'init'.
3 This forces the LOCATION back to 1 when the user has not
4 selected a location via widget, thus immediately overriding 
5 the default behavior found in common/js/init.js
6 */
7 attachEvt('common', 'run', function() {
8     var cgi = new CGI();
9     if( cgi.param(PARAM_LOCATION) == null ) LOCATION=1;
10 });
11
12
13 <!--#if expr="$OILS_PAGE='index.xml'"-->
14 isFrontPage = true;
15 <!--#endif-->
16
17 config.ids.searchbar = {};
18 config.css.searchbar = {};
19 config.ids.searchbar.text = 'search_box';
20 config.ids.searchbar.facets = 'facet_box';
21 config.ids.searchbar.submit = 'search_submit';
22 config.ids.searchbar.type_selector = 'search_type_selector';
23 config.ids.searchbar.depth_selector = 'depth_selector';
24 config.ids.searchbar.form_selector = 'form_selector';
25 config.ids.searchbar.extra_row = 'searchbar_extra';
26 config.ids.searchbar.main_row            = 'searchbar_main_row';
27 config.ids.searchbar.table                = 'searchbar_table';
28 config.ids.searchbar.location_tag    = 'search_location_tag_link';
29 config.ids.searchbar.lib_sel_span    = 'lib_selector_span';
30 config.ids.searchbar.lib_sel_link    = 'lib_selector_link';
31 config.ids.searchbar.depth_sel_span    = 'depth_selector_span';
32 config.ids.common.top_logo = "top_left_logo";
33 config.ids.sidebar = {};
34 config.css.sidebar = {};
35 config.names.sidebar = {};
36 config.css.sidebar.item = {};
37 config.ids.sidebar.home                = 'home_link_div';
38 config.ids.sidebar.advanced        = 'advanced_link_div';
39 config.ids.sidebar.myopac            = 'myopac_link_div';
40 config.ids.sidebar.prefs            = 'prefs_link_div';
41 config.ids.sidebar.mresult            = 'mresult_link_div';
42 config.ids.sidebar.rresult            = 'result_link_div';
43 config.ids.sidebar.rdetail            = "rdetail_link_div";
44 config.ids.sidebar.login            = 'login_link';
45 config.ids.sidebar.logout            = 'logout_link';
46 config.ids.sidebar.logoutbox        = 'logout_link_div';
47 config.ids.sidebar.loginbox        = 'login_link_div';
48 config.ids.sidebar.logged_in_as    = 'logged_in_as_div';
49 config.ids.sidebar.username_dest    = 'username_dest';
50
51 config.ids.sidebar.home_link        = 'home_link'
52 config.ids.sidebar.advanced_link    = 'advanced_link'
53 config.ids.sidebar.myopac_link    = 'myopac_link'
54
55 config.css.encircled                = 'encircled';
56
57 config.ids.login = {};
58 config.css.login = {};
59 config.ids.login.form            = "login_form";
60 config.ids.login.box            = "login_box";
61 config.ids.login.tbody            = "login_tbody";
62 config.ids.login.username    = "login_username";
63 config.ids.login.password    = "login_password";
64 config.ids.login.button        = "login_button";
65 config.ids.login.cancel        = "login_cancel_button";
66 config.ids.altcanvas.login            = config.ids.login.box;
67
68 config.ids.altcanvas.myopac_reload = 'myopac_reloading';
69 config.ids.myopac = {};
70 config.css.myopac = {};
71 config.names.myopac = {};
72
73 config.ids.altcanvas.org_tree       = config.ids.common.org_container;
74 config.ids.altcanvas.holds          = 'holds_box';
75 config.ids.altcanvas.check_holds    = 'check_holds_box';
76 config.ids.altcanvas.xulholds       = 'xulholds_box';
77 config.ids.altcanvas.loading        = 'loading_alt';
78
79 <!--#if expr="$OILS_PAGE='rdetail.xml'"-->
80 config.ids.rdetail              = {};
81 config.ids.rdetail.view_marc    = "rdetail_view_marc";
82 config.ids.rdetail.details_body = 'rdetail_details_body';
83 config.ids.rdetail.title        = 'rdetail_title';
84 config.ids.rdetail.author       = 'rdetail_author';
85 config.ids.rdetail.isbn         = 'rdetail_isbn';
86 config.ids.rdetail.edition      = 'rdetail_edition';
87 config.ids.rdetail.pubdate      = 'rdetail_pubdate';
88 config.ids.rdetail.publisher    = 'rdetail_publisher';
89 config.ids.rdetail.tor          = 'rdetail_tor';
90 config.ids.rdetail.abstr        = 'rdetail_abstract';
91 config.ids.rdetail.image        = 'rdetail_image';
92 config.ids.rdetail.tor_pic      = 'rdetail_tor_pic';
93
94 config.ids.rdetail.cp_status        = "rdetail_copy_info_status";
95 config.ids.rdetail.cp_info_row      = "rdetail_copy_info_row";
96 config.ids.rdetail.cp_info_loading  = "rdetail_copy_info_loading";
97 config.ids.rdetail.cp_info_local    = "copy_info_local_link";
98 config.ids.rdetail.cp_info_all      = "copy_info_all_link";
99 config.ids.rdetail.cp_info_none     = "rdetail_copy_info_none";
100 config.names.rdetail.lib_cell       = "rdetail_library_cell";
101 config.names.rdetail.cn_cell        = "rdetail_callnumber_cell";
102 config.names.rdetail.cp_count_cell  = "rdetail_copy_count_cell";
103 config.names.rdetail.cp_status      = 'rdetail_status_cell';
104
105 <!--#endif-->
106
107 var OILS_OPAC_IMAGES_HOST = null;
108 <!--#if expr="$OILS_OPAC_IMAGES_HOST"-->
109     OILS_OPAC_IMAGES_HOST = '<!--#echo var="OILS_OPAC_IMAGES_HOST"-->extras/ac/jacket/';
110 <!--#endif -->
111 var OILS_OPAC_STATIC_PROTOCOL = null;
112 <!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
113     OILS_OPAC_STATIC_PROTOCOL = '<!--#echo var="OILS_OPAC_STATIC_PROTOCOL"-->';
114 <!--#endif -->
115
116 var chilifresh = '<!--#echo var="OILS_CHILIFRESH_ACCOUNT"-->';
117 if (chilifresh == '(none)') { chilifresh = false; }
118 var novelist = '<!--#echo var="OILS_NOVELIST_URL"-->';
119 if (novelist == '(none)') { novelist = false; }
120
121
122 var cookieManager = new HTTP.Cookies();  
123
124 /*  -----------------------------------------------------------------------
125     KCLS suppressed orgs 
126     ----------------------------------------------------------------------- */
127 var localSuppressedOrgs = {1500:true, 1501:true, 1558:true};  /* change to suit */
128 for (var i in orgArraySearcher) {
129     var org = orgArraySearcher[i];
130     if(localSuppressedOrgs[i]) {
131         org.opac_visible('f');
132     }
133 }
134 /* ----------------------------------------------------------------------- */ 
135
136 <!--#if expr="$OILS_OPAC_FORCE_LOGIN_SSL"-->
137     forceLoginSSL = true;
138 <!--#endif -->
139
140
141 /* I'm not sure how to test for the situation where this block is
142    needed, but this won't hurt. */
143 try {
144     if ($('holds_frozen_chkbox').checked)
145         unHideMe($("hold_frozen_thaw_row"));
146 } catch (E) {
147     void(0);
148 }
149
150 dojo.require('dojo.cookie');
151 dojo.require("dijit._Calendar");
152 dojo.require("dijit.form.DateTextBox");
153 dojo.require("dijit.form.FilteringSelect");
154 dojo.require("dojo.date.locale");
155 dojo.require("dojo.date.stamp");
156 dojo.require("dojo.parser");
157 dojo.require("openils.BibTemplate");
158 dojo.require("openils.widget.FacetSidebar"); // pulls in Searcher and I18N
159 dojo.require("dijit.form.CheckBox");
160 dojo.require("openils.widget.ProgressDialog");
161
162
163 dojo.addOnLoad(
164     function() {
165         setTimeout(
166             function() {
167                 attachEvt("common", "unload", function(){
168                     if(typeof(G)!="undefined") destroyObj(G);
169                     if(typeof(HTTP)!="undefined") destroyObj(HTTP);
170                     if(typeof(_c)!="undefined") destroyObj(_c);
171                     if(typeof(_l)!="undefined") destroyObj(_l);
172                     if(typeof(config)!="undefined") destroyObj(config);
173                     if(typeof(facet_list)!="undefined") destroyObj(facet_list);
174                     if(typeof(globalOrgTree)!="undefined") destroyObj(globalOrgTree);
175                     if(typeof(globalOrgTypes)!="undefined") destroyObj(globalOrgTypes);
176                     if(typeof(google)!="undefined") destroyObj(google);
177                     if(typeof(orgArraySearcher)!="undefined") destroyObj(orgArraySearcher);
178                     if(typeof(recordsCache)!="undefined") destroyObj(recordsCache);
179                     if(typeof(search_list)!="undefined") destroyObj(search_list);
180                     if(typeof(subjectCache)!="undefined") destroyObj(subjectCache);
181                     if(typeof(xrefCacheIndex)!="undefined") destroyObj(xrefCacheIndex);
182                     if(typeof(x)!="undefined") destroyObj(x);
183                     if(typeof(string)!="undefined") string = "";
184                     //removeChildren(document);
185                     //alert(errCounter+'\n'+errCounter2);
186                 });
187             }, 0
188         )
189     }
190 );
191
192
193 try { 
194     document.getElementById('toptable').style.display = 'table'; 
195 } catch(e) {
196     try {
197         document.getElementById('toptable').style.display = ''; 
198     } catch(ee) {}
199 }
200 <!--#if expr="$OILS_PAGE='index.xml'"-->
201 dojo.addOnLoad(function() {
202     featuredcontentslider.init({
203         id: "homebanner",
204         contentsource: ["inline", ""],
205         toc: "markup",
206         nextprev: ["", ""],
207         enablefade: [true, 0.04],
208         onChange: function(previndex, curindex){},
209         autorotate: [true, 3000] //pause time (in milliseconds)
210     });
211 });
212 <!--#endif-->
213
214