--- /dev/null
+body { margin: 6px; }
+body { background-color: #9A8A69; }
+
+.main_header { width: 100%; }
+.space { padding-right:5px; }
+.vert_space { padding-top: 82px; width: 100%;}
+.right { position:absolute; right: 0px; }
+.hide_me { display:none; visibility: hidden; }
+
+table { border-collapse: collapse; }
+
+/* generic CSS for a table with data */
+.data_grid { font-weight: 500; border-collapse: collapse;}
+.data_grid thead tr { }
+.data_grid thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid tbody td { padding: 5px; }
+.data_grid_center { text-align: center; }
+
+.data_grid_nb { font-weight: 500; border-collapse: collapse;}
+.data_grid_nb thead tr { color: #000000; }
+.data_grid_nb thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid_nb tbody td { padding: 5px; }
+
+
+.classic_link { text-decoration: underline; color: black;}
+.classic_link:visited { text-decoration: underline; color: black;}
+.classic_link_col { text-decoration: underline; color: red;}
+
+.encircled { border: 1px solid black; }
+
+
+.adv_quick_search { padding: 3px;}
+.adv_quick_search_submit { padding: 3px;}
+
+.overdue { color: red; font-weight: bold;}
+
+#main_table { border-collapse: collapse; width: 100%; }
+#main_left_cell { width: 20%; vertical-align: top;margin: 0px; padding: 0px;}
+#main_right_cell { width: 80%; vertical-align: top; margin: 0px; padding:0px;}
+
+
+#content { min-height: 300px; }
+
+.canvas { min-height: 300px; padding-left: 4px; -moz-border-radius: 6px;}
+#canvas_main { padding-bottom: 4px; }
+
+#loading_div { width: 100%;}
+
+
+
+.shadowed { background: #F0F0E0; }
+.no_copies { background: #E0E0E0; }
+.overdue_circ { border: 2px dashed #F0D0E0; }
+
+.org_tree { padding-left: 2px; padding-right: 2px; }
+.org_link { padding-right: 15px; }
+#org_link_container { margin-bottom: 5px; padding-left: 4px; padding-bottom: 3px; padding-top: 3px; width: 100%; }
+#left_div { float:left; width: 20%; }
+#statusbar {}
+
+#frontsearch_table { }
+#frontsearch_table tr { margin: 6px; }
+
+/* ---------------------------------------------------------------------- */
+.sidebar_div { width: 100%; font-size: 9pt; margin-top: 12px; }
+.sidebar_header { margin-top: 10px; padding-left: 3px; margin-right: 6px; }
+
+.sidebar_extra_item { padding: 0px; margin-right: 8px;}
+.side_bar_item { padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; margin-right: 8px; }
+
+.sidebar_item_active { margin-right: 0px; }
+
+.sidebar_chunk { width: 100%; }
+
+/* ---------------------------------------------------------------------- */
+
+#searchbar { margin-top: 22px; width: 100%; }
+#searchbar table tr td {font-weight: bold; font-size: 8pt; }
+#searchbar select, input { border-collapse: collapse; font-size: 9pt; }
+.searchbar_item { margin: 3px; font-size: 9pt; }
+.searchbar_label_span { font-size: 9pt; }
+#searchbar_table { border-collapse: collapse; }
+
+.search_box_container { width: 240px; padding: 3px; }/* border: 1px solid #A0A0A0;' class='color_2'>*/
+#search_box { width: 260px; }
+
+
+/* ---------------------------------------------------------------------- */
+#login_box { width: 70%; padding: 5px;}
+.login_text { margin-left: 8px; }
+
+/* ---------------------------------------------------------------------- */
+#result_table_div { text-align: left; width: 100%; }
+
+#search_nav_links { width: 100%; }
+#result_info_box { text-align: left; }
+#next_prev_links { padding-left: 2px; padding-right: 2px; text-align: left;}
+#goto_page_links { text-align: left; padding-left: 2px; padding-right: 2px;}
+
+#next_prev_links_dead {padding-left: 5px; padding-right: 5px;}
+
+#res_table { width: 100%; }
+
+.result_table_pic_cell { width: 43px;}
+.result_table_pic { height: 50px; width: 40px; border: none;}
+.result_table_pic_header { width: 43px; }
+
+.result_table_row { text-align: left; width: 100%;}
+.result_table_subtable { width: 100%; border-collapse: collapse; vertical-align: top;}
+.result_table_subtbody { height: 100%; width: 100%; }
+.result_table_title_cell { text-align: left; }
+
+.copy_count_cell { width: 12%; vertical-align: middle; text-align: center; }
+.copy_count_div { width: 4em; height: 99%; vertical-align: middle; text-align: center; }
+
+.search_page_nav_link { margin-right: 5px; }
+
+.np_nav_link { margin-right: 5px; }
+
+/* ---------------------------------------------------------------------- */
+
+#rdetail_detail_main { width: 100%; }
+#rdetail_details_table { padding-top: 10px; width: 100%; padding: 30px; border-collapse: collapse;}
+.rdetail_header { padding: 3px; padding-left: 10px;}
+.rdetail_desc { padding: 2px; padding-left: 2px; padding-right: 2px;}
+.rdetail_item { width: 75%; padding-left: 10px; }
+#rdetail_image { padding-right: 10px; }
+#rdetail_copy_info_table { padding: 4px; width: 100%; border-collapse: collapse; font-size: 8pt; }
+#rdetail_copy_info_table td { padding: 3px; }
+.rdetail_copy_info_header_cell { padding: 2px; }
+.rdetail_copy_count_cell { text-align: center; }
+
+
+.tor_pic { width: 17px; height: 17px; border: none;}
+
+.dim2_border { border: 1px solid #F06000; -moz-border-radius: 3px;}
+
+.dim2 {
+ filter:alpha(opacity=50);
+ -moz-opacity:0.5;
+ opacity: 0.5;
+ text-decoration: none; }
+
+.dim {
+ filter:alpha(opacity=10);
+ -moz-opacity:0.1;
+ opacity: 0.1;
+ text-decoration: none; }
+
+/* ---------------------------------------------------------------------- */
+
+.myopac_link { width: 12%; margin: 3px; padding: 3px; text-align: center; vertical-align: middle; }
+.myopac_link_active { font-weight: 700;}
+.myopac_table thead tr td { padding: 2px; font-weight: 500; border: 1px solid #808080;}
+.myopac_table td { padding: 3px; }
+.myopac_form_pic { width: 20px; height: 20px; }
+
+.tips { padding: 2px; text-align: center; border: solid #E0E0E0 3px; -moz-border-radius: 3px; width: 99%; }
+
+.holds_cell { border: 1px solid #E0E0E0; padding: 5px; width: 50%;}
+.myopac_update_cell { border: 3px solid #E0E0E0; width:100%; padding-top: 4px; padding-bottom: 4px;}
+.myopac_update_span { padding: 5px;}
+
+.lowhits_div { width: 100%; border-top: 1px solid #E0E0E0; text-align: center;
+ padding-top: 8px; padding-bottom: 8px; }
+
+.rdetail_extras_div {
+ border-top: 3px solid #E0E0E0;margin-top: 3px; padding-top: 5px; width: 100%;}
+
+.copy_info_region_row {
+ padding: 6px;
+ border: 2px solid #E0E0E0;
+ font-weight: 600;
+}
+
+.rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; }
+.rdetails_extra_links { border: 1px solid #808080; padding-right: 5px; padding-left: 5px; }
+
+
+.cn_browse_item { height: 190px; }
+.cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;}
+
+.bookshelf {
+ /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/
+ /*
+ background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg);
+ background-repeat: repeat;
+ */
+ border-bottom: 1px solid black;
+}
+
+.cn_browse_loading { width: 95%; padding: 15px; text-align: center; background: #E0F0E0; }
+
+.cn_browse_home_cn { border: 2px solid #E0F0E0; background: green; font-weight: 700;}
+
+.rdetail_context_row { background: #F0E0E0; }
+
+.unadorned_link { text-decoration: none; vertical-align: bottom; }
+
+
+/* ie does not support disabling <option> elements */
+.disabled_option { color: #808080; }
+
+.copy_more_info { padding-left: 6px; color: #804070; }
+
+.invalid_hold { background: #F0F0D0; }
+.myopac_summary_table td { padding : 3px; }
+
+.jacket_attrib { font-size: 7pt; }
+
+/* block that contains footer links and copyright */
+#copyright_block {
+ width: 100%;
+ text-align: center;
+ vertical-align: bottom;
+ margin-top: 10px;
+}
+
+/* block that contains the footer links */
+#footer_links {
+ width: 80%;
+ text-align: center;
+ padding: 10px;
+ margin: auto;
+}
+
+/* span for each link in the footer */
+.footer-link {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+/* block that contains the copyright text */
+#copyright_text {
+ margin-top: 4px;
+}
+
+/* block that contains the logo */
+#footer_logo {
+ text-align: center;
+ margin: auto;
+}
+
+#opac.result.sort { margin-left: 5px; }
+
+#xul_recipient_me { margin-left: 25px; }
+#myopac_holds_thaw_date_form {padding: 10px; text-align: center;}
+#myopac_holds_freeze_select_thaw {margin-right: 100px; margin-left: 100px; }
+
+tr[name="myopac_invalid_addr_row"] td {
+ background:#e0e0e0;
+ color:red;
+}
+
+/* Table of contents layout */
+td.toc_label { text-align: right; }
+td.toc_title { text-align: left; padding-left: 1em; padding-right: 2em; }
+td.toc_page { text-align: right; }
--- /dev/null
+body { margin: 6px; }
+body { background-color: #9A8A69; }
+
+.main_header { width: 100%; }
+.space { padding-right:5px; }
+.vert_space { padding-top: 82px; width: 100%;}
+.right { position:absolute; right: 0px; }
+.hide_me { display:none; visibility: hidden; }
+
+table { border-collapse: collapse; }
+
+/* generic CSS for a table with data */
+.data_grid { font-weight: 500; border-collapse: collapse;}
+.data_grid thead tr { }
+.data_grid thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid tbody td { padding: 5px; }
+.data_grid_center { text-align: center; }
+
+.data_grid_nb { font-weight: 500; border-collapse: collapse;}
+.data_grid_nb thead tr { color: #000000; }
+.data_grid_nb thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid_nb tbody td { padding: 5px; }
+
+
+.classic_link { text-decoration: underline; color: black;}
+.classic_link:visited { text-decoration: underline; color: black;}
+.classic_link_col { text-decoration: underline; color: red;}
+
+.encircled { border: 1px solid black; }
+
+
+.adv_quick_search { padding: 3px;}
+.adv_quick_search_submit { padding: 3px;}
+
+.overdue { color: red; font-weight: bold;}
+
+#main_table { border-collapse: collapse; width: 100%; }
+#main_left_cell { width: 20%; vertical-align: top;margin: 0px; padding: 0px;}
+#main_right_cell { width: 80%; vertical-align: top; margin: 0px; padding:0px;}
+
+
+#content { min-height: 300px; }
+
+.canvas { min-height: 300px; padding-left: 4px; -moz-border-radius: 6px;}
+#canvas_main { padding-bottom: 4px; }
+
+#loading_div { width: 100%;}
+
+
+
+.shadowed { background: #F0F0E0; }
+.no_copies { background: #E0E0E0; }
+.overdue_circ { border: 2px dashed #F0D0E0; }
+
+.org_tree { padding-left: 2px; padding-right: 2px; }
+.org_link { padding-right: 15px; }
+#org_link_container { margin-bottom: 5px; padding-left: 4px; padding-bottom: 3px; padding-top: 3px; width: 100%; }
+#left_div { float:left; width: 20%; }
+#statusbar {}
+
+#frontsearch_table { }
+#frontsearch_table tr { margin: 6px; }
+
+/* ---------------------------------------------------------------------- */
+.sidebar_div { width: 100%; font-size: 9pt; margin-top: 12px; }
+.sidebar_header { margin-top: 10px; padding-left: 3px; margin-right: 6px; }
+
+.sidebar_extra_item { padding: 0px; margin-right: 8px;}
+.side_bar_item { padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; margin-right: 8px; }
+
+.sidebar_item_active { margin-right: 0px; }
+
+.sidebar_chunk { width: 100%; }
+
+/* ---------------------------------------------------------------------- */
+
+#searchbar { margin-top: 22px; width: 100%; }
+#searchbar table tr td {font-weight: bold; font-size: 8pt; }
+#searchbar select, input { border-collapse: collapse; font-size: 9pt; }
+.searchbar_item { margin: 3px; font-size: 9pt; }
+.searchbar_label_span { font-size: 9pt; }
+#searchbar_table { border-collapse: collapse; }
+
+.search_box_container { width: 240px; padding: 3px; }/* border: 1px solid #A0A0A0;' class='color_2'>*/
+#search_box { width: 260px; }
+
+
+/* ---------------------------------------------------------------------- */
+#login_box { width: 70%; padding: 5px;}
+.login_text { margin-left: 8px; }
+
+/* ---------------------------------------------------------------------- */
+#result_table_div { text-align: left; width: 100%; }
+
+#search_nav_links { width: 100%; }
+#result_info_box { text-align: left; }
+#next_prev_links { padding-left: 2px; padding-right: 2px; text-align: left;}
+#goto_page_links { text-align: left; padding-left: 2px; padding-right: 2px;}
+
+#next_prev_links_dead {padding-left: 5px; padding-right: 5px;}
+
+#res_table { width: 100%; }
+
+.result_table_pic_cell { width: 43px;}
+.result_table_pic { height: 50px; width: 40px; border: none;}
+.result_table_pic_header { width: 43px; }
+
+.result_table_row { text-align: left; width: 100%;}
+.result_table_subtable { width: 100%; border-collapse: collapse; vertical-align: top;}
+.result_table_subtbody { height: 100%; width: 100%; }
+.result_table_title_cell { text-align: left; }
+
+.copy_count_cell { width: 12%; vertical-align: middle; text-align: center; }
+.copy_count_div { width: 4em; height: 99%; vertical-align: middle; text-align: center; }
+
+.search_page_nav_link { margin-right: 5px; }
+
+.np_nav_link { margin-right: 5px; }
+
+/* ---------------------------------------------------------------------- */
+
+#rdetail_detail_main { width: 100%; }
+#rdetail_details_table { padding-top: 10px; width: 100%; padding: 30px; border-collapse: collapse;}
+.rdetail_header { padding: 3px; padding-left: 10px;}
+.rdetail_desc { padding: 2px; padding-left: 2px; padding-right: 2px;}
+.rdetail_item { width: 75%; padding-left: 10px; }
+#rdetail_image { padding-right: 10px; }
+#rdetail_copy_info_table { padding: 4px; width: 100%; border-collapse: collapse; font-size: 8pt; }
+#rdetail_copy_info_table td { padding: 3px; }
+.rdetail_copy_info_header_cell { padding: 2px; }
+.rdetail_copy_count_cell { text-align: center; }
+
+
+.tor_pic { width: 17px; height: 17px; border: none;}
+
+.dim2_border { border: 1px solid #F06000; -moz-border-radius: 3px;}
+
+.dim2 {
+ filter:alpha(opacity=50);
+ -moz-opacity:0.5;
+ opacity: 0.5;
+ text-decoration: none; }
+
+.dim {
+ filter:alpha(opacity=10);
+ -moz-opacity:0.1;
+ opacity: 0.1;
+ text-decoration: none; }
+
+/* ---------------------------------------------------------------------- */
+
+.myopac_link { width: 12%; margin: 3px; padding: 3px; text-align: center; vertical-align: middle; }
+.myopac_link_active { font-weight: 700;}
+.myopac_table thead tr td { padding: 2px; font-weight: 500; border: 1px solid #808080;}
+.myopac_table td { padding: 3px; }
+.myopac_form_pic { width: 20px; height: 20px; }
+
+.tips { padding: 2px; text-align: center; border: solid #E0E0E0 3px; -moz-border-radius: 3px; width: 99%; }
+
+.holds_cell { border: 1px solid #E0E0E0; padding: 5px; width: 50%;}
+.myopac_update_cell { border: 3px solid #E0E0E0; width:100%; padding-top: 4px; padding-bottom: 4px;}
+.myopac_update_span { padding: 5px;}
+
+.lowhits_div { width: 100%; border-top: 1px solid #E0E0E0; text-align: center;
+ padding-top: 8px; padding-bottom: 8px; }
+
+.rdetail_extras_div {
+ border-top: 3px solid #E0E0E0;margin-top: 3px; padding-top: 5px; width: 100%;}
+
+.copy_info_region_row {
+ padding: 6px;
+ border: 2px solid #E0E0E0;
+ font-weight: 600;
+}
+
+.rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; }
+.rdetails_extra_links { border: 1px solid #808080; padding-right: 5px; padding-left: 5px; }
+
+
+.cn_browse_item { height: 190px; }
+.cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;}
+
+.bookshelf {
+ /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/
+ /*
+ background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg);
+ background-repeat: repeat;
+ */
+ border-bottom: 1px solid black;
+}
+
+.cn_browse_loading { width: 95%; padding: 15px; text-align: center; background: #E0F0E0; }
+
+.cn_browse_home_cn { border: 2px solid #E0F0E0; background: green; font-weight: 700;}
+
+.rdetail_context_row { background: #F0E0E0; }
+
+.unadorned_link { text-decoration: none; vertical-align: bottom; }
+
+
+/* ie does not support disabling <option> elements */
+.disabled_option { color: #808080; }
+
+.copy_more_info { padding-left: 6px; color: #804070; }
+
+.invalid_hold { background: #F0F0D0; }
+.myopac_summary_table td { padding : 3px; }
+
+.jacket_attrib { font-size: 7pt; }
+
+/* block that contains footer links and copyright */
+#copyright_block {
+ width: 100%;
+ text-align: center;
+ vertical-align: bottom;
+ margin-top: 10px;
+}
+
+/* block that contains the footer links */
+#footer_links {
+ width: 80%;
+ text-align: center;
+ padding: 10px;
+ margin: auto;
+}
+
+/* span for each link in the footer */
+.footer-link {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+/* block that contains the copyright text */
+#copyright_text {
+ margin-top: 4px;
+}
+
+/* block that contains the logo */
+#footer_logo {
+ text-align: center;
+ margin: auto;
+}
+
+#opac.result.sort { margin-left: 5px; }
+
+#xul_recipient_me { margin-left: 25px; }
+#myopac_holds_thaw_date_form {padding: 10px; text-align: center;}
+#myopac_holds_freeze_select_thaw {margin-right: 100px; margin-left: 100px; }
+
+tr[name="myopac_invalid_addr_row"] td {
+ background:#e0e0e0;
+ color:red;
+}
+
+/* Table of contents layout */
+td.toc_label { text-align: right; }
+td.toc_title { text-align: left; padding-left: 1em; padding-right: 2em; }
+td.toc_page { text-align: right; }
--- /dev/null
+
+attachEvt("common", "run", advgInit);
+attachEvt("common", "locationChanged", advSyncCopyLocLink );
+
+var COOKIE_NOGROUP_RECORDS = 'grpt';
+var advSelectedOrg = null;
+
+function advgInit() {
+
+ /* XXX */
+ dojo.require('dojo.cookie');
+ if( dojo.cookie(COOKIE_NOGROUP_RECORDS) || SHOW_MR_DEFAULT )
+ $('adv_group_titles').checked = true;
+
+ $n($('adv_global_tbody'), 'term').focus();
+
+ var ctypes = ["bib_level", "item_form", "item_type", "audience", "lit_form"];
+
+ var req = new Request('open-ils.fielder:open-ils.fielder.ccvm.atomic', {"cache":1,"query":{"ctype":ctypes}});
+ req.callback(advDrawBibExtras);
+ req.request.ctypes = ctypes;
+ req.send();
+
+ var input = $n($('adv_global_trow'), 'term');
+ input.focus();
+
+ var rows = $('adv_global_tbody').getElementsByTagName('tr');
+ for(var t = 0; t < rows.length; t++) {
+ if($n(rows[t], 'term')) {
+ setEnterFunc($n(rows[t], 'term'), advSubmitGlobal);
+ }
+ }
+
+ if(getSort() && getSortDir()) {
+ setSelector($('adv_global_sort_by'), getSort());
+ setSelector($('adv_global_sort_dir'), getSortDir());
+ if(getSort() != 'rel')
+ $('adv_global_sort_dir').disabled = false;
+ }
+
+ if(getAvail())
+ $('opac.result.limit2avail').checked = true;
+
+ // not sure we want to propogate the pubdate filter,
+ // since other filters are not propogated
+ //advInitPubFilter();
+
+ if(!new CGI().param(PARAM_NOPERSIST_SEARCH))
+ initSearchBoxes();
+ advSyncCopyLocLink(getLocation());
+}
+
+function advInitPubFilter() {
+ var i1 = $('adv_global_pub_date_1');
+ var i2 = $('adv_global_pub_date_2');
+ var sel = $('adv_global_pub_date_type');
+ if(getPubdBefore()) {
+ i1.value = getPubdBefore();
+ setSelector(sel, 'before');
+ } else if(getPubdAfter()) {
+ i1.value = getPubdAfter();
+ setSelector(sel, 'after');
+ } else if(getPubdBetween()) {
+ var values = getPubdBetween().split(',');
+ i1.value = values[0]
+ if(values[0] == values[1]) {
+ setSelector(sel, 'equals');
+ } else {
+ setSelector(sel, 'between');
+ i2.value = values[1];
+ }
+ }
+}
+
+function advSyncCopyLocLink(org) {
+ // display the option to filter by copy location
+ advLocationsLoaded = false;
+ advSelectedOrg = org;
+ removeChildren($('adv_copy_location_filter_select'));
+
+ if(isTrue(findOrgType(findOrgUnit(org).ou_type()).can_have_vols())) {
+ unHideMe($('adv_copy_location_filter_row'));
+ advLoadCopyLocations(org);
+ } else {
+ hideMe($('adv_copy_location_filter_row'));
+ }
+
+}
+
+function clearSearchBoxes() {
+ var rows = $('adv_global_tbody').getElementsByTagName('tr');
+ for(var t = 0; t < rows.length; t++) {
+ if($n(rows[t], 'term')) {
+ $n(rows[t], 'term').value = '';
+ setSelector($n(rows[t], 'contains'), 'contains');
+ setSelector($n(rows[t], 'type'), 'keyword');
+ }
+ }
+ $n(rows[0], 'term').focus();
+}
+
+
+function initSearchBoxes() {
+ /* loads the compiled search from the search cookie
+ and sets the widgets accordingly */
+
+ search = dojo.cookie(COOKIE_SEARCH);
+ if(!search) return;
+ _debug("loaded compiled search cookie: " + search);
+
+ search = JSON2js(search);
+ if(!search) return;
+
+ var types = getObjectKeys(search.searches);
+
+ // if we have browser cached data, clear it before populating from cookie
+ if (search.searches[types[0]].term)
+ clearSearchBoxes();
+
+ /* pre-add the needed rows */
+ while($('adv_global_tbody').getElementsByTagName('tr').length - 1 < types.length)
+ advAddGblRow();
+
+ var rows = $('adv_global_tbody').getElementsByTagName('tr');
+
+ for(var t = 0; t < types.length; t++) {
+ var row = rows[t];
+ setSelector($n(row, 'type'), types[t]);
+ var term = search.searches[types[t]].term;
+
+ /* if this is a single -<term> search, set the selector to nocontains */
+ if(match = term.match(/^-(\w+)$/)) {
+ term = match[1];
+ setSelector($n(row, 'contains'), 'nocontains');
+ }
+ $n(row, 'term').value = term;
+ }
+}
+
+function advAddGblRow() {
+ var tbody = $("adv_global_tbody");
+ var newrow = $("adv_global_trow").cloneNode(true);
+ tbody.insertBefore(newrow, $("adv_global_addrow"));
+ var input = $n(newrow, "term");
+ input.value = "";
+ setEnterFunc(input, advSubmitGlobal);
+ $n(newrow, 'type').focus();
+}
+
+function advDrawBibExtras(r) {
+ var data = r.getResultObject();
+ var ctypes = r.ctypes
+ dojo.forEach(ctypes,
+ function(ctype) {
+ var sel = $('adv_global_' + ctype);
+ var ctypeData = dojo.filter(data, function(item) { return item.ctype == ctype } );
+ ctypeData = ctypeData.sort(
+ function(a,b) { /* sort alphabetically */
+ return (a.value < b.value) ? -1 : 1;
+ }
+ );
+ dojo.forEach(ctypeData,
+ function(thing) {
+ var opt = insertSelectorVal(sel, -1, thing.value, thing.code);
+ opt.setAttribute('title', thing.value);
+ }
+ );
+ }
+ );
+}
+
+function advSelToStringList(sel) {
+ var list = getSelectedList(sel);
+ var vals = [];
+ for( var i = 0; i < list.length; i++ ) {
+ var str = list[i];
+ for( var j = 0; j < str.length; j++ ) {
+ //if(str.charAt(j) == ' ') continue;
+ vals.push(str.charAt(j));
+ }
+ }
+ return vals.toString();
+}
+
+function advGetVisSelectorVals(id) {
+ var basic = id + '_basic';
+ if(! $(id).className.match(/hide_me/))
+ return advSelToStringList($(id));
+ return advSelToStringList($(basic));
+}
+
+function advSubmitGlobal() {
+
+ var sortdir = getSelectorVal($('adv_global_sort_dir'));
+ var sortby = getSelectorVal($('adv_global_sort_by'));
+
+ var litforms = advGetVisSelectorVals('adv_global_lit_form');
+ var itemforms = advGetVisSelectorVals('adv_global_item_form');
+ var itemtypes = advGetVisSelectorVals('adv_global_item_type');
+ var audiences = advGetVisSelectorVals('adv_global_audience');
+ var biblevels = advGetVisSelectorVals('adv_global_bib_level');
+ var locations = getSelectedList($('adv_copy_location_filter_select')) + '';
+ var languages = getSelectedList($('adv_global_lang')) + '';
+ var limit2avail = $('opac.result.limit2avail').checked ? 1 : ''
+
+ var searches = advBuildSearchBlob();
+ if(!searches) return;
+
+ clearSearchParams();
+
+ var args = {};
+ args.page = MRESULT;
+ args[PARAM_ITEMFORM] = itemforms;
+ args[PARAM_ITEMTYPE] = itemtypes;
+ args[PARAM_BIBLEVEL] = biblevels;
+ args[PARAM_LITFORM] = litforms;
+ args[PARAM_AUDIENCE] = audiences;
+ args[PARAM_LANGUAGE] = languages;
+ args[PARAM_COPYLOCS] = locations;
+ //args[PARAM_SEARCHES] = js2JSON(searches); /* break these out */
+ args[PARAM_DEPTH] = depthSelGetDepth();
+ args[PARAM_LOCATION] = depthSelGetNewLoc();
+ args[PARAM_SORT] = sortby;
+ args[PARAM_SORT_DIR] = sortdir;
+ args[PARAM_ADVTYPE] = ADVTYPE_MULTI;
+ args[PARAM_STYPE] = "";
+ args[PARAM_TERM] = searches;
+ args[PARAM_AVAIL] = limit2avail;
+
+ // publicate year filtering
+ var pub1;
+ if( (pub1 = $('adv_global_pub_date_1').value) && (''+pub1).match(/\d{4}/)) {
+ switch(getSelectorVal($('adv_global_pub_date_type'))) {
+ case 'equals':
+ args[PARAM_PUBD_BETWEEN] = pub1+','+pub1;
+ break;
+ case 'before':
+ args[PARAM_PUBD_BEFORE] = pub1;
+ break;
+ case 'after':
+ args[PARAM_PUBD_AFTER] = pub1;
+ break;
+ case 'between':
+ var pub2 = $('adv_global_pub_date_2').value;
+ if((''+pub2).match(/\d{4}/))
+ args[PARAM_PUBD_BETWEEN] = pub1+','+pub2;
+ break;
+ }
+ }
+
+ /* pubdate sorting causes a record (not metarecord) search */
+ if( sortby == SORT_TYPE_PUBDATE || !$('adv_group_titles').checked ) {
+ args.page = RRESULT;
+ args[PARAM_RTYPE] = RTYPE_MULTI;
+ }
+
+ if($('adv_group_titles').checked )
+ dojo.cookie(COOKIE_NOGROUP_RECORDS,'1');
+ else
+ dojo.cookie(COOKIE_NOGROUP_RECORDS,null,{'expires':-1});
+
+
+ goTo(buildOPACLink(args));
+}
+
+
+function advBuildSearchBlob() {
+
+ var searches = '';
+ var tbody = $('adv_global_tbody');
+ var rows = tbody.getElementsByTagName('tr');
+
+ for( var i = 0; i < rows.length; i++ ) {
+
+ var row = rows[i];
+ if(!(row && typeof row == 'object')) continue;
+ if(!row.getAttribute('type')) continue;
+
+ var stype = getSelectorVal($n(row, 'type'));
+ var contains = getSelectorVal($n(row, 'contains'));
+ var term = $n(row, 'term').value;
+ if(!term) continue;
+
+ var string = "";
+ switch(contains) {
+ case 'contains' :
+ string += " " + term;
+ break;
+
+ case 'nocontains' : {
+ // Normalize spaces so we don't get "- " embedded in the query
+ var words = term.replace(/\s+/g,' ').replace(/^\s*/,'').replace(/\s*$/,'').split(" ");
+ for( var j in words )
+ string += " -" + words[j];
+ }
+ break;
+
+ case 'exact' :
+ if(term.indexOf('"') > -1) string += " " + term;
+ else string += " \"" + term + "\"";
+ break;
+ }
+ if(string) {
+ string = string.replace(/\\/g,' ');
+ string = string.replace(/^\s*/,'');
+ string = string.replace(/\s*$/,'');
+ //searches[stype].term = string;
+ if(searches) searches += ' ';
+ searches += stype + ': '+ string;
+ }
+ }
+
+ _debug("created search query " + searches);
+ return searches;
+}
+
+
+// retrieves the shelving locations
+var advLocationsLoaded = false;
+function advLoadCopyLocations(org) {
+ if(org == null)
+ org = advSelectedOrg;
+ var req = new Request(FETCH_COPY_LOCATIONS, org);
+ req.callback(advShowCopyLocations);
+ req.send();
+ advLocationsLoaded = true;
+}
+
+// inserts the shelving locations into the multi-select
+function advShowCopyLocations(r) {
+ var locations = r.getResultObject();
+ var sel = $('adv_copy_location_filter_select');
+ for(var i = 0; i < locations.length; i++)
+ insertSelectorVal(sel, -1, locations[i].name(), locations[i].id());
+}
+
+
--- /dev/null
+/* advanced search interface */
+
+attachEvt("common", "run", advInit);
+
+function advInit() {
+
+ /* propogate these? */
+
+ depthSelInit();
+ setEnterFunc( $n( $('advanced.marc.tbody'), 'advanced.marc.value'), advMARCRun );
+
+ unHideMe($('adv_quick_search_sidebar'));
+
+ /*
+ if(isXUL())
+ setSelector($('adv_quick_type'), 'tcn'); */
+
+ setEnterFunc($('adv_quick_text'), advGenericSearch);
+
+ unHideMe($('adv_marc_search_sidebar'));
+}
+
+
+function advAddMARC() {
+ var newt = $('adv_sdbar_table').cloneNode(true);
+ newt.id = "";
+ unHideMe($n(newt, 'crow'));
+ $n(newt, 'advanced.marc.tag').value = "";
+ $n(newt, 'advanced.marc.subfield').value = "";
+ $n(newt, 'advanced.marc.value').value = "";
+ $('adv_marc_search_sidebar').insertBefore(newt, $('adv_marc_submit'));
+}
+
+function advMARCRun() {
+
+ clearSearchParams();
+
+ var div = $('adv_marc_search_sidebar');
+ var tbodies = div.getElementsByTagName('tbody');
+ var searches = [];
+
+ for( var i = 0; i < tbodies.length; i++ ) {
+ var tbody = tbodies[i];
+ var val = advExtractMARC(tbody);
+ if(val) searches.push(val);
+ }
+
+ if(searches.length == 0) return;
+
+ var arg = {};
+ arg.page = RRESULT;
+ arg[PARAM_FORM] = 'all'
+ arg[PARAM_RTYPE] = RTYPE_MARC;
+ arg[PARAM_OFFSET] = 0;
+ arg[PARAM_DEPTH] = depthSelGetDepth();
+ arg[PARAM_LOCATION] = depthSelGetNewLoc();
+ arg[PARAM_SEARCHES] = js2JSON(searches);
+ arg[PARAM_ADVTYPE] = ADVTYPE_MARC;
+ arg[PARAM_TERM] = "";
+
+ goTo(buildOPACLink(arg));
+}
+
+
+/* EXAMPLE => {"term":"0516011901","restrict":[{"tag":"020","subfield":"a"}]} */
+function advExtractMARC(tbody) {
+ if(!tbody) return null;
+ var term = $n(tbody, 'advanced.marc.value').value;
+ if(!term) return null;
+
+ var subfield = $n(tbody, 'advanced.marc.subfield').value;
+ if(!subfield) subfield = "_";
+
+ var tag = $n(tbody, 'advanced.marc.tag').value;
+ if(!tag) return null;
+
+ return { 'term' : term.toLowerCase(), 'restrict' : [ { 'tag' : tag, 'subfield' : subfield } ] };
+}
+
+function advGenericSearch() {
+ clearSearchParams();
+ var type = getSelectorVal($('adv_quick_type'));
+
+ var term = $('adv_quick_text').value;
+ if(!term) return;
+
+ var arg = {};
+
+ switch(type) {
+
+ case 'isbn' :
+ arg.page = RRESULT;
+ arg[PARAM_STYPE] = "";
+ arg[PARAM_TERM] = "";
+ arg[PARAM_RTYPE] = RTYPE_ISBN;
+ arg[PARAM_OFFSET] = 0;
+ arg[PARAM_ADVTERM] = term.toLowerCase();
+ break;
+
+ case 'issn' :
+ arg.page = RRESULT;
+ arg[PARAM_STYPE] = "";
+ arg[PARAM_TERM] = "";
+ arg[PARAM_ADVTERM] = term.toLowerCase();
+ arg[PARAM_OFFSET] = 0;
+ arg[PARAM_RTYPE] = RTYPE_ISSN;
+ break;
+
+ case 'tcn' :
+ arg.page = RRESULT;
+ arg[PARAM_STYPE] = "";
+ arg[PARAM_TERM] = "";
+ arg[PARAM_ADVTERM] = term;
+ arg[PARAM_OFFSET] = 0;
+ arg[PARAM_RTYPE] = RTYPE_TCN;
+ break;
+
+ case 'barcode':
+ advFindBarcode(term);
+ break;
+
+
+ case 'cn':
+ arg.page = CNBROWSE;
+ arg[PARAM_CN] = term;
+ arg[PARAM_DEPTH] = depthSelGetDepth();
+ arg[PARAM_LOCATION] = depthSelGetNewLoc();
+ break;
+
+ case 'lccn':
+ arg.page = RRESULT;
+ arg[PARAM_FORM] = 'all'
+ arg[PARAM_RTYPE] = RTYPE_MARC;
+ arg[PARAM_OFFSET] = 0;
+ arg[PARAM_DEPTH] = depthSelGetDepth();
+ arg[PARAM_LOCATION] = depthSelGetNewLoc();
+ arg[PARAM_SEARCHES] = js2JSON([{ 'term' : term.toLowerCase(),
+ 'restrict' : [ { 'tag' : '010', 'subfield' : '_' } ] }]);
+ arg[PARAM_ADVTYPE] = ADVTYPE_MARC;
+ arg[PARAM_TERM] = "";
+ break;
+
+
+ default: alert('not done');
+ }
+
+ if(arg.page) goTo(buildOPACLink(arg));
+}
+
+
+function advFindBarcode(barcode) {
+ var req = new Request(FETCH_BIB_IDS_BY_BARCODE, barcode);
+ req.callback(advDrawBarcode);
+ req.request.alertEvent = false;
+ req.send();
+}
+
+function advDrawBarcode(r) {
+ var title_ids = r.getResultObject();
+ if(checkILSEvent(title_ids)) {
+ alertId('myopac.copy.not.found');
+ return;
+ }
+ if(!title_ids) return;
+ if (title_ids[0] == -1) { // pre-cat record
+ alertId('myopac.copy.not.cataloged');
+ return;
+ }
+
+ var args = {};
+ if (title_ids.length == 1) {
+ args.page = RDETAIL;
+ args[PARAM_RID] = title_ids[0];
+ } else {
+ args.page = RRESULT;
+ args[PARAM_RTYPE] = RTYPE_LIST;
+ args[PARAM_RLIST] = title_ids;
+ }
+ location.href = buildOPACLink(args);
+}
+
+
+
--- /dev/null
+var cnOffset = 0;
+var cnCount = 9;
+var cnBrowseCN;
+var cnBrowseOrg;
+
+if( findCurrentPage() == CNBROWSE ) {
+ attachEvt("common", "run", cnBrowseLoadSearch);
+ attachEvt( "common", "locationUpdated", cnBrowseResubmit );
+ attachEvt( "common", "depthChanged", cnBrowseResubmit );
+}
+
+
+function cnBrowseLoadSearch() {
+ unHideMe($('cn_browse'));
+ cnBrowseGo(getCallnumber(), getLocation(), getDepth());
+}
+
+
+function cnBrowseResubmit() {
+ var args = {}
+ args[PARAM_CN] = cnBrowseCN;
+ args[PARAM_DEPTH] = depthSelGetDepth();
+ args[PARAM_LOCATION] = getNewSearchLocation();
+ goTo(buildOPACLink(args));
+}
+
+
+
+function cnBrowseGo(cn, org, depth) {
+ if(depth == null) depth = getDepth();
+
+ org = findOrgUnit(org);
+ cnOffset = 0;
+
+ do {
+ var t = findOrgType(org.ou_type());
+ if( t.depth() > depth )
+ org = findOrgUnit(org.parent_ou());
+ else break;
+ } while(true);
+
+ cnBrowseOrg = org;
+ cnBrowseCN = cn;
+
+ _cnBrowseGo( cn, org );
+ appendClear($('cn_browse_where'), text(org.name()));
+}
+
+
+function _cnBrowseGo( cn, org ) {
+ var req = new Request( FETCH_CNBROWSE, cn, org.id(), cnCount, cnOffset );
+ req.callback( cnBrowseDraw );
+ req.send();
+}
+
+function cnBrowseNext() {
+ cnOffset++;
+ _cnBrowseGo( cnBrowseCN, cnBrowseOrg );
+}
+
+function cnBrowsePrev() {
+ cnOffset--;
+ _cnBrowseGo( cnBrowseCN, cnBrowseOrg );
+}
+
+
+function cnBrowseDraw( r ) {
+ var list = r.getResultObject();
+ _cnBrowseDraw(list);
+}
+
+
+var cnTbody;
+var cnRowT;
+var cnTdT;
+function _cnBrowseDraw( list ) {
+
+ if(!cnTbody) {
+ cnTbody = $('cn_tbody');
+ cnRowT = $('cn_browse_row');
+ cnTdT = cnRowT.removeChild($('cn_browse_td'));
+ cnTbody.removeChild(cnRowT);
+ }
+ removeChildren(cnTbody);
+
+ var counter = 1;
+ var currentRow = cnRowT.cloneNode(true);
+ cnTbody.appendChild(currentRow);
+
+ for( var idx in list ) {
+
+
+ var currentTd = cnTdT.cloneNode(true);
+ currentRow.appendChild(currentTd);
+
+ var td = cnTdT.cloneNode(true);
+
+ var obj = list[idx];
+ var cn = obj.cn;
+ var mods = obj.mods;
+
+ var cn_td = $n(currentTd, 'cn_browse_cn');
+ var lib_td = $n(currentTd, 'cn_browse_lib');
+ var title_td = $n(currentTd, 'cn_browse_title');
+ var author_td = $n(currentTd, 'cn_browse_author');
+ var pic_td = $n(currentTd, 'cn_browse_pic');
+
+ if (parseInt(cn.prefix().id()) > -1) {
+ cn_td.appendChild(text(cn.prefix().label()));
+ cn_td.appendChild(text(' '));
+ }
+
+ cn_td.appendChild(text(cn.label()));
+
+ if (parseInt(cn.suffix().id()) > -1) {
+ cn_td.appendChild(text(' '));
+ cn_td.appendChild(text(cn.suffix().label()));
+ }
+
+ lib_td.appendChild(text(findOrgUnit(cn.owning_lib()).name()));
+ cnBrowseDrawTitle(mods, title_td, author_td, pic_td);
+
+ if( counter++ % 3 == 0 ) {
+ counter = 1;
+ currentRow = cnRowT.cloneNode(true);
+ cnTbody.appendChild(currentRow);
+ }
+ }
+}
+
+
+function cnBrowseDrawTitle(mods, title_td, author_td, pic_td) {
+
+ buildTitleDetailLink(mods, title_td);
+ buildSearchLink(STYPE_AUTHOR, mods.author(), author_td);
+ pic_td.setAttribute("src", buildISBNSrc(cleanISBN(mods.isbn())));
+
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = mods.doc_id();
+ args[PARAM_MRID] = 0;
+ pic_td.parentNode.setAttribute("href", buildOPACLink(args));
+}
+
--- /dev/null
+function $(id) { return getId(id); }
+function getId(id) {
+ return document.getElementById(id);
+}
+
+function swapCSSClass(obj, old, newc ) {
+ removeCSSClass(obj, old );
+ addCSSClass(obj, newc );
+}
+
+
+function addCSSClass(e,c) {
+ if(!e || !c) return;
+
+ var css_class_string = e.className;
+ var css_class_array;
+
+ if(css_class_string)
+ css_class_array = css_class_string.split(/\s+/);
+
+ var string_ip = ""; /*strip out nulls*/
+ for (var css_class in css_class_array) {
+ if (css_class_array[css_class] == c) { return; }
+ if(css_class_array[css_class] !=null)
+ string_ip += css_class_array[css_class] + " ";
+ }
+ string_ip += c;
+ e.className = string_ip;
+}
+
+function removeCSSClass(e, c) {
+ if(!e || !c) return;
+
+ var css_class_string = '';
+
+ var css_class_array = e.className;
+ if( css_class_array )
+ css_class_array = css_class_array.split(/\s+/);
+
+ var first = 1;
+ for (var css_class in css_class_array) {
+ if (css_class_array[css_class] != c) {
+ if (first == 1) {
+ css_class_string = css_class_array[css_class];
+ first = 0;
+ } else {
+ css_class_string = css_class_string + ' ' +
+ css_class_array[css_class];
+ }
+ }
+ }
+ e.className = css_class_string;
+}
+
+
+/*returns the character code pressed that caused the event */
+function grabCharCode(evt) {
+ evt = (evt) ? evt : ((window.event) ? event : null);
+ if( evt ) {
+ return (evt.charCode ? evt.charCode :
+ ((evt.which) ? evt.which : evt.keyCode ));
+ } else { return -1; }
+}
+
+
+/* returns true if the user pressed enter */
+function userPressedEnter(evt) {
+ var code = grabCharCode(evt);
+ if(code==13||code==3) return true;
+ return false;
+}
+
+
+function goTo(url) {
+ /* setTimeout because ie sux */
+ setTimeout( function(){ location.href = url; }, 0 );
+}
+
+
+function removeChildren(dom) {
+ if(!dom) return;
+ while(dom.childNodes[0])
+ dom.removeChild(dom.childNodes[0]);
+}
+
+function appendClear(node, child) {
+ if(typeof child =='string') child = text(child);
+ removeChildren(node);
+ node.appendChild(child);
+}
+
+
+function instanceOf(object, constructorFunction) {
+
+ if(!IE) {
+ while (object != null) {
+ if (object == constructorFunction.prototype)
+ return true;
+ object = object.__proto__;
+ }
+ } else {
+ while(object != null) {
+ if( object instanceof constructorFunction )
+ return true;
+ object = object.__proto__;
+ }
+ }
+ return false;
+}
+
+
+/* ------------------------------------------------------------------------------------------- */
+/* detect my browser */
+var isMac, NS, NS4, NS6, IE, IE4, IEmac, IE4plus, IE5, IE5plus, IE6, IEMajor, ver4, Safari;
+function detect_browser() {
+
+ isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
+ NS = (navigator.appName == "Netscape") ? true : false;
+ NS4 = (document.layers) ? true : false;
+ IE = (navigator.appName == "Microsoft Internet Explorer") ? true : false;
+ IEmac = ((document.all)&&(isMac)) ? true : false;
+ IE4plus = (document.all) ? true : false;
+ IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
+ IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
+ IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
+ ver4 = (NS4 || IE4plus) ? true : false;
+ NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;
+ Safari = navigator.userAgent.match(/Safari/);
+
+ IE5plus = IE5 || IE6;
+ IEMajor = 0;
+
+ if (IE4plus) {
+ var start = navigator.appVersion.indexOf("MSIE");
+ var end = navigator.appVersion.indexOf(".",start);
+ IEMajor = parseInt(navigator.appVersion.substring(start+5,end));
+ IE5plus = (IEMajor>=5) ? true : false;
+ }
+}
+detect_browser();
+/* ------------------------------------------------------------------------------------------- */
+
+
+function text(t) {
+ if(t == null) t = "";
+ return document.createTextNode(t);
+}
+
+function elem(name, attrs, txt) {
+ var e = document.createElement(name);
+ if (attrs) {
+ for (key in attrs) {
+ if( key == 'id') e.id = attrs[key];
+ else e.setAttribute(key, attrs[key]);
+ }
+ }
+ if (txt) e.appendChild(text(txt));
+ return e;
+}
+
+
+/* sel is the selector object, sets selected on the
+ option with the given value. case does not matter...*/
+function setSelector( sel, value ) {
+ if(sel && value != null) {
+ for( var i = 0; i!= sel.options.length; i++ ) {
+ if( sel.options[i] ) {
+ var val = sel.options[i].value;
+ if( val == null || val == "" ) /* for IE */
+ val = sel.options[i].innerHTML;
+ value += ""; /* in case of number */
+ if( val && val.toLowerCase() == value.toLowerCase() ) {
+ sel.selectedIndex = i;
+ sel.options[i].selected = true;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+function setSelectorRegex( sel, regex ) {
+ if(sel && regex != null) {
+ for( var i = 0; i!= sel.options.length; i++ ) {
+ if( sel.options[i] ) {
+ var val = sel.options[i].value;
+ if( val == null || val == "" ) /* for IE */
+ val = sel.options[i].innerHTML;
+ value += ""; /* in case of number */
+ if( val && val.match(regex) ) {
+ sel.selectedIndex = i;
+ sel.options[i].selected = true;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+function getSelectorVal( sel ) {
+ if(!sel) return null;
+ var idx = sel.selectedIndex;
+ if( idx < 0 ) return null;
+ var o = sel.options[idx];
+ var v = o.value;
+ if(v == null) v = o.innerHTML;
+ return v;
+}
+
+function getSelectorName( sel ) {
+ var o = sel.options[sel.selectedIndex];
+ var v = o.name;
+ if(v == null || v == undefined || v == "") v = o.innerHTML;
+ return v;
+}
+
+function setSelectorByName( sel, name ) {
+ for( var o in sel.options ) {
+ var opt = sel.options[o];
+ if( opt.name == name || opt.innerHTML == name ) {
+ sel.selectedIndex = o;
+ opt.selected = true;
+ }
+ }
+}
+
+function findSelectorOptByValue( sel, val ) {
+ for( var i = 0; i < sel.options.length; i++ ) {
+ var opt = sel.options[i];
+ if( opt.value == val ) return opt;
+ }
+ return null;
+}
+
+function debugSelector(sel) {
+ var s = 'Selector\n';
+ for( var i = 0; i != sel.options.length; i++ ) {
+ var o = sel.options[i];
+ s += "\t" + o.innerHTML + "\n";
+ }
+ return s;
+}
+
+function findParentByNodeName(node, name) {
+ while( ( node = node.parentNode) )
+ if (node.nodeName == name) return node;
+ return null;
+}
+
+/* returns only elements in nodes childNodes list, not sub-children */
+function getElementsByTagNameFlat( node, name ) {
+ var elements = [];
+ for( var e in node.childNodes ) {
+ var n = node.childNodes[e];
+ if( n && n.nodeName == name ) elements.push(n);
+ }
+ return elements;
+}
+
+/* expects a tree with a id() method on each node and a
+children() method to get to each node */
+function findTreeItemById( tree, id ) {
+ if( tree.id() == id ) return tree;
+ for( var c in tree.children() ) {
+ var found = findTreeItemById( tree.children()[c], id );
+ if(found) return found;
+ }
+ return null;
+}
+
+/* returns null if none of the tests are true. returns sub-array of
+matching array items otherwise */
+function grep( arr, func ) {
+ var results = [];
+ if(!arr) return null;
+ if( arr.constructor == Array ) {
+ for( var i = 0; i < arr.length; i++ ) {
+ if( func(arr[i]) )
+ results.push(arr[i]);
+ }
+ } else {
+ for( var i in arr ) {
+ if( func(arr[i]) )
+ results.push(arr[i]);
+ }
+ }
+ if(results.length > 0) return results;
+ return null;
+}
+
+function ogrep( obj, func ) {
+ var results = {};
+ var found = false;
+ for( var i in obj ) {
+ if( func(obj[i]) ) {
+ results[i] = obj[i];
+ found = true;
+ }
+ }
+ if(found) return results;
+ return null;
+}
+
+function doSelectorActions(sel) {
+ if((IE || Safari) && sel) {
+ sel.onchange = function() {
+ var o = sel.options[sel.selectedIndex];
+ if(o && o.onclick) o.onclick()
+ }
+ }
+}
+
+/* if index < 0, the item is pushed onto the end */
+function insertSelectorVal( selector, index, name, value, action, indent ) {
+ if( index < 0 ) index = selector.options.length;
+ var a = [];
+ for( var i = selector.options.length; i != index; i-- )
+ a[i] = selector.options[i-1];
+
+ var opt = setSelectorVal( selector, index, name, value, action, indent );
+
+ for( var i = index + 1; i < a.length; i++ )
+ selector.options[i] = a[i];
+
+ return opt;
+}
+
+/* changes the value of the option at the specified index */
+function setSelectorVal( selector, index, name, value, action, indent ) {
+ if(!indent || indent < 0) indent = 0;
+ indent = parseInt(indent);
+
+ var option;
+
+ if(IE) {
+ var pre = elem("pre");
+ for( var i = 0; i != indent; i++ )
+ pre.appendChild(text(" "));
+
+ pre.appendChild(text(name));
+ option = new Option("", value);
+ selector.options[index] = option;
+ option.appendChild(pre);
+
+ } else {
+ indent = indent * 14;
+ option= new Option(name, value);
+ option.setAttribute("style", "padding-left: "+indent+'px;');
+ selector.options[index] = option;
+ if(action) option.onclick = action;
+ }
+
+ if(action) option.onclick = action;
+ return option;
+}
+
+
+/* split on spaces. capitalize the first /\w/ character in
+ each substring */
+function normalize(val) {
+ return val; /* disable me for now */
+
+ if(!val) return "";
+
+ var newVal = '';
+ try {val = val.split(' ');} catch(E) {return val;}
+ var reg = /\w/;
+
+ for( var c = 0; c < val.length; c++) {
+
+ var string = val[c];
+ var cap = false;
+ for(var x = 0; x != string.length; x++) {
+
+ if(!cap) {
+ var ch = string.charAt(x);
+ if(reg.exec(ch + "")) {
+ newVal += string.charAt(x).toUpperCase();
+ cap = true;
+ continue;
+ }
+ }
+
+ newVal += string.charAt(x).toLowerCase();
+ }
+ if(c < (val.length-1)) newVal += " ";
+ }
+
+ newVal = newVal.replace(/\s*\.\s*$/,'');
+ newVal = newVal.replace(/\s*\/\s*\/\s*$/,' / ');
+ newVal = newVal.replace(/\s*\/\s*$/,'');
+
+ return newVal;
+}
+
+
+/* returns true if n is null or stringifies to 'undefined' */
+function isNull(n) {
+ if( n == null || n == undefined || n.toString().toLowerCase() == "undefined"
+ || n.toString().toLowerCase() == "null" )
+ return true;
+ return false;
+}
+
+
+/* find nodes with an attribute of 'name' that equals nodeName */
+
+function $n( root, nodeName ) { return findNodeByName(root,nodeName); }
+
+function findNodeByName(root, nodeName) {
+ if( !root || !nodeName) return null;
+
+ if(root.nodeType != 1) return null;
+
+ if(root.getAttribute("name") == nodeName || root.name == nodeName )
+ return root;
+
+ var children = root.childNodes;
+
+ for( var i = 0; i != children.length; i++ ) {
+ var n = findNodeByName(children[i], nodeName);
+ if(n) return n;
+ }
+
+ return null;
+}
+
+
+/* truncates the string at 'size' characters and appends a '...' to the end */
+function truncate(string, size) {
+ if(string && size != null &&
+ size > -1 && string.length > size)
+ return string.substr(0, size) + "... ";
+ return string;
+}
+
+
+/* style sheets must have a 'name' attribute for these functions to work */
+function setActivateStyleSheet(name) {
+ var i, a, main;
+ for (i = 0; (a = document.getElementsByTagName ("link")[i]); i++) {
+ if (a.getAttribute ("rel").indexOf ("style") != -1 && a.getAttribute ("name")) {
+ a.disabled = true;
+ if (a.getAttribute ("name").indexOf(name) != -1)
+ a.disabled = false;
+ }
+ }
+}
+
+
+/* ----------------------------------------------------- */
+var currentFontSize;
+function scaleFonts(type) {
+
+ var size = "";
+ var ssize = "";
+ var size2 = "";
+ var a;
+
+ if(!currentFontSize) currentFontSize = 'regular';
+ if(currentFontSize == 'regular' && type == 'regular' ) return;
+ if( currentFontSize == type ) return;
+ currentFontSize = type;
+
+ switch(type) {
+ case "large": /* these are arbitrary.. but they seem to work ok in FF/IE */
+ size = "142%";
+ size2 = "107%";
+ ssize = "94%";
+ break;
+ }
+
+ document.getElementsByTagName('body')[0].style.fontSize = size;
+ for (i = 0; (a = document.getElementsByTagName ("td")[i]); i++) a.style.fontSize = size;;
+ for (i = 0; (a = document.getElementsByTagName ("div")[i]); i++) a.style.fontSize = ssize;
+ for (i = 0; (a = document.getElementsByTagName ("option")[i]); i++) a.style.fontSize = ssize;
+ for (i = 0; (a = document.getElementsByTagName ("li")[i]); i++) a.style.fontSize = ssize;
+ for (i = 0; (a = document.getElementsByTagName ("span")[i]); i++) a.style.fontSize = ssize;
+ for (i = 0; (a = document.getElementsByTagName ("select")[i]); i++) a.style.fontSize = ssize;
+ for (i = 0; (a = document.getElementsByTagName ("a")[i]); i++) a.style.fontSize = size2;
+}
+
+
+function sortWordsIgnoreCase(a, b) {
+ a = a.toLowerCase();
+ b = b.toLowerCase();
+ if(a>b) return 1;
+ if(a<b) return -1;
+ return 0;
+}
+
+
+function getSelectedList(sel) {
+ if(!sel) return [];
+ var vals = [];
+ for( var i = 0; i != sel.options.length; i++ ) {
+ if(sel.options[i].selected)
+ vals.push(sel.options[i].value);
+ }
+ return vals;
+}
+
+
+function setEnterFunc(node, func) {
+ if(!(node && func)) return;
+ node.onkeydown = function(evt) {
+ if( userPressedEnter(evt)) func();
+ }
+}
+
+function iterate( arr, callback ) {
+ for( var i = 0; arr && i < arr.length; i++ )
+ callback(arr[i]);
+}
+
+
+
+
+/* taken directly from the JSAN util.date library */
+/* but changed from the util.date.interval_to_seconds invocation,
+because JSAN will assume the whole library is already loaded if
+it sees that, and the staff client uses both this file and the
+JSAN library*/
+function interval_to_seconds( $interval ) {
+
+ $interval = $interval.replace( /and/, ',' );
+ $interval = $interval.replace( /,/, ' ' );
+
+ var $amount = 0;
+ var results = $interval.match( /\s*\+?\s*(\d+)\s*(\w{1})\w*\s*/g);
+ for( var i = 0; i < results.length; i++ ) {
+ if(!results[i]) continue;
+ var result = results[i].match( /\s*\+?\s*(\d+)\s*(\w{1})\w*\s*/ );
+ if (result[2] == 's') $amount += result[1] ;
+ if (result[2] == 'm') $amount += 60 * result[1] ;
+ if (result[2] == 'h') $amount += 60 * 60 * result[1] ;
+ if (result[2] == 'd') $amount += 60 * 60 * 24 * result[1] ;
+ if (result[2] == 'w') $amount += 60 * 60 * 24 * 7 * result[1] ;
+ if (result[2] == 'M') $amount += ((60 * 60 * 24 * 365)/12) * result[1] ;
+ if (result[2] == 'y') $amount += 60 * 60 * 24 * 365 * result[1] ;
+ }
+ return $amount;
+}
+
+
+function openWindow( data ) {
+ if( isXUL() ) {
+ var data = window.escape(
+ '<html><head><title></title></head><body>' + data + '</body></html>');
+
+ xulG.window_open(
+ 'data:text/html,' + data,
+ '',
+ 'chrome,resizable,width=700,height=500');
+
+ } else {
+ win = window.open('','', 'resizable,width=700,height=500,scrollbars=1');
+ win.document.body.innerHTML = data;
+ }
+}
+
+
+/* alerts the innerhtml of the node with the given id */
+function alertId(id) {
+ var node = $(id);
+ if(node) alert(node.innerHTML);
+}
+
+function alertIdText(id, text) {
+ var node = $(id);
+ if(!node) return;
+ if(text)
+ alert(text + '\n\n' + node.innerHTML);
+ else
+ alert(node.innerHTML);
+}
+
+function confirmId(id) {
+ var node = $(id);
+ if(node) return confirm(node.innerHTML);
+}
+
+
+function goBack() { history.back(); }
+function goForward() { history.forward(); }
+
+
+function uniquify(arr) {
+ if(!arr) return [];
+ var newarr = [];
+ for( var i = 0; i < arr.length; i++ ) {
+ var item = arr[i];
+ if( ! grep( newarr, function(x) {return (x == item);}))
+ newarr.push(item);
+ }
+ return newarr;
+}
+
+function contains(arr, item) {
+ for( var i = 0; i < arr.length; i++ )
+ if( arr[i] == item ) return true;
+ return false;
+}
+
+function isTrue(i) {
+ return (i && !(i+'').match(/f/i) );
+}
+
+
+/* builds a JS date object with the given info. The given data
+ has to be valid (e.g. months == 30 is not valid). Returns NULL on
+ invalid date
+ Months are 1-12 (unlike the JS date object)
+ */
+
+function buildDate( year, month, day, hours, minutes, seconds ) {
+
+ if(!year) year = 0;
+ if(!month) month = 1;
+ if(!day) day = 1;
+ if(!hours) hours = 0;
+ if(!minutes) minutes = 0;
+ if(!seconds) seconds = 0;
+
+ var d = new Date(year, month - 1, day, hours, minutes, seconds);
+
+ _debug('created date with ' +
+ (d.getYear() + 1900) +'-'+
+ (d.getMonth() + 1) +'-'+
+ d.getDate()+' '+
+ d.getHours()+':'+
+ d.getMinutes()+':'+
+ d.getSeconds());
+
+
+ if(
+ (d.getYear() + 1900) == year &&
+ d.getMonth() == (month - 1) &&
+ d.getDate() == new Number(day) &&
+ d.getHours() == new Number(hours) &&
+ d.getMinutes() == new Number(minutes) &&
+ d.getSeconds() == new Number(seconds) ) {
+ return d;
+ }
+
+ return null;
+}
+
+function mkYearMonDay(date) {
+ if(!date) date = new Date();
+ var y = date.getYear() + 1900;
+ var m = (date.getMonth() + 1)+'';
+ var d = date.getDate()+'';
+ if(m.length == 1) m = '0'+m;
+ if(d.length == 1) d = '0'+d;
+ return y+'-'+m+'-'+d;
+}
+
+
+function debugFMObject(obj) {
+ if(typeof obj != 'object' ) return obj;
+ _debug("---------------------");
+ var keys = fmclasses[obj.classname];
+ if(!keys) { _debug(formatJSON(js2JSON(obj))); return; }
+
+ keys.sort();
+ for( var i = 0; i < keys.length; i++ ) {
+ var key = keys[i];
+ while( key.length < 12 ) key += ' ';
+ var val = obj[keys[i]]();
+ if( typeof val == 'object' ) {
+ _debug(key+' :=\n');
+ _debugFMObject(val);
+ } else {
+ _debug(key+' = ' +val);
+ }
+
+ }
+ _debug("---------------------");
+}
+
+
+function getTableRows(tbody) {
+ var rows = [];
+ if(!tbody) return rows;
+
+ var children = tbody.childNodes;
+ if(!children) return rows;
+
+ for(var i = 0; i < children.length; i++) {
+ var child = children[i];
+ if(child.nodeName.match(/^tr$/i))
+ rows.push(child);
+ }
+ return rows;
+}
+
+function getObjectKeys(obj) {
+ keys = []
+ for(var k in obj)
+ keys.push(k)
+ return keys;
+}
+/* Export some constants ----------------------------------------------------- */
+
+var SHOW_MR_DEFAULT = false; /* true if we show metarecords by default */
+
+//var DO_AUTHORITY_LOOKUPS = false;
+var DO_AUTHORITY_LOOKUPS = true;
+
+var STAFF_WEB_BASE_PATH = '/eg'; // root of the web-based staff interfaces
+
+/* URL param names */
+var PARAM_TERM = "t"; /* search term */
+var PARAM_FACET = "ft"; /* facet term */
+var PARAM_STYPE = "tp"; /* search type */
+var PARAM_LOCATION = "l"; /* current location */
+var PARAM_LASSO = "sg"; /* current location */
+var PARAM_DEPTH = "d"; /* search depth */
+var PARAM_FORM = "f"; /* search format */
+var PARAM_OFFSET = "o"; /* search offset */
+var PARAM_COUNT = "c"; /* hits per page */
+var PARAM_HITCOUNT = "hc"; /* hits per page */
+var PARAM_MRID = "m"; /* metarecord id */
+var PARAM_RID = "r"; /* record id */
+var PARAM_RLIST = "rl";
+var PARAM_ORIGLOC = "ol"; /* the original location */
+var PARAM_AUTHTIME = "at"; /* inactivity timeout in seconds */
+var PARAM_ADVTERM = "adv"; /* advanced search term */
+var PARAM_ADVTYPE = "adt"; /* the advanced search type */
+var PARAM_RTYPE = "rt";
+var PARAM_SORT = "s";
+var PARAM_SORT_DIR = "sd";
+var PARAM_DEBUG = "dbg";
+var PARAM_CN = "cn";
+var PARAM_LITFORM = 'lf';
+var PARAM_ITEMFORM = 'if';
+var PARAM_ITEMTYPE = 'it';
+var PARAM_BIBLEVEL = 'bl';
+var PARAM_AUDIENCE = 'a';
+var PARAM_SEARCHES = 'ss';
+var PARAM_LANGUAGE = 'la';
+var PARAM_TFORM = 'tf'; /* temporary format for title result pages */
+var PARAM_RDEPTH = 'rd';
+var PARAM_REDIR = 're'; /* true if we have been redirected by IP (we're at a real lib) */
+var PARAM_AVAIL = 'av'; /* limit search results to available items */
+var PARAM_COPYLOCS = 'cl'; // copy (shelving) locations
+var PARAM_PUBD_BEFORE = 'pdb';
+var PARAM_PUBD_AFTER = 'pda';
+var PARAM_PUBD_BETWEEN = 'pdt';
+var PARAM_PUBD_DURING = 'pdd';
+var PARAM_NOPERSIST_SEARCH = 'nps';
+
+/* URL param values (see comments above) */
+var TERM;
+var FACET;
+var STYPE;
+var LOCATION;
+var LASSO;
+var DEPTH;
+var FORM;
+var OFFSET;
+var COUNT;
+var HITCOUNT;
+var RANKS;
+var FONTSIZE;
+var ORIGLOC;
+var AUTHTIME;
+var ADVTERM;
+var ADVTYPE;
+var MRID;
+var RID;
+var RTYPE;
+var SORT;
+var SORT_DIR;
+var RLIST;
+var DEBUG;
+var CALLNUM;
+var LITFORM;
+var ITEMFORM;
+var ITEMTYPE;
+var BIBLEVEL;
+var AUDIENCE;
+var SEARCHES;
+var LANGUAGE;
+var TFORM;
+var RDEPTH;
+var AVAIL;
+var COPYLOCS;
+var PUBD_BEFORE;
+var PUBD_AFTER;
+var PUBD_BETWEEN;
+var PUBD_DURING;
+
+/* cookie values */
+var SBEXTRAS;
+var SKIN;
+
+/* cookies */
+var COOKIE_SB = "sbe";
+var COOKIE_SES = "ses";
+//var COOKIE_IDS = "ids"; /* list of mrecord ids */
+//var COOKIE_SRIDS = "srids"; /* record ids cached from a search */
+var COOKIE_FONT = "fnt";
+var COOKIE_SKIN = "skin";
+var COOKIE_RIDS = "rids"; /* list of record ids */
+var COOKIE_SEARCH = 'sr';
+
+/* pages */
+var MRESULT = "mresult";
+var RRESULT = "rresult";
+var RDETAIL = "rdetail";
+var MYOPAC = "myopac";
+var ADVANCED = "advanced";
+var HOME = "home";
+var BBAGS = "bbags";
+var REQITEMS = "reqitems";
+var CNBROWSE = "cnbrowse";
+
+/* search type (STYPE) options */
+var STYPE_AUTHOR = "author";
+var STYPE_TITLE = "title";
+var STYPE_SUBJECT = "subject";
+var STYPE_SERIES = "series";
+var STYPE_KEYWORD = "keyword";
+
+/* record-level search types */
+var RTYPE_MRID = "mrid";
+var RTYPE_COOKIE = "cookie";
+var RTYPE_AUTHOR = STYPE_AUTHOR;
+var RTYPE_SUBJECT = STYPE_SUBJECT;
+var RTYPE_TITLE = STYPE_TITLE;
+var RTYPE_SERIES = STYPE_SERIES;
+var RTYPE_KEYWORD = STYPE_KEYWORD;
+var RTYPE_LIST = "list";
+var RTYPE_MULTI = 'multi';
+var RTYPE_MARC = 'marc';
+var RTYPE_ISBN = 'isbn';
+var RTYPE_ISSN = 'issn';
+var RTYPE_TCN = 'tcn';
+
+var SORT_TYPE_REL = "rel";
+var SORT_TYPE_AUTHOR = STYPE_AUTHOR;
+var SORT_TYPE_TITLE = STYPE_TITLE;
+var SORT_TYPE_PUBDATE = "pubdate";
+var SORT_DIR_ASC = "asc";
+var SORT_DIR_DESC = "desc";
+
+/* types of advanced search */
+var ADVTYPE_MULTI = 'ml';
+var ADVTYPE_MARC = 'ma';
+
+/*
+var ADVTYPE_ISBN = 'isbn';
+var ADVTYPE_ISSN = 'issn';
+*/
+
+var LOGOUT_WARNING_TIME = 30; /* "head up" for session timeout */
+
+/* user preferences */
+var PREF_HITS_PER = 'opac.hits_per_page';
+var PREF_DEF_FONT = 'opac.default_font';
+var PREF_HOLD_NOTIFY = 'opac.hold_notify';
+var PREF_DEF_LOCATION = 'opac.default_search_location';
+var PREF_DEF_DEPTH = 'opac.default_search_depth';
+
+
+/** If enabled, added content attribution links will be
+ made visible where appropriate. The added content vendor name
+ and URL are defined in the entities in opac.dtd
+ */
+var ENABLE_ADDED_CONTENT_ATTRIB_LINKS = false;
+
+
+/* container for global variables shared accross pages */
+var G = {};
+G.user = null; /* global user object */
+G.ui = {} /* cache of UI components */
+
+
+/* regexes */
+var REGEX_BARCODE = /^\d+/; /* starts with a number */
+var REGEX_PHONE = /^\d{3}-\d{3}-\d{4}$/; /* 111-222-3333 */
+
+
+/* call me after page init and I will load references
+ to all of the ui object id's defined below
+ They will be stored in G.ui.<page>.<thingy>
+ */
+function loadUIObjects() {
+ for( var p in config.ids ) {
+ G.ui[p] = {};
+ for( var o in config.ids[p] )
+ G.ui[p][o] = getId(config.ids[p][o]);
+ }
+}
+
+/* try our best to free memory */
+function clearUIObjects() {
+ for( var p in config.ids ) {
+ for( var o in config.ids[p] ) {
+ if(G.ui[p][o]) {
+ G.ui[p][o].onclick = null;
+ G.ui[p][o].onkeydown = null;
+ G.ui[p][o] = null;
+ }
+ }
+ G.ui[p] = null;
+ }
+}
+
+/* ----------------------------------------------------------------------------
+ Set up ID's and CSS classes
+ Any new ids, css, etc. may be added by giving the unique names and putting
+ them into the correct scope
+/* ---------------------------------------------------------------------------- */
+
+var config = {};
+
+/* Set up the page names */
+config.page = {};
+config.page[HOME] = "index.xml";
+config.page[ADVANCED] = "advanced.xml";
+config.page[MRESULT] = "mresult.xml";
+config.page[RRESULT] = "rresult.xml";
+config.page[MYOPAC] = "myopac.xml";
+config.page[RDETAIL] = "rdetail.xml";
+config.page[BBAGS] = "bbags.xml";
+config.page[REQITEMS] = "reqitems.xml";
+config.page[CNBROWSE] = "cnbrowse.xml";
+
+/* themes */
+config.themes = {};
+
+/* set up images */
+config.images = {};
+config.images.logo = "main_logo.jpg";
+
+
+/* set up ID's, CSS, and node names */
+config.ids = {};
+config.ids.result = {};
+config.ids.mresult = {};
+config.ids.advanced = {};
+config.ids.rresult = {};
+config.ids.myopac = {};
+config.ids.rdetail = {};
+
+config.css = {};
+config.css.result = {};
+config.css.mresult = {};
+config.css.advanced = {};
+config.css.rresult = {};
+config.css.myopac = {};
+config.css.rdetail = {};
+
+config.names = {};
+config.names.result = {};
+config.names.mresult = {};
+config.names.advanced = {};
+config.names.rresult = {};
+config.names.myopac = {};
+config.names.rdetail = {};
+
+
+/* id's shared accross skins. These *must* be defined */
+config.ids.common = {};
+config.ids.common.loading = "loading_div";
+config.ids.common.canvas = "canvas";
+config.ids.common.canvas_main = "canvas_main";
+config.ids.common.org_tree = "org_tree";
+config.ids.common.org_container = "org_container";
+
+config.ids.xul = {};
+
+
+/* shared CSS */
+config.css.hide_me = "hide_me";
+config.css.dim = "dim";
+config.css.dim2 = "dim2";
+
+
+/* ---------------------------------------------------------------------------- */
+/* These are pages that may replace the canvas */
+/* ---------------------------------------------------------------------------- */
+config.ids.altcanvas = {};
+
+
+
+/* ---------------------------------------------------------------------------- */
+/* Methods are defined as service:method
+ An optional 3rd component is when a method is followed by a :1, such methods
+ have a staff counterpart and should have ".staff" appended to the method
+ before the method is called when in XUL mode */
+
+var SEARCH_MRS = 'open-ils.search:open-ils.search.metabib.multiclass:1';
+var SEARCH_RS = 'open-ils.search:open-ils.search.biblio.multiclass:1';
+var SEARCH_MRS_QUERY = 'open-ils.search:open-ils.search.metabib.multiclass.query:1';
+var SEARCH_RS_QUERY = 'open-ils.search:open-ils.search.biblio.multiclass.query:1';
+var FETCH_SEARCH_RIDS = "open-ils.search:open-ils.search.biblio.record.class.search:1";
+var CREATE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.xml.create";
+var DELETE_MFHD_RECORD = "open-ils.cat:open-ils.cat.serial.record.delete";
+var FETCH_MFHD_SUMMARY = "open-ils.search:open-ils.search.serial.record.bib.retrieve";
+var FETCH_MRMODS = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
+var FETCH_MODS_FROM_COPY = "open-ils.search:open-ils.search.biblio.mods_from_copy";
+var FETCH_MR_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
+var FETCH_RIDS = "open-ils.search:open-ils.search.biblio.metarecord_to_records:1";
+var FETCH_RMODS = "open-ils.search:open-ils.search.biblio.record.mods_slim.retrieve";
+var FETCH_R_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.record.copy_count:1";
+var FETCH_FLESHED_USER = "open-ils.actor:open-ils.actor.user.fleshed.retrieve";
+var FETCH_SESSION = "open-ils.auth:open-ils.auth.session.retrieve";
+var LOGIN_INIT = "open-ils.auth:open-ils.auth.authenticate.init";
+var LOGIN_COMPLETE = "open-ils.auth:open-ils.auth.authenticate.complete";
+var LOGIN_DELETE = "open-ils.auth:open-ils.auth.session.delete";
+var FETCH_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.retrieve";
+var UPDATE_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.update";
+var FETCH_COPY_STATUSES = "open-ils.search:open-ils.search.config.copy_status.retrieve.all";
+var FETCH_COPY_LOCATION_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_location_counts.summary.retrieve";
+var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve";
+//var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.location.summary.retrieve";
+var FETCH_MARC_HTML = "open-ils.search:open-ils.search.biblio.record.html";
+var FETCH_CHECKED_OUT_SUM = "open-ils.actor:open-ils.actor.user.checked_out";
+var FETCH_HOLDS = "open-ils.circ:open-ils.circ.holds.retrieve";
+var FETCH_FINES_SUMMARY = "open-ils.actor:open-ils.actor.user.fines.summary";
+var FETCH_TRANSACTIONS = "open-ils.actor:open-ils.actor.user.transactions.have_charge.fleshed";
+var FETCH_MONEY_BILLING = 'open-ils.circ:open-ils.circ.money.billing.retrieve.all';
+var FETCH_CROSSREF = "open-ils.search:open-ils.search.authority.crossref";
+var FETCH_CROSSREF_BATCH = "open-ils.search:open-ils.search.authority.crossref.batch";
+var CREATE_HOLD = "open-ils.circ:open-ils.circ.holds.create";
+var CREATE_HOLD_OVERRIDE = "open-ils.circ:open-ils.circ.holds.create.override";
+var CANCEL_HOLD = "open-ils.circ:open-ils.circ.hold.cancel";
+var UPDATE_USERNAME = "open-ils.actor:open-ils.actor.user.username.update";
+var UPDATE_PASSWORD = "open-ils.actor:open-ils.actor.user.password.update";
+var UPDATE_EMAIL = "open-ils.actor:open-ils.actor.user.email.update";
+var RENEW_CIRC = "open-ils.circ:open-ils.circ.renew";
+var CHECK_SPELL = "open-ils.search:open-ils.search.spellcheck";
+var FETCH_REVIEWS = "open-ils.search:open-ils.search.added_content.review.retrieve.all";
+var FETCH_TOC = "open-ils.search:open-ils.search.added_content.toc.retrieve";
+var FETCH_ACONT_SUMMARY = "open-ils.search:open-ils.search.added_content.summary.retrieve";
+var FETCH_USER_BYBARCODE = "open-ils.actor:open-ils.actor.user.fleshed.retrieve_by_barcode";
+var FETCH_ADV_MARC_MRIDS = "open-ils.search:open-ils.search.biblio.marc:1";
+var FETCH_ADV_ISBN_RIDS = "open-ils.search:open-ils.search.biblio.isbn:1";
+var FETCH_ADV_ISSN_RIDS = "open-ils.search:open-ils.search.biblio.issn:1";
+var FETCH_ADV_TCN_RIDS = "open-ils.search:open-ils.search.biblio.tcn";
+var FETCH_CNBROWSE = 'open-ils.search:open-ils.search.callnumber.browse';
+var FETCH_CONTAINERS = 'open-ils.actor:open-ils.actor.container.retrieve_by_class.authoritative';
+var CREATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.create';
+var DELETE_CONTAINER = 'open-ils.actor:open-ils.actor.container.full_delete';
+var CREATE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.create';
+var DELETE_CONTAINER_ITEM = 'open-ils.actor:open-ils.actor.container.item.delete';
+var FLESH_CONTAINER = 'open-ils.actor:open-ils.actor.container.flesh';
+var FLESH_PUBLIC_CONTAINER = 'open-ils.actor:open-ils.actor.container.public.flesh';
+var UPDATE_CONTAINER = 'open-ils.actor:open-ils.actor.container.update';
+var FETCH_COPY = 'open-ils.search:open-ils.search.asset.copy.retrieve';
+var FETCH_FLESHED_COPY = 'open-ils.search:open-ils.search.asset.copy.fleshed2.retrieve';
+var CHECK_HOLD_POSSIBLE = 'open-ils.circ:open-ils.circ.title_hold.is_possible';
+var UPDATE_HOLD = 'open-ils.circ:open-ils.circ.hold.update';
+var FETCH_COPIES_FROM_VOLUME = 'open-ils.search:open-ils.search.asset.copy.retrieve_by_cn_label:1';
+var FETCH_VOLUME_BY_INFO = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */
+var FETCH_VOLUME = 'open-ils.search:open-ils.search.asset.call_number.retrieve';
+var FETCH_ISSUANCE = 'open-ils.serial:open-ils.serial.issuance.pub_fleshed.batch.retrieve';
+var FETCH_COPY_LOCATIONS = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all';
+var FETCH_COPY_NOTES = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all';
+var FETCH_COPY_STAT_CATS = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy';
+
+/* XXX deprecated. Use ccvm's instead */
+var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all';
+var FETCH_ITEM_FORMS = 'open-ils.search:open-ils.search.biblio.item_form_map.retrieve.all';
+var FETCH_ITEM_TYPES = 'open-ils.search:open-ils.search.biblio.item_type_map.retrieve.all';
+var FETCH_BIB_LEVELS = 'open-ils.search:open-ils.search.biblio.bib_level_map.retrieve.all';
+var FETCH_AUDIENCES = 'open-ils.search:open-ils.search.biblio.audience_map.retrieve.all';
+/* ----------------------------------- */
+
+//var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.status.retrieve';
+var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.queue_stats.retrieve';
+var FETCH_NON_CAT_CIRCS = 'open-ils.circ:open-ils.circ.open_non_cataloged_circulation.user';
+var FETCH_NON_CAT_CIRC = 'open-ils.circ:open-ils.circ.non_cataloged_circulation.retrieve';
+var FETCH_NON_CAT_TYPES = "open-ils.circ:open-ils.circ.non_cat_types.retrieve.all";
+var FETCH_BRE = 'open-ils.search:open-ils.search.biblio.record_entry.slim.retrieve';
+var CHECK_USERNAME = 'open-ils.actor:open-ils.actor.username.exists';
+var FETCH_CIRC_BY_ID = 'open-ils.circ:open-ils.circ.retrieve';
+var FETCH_MR_DESCRIPTORS = 'open-ils.search:open-ils.search.metabib.record_to_descriptors';
+var FETCH_HIGHEST_PERM_ORG = 'open-ils.actor:open-ils.actor.user.perm.highest_org.batch';
+var FETCH_USER_NOTES = 'open-ils.actor:open-ils.actor.note.retrieve.all';
+var FETCH_ORG_BY_SHORTNAME = 'open-ils.actor:open-ils.actor.org_unit.retrieve_by_shortname';
+var FETCH_BIB_IDS_BY_BARCODE = 'open-ils.search:open-ils.search.multi_home.bib_ids.by_barcode';
+var FETCH_ORG_SETTING = 'open-ils.actor:open-ils.actor.ou_setting.ancestor_default';
+var TEST_PEER_BIBS = 'open-ils.search:open-ils.search.peer_bibs.test';
+var FETCH_PEER_BIBS = 'open-ils.search:open-ils.search.peer_bibs';
+
+/* ---------------------------------------------------------------------------- */
+
+
+/* ---------------------------------------------------------------------------- */
+/* event callback functions. Other functions may be appended to these vars to
+ for added functionality. */
+
+G.evt = {}; /* events container */
+
+function runEvt(scope, name, a, b, c, d, e, f, g) {
+ var evt = G.evt[scope][name];
+ for( var i in evt ) {
+ evt[i](a, b, c, d, e, f, g);
+ }
+}
+
+/* creates a new event if it doesn't already exist */
+function createEvt(scope, name) {
+ if(!G.evt[scope]) G.evt[scope] = {};
+ if(G.evt[scope][name] == null)
+ G.evt[scope][name] = [];
+}
+
+function attachEvt(scope, name, action) {
+ createEvt(scope, name);
+ G.evt[scope][name].push(action);
+}
+
+function detachAllEvt(scope, name) {
+ G.evt[scope][name] = [];
+}
+
+
+createEvt("common", "init"); /* f() : what happens on page init */
+createEvt("common", "pageRendered"); /* f() : what happens when the page is done (up to the skin to call this even)*/
+createEvt("common", "unload"); /* f() : what happens on window unload (clean memory, etc.)*/
+createEvt("common", "locationChanged"); /* f() : what happens when the location has changed */
+createEvt("common", "locationUpdated"); /* f() : what happens when the location has updated by the code */
+
+createEvt("common", "run"); /* f() : make the page do stuff */
+createEvt("result", "idsReceived"); /* f(ids) */
+createEvt("rresult", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */
+createEvt("result", "preCollectRecords"); /* f() we're about to go and grab the recs */
+
+createEvt("result", "hitCountReceived"); /* f() : display hit info, pagination, etc. */
+createEvt("result", "recordReceived"); /* f(mvr, pagePosition, isMr) : display the record*/
+createEvt("result", "recordDrawn"); /* f(recordid, linkDOMNode) : after record is drawn, allow others (xul) to plugin actions */
+createEvt("result", "copyCountsReceived"); /* f(mvr, pagePosition, copyCountInfo) : display copy counts*/
+createEvt("result", "allRecordsReceived"); /* f(mvrsArray) : add other page stuff, sidebars, etc.*/
+
+createEvt("rdetail", "recordDrawn"); /* f() : the record has been drawn */
+
+createEvt("common", "loggedIn"); /* f() : user has just logged in */
+createEvt("common", "loginCanceled"); /* f() : user has just logged in */
+createEvt('result', 'zeroHits');
+createEvt('result', 'lowHits');
+createEvt('rdetail', 'recordRetrieved'); /* we are about to draw the rdetail page */
+createEvt('common', 'depthChanged');
+createEvt('common', 'holdUpdated');
+createEvt('common', 'holdUpdateCanceled');
+
+createEvt('rdetail', 'nextPrevDrawn');
+
+
+
+
+
+function CGI() {
+ /* load up the url parameters */
+
+ this._keys = new Array();
+ this.data = new Object();
+
+ var string = location.search.replace(/^\?/,"");
+ this.server_name = location.href.replace(/^https?:\/\/([^\/]+).+$/,"$1");
+
+ var key = "";
+ var value = "";
+ var inkey = true;
+ var invalue = false;
+
+ for( var idx = 0; idx!= string.length; idx++ ) {
+
+ var c = string.charAt(idx);
+
+ if( c == "=" ) {
+ invalue = true;
+ inkey = false;
+ continue;
+ }
+
+ if(c == "&" || c == ";") {
+ inkey = 1;
+ invalue = 0;
+ if( ! this.data[key] ) this.data[key] = [];
+ this.data[key].push(decodeURIComponent(value));
+ this._keys.push(key);
+ key = ""; value = "";
+ continue;
+ }
+
+ if(inkey) key += c;
+ else if(invalue) value += c;
+ }
+
+ if( ! this.data[key] ) this.data[key] = [];
+ this.data[key].push(decodeURIComponent(value));
+ this._keys.push(key);
+}
+
+/* returns the value for the given param. If there is only one value for the
+ given param, it returns that value. Otherwise it returns an array of values
+ */
+CGI.prototype.param = function(p) {
+ if(this.data[p] == null) return null;
+ if(this.data[p].length == 1)
+ return this.data[p][0];
+ return this.data[p];
+}
+
+/* returns an array of param names */
+CGI.prototype.keys = function() {
+ return this._keys;
+}
+
+/* debuggin method */
+CGI.prototype.toString = function() {
+ var string = "";
+ var keys = this.keys();
+
+ for( var k in keys ) {
+ string += keys[k] + " : ";
+ var params = this.param(keys[k]);
+
+ for( var p in params ) {
+ string += params[p] + " ";
+ }
+ string += "\n";
+ }
+ return string;
+}
+
+
+/*
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+/*
+ * Configurable variables. You may need to tweak these to be compatible with
+ * the server-side, but the defaults work in most cases.
+ */
+var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
+var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
+var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
+
+/*
+ * These are the functions you'll usually want to call
+ * They take string arguments and return either hex or base-64 encoded strings
+ */
+function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
+function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
+function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
+function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
+function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
+function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
+
+/*
+ * Perform a simple self-test to see if the VM is working
+ */
+function md5_vm_test()
+{
+ return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
+}
+
+/*
+ * Calculate the MD5 of an array of little-endian words, and a bit length
+ */
+function core_md5(x, len)
+{
+ /* append padding */
+ x[len >> 5] |= 0x80 << ((len) % 32);
+ x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+ var a = 1732584193;
+ var b = -271733879;
+ var c = -1732584194;
+ var d = 271733878;
+
+ for(var i = 0; i < x.length; i += 16)
+ {
+ var olda = a;
+ var oldb = b;
+ var oldc = c;
+ var oldd = d;
+
+ a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
+ d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
+ c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
+ b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
+ a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
+ d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
+ c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
+ b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
+ a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
+ d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
+ c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
+ b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
+ a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
+ d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
+ c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
+ b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
+
+ a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
+ d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
+ c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
+ b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
+ a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
+ d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
+ c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
+ b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
+ a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
+ d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
+ c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
+ b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
+ a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
+ d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
+ c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
+ b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
+
+ a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
+ d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
+ c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
+ b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
+ a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
+ d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
+ c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
+ b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
+ a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
+ d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
+ c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
+ b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
+ a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
+ d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
+ c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
+ b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
+
+ a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
+ d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
+ c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
+ b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
+ a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
+ d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
+ c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
+ b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
+ a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
+ d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
+ c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
+ b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
+ a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
+ d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
+ c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
+ b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
+
+ a = safe_add(a, olda);
+ b = safe_add(b, oldb);
+ c = safe_add(c, oldc);
+ d = safe_add(d, oldd);
+ }
+ return Array(a, b, c, d);
+
+}
+
+/*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+function md5_cmn(q, a, b, x, s, t)
+{
+ return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
+}
+function md5_ff(a, b, c, d, x, s, t)
+{
+ return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+}
+function md5_gg(a, b, c, d, x, s, t)
+{
+ return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+}
+function md5_hh(a, b, c, d, x, s, t)
+{
+ return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+}
+function md5_ii(a, b, c, d, x, s, t)
+{
+ return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+}
+
+/*
+ * Calculate the HMAC-MD5, of a key and some data
+ */
+function core_hmac_md5(key, data)
+{
+ var bkey = str2binl(key);
+ if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
+
+ var ipad = Array(16), opad = Array(16);
+ for(var i = 0; i < 16; i++)
+ {
+ ipad[i] = bkey[i] ^ 0x36363636;
+ opad[i] = bkey[i] ^ 0x5C5C5C5C;
+ }
+
+ var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
+ return core_md5(opad.concat(hash), 512 + 128);
+}
+
+/*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+function safe_add(x, y)
+{
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF);
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+}
+
+/*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+function bit_rol(num, cnt)
+{
+ return (num << cnt) | (num >>> (32 - cnt));
+}
+
+/*
+ * Convert a string to an array of little-endian words
+ * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
+ */
+function str2binl(str)
+{
+ var bin = Array();
+ var mask = (1 << chrsz) - 1;
+ for(var i = 0; i < str.length * chrsz; i += chrsz)
+ bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
+ return bin;
+}
+
+/*
+ * Convert an array of little-endian words to a string
+ */
+function binl2str(bin)
+{
+ var str = "";
+ var mask = (1 << chrsz) - 1;
+ for(var i = 0; i < bin.length * 32; i += chrsz)
+ str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
+ return str;
+}
+
+/*
+ * Convert an array of little-endian words to a hex string.
+ */
+function binl2hex(binarray)
+{
+ var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
+ var str = "";
+ for(var i = 0; i < binarray.length * 4; i++)
+ {
+ str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
+ hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
+ }
+ return str;
+}
+
+/*
+ * Convert an array of little-endian words to a base-64 string
+ */
+function binl2b64(binarray)
+{
+ var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var str = "";
+ for(var i = 0; i < binarray.length * 4; i += 3)
+ {
+ var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
+ | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
+ | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
+ for(var j = 0; j < 4; j++)
+ {
+ if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
+ else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
+ }
+ }
+ return str;
+}
+/*
+var stpicopen = '../../../../images/slimtree/folder.gif';
+var stpicclose = '../../../../images/slimtree/folderopen.gif';
+*/
+var stpicopen = '../../../../images/slimtree/folder2.gif';
+var stpicclose = '../../../../images/slimtree/folderopen2.gif';
+var stpicblank = '../../../../images/slimtree/page.gif';
+var stpicline = '../../../../images/slimtree/line.gif';
+var stpicjoin = '../../../../images/slimtree/join.gif';
+var stpicjoinb = '../../../../images/slimtree/joinbottom.gif';
+
+var stimgopen;
+var stimgclose;
+var stimgblank;
+var stimgline;
+var stimgjoin;
+
+function _apc(root,node) { root.appendChild(node); }
+
+function SlimTree(context, handle, rootimg) {
+
+ if(!stimgopen) {
+ stimgopen = elem('img',{src:stpicopen,border:0, style:'height:13px;width:31px;'});
+ stimgclose = elem('img',{src:stpicclose,border:0, style:'height:13px;width:31px;'});
+ stimgblank = elem('img',{src:stpicblank,border:0, style:'height:18px;width:18px;'});
+ stimgline = elem('img',{src:stpicline,border:0, style:'height:18px;width:18px;'});
+ stimgjoin = elem('img',{src:stpicjoin,border:0, style:'display:inline;height:18px;width:18px;'});
+ }
+
+ this.context = context;
+ this.handle = handle;
+ this.cache = new Object();
+ if(rootimg)
+ this.rootimg = elem('img',
+ {src:rootimg,border:0,style:'padding-right: 4px;'});
+}
+
+SlimTree.prototype.addCachedChildren = function(pid) {
+ var child;
+ while( child = this.cache[pid].shift() )
+ this.addNode( child.id, child.pid,
+ child.name, child.action, child.title );
+ this.cache[pid] = null;
+}
+
+SlimTree.prototype.addNode = function( id, pid, name, action, title, cls ) {
+
+ if( pid != -1 && !$(pid)) {
+ if(!this.cache[pid]) this.cache[pid] = new Array();
+ this.cache[pid].push(
+ {id:id,pid:pid,name:name,action:action,title:title });
+ return;
+ }
+
+ if(!action)
+ action='javascript:'+this.handle+'.toggle("'+id+'");';
+
+ var actionref;
+ if( typeof action == 'string' )
+ actionref = elem('a',{href:action}, name);
+ else {
+ actionref = elem('a',{href:'javascript:void(0);'}, name);
+ actionref.onclick = action;
+ }
+
+ var div = elem('div',{id:id});
+ var topdiv = elem('div',{style:'vertical-align:middle'});
+ var link = elem('a', {id:'stlink_' + id});
+ var contdiv = elem('div',{id:'stcont_' + id});
+
+ if(cls) addCSSClass(actionref, cls);
+
+ //actionref.setAttribute('href',action);
+ if(title) actionref.setAttribute('title',title);
+ else actionref.setAttribute('title',name);
+
+ _apc(topdiv,link);
+ _apc(topdiv,actionref);
+ _apc(div,topdiv);
+ _apc(div,contdiv);
+
+ if( pid == -1 ) {
+
+ this.rootid = id;
+ _apc(this.context,div);
+ if(this.rootimg) _apc(link,this.rootimg.cloneNode(true));
+ else _apc(link,stimgblank.cloneNode(true));
+
+ } else {
+
+ if(pid == this.rootid) this.open(pid);
+ else this.close(pid);
+ $(pid).setAttribute('haschild','1');
+ _apc(link,stimgblank.cloneNode(true));
+ div.style.paddingLeft = '18px';
+ div.style.backgroundImage = 'url('+stpicjoinb+')';
+ div.style.backgroundRepeat = 'no-repeat';
+ _apc($('stcont_' + pid), div);
+ if (div.previousSibling) stMakePaths(div);
+ }
+ if(this.cache[id]) this.addCachedChildren(id);
+}
+
+function stMakePaths(div) {
+ _apc(div.previousSibling.firstChild,stimgjoin.cloneNode(true));
+ _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild);
+ _apc(div.previousSibling.firstChild,div.previousSibling.firstChild.firstChild);
+ div.previousSibling.firstChild.firstChild.style.marginLeft = '-18px';
+ div.previousSibling.style.backgroundImage = 'url('+stpicline+')';
+ div.previousSibling.style.backgroundRepeat = 'repeat-y';
+}
+
+SlimTree.prototype.expandAll = function() { this.flex(this.rootid, 'open'); }
+SlimTree.prototype.closeAll = function() { this.flex(this.rootid,'close'); }
+SlimTree.prototype.flex = function(id, type) {
+ if(type=='open') this.open(id);
+ else { if (id != this.rootid) this.close(id); }
+ var n = $('stcont_' + id);
+ for( var c = 0; c != n.childNodes.length; c++ ) {
+ var ch = n.childNodes[c];
+ if(ch.nodeName.toLowerCase() == 'div') {
+ if($(ch.id).getAttribute('haschild') == '1')
+ this.flex(ch.id, type);
+ }
+ }
+}
+
+SlimTree.prototype.toggle = function(id) {
+ if($(id).getAttribute('ostate') == '1') this.open(id);
+ else if($(id).getAttribute('ostate') == '2') this.close(id);
+}
+
+SlimTree.prototype.open = function(id) {
+ if($(id).getAttribute('ostate') == '2') return;
+ var link = $('stlink_' + id);
+ if(!link) return;
+ if(id != this.rootid || !this.rootimg) {
+ removeChildren(link);
+ _apc(link,stimgclose.cloneNode(true));
+ }
+ link.setAttribute('href','javascript:' + this.handle + '.close("'+id+'");');
+ unHideMe($('stcont_' + id));
+ $(id).setAttribute('ostate','2');
+}
+
+SlimTree.prototype.close = function(id) {
+ var link = $('stlink_' + id);
+ if(!link) return;
+ if(id != this.rootid || !this.rootimg) {
+ removeChildren(link);
+ _apc(link,stimgopen.cloneNode(true));
+ }
+ link.setAttribute('href','javascript:' + this.handle + '.open("'+id+'");');
+ hideMe($('stcont_' + id));
+ $(id).setAttribute('ostate','1');
+}
+
+/* - Request ------------------------------------------------------------- */
+
+
+/* define it again here for pages that don't load RemoteRequest */
+function isXUL() { try { if(IAMXUL) return true;}catch(e){return false;}; }
+
+
+var __ilsEvent; /* the last event the occurred */
+
+var DEBUGSLIM;
+function Request(type) {
+
+ var s = type.split(":");
+ if(s[2] == "1" && isXUL()) s[1] += ".staff";
+ this.request = new RemoteRequest(s[0], s[1]);
+ var p = [];
+
+ if(isXUL()) {
+ if(!location.href.match(/^https:/))
+ this.request.setSecure(false);
+
+ } else {
+
+ if( G.user && G.user.session ) {
+ /* if the user is logged in, all activity resets the timeout
+ This is not entirely accurate in the sense that not all
+ requests will reset the server timeout - this should
+ get close enough, however.
+ */
+ var at = getAuthtime();
+ if(at) new AuthTimer(at).run();
+ }
+ }
+
+ for( var x = 1; x!= arguments.length; x++ ) {
+ p.push(arguments[x]);
+ this.request.addParam(arguments[x]);
+ }
+
+ if( getDebug() ) {
+ var str = "";
+ for( var i = 0; i != p.length; i++ ) {
+ if( i > 0 ) str += ", "
+ str += js2JSON(p[i]);
+ }
+ _debug('request ' + s[0] + ' ' + s[1] + ' ' + str );
+
+ } else if( DEBUGSLIM ) {
+ _debug('request ' + s[1]);
+ }
+}
+
+Request.prototype.callback = function(cal) {this.request.setCompleteCallback(cal);}
+Request.prototype.send = function(block){this.request.send(block);}
+Request.prototype.result = function(){return this.request.getResultObject();}
+
+function showCanvas() {
+ for( var x in G.ui.altcanvas ) {
+ hideMe(G.ui.altcanvas[x]);
+ }
+ hideMe(G.ui.common.loading);
+ unHideMe(G.ui.common.canvas_main);
+ try{G.ui.searchbar.text.focus();}catch(e){}
+}
+
+function swapCanvas(newNode) {
+ for( var x in G.ui.altcanvas )
+ hideMe(G.ui.altcanvas[x]);
+
+ hideMe(G.ui.common.loading);
+ hideMe(G.ui.common.canvas_main);
+ unHideMe(newNode);
+}
+
+/* finds the name of the current page */
+var currentPage = null;
+function findCurrentPage() {
+ if(currentPage) return currentPage;
+
+ var pages = [];
+ for( var p in config.page ) pages.push(config.page[p]);
+ pages = pages.sort( function(a,b){ return - (a.length - b.length); } );
+
+ var path = location.pathname;
+ if(!path.match(/.*\.xml$/))
+ path += "index.xml"; /* in case they go to / */
+
+ var page = null;
+ for( var p = 0; p < pages.length; p++ ) {
+ if( path.indexOf(pages[p]) != -1)
+ page = pages[p];
+ }
+
+ for( var p in config.page ) {
+ if(config.page[p] == page) {
+ currentPage = p;
+ return p;
+ }
+ }
+ return null;
+}
+
+
+/* sets all of the params values ----------------------------- */
+function initParams() {
+ var cgi = new CGI();
+
+ /* handle the location var */
+ var org;
+ var loc = cgi.param(PARAM_LOCATION);
+ var lasso = cgi.param(PARAM_LASSO);
+
+ if ( lasso ) {
+ lasso = findOrgLasso( lasso );
+ LASSO = lasso ? lasso.id() : null;
+ }
+
+ if (loc) {
+ org = findOrgUnit(loc);
+ LOCATION = org ? org.id() : null;
+
+ if ( !LOCATION ){
+ org = findOrgUnit(loc);
+ LOCATION = org ? org.id() : null;
+ }
+ }
+
+ org = null;
+ loc = cgi.param(PARAM_ORIGLOC);
+ if( loc ) {
+ org = findOrgUnit(loc);
+ if(!org) org = findOrgUnitSN(loc);
+ }
+ ORIGLOC = (org) ? org.id() : null;
+
+
+ DEPTH = parseInt(cgi.param(PARAM_DEPTH));
+ if(isNaN(DEPTH)) DEPTH = null;
+
+
+ FACET = cgi.param(PARAM_FACET);
+ TERM = cgi.param(PARAM_TERM);
+ STYPE = cgi.param(PARAM_STYPE);
+ FORM = cgi.param(PARAM_FORM);
+ //DEPTH = parseInt(cgi.param(PARAM_DEPTH));
+ OFFSET = parseInt(cgi.param(PARAM_OFFSET));
+ COUNT = parseInt(cgi.param(PARAM_COUNT));
+ HITCOUNT = parseInt(cgi.param(PARAM_HITCOUNT));
+ MRID = parseInt(cgi.param(PARAM_MRID));
+ RID = parseInt(cgi.param(PARAM_RID));
+ AUTHTIME = parseInt(cgi.param(PARAM_AUTHTIME));
+ ADVTERM = cgi.param(PARAM_ADVTERM);
+ ADVTYPE = cgi.param(PARAM_ADVTYPE);
+ RTYPE = cgi.param(PARAM_RTYPE);
+ SORT = cgi.param(PARAM_SORT);
+ SORT_DIR = cgi.param(PARAM_SORT_DIR);
+ DEBUG = cgi.param(PARAM_DEBUG);
+ CALLNUM = cgi.param(PARAM_CN);
+ LITFORM = cgi.param(PARAM_LITFORM);
+ ITEMFORM = cgi.param(PARAM_ITEMFORM);
+ ITEMTYPE = cgi.param(PARAM_ITEMTYPE);
+ BIBLEVEL = cgi.param(PARAM_BIBLEVEL);
+ AUDIENCE = cgi.param(PARAM_AUDIENCE);
+ SEARCHES = cgi.param(PARAM_SEARCHES);
+ LANGUAGE = cgi.param(PARAM_LANGUAGE);
+ TFORM = cgi.param(PARAM_TFORM);
+ RDEPTH = cgi.param(PARAM_RDEPTH);
+ AVAIL = cgi.param(PARAM_AVAIL);
+ COPYLOCS = cgi.param(PARAM_COPYLOCS);
+ PUBD_BEFORE = cgi.param(PARAM_PUBD_BEFORE);
+ PUBD_AFTER = cgi.param(PARAM_PUBD_AFTER);
+ PUBD_BETWEEN = cgi.param(PARAM_PUBD_BETWEEN);
+ PUBD_DURING = cgi.param(PARAM_PUBD_DURING);
+
+
+ /* set up some sane defaults */
+ //if(isNaN(DEPTH)) DEPTH = 0;
+ if(isNaN(RDEPTH)) RDEPTH = 0;
+ if(isNaN(OFFSET)) OFFSET = 0;
+ if(isNaN(COUNT)) COUNT = 10;
+ if(isNaN(HITCOUNT)) HITCOUNT = 0;
+ if(isNaN(MRID)) MRID = 0;
+ if(isNaN(RID)) RID = 0;
+ if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */
+ if(isNaN(AUTHTIME)) AUTHTIME = 0;
+ if(ADVTERM==null) ADVTERM = "";
+ if(isNaN(AVAIL)) AVAIL = 0;
+}
+
+function clearSearchParams() {
+ TERM = null;
+ STYPE = null;
+ FORM = null;
+ OFFSET = 0;
+ HITCOUNT = 0;
+ ADVTERM = null;
+ ADVTYPE = null;
+ MRID = null;
+ RID = null;
+ RTYPE = null;
+ SORT = null;
+ SORT_DIR = null;
+ RLIST = null;
+ CALLNUM = null;
+ LITFORM = null;
+ ITEMFORM = null;
+ ITEMTYPE = null;
+ BIBLEVEL = null;
+ AUDIENCE = null;
+ SEARCHES = null;
+ LANGUAGE = null;
+ RDEPTH = null;
+ AVAIL = null;
+ COPYLOCS = null;
+ PUBD_BEFORE = null;
+ PUBD_AFTER = null;
+ PUBD_BETWEEN = null;
+ PUBD_DURING = null;
+}
+
+
+function initCookies() {
+ dojo.require('dojo.cookie');
+ FONTSIZE = "regular";
+ var font = dojo.cookie(COOKIE_FONT);
+ scaleFonts(font);
+ if(font) FONTSIZE = font;
+ SKIN = dojo.cookie(COOKIE_SKIN);
+ if(findCurrentPage() == HOME)
+ dojo.cookie(COOKIE_SEARCH,null,{'expires':-1});
+}
+
+/* URL param accessors */
+function getTerm(){return TERM;}
+function getFacet(){return FACET;}
+function getStype(){return STYPE;}
+function getLocation(){return LOCATION;}
+function getLasso(){return LASSO;}
+function getDepth(){return DEPTH;}
+function getForm(){return FORM;}
+function getTform(){return TFORM;}
+function getOffset(){return OFFSET;}
+function getDisplayCount(){return COUNT;}
+function getHitCount(){return HITCOUNT;}
+function getMrid(){return MRID;};
+function getRid(){return RID;};
+function getOrigLocation(){return ORIGLOC;}
+function getAuthtime() { return AUTHTIME; }
+function getSearchBarExtras(){return SBEXTRAS;}
+function getFontSize(){return FONTSIZE;};
+function getSkin(){return SKIN;};
+function getAdvTerm(){return ADVTERM;}
+function getAdvType(){return ADVTYPE;}
+function getRtype(){return RTYPE;}
+function getSort(){return SORT;}
+function getSortDir(){return SORT_DIR;}
+function getDebug(){return DEBUG;}
+function getCallnumber() { return CALLNUM; }
+function getLitForm() { return LITFORM; }
+function getItemForm() { return ITEMFORM; }
+function getItemType() { return ITEMTYPE; }
+function getBibLevel() { return BIBLEVEL; }
+function getAudience() { return AUDIENCE; }
+function getSearches() { return SEARCHES; }
+function getLanguage() { return LANGUAGE; }
+function getRdepth() { return RDEPTH; }
+function getAvail() { return AVAIL; }
+function getCopyLocs() { return COPYLOCS; }
+function getPubdBefore() { return PUBD_BEFORE; }
+function getPubdAfter() { return PUBD_AFTER; }
+function getPubdBetween() { return PUBD_BETWEEN; }
+function getPubdDuring() { return PUBD_DURING; }
+
+
+function findBasePath() {
+ var path = location.pathname;
+ if(!path.match(/.*\.xml$/)) path += "index.xml";
+ var idx = path.indexOf(config.page[findCurrentPage()]);
+ return path.substring(0, idx);
+}
+
+function findBaseURL(ssl) {
+ var path = findBasePath();
+ var proto = (ssl) ? "https:" : "http:";
+
+ /* strip port numbers. This is necessary for browsers that
+ send an explicit <host>:80, 443 - explicit ports
+ break links that need to change ports (e.g. http -> https) */
+ var h = location.host.replace(/:.*/,'');
+
+ return proto + "//" + h + path;
+}
+
+/*
+function buildISBNSrc(isbn) {
+ return "http://" + location.host + "/jackets/" + isbn;
+}
+*/
+
+function buildImageLink(name, ssl) {
+ return findBaseURL(ssl) + "../../../../images/" + name;
+}
+
+function buildExtrasLink(name, ssl) {
+ return findBaseURL(ssl) + "../../../../extras/" + name;
+}
+
+var consoleService;
+function _debug(str) {
+ try { dump('dbg: ' + str + '\n'); } catch(e) {}
+
+ /* potentially useful, but usually just annoying */
+ /*
+ if(!IE) {
+ if(!consoleService) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ this.consoleService = Components.classes['@mozilla.org/consoleservice;1']
+ .getService(Components.interfaces.nsIConsoleService);
+ } catch(e) {}
+ }
+
+ try {
+ if(consoleService) {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ consoleService.logStringMessage(str + '\n');
+ }
+ } catch(e){}
+ }
+ */
+}
+
+var forceLoginSSL; // set via Apache env variable
+function buildOPACLink(args, slim, ssl) {
+
+ if(!args) args = {};
+ var string = "";
+
+ if( ssl == undefined && (
+ location.protocol == 'https:' ||
+ (forceLoginSSL && G.user && G.user.session))) {
+ ssl = true;
+ }
+
+ if(!slim) {
+ string = findBaseURL(ssl);
+ if(args.page) string += config.page[args.page];
+ else string += config.page[findCurrentPage()];
+ }
+
+ /* this may seem unnecessary.. safety precaution for now */
+ /*
+ if( args[PARAM_DEPTH] == null )
+ args[PARAM_DEPTH] = getDepth();
+ */
+
+ string += "?";
+
+ for( var x in args ) {
+ var v = args[x];
+ if(x == "page" || v == null || v == undefined || v+'' == 'NaN' ) continue;
+ if(x == PARAM_OFFSET && v == 0) continue;
+ if(x == PARAM_COUNT && v == 10) continue;
+ if(x == PARAM_FORM && v == 'all' ) continue;
+ if( instanceOf(v, Array) && v.length ) {
+ for( var i = 0; i < v.length; i++ ) {
+ string += "&" + x + "=" + encodeURIComponent(v[i]);
+ }
+ } else {
+ string += "&" + x + "=" + encodeURIComponent(v);
+ }
+ }
+
+ if(getDebug())
+ string += _appendParam(DEBUG, PARAM_DEBUG, args, getDebug, string);
+ if(getOrigLocation() != 1)
+ string += _appendParam(ORIGLOC, PARAM_ORIGLOC, args, getOrigLocation, string);
+ if(getTerm())
+ string += _appendParam(TERM, PARAM_TERM, args, getTerm, string);
+ if(getFacet())
+ string += _appendParam(FACET, PARAM_FACET, args, getFacet, string);
+ if(getStype())
+ string += _appendParam(STYPE, PARAM_STYPE, args, getStype, string);
+ if(getLocation() != 1)
+ string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string);
+ if(getLasso() != null)
+ string += _appendParam(LASSO, PARAM_LASSO, args, getLasso, string);
+ if(getDepth() != null)
+ string += _appendParam(DEPTH, PARAM_DEPTH, args, getDepth, string);
+ if(getForm() && (getForm() != 'all') )
+ string += _appendParam(FORM, PARAM_FORM, args, getForm, string);
+ if(getTform() && (getTform() != 'all') )
+ string += _appendParam(TFORM, PARAM_TFORM, args, getTform, string);
+ if(getOffset() != 0)
+ string += _appendParam(OFFSET, PARAM_OFFSET, args, getOffset, string);
+ if(getDisplayCount() != 10)
+ string += _appendParam(COUNT, PARAM_COUNT, args, getDisplayCount, string);
+ if(getHitCount())
+ string += _appendParam(HITCOUNT, PARAM_HITCOUNT, args, getHitCount, string);
+ if(getMrid())
+ string += _appendParam(MRID, PARAM_MRID, args, getMrid, string);
+ if(getRid())
+ string += _appendParam(RID, PARAM_RID, args, getRid, string);
+ if(getAuthtime())
+ string += _appendParam(AUTHTIME, PARAM_AUTHTIME, args, getAuthtime, string);
+ if(getAdvTerm())
+ string += _appendParam(ADVTERM, PARAM_ADVTERM, args, getAdvTerm, string);
+ if(getAdvType())
+ string += _appendParam(ADVTYPE, PARAM_ADVTYPE, args, getAdvType, string);
+ if(getRtype())
+ string += _appendParam(RTYPE, PARAM_RTYPE, args, getRtype, string);
+ if(getItemForm())
+ string += _appendParam(ITEMFORM, PARAM_ITEMFORM, args, getItemForm, string);
+ if(getItemType())
+ string += _appendParam(ITEMTYPE, PARAM_ITEMTYPE, args, getItemType, string);
+ if(getBibLevel())
+ string += _appendParam(BIBLEVEL, PARAM_BIBLEVEL, args, getBibLevel, string);
+ if(getLitForm())
+ string += _appendParam(LITFORM, PARAM_LITFORM, args, getLitForm, string);
+ if(getAudience())
+ string += _appendParam(AUDIENCE, PARAM_AUDIENCE, args, getAudience, string);
+ if(getSearches())
+ string += _appendParam(SEARCHES, PARAM_SEARCHES, args, getSearches, string);
+ if(getLanguage())
+ string += _appendParam(LANGUAGE, PARAM_LANGUAGE, args, getLanguage, string);
+ if(getRdepth() != null)
+ string += _appendParam(RDEPTH, PARAM_RDEPTH, args, getRdepth, string);
+ if(getSort() != null)
+ string += _appendParam(SORT, PARAM_SORT, args, getSort, string);
+ if(getSortDir() != null)
+ string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string);
+ if(getAvail())
+ string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
+ if(getCopyLocs())
+ string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string);
+ if(getPubdBefore())
+ string += _appendParam(PUBD_BEFORE, PARAM_PUBD_BEFORE, args, getPubdBefore, string);
+ if(getPubdAfter())
+ string += _appendParam(PUBD_AFTER, PARAM_PUBD_AFTER, args, getPubdAfter, string);
+ if(getPubdBetween())
+ string += _appendParam(PUBD_BETWEEN, PARAM_PUBD_BETWEEN, args, getPubdBetween, string);
+ if(getPubdDuring())
+ string += _appendParam(PUBD_DURING, PARAM_PUBD_DURING, args, getPubdDuring, string);
+
+
+ return string.replace(/\&$/,'').replace(/\?\&/,"?");
+}
+
+var xx = 1;
+function _appendParam( fieldVar, fieldName, overrideArgs, getFunc, string ) {
+
+ var ret = "";
+
+ if( fieldVar != null &&
+ (fieldVar +'' != 'NaN') &&
+ overrideArgs[fieldName] == null &&
+ getFunc() != null &&
+ getFunc()+'' != '' ) {
+
+ ret = "&" + fieldName + "=" + encodeURIComponent(getFunc());
+ }
+
+ return ret;
+}
+
+/* ----------------------------------------------------------------------- */
+function cleanISBN(isbn) {
+ if(isbn) {
+ isbn = isbn.toString().replace(/^\s+/,"");
+ var idx = isbn.indexOf(" ");
+ if(idx > -1) { isbn = isbn.substring(0, idx); }
+ } else isbn = "";
+ return isbn;
+}
+
+
+/* builds a link that goes to the title listings for a metarecord */
+function buildTitleLink(rec, link) {
+ if(!rec) return;
+ link.appendChild(text(normalize(truncate(rec.title(), 65))));
+ var args = {};
+ args.page = RRESULT;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_MRID] = rec.doc_id();
+ args[PARAM_RTYPE] = RTYPE_MRID;
+ var linkText = link.innerHTML; // IE
+ link.setAttribute("href", buildOPACLink(args));
+ link.innerHTML = linkText; // IE
+}
+
+function buildTitleDetailLink(rec, link) {
+ if(!rec) return;
+ link.appendChild(text(normalize(truncate(rec.title(), 65))));
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_RID] = rec.doc_id();
+ // in IE, if the link text contains a '@', it replaces the innerHTML text
+ // with the value of the href attribute. Wait, what? Yes. Capture the
+ // innerHTML and put it back into place after the href is set
+ var linkText = link.innerHTML; // IE
+ link.setAttribute("href", buildOPACLink(args));
+ link.innerHTML = linkText; // IE
+}
+
+/* 'type' is one of STYPE_AUTHOR, STYPE_SUBJECT, ... found in config.js
+ 'trunc' is the number of characters to show in the string, defaults to 65 */
+function buildSearchLink(type, string, linknode, trunc) {
+ if(!trunc) trunc = 65;
+ var args = {};
+ if( SHOW_MR_DEFAULT || findCurrentPage() == MRESULT ) {
+ args.page = MRESULT;
+ } else {
+ args.page = RRESULT;
+ args[PARAM_RTYPE] = type;
+ }
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_TERM] = string;
+ args[PARAM_STYPE] = type;
+ linknode.appendChild(text(normalize(truncate(string, trunc))));
+ linknode.setAttribute("href", buildOPACLink(args));
+}
+
+function setSessionCookie(ses) {
+ dojo.cookie(COOKIE_SES, ses);
+}
+
+
+
+/* ----------------------------------------------------------------------- */
+/* user session handling */
+/* ----------------------------------------------------------------------- */
+/* session is the login session. If no session is provided, we attempt
+ to find one in the cookies. If 'force' is true we retrieve the
+ user from the server even if there is already a global user present.
+ if ses != G.user.session, we also force a grab */
+function grabUser(ses, force) {
+
+ _debug("grabUser auth token = " + ses);
+ if(!ses && isXUL()) {
+ stash = fetchXULStash();
+ ses = stash.session.key
+ _debug("stash auth token = " + ses);
+ }
+
+ if(!ses) {
+ ses = dojo.cookie(COOKIE_SES);
+ /* https cookies don't show up in http servers.. */
+ _debug("cookie auth token = " + ses);
+ }
+
+ if(!ses) return false;
+
+ if(!force)
+ if(G.user && G.user.session == ses)
+ return G.user;
+
+ /* first make sure the session is valid */
+ var request = new Request(FETCH_SESSION, ses);
+ request.request.alertEvent = false;
+ request.send(true);
+ var user = request.result();
+
+ if(!user || user.textcode == 'NO_SESSION') {
+
+ if(isXUL()) {
+ dojo.require('openils.XUL');
+ dump('getNewSession in opac_utils.js\n');
+ openils.XUL.getNewSession(
+ function(success, authtoken) {
+ if(success) {
+ ses = authtoken;
+ var request = new Request(FETCH_SESSION, ses);
+ request.request.alertEvent = false;
+ request.send(true);
+ user = request.result();
+ }
+ }
+ );
+ }
+
+ if(!user || user.textcode == 'NO_SESSION') {
+ doLogout();
+ return false; /* unable to grab the session */
+ }
+ }
+
+ if( !(typeof user == 'object' && user._isfieldmapper) ) {
+ doLogout();
+ return false;
+ }
+
+ G.user = user;
+ G.user.fleshed = false;
+ G.user.session = ses;
+ setSessionCookie(ses);
+
+ grabUserPrefs();
+ if(G.user.prefs['opac.hits_per_page'])
+ COUNT = parseInt(G.user.prefs['opac.hits_per_page']);
+
+ if(G.user.prefs[PREF_DEF_FONT])
+ setFontSize(G.user.prefs[PREF_DEF_FONT]);
+
+ var at = getAuthtime();
+ //if(isXUL()) at = xulG['authtime'];
+
+ if(at && !isXUL()) new AuthTimer(at).run();
+ return G.user;
+}
+
+
+/* sets the 'prefs' field of the user object to their preferences
+ and returns the preferences */
+function grabUserPrefs(user, force) {
+ if(user == null) user = G.user;
+ if(!force && user.prefs) return user.prefs;
+ var req = new Request(FETCH_USER_PREFS, G.user.session, user.id());
+ req.send(true);
+ user.prefs = req.result();
+ return user.prefs;
+}
+
+function grabFleshedUser() {
+
+ if(!G.user || !G.user.session) {
+ grabUser();
+ if(!G.user || !G.user.session) return null;
+ }
+
+ if(G.user.fleshed) return G.user;
+
+ var req = new Request(FETCH_FLESHED_USER, G.user.session);
+ req.send(true);
+
+ G.user = req.result();
+
+ if(!G.user || G.user.length == 0) {
+ dojo.cookie(COOKIE_SES,null,{'expires':-1});
+ G.user = null; return false;
+ }
+
+ G.user.session = ses;
+ G.user.fleshed = true;
+
+ setSessionCookie(ses);
+ return G.user;
+}
+
+function checkUserSkin(new_skin) {
+
+ return; /* XXX do some debugging with this... */
+
+ var user_skin = getSkin();
+ var cur_skin = grabSkinFromURL();
+
+ if(new_skin) user_skin = new_skin;
+
+ if(!user_skin) {
+
+ if(grabUser()) {
+ if(grabUserPrefs()) {
+ user_skin = G.user.prefs["opac.skin"];
+ dojo.cookie( COOKIE_SKIN, user_skin, { 'expires' : 365 } );
+ }
+ }
+ }
+
+ if(!user_skin) return;
+
+ if( cur_skin != user_skin ) {
+ var url = buildOPACLink();
+ goTo(url.replace(cur_skin, user_skin));
+ }
+}
+
+function updateUserSetting(setting, value, user) {
+ if(user == null) user = G.user;
+ var a = {};
+ a[setting] = value;
+ var req = new Request( UPDATE_USER_PREFS, user.session, a );
+ req.send(true);
+ return req.result();
+}
+
+function commitUserPrefs() {
+ var req = new Request(
+ UPDATE_USER_PREFS, G.user.session, null, G.user.prefs );
+ req.send(true);
+ return req.result();
+}
+
+function grabSkinFromURL() {
+ var path = findBasePath();
+ path = path.replace("/xml/", "");
+ var skin = "";
+ for( var i = path.length - 1; i >= 0; i-- ) {
+ var ch = path.charAt(i);
+ if(ch == "/") break;
+ skin += ch;
+ }
+
+ var skin2 = "";
+ for( i = skin.length - 1; i >= 0; i--)
+ skin2 += skin.charAt(i);
+
+ return skin2;
+}
+
+
+/* returns a fleshed G.user on success, false on failure */
+function doLogin(suppressEvents) {
+
+ abortAllRequests();
+
+ var uname = G.ui.login.username.value;
+ var passwd = G.ui.login.password.value;
+
+ var init_request = new Request( LOGIN_INIT, uname );
+ init_request.send(true);
+ var seed = init_request.result();
+
+ if( ! seed || seed == '0') {
+ alert( "Error Communicating with Authentication Server" );
+ return null;
+ }
+
+ var args = {
+ password : hex_md5(seed + hex_md5(passwd)),
+ type : "opac",
+ org : getOrigLocation()
+ };
+
+ r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex');
+ if(r) REGEX_BARCODE = new RegExp(r);
+
+ if( uname.match(REGEX_BARCODE) ) args.barcode = uname;
+ else args.username = uname;
+
+ var auth_request = new Request( LOGIN_COMPLETE, args );
+
+ auth_request.request.alertEvent = false;
+ auth_request.send(true);
+ var auth_result = auth_request.result();
+
+ if(!auth_result) {
+ alertId('patron_login_failed');
+ return null;
+ }
+
+ if( checkILSEvent(auth_result) ) {
+
+ if( auth_result.textcode == 'PATRON_INACTIVE' ) {
+ alertId('patron_inactive_alert');
+ return;
+ }
+
+ if( auth_result.textcode == 'PATRON_CARD_INACTIVE' ) {
+ alertId('patron_card_inactive_alert');
+ return;
+ }
+
+ if( auth_result.textcode == 'LOGIN_FAILED' ||
+ auth_result.textcode == 'PERM_FAILURE' ) {
+ alertId('patron_login_failed');
+ return;
+ }
+ }
+
+
+ AUTHTIME = parseInt(auth_result.payload.authtime);
+ var u = grabUser(auth_result.payload.authtoken, true);
+ if(u && ! suppressEvents)
+ runEvt( "common", "locationChanged", u.ws_ou(), findOrgDepth(u.ws_ou()) );
+
+ checkUserSkin();
+
+ return u;
+}
+
+function doLogout() {
+
+ /* cancel everything else */
+ abortAllRequests();
+
+ /* be nice and delete the session from the server */
+ if(G.user && G.user.session) {
+ var req = new Request(LOGIN_DELETE, G.user.session);
+ req.send(true);
+ try { req.result(); } catch(E){}
+ }
+
+ G.user = null;
+
+ /* remove any cached data */
+ dojo.require('dojo.cookie');
+ dojo.cookie(COOKIE_SES, null, {expires:-1});
+ dojo.cookie(COOKIE_RIDS, null, {expires:-1});
+ dojo.cookie(COOKIE_SKIN, null, {expires:-1});
+ dojo.cookie(COOKIE_SEARCH, null, {expires:-1});
+
+
+ checkUserSkin("default");
+ COUNT = 10;
+
+
+ var args = {};
+ args[PARAM_TERM] = "";
+ args[PARAM_LOCATION] = getOrigLocation();
+ args[PARAM_DEPTH] = findOrgDepth(getOrigLocation() || globalOrgTree);
+ args.page = "home";
+
+
+ var nored = false;
+ try{ if(isFrontPage) nored = true; } catch(e){nored = false;}
+ if(!nored) goTo(buildOPACLink(args, false, false));
+}
+
+
+function hideMe(obj) { addCSSClass(obj, config.css.hide_me); }
+function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
+
+
+/* ----------------------------------------------------------------------- */
+/* build the org tree */
+/* ----------------------------------------------------------------------- */
+function drawOrgTree() {
+ //setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 10 );
+ setTimeout( 'buildOrgSelector(G.ui.common.org_tree, orgTreeSelector);', 1 );
+}
+
+var checkOrgHiding_cached = false;
+var checkOrgHiding_cached_context_org;
+var checkOrgHiding_cached_depth;
+function checkOrgHiding() {
+ if (isXUL()) {
+ return false; // disable org hiding for staff client
+ }
+ var context_org = getOrigLocation() || globalOrgTree.id();
+ var depth;
+ if (checkOrgHiding_cached) {
+ if (checkOrgHiding_cached_context_org != context_org) {
+ checkOrgHiding_cached_context_org = context_org;
+ checkOrgHiding_cached_depth = undefined;
+ checkOrgHiding_cached = false;
+ } else {
+ depth = checkOrgHiding_cached_depth;
+ }
+ } else {
+ depth = fetchOrgSettingDefault( context_org, 'opac.org_unit_hiding.depth');
+ checkOrgHiding_cached_depth = depth;
+ checkOrgHiding_cached_context_org = context_org;
+ checkOrgHiding_cached = true;
+ }
+ if ( findOrgDepth( context_org ) < depth ) {
+ return false; // disable org hiding if Original Location doesn't make sense with setting depth (avoids disjointed org selectors)
+ }
+ if (depth) {
+ return { 'org' : findOrgUnit(context_org), 'depth' : depth };
+ } else {
+ return false;
+ }
+}
+
+var orgTreeSelector;
+function buildOrgSelector(node) {
+ var tree = new SlimTree(node,'orgTreeSelector');
+ orgTreeSelector = tree;
+ var orgHiding = checkOrgHiding();
+ for( var i in orgArraySearcher ) {
+ var node = orgArraySearcher[i];
+ if( node == null ) continue;
+ if(!isXUL() && !isTrue(node.opac_visible())) continue;
+ if (orgHiding) {
+ if ( ! orgIsMine( orgHiding.org, node, orgHiding.depth ) ) {
+ continue;
+ }
+ }
+ if(node.parent_ou() == null) {
+ tree.addNode(node.id(), -1, node.name(),
+ "javascript:orgSelect(" + node.id() + ");", node.name());
+ } else {
+ if (orgHiding && orgHiding.depth == findOrgDepth(node)) {
+ tree.addNode(node.id(), -1, node.name(),
+ "javascript:orgSelect(" + node.id() + ");", node.name());
+ } else {
+ tree.addNode(node.id(), node.parent_ou(), node.name(),
+ "javascript:orgSelect(" + node.id() + ");", node.name());
+ }
+ }
+ }
+ hideMe($('org_loading_div'));
+ unHideMe($('org_selector_tip'));
+ return tree;
+}
+
+function orgSelect(id) {
+ showCanvas();
+ runEvt("common", "locationChanged", id, findOrgDepth(id) );
+
+
+ var loc = findOrgLasso(getLasso());
+ if (!loc) loc = findOrgUnit(id);
+
+ removeChildren(G.ui.common.now_searching);
+ G.ui.common.now_searching.appendChild(text(loc.name()));
+}
+
+function setFontSize(size) {
+ scaleFonts(size);
+ dojo.cookie(COOKIE_FONT, size, { 'expires' : 365});
+}
+
+var resourceFormats = [
+ "text",
+ "moving image",
+ "sound recording", "software, multimedia",
+ "still image",
+ "cartographic",
+ "mixed material",
+ "notated music",
+ "three dimensional object" ];
+
+
+function modsFormatToMARC(format) {
+ switch(format) {
+ case "text":
+ return "at";
+ case "moving image":
+ return "g";
+ case "sound recording":
+ return "ij";
+ case "sound recording-nonmusical":
+ return "i";
+ case "sound recording-musical":
+ return "j";
+ case "software, multimedia":
+ return "m";
+ case "still image":
+ return "k";
+ case "cartographic":
+ return "ef";
+ case "mixed material":
+ return "op";
+ case "notated music":
+ return "cd";
+ case "three dimensional object":
+ return "r";
+ }
+ return "at";
+}
+
+
+function MARCFormatToMods(format) {
+ switch(format) {
+ case "a":
+ case "t":
+ return "text";
+ case "g":
+ return "moving image";
+ case "i":
+ return "sound recording-nonmusical";
+ case "j":
+ return "sound recording-musical";
+ case "m":
+ return "software, multimedia";
+ case "k":
+ return "still image";
+ case "e":
+ case "f":
+ return "cartographic";
+ case "o":
+ case "p":
+ return "mixed material";
+ case "c":
+ case "d":
+ return "notated music";
+ case "r":
+ return "three dimensional object";
+ }
+ return "text";
+}
+
+function MARCTypeToFriendly(format) {
+ var words = $('format_words');
+ switch(format) {
+ case 'a' :
+ case 't' : return $n(words, 'at').innerHTML;
+ default:
+ var node = $n(words,format);
+ if( node ) return node.innerHTML;
+ }
+ return "";
+}
+
+function setResourcePic( img, resource ) {
+ img.setAttribute( "src", "../../../../images/tor/" + resource + ".jpg");
+ img.title = resource;
+}
+
+
+
+function msg( text ) {
+ try { alert( text ); } catch(e) {}
+}
+
+function findRecord(id,type) {
+ try {
+ for( var i = 0; i != recordsCache.length; i++ ) {
+ var rec = recordsCache[i];
+ if( rec && rec.doc_id() == id ) return rec;
+ }
+ } catch(E){}
+ var meth = FETCH_RMODS
+ if(type == 'M') meth = FETCH_MRMODS;
+ var req = new Request(meth, id);
+ req.request.alertEvent = false;
+ req.send(true);
+ var res = req.result();
+ if( checkILSEvent(res) ) return null;
+ return res;
+}
+
+function Timer(name, node){
+ this.name = name;
+ this.count = 1;
+ this.node = node;
+}
+Timer.prototype.start =
+ function(){_timerRun(this.name);}
+Timer.prototype.stop =
+ function(){this.done = true;}
+function _timerRun(tname) {
+ var _t;
+ eval('_t='+tname);
+ if(_t.done) return;
+ if(_t.count > 100) return;
+ var str = ' . ';
+ if( (_t.count % 5) == 0 )
+ str = _t.count / 5;
+ _t.node.appendChild(text(str));
+ setTimeout("_timerRun('"+tname+"');", 200);
+ _t.count++;
+}
+
+function checkILSEvent(obj) {
+ if (obj && typeof obj == 'object' && typeof obj.ilsevent != 'undefined') {
+ if (obj.ilsevent === '') {
+ return true;
+ } else if ( obj.ilsevent != null && obj.ilsevent != 0 ) {
+ return parseInt(obj.ilsevent);
+ }
+ }
+ return null;
+}
+
+
+function alertILSEvent(evt, msg) {
+ if(!msg) msg = "";
+ if(msg)
+ alert(msg +'\n' + evt.textcode + '\n' + evt.desc );
+ else
+ alert(evt.textcode + '\n' + evt.desc );
+}
+
+
+var __authTimer;
+function AuthTimer(time) {
+ this.time = (time - LOGOUT_WARNING_TIME) * 1000;
+ if(__authTimer)
+ try {clearTimeout(__authTimer.id)} catch(e){}
+ __authTimer = this;
+}
+
+AuthTimer.prototype.run = function() {
+ this.id = setTimeout('_authTimerAlert()', this.time);
+}
+
+function _authTimerAlert() {
+ alert( $('auth_session_expiring').innerHTML );
+ if(!grabUser(null, true)) doLogout();
+}
+
+
+function grabUserByBarcode( authtoken, barcode ) {
+ var req = new Request( FETCH_USER_BYBARCODE, authtoken, barcode );
+ req.send(true);
+ return req.result();
+}
+
+
+function goHome() {
+ goTo(buildOPACLink({page:HOME}));
+}
+
+
+function buildOrgSel(selector, org, offset, namecol) {
+ if(!namecol) namecol = 'name';
+ if(!isXUL() && !isTrue(org.opac_visible())) return;
+ insertSelectorVal( selector, -1,
+ org[namecol](), org.id(), null, findOrgDepth(org) - offset );
+ var kids = org.children();
+ if (kids) {
+ for( var c = 0; c < kids.length; c++ )
+ buildOrgSel( selector, kids[c], offset, namecol);
+ }
+}
+
+function buildMergedOrgSel(selector, org_list, offset, namecol) {
+ if(!namecol) namecol = 'name';
+ for(var i = 0; i < org_list.length; i++) {
+ var org = findOrgUnit(org_list[i]);
+ insertSelectorVal( selector, -1,
+ org[namecol](), org.id(), null, findOrgDepth(org) - offset );
+ var kids = org.children();
+ if (kids) {
+ for( var c = 0; c < kids.length; c++ )
+ buildOrgSel( selector, kids[c], offset, namecol);
+ }
+ }
+}
+
+
+function parseForm(form) {
+ if(!form) return {};
+
+ var it = form.replace(/-\w+$/,"");
+ var itf = null;
+ var item_form;
+ var item_type;
+
+ if(form.match(/-/)) itf = form.replace(/^\w+-/,"");
+
+ if(it) {
+ item_type = [];
+ for( var i = 0; i < it.length; i++ )
+ item_type.push( it.charAt(i) );
+ }
+
+ if(itf) {
+ item_form = [];
+ for( var i = 0; i < itf.length; i++ )
+ item_form.push( itf.charAt(i) );
+ }
+
+ return {item_type: item_type, item_form:item_form};
+}
+
+
+function isTrue(x) { return ( x && x != "0" && !(x+'').match(/^f$/i) ); }
+
+function fetchPermOrgs() {
+ var a = []; /* Q: why does arguments come accross as an object and not an array? A: because arguments is a special object, a collection */
+
+ for( var i = 0; i < arguments.length; i++ )
+ a.push(arguments[i])
+
+ var preq = new Request(FETCH_HIGHEST_PERM_ORG,
+ G.user.session, G.user.id(), a );
+ preq.send(true);
+ return preq.result();
+}
+
+
+function print_tabs(t) {
+ var r = '';
+ for (var j = 0; j < t; j++ ) { r = r + " "; }
+ return r;
+}
+function formatJSON(s) {
+ var r = ''; var t = 0;
+ for (var i in s) {
+ if (s[i] == '{' || s[i] == '[' ) {
+ r = r + s[i] + "\n" + print_tabs(++t);
+ } else if (s[i] == '}' || s[i] == ']') {
+ t--; r = r + "\n" + print_tabs(t) + s[i];
+ } else if (s[i] == ',') {
+ r = r + s[i] + "\n" + print_tabs(t);
+ } else {
+ r = r + s[i];
+ }
+ }
+ return r;
+}
+/* ------------------------------------------------------------------------------------------------------ */
+/* org tree utilities */
+/* ------------------------------------------------------------------------------------------------------ */
+
+function fetchOrgSettingDefault(orgId, name) {
+ var req = new Request(FETCH_ORG_SETTING, orgId, name);
+ req.send(true);
+ var res = req.result();
+ return (res) ? res.value : null;
+}
+
+function fetchBatchOrgSetting(orgId, nameList, onload) {
+ var req = new Request(
+ 'open-ils.actor:open-ils.actor.ou_setting.ancestor_default.batch', orgId, nameList);
+ if(onload) {
+ req.callback(function(r) { onload(r.getResultObject()); });
+ req.send();
+ } else {
+ req.send(true);
+ return req.result();
+ }
+}
+
+
+/* takes an org unit or id and return the numeric depth */
+function findOrgDepth(org_id_or_node) {
+ var org = findOrgUnit(org_id_or_node);
+ if(!org) return -1;
+ var type = findOrgType(org.ou_type());
+ if(type) return type.depth();
+ return -1;
+}
+
+function findOrgTypeFromDepth(depth) {
+ if( depth == null ) return null;
+ for( var type = 0; type < globalOrgTypes.length; type++ ) {
+ var t = globalOrgTypes[type];
+ if( t.depth() == depth ) return t;
+ }
+}
+
+/* takes the org type id from orgunit.ou_type() field and returns
+ the org type object */
+function findOrgType(type_id) {
+ if(typeof type_id == 'object') return type_id;
+ for(var type = 0; type < globalOrgTypes.length; type++) {
+ var t =globalOrgTypes[type];
+ if( t.id() == type_id || t.id() == parseInt(type_id) )
+ return t;
+ }
+ return null;
+}
+
+
+/* returns an org unit by id. if an object is passed in as the id,
+ then the object is assumed to be an org unit and is returned */
+function findOrgUnit(org_id) {
+ return (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id];
+}
+
+function findOrgLasso(lasso_id) {
+ if (typeof lasso_id == 'object') return lasso_id;
+ for (var i = 0; i < _lasso.length; i++) {
+ if (_lasso[i].id() == lasso_id) return _lasso[i];
+ }
+ return null;
+}
+
+var orgArraySearcherSN = {};
+function findOrgUnitSN(shortname) {
+ if (typeof shortname == 'object') return shortname;
+ if( orgArraySearcherSN[shortname] ) return orgArraySearcherSN[shortname];
+ _debug("fetching org by shortname "+shortname);
+ var req = new Request(FETCH_ORG_BY_SHORTNAME, shortname);
+ req.request.alertEvent = false;
+ req.send(true);
+ return req.result();
+}
+
+
+/* builds a trail from the top of the org tree to the node provide.
+ basically fleshes out 'my orgs'
+ Returns an array of [org0, org1, ..., myorg] */
+function orgNodeTrail(node) {
+ var na = new Array();
+ while( node ) {
+ na.push(node);
+ node = findOrgUnit(node.parent_ou());
+ }
+ return na.reverse();
+}
+
+function findSiblingOrgs(node) { return findOrgUnit(node.parent_ou()).children(); }
+
+/* true if 'org' is 'me' or a child of mine, or optionally, a child of an ancestor org within the specified depth */
+function orgIsMine(me, org, depth) {
+ if(!me || !org) {
+ return false;
+ }
+ if(me.id() == org.id()) {
+ return true;
+ }
+ if (depth !== undefined) {
+ while (depth < findOrgDepth(me)) {
+ me = findOrgUnit( me.parent_ou() );
+ }
+ if(me.id() == org.id()) {
+ return true;
+ }
+ }
+ var kids = me.children();
+ for( var i = 0; kids && i < kids.length; i++ ) {
+ if(orgIsMine(kids[i], org /* intentional lack of 3rd arg */)) {
+ return true;
+ }
+
+ }
+ return false;
+}
+
+function orgIsMineFromSet(meList, org) {
+ org = findOrgUnit(org);
+ for(var i = 0; i < meList.length; i++) {
+ if(orgIsMine(findOrgUnit(meList[i]), org))
+ return true;
+ }
+ return false;
+}
+
+var orgArraySearcher = {};
+var globalOrgTree;
+for (var i = 0; i < _l.length; i++) {
+ var x = new aou();
+ x.id(_l[i][0]);
+ x.ou_type(_l[i][1]);
+ x.parent_ou(_l[i][2]);
+ x.name(_l[i][3]);
+ x.opac_visible(_l[i][4]);
+ x.shortname(_l[i][5]);
+ orgArraySearcher[x.id()] = x;
+}
+for (var i in orgArraySearcher) {
+ var x = orgArraySearcher[i];
+ if (x.parent_ou() == null || x.parent_ou() == '') {
+ globalOrgTree = x;
+ continue;
+ }
+
+ var par = findOrgUnit(x.parent_ou());
+ if (!par.children()) par.children(new Array());
+ par.children().push(x);
+}
+
+function _tree_killer () {
+ for (var i in orgArraySearcher) {
+ x=orgArraySearcher[i];
+ x.children(null);
+ x.parent_ou(null);
+ orgArraySearcher[i]=null;
+ }
+ globalOrgTree = null;
+ orgArraySearcher = null;
+ globalOrgTypes = null;
+}
+
+
+
+var XML_HTTP_GATEWAY = "osrf-gateway-v1";
+var XML_HTTP_SERVER = "";
+
+
+/* This object is thrown when network failures occur */
+function NetworkFailure(stat, url) {
+ this._status = stat;
+ this._url = url;
+}
+
+NetworkFailure.prototype.status = function() { return this._status; }
+NetworkFailure.prototype.url = function() { return this._url; }
+NetworkFailure.prototype.toString = function() {
+ return "Network Failure: status = " + this.status() +'\n'+this.url();
+}
+
+
+
+function isXUL() { try { if(IAMXUL) return true;}catch(e){return false;}; }
+var _allrequests = {};
+
+// If the legacy JSON gateway is needed by the staff client, uncomment this
+/*
+if(isXUL()) {
+ XML_HTTP_GATEWAY = 'gateway';
+}
+*/
+
+function cleanRemoteRequests() {
+ for( var i in _allrequests )
+ destroyRequest(_allrequests[i]);
+}
+
+function abortAllRequests() {
+ for( var i in _allrequests ) {
+ var r = _allrequests[i];
+ if(r) {
+ r.abort();
+ destroyRequest(r);
+ }
+ }
+}
+
+function destroyRequest(r) {
+ if(r == null) return;
+
+ if( r.xmlhttp ) {
+ r.xmlhttp.onreadystatechange = function(){};
+ r.xmlhttp = null;
+ }
+
+ r.callback = null;
+ r.userdata = null;
+ _allrequests[r.id] = null;
+}
+
+/* ----------------------------------------------------------------------- */
+/* Request object */
+var rrId = 0;
+function RemoteRequest( service, method ) {
+
+ /* dojo is currently only available in the OPAC */
+ try {
+ /* We want OpenSRF.locale for xx-YY format */
+ this.locale = OpenSRF.locale;
+ }
+ catch (e) {
+ this.locale = null;
+ }
+ this.service = service;
+ this.method = method;
+ this.xmlhttp = false;
+ this.name = null;
+ this.alertEvent = true; /* only used when isXUL is false */
+
+ this.type = "POST"; /* default */
+ this.id = rrId++;
+ this.cancelled = false;
+
+ this.setSecure(false);
+ if(isXUL()) this.setSecure(true);
+
+ _allrequests[this.id] = this;
+
+ var i = 2;
+ this.params = "";
+
+ while(i < arguments.length) {
+ var object = js2JSON(arguments[i++]);
+ this.params += "¶m=" + encodeURIComponent(object);
+ }
+
+ if(!this.params) { this.params = ""; }
+
+ this.param_string = "service=" + service + "&method=" + method + this.params;
+ if (this.locale != null) {
+ this.param_string = this.param_string + "&locale=" + this.locale;
+ }
+ if( this.buildXMLRequest() == null ) alert("Browser is not supported!");
+
+}
+
+
+RemoteRequest.prototype.timeout = function(t) {
+ t *= 1000
+ var req = this;
+ req.timeoutFunc = setTimeout(
+ function() {
+ if( req && req.xmlhttp ) {
+ req.cancelled = true;
+ req.abort();
+ if( req.abtCallback ) {
+ req.abtCallback(req);
+ }
+ }
+ },
+ t
+ );
+}
+
+RemoteRequest.prototype.abortCallback = function(func) {
+ this.abtCallback = func;
+}
+
+RemoteRequest.prototype.event = function(evt) {
+ if( arguments.length > 0 )
+ this.evt = evt;
+ return this.evt;
+}
+
+RemoteRequest.prototype.abort = function() {
+ if( this.xmlhttp ) {
+ /* this has to come before abort() or IE will puke on you */
+ this.xmlhttp.onreadystatechange = function(){};
+ this.xmlhttp.abort();
+ }
+}
+
+/* constructs our XMLHTTPRequest object */
+RemoteRequest.prototype.buildXMLRequest = function() {
+ this.xmlhttp = buildXMLRequest();
+ return true;
+}
+
+
+function buildXMLRequest() {
+ try {
+ return new XMLHttpRequest();
+ } catch(e) {
+ try {
+ return new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e2) {
+ try {
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e3) {
+ alert("NEEDS NEWER JAVASCRIPT for XMLHTTPRequest()");
+ return null;
+ }
+ }
+ }
+}
+
+
+function _remoteRequestCallback(id) {
+
+ var object = _allrequests[id];
+ if(object.cancelled) return;
+
+ if( object.xmlhttp.readyState == 4 ) {
+
+ try {
+ object.duration = new Date().getTime() - object.sendTime;
+ dump('request ' + object.id + ': duration = ' + object.duration + ' ms\n');
+ } catch(ee){}
+
+ try {
+ object.callback(object);
+ } catch(E) {
+ throw E
+ } finally {
+ destroyRequest(object);
+ object = null;
+ }
+ }
+}
+
+
+/* define the callback we use when this request has received
+ all of its data */
+RemoteRequest.prototype.setCompleteCallback = function(callback) {
+ if(this.cancelled) return;
+ this.callback = callback;
+ var id = this.id;
+ this.xmlhttp.onreadystatechange = function() { _remoteRequestCallback(id); }
+}
+
+
+/* http by default. This makes it https. *ONLY works when
+ embedded in a XUL app. */
+RemoteRequest.prototype.setSecure = function(bool) {
+ this.secure = bool;
+}
+
+RemoteRequest.prototype.send = function(blocking) {
+
+ if(this.cancelled) return;
+
+ /* determine the xmlhttp server dynamically */
+ var url = location.protocol + "//" + location.host + "/" + XML_HTTP_GATEWAY;
+
+ if(isXUL()) {
+ if( XML_HTTP_SERVER )
+ url = 'http://'+XML_HTTP_SERVER+'/'+XML_HTTP_GATEWAY;
+
+ if( url.match(/^http:/) &&
+ (this.secure || location.href.match(/^https:/) || location.href.match(/^chrome:/) ) ) {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+ url = url.replace(/^http:/, 'https:');
+ }
+ }
+
+ var data = null;
+ if( this.type == 'GET' ) url += "?" + this.param_string;
+
+ this.url = url;
+
+ //if( isXUL() ) dump('request URL = ' + url + '?' + this.param_string + '\n');
+
+ try {
+
+ if(blocking) this.xmlhttp.open(this.type, url, false);
+ else this.xmlhttp.open(this.type, url, true);
+
+ } catch(E) {
+ alert("Fatal error opening XMLHTTPRequest for URL:\n" + url + '\n' + E);
+ return;
+ }
+
+ if( this.type == 'POST' ) {
+ data = this.param_string;
+ this.xmlhttp.setRequestHeader('Content-Type',
+ 'application/x-www-form-urlencoded');
+ }
+
+ try {
+ var auth;
+ try { dojo.require('dojo.cookie'); auth = dojo.cookie(COOKIE_SES) } catch(ee) {}
+ if( isXUL() ) auth = fetchXULStash().session.key;
+ if( auth )
+ this.xmlhttp.setRequestHeader('X-OILS-Authtoken', auth);
+
+ } catch(e) {}
+
+ if(data && data.match(/param=undefined/)) {
+ /* we get a bogus param .. replace with NULL */
+ try{dump('!+! UNDEFINED PARAM IN QUERY: ' + this.service + ' : ' + this.method+'\n');}catch(r){}
+ data = data.replace(/param=undefined/g,'param=null');
+ }
+
+
+ this.sendTime = new Date().getTime();
+ try{ this.xmlhttp.send( data ); } catch(e){}
+
+ return this;
+}
+
+/* returns the actual response text from the request */
+RemoteRequest.prototype.getText = function() {
+ return this.xmlhttp.responseText;
+}
+
+RemoteRequest.prototype.isReady = function() {
+ return this.xmlhttp.readyState == 4;
+}
+
+
+/* returns the JSON->js result object */
+RemoteRequest.prototype.getResultObject = function() {
+
+ if(this.cancelled) return null;
+ if(!this.xmlhttp) return null;
+
+ var failed = false;
+ var status = null;
+ this.event(null);
+
+ /*
+ try {
+ dump(this.url + '?' + this.param_string + '\n' +
+ 'Returned with \n\tstatus = ' + this.xmlhttp.status +
+ '\n\tpayload= ' + this.xmlhttp.responseText + '\n');
+ } catch(e) {}
+ */
+
+ try {
+ status = this.xmlhttp.status;
+ if( status != 200 ) failed = true;
+ } catch(e) { failed = true; }
+
+ if( failed ) {
+ if(!status) status = '<unknown>';
+ try{dump('! NETWORK FAILURE. HTTP STATUS = ' +status+'\n'+this.param_string+'\n');}catch(e){}
+ if(isXUL())
+ throw new NetworkFailure(status, this.param_string);
+ else return null;
+ }
+
+ var text = this.xmlhttp.responseText;
+
+ //try{if(getDebug()) _debug('response: ' + text + '\n')}catch(e){}
+
+ if(text == "" || text == " " || text == null) {
+ try { dump('dbg: Request returned no text!\n'); } catch(E) {}
+ if(isXUL())
+ throw new NetworkFailure(status, this.param_string);
+ return null;
+ }
+
+ var obj = JSON2js(text);
+ if(!obj) return null;
+
+ if( obj.status != 200 ) {
+
+ var str = 'A server error occurred. Debug information follows: ' +
+ '\ncode = ' + obj.status +
+ '\ndebug: ' + obj.debug +
+ '\npayload: ' + js2JSON(obj.payload);
+
+ if(isXUL()) {
+ dump(str);
+ throw obj;
+
+ } else {
+ _debug(str);
+ throw str;
+ }
+ }
+
+ var payload = obj.payload;
+ if(!payload || payload.length == 0) return null;
+ payload = (payload.length == 1) ? payload[0] : payload;
+
+ if(!isXUL()) {
+ if( checkILSEvent(payload) ) {
+ this.event(payload);
+ if( this.alertEvent ) {
+ alertILSEvent(payload);
+ return null;
+ }
+ }
+ }
+
+ return payload;
+}
+
+/* adds a new parameter to the request */
+RemoteRequest.prototype.addParam = function(param) {
+ var string = encodeURIComponent(js2JSON(param));
+ this.param_string += "¶m=" + string;
+}
+
+function fetchXULStash() {
+ if( isXUL() ) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var __OILS = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS");
+ var data_cache = new __OILS( );
+ return data_cache.wrappedJSObject.OpenILS.prototype.data;
+
+ } catch(E) {
+ _debug('Error in OpenILS.data._debug_stash(): ' + js2JSON(E) );
+ }
+ }
+ return {};
+}
+
+
+
+/* these events should be used by all */
+
+window.onunload = windowUnload;
+
+attachEvt("common", "init", loadUIObjects);
+//attachEvt("common", "init", initParams);
+attachEvt("common", "init", initCookies);
+
+attachEvt("common", "unload", _tree_killer);
+try{ attachEvt("common", "unload", cleanRemoteRequests);} catch(e){}
+
+function init() {
+
+ initParams();
+
+ if( getLocation() == null && getOrigLocation() != null )
+ LOCATION = getOrigLocation();
+
+ if( getLocation() == null && getOrigLocation() == null )
+ LOCATION = globalOrgTree.id();
+
+ /* if they click on the home page and the origlocation is set
+ take the opac back to the origlocation */
+ if( findCurrentPage() == HOME && getOrigLocation() != null )
+ LOCATION = getOrigLocation();
+
+ if(getDepth() == null) DEPTH = findOrgDepth(getLocation());
+
+
+ runEvt('common','init');
+
+ var cgi = new CGI();
+ if( grabUser() ) {
+ if( cgi.param(PARAM_LOCATION) == null ) {
+ var org = G.user.prefs[PREF_DEF_LOCATION];
+ var depth = G.user.prefs[PREF_DEF_DEPTH];
+
+ if(org == null) org = G.user.ws_ou();
+ if(depth == null) depth = findOrgDepth(org);
+
+ LOCATION = org;
+ DEPTH = depth;
+ }
+ }
+
+ runEvt("common", "run");
+ //checkUserSkin();
+
+ var loc = findOrgLasso(getLasso());
+ if (!loc) loc = findOrgUnit(getLocation());
+
+ if (getLasso()) G.ui.common.now_searching.appendChild(text('Search group: '));
+ G.ui.common.now_searching.appendChild(text(loc.name()));
+}
+
+function windowUnload() { runEvt("common", "unload"); }
+/**
+* This function should return a URL which points to the book cover image based on ISBN.
+*/
+
+
+function buildISBNSrc(isbn, size) {
+ size = (size) ? size : 'small';
+ var protocol = (OILS_OPAC_STATIC_PROTOCOL) ? OILS_OPAC_STATIC_PROTOCOL + ':' : location.protocol;
+ if(OILS_OPAC_IMAGES_HOST)
+ return protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
+ return '../../../../extras/ac/jacket/'+size+'/'+isbn;
+}
+
+
+function acMakeURL(type, key) {
+ return '../../../../extras/ac/' + type + '/html/' + key;
+}
+
+
+function acCollectData( key, callback ) {
+ var context = { key : key, callback: callback, data : {} };
+ acCollectItem(context, 'summary');
+ acCollectItem(context, 'reviews');
+ acCollectItem(context, 'toc');
+ acCollectItem(context, 'excerpt');
+ acCollectItem(context, 'anotes');
+}
+
+function acCheckDone(context) {
+ if( context.data.reviews && context.data.reviews.done &&
+ context.data.toc && context.data.toc.done &&
+ context.data.excerpt && context.data.excerpt.done &&
+ context.data.anotes && context.data.anotes.done ) {
+
+ if(context.callback) context.callback(context.data);
+ }
+}
+
+function acCollectItem(context, type) {
+ var req = buildXMLRequest();
+ req.open('GET', acMakeURL(type, context.key), true);
+ req.onreadystatechange = function() {
+ if( req.readyState == 4 ) {
+ context.data[type] = { done : true }
+
+ if(IE) {
+
+ /* Someone please explain why IE treats status 404 as status 200??
+ On second thought, don't bother.
+ */
+ if( ! req.responseText.match(
+ /The requested URL.*was not found on this server/) )
+ context.data[type].html = req.responseText;
+
+ } else {
+ if( req.status != 404 )
+ context.data[type].html = req.responseText;
+ }
+ acCheckDone(context);
+ }
+ }
+ req.send(null);
+}
+
+
--- /dev/null
+
+function containerDoRequest( req, callback, args ) {
+
+ if( callback ) {
+ req.callback( callback );
+ req.request.args = args;
+ req.send();
+ return null;
+ }
+
+ req.send(true);
+ return req.result();
+}
+
+
+function containerFetchAll( callback, args ) {
+ var req = new Request(
+ FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
+ return containerDoRequest( req, callback, args );
+}
+
+function containerFlesh( id, callback, args ) {
+ var req = new Request( FLESH_CONTAINER, G.user.session, 'biblio', id );
+ return containerDoRequest( req, callback, args );
+}
+
+function containerDelete( id, callback, args ) {
+ var req = new Request( DELETE_CONTAINER, G.user.session, 'biblio', id );
+ return containerDoRequest(req, callback, args );
+}
+
+
+function containerCreate( name, pub, callback, args ) {
+
+ fieldmapper.IDL.load(['cbreb']);
+ var container = new cbreb();
+ container.btype('bookbag');
+ container.owner( G.user.id() );
+ container.name( name );
+ if(pub) container.pub('t');
+ else container.pub('f');
+
+ var req = new Request(
+ CREATE_CONTAINER, G.user.session, 'biblio', container );
+ return containerDoRequest( req, callback, args );
+}
+
+function containerUpdate( container, callback, args ) {
+ var req = new Request(UPDATE_CONTAINER, G.user.session, 'biblio', container);
+ return containerDoRequest(req, callback, args);
+}
+
+function containerCreateItem( containerId, target, callback, args ) {
+
+ fieldmapper.IDL.load(['cbrebi']);
+ var item = new cbrebi();
+ item.target_biblio_record_entry(target);
+ item.bucket(containerId);
+
+ var req = new Request( CREATE_CONTAINER_ITEM,
+ G.user.session, 'biblio', item );
+
+ return containerDoRequest( req, callback, args );
+}
+
+function containerRemoveItem( id, callback, args ) {
+ var req = new Request( DELETE_CONTAINER_ITEM, G.user.session, 'biblio', id );
+ return containerDoRequest( req, callback, args );
+}
--- /dev/null
+var cpdTemplate;
+var cpdCounter = 0;
+var cpdNodes = {};
+
+/* showDueDate will show the due date in the OPAC */
+var showDueDate = false;
+/* showDueTime will show the due time (hours and minutes) in the OPAC;
+ if showDueDate is false, then showDueTime has no effect
+*/
+var showDueTime = false;
+
+function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location, already_fetched_copies, peer_types ) {
+ var i = cpdCheckExisting(contextRow);
+ if(i) return i;
+
+ var counter = cpdCounter++;
+
+ /* yank out all of the template rows */
+ if(!cpdTemplate) cpdTemplate = $('rdetail_volume_details_row');
+ var templateRow = cpdTemplate.cloneNode(true);
+ templateRow.id = 'cpd_row_' + counter;
+
+ /* shove a dummy a tag in before the context previous sibling */
+ /*
+ contextTbody.insertBefore(
+ elem('a',{name:'slot_'+templateRow.id}), contextRow.previousSibling);
+ goTo('#slot_'+templateRow.id);
+ */
+
+ if(isXUL()) {
+ /* unhide before we unhide/clone the parent */
+ unHideMe($n(templateRow, 'age_protect_label'));
+ unHideMe($n(templateRow, 'create_date_label'));
+ unHideMe($n(templateRow, 'holdable_label'));
+ }
+
+ if (isXUL() || showDueDate) {
+ unHideMe($n(templateRow, 'due_date_label'));
+ }
+
+ unHideMe(templateRow);
+
+ var print = $n(templateRow,'print');
+ print.onclick = function() { cpdBuildPrintPane(
+ contextRow, record, callnumber, orgid, depth) };
+ if (callnumber == null) {
+ addCSSClass(print,'hide_me');
+ }
+
+ var mainTbody = $n(templateRow, 'copies_tbody');
+ var extrasRow = mainTbody.removeChild($n(mainTbody, 'copy_extras_row'));
+
+ var request_args = {
+ peer_types : peer_types, /* indexed the same as already_fetched_copies */
+ contextTbody : contextTbody, /* tbody that holds the contextrow */
+ contextRow : contextRow, /* the row our new row will be inserted after */
+ record : record,
+ callnumber : callnumber,
+ orgid : orgid,
+ depth : depth,
+ templateRow : templateRow, /* contains everything */
+ copy_location : copy_location,
+ mainTbody : mainTbody, /* holds the copy rows */
+ extrasRow : extrasRow, /* wrapper row for all extras */
+ counter : counter
+ }
+
+ if (! already_fetched_copies) {
+ var req = new Request(FETCH_COPIES_FROM_VOLUME, record.doc_id(), callnumber, orgid);
+ req.callback(cpdDrawCopies);
+
+ req.request.args = request_args;
+
+ req.send();
+ } else {
+ setTimeout(
+ function() {
+ delete request_args['copy_location'];
+ cpdDrawCopies({
+ 'args' : request_args,
+ 'getResultObject' : function() { return already_fetched_copies; }
+ });
+ }, 0
+ );
+ }
+
+ if( contextRow.nextSibling )
+ contextTbody.insertBefore( templateRow, contextRow.nextSibling );
+ else
+ contextTbody.appendChild( templateRow );
+ _debug('creating new details row with id ' + templateRow.id);
+ cpdNodes[templateRow.id] = { templateRow : templateRow };
+ return templateRow.id;
+}
+
+
+function cpdBuildPrintWindow(record, orgid) {
+ var div = $('rdetail_print_details').cloneNode(true);
+ div.id = "";
+
+ $n(div, 'lib').appendChild(text(findOrgUnit(orgid).name()));
+ $n(div, 'title').appendChild(text(record.title()));
+ $n(div, 'author').appendChild(text(record.author()));
+ $n(div, 'edition').appendChild(text(record.edition()));
+ $n(div, 'pubdate').appendChild(text(record.pubdate()));
+ $n(div, 'publisher').appendChild(text(record.publisher()));
+ $n(div, 'phys').appendChild(text(record.physical_description()));
+
+ return div;
+}
+
+function cpdStylePopupWindow(div) {
+ var tds = div.getElementsByTagName('td');
+ for( var i = 0; i < tds.length ; i++ ) {
+ var td = tds[i];
+ var sty = td.getAttribute('style');
+ if(!sty) sty = "";
+ td.setAttribute('style', sty + 'padding: 2px; border: 1px solid #F0F0E0;');
+ if( td.className && td.className.match(/hide_me/) )
+ td.parentNode.removeChild(td);
+ }
+}
+
+
+/* builds a friendly print window for this CNs data */
+function cpdBuildPrintPane(contextRow, record, cn, orgid, depth) {
+
+ var div = cpdBuildPrintWindow( record, orgid);
+
+ var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
+ $n(div, 'cn').appendChild(text(whole_cn_text));
+
+ unHideMe($n(div, 'copy_header'));
+
+ var subtbody = $n(contextRow.nextSibling, 'copies_tbody');
+ var rows = subtbody.getElementsByTagName('tr');
+
+ for( var r = 0; r < rows.length; r++ ) {
+ var row = rows[r];
+ if(!row) continue;
+ var name = row.getAttribute('name');
+ if( name.match(/extras_row/) ) continue; /* hide the copy notes, stat-cats */
+ var clone = row.cloneNode(true);
+ var links = clone.getElementsByTagName('a');
+ for( var i = 0; i < links.length; i++ )
+ links[i].style.display = 'none';
+
+ $n(div, 'tbody').appendChild(clone);
+ }
+
+ cpdStylePopupWindow(div);
+ openWindow( div.innerHTML);
+}
+
+
+
+/* hide any open tables and if we've already
+ fleshed this cn, just unhide it */
+function cpdCheckExisting( contextRow ) {
+
+ var existingid;
+ var next = contextRow.nextSibling;
+
+ if( next && next.getAttribute('templateRow') ) {
+ var obj = cpdNodes[next.id];
+ if(obj.templateRow.className.match(/hide_me/))
+ unHideMe(obj.templateRow);
+ else hideMe(obj.templateRow);
+ existingid = next.id;
+ }
+
+ if(existingid) _debug('row exists with id ' + existingid);
+
+ for( var o in cpdNodes ) {
+ var node = cpdNodes[o];
+ if( existingid && o == existingid ) continue;
+ hideMe(node.templateRow);
+ removeCSSClass(node.templateRow.previousSibling, 'rdetail_context_row');
+ }
+
+ addCSSClass(contextRow, 'rdetail_context_row');
+ if(existingid) return existingid;
+ return null;
+}
+
+/*
+function cpdFetchCopies(r) {
+ var args = r.args;
+ args.cn = r.getResultObject();
+ var req = new Request(FETCH_COPIES_FROM_VOLUME, args.cn.id());
+ req.request.args = args;
+ req.callback(cpdDrawCopies);
+ req.send();
+}
+*/
+
+function cpdDrawCopies(r) {
+
+ var copies = r.getResultObject();
+ var args = r.args;
+ var copytbody = $n(args.templateRow, 'copies_tbody');
+ var copyrow = copytbody.removeChild($n(copytbody, 'copies_row'));
+
+ if(isXUL()) {
+ /* unhide before we unhide/clone the parent */
+ unHideMe($n(copyrow, 'age_protect_value'));
+ unHideMe($n(copyrow, 'create_date_value'));
+ unHideMe($n(copyrow, 'copy_holdable_td'));
+ }
+
+ if(isXUL() || showDueDate) {
+ unHideMe($n(copyrow, 'copy_due_date_td'));
+ }
+
+ for( var i = 0; i < copies.length; i++ ) {
+ var row = copyrow.cloneNode(true);
+ var copyid = copies[i];
+ var pt; if (args.peer_types) pt = args.peer_types[i];
+ if (typeof copyid != 'object') {
+ var req = new Request(FETCH_FLESHED_COPY, copyid);
+ req.callback(cpdDrawCopy);
+ req.request.args = r.args;
+ req.request.row = row;
+ req.send();
+ } else {
+ setTimeout(
+ function(copy,row,pt) {
+ return function() {
+ cpdDrawCopy({
+ 'getResultObject' : function() { return copy; },
+ 'args' : r.args,
+ 'peer_type' : pt,
+ 'row' : row
+ });
+ };
+ }(copies[i],row,pt), 0
+ );
+ }
+ copytbody.appendChild(row);
+ }
+}
+
+function cpdDrawCopy(r) {
+ var copy = r.getResultObject();
+ var row = r.row;
+ var pt = r.peer_type;
+ var trow = r.args.templateRow;
+
+ if (r.args.copy_location && copy.location().name() != r.args.copy_location) {
+ hideMe(row);
+ return;
+ }
+
+ // Make barcode more useful for staff client usage
+ if(isXUL()) {
+ var my_a = document.createElement('a');
+ my_a.appendChild(text(copy.barcode()));
+ my_a.setAttribute("href","javascript:void(0);");
+ my_a.onclick = function() {
+ xulG.new_tab(xulG.urls.XUL_COPY_STATUS, {}, {'from_item_details_new': true, 'barcodes': [copy.barcode()]});
+ };
+ $n(row, 'barcode').appendChild(my_a);
+ }
+ else {
+ $n(row, 'barcode').appendChild(text(copy.barcode()));
+ }
+
+ /* show the peer type*/
+ if (pt) {
+ $n(row, 'barcode').appendChild(text(' :: ' + pt));
+ }
+
+ $n(row, 'location').appendChild(text(copy.location().name()));
+ $n(row, 'status').appendChild(text(copy.status().name()));
+
+ // append comma-separated list of part this copy is linked to
+ if(copy.parts() && copy.parts().length) {
+ unHideMe($n(trow, 'copy_part_label'));
+ unHideMe($n(row, 'copy_part'));
+ for(var i = 0; i < copy.parts().length; i++) {
+ var part = copy.parts()[i];
+ var node = $n(row, 'copy_part');
+ if(i > 0) node.appendChild(text(','));
+ node.appendChild(text(part.label()));
+ }
+ }
+
+ /* show the other bibs link */
+ if (copy.peer_record_maps().length > 0) {
+ var l = $n(row, 'copy_multi_home');
+ unHideMe(l);
+ var link_args = {};
+ link_args.page = RRESULT;
+ link_args[PARAM_RTYPE] = RTYPE_LIST;
+ link_args[PARAM_RLIST] = new Array();
+ for (var i = 0; i < copy.peer_record_maps().length; i++) {
+ link_args[PARAM_RLIST].push( copy.peer_record_maps()[i].peer_record() );
+ }
+ l.setAttribute('href',buildOPACLink(link_args));
+ }
+
+ if(isXUL()) {
+ /* show the hold link */
+ var l = $n(row, 'copy_hold_link');
+ unHideMe(l);
+ l.onclick = function() {
+ holdsDrawEditor(
+ {
+ type : 'C',
+ copyObject : copy,
+ onComplete : function(){}
+ }
+ );
+ }
+
+ /* show the book now link */
+ l = $n(row, 'copy_reserve_link');
+ unHideMe(l);
+ l.onclick = function() {
+ // XXX FIXME this duplicates things in cat/util.js
+ // Also needs i18n
+ dojo.require("fieldmapper.Fieldmapper");
+ var r = fieldmapper.standardRequest(
+ ["open-ils.booking",
+ "open-ils.booking.resources.create_from_copies"],
+ [G.user.session, [copy.id()]]
+ );
+ if (!r) {
+ alert("No response from server!");
+ } else if (r.ilsevent != undefined) {
+ alert("Error from server:\n" + js2JSON(r));
+ } else {
+ xulG.auth = {"session": {"key": G.user.session}};
+ xulG.bresv_interface_opts = {"booking_results": r};
+ location.href = "/eg/booking/reservation";
+ }
+ }
+
+ if( copy.age_protect() )
+ appendClear($n(row, 'age_protect_value'), text(copy.age_protect().name()));
+
+ var cd = copy.create_date();
+ cd = cd.replace(/T.*/, '');
+ $n(row, 'create_date_value').appendChild(text(cd));
+
+ var yes = $('rdetail.yes').innerHTML;
+ var no = $('rdetail.no').innerHTML;
+
+ if( isTrue(copy.holdable()) &&
+ isTrue(copy.location().holdable()) &&
+ isTrue(copy.status().holdable()) ) {
+ $n(row, 'copy_is_holdable').appendChild(text(yes));
+ } else {
+ $n(row, 'copy_is_holdable').appendChild(text(no));
+ }
+ }
+
+ if (isXUL() || showDueDate) {
+ var circ;
+ if( copy.circulations() ) {
+ circ = copy.circulations()[0];
+ if( circ ) {
+ var due_time = dojo.date.stamp.fromISOString(circ.due_date());
+ if( showDueTime ) {
+ $n(row, 'copy_due_date').appendChild(text(dojo.date.locale.format(due_time, {"formatLength": "medium"})));
+ } else {
+ $n(row, 'copy_due_date').appendChild(text(dojo.date.locale.format(due_time, {"selector": "date", "formatLength": "medium"})));
+ }
+ }
+ }
+ }
+
+ r.args.copy = copy;
+ r.args.copyrow = row;
+ cpdShowNotes(copy, r.args)
+ cpdShowStats(copy, r.args);
+
+}
+
+function _cpdExtrasInit(args) {
+
+ var newrid = 'extras_row_' + args.copy.barcode();
+ var newrow = $(newrid);
+ if(!newrow) newrow = args.extrasRow.cloneNode(true);
+ var tbody = $n(newrow, 'extras_tbody');
+ var rowt = $n(tbody, 'extras_row');
+ newrow.id = newrid;
+
+ var cr = args.copyrow;
+ var nr = cr.nextSibling;
+ var np = args.mainTbody;
+
+ /* insert the extras row into the main table */
+ if(nr) np.insertBefore( newrow, nr );
+ else np.appendChild(newrow);
+
+ var link = $n(args.copyrow, 'details_link');
+ var link2 = $n(args.copyrow, 'less_details_link');
+ var id = newrow.id;
+ link.id = id + '_morelink';
+ link2.id = id + '_lesslink';
+ unHideMe(link);
+ hideMe(link2);
+
+ link.setAttribute('href',
+ 'javascript:unHideMe($("'+link2.id+'")); hideMe($("'+link.id+'"));unHideMe($("'+newrow.id+'"));');
+
+ link2.setAttribute('href',
+ 'javascript:unHideMe($("'+link.id+'")); hideMe($("'+link2.id+'"));hideMe($("'+newrow.id+'"));');
+
+ return [ tbody, rowt ];
+}
+
+function cpdShowNotes(copy, args) {
+ var notes = copy.notes();
+ if(!notes || notes.length == 0) return;
+
+ var a = _cpdExtrasInit(args);
+ var tbody = a[0];
+ var rowt = a[1];
+
+ for( var n in notes ) {
+ var note = notes[n];
+ if(!isTrue(note.pub())) continue;
+ var row = rowt.cloneNode(true);
+ $n(row, 'key').appendChild(text(note.title()));
+ $n(row, 'value').appendChild(text(note.value()));
+ unHideMe($n(row, 'note'));
+ unHideMe(row);
+ tbody.appendChild(row);
+ }
+}
+
+
+function cpdShowStats(copy, args) {
+ var entries = copy.stat_cat_entry_copy_maps();
+ if(!entries || entries.length == 0) return;
+
+ var visibleStatCat = false;
+
+ /*
+ check all copy stat cats; if we find one that's OPAC visible,
+ set the flag and break the loop. If we've found one, or we're
+ in the staff client, build the table. if not, we return doing
+ nothing, as though the stat_cat_entry_copy_map was empty or null
+ */
+
+ for( var n in entries )
+ {
+ var entry = entries[n];
+ if(isTrue(entry.stat_cat().opac_visible()))
+ {
+ visibleStatCat = true;
+ break;
+ }
+ }
+
+ if(!(isXUL() || visibleStatCat)) return;
+
+ var a = _cpdExtrasInit(args);
+ var tbody = a[0];
+ var rowt = a[1];
+
+ for( var n in entries ) {
+ var entry = entries[n];
+ if(!(isXUL() || isTrue(entry.stat_cat().opac_visible()))) continue;
+ var row = rowt.cloneNode(true);
+ $n(row, 'key').appendChild(text(entry.stat_cat().name()));
+ $n(row, 'value').appendChild(text(entry.stat_cat_entry().value()));
+ unHideMe($n(row, 'cat'));
+ unHideMe(row);
+ tbody.appendChild(row);
+ }
+}
+
--- /dev/null
+
+attachEvt( "common", "locationChanged", updateLoc );
+
+var _ds;
+var _libselspan;
+var _libselslink;
+var _dselspan;
+var _newlocation = null;
+
+function depthSelInit() {
+ _ds = $('depth_selector');
+ _ds.onchange = depthSelectorChanged;
+ _libselspan = $('lib_selector_span');
+ _libsellink = $('lib_selector_link');
+ _dselspan = $('depth_selector_span');
+
+ if( getLocation() == globalOrgTree.id() ) {
+ unHideMe( _libselspan );
+ _libsellink.onclick = _opacHandleLocationTagClick;
+ } else {
+ unHideMe( _dselspan );
+ buildLocationSelector();
+ }
+
+ setSelector(_ds, getDepth());
+ _newlocation = getLocation();
+}
+
+
+var orgTreeIsBuilt = false;
+function _opacHandleLocationTagClick() {
+
+ swapCanvas(G.ui.common.org_container);
+
+ if(!orgTreeIsBuilt) {
+ drawOrgTree();
+ orgTreeIsBuilt = true;
+ }
+
+}
+
+function depthSelGetDepth() {
+ var depth = parseInt(_ds.options[_ds.selectedIndex].value);
+ if(isNaN(depth)) depth = 0;
+ return depth;
+}
+
+function depthSelectorChanged() {
+ var i = _ds.selectedIndex;
+ if( i == _ds.options.length - 1 ) {
+ setSelector( _ds, getDepth() );
+ _opacHandleLocationTagClick();
+ } else {
+ /* this re-submits the search when they change the search range
+ disabled for testing...
+ */
+ /*runEvt('common', 'depthChanged');*/
+ }
+}
+
+var chooseAnotherNode;
+function buildLocationSelector(newLoc) {
+
+ var loc;
+ if(newLoc != null) loc = newLoc;
+ else loc = getLocation();
+
+ if( loc == globalOrgTree.id() ) return;
+
+ var selector = _ds;
+ if(!chooseAnotherNode)
+ chooseAnotherNode = selector.removeChild(
+ selector.getElementsByTagName("option")[0]);
+ var node = chooseAnotherNode;
+ removeChildren(selector);
+
+ var location = findOrgUnit(loc);
+ var type;
+ if (location) type = findOrgType(location.ou_type());
+
+ var orgHiding = checkOrgHiding();
+ while( type && location ) {
+ var n = node.cloneNode(true);
+ n.setAttribute("value", type.depth());
+ removeChildren(n);
+ n.appendChild(text(type.opac_label()));
+ selector.appendChild(n);
+ location = findOrgUnit(location.parent_ou());
+ if(location) {
+ type = findOrgType(location.ou_type());
+ if (orgHiding && orgHiding.depth > type.depth()) {
+ type = null;
+ }
+ } else {
+ type = null;
+ }
+ }
+
+ selector.appendChild(node);
+}
+
+function getNewSearchDepth() { return newSearchDepth; }
+function getNewSearchLocation() { return (isNull(_newlocation)) ? LOCATION : _newlocation; }
+function depthSelGetNewLoc() { return getNewSearchLocation(); }
+
+function updateLoc(location, depth) {
+ if( depth != null ) {
+ if(depth != 0 ){
+ _libsellink.onclick = _opacHandleLocationTagClick;
+ if( location == globalOrgTree.id() ) {
+ hideMe( _dselspan );
+ unHideMe( _libselspan );
+ } else {
+ buildLocationSelector(location);
+ hideMe( _libselspan );
+ unHideMe( _dselspan );
+ }
+ }
+
+ setSelector(_ds, depth);
+ newSearchDepth = depth;
+ }
+
+ _newlocation = location;
+ runEvt('common','locationUpdated', location);
+}
+
+
+
--- /dev/null
+var holdsOrgSelectorBuilt = false;
+var holdArgs;
+
+/*
+note: metarecord holds have a holdable_formats field that contains
+item_type(s)-item_forms(s)-language
+item_form and language are optional - if language exist and no
+item_form is specified, use item_type(s)--language
+*/
+
+var noEmailMessage;
+var noEmailMessageXUL;
+
+var holdTargetTypeMap = {
+ M : 'metarecord',
+ T : 'record',
+ V : 'volume',
+ I : 'issuance',
+ C : 'copy',
+ P : 'part'
+};
+
+
+
+function holdsHandleStaff() {
+
+ // if we know the recipient's barcode, use it
+ if(xulG.patron_barcode) return _holdsHandleStaff();
+
+ swapCanvas($('xulholds_box'));
+ $('xul_recipient_barcode').focus();
+ $('xul_recipient_barcode').onkeypress = function(evt)
+ {if(userPressedEnter(evt)) { _holdsHandleStaff(); } };
+ $('xul_recipient_barcode_submit').onclick = _holdsHandleStaff;
+ $('xul_recipient_me').onclick = _holdsHandleStaffMe;
+
+ $('xul_recipient_barcode').onkeyup = function(evt) {
+ if($('xul_recipient_barcode').value == '')
+ $('xul_recipient_me').disabled = false;
+ else
+ $('xul_recipient_me').disabled = true;
+ };
+}
+
+$('holds_frozen_thaw_input').onchange =
+ function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');}
+$('holds_frozen_thaw_input').onkeyup =
+ function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');}
+
+function _holdsHandleStaffMe() {
+ holdArgs.recipient = G.user;
+ holdsDrawEditor();
+}
+
+function _holdsHandleStaff() {
+ var barcode = xulG.patron_barcode || $('xul_recipient_barcode').value;
+ var user = grabUserByBarcode( G.user.session, barcode );
+
+ var evt;
+ if(evt = checkILSEvent(user)) {
+ alertILSEvent(user);
+ return;
+ }
+
+ if(!barcode || !user) {
+ alertId('holds_invalid_recipient', barcode);
+ return
+ }
+
+ grabUserPrefs(user);
+
+ holdArgs.recipient = user;
+ holdsDrawEditor();
+}
+
+
+
+/** args:
+ * record, volume, copy (ids)
+ * request, recipient, editHold (objects)
+ */
+
+function holdsDrawEditor(args) {
+
+ holdArgs = (args) ? args : holdArgs;
+
+ if(!noEmailMessage)
+ noEmailMessage = $('holds_email').removeChild($('holds.no_email'));
+
+ if(!noEmailMessageXUL)
+ noEmailMessageXUL = $('holds_email').removeChild($('holds.no_email.xul'));
+
+ if(isXUL() && holdArgs.recipient == null
+ && holdArgs.editHold == null) {
+ holdsHandleStaff();
+ return;
+ }
+
+ if(!holdArgs.recipient) holdArgs.recipient = G.user;
+ if(!holdArgs.requestor) holdArgs.requestor = G.user;
+
+ if(!(holdArgs.requestor && holdArgs.requestor.session)) {
+ detachAllEvt('common','locationChanged');
+ attachEvt('common','loggedIn', holdsDrawEditor)
+ initLogin();
+ return;
+ }
+
+ if(holdArgs.editHold) // flesh the args with the existing hold
+ holdArgsFromHold(holdArgs.editHold, holdArgs);
+
+ removeCSSClass($('holds_parts_selector'), 'parts-warning');
+ holdArgs.partsSuggestionMade = false;
+
+ holdsDrawWindow();
+}
+
+
+// updates the edit window with the existing hold's data
+function _holdsUpdateEditHold() {
+
+ var hold = holdArgs.editHold;
+ var qstats = holdArgs.status;
+
+ var orgsel = $('holds_org_selector');
+ var frozenbox = $('holds_frozen_chkbox');
+
+ setSelector(orgsel, hold.pickup_lib());
+
+ if( hold.capture_time() || qstats.status > 2 ) {
+ frozenbox.disabled = true;
+ $('holds_frozen_thaw_input').disabled = true;
+ if(qstats.status == 3) {
+ // no pickup lib changes while in-transit
+ orgsel.disabled = true;
+ } else {
+ var orgs = fetchPermOrgs('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF');
+ if(orgs[0] == -1)
+ orgsel.disabled = true;
+ }
+ } else {
+ orgsel.disabled = false;
+ frozenbox.disabled = false;
+ }
+
+
+ $('holds_submit').onclick = holdsEditHold;
+ $('holds_update').onclick = holdsEditHold;
+
+ if(hold.phone_notify()) {
+ $('holds_enable_phone').checked = true;
+ $('holds_phone').value = hold.phone_notify();
+
+ } else {
+ $('holds_phone').disabled = true;
+ $('holds_enable_phone').checked = false;
+ }
+
+ if(isTrue(hold.email_notify())) {
+ $('holds_enable_email').checked = true;
+
+ } else {
+ $('holds_enable_email').checked = false;
+ }
+
+ dijit.byId('holds_expire_time').setValue(dojo.date.stamp.fromISOString(hold.expire_time()));
+
+ /* populate the hold freezing info */
+ if(!frozenbox.disabled && isTrue(hold.frozen())) {
+ frozenbox.checked = true;
+ unHideMe($('hold_frozen_thaw_row'));
+ if(hold.thaw_date()) {
+ dijit.byId('holds_frozen_thaw_input').setValue(dojo.date.stamp.fromISOString(hold.thaw_date()));
+ } else {
+ dijit.byId('holds_frozen_thaw_input').setValue('');
+ }
+ } else {
+ frozenbox.checked = false;
+ dijit.byId('holds_frozen_thaw_input').setValue('');
+ hideMe($('hold_frozen_thaw_row'));
+ }
+}
+
+function holdsEditHold() {
+ var hold = holdsBuildHoldFromWindow();
+ if(!hold) return;
+ holdsUpdate(hold);
+ showCanvas();
+ if(holdArgs.onComplete)
+ holdArgs.onComplete(hold);
+}
+
+function holdArgsFromHold(hold, oargs) {
+ var args = (oargs) ? oargs : {};
+ args.type = hold.hold_type();
+ var target = hold.target();
+ args[holdTargetTypeMap[args.type]] = target;
+ return args;
+}
+
+function holdFetchObjects(hold, doneCallback) {
+
+ var args = (hold) ? holdArgsFromHold(hold) : holdArgs;
+
+ var type = args.type;
+
+ if( type == 'C' ) {
+
+ if( args.copyObject ) {
+
+ args.copy = args.copyObject.id();
+ args.volume = args.copyObject.call_number();
+ _h_set_vol(args, doneCallback);
+
+ } else {
+ var creq = new Request(FETCH_COPY, args.copy);
+
+ creq.callback(
+ function(r) {
+ var cp = r.getResultObject();
+ args.copyObject = cp;
+ args.volume = args.copyObject.call_number();
+ _h_set_vol(args, doneCallback);
+ }
+ );
+ creq.send();
+ }
+ } else {
+ if( type == 'V' ) {
+ _h_set_vol(args, doneCallback);
+
+ } else if( type == 'I' ) {
+ _h_set_issuance(args, doneCallback);
+
+ } else if( type == 'P' ) {
+ _h_set_parts(args, doneCallback);
+
+ } else {
+ if( type == 'T') {
+ _h_set_rec(args, doneCallback);
+ } else {
+ _h_set_rec_descriptors(args, doneCallback);
+ }
+ }
+ }
+
+ return args;
+}
+
+function _h_set_parts(args, doneCallback) {
+
+ var preq = new Request(
+ 'open-ils.fielder:open-ils.fielder.bmp.atomic',
+ {"cache":1, "fields":["label", "record"],"query": {"id":args.part}}
+ );
+
+ preq.callback(
+ function(r) {
+ var part = r.getResultObject()[0];
+ args.record = part.record;
+ args.partObject = part;
+ _h_set_rec(args, doneCallback);
+ }
+ );
+
+ preq.send();
+}
+
+function _h_set_vol(args, doneCallback) {
+
+ if( args.volumeObject ) {
+ args.volume = args.volumeObject.id();
+ args.record = args.volumeObject.record();
+ _h_set_rec(args, doneCallback);
+
+ } else {
+
+ var vreq = new Request(FETCH_VOLUME, args.volume);
+ vreq.callback(
+ function(r) {
+ var vol = r.getResultObject();
+ args.volumeObject = vol;
+ args.record = vol.record();
+ _h_set_rec(args, doneCallback);
+ }
+ );
+ vreq.send();
+ }
+}
+
+function _h_set_issuance(args, doneCallback) {
+
+ if( args.issuanceObject ) {
+ args.issuance = args.issuanceObject.id();
+ args.record = args.issuanceObject.subscription().record_entry();
+ _h_set_rec(args, doneCallback);
+
+ } else {
+
+ var vreq = new Request(FETCH_ISSUANCE, [args.issuance]);
+ vreq.callback(
+ function(r) {
+ var issuance = r.getResultObject()[0];
+ args.issuanceObject = issuance;
+ args.record = issuance.subscription().record_entry();
+ _h_set_rec(args, doneCallback);
+ }
+ );
+ vreq.send();
+ }
+}
+
+function _h_set_rec(args, doneCallback) {
+
+ if(args.recordObject)
+ args.record = args.recordObject.doc_id();
+ else
+ args.recordObject = findRecord( args.record, 'T' );
+
+ if( args.type == 'T' || args.type == 'M' ) {
+ _h_set_rec_descriptors(args, doneCallback);
+ //} else if(args.type == 'P') {
+ //_h_get_parts(args, doneCallback);
+ } else {
+ if(doneCallback) doneCallback(args);
+ }
+}
+
+
+function _h_set_rec_descriptors(args, doneCallback) {
+
+ if( ! args.pickup_lib )
+ args.pickup_lib = getSelectorVal($('holds_org_selector'));
+
+ if(args.pickup_lib === null)
+ args.pickup_lib = args.recipient.home_ou();
+
+ // grab the list of record desciptors attached to this records metarecord
+ if( ! args.recordDescriptors ) {
+ var params = { pickup_lib: args.pickup_lib };
+
+ if (args.type == 'M') {
+ if( !args.metarecord && args.record) {
+ params.metarecord = args.metarecord = args.record;
+ delete(args.record);
+ } else {
+ params.metarecord = args.metarecordObject.doc_id();
+ }
+ } else {
+ params.record = args.record;
+ }
+
+ if( ! args.record ) {
+ if( args.metarecord )
+ params.metarecord = args.metarecord;
+ else
+ params.metarecord = args.metarecordObject.doc_id();
+ }
+
+ var req = new Request(FETCH_MR_DESCRIPTORS, params );
+ req.callback(
+ function(r) {
+ var data = r.getResultObject();
+ args.recordDescriptors = args.recordDescriptors = data.descriptors;
+ args.metarecord = args.metarecord = data.metarecord;
+ if( args.type == 'M' && ! args.metarecordObject)
+ args.metarecordObject = args.metarecordObject = findRecord(args.metarecord, 'M');
+
+ _h_get_parts(args, doneCallback);
+ }
+ );
+ req.send();
+
+ } else {
+ _h_get_parts(args, doneCallback);
+ }
+
+ return args;
+}
+
+function _h_get_parts(args, doneCallback) {
+
+ if(args.type == 'M' || args.editHold || args.holdParts) {
+ if(doneCallback)
+ doneCallback(args);
+
+ } else {
+
+ var req = new Request(
+ 'open-ils.search:open-ils.search.biblio.record_hold_parts',
+ {pickup_lib: args.pickup_lib, record: args.record}
+ );
+
+ req.callback(
+ function(r) {
+ args.recordParts = r.getResultObject();
+ if(doneCallback)
+ doneCallback(args);
+ }
+ );
+ req.send();
+ }
+}
+
+
+
+function holdsDrawWindow() {
+ swapCanvas($('holds_box'));
+ $('holds_cancel').onclick = function(){ runEvt('common', 'holdUpdateCanceled'), showCanvas() };
+ $('holds_submit').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())};
+ $('holds_update').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())};
+ $('holds_org_selector').onchange = function(){holdsDrawWindow()};
+ holdFetchObjects(null,
+ function(){
+ __holdsDrawWindow();
+
+ if(holdArgs.editHold) {
+ hideMe($('holds_submit'));
+ unHideMe($('holds_update'));
+ var req = new Request(FETCH_HOLD_STATUS,
+ G.user.session, holdArgs.editHold.id());
+ req.send(true);
+ holdArgs.status = req.result();
+ _holdsUpdateEditHold();
+ }
+ }
+ );
+}
+
+function __holdsDrawWindow() {
+
+ var rec = holdArgs.recordObject;
+ var vol = holdArgs.volumeObject;
+ var copy = holdArgs.copyObject;
+ var mr = holdArgs.metarecordObject;
+
+ rec = (rec) ? rec : mr;
+
+ if(!holdsOrgSelectorBuilt) {
+ holdsBuildOrgSelector(null,0);
+ holdsOrgSelectorBuilt = true;
+ var selector = $('holds_org_selector');
+
+ /*
+ var o_loc = findOrgUnit(getOrigLocation());
+ var t = findOrgType(o_loc.ou_type());
+ if( t.can_have_users() )
+ setSelector(selector, o_loc.id());
+ else
+ */
+
+ setSelector(selector, holdArgs.recipient.home_ou());
+
+ }
+
+ /*
+ if(isXUL()) {
+ var dsel = $('holds_depth_selector');
+ unHideMe($('holds_depth_selector_row'));
+ if(dsel.getElementsByTagName('option').length == 0) {
+ var types = globalOrgTypes;
+ var depth = findOrgDepth(G.user.ws_ou());
+ iterate(types,
+ function(t) {
+ if(t.depth() > depth) return;
+ insertSelectorVal(dsel, -1, t.opac_label(), t.depth());
+ }
+ );
+ }
+ }
+ */
+
+ appendClear($('holds_recipient'), text(
+ holdArgs.recipient.family_name() + ', ' +
+ holdArgs.recipient.first_given_name()));
+ appendClear($('holds_title'), text(rec.title()));
+ appendClear($('holds_author'), text(rec.author()));
+
+ if( holdArgs.type == 'I' ) {
+ unHideMe($('holds_type_row'));
+ unHideMe($('holds_is_issuance'));
+ unHideMe($('holds_issuance_row'));
+ appendClear($('holds_issuance_label'), text(holdArgs.issuanceObject.label()));
+
+ } else if( holdArgs.type == 'V' || holdArgs.type == 'C' ) {
+
+ unHideMe($('holds_type_row'));
+ unHideMe($('holds_cn_row'));
+ appendClear($('holds_cn'), text(holdArgs.volumeObject.label()));
+
+ if( holdArgs.type == 'V' ) {
+ unHideMe($('holds_is_cn'));
+ hideMe($('holds_is_copy'));
+
+ } else {
+ hideMe($('holds_is_cn'));
+ unHideMe($('holds_is_copy'));
+ unHideMe($('holds_copy_row'));
+ appendClear($('holds_copy'), text(holdArgs.copyObject.barcode()));
+ }
+
+ } else {
+ hideMe($('holds_type_row'));
+ hideMe($('holds_copy_row'));
+ hideMe($('holds_cn_row'));
+ hideMe($('holds_issuance_row'));
+ }
+
+ if(holdArgs.recordParts && holdArgs.recordParts.length) {
+ var selector = $('holds_parts_selector');
+ unHideMe($('holds_parts_row'));
+ unHideMe(selector);
+
+ var nodeList = [];
+ dojo.forEach(selector.options,
+ function(node) { if(node.value != '') nodeList.push(node) } );
+
+ dojo.forEach(nodeList, function(node) { selector.removeChild(node); });
+
+ dojo.forEach(
+ holdArgs.recordParts,
+ function(part) {
+ insertSelectorVal(selector, -1, part.label, part.id);
+ }
+ );
+
+ } else if(holdArgs.type == 'P') {
+ unHideMe($('holds_parts_row'));
+ unHideMe($('holds_parts_label'));
+ appendClear( $('holds_parts_label'), text(holdArgs.partObject.label));
+ }
+
+ removeChildren($('holds_format'));
+
+ var mods_formats = rec.types_of_resource();
+ var formats;
+
+ if(holdArgs.recordDescriptors)
+ formats = holdArgs.recordDescriptors[0].item_type();
+
+ if( holdArgs.type == 'T' ) {
+ var desc = grep( holdArgs.recordDescriptors,
+ function(i) {
+ return (i.record() == holdArgs.record);
+ }
+ );
+ if (desc) {
+ formats = desc[0].item_type();
+ }
+ }
+
+ if( holdArgs.type == 'M' ) {
+ var mr_formats;
+ if(holdArgs.editHold){
+ mr_formats = holdArgs.editHold.holdable_formats();
+ }else{
+ mr_formats = ''; // collect the item_type()s from all holdArgs.recordDescriptors
+ for(var desc in holdArgs.recordDescriptors){
+ if (!holdArgs.recordDescriptors[desc].item_type()) continue;
+ mr_formats += holdArgs.recordDescriptors[desc].item_type();
+ }
+
+ var first_form = 1;
+ for(var desc in holdArgs.recordDescriptors){
+ if (!holdArgs.recordDescriptors[desc].item_form()) continue;
+ if (first_form) {
+ mr_formats += '-';
+ first_form = 0;
+ }
+ mr_formats += holdArgs.recordDescriptors[desc].item_form();
+ }
+
+
+ }
+
+ var data = holdsParseMRFormats(mr_formats);
+ mods_formats = data.mods_formats;
+ formats = data.formats;
+ }
+
+
+ for( var i in mods_formats ) {
+ var res = mods_formats[i];
+ var img = elem("img");
+ setResourcePic(img, res);
+ $('holds_format').appendChild(img);
+ if(formats)
+ $('holds_format').appendChild(text(' '+ MARCTypeToFriendly(formats[i]) +' '));
+ else
+ $('holds_format').appendChild(text(' '+ mods_formats[i] +' '));
+ $('holds_format').appendChild(elem('br'));
+ }
+
+
+ $('holds_phone').value = holdArgs.recipient.day_phone();
+ appendClear( $('holds_email'), text(holdArgs.recipient.email()));
+
+ var pref = holdArgs.recipient.prefs[PREF_HOLD_NOTIFY];
+
+ if(pref) {
+ if( ! pref.match(/email/i) ) {
+ $('holds_enable_email').checked = false;
+ } else {
+ $('holds_enable_email').checked = true;
+ }
+
+ if( ! pref.match(/phone/i) ) {
+ $('holds_phone').disabled = true;
+ $('holds_enable_phone').checked = false;
+ } else {
+ $('holds_phone').disabled = false;
+ $('holds_enable_phone').checked = true;
+ }
+ }
+
+ if(!holdArgs.recipient.email()) {
+ $('holds_enable_email').checked = false;
+ $('holds_enable_email').disabled = true;
+ var message;
+ if(isXUL()) {
+ message = noEmailMessageXUL.cloneNode(true);
+ appendClear($('holds_email'), message);
+ } else {
+ message = noEmailMessage.cloneNode(true);
+ appendClear($('holds_email'), message);
+ $('holds.no_email.my_account').setAttribute('href', buildOPACLink({page:MYOPAC},null,true));
+ }
+ unHideMe(message);
+ }
+
+ if(!$('holds_phone').value)
+ $('holds_enable_phone').checked = false;
+
+ appendClear($('holds_physical_desc'), text(rec.physical_description()));
+
+ if(holdArgs.type == 'M') hideMe($('hold_physical_desc_row'));
+
+ holdsSetFormatSelector();
+
+ $('holds_frozen_chkbox').checked = false;
+ hideMe($('hold_frozen_thaw_row'));
+
+ var interval = fetchOrgSettingDefault(holdArgs.recipient.home_ou(), 'circ.hold_expire_interval');
+ var secs = 0;
+ if(interval) {
+ secs = interval_to_seconds(interval);
+ var expire = new Date();
+ expire.setTime(expire.getTime() + Number(secs + '000'));
+ dijit.byId('holds_expire_time').setValue(expire);
+ }
+}
+
+function holdsParseMRFormats(str) {
+ var data = str.split(/-/);
+
+ var formats = [];
+ var mods_formats = [];
+
+ for( var i = 0; i < data[0].length; i++ ) {
+ formats.push( data[0].charAt(i) );
+ mods_formats.push( MARCFormatToMods( formats[i] ) );
+ }
+
+ formats = uniquify(formats);
+ mods_formats = uniquify(mods_formats);
+
+ return {
+ formats : formats,
+ mods_formats : mods_formats,
+ lang : data[2],
+ largeprint : data[1]
+ };
+}
+
+
+function holdsSetFormatSelector() {
+ var type = holdArgs.type;
+ if( type == 'C' || type == 'V' || type == "I" || holdArgs.editHold ) return;
+
+ var data = holdsGetFormats();
+ var avail_formats = data.avail_formats;
+ var sel_formats = data.sel_formats;
+ holdArgs.language = data.lang;
+ if( type=='M'){
+ hideMe($('holds_alt_formats_row_extras'));
+ unHideMe($('holds_alt_formats_row'));
+ }else{
+ unHideMe($('holds_alt_formats_row_extras'));
+ }
+
+ var selector = $('hold_alt_form_selector');
+
+ for( var i = 0; i < selector.options.length; i++ ) {
+ if (selector.options[i].className.indexOf('hide_me') == -1)
+ hideMe(selector.options[i]);
+ selector.options[i].disabled = true;
+ }
+
+ for( var i = 0; i < avail_formats.length; i++ ) {
+ var form = avail_formats[i];
+ var opt = findFormatSelectorOptByParts(selector,form);
+ if (!opt) continue;
+ if(type=='M') opt.selected=true;
+ unHideMe(opt);
+ opt.disabled = false;
+ }
+
+ // If the user selects a format, P-type holds are no longer an option
+ // disable and reset the P-type form control
+ selector.onchange = function() {
+ var partsSel = $('holds_parts_selector');
+ for(var i = 0; i < selector.options.length; i++) {
+ if(selector.options[i].selected) {
+ partsSel.selectedIndex = 0; // none selected
+ partsSel.disabled = true;
+ return;
+ }
+ }
+ partsSel.disabled = false;
+ }
+}
+
+function findFormatSelectorOptByParts( sel, val ) {
+ var parts = val.split('-');
+ for( var i = 0; i < sel.options.length; i++ ) {
+ var opt = sel.options[i];
+ var oval = opt.value;
+ var oparts = oval.split('-');
+ if( oparts[0].indexOf(parts[0]) > -1 && (!parts[1] || oparts[1].indexOf(parts[1]) > -1) ) return opt;
+ }
+ return null;
+}
+
+function holdsGetFormats() {
+
+ var lang;
+ var formats = [];
+ var sformats = []; // selected formats
+
+ var type = holdArgs.type;
+ var desc = holdArgs.recordDescriptors;
+ var rec = holdArgs.record;
+ var mrec = holdArgs.metarecord;
+
+
+ if( type == 'T') {
+
+ for( var i = 0; i < desc.length; i++ ) {
+ var d = desc[i];
+ if( d.record() == holdArgs.record ) {
+ lang = d.item_lang();
+ holdArgs.myFormat = _t_f_2_format(d.item_type(), d.item_form());
+ sformats.push(holdArgs.myFormat);
+ break;
+ }
+ }
+
+ for( var i = 0; i < desc.length; i++ ) {
+ var d = desc[i];
+ if( type == 'T' && d.item_lang() != lang ) continue;
+ formats.push( _t_f_2_format(d.item_type(), d.item_form()));
+ }
+
+ } else if( type =='M') {
+
+ // All available formats are selected by default in MR holds
+ for( var i = 0; i < desc.length; i++ ) {
+ var d = desc[i];
+ var _tmp_f = _t_f_2_format(d.item_type(), d.item_form());
+ formats.push( _tmp_f );
+ sformats.push( _tmp_f );
+ }
+ }
+
+ formats = uniquify(formats);
+ sformats = uniquify(sformats);
+
+ return {
+ lang : lang,
+ avail_formats : formats,
+ sel_formats : sformats
+ };
+}
+
+
+
+function _t_f_2_format(type, form) {
+ if( (type == 'a' || type == 't') && form == 's' ) return 'at-s';
+ if( form == 'd' ) return 'at-d';
+ return (type == 'a' || type == 't') ? 'at' : type;
+}
+
+function holdsSetSelectedFormats() {
+
+ var cn = $('holds_alt_formats_row').className;
+ if( cn && cn.match(/hide_me/) ) return;
+
+ var selector = $('hold_alt_form_selector');
+ var vals = getSelectedList(selector);
+
+ if(vals.length == 0) return;
+
+ var fstring = "";
+
+ if( contains(vals, 'at-d') || contains(vals, 'at-s') || contains(vals, 'at')) {
+ if( contains(vals, 'at') ) {
+ fstring = 'at';
+ } else if (contains(vals, 'at-s') && contains(vals, 'at-d')) {
+ fstring = 'at-sd';
+ } else if (!contains(vals, 'at-s')) {
+ fstring = 'at-d';
+ } else {
+ fstring = 'at-s';
+ }
+ }
+
+ for( var i = 0; i < vals.length; i++ ) {
+ var val = vals[i];
+ if( !val.match(/at/) ) fstring = val + fstring;
+ }
+
+ if( holdArgs.language ) {
+ if( fstring.match(/-/) )
+ fstring = fstring + '-' + holdArgs.language;
+ else
+ fstring = fstring + '--' + holdArgs.language;
+ }
+
+
+ return fstring;
+}
+
+
+function holdsCheckPossibility(pickuplib, hold, recurse) {
+
+ var args = {
+ titleid : holdArgs.record,
+ mrid : holdArgs.metarecord,
+ volume_id : holdArgs.volume,
+ issuanceid : holdArgs.issuance,
+ copy_id : holdArgs.copy,
+ hold_type : holdArgs.type,
+ holdable_formats : holdArgs.holdable_formats,
+ patronid : holdArgs.recipient.id(),
+ depth : 0,
+ pickup_lib : pickuplib,
+ partid : holdArgs.part
+ };
+
+ if(recurse) {
+ /* if we're calling create again (recursing),
+ we know that the hold possibility check already succeeded */
+ holdHandleCreateResponse({_recurse:true, _hold:hold}, true );
+
+ } else {
+ _debug("hold possible args = "+js2JSON(args));
+
+ var req = new Request(CHECK_HOLD_POSSIBLE, G.user.session, args );
+
+ req.request.alertEvent = false;
+ req.request._hold = hold;
+ req.request._recurse = recurse;
+ req.callback(holdHandleCreateResponse);
+ req.send();
+ }
+}
+
+
+function holdsBuildOrgSelector(node) {
+
+ if(!node) node = globalOrgTree;
+ if(!isTrue(node.opac_visible())) return;
+
+ var render_this_org = true;
+ var orgHiding = checkOrgHiding(); // value here is cached so not too painful with the recursion
+ if (orgHiding) {
+ if (node.id() == globalOrgTree.id()) {
+ node = orgHiding.org; // top of tree = org hiding context org
+ }
+ if ( ! orgIsMine( orgHiding.org, node, orgHiding.depth ) ) {
+ render_this_org = false;
+ }
+ }
+
+ if (render_this_org) {
+ var selector = $('holds_org_selector');
+ var index = selector.options.length;
+
+ var type = findOrgType(node.ou_type());
+ var indent = type.depth() - 1;
+
+ var opt = setSelectorVal( selector, index, node.name(), node.id(), null, indent );
+ if(!type.can_have_users()) {
+ opt.disabled = true;
+ addCSSClass(opt, 'disabled_option');
+ }
+ }
+
+ for( var i in node.children() ) {
+ var child = node.children()[i];
+ if(child) holdsBuildOrgSelector(child);
+ }
+}
+
+function holdsBuildHoldFromWindow() {
+
+ var org = getSelectorVal($('holds_org_selector'));
+ var node = findOrgUnit(org);
+ var ntype = findOrgType(node.ou_type());
+ if(!ntype.can_have_users()) {
+ alertId('holds_pick_good_org');
+ return;
+ }
+
+ fieldmapper.IDL.load(['ahr']);
+ var hold = new ahr();
+ if(holdArgs.editHold) {
+ hold = holdArgs.editHold;
+ holdArgs.editHold = null;
+ }
+
+ if( $('holds_enable_phone').checked ) {
+ var phone = $('holds_phone').value;
+ if( !phone || !phone.match(REGEX_PHONE) ) {
+ alert($('holds_bad_phone').innerHTML);
+ return null;
+ }
+ hold.phone_notify(phone);
+
+ } else {
+ hold.phone_notify("");
+ }
+
+ if( $('holds_enable_email').checked )
+ hold.email_notify(1);
+ else
+ hold.email_notify(0);
+
+ var part = getSelectorVal($('holds_parts_selector'));
+ if(part) {
+ holdArgs.type = 'P';
+ holdArgs.part = part;
+ }
+
+ var target = holdArgs[holdTargetTypeMap[holdArgs.type]];
+
+ // a mono part is selected
+
+ hold.pickup_lib(org);
+ //hold.request_lib(org);
+ hold.requestor(holdArgs.requestor.id());
+ hold.usr(holdArgs.recipient.id());
+ hold.target(target);
+ hold.hold_type(holdArgs.type);
+
+ var expDate = dijit.byId('holds_expire_time').getValue();
+ if(expDate) {
+ var expireDate = dojo.date.stamp.toISOString(expDate);
+ expireDate = holdsVerifyThawDate(expireDate);
+ if(expireDate)
+ hold.expire_time(expireDate);
+ else
+ return;
+ }
+
+ // see if this hold should be frozen and for how long
+ if($('holds_frozen_chkbox').checked) {
+ hold.frozen('t');
+ unHideMe($('hold_frozen_thaw_row'));
+ var thawDate = dijit.byId('holds_frozen_thaw_input').attr('value');
+ if(thawDate) {
+ thawDate = dojo.date.stamp.toISOString(thawDate);
+ thawDate = holdsVerifyThawDate(thawDate);
+ if(thawDate)
+ hold.thaw_date(thawDate);
+ else
+ return;
+ } else {
+ hold.thaw_date(null);
+ }
+ } else {
+ hold.frozen('f');
+ hold.thaw_date(null);
+ }
+
+ //check for alternate hold formats
+ var fstring = holdsSetSelectedFormats();
+ if(fstring) {
+ hold.hold_type('M');
+ hold.holdable_formats(fstring);
+ if (fstring)
+ holdArgs.holdable_formats = fstring;
+ hold.target(holdArgs.metarecord);
+ }
+ return hold;
+}
+
+function holdsPlaceHold(hold, recurse) {
+ if(!hold) return;
+ swapCanvas($('check_holds_box'));
+ holdsCheckPossibility(hold.pickup_lib(), hold, recurse);
+}
+
+
+function holdHandleCreateResponse(r, recurse) {
+
+ if(!recurse) {
+ var res = r.getResultObject();
+ if(checkILSEvent(res) || res.success != 1) {
+ if(res.success != 1) {
+
+ if(!holdArgs.partsSuggestionMade && holdArgs.recordParts &&
+ holdArgs.recordParts.length && holdArgs.type == 'T') {
+ // T holds on records that have parts are OK, but if the record has no non-part
+ // copies, the hold will ultimately fail. Suggest selecting a part to the user.
+ addCSSClass($('holds_parts_selector'), 'parts-warning');
+ holdArgs.partsSuggestionMade = true;
+ alert($('hold_has_parts').innerHTML);
+ } else {
+ alert($('hold_not_allowed').innerHTML);
+ }
+ } else {
+ if( res.textcode == 'PATRON_BARRED' ) {
+ alertId('hold_failed_patron_barred');
+ } else {
+ alert($('hold_not_allowed').innerHTML);
+ }
+ }
+ swapCanvas($('holds_box'));
+ return;
+ }
+ r._hold.selection_depth(res.depth);
+ }
+
+ holdCreateHold(r._recurse, r._hold);
+}
+
+
+function holdCreateHold( recurse, hold ) {
+ var method = CREATE_HOLD;
+ if(recurse) method = CREATE_HOLD_OVERRIDE;
+ var req = new Request( method, holdArgs.requestor.session, hold );
+ req.request.alertEvent = false;
+ req.send(true);
+ var res = req.result();
+ holdProcessResult(hold, res, recurse);
+
+ showCanvas();
+
+ runEvt('common', 'holdUpdated');
+}
+
+
+function holdProcessResult( hold, res, recurse ) {
+
+ if( res && res > -1 ) {
+ alert($('holds_success').innerHTML);
+ holdArgs = null;
+ if(isXUL() && typeof xulG.opac_hold_placed == 'function')
+ xulG.opac_hold_placed(res);
+
+ } else {
+
+ if( recurse ) {
+ alert($('holds_failure').innerHTML);
+ return;
+ }
+
+ if( grep(res, function(e) { return (e.textcode == 'HOLD_EXISTS'); }) ) {
+ if( fetchPermOrgs('HOLD_EXISTS.override')[0] != -1 ) {
+ if( confirm($('hold_dup_exists_override').innerHTML) ) {
+ return holdsPlaceHold(hold, true);
+ }
+ return;
+
+ } else {
+ return alert($('hold_dup_exists').innerHTML);
+ }
+ }
+
+ if( grep(res, function(e) { return (e.textcode == 'HOLD_ITEM_CHECKED_OUT'); }) ) {
+ if( fetchPermOrgs('HOLD_ITEM_CHECKED_OUT.override')[0] != -1 ) {
+ if( confirm($('hold_checked_out_override').innerHTML) ) {
+ return holdsPlaceHold(hold, true);
+ }
+ return;
+
+ } else {
+ return alert($('hold_checked_out').innerHTML);
+ }
+ }
+
+
+ alert($('holds_failure').innerHTML);
+ }
+}
+
+
+function holdsCancel(holdid, user) {
+ if(!user) user = G.user;
+ var req = new Request(CANCEL_HOLD, user.session, holdid, /* Patron via OPAC */ 6);
+ req.send(true);
+ return req.result();
+ runEvt('common', 'holdUpdated');
+}
+
+function holdsUpdate(hold, user) {
+ if(!user) user = G.user;
+ var req = new Request(UPDATE_HOLD, user.session, hold);
+ req.send(true);
+ var x = req.result(); // cause an exception if there is one
+ runEvt('common', 'holdUpdated');
+}
+
+/* verify that the thaw date is valid and after today */
+function holdsVerifyThawDate(dateString, isGreater) {
+ thawDate = dojo.date.stamp.fromISOString(dateString);
+ if(thawDate) {
+ if(isGreater) {
+ if(dojo.date.compare(thawDate) > 0) {
+ return dojo.date.stamp.toISOString(thawDate);
+ }
+ } else {
+ return dojo.date.stamp.toISOString(thawDate);
+ }
+ }
+ return null;
+}
+
+function holdsVerifyThawDateUI(element) {
+ value = dojo.date.stamp.toISOString(dijit.byId(element).getValue());
+
+ if(!value) {
+ removeCSSClass($(element), 'invalid_field');
+ return;
+ }
+
+ if(!holdsVerifyThawDate(value, true)) {
+ addCSSClass($(element), 'invalid_field');
+ } else {
+ removeCSSClass($(element), 'invalid_field');
+ }
+}
+
--- /dev/null
+//var records = {};
+var records = [];
+var ranks = [];
+var onlyrecord = {};
+var table;
+var mresultPreCache = 200;
+var searchTimer;
+var resultFacetKey;
+
+attachEvt("common", "unload", mresultUnload);
+attachEvt("common", "run", mresultDoSearch);
+attachEvt("result", "idsReceived", mresultSetRecords);
+attachEvt("result", "idsReceived", mresultCollectRecords);
+
+function mresultUnload() { removeChildren(table); table = null;}
+
+hideMe($('copyright_block'));
+
+function mresultDoSearch() {
+
+
+ TFORM = null; /* clear the rresult tform var so it's not propogated */
+
+ swapCanvas($('loading_alt'));
+ table = G.ui.result.main_table;
+
+ var holdTarget = new CGI().param('hold_target');
+ if(holdTarget != null) {
+ mresultHandlePlaceHold(holdTarget);
+ return;
+ }
+
+
+ while( table.parentNode.rows.length <= (getDisplayCount() + 1) )
+ table.appendChild(G.ui.result.row_template.cloneNode(true));
+
+ if( (getSearches() || getAdvTerm()) && !getTerm() ) {
+ if(getAdvType() == ADVTYPE_MULTI ) mresultCollectAdvIds();
+
+ } else {
+ _mresultCollectIds();
+ ADVTERM = "";
+ ADVTYPE = "";
+ }
+}
+
+function _mresultCollectIds() {
+ resultCollectSearchIds(true, SEARCH_MRS_QUERY, mresultHandleMRIds );
+}
+
+function mresultCollectAdvIds() {
+ resultCollectSearchIds(false, SEARCH_MRS_QUERY, mresultHandleMRIds );
+}
+
+function mresultHandleMRIds(r) {
+ var res = r.getResultObject();
+ resultFacetKey = res.facet_key;
+ resultCompiledSearch = res.compiled_search;
+ dojo.require('dojo.cookie');
+ dojo.cookie(COOKIE_SEARCH, js2JSON(res.compiled_search));
+ if(res.count != null) {
+ if( getOffset() == 0 ) HITCOUNT = res.count;
+ runEvt('result', 'hitCountReceived');
+ }
+ runEvt('result', 'idsReceived', res.ids);
+}
+
+
+
+function mresultSetRecords(idstruct) {
+ if(!idstruct) return;
+ var o = getOffset();
+ for( var x = o; x < idstruct.length + o; x++ ) {
+ if( idstruct[x-o] != null ) {
+ var r = parseInt(idstruct[x - o][0]);
+ var ra = parseFloat(idstruct[x - o][1]);
+ var or = parseInt(idstruct[x - o][2]);
+ if(!isNull(r) && !isNaN(r)) records[x] = r;
+ if(!isNull(ra) && !isNaN(ra)) ranks[x] = ra;
+ if(!isNull(or) && !isNaN(or)) onlyrecord[x] = or;
+ }
+ }
+
+ TOPRANK = ranks[getOffset()];
+}
+
+
+
+var recsReceivedCalled = false;
+function mresultCollectRecords() {
+ if(getHitCount() > 0 ) runEvt("result", "preCollectRecords");
+ var i = 0;
+ for( var x = getOffset(); x!= getDisplayCount() + getOffset(); x++ ) {
+ if(isNull(records[x])) break;
+ if(isNaN(records[x])) continue;
+ var req = new Request(FETCH_MRMODS, records[x]);
+
+ req.request.userdata = i++;
+
+ /* wait at most 10 seconds for the mods rec to come back */
+ /* this needs more testing */
+ req.request.timeout(10);
+ req.request.abortCallback(
+ function(){
+ recordsHandled++;
+ if(resultPageIsDone() && !recsReceivedCalled) {
+ recsReceivedCalled = true;
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ unHideMe($('copyright_block'));
+ }
+ }
+ );
+
+ req.callback(mresultHandleMods);
+ req.send();
+ }
+}
+
+function mresultHandleMods(r) {
+ var rec = r.getResultObject();
+ var pagePosition = r.userdata;
+ runEvt('result', 'recordReceived', rec, pagePosition, true);
+ if(rec) resultCollectCopyCounts(rec, pagePosition, FETCH_MR_COPY_COUNTS);
+ if(resultPageIsDone()) {
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ unHideMe($('copyright_block')); /* *** */
+ }
+}
+
+
+function mresultHandlePlaceHold(target) {
+ function reload() {
+ location.href = location.href.replace(/&hold_target=\d+/, '');
+ }
+ attachEvt("common", "holdUpdated", reload);
+ attachEvt("common", "holdUpdateCanceled", reload);
+ attachEvt("common", "loginCanceled", reload);
+ holdsDrawEditor({record:target, type: 'M'});
+}
+
+
--- /dev/null
+
+attachEvt("common", "run", myOPACInit );
+//attachEvt("common", "loggedIn", myOPACInit );
+attachEvt('common','locationUpdated', myopacReload );
+
+dojo.requireLocalization("openils.opac", "opac");
+
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+var fleshedUser = null;
+var fleshedContainers = {};
+var holdCache = {};
+var holdStatusCache = {};
+var showHoldQueuePosition = false;
+var allowPendingAddr = false;
+var myopacEnableRefWorks = false;
+var myopacRefWorksHost = 'http://www.refworks.com';
+
+function clearNodes( node, keepArray ) {
+ if(!node) return;
+ for( var n in keepArray ) node.removeChild(keepArray[n]);
+ removeChildren(node);
+ for( var n in keepArray ) node.appendChild(keepArray[n]);
+}
+
+function myOPACInit() {
+
+ fieldmapper.IDL.load(['mous']);
+
+ var orgHiding = checkOrgHiding();
+ if (orgHiding) {
+ hideMe($('prefs_def_location_row'));
+ hideMe($('prefs_def_range_row'));
+ }
+
+ if(!(G.user && G.user.session)) {
+ initLogin();
+
+ } else {
+
+ allowPendingAddr = fetchOrgSettingDefault(G.user.home_ou(), 'opac.allow_pending_address');
+ if(allowPendingAddr)
+ unHideMe($('myopac_pending_addr_td'));
+ myOPACChangePage( "summary" );
+ }
+
+ $('myopac_holds_thaw_date_input').onkeyup =
+ function(){holdsVerifyThawDateUI('myopac_holds_thaw_date_input'); }
+ $('myopac_holds_thaw_date_input').onchange =
+ function(){holdsVerifyThawDateUI('myopac_holds_thaw_date_input'); }
+
+}
+
+function myopacReload() {
+ //swapCanvas($('myopac_reloading'));
+ var a = {};
+ a[PARAM_LOCATION] = getNewSearchLocation();
+ a[PARAM_DEPTH] = getNewSearchDepth();
+ hideMe($('canvas_main'));
+ goTo(buildOPACLink(a, true));
+}
+
+
+function myOPACChangePage( page ) {
+ showCanvas();
+
+ var s = $("myopac_summary_td");
+ var c = $("myopac_checked_td");
+ var f = $("myopac_fines_td");
+ var h = $("myopac_holds_td");
+ var p = $("myopac_prefs_td");
+ var b = $('myopac_bookbag_td');
+
+ var ss = $("myopac_summary_div");
+ var cc = $("myopac_checked_div");
+ var ff = $("myopac_fines_div");
+ var hh = $("myopac_holds_div");
+ var pp = $("myopac_prefs_div");
+ var bb = $('myopac_bookbag_div');
+
+ var cls = "myopac_link";
+ var acls = "myopac_link_active";
+
+ hideMe(ss);
+ hideMe(cc); hideMe(ff);
+ hideMe(hh); hideMe(pp);
+ hideMe(bb);
+
+ removeCSSClass(s, acls );
+ removeCSSClass(c, acls );
+ removeCSSClass(f, acls );
+ removeCSSClass(h, acls );
+ removeCSSClass(p, acls );
+ removeCSSClass(b, acls );
+
+ switch( page ) {
+
+ case "summary":
+ unHideMe(ss);
+ addCSSClass(s, acls );
+ myOPACShowSummary();
+ break;
+
+ case "checked":
+ unHideMe(cc);
+ addCSSClass(c, acls );
+ myOPACShowChecked();
+ break;
+
+ case "holds":
+ unHideMe(hh);
+ addCSSClass(h, acls );
+ myOPACShowHolds();
+ break;
+
+ case "fines":
+ unHideMe(ff);
+ addCSSClass(f, acls );
+ myOPACShowFines();
+ break;
+
+ case "prefs":
+ unHideMe(pp);
+ addCSSClass(p, acls );
+ myOPACShowPrefs();
+ break;
+
+ case 'bookbag':
+ unHideMe(bb);
+ addCSSClass(b, acls);
+ myOPACShowBookbags();
+ break;
+ }
+}
+
+function myOPACShowChecked() {
+ if(checkedDrawn) return;
+ var req = new Request(FETCH_CHECKED_OUT_SUM, G.user.session, G.user.id());
+ req.callback(myOPACDrawCheckedOutSlim);
+ req.send();
+
+ var nreq = new Request(FETCH_NON_CAT_CIRCS, G.user.session);
+ nreq.callback(myOPACDrawNonCatCircs);
+ nreq.send();
+}
+
+
+var checkedRowTemplate;
+var circsCache = new Array();
+var checkedDrawn = false;
+
+function moClearCheckedTable() {
+ var tbody = $("myopac_checked_tbody");
+ var loading = $("myopac_checked_loading");
+ var none = $("myopac_checked_none");
+ clearNodes( tbody, [ loading, none ] );
+}
+
+var __can_renew_one = false;
+
+function myOPACDrawCheckedOutSlim(r) {
+
+ var checked = r.getResultObject();
+ var tbody = $("myopac_checked_tbody");
+ var loading = $("myopac_checked_loading");
+ var none = $("myopac_checked_none");
+
+ __can_renew_one = false;
+
+ if(checkedDrawn) return;
+ checkedDrawn = true;
+ if(!checkedRowTemplate)
+ checkedRowTemplate = tbody.removeChild($("myopac_checked_row"));
+
+ moClearCheckedTable();
+
+ hideMe(loading); /* remove all children and start over */
+ if(!(checked && (checked.out || checked.overdue))) {
+ unHideMe(none);
+ return;
+ }
+
+ var totalAsync = checked.overdue.length + checked.out.length;
+ var fetchedCircs = [];
+ var collectCircs = function(r) {
+ var circ = r.getResultObject();
+ circ._od = r.od;
+ fetchedCircs.push(circ);
+ if(fetchedCircs.length < totalAsync) return;
+
+ // sort by due date, oldest to newest
+ fetchedCircs = fetchedCircs.sort(
+ function(a, b) {
+ if(a.due_date() > b.due_date()) return 1;
+ return -1;
+ }
+ )
+
+ dojo.forEach(fetchedCircs,
+ function(circ) {
+ myOPACDrawCheckedItem(circ, tbody);
+ }
+ );
+ }
+
+ for( var i = 0; i < checked.overdue.length; i++ ) {
+ var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.overdue[i]);
+ //req.request.tbody = tbody;
+ req.request.od = true;
+ req.callback(collectCircs);
+ req.send();
+ }
+
+
+ for( var i = 0; i < checked.out.length; i++ ) {
+ var req = new Request(FETCH_CIRC_BY_ID, G.user.session, checked.out[i]);
+ //req.request.tbody = tbody;
+ req.callback(collectCircs);
+ req.send();
+ }
+
+ appendClear($('mo_items_out_count'),
+ text(new String( parseInt(checked.overdue.length) + parseInt(checked.out.length) )) );
+
+ if( checked.overdue.length > 0 ) {
+ addCSSClass($('mo_items_overdue_count'), 'overdue');
+ appendClear($('mo_items_overdue_count'),
+ text(new String( parseInt(checked.overdue.length) )) );
+ }
+
+}
+
+
+//function myOPACDrawCheckedItem(r) {
+function myOPACDrawCheckedItem(circ, tbody) {
+
+ //var circ = r.getResultObject();
+ //var tbody = r.tbody;
+ var row = checkedRowTemplate.cloneNode(true);
+ row.id = 'myopac_checked_row_ ' + circ.id();
+ row.setAttribute('circid', circ.id());
+
+ var due = _trimTime(circ.due_date());
+
+ var dlink = $n( row, "myopac_checked_due" );
+ var rlink = $n( row, "myopac_checked_renewals" );
+ //var rnlink = $n( row, "myopac_checked_renew_link" );
+
+ //if( r.od ) due = elem('b', {style:'color:red;font-size:110%'},due);
+ if( circ._od ) {
+ due = elem('b', null, due);
+ addCSSClass(due, 'overdue');
+ } else {
+ due = text(due);
+ }
+
+ dlink.appendChild(due);
+ rlink.appendChild(text(circ.renewal_remaining()));
+ unHideMe(row);
+ //rnlink.setAttribute('href', 'javascript:myOPACRenewCirc("'+circ.id()+'");');
+ circsCache.push(circ);
+
+ if( circ.renewal_remaining() < 1 ) {
+ $n(row, 'selectme').disabled = true;
+ if(!__can_renew_one)
+ $('mo_renew_button').disabled = true;
+ } else {
+ __can_renew_one = true;
+ $('mo_renew_button').disabled = false;
+ $n(row, 'selectme').disabled = false;
+ }
+
+ tbody.appendChild(row);
+
+ var req = new Request(FETCH_MODS_FROM_COPY, circ.target_copy() );
+ req.request.alertEvent = false;
+ req.request.circ = circ.id();
+ req.request.copy = circ.target_copy();
+ req.callback(myOPACDrawCheckedTitle);
+ req.send();
+}
+
+var __circ_titles = {};
+
+function myOPACDrawCheckedTitle(r) {
+ var record = r.getResultObject();
+ var circid = r.circ;
+
+ /* Draw pre-cataloged items */
+ if(!record || checkILSEvent(record) || !(record.title() || record.author())) {
+ var req = new Request( FETCH_COPY, r.copy );
+ req.request.circ = circid;
+ req.callback(myOPACDrawPreCatalogedItem);
+ req.send();
+ return;
+ }
+
+ var row = $('myopac_checked_row_ ' + circid);
+ var tlink = $n( row, "myopac_checked_title_link" );
+ var alink = $n( row, "myopac_checked_author_link" );
+
+ buildTitleDetailLink(record, tlink);
+ buildSearchLink(STYPE_AUTHOR, record.author(), alink);
+ __circ_titles[circid] = record.title();
+}
+
+function myOPACDrawPreCatalogedItem(r) {
+ var copy = r.getResultObject();
+ var circid = r.circ;
+
+ var row = $('myopac_checked_row_ ' + circid);
+ var tlink = $n( row, "myopac_checked_title_link" );
+ var alink = $n( row, "myopac_checked_author_link" );
+
+ tlink.parentNode.appendChild(text(copy.dummy_title()));
+ alink.parentNode.appendChild(text(copy.dummy_author()));
+ __circ_titles[circid] = copy.dummy_title();
+}
+
+
+/*
+function myOPACRenewCirc(circid) {
+
+ var circ;
+ for( var i = 0; i != circsCache.length; i++ )
+ if(circsCache[i].id() == circid)
+ circ = circsCache[i];
+
+ if(!confirm($('myopac_renew_confirm').innerHTML)) return;
+
+ var req = new Request(RENEW_CIRC, G.user.session,
+ { patron : G.user.id(), copyid : circ.target_copy(), opac_renewal : 1 } );
+ req.request.alertEvent = false;
+ req.send(true);
+ var res = req.result();
+
+ if(checkILSEvent(res) || checkILSEvent(res[0])) {
+ alertId('myopac_renew_fail');
+ return;
+ }
+
+ alert($('myopac_renew_success').innerHTML);
+ checkedDrawn = false;
+ myOPACShowChecked();
+}
+*/
+
+
+
+function myOPACShowHolds() {
+ var req = new Request(FETCH_HOLDS, G.user.session, G.user.id());
+ req.callback(myOPACDrawHolds);
+ req.send();
+ $('myopac_holds_actions_none').selected = true;
+}
+
+var holdsTemplateRowOrig;
+var holdsTemplateRow;
+var myopacForceHoldsRedraw = false;
+function myOPACDrawHolds(r) {
+
+ var tbody = $("myopac_holds_tbody");
+ if(holdsTemplateRow && !myopacForceHoldsRedraw) return;
+ myopacForceHoldsRedraw = false;
+
+ if(holdsTemplateRowOrig) {
+ holdsTemplateRow = holdsTemplateRowOrig;
+ removeChildren(tbody);
+ } else {
+ holdsTemplateRow = tbody.removeChild($("myopac_holds_row"));
+ holdsTemplateRowOrig = holdsTemplateRow;
+ }
+
+ hideMe($('myopac_holds_loading'));
+
+ var holds = r.getResultObject();
+
+ if(!holds || holds.length < 1) unHideMe($('myopac_holds_none'));
+ for( var i = 0; i != holds.length; i++ ) {
+
+ var h = holds[i];
+ holdCache[h.id()] = h;
+
+ var row = holdsTemplateRow.cloneNode(true);
+ row.id = "myopac_holds_row_" + h.id();
+
+ var form = $n(row, "myopac_holds_formats");
+ form.id = "myopac_holds_form_" + h.id();
+
+ var orglink = $n(row, "myopac_holds_location");
+ orglink.appendChild(text(findOrgUnit(h.pickup_lib()).name()));
+
+ tbody.appendChild(row);
+
+ $n(row,'myopac_holds_edit_link').setAttribute(
+ 'href','javascript:myOPACEditHold("'+ h.id()+'");');
+
+ if(isTrue(h.frozen())) {
+ hideMe($n(row, 'myopac_hold_unfrozen_true'))
+ unHideMe($n(row, 'myopac_hold_unfrozen_false'))
+ if(h.thaw_date()) {
+ var d = dojo.date.stamp.fromISOString(h.thaw_date());
+ $n(row, 'myopac_holds_frozen_until').appendChild(text(dojo.date.locale.format(d, {selector: 'date', fullYear: true})));
+ }
+ } else {
+ unHideMe($n(row, 'myopac_hold_unfrozen_true'))
+ hideMe($n(row, 'myopac_hold_unfrozen_false'))
+ }
+
+ $n(row, 'myopac_holds_selected_chkbx').checked = false;
+
+ var exp_date;
+ if(h.expire_time()) {
+ exp_date = dojo.date.stamp.fromISOString(h.expire_time().replace(/(T\d\d:\d\d:\d\d)([+-]\d\d)(\d)/, "$1$2:$3"));
+ $n(row, 'myopac_hold_expire_time').appendChild(
+ text(dojo.date.locale.format(exp_date, {selector:'date'})));
+ }
+
+ unHideMe(row);
+
+ var interval = fetchOrgSettingDefault(G.user.home_ou(), 'circ.hold_expire_alert_interval');
+ if(interval && exp_date) {
+ secs = interval_to_seconds(interval) * 1000;
+ var diff = exp_date.getTime() - new Date().getTime();
+ if(diff < secs)
+ addCSSClass($n(row, 'myopac_hold_expire_time'), 'hold_expire_warning');
+ }
+
+ myOPACDrawHoldTitle(h);
+ myOPACDrawHoldStatus(h);
+ }
+}
+
+function myOPACEditHold(holdid) {
+ var hold = holdCache[holdid];
+
+ holdsDrawEditor(
+ {
+ editHold : hold,
+ onComplete : function(){
+ holdsTemplateRow = null;
+ myOPACShowHolds();
+ }
+ }
+ );
+}
+
+
+function myOPACDrawHoldStatus(hold) {
+ var req = new Request(FETCH_HOLD_STATUS, G.user.session, hold.id() );
+ req.callback(myOShowHoldStatus);
+ req.request.hold = hold;
+ req.send();
+}
+
+var myopacShowHoldEstimate = false;
+function myOShowHoldStatus(r) {
+
+ var hold = r.hold;
+ var qstats = r.getResultObject();
+ holdStatusCache[hold.id()] = qstats;
+
+ var row = $("myopac_holds_row_" + r.hold.id());
+
+ if(qstats.estimated_wait || myopacShowHoldEstimate) {
+ myopacShowHoldEstimate = true;
+ if(qstats.estimated_wait) {
+ // wait is currently returned in seconds, but displayed in days
+ var wait = Math.ceil(qstats.estimated_wait / 86400);
+ $n(row, 'myopac_holds_estimated_wait').appendChild(text(wait));
+ }
+ unHideMe($('myopac_holds_estimated_wait_column'));
+ unHideMe($n(row, 'myopac_holds_estimated_wait'));
+ }
+
+ if( qstats.status == 4 ) {
+ unHideMe($n(row, 'hold_status_available'));
+ hideMe($n(row, 'myopac_holds_cancel_link'));
+ }
+
+ if (showHoldQueuePosition) {
+ var node = $n(row, 'hold_qstats');
+ if (qstats.potential_copies == 1) {
+ node.appendChild(text(dojo.string.substitute(opac_strings.HOLD_STATUS_SINGULAR, [qstats.queue_position, qstats.total_holds, qstats.potential_copies])));
+ } else {
+ node.appendChild(text(dojo.string.substitute(opac_strings.HOLD_STATUS_PLURAL, [qstats.queue_position, qstats.total_holds, qstats.potential_copies])));
+ }
+ unHideMe(node);
+
+ } else {
+ if( qstats.status < 3 )
+ unHideMe($n(row, 'hold_status_waiting'));
+
+ if( qstats.status == 3 )
+ unHideMe($n(row, 'hold_status_transit'));
+ }
+}
+
+
+function myOPACDrawHoldTitle(hold) {
+ var method;
+
+ if( hold.hold_type() == 'T' || hold.hold_type() == 'M') {
+ if(hold.hold_type() == "M") method = FETCH_MRMODS;
+ if(hold.hold_type() == "T") method = FETCH_RMODS;
+ var req = new Request(method, hold.target());
+ req.callback(myOPACFleshHoldTitle);
+ req.request.hold = hold;
+ req.request.alertEvent = false;
+ req.send();
+
+ } else {
+ holdFetchObjects(hold,
+ function(a) { _myOPACFleshHoldTitle(hold, a);});
+ }
+}
+
+function myOPACFleshHoldTitle(r) {
+ var rec = r.getResultObject();
+ _myOPACFleshHoldTitle(r.hold, {recordObject: rec});
+}
+
+function _myOPACFleshHoldTitle(hold, holdObjects) {
+
+ var record = holdObjects.recordObject;
+ var volume = holdObjects.volumeObject;
+ var copy = holdObjects.copyObject;
+
+ var row = $("myopac_holds_row_" + hold.id());
+ var title_link = $n(row, "myopac_holds_title_link");
+ var author_link = $n(row, "myopac_holds_author_link");
+
+ if(!record || checkILSEvent(record) ) {
+ addCSSClass(row, 'invalid_hold');
+ $n(row, 'myopac_holds_edit_link').setAttribute('href', 'javascript:void(0);');
+ $n(row, 'myopac_holds_edit_link').onclick = function(){alertId('invalid_hold');};
+ return;
+ }
+
+ buildTitleDetailLink(record, title_link);
+ buildSearchLink(STYPE_AUTHOR, record.author(), author_link);
+
+ if(hold.hold_type() == 'P') {
+ unHideMe($n(row, 'vol_copy'));
+ $n(row, 'part').appendChild(text(holdObjects.partObject.label));
+ }
+
+ if( volume ) {
+ $n(row, 'volume').appendChild(text(volume.label()));
+ unHideMe($n(row, 'vol_copy'));
+ if(copy) $n(row, 'copy').appendChild(text(copy.barcode()));
+ }
+
+ var form = $("myopac_holds_form_" + hold.id());
+
+ if(form) {
+ var mods_formats = record.types_of_resource();
+
+ if( hold.hold_type() == 'M' ) {
+ var data = holdsParseMRFormats(hold.holdable_formats());
+ mods_formats = data.mods_formats;
+ }
+
+ for( var i = 0; i < mods_formats.length; i++ ) {
+ var img = elem("img");
+ setResourcePic(img, mods_formats[i]);
+ form.appendChild(img);
+ }
+ }
+}
+
+var finesShown = false;
+function myOPACShowFines() {
+ if(finesShown) return; finesShown = true;
+ var req = new Request(FETCH_FINES_SUMMARY, G.user.session, G.user.id() );
+ req.callback(_myOPACShowFines);
+ req.send();
+}
+
+function _myOPACShowFines(r) {
+ hideMe($('myopac_fines_summary_loading'));
+ unHideMe($('myopac_fines_summary_row'));
+
+ var summary = r.getResultObject();
+ var total = "0.00"; /* localization? */
+ var paid = "0.00";
+ var balance = "0.00";
+ if( instanceOf(summary,mous) ) {
+
+ total = _finesFormatNumber(summary.total_owed());
+ paid = _finesFormatNumber(summary.total_paid());
+ balance = _finesFormatNumber(summary.balance_owed());
+
+ var req = new Request(FETCH_TRANSACTIONS, G.user.session, G.user.id() );
+ req.callback(myOPACShowTransactions);
+ req.send();
+ }
+
+ $('myopac_fines_summary_total').appendChild(text(total));
+ $('myopac_fines_summary_paid').appendChild(text(paid));
+ $('myopac_fines_summary_balance').appendChild(text(balance));
+}
+
+function _finesFormatNumber(num) {
+ if(isNull(num)) num = 0;
+ num = num + "";
+ if(num.length < 2 || !num.match(/\./)) num += ".00";
+ if(num.match(/\./) && num.charAt(num.length-2) == '.') num += "0";
+ return num;
+}
+
+//function _trimTime(time) { if(!time) return ""; return time.replace(/\ .*/,""); }
+function _trimTime(time) {
+ if(!time) return "";
+ time = time.replace(/(T\d\d:\d\d:\d\d)([+-]\d\d)(\d)/, "$1$2:$3");
+ var d = dojo.date.stamp.fromISOString(time);
+ if(!d) return ""; /* date parse failed */
+ return dojo.date.locale.format(d, {"formatLength": "medium"});
+}
+
+function _trimSeconds(time) {
+ if(!time) return "";
+ var d = dojo.date.stamp.fromISOString(time.replace(/(T\d\d:\d\d:\d\d)([+-]\d\d)(\d)/, "$1$2:$3"));
+ if(!d) return ""; /* date parse failed */
+ return dojo.date.locale.format(d, { "timePattern" : "h:ma", "formatLength" : "medium" });
+}
+
+function myOPACShowTransactions(r) {
+
+ if(myopacGenericTransTemplate || myopacCircTransTemplate) return;
+
+ var transactions = r.getResultObject();
+
+ for( var idx in transactions ) {
+
+ var trans = transactions[idx].transaction;
+ var record = transactions[idx].record;
+ var circ = transactions[idx].circ;
+
+ if(trans.xact_type() == 'circulation')
+ myOPACShowCircTransaction(trans, record, circ);
+
+ else if(trans.xact_type() == 'grocery' )
+ myopacShowGenericTransaction( trans );
+
+/* XXX need to copy circulation output function here
+ else if(trans.xact_type() == 'reservation' )
+ myopacShowReservationTransaction( trans );
+*/
+
+ }
+}
+
+var myopacGenericTransTemplate;
+function myopacShowGenericTransaction( trans ) {
+ var tbody = $('myopac_trans_tbody');
+
+ if(!myopacGenericTransTemplate) {
+ myopacGenericTransTemplate =
+ tbody.removeChild($('myopac_trans_row'));
+ removeChildren(tbody);
+ }
+
+ var row = myopacGenericTransTemplate.cloneNode(true);
+
+ $n(row,'myopac_trans_start').appendChild(
+ text(_trimSeconds(trans.xact_start())));
+
+ $n(row,'myopac_trans_last_payment').appendChild(
+ text(_trimSeconds(trans.last_payment_ts())));
+
+ $n(row,'myopac_trans_init_amount').appendChild(
+ text(_finesFormatNumber(trans.total_owed())));
+
+ $n(row,'myopac_trans_total_paid').appendChild(
+ text(_finesFormatNumber(trans.total_paid())));
+
+ $n(row,'myopac_trans_balance').appendChild(
+ text(_finesFormatNumber(trans.balance_owed())));
+
+ var req = new Request(FETCH_MONEY_BILLING, G.user.session, trans.id());
+ req.send(true);
+ var bills = req.result();
+ if(bills && bills[0])
+ $n(row,'myopac_trans_bill_type').appendChild(
+ text(bills[0].billing_type()));
+
+ tbody.appendChild(row);
+ unHideMe($('myopac_trans_div'));
+}
+
+
+
+/* draws a circulation transaction summary */
+var myopacCircTransTemplate;
+function myOPACShowCircTransaction(trans, record, circ) {
+ var tbody = $('myopac_circ_trans_tbody');
+
+ if(!myopacCircTransTemplate) {
+ myopacCircTransTemplate = tbody.removeChild($('myopac_circ_trans_row'));
+ removeChildren(tbody);
+ }
+
+ var row = myopacCircTransTemplate.cloneNode(true);
+
+ if(record) {
+ buildTitleDetailLink(record, $n(row,'myopac_circ_trans_title'));
+
+ $n(row,'myopac_circ_trans_author').appendChild(text(
+ normalize(truncate(record.author(), 65))));
+
+ } else {
+
+ var req = new Request( FETCH_COPY, circ.target_copy() );
+ req.alertEvents = false;
+ req.send(true);
+ var copy = req.result();
+ if( copy ) {
+ $n(row,'myopac_circ_trans_title').appendChild(text(copy.dummy_title()));
+ $n(row,'myopac_circ_trans_author').appendChild(text(copy.dummy_author()));
+ }
+ }
+
+
+ $n(row,'myopac_circ_trans_start').
+ appendChild(text(_trimTime(trans.xact_start())));
+ var due = _trimTime(circ.due_date());
+ var checkin = _trimTime(circ.stop_fines_time());
+
+ $n(row,'myopac_circ_trans_due').appendChild(text(due))
+ if(checkin)
+ appendClear($n(row,'myopac_circ_trans_finished'), text(checkin));
+ if(circ.stop_fines() == 'LOST')
+ appendClear($n(row,'myopac_circ_trans_finished'), text(circ.stop_fines()));
+ if(circ.stop_fines() == 'CLAIMSRETURNED')
+ appendClear($n(row,'myopac_circ_trans_finished'), text(""));
+
+
+ $n(row,'myopac_circ_trans_balance').
+ appendChild(text(_finesFormatNumber(trans.balance_owed())));
+
+ tbody.appendChild(row);
+ unHideMe($('myopac_circ_trans_div'));
+}
+
+
+function myOPACSavePrefs() {
+ G.user.prefs[PREF_HITS_PER] = getSelectorVal($('prefs_hits_per'));
+ G.user.prefs[PREF_DEF_FONT] = getSelectorVal($('prefs_def_font'));
+ G.user.prefs[PREF_HOLD_NOTIFY] = getSelectorVal($('prefs_hold_notify'));
+ G.user.prefs[PREF_DEF_DEPTH] = getSelectorVal($('prefs_def_range'));
+
+ if( $('myopac_pref_home_lib').checked == true )
+ G.user.prefs[PREF_DEF_LOCATION] = null;
+ else
+ G.user.prefs[PREF_DEF_LOCATION] = getSelectorVal($('prefs_def_location'));
+
+ if(commitUserPrefs())
+ alert($('prefs_update_success').innerHTML);
+ else alert($('prefs_update_failure').innerHTML);
+}
+
+
+function myOPACShowDefFont() {
+ var font;
+ if(G.user.prefs[PREF_DEF_FONT])
+ font = G.user.prefs[PREF_DEF_FONT];
+ else font = "regular";
+ setSelector($('prefs_def_font'), font);
+}
+
+function myOPACShowHoldNotify() {
+ var pref = G.user.prefs[PREF_HOLD_NOTIFY];
+
+ if(pref) {
+ if(pref.match(/email/i) && pref.match(/phone/i)) {
+ setSelector($('prefs_hold_notify'), 'phone:email');
+ } else if( pref.match(/email/i) ) {
+ setSelector($('prefs_hold_notify'), 'email');
+ } else if( pref.match(/phone/i) ) {
+ setSelector($('prefs_hold_notify'), 'phone');
+ }
+
+ } else {
+ setSelector($('prefs_hold_notify'), 'phone:email');
+ }
+}
+
+function myOPACShowPrefs() {
+ grabUserPrefs();
+ myOPACShowHitsPer();
+ myOPACShowDefFont();
+ myOPACShowHoldNotify();
+ myOPACShowDefLocation();
+ hideMe($('myopac_prefs_loading'));
+}
+
+var defSearchLocationDrawn = false;
+var defDepthIndex = 0;
+function myOPACShowDefLocation() {
+
+ var selector = $('prefs_def_location');
+ var rsel = $('prefs_def_range');
+
+ if(!defSearchLocationDrawn) {
+
+ defSearchLocationDrawn = true;
+
+ var org = G.user.prefs[PREF_DEF_LOCATION];
+
+ if(!org) {
+ $('myopac_pref_home_lib').checked = true;
+ $('prefs_def_location').disabled = true;
+ org = G.user.home_ou();
+ }
+
+ buildOrgSel(selector, globalOrgTree, 0);
+
+ globalOrgTypes = globalOrgTypes.sort(
+ function(a, b) {
+ if( a.depth() < b.depth() ) return -1;
+ return 1;
+ }
+ );
+
+ iterate(globalOrgTypes,
+ function(t) {
+ if( t.depth() <= findOrgDepth(org) ) {
+ setSelectorVal(rsel, defDepthIndex++, t.opac_label(), t.depth());
+ if( t.depth() == findOrgDepth(org) )
+ setSelector(rsel, t.depth());
+ }
+ }
+ );
+ }
+
+ setSelector(selector, org);
+}
+
+function myOPACShowHitsPer() {
+ var hits = 10;
+ if(G.user.prefs[PREF_HITS_PER])
+ hits = G.user.prefs[PREF_HITS_PER];
+ var hitsSel = $('prefs_hits_per');
+ setSelector(hitsSel, hits);
+}
+
+var userShown = false;
+function myOPACShowSummary() {
+ if(userShown) return; userShown = true;
+ var req = new Request(FETCH_FLESHED_USER,G.user.session, G.user.id());
+ req.callback(_myOPACSummaryShowUer);
+ req.send();
+}
+
+var addrRowTemplate;
+var notesTemplate;
+function _myOPACSummaryShowUer(r) {
+
+ var user = r.getResultObject();
+ fleshedUser = user;
+ if(!user) return;
+
+ var expireDate = dojo.date.stamp.fromISOString(user.expire_date());
+ if( expireDate < new Date() ) {
+ appendClear($('myopac.expired.date'), dojo.date.locale.format(expireDate, { "formatLength" : "medium", "selector" : "date" }));
+ unHideMe($('myopac.expired.alert'));
+ }
+
+ var iv1 = user.ident_value()+'';
+ if (iv1.length > 4 && iv1.match(/\d{4}/)) iv1 = iv1.substring(0,4) + '***********';
+
+
+ appendClear($('myopac_summary_prefix'),text(user.prefix()));
+ appendClear($('myopac_summary_first'),text(user.first_given_name()));
+ appendClear($('myopac_summary_middle'),text(user.second_given_name()));
+ appendClear($('myopac_summary_dayphone'),text(user.day_phone()));
+ appendClear($('myopac_summary_eveningphone'),text(user.evening_phone()));
+ appendClear($('myopac_summary_otherphone'),text(user.other_phone()));
+ appendClear($('myopac_summary_last'),text(user.family_name()));
+ appendClear($('myopac_summary_suffix'),text(user.suffix()));
+ appendClear($('myopac_summary_username'),text(user.usrname()));
+ appendClear($('myopac_summary_email'),text(user.email()));
+ appendClear($('myopac_summary_barcode'),text(user.card().barcode()));
+ appendClear($('myopac_summary_ident1'),text(iv1));
+ appendClear($('myopac_summary_homelib'),text(findOrgUnit(user.home_ou()).name()));
+ appendClear($('myopac_summary_create_date'),text(_trimTime(user.create_date())));
+
+ var req = new Request(
+ FETCH_USER_NOTES, G.user.session, {pub:1, patronid:G.user.id()});
+ req.callback(myopacDrawNotes);
+ req.send();
+
+
+ var tbody = $('myopac_addr_tbody');
+ var template;
+
+ if(addrRowTemplate) {
+ template = addrRowTemplate;
+ } else {
+ template = tbody.removeChild($('myopac_addr_row'));
+ addrRowTemplate = template;
+ }
+ removeChildren(tbody);
+
+ var addrs = user.addresses();
+ for( var a in addrs ) {
+ var addr = addrs[a];
+ if(!allowPendingAddr && isTrue(addr.pending()))
+ continue;
+ if(addr.replaces() != null) continue;
+ var row = template.cloneNode(true);
+ myOPACDrawAddr(row, addr, addrs);
+ tbody.appendChild(row);
+ }
+}
+
+
+function myopacDrawNotes(r) {
+ var notes = r.getResultObject();
+ var tbody = $('myopac.notes.tbody');
+ if(!notesTemplate)
+ notesTemplate = tbody.removeChild($('myopac.notes.tr'));
+ removeChildren(tbody);
+
+ iterate(notes,
+ function(note) {
+ unHideMe($('myopac.notes.div'));
+ var row = notesTemplate.cloneNode(true);
+ $n(row, 'title').appendChild(text(note.title()));
+ $n(row, 'value').appendChild(text(note.value()));
+ tbody.appendChild(row);
+ }
+ );
+}
+
+
+
+function myOPACDrawAddr(row, addr, addrs) {
+ appendClear($n(row, 'myopac_addr_type'),text(addr.address_type()));
+ appendClear($n(row, 'myopac_addr_street'),text(addr.street1()));
+ appendClear($n(row, 'myopac_addr_street2'),text(addr.street2()));
+ appendClear($n(row, 'myopac_addr_city'),text(addr.city()));
+ appendClear($n(row, 'myopac_addr_county'),text(addr.county()));
+ appendClear($n(row, 'myopac_addr_state'),text(addr.state()));
+ appendClear($n(row, 'myopac_addr_country'),text(addr.country()));
+ appendClear($n(row, 'myopac_addr_zip'),text(addr.post_code()));
+
+ if(!isTrue(addr.valid()))
+ unHideMe($n(row, 'myopac_invalid_addr_row'));
+
+ if(!allowPendingAddr) return;
+
+ $n(row, 'myopac_addr_edit_link').onclick = function(){myopacEditAddress(addr)};
+ unHideMe($n(row, 'myopac_addr_edit_td'));
+
+ /* if we have a replacement address, plop it into the table next to this addr */
+ var repl = grep(addrs,
+ function(a) {
+ return a.replaces() == addr.id();
+ }
+ );
+
+ $n(row, 'myopac_pending_addr_td').id = 'myopac_pending_addr_td_' + addr.id();
+
+ if(repl) {
+ hideMe($n(row, 'myopac_addr_edit_td')); // hide the edit link
+ repl = repl[0];
+ myopacSetAddrInputs(row, repl);
+ }
+}
+
+function myopacEditAddress(addr) {
+ var td = $('myopac_pending_addr_td_' + addr.id());
+ var row = td.parentNode;
+ myopacSetAddrInputs(row, addr);
+}
+
+function myopacSetAddrInputs(row, addr, prefix) {
+ unHideMe($n(row, 'myopac_pending_addr_td'));
+ $n(row, 'myopac_pending_addr_type').value = addr.address_type();
+ $n(row, 'myopac_pending_addr_street').value = addr.street1();
+ $n(row, 'myopac_pending_addr_street2').value = addr.street2();
+ $n(row, 'myopac_pending_addr_city').value = addr.city();
+ $n(row, 'myopac_pending_addr_county').value = addr.county();
+ $n(row, 'myopac_pending_addr_state').value = addr.state();
+ $n(row, 'myopac_pending_addr_country').value = addr.country();
+ $n(row, 'myopac_pending_addr_zip').value = addr.post_code();
+ $n(row, 'myopac_pending_addr_edit_link').onclick = function(){myopacSaveAddress(row, addr)};
+ $n(row, 'myopac_pending_addr_del_link').onclick = function(){myopacSaveAddress(row, addr, true)};
+}
+
+// if no pending addr exists, this is called with the original address
+function myopacSaveAddress(row, addr, deleteMe) {
+
+ if(addr.replaces() == null) {
+ // we are editing a non-pending address. create a pending address to manage that
+ var repl = new aua();
+ repl.usr(addr.usr());
+ repl.address_type(addr.address_type());
+ repl.within_city_limits(addr.within_city_limits());
+ repl.replaces(addr.id());
+ repl.pending('t');
+ repl.isnew(true);
+ repl.id(null);
+ addr = repl;
+ }
+
+ if(deleteMe) {
+ if(addr.id() == null) {
+ hideMe($n(row, 'myopac_pending_addr_td'));
+ return;
+ }
+ addr.isdeleted(true);
+ } else {
+ addr.address_type($n(row, 'myopac_pending_addr_type').value);
+ addr.street1($n(row, 'myopac_pending_addr_street').value);
+ addr.street2($n(row, 'myopac_pending_addr_street2').value);
+ addr.city($n(row, 'myopac_pending_addr_city').value);
+ addr.county($n(row, 'myopac_pending_addr_county').value);
+ addr.state($n(row, 'myopac_pending_addr_state').value);
+ addr.country($n(row, 'myopac_pending_addr_country').value);
+ addr.post_code($n(row, 'myopac_pending_addr_zip').value);
+ }
+
+ var req = new Request(
+ 'open-ils.actor:open-ils.actor.user.address.pending.cud',
+ G.user.session, addr);
+
+ req.callback(
+ function(r) {
+ var resp = r.getResultObject();
+
+ if(addr.isnew()) {
+ // new, add to list of addrs
+ addr.id(resp);
+ fleshedUser.addresses().push(addr);
+
+ } else {
+ // deleted, remove from list of addrs
+ if(addr.isdeleted()) {
+ hideMe($n(row, 'myopac_pending_addr_td'));
+ var addrs = [];
+ for(var i in fleshedUser.addresses()) {
+ var a = fleshedUser.addresses()[i];
+ if(a.id() != addr.id())
+ addrs.push(a);
+ }
+ fleshedUser.addresses(addrs);
+ }
+ }
+ alertId('myopac_addr_changes_saved');
+ }
+ );
+ req.send();
+};
+
+
+function myOPACUpdateUsername() {
+ var username = $('myopac_new_username').value;
+ var curpassword = $('myopac_username_current_password').value;
+ if(username == null || username == "") {
+ alert($('myopac_username_error').innerHTML);
+ return;
+ }
+
+ if( username.match(/.*\s.*/) ) {
+ alert($('myopac_invalid_username').innerHTML);
+ return;
+ }
+
+ r = fetchOrgSettingDefault(globalOrgTree.id(), 'opac.barcode_regex');
+ if(r) REGEX_BARCODE = new RegExp(r);
+
+ if(username.match(REGEX_BARCODE)) {
+ alert($('myopac_invalid_username').innerHTML);
+ return;
+ }
+
+ /* first see if the requested username is taken */
+ var req = new Request(CHECK_USERNAME, G.user.session, username);
+ req.send(true);
+ var res = req.result();
+ /* If the username does not already exist, res will be null;
+ * we can move on to updating the username.
+ *
+ * If the username does exist, then res will be the user ID.
+ * G.user.id() gives us the currently authenticated user ID.
+ * If res == G.user.id(), we try to update the username anyways.
+ */
+ if( res !== null && res != G.user.id() ) {
+ alertId('myopac_username_dup');
+ return;
+ }
+
+ var req = new Request(UPDATE_USERNAME, G.user.session, username, curpassword );
+ req.send(true);
+ if(req.result()) {
+
+ var evt;
+ var res = req.result();
+ if(evt = checkILSEvent(res)) {
+ alertILSEvent(res);
+ return;
+ }
+
+ G.user.usrname(username);
+ hideMe($('myopac_update_username_row'));
+ userShown = false;
+ alertId('myopac_username_success');
+ myOPACShowSummary();
+ return;
+ }
+
+ alert($('myopac_username_failure').innerHTML);
+}
+
+function myOPACUpdateEmail() {
+ var email = $('myopac_new_email').value;
+ var curpassword = $('myopac_email_current_password').value;
+ if(email == null || email == "") {
+ alert($('myopac_email_error').innerHTML);
+ return;
+ }
+
+ var req = new Request(UPDATE_EMAIL, G.user.session, email, curpassword );
+ req.send(true);
+ if(req.result()) {
+ G.user.email(email);
+ hideMe($('myopac_update_email_row'));
+ userShown = false;
+ alertId('myopac_email_success');
+ myOPACShowSummary();
+ return;
+ }
+
+ alert($('myopac_email_failure').innerHTML);
+}
+
+
+function myOPACUpdatePassword() {
+ var curpassword = $('myopac_current_password').value;
+ var password = $('myopac_new_password').value;
+ var password2 = $('myopac_new_password2').value;
+
+ if( curpassword == null || curpassword == "" ||
+ password == null || password == "" ||
+ password2 == null || password2 == "" || password != password2 ) {
+ alert($('myopac_password_error').innerHTML);
+ return;
+ }
+
+ if(!strongPassword(password, true)) return;
+
+ var req = new Request(UPDATE_PASSWORD, G.user.session, password, curpassword );
+ req.send(true);
+ if(req.result()) {
+ hideMe($('myopac_update_password_row'));
+ userShown = false;
+ alertId('myopac_password_success');
+ myOPACShowSummary();
+ return;
+ }
+
+ alert($('myopac_password_failure').innerHTML);
+}
+
+
+
+
+var containerTemplate;
+function myOPACShowBookbags(force) {
+
+ var tbody =$('myopac_bookbag_tbody') ;
+
+ if(!containerTemplate)
+ containerTemplate = tbody.removeChild($('myopac_bookbag_tr'));
+ else if(!force) return;
+
+ removeChildren(tbody);
+
+ var containers = containerFetchAll();
+
+ var found = false;
+ for( var i in containers ) {
+ found = true;
+ var cont = containers[i];
+ var row = containerTemplate.cloneNode(true);
+ row.id = 'myopac_bookbag_row_' + cont.id();
+ var link = $n(row, 'myopac_expand_bookbag');
+ var dlink = $n(row, 'myopac_container_delete');
+ link.appendChild( text(cont.name()) );
+ link.setAttribute('href',
+ 'javascript:myOPACExpandBookbag("' + cont.id() + '","' + cont.name() + '");');
+ myOPACFetchBBItems( cont.id(), row );
+ dlink.setAttribute('href', 'javascript:myOPACDeleteBookbag("'+cont.id()+'");');
+
+ if( isTrue(cont.pub()) ) {
+ unHideMe($n(row, 'myopac_bb_published_yes'));
+ var link = $n(row, 'myopac_bb_published_view');
+ link.setAttribute('href', buildExtrasLink( 'feed/bookbag/html-full/'+cont.id(), false));
+ link.setAttribute('target', '_blank' );
+ unHideMe(link);
+
+ link = $n(row, 'myopac_bb_published_atom');
+ link.setAttribute('href', buildExtrasLink( 'feed/bookbag/rss2-full/'+cont.id(), false));
+ link.setAttribute('target', '_blank' );
+ unHideMe(link);
+
+ link = $n(row, 'myopac_bb_make_unpublished');
+ link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'", true);');
+ unHideMe(link);
+
+ var RW = $n(row, 'myopac_bb_exp_refworks');
+ if (RW && myopacEnableRefWorks) {
+ var here = (findOrgUnit(getLocation())).name();
+ var org_name = here.replace(" ", "+");
+ var cgi = new CGI();
+
+ RW.setAttribute('href',
+ myopacRefWorksHost + '/express/expressimport.asp?vendor='
+ + org_name
+ + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
+ + cgi.server_name + '/opac/extras/feed/bookbag/marctxt-full/'
+ + cont.id()
+ );
+ RW.setAttribute('target', 'RefWorksMain');
+ unHideMe($n(row, 'myopac_bb_exp_refworks'));
+ }
+ } else {
+ unHideMe($n(row, 'myopac_bb_published_no'));
+ var link = $n(row, 'myopac_bb_make_published');
+ link.setAttribute('href', 'javascript:myOPACMakeBBPublished("'+cont.id()+'");');
+ unHideMe(link);
+ }
+
+ tbody.appendChild(row);
+ }
+
+ if(!found) unHideMe($('myopac_bookbags_none'));
+ else unHideMe($('myopac_bookbag_table'));
+}
+
+function myOPACMakeBBPublished(bbid, hideme) {
+
+ var bb = fleshedContainers[bbid];
+
+ if(hideme) {
+ if(!confirm($('myopac_make_unpublished_confirm').innerHTML)) return;
+ bb.pub('f');
+ } else {
+ if(!confirm($('myopac_make_published_confirm').innerHTML)) return;
+ bb.pub('t');
+ }
+
+ var result = containerUpdate(bb);
+
+ var code = checkILSEvent(result);
+ if(code) { alertILSEvent(result); return; }
+
+ alert($('myopac_bb_update_success').innerHTML);
+ myOPACShowBookbags(true);
+}
+
+
+
+function myOPACDeleteBookbag(id) {
+ if( confirm( $('myopac_delete_bookbag_warn').innerHTML ) ) {
+ var result = containerDelete(id);
+ var code = checkILSEvent(result);
+ if(code) { alertILSEvent(result); return; }
+ alert($('myopac_bb_update_success').innerHTML);
+ hideMe($('myopac_bookbag_items_table'));
+ hideMe($('myopac_bookbag_items_name'));
+ hideMe($('myopac_bookbag_no_items'));
+ myOPACShowBookbags(true);
+ }
+}
+
+function myOPACFetchBBItems( id, row, block ) {
+ if(!block) {
+ containerFlesh( id, _myOPACSetBBItems, { row: row } );
+ } else {
+ var cont = containerFlesh(id);
+ myOPACSetBBItems( cont, row );
+ }
+}
+
+function _myOPACSetBBItems(r) { myOPACSetBBItems( r.getResultObject(), r.args.row ); }
+
+function myOPACSetBBItems( container, row ) {
+ fleshedContainers[container.id()] = container;
+ var node = $n(row, 'myopac_bookbag_item_count');
+ removeChildren(node);
+ node.appendChild( text(container.items().length) );
+}
+
+var BBItemsRow;
+function myOPACExpandBookbag( id, name ) {
+
+ var tbody = $('myopac_bookbag_items_tbody');
+ if(!BBItemsRow) BBItemsRow = tbody.removeChild($('myopac_bookbag_items_row'));
+ removeChildren(tbody);
+ removeChildren($('myopac_bookbag_items_name'));
+
+ $('myopac_bookbag_items_name').appendChild(text(name));
+
+ if( fleshedContainers[id] ) {
+ var len = fleshedContainers[id].items().length;
+
+ if( len == 0 ) {
+ unHideMe($('myopac_bookbag_no_items'));
+ hideMe($('myopac_bookbag_items_table'));
+ return;
+ }
+
+ hideMe($('myopac_bookbag_no_items'));
+ unHideMe($('myopac_bookbag_items_table'));
+
+ for( var i = 0; i != len; i++ ) {
+ var row = BBItemsRow.cloneNode(true);
+ found = true;
+
+ var item = fleshedContainers[id].items()[i];
+ var tlink = $n(row,'myopac_bookbag_items_title');
+ var alink = $n(row,'myopac_bookbag_items_author');
+
+ var req = new Request( FETCH_RMODS, item.target_biblio_record_entry() );
+ req.request.tlink = tlink;
+ req.request.alink = alink;
+ req.callback(myOPACShowBBItem);
+ req.send();
+
+ var clink = $n(row, 'myopac_bookbag_items_remove');
+ clink.setAttribute('href', 'javascript:myOPACRemoveBBItem("'+item.id()+'","'+id+'","'+name+'");');
+
+ tbody.appendChild(row);
+ }
+ }
+}
+
+function myOPACRemoveBBItem( id, containerid, container_name ) {
+ if(!confirm($('myopac_remove_bb_item_confirm').innerHTML)) return;
+ var stat = containerRemoveItem( id );
+ if(stat) alert($('myopac_bb_update_success').innerHTML);
+ myOPACFetchBBItems( containerid, $('myopac_bookbag_row_' + containerid), true);
+ myOPACExpandBookbag( containerid, container_name );
+}
+
+function myOPACShowBBItem(r) {
+ var record = r.getResultObject();
+ buildTitleDetailLink(record, r.tlink);
+ buildSearchLink(STYPE_AUTHOR, record.author(), r.alink);
+}
+
+function myOPACCreateBookbag() {
+ var name = $('myopac_bookbag_new_name').value;
+ if(!name) return;
+
+ var exists = false;
+ for( var c in fleshedContainers ) { exists = true; break; }
+
+ /* let them know what they are getting into... */
+ if(!exists) if(!confirm($('bb_create_warning').innerHTML)) return;
+
+ var result = containerCreate( name, $('bb_public_yes').checked );
+ var code = checkILSEvent(result);
+ if(code) { alertILSEvent(result); return; }
+ if(result) alert($('myopac_bb_update_success').innerHTML);
+ myOPACShowBookbags(true);
+}
+
+
+/* ---------------------------------------------------------------------- */
+/* Non cat circs */
+/* ---------------------------------------------------------------------- */
+
+var nonCatCircIds;
+var nonCatTypes;
+/* if we have some circs, grab the non-cat types */
+function myOPACDrawNonCatCircs(r) {
+ var ids = r.getResultObject();
+ if(ids.length == 0) return;
+ nonCatCircIds = ids;
+ unHideMe($('non_cat_circs_div'));
+ var req = new Request(FETCH_NON_CAT_TYPES, G.user.home_ou());
+ req.callback(myOPACDrawNonCatCircs2);
+ req.send();
+}
+
+
+/* now we have circs and the types.. draw each one */
+var nonCatTbody;
+var nonCatRow;
+function myOPACDrawNonCatCircs2(r) {
+ nonCatTypes = r.getResultObject();
+ nonCatTbody = $('non_cat_circs_tbody');
+ if(!nonCatRow) nonCatRow =
+ nonCatTbody.removeChild($('non_cat_circs_row'));
+ removeChildren(nonCatTbody);
+ for( var i in nonCatCircIds ) {
+ var req = new Request(FETCH_NON_CAT_CIRC, G.user.session, nonCatCircIds[i]);
+ req.callback(myOPACDrawNonCatCirc);
+ req.send();
+ }
+}
+
+
+/* draw a single circ */
+function myOPACDrawNonCatCirc(r) {
+ var circ = r.getResultObject();
+
+
+ var type = grep(nonCatTypes,
+ function(i){
+ return (i.id() == circ.item_type());
+ }
+ )[0];
+
+
+ var row = nonCatTbody.appendChild(nonCatRow.cloneNode(true));
+ appendClear($n(row, 'circ_lib'), text(findOrgUnit(circ.circ_lib()).name()));
+ appendClear($n(row, 'item_type'), text(type.name()));
+
+ appendClear(
+ $n(row, 'circ_time'),
+ text(dojo.date.locale.format(
+ dojo.date.stamp.fromISOString(circ.duedate()),
+ {format : 'short'}
+ ))
+ );
+}
+
+
+
+
+function myopacSelectAllChecked() {
+ __myopacSelectChecked(true);
+}
+
+function myopacSelectNoneChecked() {
+ __myopacSelectChecked(false);
+}
+
+function __myopacSelectChecked(value) {
+ var rows = myopacGetCheckedOutRows();
+ for( var i = 0; i < rows.length; i++ ) {
+ var row = rows[i];
+ var box = $n(row, 'selectme');
+ if( box && ! box.disabled )
+ box.checked = value;
+ }
+}
+
+function myopacGetCheckedOutRows() {
+ var rows = [];
+ var tbody = $('myopac_checked_tbody');
+ var children = tbody.childNodes;
+ for( var i = 0; i < children.length; i++ ) {
+ var child = children[i];
+ if( child.nodeName.match(/^tr$/i) )
+ if( $n(child, 'selectme') )
+ rows.push(child);
+ }
+ return rows;
+}
+
+var __renew_circs = [];
+
+/* true if 1 renewal succeeded */
+var __success_count = 0;
+
+/* renews all selected circulations */
+function myOPACRenewSelected() {
+ var rows = myopacGetCheckedOutRows();
+ if(!confirm($('myopac_renew_confirm').innerHTML)) return;
+ __success_count = 0;
+
+ for( var i = 0; i < rows.length; i++ ) {
+
+ var row = rows[i];
+ if( ! $n(row, 'selectme').checked ) continue;
+ var circ_id = row.getAttribute('circid');
+
+ var circ;
+ for( var j = 0; j != circsCache.length; j++ )
+ if(circsCache[j].id() == circ_id)
+ circ = circsCache[j];
+
+ __renew_circs.push(circ);
+ }
+
+ if( __renew_circs.length == 0 ) return;
+
+ unHideMe($('my_renewing'));
+ moClearCheckedTable();
+
+ for( var i = 0; i < __renew_circs.length; i++ ) {
+ var circ = __renew_circs[i];
+ moRenewCirc( circ.target_copy(), G.user.id(), circ );
+ }
+}
+
+
+/* renews a single circulation */
+function moRenewCirc(copy_id, user_id, circ) {
+
+ _debug('renewing circ ' + circ.id() + ' with copy ' + copy_id);
+ var req = new Request(RENEW_CIRC, G.user.session,
+ { patron : user_id,
+ copyid : copy_id,
+ opac_renewal : 1
+ }
+ );
+
+ req.request.alertEvent = false;
+ req.callback(myHandleRenewResponse);
+ req.request.circ = circ;
+ req.send();
+}
+
+
+
+/* handles the circ renew results */
+function myHandleRenewResponse(r) {
+ var res = r.getResultObject();
+ var circ = r.circ;
+
+ /* remove this circ from the list of circs to renew */
+ __renew_circs = grep(__renew_circs, function(i) { return (i.id() != circ.id()); });
+
+ _debug("handling renew result for " + circ.id());
+
+ if(checkILSEvent(res) || checkILSEvent(res[0]))
+ alertIdText('myopac_renew_fail', __circ_titles[circ.id()]);
+ else __success_count++;
+
+ if(__renew_circs) return; /* more to come */
+
+ __renew_circs = [];
+
+ if( __success_count > 0 )
+ alertIdText('myopac_renew_success', __success_count);
+
+ hideMe($('my_renewing'));
+ checkedDrawn = false;
+ myOPACShowChecked();
+}
+
+/** ---- batch hold processing ------------ */
+
+
+/* myopac_holds_checkbx */
+function myopacSelectAllHolds() {
+ var rows = getTableRows($("myopac_holds_tbody"));
+ for(var i = 0; i < rows.length; i++) {
+ cb = $n(rows[i], 'myopac_holds_selected_chkbx');
+ if(cb) cb.checked = true;
+ }
+}
+
+function myopacSelectNoneHolds() {
+ var rows = getTableRows($("myopac_holds_tbody"));
+ for(var i = 0; i < rows.length; i++) {
+ cb = $n(rows[i], 'myopac_holds_selected_chkbx');
+ if(cb) cb.checked = false;
+ }
+}
+
+function myopacSelectedHoldsRows() {
+ var r = [];
+ var rows = getTableRows($("myopac_holds_tbody"));
+ for(var i = 0; i < rows.length; i++) {
+ cb = $n(rows[i], 'myopac_holds_selected_chkbx');
+ if(cb && cb.checked)
+ r.push(rows[i]);
+ }
+ return r;
+}
+
+var myopacProcessedHolds = 0;
+var myopacHoldsToProcess = 0;
+function myopacDoHoldAction() {
+
+ var selectedRows = myopacSelectedHoldsRows();
+ action = getSelectorVal($('myopac_holds_actions'));
+ $('myopac_holds_actions_none').selected = true;
+ if(selectedRows.length == 0) return;
+
+ myopacProcessedHolds = 0;
+
+ if(!confirmId('myopac.holds.'+action+'.confirm')) return;
+ myopacSelectNoneHolds(); /* clear the selection */
+
+
+ /* first, let's collect the holds that actually need processing and
+ collect the full process count while we're at it */
+ var holds = [];
+ for(var i = 0; i < selectedRows.length; i++) {
+ hold = holdCache[myopacHoldIDFromRow(selectedRows[i])];
+ var qstats = holdStatusCache[hold.id()];
+ switch(action) {
+ case 'cancel':
+ holds.push(hold);
+ break;
+ case 'thaw_date':
+ case 'thaw':
+ if(isTrue(hold.frozen()))
+ holds.push(hold);
+ break;
+ case 'freeze':
+ if(!isTrue(hold.frozen()) && qstats.status < 3)
+ holds.push(hold);
+ break;
+ }
+ }
+ myopacHoldsToProcess = holds;
+ if(myopacHoldsToProcess.length == 0) return;
+
+ if(action == 'thaw_date' || action == 'freeze')
+ myopacDrawHoldThawDateForm();
+ else
+ myopacProcessHolds(action);
+}
+
+
+function myopacProcessHolds(action, thawDate) {
+
+ myopacShowHoldProcessing();
+ /* now we process them */
+ for(var i = 0; i < myopacHoldsToProcess.length; i++) {
+
+ hold = myopacHoldsToProcess[i];
+
+ var req;
+ switch(action) {
+
+ case 'cancel':
+ req = new Request(CANCEL_HOLD, G.user.session, hold.id(), /* Patron via OPAC */ 6);
+ break;
+
+ case 'thaw':
+ hold.frozen('f');
+ hold.thaw_date(null);
+ req = new Request(UPDATE_HOLD, G.user.session, hold);
+ break;
+
+ case 'thaw_date':
+ case 'freeze':
+ hold.frozen('t');
+ hold.thaw_date(thawDate);
+ req = new Request(UPDATE_HOLD, G.user.session, hold);
+ break;
+ //thawDate = prompt($('myopac.holds.freeze.select_thaw').innerHTML);
+
+ }
+
+ req.callback(myopacBatchHoldCallback);
+ req.send();
+ req = null;
+ }
+}
+
+function myopacDrawHoldThawDateForm() {
+ hideMe($('myopac_holds_main_table'));
+ unHideMe($('myopac_holds_thaw_date_form'));
+ $('myopac_holds_thaw_date_input').focus();
+}
+
+function myopacApplyThawDate() {
+ var dateString = dijit.byId('myopac_holds_thaw_date_input').getValue();
+ if(dateString) {
+ dateString = dojo.date.stamp.toISOString(dateString);
+ if(dateString) {
+ dateString = holdsVerifyThawDate(dateString);
+ if(!dateString) return;
+ } else {
+ dateString = null;
+ }
+ }
+ myopacProcessHolds('freeze', dateString);
+}
+
+function myopacHoldIDFromRow(row) {
+ return row.id.replace(/.*_(\d+)$/, '$1');
+}
+
+function myopacShowHoldProcessing() {
+ unHideMe($('myopac_holds_processing'));
+ hideMe($('myopac_holds_main_table'));
+}
+
+function myopacHideHoldProcessing() {
+ hideMe($('myopac_holds_processing'));
+ unHideMe($('myopac_holds_main_table'));
+ hideMe($('myopac_holds_thaw_date_form'));
+}
+
+function myopacBatchHoldCallback(r) {
+ if(r) /* force load any exceptions */
+ r.getResultObject();
+ if(++myopacProcessedHolds >= myopacHoldsToProcess.length) {
+ myopacHideHoldProcessing();
+ holdCache = {};
+ holdStatusCache = {};
+ myopacForceHoldsRedraw = true;
+ myOPACShowHolds();
+ }
+}
+
--- /dev/null
+dojo.require('dojo.parser');
+dojo.require('dijit.Dialog');
+dojo.require('dijit.form.Button');
+dojo.require('dijit.form.TextBox');
+
+dojo.requireLocalization("openils.opac", "opac");
+opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+
+dojo.addOnLoad(function() {
+
+ // Create the password reset dialog
+ var pwResetFormDlg = createResetDialog();
+ dojo.parser.parse();
+
+ // Connect the buttons to submit / cancel events that override
+ // the default actions associated with the buttons to do
+ // pleasing Ajax things
+ dojo.connect(dijit.byId("pwCancel"), "onClick", function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ pwResetFormDlg.hide();
+ dijit.byId('pwUsername').attr('value', null);
+ dijit.byId('pwBarcode').attr('value', null);
+ });
+ dojo.connect(dijit.byId("pwSubmit"), "onClick", function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ var xhrArgs = {
+ form: dojo.byId("requestReset"),
+ handleAs: "text",
+ load: function(data) {
+ pwResetFormDlg.hide();
+ passwordSubmission(opac_strings.PWD_RESET_SUBMIT_SUCCESS);
+ dijit.byId('pwUsername').attr('value', null);
+ dijit.byId('pwBarcode').attr('value', null);
+ },
+ error: function(error) {
+ pwResetFormDlg.hide();
+ passwordSubmission(opac_strings.PWD_RESET_SUBMIT_ERROR);
+ }
+ }
+ var deferred = dojo.xhrPost(xhrArgs);
+ });
+ dojo.place("<tr><td colspan='2' align='center'><a class='classic_link' id='pwResetLink' onClick='dijit.byId(\"pwResetFormDlg\").show();'</a></td></tr>", config.ids.login.tbody);
+ dojo.query("#pwResetLink").attr("innerHTML", opac_strings.PWD_RESET_FORGOT_PROMPT);
+
+});
+
+function passwordSubmission( msg ) {
+ var responseDialog = new dijit.Dialog({
+ title: opac_strings.PWD_RESET_RESPONSE_TITLE,
+ style: "width: 35em"
+ });
+ responseDialog.startup();
+ var requestStatusDiv = dojo.create("div", { style: "width: 30em" });
+ var requestStatusMsg = dojo.create("div", { innerHTML: msg }, requestStatusDiv);
+ var okButton = new dijit.form.Button({
+ id: "okButton",
+ type: "submit",
+ label: opac_strings.OK
+ }).placeAt(requestStatusDiv);
+ responseDialog.attr("content", requestStatusDiv);
+ responseDialog.show();
+ dojo.connect(dijit.byId("okButton"), "onClick", responseDialog, "hide");
+}
+
+function createResetDialog() {
+ var pwResetFormDlg = new dijit.Dialog({
+ id: "pwResetFormDlg",
+ title: opac_strings.PWD_RESET_FORM_TITLE,
+ style: "width: 35em"
+ });
+ pwResetFormDlg.startup();
+
+ // Instantiate the form
+ var pwResetFormURL = "/opac/password/" + (OpenSRF.locale || "en-US") + "/";
+ var pwResetFormDiv = dojo.create("form", { id: "requestReset", style: "width: 30em", method: "post", action: pwResetFormURL });
+ dojo.create("p", { innerHTML: opac_strings.PWD_RESET_SUBMIT_PROMPT }, pwResetFormDiv);
+ var pwResetFormTable = dojo.create("table", null, pwResetFormDiv);
+ var pwResetFormTbody = dojo.create("tbody", null, pwResetFormTable);
+ var pwResetFormRow = dojo.create("tr", null, pwResetFormTbody);
+ var pwResetFormCell = dojo.create("td", null, pwResetFormRow);
+ var pwResetFormLabel = dojo.create("label", null, pwResetFormCell);
+ dojo.attr(pwResetFormCell, { innerHTML: opac_strings.BARCODE_PROMPT });
+ pwResetFormCell = dojo.create("td", null, pwResetFormRow);
+ var barcodeText = new dijit.form.TextBox({
+ id: "pwBarcode",
+ name: "barcode"
+ }).placeAt(pwResetFormCell);
+ pwResetFormRow = dojo.create("tr", {}, pwResetFormTbody);
+ pwResetFormCell = dojo.create("td", {}, pwResetFormRow);
+ dojo.attr(pwResetFormCell, { innerHTML: opac_strings.USERNAME_PROMPT });
+ pwResetFormCell = dojo.create("td", {}, pwResetFormRow);
+ var usernameText = new dijit.form.TextBox({
+ id: "pwUsername",
+ name: "username"
+ }).placeAt(pwResetFormCell);
+ dojo.create("br", null, pwResetFormDiv);
+ var submitButton = new dijit.form.Button({
+ id: "pwSubmit",
+ type: "submit",
+ label: opac_strings.SUBMIT_BUTTON_LABEL
+ }).placeAt(pwResetFormDiv);
+ var cancelButton = new dijit.form.Button({
+ id: "pwCancel",
+ type: "cancel",
+ label: opac_strings.CANCEL_BUTTON_LABEL
+ }).placeAt(pwResetFormDiv);
+
+ // Set the content of the Dialog to the pwResetForm
+ pwResetFormDlg.attr("content", pwResetFormDiv);
+ return pwResetFormDlg;
+}
+
--- /dev/null
+
+/* */
+
+detachAllEvt('common', 'run');
+attachEvt("common", "run", rdetailDraw);
+attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
+attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
+attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
+
+/* Per-skin configuration settings */
+var rdetailLocalOnly = true;
+var rdetailShowLocal = true;
+var rdetailShowCopyLocation = true;
+var rdetailGoogleBookPreview = false;
+var rdetailDisplaySerialHoldings = true;
+var rdetailEnableRefWorks = false;
+var rdetailRefWorksHost = 'http://www.refworks.com';
+
+/* vars vars vars */
+var record = null;
+var cp_statuses = null;
+var recordsCache = [];
+
+var copyRowParent = null;
+var copyRow = null;
+var statusRow = null;
+var numStatuses = null;
+var defaultCN;
+var callnumberCache = {};
+var globalCNCache = {};
+var localTOC;
+var cachedRecords;
+var _statusPositions = {};
+var opac_strings;
+
+var nextContainerIndex;
+
+var nextRecord;
+var prevRecord;
+
+var rdetailPrev = null;
+var rdetailNext = null;
+var rdetailStart = null;
+var rdetailEnd = null;
+
+var mfhdDetails = [];
+var orgHiding = false;
+
+if(location.href.match(/&place_hold=1/)) {
+ // prevent load flicker between canvases
+ hideMe(dojo.byId('canvas_main'));
+}
+
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.TextBox");
+
+/* serials are currently the only use of Dojo strings in the OPAC */
+if (rdetailDisplaySerialHoldings) {
+ dojo.require("dijit.Menu");
+ dojo.require("dijit.form.Button");
+ dojo.requireLocalization("openils.opac", "opac");
+ opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+}
+
+function rdetailReload() {
+ var args = {};
+ args[PARAM_LOCATION] = getNewSearchLocation();
+ args[PARAM_DEPTH] = depthSelGetDepth();
+ goTo(buildOPACLink(args));
+}
+
+/* looks to see if we have a next and/or previous record in the
+ record cache, if so, set up the nav links */
+function rdetailSetPaging(ids) {
+
+ cachedRecords = {};
+ cachedRecords.ids = ids;
+
+ for( var i = 0; i < cachedRecords.ids.length; i++ ) {
+ var rec = cachedRecords.ids[i];
+ if( rec == getRid() ) {
+ if( i > 0 ) prevRecord = cachedRecords.ids[i-1];
+ if( i < cachedRecords.ids.length - 1 )
+ nextRecord = cachedRecords.ids[i+1];
+ break;
+ }
+ }
+
+ $('np_offset').appendChild(text(i + 1));
+ $('np_count').appendChild(text(getHitCount()));
+
+ if(prevRecord) {
+ unHideMe($('np_table'));
+ unHideMe($('np_prev'));
+ unHideMe($('np_start'));
+ rdetailPrev = function() { _rdetailNav(prevRecord); };
+ rdetailStart = function() { _rdetailNav(cachedRecords.ids[0]); };
+ }
+
+ if(nextRecord) {
+ unHideMe($('np_table'));
+ unHideMe($('np_next'));
+ unHideMe($('np_end'));
+ rdetailNext = function() { _rdetailNav(nextRecord); };
+ rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); };
+ }
+
+ runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length);
+}
+
+
+function _rdetailNav(id, offset) {
+ var args = {};
+ args[PARAM_RID] = id;
+ goTo(buildOPACLink(args));
+}
+
+function rdetailHandlePlaceHold() {
+ function reload() {
+ location.href = location.href.replace(/&place_hold=1/, '');
+ }
+ attachEvt("common", "holdUpdated", reload);
+ attachEvt("common", "holdUpdateCanceled", reload);
+ attachEvt("common", "loginCanceled", reload);
+ holdsDrawEditor({record:getRid(), type: 'T'});
+}
+
+function rdetailDraw() {
+
+ if(new CGI().param('place_hold')) {
+ rdetailHandlePlaceHold();
+ return;
+ }
+
+ detachAllEvt('common','depthChanged');
+ detachAllEvt('common','locationUpdated');
+ attachEvt('common','depthChanged', rdetailReload);
+ attachEvt('common','locationUpdated', rdetailReload);
+ attachEvt('common','holdUpdated', rdetailReload);
+ attachEvt('common','holdUpdateCanceled', rdetailReload);
+
+ copyRowParent = G.ui.rdetail.cp_info_row.parentNode;
+ copyRow = copyRowParent.removeChild(G.ui.rdetail.cp_info_row);
+ statusRow = G.ui.rdetail.cp_status.parentNode;
+ statusRow.id = '__rdsrow';
+
+ G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies;
+ G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies;
+
+ if(getLocation() == globalOrgTree.id())
+ hideMe(G.ui.rdetail.cp_info_all);
+
+ if(getRid()) {
+
+ var req = new Request(FETCH_RMODS, getRid());
+ req.callback(_rdetailDraw);
+ req.send();
+
+ } else { // No record ID was specified
+
+ // If we have an ISBN in the URL, let's try to find that record
+ // This allows direct linking by ISBN.
+ // Note, this uses the first record it finds
+ if(getRtype() == RTYPE_ISBN) {
+ var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() );
+ req.callback(
+ function(r) {
+ var blob = r.getResultObject();
+ if(blob && blob.count > 0)
+ RID = blob.ids[0];
+ var req2 = new Request(FETCH_RMODS, getRid());
+ req2.callback(_rdetailDraw);
+ req2.send();
+ }
+ );
+ req.send();
+ }
+ }
+
+
+ if (rdetailDisplaySerialHoldings && (
+ isXUL() || !fetchOrgSettingDefault(
+ getLocation(), "opac.fully_compressed_serial_holdings")
+ )
+ ) {
+ var req = new Request(FETCH_MFHD_SUMMARY, getRid());
+ req.callback(_holdingsDraw);
+ req.send();
+ if (isXUL()) {
+ var here = findOrgUnit(getLocation());
+ dojo.place("<div id='mfhd_ad_menu'></div>", "rdetail_details_table", "after");
+ var mfhd_add = new dijit.Menu({style:"float: right;"});
+ new dijit.MenuItem({onClick:function(){
+ var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid());
+ var res = req.send();
+ alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()]));
+ }, label:opac_strings.CREATE_MFHD}).placeAt(mfhd_add);
+ mfhd_add.placeAt(mfhd_ad_menu);
+ }
+ }
+
+ detachAllEvt("result", "idsReceived");
+ G.evt.result.hitCountReceived = [];
+ G.evt.result.recordReceived = [];
+ G.evt.result.copyCountsReceived = [];
+ G.evt.result.allRecordsReceived = [];
+
+ if(isXUL())
+ unHideMe($('rdetail_show_orders'));
+}
+
+function rdetailGetPageIds() {
+ attachEvt("result", "idsReceived", rdetailSetPaging );
+ resultFetchAllRecords = true;
+ rresultCollectIds(true);
+}
+
+
+function buildunAPISpan (span, type, id) {
+ var cgi = new CGI();
+ var d = new Date();
+
+ addCSSClass(span,'unapi-id');
+
+ span.setAttribute(
+ 'title', 'tag:' + cgi.server_name + ',' +
+ d.getFullYear() + ':' + type + '/' + id
+ );
+}
+
+function rdetailViewMarc(r,id) {
+ hideMe($('rdetail_extras_loading'));
+ $('rdetail_view_marc_box').innerHTML = r.getResultObject();
+
+ var div = elem('div', { "class" : 'hide_me' });
+ var span = div.appendChild( elem('abbr') );
+
+ buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
+
+ $('rdetail_view_marc_box').insertBefore(span, $('rdetail_view_marc_box').firstChild);
+}
+
+function rdetailForeignItems(r,id) {
+ hideMe($('rdetail_extras_loading'));
+ var tbody = $('rdetail_foreign_items_tbody');
+
+ var robj = r.getResultObject(); /* mvr list with foreign_copy_maps fleshed */
+
+ for (var i = 0; i < robj.length; i++) {
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = robj[i].doc_id();
+ var row = elem('tr'); tbody.appendChild(row);
+ var td1 = elem('td'); row.appendChild(td1);
+ var title = elem(
+ 'a',
+ {
+ 'href' : buildOPACLink(args),
+ 'class' : 'classic_link'
+ },
+ robj[i].title()
+ );
+ td1.appendChild(title);
+ var td2 = elem('td',{},robj[i].author()); row.appendChild(td2);
+ var td3 = elem('td'); row.appendChild(td3);
+ var details = elem(
+ 'a',
+ {
+ 'href' : 'javascript:void(0)',
+ 'class' : 'classic_link'
+ },
+ 'Copy Details'
+ );
+ details.onclick = function(idx,context_row){
+ return function() {
+ cpdBuild(
+ tbody,
+ context_row,
+ robj[idx],
+ null,
+ 1,
+ 0,
+ 1,
+ dojo.map(
+ robj[idx].foreign_copy_maps(),
+ function(x){ return x.target_copy(); }
+ ),
+ dojo.map(
+ robj[idx].foreign_copy_maps(),
+ function(x){ return x.peer_type().name(); }
+ )
+ );
+ };
+ }(i,row);
+ td3.appendChild(details);
+ }
+}
+
+
+
+function rdetailShowLocalCopies() {
+ rdetailShowLocal = true;
+ rdetailBuildInfoRows();
+ hideMe(G.ui.rdetail.cp_info_local);
+ unHideMe(G.ui.rdetail.cp_info_all);
+ hideMe(G.ui.rdetail.cp_info_none);
+}
+
+function rdetailShowAllCopies() {
+
+ rdetailShowLocal = false;
+ rdetailBuildInfoRows();
+ hideMe(G.ui.rdetail.cp_info_all);
+ unHideMe(G.ui.rdetail.cp_info_local);
+ hideMe(G.ui.rdetail.cp_info_none);
+}
+
+function OpenMarcEditWindow(pcrud, rec) {
+ /*
+ To run in Firefox directly, must set signed.applets.codebase_principal_support
+ to true in about:config
+ */
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+ dojo.require('openils.PermaCrud');
+
+ win.xulG = {
+ "record": {"marc": rec.marc(), "rtype": "sre"},
+ "save": {
+ "label": opac_strings.SAVE_MFHD_LABEL,
+ "func": function(xmlString) {
+ rec.marc(xmlString);
+ rec.edit_date('now');
+ rec.ischanged(true);
+ pcrud.update(rec);
+ }
+ },
+ 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined,
+ 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined
+ };
+}
+
+function loadMarcEditor(recId) {
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var rec = pcrud.retrieve("sre", recId);
+ if (rec) {
+ OpenMarcEditWindow(pcrud, rec);
+ }
+}
+
+/*
+ * This function could be written much more intelligently
+ * Limited brain power means that I'm brute-forcing it for now
+ */
+function _holdingsDraw(h) {
+ holdings = h.getResultObject();
+
+ if (holdings) {
+ // Only draw holdings within our OU scope
+ var here = findOrgUnit(getLocation());
+ var entryNum = 0;
+ var depth = getDepth();
+ dojo.forEach(holdings, function (item) {
+ if (orgIsMine(here, findOrgUnit(item.owning_lib()), depth)) {
+ _holdingsDrawMFHD(item, entryNum);
+ entryNum++;
+ }
+ });
+ }
+
+ // Populate (or unpopulate) XUL menus
+ if (isXUL()) {
+ runEvt('rdetail','MFHDDrawn');
+ }
+}
+
+function _holdingsDrawMFHD(holdings, entryNum) {
+ var hb = holdings.basic_holdings();
+ var hba = holdings.basic_holdings_add();
+ var hs = holdings.supplement_holdings();
+ var hsa = holdings.supplement_holdings_add();
+ var hi = holdings.index_holdings();
+ var hia = holdings.index_holdings_add();
+ var ho = holdings.online();
+ var hm = holdings.missing();
+ var hinc = holdings.incomplete();
+ var hloc = holdings.location() || 'MFHD';
+
+ if ( hb.length == 0 && hba.length == 0 && hs.length == 0 &&
+ hsa.length == 0 && hi.length == 0 && hia.length == 0 &&
+ ho.length == 0 && hm.length == 0 && hinc.length == 0
+ ) {
+
+ if (isXUL()) {
+ /*
+ * If we have a record, but nothing to show for it, then the
+ * record is likely empty or corrupt. This gives cataloguers a
+ * chance to add holdings or correct the record
+ */
+ hb = ['PLACEHOLDER'];
+ } else {
+ return null;
+ }
+ }
+
+ // Show entryNum + 1 in staff client for better menu correlation
+ // Maybe this should be holdings.sre_id() instead? (which could get long after time)
+ var entryNumString = '';
+ if (isXUL()) {
+ var entryNumInc = entryNum + 1;
+ entryNumString = ' [Entry #'+entryNumInc+'] ';
+ }
+
+ var refNode;
+ if (entryNum > 0) {
+ refNode = 'rdetail_holdings_table_' + (entryNum - 1);
+ } else {
+ refNode = 'rdetail_details_table';
+ }
+
+ dojo.place("<table style='width: 100%;' id='rdetail_holdings_table_"+entryNum+"'><caption id='mfhdHoldingsCaption" + entryNum + "' class='rdetail_header color_1'>" +
+ dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) + entryNumString +
+ "</caption><tbody id='rdetail_holdings_tbody_" + entryNum +
+ "'></tbody></table>", refNode, "after"
+ );
+ if (hb.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.BASIC_HOLDINGS, hb); }
+ if (hba.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.BASIC_HOLDINGS_ADD, hba); }
+ if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENT_HOLDINGS, hs); }
+ if (hsa.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENT_HOLDINGS_ADD, hsa); }
+ if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEX_HOLDINGS, hi); }
+ if (hia.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEX_HOLDINGS_ADD, hia); }
+ if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.ONLINE_VOLUMES, ho); }
+ if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.MISSING_VOLUMES, hm); }
+ if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INCOMPLETE_VOLUMES, hinc); }
+
+ if (isXUL() && holdings.sre_id() != -1) { // -1 indicates in-DB only holdings, so no button or menu entries for MFHD
+ mfhdDetails.push({ 'id' : holdings.sre_id(), 'label' : hloc, 'entryNum' : entryNum, 'owning_lib' : holdings.owning_lib() });
+ dojo.require('openils.Event');
+ dojo.require('openils.PermaCrud');
+ var mfhd_edit = new dijit.Menu({});
+ new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.sre_id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first");
+ new dijit.MenuItem({onClick:function(){
+ // Avoid accidental deletion of MFHD records
+ if (!confirm(opac_strings.DELETE_MFHD_CONFIRM)) {
+ return;
+ }
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var mfhd_rec = pcrud.retrieve("sre", holdings.sre_id());
+ if (mfhd_rec) {
+ pcrud.eliminate(mfhd_rec);
+ alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.sre_id()]));
+ }
+ }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last");
+ // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.sre_id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last");
+ var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"});
+ mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last");
+ mfhd_edit.startup();
+ }
+}
+
+function _holdingsDrawMFHDEntry(entryNum, entryName, entry) {
+ var flatEntry = entry.toString().replace(/,/g, ', ');
+ dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>" + entryName + "</td><td class='rdetail_item'>" + flatEntry + "</td></tr>", "rdetail_holdings_tbody_" + entryNum, "last");
+}
+
+function _rdetailDraw(r) {
+ record = r.getResultObject();
+
+ runEvt('rdetail', 'recordRetrieved', record.doc_id());
+
+ G.ui.rdetail.title.appendChild(text(record.title()));
+ buildSearchLink(STYPE_AUTHOR, record.author(), G.ui.rdetail.author);
+ G.ui.rdetail.isbn.appendChild(text(cleanISBN(record.isbn())));
+ G.ui.rdetail.edition.appendChild(text(record.edition()));
+ G.ui.rdetail.pubdate.appendChild(text(record.pubdate()));
+ G.ui.rdetail.publisher.appendChild(text(record.publisher()));
+ $('rdetail_physical_desc').appendChild(text(record.physical_description()));
+ r = record.types_of_resource();
+ if(r) {
+ G.ui.rdetail.tor.appendChild(text(r[0]));
+ setResourcePic( G.ui.rdetail.tor_pic, r[0]);
+ }
+ G.ui.rdetail.abstr.appendChild(text(record.synopsis()));
+
+ try{
+ if(record.isbn()) {
+ if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) {
+ unHideMe($('rdetail.jacket_attrib_div'));
+ var href = $('rdetail.jacket_attrib_link').getAttribute('href') +cleanISBN(record.isbn());
+ $('rdetail.jacket_attrib_link').setAttribute('href', href);
+ }
+ rdetailCheckForGBPreview();
+
+ } else {
+ hideMe($("rdetail.jacket_attrib_div"));
+ hideMe($("rdetail_img_link"));
+ }
+ } catch(E) {}
+
+
+ // see if the record has any external links
+ var links = record.online_loc();
+ for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) {
+ var href = links[i];
+ // avoid matching "HTTP: The Complete Reference"
+ if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) {
+ unHideMe($('rdetail_online_row'));
+ // MODS can contain a display label (used for the text of the link)
+ // as well as a note about the URL; many legacy systems conflate the
+ // two and generate MARC records that expect the note to be used as
+ // the text of the link, with no display label; here's the canonical
+ // format:
+ //
+ // 856 40 $uhttp://localhost$yDisplay label$zPublic note
+ //
+ // Note that the MARC21slim2MODS XSL concatenates $3 and $y together
+ // (as $y was defined later in MARC21's life as the display label)
+ var displayLabel = '' + links[i+1];
+ var note = '' + links[i+2];
+ if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) {
+ if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) {
+ displayLabel = href;
+ } else {
+ displayLabel = note;
+ }
+ }
+ $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel));
+ if (note && note != displayLabel) {
+ $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note));
+ }
+ $('rdetail_online').appendChild(elem('br'));
+ }
+ }
+
+ // Fill in our unAPI ID, if anyone cares
+ var abbrs = document.getElementsByTagName('abbr');
+ var span;
+ for (var i = 0; i < abbrs.length; i++) {
+ if (abbrs[i].getAttribute('name') == 'unapi') {
+ span = abbrs[i];
+ break;
+ }
+ }
+ buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
+
+ $('rdetail_place_hold').onclick = function() {
+ var src = location.href;
+
+ if(forceLoginSSL && src.match(/^http:/)) {
+
+ src = src.replace(/^http:/, 'https:');
+
+ if(!src.match(/&place_hold=1/)) {
+ src += '&place_hold=1';
+ }
+
+ location.href = src;
+
+ } else {
+ holdsDrawEditor({record:record.doc_id(), type:'T'});
+ }
+ }
+
+
+ var RW = $('rdetail_exp_refworks');
+ if (RW && rdetailEnableRefWorks) {
+
+ var here = (findOrgUnit(getLocation())).name();
+ var org_name = here.replace(" ", "+");
+ var cgi = new CGI();
+
+ RW.setAttribute(
+ 'href',
+ rdetailRefWorksHost + '/express/expressimport.asp?vendor='
+ + org_name
+ + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
+ + cgi.server_name + '/opac/extras/supercat/marctxt/record/'
+ + record.doc_id()
+ );
+
+ RW.setAttribute('target', 'RefWorksMain');
+
+ unHideMe($('rdetail_exp_refworks_span'));
+ }
+
+ $('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large'));
+ G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
+ runEvt("rdetail", "recordDrawn");
+ recordsCache.push(record);
+
+ rdetailSetExtrasSelector();
+
+ var breq = new Request(FETCH_BRE, [getRid()]);
+ breq.callback( rdetailCheckDeleted );
+ breq.send();
+
+ //resultBuildCaches( [ record ] );
+ //resultDrawSubjects();
+ //resultDrawSeries();
+
+ // grab added content
+
+ // Proxied through Evergreen AddedContent module
+ acCollectData(cleanISBN(record.isbn()), rdetailhandleAC);
+
+ var currentISBN = cleanISBN(record.isbn());
+
+ // Not proxied, cross-site javascript
+
+ // ChiliFresh
+ if (chilifresh && chilifresh != '(none)' && currentISBN) {
+ $('chilifreshReviewLink').setAttribute('id','isbn_'+currentISBN);
+ $('chilifreshReviewResult').setAttribute('id','chili_review_'+currentISBN);
+ unHideMe($('rdetail_reviews_link'));
+ unHideMe($('rdetail_chilifresh_reviews'));
+ try {
+ chili_init();
+ } catch(E) {
+ console.log(E + '\n');
+ hideMe($('rdetail_reviews_link'));
+ hideMe($('rdetail_chilifresh_reviews'));
+ }
+ }
+
+ // Novelist
+ if (novelist && currentISBN) {
+ unHideMe($('rdetail_novelist_link'));
+ }
+
+ // Multi-Home / Foreign Items / Peer Bibs
+ var req = new Request( TEST_PEER_BIBS, record.doc_id() );
+ req.callback(function(r){
+ var test = r.getResultObject();
+ if (test == "1") {
+ unHideMe($('rdetail_foreign_items_link'));
+ }
+ });
+ req.send();
+}
+
+
+
+function rdetailCheckDeleted(r) {
+ var br = r.getResultObject()[0];
+ if( isTrue(br.deleted()) ) {
+ hideMe($('rdetail_place_hold'));
+ $('rdetail_more_actions_selector').disabled = true;
+ unHideMe($('rdetail_deleted_exp'));
+ }
+}
+
+function rdetailSetExtrasSelector() {
+ if(!grabUser()) return;
+ unHideMe($('rdetail_more_actions'));
+
+ var req = new Request(
+ FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
+ req.callback(rdetailAddBookbags);
+ req.send();
+}
+
+function rdetailAddBookbags(r) {
+
+ var containers = r.getResultObject();
+ var selector = $('rdetail_more_actions_selector');
+ var found = false;
+ var index = 3;
+ doSelectorActions(selector);
+
+ for( var i = 0; i < containers.length; i++ ) {
+ found = true;
+ var container = containers[i];
+ insertSelectorVal( selector, index++, container.name(),
+ "container_" + container.id(), rdetailAddToBookbag, 1 );
+ }
+
+ nextContainerIndex = index;
+}
+
+var _actions = {};
+/**
+ * Adds a new bookbag and exits.
+ *
+ * exitstatus should be 0 if the status is to be read.
+ */
+function finishBookbag(exitstatus) {
+ var name = bbName.attr('value');
+
+ newBBDialog.hide();
+ bbName.attr("value", ""); // Do this after hide so the text doesn't disappear.
+
+ if(exitstatus != 0) return; // If the user canceled, just drop off here.
+
+ var id;
+
+ if( id = containerCreate( name ) ) {
+ alert( $('rdetail_bb_success').innerHTML );
+ var selector = $('rdetail_more_actions_selector');
+ insertSelectorVal( selector, nextContainerIndex++, name,
+ "container_" + id, rdetailAddToBookbag, 1 );
+ setSelector( selector, 'start' );
+ }
+}
+
+/**
+ * Creates a new Bookbag for the user.
+ */
+function rdetailNewBookbag() {
+ newBBDialog.show(); // Show the bookbag dialog.
+ dojo.connect(dijit.byId('newBBDialog'), 'onKeyPress', function(evt) {
+ if (evt.keyCode == dojo.keys.ENTER) {
+ finishBookbag(0);
+ }
+ });
+}
+
+function rdetailAddToBookbag() {
+ var selector = $('rdetail_more_actions_selector');
+ var id = selector.options[selector.selectedIndex].value;
+ setSelector( selector, 'start' );
+
+ if( containerCreateItem( id.substring(10), record.doc_id() )) {
+ alert($('rdetail_bb_item_success').innerHTML);
+ }
+}
+
+
+var rdetailMarcFetched = false;
+var rdetailForeignItemsFetched = false;
+function rdetailShowExtra(type, args) {
+
+ hideMe($('rdetail_copy_info_div'));
+ hideMe($('rdetail_summary_div'));
+ hideMe($('rdetail_reviews_div'));
+ hideMe($('rdetail_toc_div'));
+ hideMe($('rdetail_anotes_div'));
+ hideMe($('rdetail_excerpt_div'));
+ hideMe($('rdetail_preview_div'));
+ hideMe($('rdetail_marc_div'));
+ hideMe($('cn_browse'));
+ hideMe($('rdetail_cn_browse_div'));
+ hideMe($('rdetail_novelist_div'));
+ hideMe($('rdetail_foreign_items_div'));
+ hideMe($('rdetail_notes_div'));
+
+ removeCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_summary_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_annotation_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_foreign_items_link'), 'rdetail_extras_selected');
+
+ switch(type) {
+
+ case "copyinfo":
+ unHideMe($('rdetail_copy_info_div'));
+ addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
+ break;
+
+ case "summary":
+ addCSSClass($('rdetail_summary_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_summary_div'));
+ break;
+
+ case "reviews":
+ addCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_reviews_div'));
+ break;
+
+ case "excerpt":
+ addCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_excerpt_div'));
+ break;
+
+ case "preview":
+ addCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_preview_div'));
+ rdetailDisplayGBPreview();
+ break;
+
+ case "anotes":
+ addCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_anotes_div'));
+ break;
+
+ case "toc":
+ addCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_toc_div'));
+ break;
+
+ case "marc":
+ addCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_marc_div'));
+ if(rdetailMarcFetched) return;
+ unHideMe($('rdetail_extras_loading'));
+ rdetailMarcFetched = true;
+ var req = new Request( FETCH_MARC_HTML, record.doc_id() );
+ req.callback(rdetailViewMarc);
+ req.send();
+ break;
+
+ case "novelist":
+ addCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_novelist_div'));
+ break;
+
+ case "foreign_items":
+ addCSSClass($('rdetail_foreign_items_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_foreign_items_div'));
+ if(rdetailForeignItemsFetched) return;
+ unHideMe($('rdetail_extras_loading'));
+ rdetailForeignItemsFetched = true;
+ var req = new Request( FETCH_PEER_BIBS, record.doc_id() );
+ req.callback(rdetailForeignItems);
+ req.send();
+ break;
+
+ case 'cn':
+ addCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_cn_browse_div'));
+ rdetailShowCNBrowse(defaultCN[1], getLocation(), null, true);
+ break;
+
+ }
+}
+
+function rdetailVolumeDetails(args) {
+ var row = $(args.rowid);
+ var tbody = row.parentNode;
+ cpdBuild( tbody, row, record, [args.cn_prefix, args.cn, args.cn_suffix], args.org, args.depth, args.copy_location );
+ return;
+}
+
+function rdetailBuildCNList() {
+
+ var select = $('cn_browse_selector');
+ var index = 0;
+ var arr = [];
+ for( var cn_json in callnumberCache ) arr.push( cn_json );
+ arr.sort();
+
+ if( arr.length == 0 ) {
+ hideMe($('rdetail_cn_browse_select_div'));
+ return;
+ }
+
+ for( var i = 0; i < arr.length; i++ ) {
+ var cn_json = arr[i];
+ var cn = JSON2js(cn_json);
+ var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
+ var opt = new Option(whole_cn_text,cn_json);
+ select.options[index++] = opt;
+ }
+ select.onchange = rdetailGatherCN;
+}
+
+function rdetailGatherCN() {
+ var cn = getSelectorVal($('cn_browse_selector'));
+ rdetailShowCNBrowse( JSON2js(cn), getLocation(), getDepth(), true );
+ setSelector( $('cn_browse_selector'), cn );
+}
+
+
+function rdetailShowCNBrowse( cn, loc, depth, fromOnclick ) {
+
+ if(!cn) {
+ unHideMe($('cn_browse_none'));
+ hideMe($('rdetail_cn_browse_select_div'));
+ return;
+ }
+
+ unHideMe($('rdetail_cn_browse_select_div'));
+ rdetailBuildCNList();
+ setSelector( $('cn_browse_selector'), js2JSON(cn) );
+ hideMe($('rdetail_copy_info_div'));
+ hideMe($('rdetail_reviews_div'));
+ hideMe($('rdetail_summary_div'));
+ hideMe($('rdetail_toc_div'));
+ hideMe($('rdetail_marc_div'));
+ unHideMe($('rdetail_cn_browse_div'));
+ unHideMe($('cn_browse'));
+ if( !rdetailLocalOnly && ! fromOnclick ) depth = findOrgDepth(globalOrgTree);
+ cnBrowseGo(cn, loc, depth);
+}
+
+function rdetailhandleAC(data) {
+
+ if( data.summary.html ) {
+ $('rdetail_summary_div').innerHTML = data.summary.html;
+ unHideMe($('rdetail_summary_link'));
+ }
+
+ if( data.reviews.html ) {
+ $('rdetail_review_container').innerHTML = data.reviews.html;
+ unHideMe($('rdetail_reviews_link'));
+ }
+
+ if( data.toc.html ) {
+ $('rdetail_toc_div').innerHTML = data.toc.html;
+ unHideMe($('rdetail_toc_link'));
+ }
+
+ if( data.excerpt.html ) {
+ $('rdetail_excerpt_div').innerHTML = data.excerpt.html;
+ unHideMe($('rdetail_excerpt_link'));
+ }
+
+ if( data.anotes.html ) {
+ $('rdetail_anotes_div').innerHTML = data.anotes.html;
+ unHideMe($('rdetail_anotes_link'));
+ }
+}
+
+function rdetailShowReviews(r) {
+ hideMe($('rdetail_extras_loading'));
+ var res = r.getResultObject();
+ var par = $('rdetail_reviews_div');
+ var template = par.removeChild($('rdetail_review_template'));
+ if( res && res.length > 0 ) {
+ unHideMe($('rdetail_reviews_link'));
+ for( var i = 0; i < res.length; i++ ) {
+ var rev = res[i];
+ if( rev.text && rev.info ) {
+ var node = template.cloneNode(true);
+ $n(node, 'review_header').appendChild(text(rev.info));
+ $n(node, 'review_text').appendChild(text(rev.text));
+ par.appendChild(node);
+ }
+ }
+ }
+}
+
+
+function rdetailShowTOC(r) {
+ hideMe($('rdetail_extras_loading'));
+ var resp = r.getResultObject();
+ if(resp) {
+ unHideMe($('rdetail_toc_link'));
+ $('rdetail_toc_div').innerHTML = resp;
+ }
+}
+
+function rdetailBuildInfoRows() {
+ var req;
+ var method = FETCH_COPY_COUNTS_SUMMARY;
+ if (rdetailShowCopyLocation)
+ method = FETCH_COPY_LOCATION_COUNTS_SUMMARY;
+ if( rdetailShowLocal )
+ req = new Request(method, record.doc_id(), getLocation(), getDepth())
+ else
+ req = new Request(method, record.doc_id());
+ req.callback(_rdetailBuildInfoRows);
+ req.send();
+}
+
+function _rdetailRows(node) {
+
+ if( rdetailShowLocal && getLocation() != globalOrgTree.id() ) {
+ var loc = findOrgUnit(getLocation());
+ if( node ) {
+ if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return;
+ } else {
+ var kids = globalOrgTree.children();
+ if (kids) {
+ for( var i = 0; i < kids.length; i++ ) {
+ var org = findOrgUnit(kids[i]);
+ if( orgIsMine(org, loc) ) {
+ node = org;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols())
+ node = globalOrgTree;
+
+
+ /* don't show hidden orgs */
+
+ if(node) {
+
+ if(!isXUL() && !isTrue(node.opac_visible())) return;
+
+ if (orgHiding) {
+ if (isTrue( findOrgType(node.ou_type()).can_have_vols() )) {
+ if ( ! orgIsMine( orgHiding.org, node, orgHiding.depth ) ) {
+ return;
+ }
+ }
+ }
+
+ var row = copyRow.cloneNode(true);
+ row.id = "cp_info_" + node.id();
+
+ var libtd = findNodeByName( row, config.names.rdetail.lib_cell );
+ var cntd = findNodeByName( row, config.names.rdetail.cn_cell );
+ var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell );
+ var actions = $n(row, 'rdetail_actions_cell');
+
+ var p = libtd.getElementsByTagName('a')[0];
+ libtd.insertBefore(text(node.name()), p);
+ libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;");
+
+ if(!findOrgType(node.ou_type()).can_have_vols()) {
+
+ row.removeChild(cntd);
+ row.removeChild(cpctd);
+ row.removeChild(actions);
+ row.setAttribute('novols', '1');
+
+ libtd.setAttribute("colspan", numStatuses + 3 );
+ libtd.colSpan = numStatuses + 3;
+ addCSSClass(row, 'copy_info_region_row');
+ }
+
+ copyRowParent.appendChild(row);
+
+ } else { node = globalOrgTree; }
+
+ var kids = node.children();
+ if (kids) {
+ for( var c = 0; c < kids.length; c++ )
+ _rdetailRows(kids[c]);
+ }
+}
+
+function rdetailCNPrint(orgid, cn) {
+ var div = cpdBuildPrintWindow( record, orgid);
+ var template = div.removeChild($n(div, 'cnrow'));
+ var rowNode = $("cp_info_" + orgid);
+ cpdStylePopupWindow(div);
+ openWindow(div.innerHTML);
+}
+
+var localCNFound = false;
+var ctr = 0;
+function _rdetailBuildInfoRows(r) {
+
+ if (rdetailShowCopyLocation)
+ unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ) );
+
+ removeChildren(copyRowParent);
+
+ orgHiding = checkOrgHiding();
+
+ _rdetailRows();
+
+ var summary = r.getResultObject();
+ if(!summary) return;
+
+ var found = false;
+ for( var i = 0; i < summary.length; i++ ) {
+
+ var arr = summary[i];
+ globalCNCache[js2JSON([arr[1],arr[2],arr[3]])] = 1; // prefix, label, suffix. FIXME - Am I used anywhere?
+ var thisOrg = findOrgUnit(arr[0]);
+ var rowNode = $("cp_info_" + thisOrg.id());
+ if(!rowNode) continue;
+
+ if(rowNode.getAttribute("used")) {
+
+ if( rowNode.nextSibling ) {
+ sib = rowNode.nextSibling;
+ o ='cp_info_'+thisOrg.id()+'_';
+ /* push the new row on as the last row for this org unit */
+ while( sib && sib.id.match(o) ) {
+ sib = sib.nextSibling;
+ }
+ if(sib)
+ rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
+ else
+ rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
+ } else {
+ rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
+ }
+
+ var n = findNodeByName( rowNode, config.names.rdetail.lib_cell );
+ n.appendChild(text(thisOrg.name()));
+ n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;");
+ rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr);
+
+ } else {
+ rowNode.setAttribute("used", "1");
+ }
+
+ var cpc_temp = rowNode.removeChild(
+ findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
+
+ var statuses = arr[4];
+ var cl = '';
+ if (rdetailShowCopyLocation) {
+ cl = arr[4];
+ statuses = arr[5];
+ }
+
+
+ rdetailApplyStatuses(rowNode, cpc_temp, statuses);
+
+ var isLocal = false;
+ if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) {
+ found = true;
+ isLocal = true;
+ if(!localCNFound) {
+ localCNFound = true;
+ defaultCN = [arr[1],arr[2],arr[3]]; // prefix, label, suffix
+ }
+ }
+
+ //if(isLocal) unHideMe(rowNode);
+ unHideMe(rowNode);
+
+ rdetailSetPath( thisOrg, isLocal );
+ rdetailBuildBrowseInfo( rowNode, [arr[1],arr[2],arr[3]], isLocal, thisOrg, cl );
+
+ if( i == summary.length - 1 && !defaultCN) defaultCN = [arr[1],arr[2],arr[3]]; // prefix, label, suffix
+ }
+
+ if(!found) unHideMe(G.ui.rdetail.cp_info_none);
+}
+
+function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
+
+ var whole_cn_json = js2JSON(cn);
+ var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
+
+ if(local) {
+ var cache = callnumberCache[whole_cn_json];
+ if( cache ) cache.count++;
+ else callnumberCache[whole_cn_json] = { count : 1 };
+ }
+
+ var depth = getDepth();
+ if( !local ) depth = findOrgDepth(globalOrgTree);
+
+ $n(row, 'rdetail_callnumber_cell').appendChild(text(whole_cn_text));
+
+ if (rdetailShowCopyLocation) {
+ var cl_cell = $n(row, 'rdetail_copylocation_cell');
+ cl_cell.appendChild(text(cl));
+ unHideMe(cl_cell);
+ }
+
+ _debug('setting action clicks for cn ' + whole_cn_text);
+
+ var dHref = 'javascript:rdetailVolumeDetails('+
+ '{copy_location : "'+cl.replace(/\"/g, '\\"')+'", rowid : "'+row.id+'", cn_prefix :"'+cn[0].replace(/\"/g, '\\"')+'",cn :"'+cn[1].replace(/\"/g, '\\"')+'",cn_suffix :"'+cn[2].replace(/\"/g, '\\"')+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});';
+
+ var bHref = 'javascript:rdetailShowCNBrowse("'+cn[1].replace(/\"/g, '\\"') + '", '+orgNode.id()+', "'+depth+'");';
+
+ unHideMe( $n(row, 'details') )
+ $n(row, 'details').setAttribute('href', dHref);
+ unHideMe( $n(row, 'browse') )
+ $n(row, 'browse').setAttribute('href', bHref);
+
+ if(isXUL()) {
+ unHideMe($n(row, 'hold_div'));
+ $n(row, 'hold').onclick = function() {
+ var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id());
+ req.callback(
+ function(r) {
+ var vol = r.getResultObject();
+ holdsDrawEditor({type: 'V', volumeObject : vol});
+ }
+ );
+ req.send();
+ };
+ }
+}
+
+// sets the path to org as 'active' and displays the path if it's local
+function rdetailSetPath(org, local) {
+ if( findOrgDepth(org) == 0 ) return;
+ var row = $("cp_info_" + org.id());
+ row.setAttribute("hasinfo", "1");
+ unHideMe(row);
+ rdetailSetPath(findOrgUnit(org.parent_ou()), local);
+}
+
+//Append all the statuses for a given summary to the
+//copy summary table
+function rdetailApplyStatuses( row, template, statuses ) {
+ for( var j in _statusPositions ) {
+ var stat = _statusPositions[j];
+ var val = statuses[stat.id()];
+ var nn = template.cloneNode(true);
+ if(val) nn.appendChild(text(val));
+ else nn.appendChild(text(0));
+ row.appendChild(nn);
+ }
+}
+
+//Add one td (creating a new column) to the copy summary
+//table for each opac_visible copy status
+function rdetailBuildStatusColumns() {
+
+ rdetailGrabCopyStatuses();
+ var parent = statusRow;
+ var template = parent.removeChild(G.ui.rdetail.cp_status);
+
+ var i = 0;
+ for( i = 0; i < cp_statuses.length; i++ ) {
+
+ var c = cp_statuses[i];
+ if( c && isTrue(c.opac_visible()) ) {
+ var name = c.name();
+ _statusPositions[i] = c;
+ var node = template.cloneNode(true);
+ var data = findNodeByName( node, config.names.rdetail.cp_status);
+
+ data.appendChild(text(name));
+ parent.appendChild(node);
+ }
+ }
+
+ numStatuses = 0;
+ for(x in _statusPositions) numStatuses++;
+}
+
+function rdetailGrabCopyStatuses() {
+ if(cp_statuses) return cp_statuses;
+ var req = new Request(FETCH_COPY_STATUSES);
+ req.send(true);
+ cp_statuses = req.result();
+ cp_statuses = cp_statuses.sort(_rdetailSortStatuses);
+}
+
+function _rdetailSortStatuses(a, b) {
+ return parseInt(a.id()) - parseInt(b.id());
+}
+
+/**
+ * Check for a Google Book preview after the main page loads
+ */
+function rdetailCheckForGBPreview() {
+ if (!rdetailGoogleBookPreview) return;
+ dojo.addOnLoad(function() {
+ searchForGBPreview( cleanISBN(record.isbn()) );
+ });
+}
+
+/**
+ *
+ * @param {DOM object} isbn The form element containing the input parameters "isbns"
+ */
+function searchForGBPreview( isbn ) {
+ dojo.require("dojo.io.script");
+ dojo.io.script.get({"url": "https://www.google.com/jsapi"});
+ dojo.io.script.get({"url": "http://books.google.com/books", "content": { "bibkeys": isbn, "jscmd": "viewapi", "callback": "GBPreviewCallback"}});
+}
+
+/**
+ * This function is the call-back function for the JSON scripts which
+ * executes a Google book search response.
+ *
+ * XXX I18N of text needed
+ *
+ * @param {JSON} GBPBookInfo is the JSON object pulled from the Google books service.
+ */
+function GBPreviewCallback(GBPBookInfo) {
+ var GBPreviewDiv = document.getElementById("rdetail_preview_div");
+ var GBPBook;
+
+ for ( i in GBPBookInfo ) {
+ GBPBook = GBPBookInfo[i];
+ }
+
+ if ( !GBPBook ) {
+ return;
+ }
+
+ if ( GBPBook.preview != "noview" ) {
+ // Add a button below the book cover image to load the preview.
+ GBPBadge = document.createElement( 'img' );
+ GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif';
+ GBPBadge.title = $('rdetail_preview_badge').innerHTML;
+ GBPBadge.style.border = 0;
+ GBPBadgelink = document.createElement( 'a' );
+ GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");';
+ GBPBadgelink.appendChild( GBPBadge );
+ $('rdetail_image_cell').appendChild( GBPBadgelink );
+ $('rdetail_preview_div').style.height = 600;
+
+ /* Display the "Preview" tab in the Extras section */
+ unHideMe( $('rdetail_preview_link' ) );
+ }
+}
+
+/**
+ * This is called when the user clicks on the 'Preview' link. We assume
+ * a preview is available from Google if this link was made visible.
+ *
+ * XXX I18N of Google Book Preview language attribute needed
+ */
+function rdetailDisplayGBPreview() {
+ unHideMe($('rdetail_extras_loading'));
+ GBPreviewPane = $('rdetail_preview_div');
+ if ( GBPreviewPane.getAttribute('loaded') == null ||
+ GBPreviewPane.getAttribute('loaded') == "false" ) {
+ google.load("books", "0", {"callback" : rdetailGBPViewerLoadCallback, "language": "en"} );
+ GBPreviewPane.setAttribute('loaded', 'true');
+ }
+}
+
+function rdetailGBPViewerLoadCallback() {
+ hideMe($('rdetail_extras_loading'));
+ var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div'));
+ GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) );
+
+}
+
+function rdetailDrawExpandedHoldings(anchor, bibid, type) {
+ var offsets = {"basic": 0, "index": 0, "supplement": 0};
+ var limit = 10; /* XXX give user control over this? */
+ var target_id = "holding_type_" + type;
+ var target = dojo.byId(target_id);
+
+ anchor.innerHTML = "[-]";
+ anchor.oldonclick = anchor.onclick;
+ anchor.onclick = function() {
+ anchor.onclick = anchor.oldonclick;
+ anchor.innerHTML = "[+]";
+ dojo.empty(target);
+ };
+
+ function _load() {
+ dojo.empty(target);
+ fieldmapper.standardRequest(
+ ["open-ils.serial",
+ "open-ils.serial.received_siss.retrieve.by_bib.atomic"], {
+ "params": [bibid, {"offset": offsets[type], "limit": limit}],
+ "async": true,
+ "oncomplete": function(r) {
+ try {
+ if (msg = r.recv().content()) { /* sic, assignment */
+ if (!msg.length) return;
+ offsets[type] += msg.length;
+ var table = dojo.create("table", null, target);
+ dojo.forEach(
+ msg, function(o) {
+ var tr = dojo.create("tr", null, table);
+ dojo.create(
+ "td", {
+ "innerHTML": o.issuance.label(),
+ "style": {"paddingLeft": "3em"}
+ }, tr
+ );
+
+ if (!o.has_units) return;
+ /* can't place holds if no units */
+ var td = dojo.create("td", null, tr);
+ dojo.create(
+ "a", {
+ "href":"javascript:void(0);",
+ "style": {"marginLeft": "1.5em"},
+ "onclick": function() {
+ holdsDrawEditor({
+ "type": "I",
+ "issuance": o.issuance.id()
+ });
+ },
+ "innerHTML": "[" +
+ opac_strings.PLACE_HOLD + "]"
+ }, td
+ );
+ }
+ );
+ if (msg.length == limit) {
+ dojo.create("br", null, target);
+ dojo.create(
+ "a", {
+ "href": "javascript:void(0);",
+ "innerHTML":
+ "[" + opac_strings.MORE + "]",
+ "onclick": _load
+ }, target
+ );
+ }
+ }
+ } catch (E) {
+ void(0);
+ }
+ }
+ }
+ );
+ }
+ _load();
+}
--- /dev/null
+
+/* */
+
+detachAllEvt('common', 'run');
+attachEvt("common", "run", rdetailDraw);
+attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
+attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
+attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
+
+/* Per-skin configuration settings */
+var rdetailLocalOnly = true;
+var rdetailShowLocal = true;
+var rdetailShowCopyLocation = true;
+var rdetailGoogleBookPreview = true;
+var rdetailDisplaySerialHoldings = true;
+var rdetailEnableRefWorks = false;
+var rdetailRefWorksHost = 'http://www.refworks.com';
+
+/* vars vars vars */
+var record = null;
+var cp_statuses = null;
+var recordsCache = [];
+
+var copyRowParent = null;
+var copyRow = null;
+var statusRow = null;
+var numStatuses = null;
+var defaultCN;
+var callnumberCache = {};
+var globalCNCache = {};
+var localTOC;
+var cachedRecords;
+var _statusPositions = {};
+var opac_strings;
+
+var nextContainerIndex;
+
+var nextRecord;
+var prevRecord;
+
+var rdetailPrev = null;
+var rdetailNext = null;
+var rdetailStart = null;
+var rdetailEnd = null;
+
+var mfhdDetails = [];
+var orgHiding = false;
+
+if(location.href.match(/&place_hold=1/)) {
+ // prevent load flicker between canvases
+ hideMe(dojo.byId('canvas_main'));
+}
+
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.TextBox");
+
+/* serials are currently the only use of Dojo strings in the OPAC */
+if (rdetailDisplaySerialHoldings) {
+ dojo.require("dijit.Menu");
+ dojo.require("dijit.form.Button");
+ dojo.requireLocalization("openils.opac", "opac");
+ opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+}
+
+function rdetailReload() {
+ var args = {};
+ args[PARAM_LOCATION] = getNewSearchLocation();
+ args[PARAM_DEPTH] = depthSelGetDepth();
+ goTo(buildOPACLink(args));
+}
+
+/* looks to see if we have a next and/or previous record in the
+ record cache, if so, set up the nav links */
+function rdetailSetPaging(ids) {
+
+ cachedRecords = {};
+ cachedRecords.ids = ids;
+
+ for( var i = 0; i < cachedRecords.ids.length; i++ ) {
+ var rec = cachedRecords.ids[i];
+ if( rec == getRid() ) {
+ if( i > 0 ) prevRecord = cachedRecords.ids[i-1];
+ if( i < cachedRecords.ids.length - 1 )
+ nextRecord = cachedRecords.ids[i+1];
+ break;
+ }
+ }
+
+ $('np_offset').appendChild(text(i + 1));
+ $('np_count').appendChild(text(getHitCount()));
+
+ if(prevRecord) {
+ unHideMe($('np_table'));
+ unHideMe($('np_prev'));
+ unHideMe($('np_start'));
+ rdetailPrev = function() { _rdetailNav(prevRecord); };
+ rdetailStart = function() { _rdetailNav(cachedRecords.ids[0]); };
+ }
+
+ if(nextRecord) {
+ unHideMe($('np_table'));
+ unHideMe($('np_next'));
+ unHideMe($('np_end'));
+ rdetailNext = function() { _rdetailNav(nextRecord); };
+ rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); };
+ }
+
+ runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length);
+}
+
+
+function _rdetailNav(id, offset) {
+ var args = {};
+ args[PARAM_RID] = id;
+ goTo(buildOPACLink(args));
+}
+
+function rdetailHandlePlaceHold() {
+ function reload() {
+ location.href = location.href.replace(/&place_hold=1/, '');
+ }
+ attachEvt("common", "holdUpdated", reload);
+ attachEvt("common", "holdUpdateCanceled", reload);
+ attachEvt("common", "loginCanceled", reload);
+ holdsDrawEditor({record:getRid(), type: 'T'});
+}
+
+function rdetailDraw() {
+
+ if(new CGI().param('place_hold')) {
+ rdetailHandlePlaceHold();
+ return;
+ }
+
+ detachAllEvt('common','depthChanged');
+ detachAllEvt('common','locationUpdated');
+ attachEvt('common','depthChanged', rdetailReload);
+ attachEvt('common','locationUpdated', rdetailReload);
+ attachEvt('common','holdUpdated', rdetailReload);
+ attachEvt('common','holdUpdateCanceled', rdetailReload);
+
+ copyRowParent = G.ui.rdetail.cp_info_row.parentNode;
+ copyRow = copyRowParent.removeChild(G.ui.rdetail.cp_info_row);
+ statusRow = G.ui.rdetail.cp_status.parentNode;
+ statusRow.id = '__rdsrow';
+
+ G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies;
+ G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies;
+
+ if(getLocation() == globalOrgTree.id())
+ hideMe(G.ui.rdetail.cp_info_all);
+
+ if(getRid()) {
+
+ var req = new Request(FETCH_RMODS, getRid());
+ req.callback(_rdetailDraw);
+ req.send();
+
+ } else { // No record ID was specified
+
+ // If we have an ISBN in the URL, let's try to find that record
+ // This allows direct linking by ISBN.
+ // Note, this uses the first record it finds
+ if(getRtype() == RTYPE_ISBN) {
+ var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() );
+ req.callback(
+ function(r) {
+ var blob = r.getResultObject();
+ if(blob && blob.count > 0)
+ RID = blob.ids[0];
+ var req2 = new Request(FETCH_RMODS, getRid());
+ req2.callback(_rdetailDraw);
+ req2.send();
+ }
+ );
+ req.send();
+ }
+ }
+
+
+ if (rdetailDisplaySerialHoldings && (
+ isXUL() || !fetchOrgSettingDefault(
+ getLocation(), "opac.fully_compressed_serial_holdings")
+ )
+ ) {
+ var req = new Request(FETCH_MFHD_SUMMARY, getRid());
+ req.callback(_holdingsDraw);
+ req.send();
+ if (isXUL()) {
+ var here = findOrgUnit(getLocation());
+ dojo.place("<div id='mfhd_ad_menu'></div>", "rdetail_details_table", "after");
+ var mfhd_add = new dijit.Menu({style:"float: right;"});
+ new dijit.MenuItem({onClick:function(){
+ var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid());
+ var res = req.send();
+ alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()]));
+ }, label:opac_strings.CREATE_MFHD}).placeAt(mfhd_add);
+ mfhd_add.placeAt(mfhd_ad_menu);
+ }
+ }
+
+ detachAllEvt("result", "idsReceived");
+ G.evt.result.hitCountReceived = [];
+ G.evt.result.recordReceived = [];
+ G.evt.result.copyCountsReceived = [];
+ G.evt.result.allRecordsReceived = [];
+
+ if(isXUL())
+ unHideMe($('rdetail_show_orders'));
+}
+
+function rdetailGetPageIds() {
+ attachEvt("result", "idsReceived", rdetailSetPaging );
+ resultFetchAllRecords = true;
+ rresultCollectIds(true);
+}
+
+
+function buildunAPISpan (span, type, id) {
+ var cgi = new CGI();
+ var d = new Date();
+
+ addCSSClass(span,'unapi-id');
+
+ span.setAttribute(
+ 'title', 'tag:' + cgi.server_name + ',' +
+ d.getFullYear() + ':' + type + '/' + id
+ );
+}
+
+function rdetailViewMarc(r,id) {
+ hideMe($('rdetail_extras_loading'));
+ $('rdetail_view_marc_box').innerHTML = r.getResultObject();
+
+ var div = elem('div', { "class" : 'hide_me' });
+ var span = div.appendChild( elem('abbr') );
+
+ buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
+
+ $('rdetail_view_marc_box').insertBefore(span, $('rdetail_view_marc_box').firstChild);
+}
+
+function rdetailForeignItems(r,id) {
+ hideMe($('rdetail_extras_loading'));
+ var tbody = $('rdetail_foreign_items_tbody');
+
+ var robj = r.getResultObject(); /* mvr list with foreign_copy_maps fleshed */
+
+ for (var i = 0; i < robj.length; i++) {
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = robj[i].doc_id();
+ var row = elem('tr'); tbody.appendChild(row);
+ var td1 = elem('td'); row.appendChild(td1);
+ var title = elem(
+ 'a',
+ {
+ 'href' : buildOPACLink(args),
+ 'class' : 'classic_link'
+ },
+ robj[i].title()
+ );
+ td1.appendChild(title);
+ var td2 = elem('td',{},robj[i].author()); row.appendChild(td2);
+ var td3 = elem('td'); row.appendChild(td3);
+ var details = elem(
+ 'a',
+ {
+ 'href' : 'javascript:void(0)',
+ 'class' : 'classic_link'
+ },
+ 'Copy Details'
+ );
+ details.onclick = function(idx,context_row){
+ return function() {
+ cpdBuild(
+ tbody,
+ context_row,
+ robj[idx],
+ null,
+ 1,
+ 0,
+ 1,
+ dojo.map(
+ robj[idx].foreign_copy_maps(),
+ function(x){ return x.target_copy(); }
+ ),
+ dojo.map(
+ robj[idx].foreign_copy_maps(),
+ function(x){ return x.peer_type().name(); }
+ )
+ );
+ };
+ }(i,row);
+ td3.appendChild(details);
+ }
+}
+
+
+
+function rdetailShowLocalCopies() {
+ rdetailShowLocal = true;
+ rdetailBuildInfoRows();
+ hideMe(G.ui.rdetail.cp_info_local);
+ unHideMe(G.ui.rdetail.cp_info_all);
+ hideMe(G.ui.rdetail.cp_info_none);
+}
+
+function rdetailShowAllCopies() {
+
+ rdetailShowLocal = false;
+ rdetailBuildInfoRows();
+ hideMe(G.ui.rdetail.cp_info_all);
+ unHideMe(G.ui.rdetail.cp_info_local);
+ hideMe(G.ui.rdetail.cp_info_none);
+}
+
+function OpenMarcEditWindow(pcrud, rec) {
+ /*
+ To run in Firefox directly, must set signed.applets.codebase_principal_support
+ to true in about:config
+ */
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+ dojo.require('openils.PermaCrud');
+
+ win.xulG = {
+ "record": {"marc": rec.marc(), "rtype": "sre"},
+ "save": {
+ "label": opac_strings.SAVE_MFHD_LABEL,
+ "func": function(xmlString) {
+ rec.marc(xmlString);
+ rec.edit_date('now');
+ rec.ischanged(true);
+ pcrud.update(rec);
+ }
+ },
+ 'lock_tab' : typeof xulG != 'undefined' ? (typeof xulG['lock_tab'] != 'undefined' ? xulG.lock_tab : undefined) : undefined,
+ 'unlock_tab' : typeof xulG != 'undefined' ? (typeof xulG['unlock_tab'] != 'undefined' ? xulG.unlock_tab : undefined) : undefined
+ };
+}
+
+function loadMarcEditor(recId) {
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var rec = pcrud.retrieve("sre", recId);
+ if (rec) {
+ OpenMarcEditWindow(pcrud, rec);
+ }
+}
+
+/*
+ * This function could be written much more intelligently
+ * Limited brain power means that I'm brute-forcing it for now
+ */
+function _holdingsDraw(h) {
+ holdings = h.getResultObject();
+
+ if (holdings) {
+ // Only draw holdings within our OU scope
+ var here = findOrgUnit(getLocation());
+ var entryNum = 0;
+ var depth = getDepth();
+ dojo.forEach(holdings, function (item) {
+ if (orgIsMine(here, findOrgUnit(item.owning_lib()), depth)) {
+ _holdingsDrawMFHD(item, entryNum);
+ entryNum++;
+ }
+ });
+ }
+
+ // Populate (or unpopulate) XUL menus
+ if (isXUL()) {
+ runEvt('rdetail','MFHDDrawn');
+ }
+}
+
+function _holdingsDrawMFHD(holdings, entryNum) {
+ var hb = holdings.basic_holdings();
+ var hba = holdings.basic_holdings_add();
+ var hs = holdings.supplement_holdings();
+ var hsa = holdings.supplement_holdings_add();
+ var hi = holdings.index_holdings();
+ var hia = holdings.index_holdings_add();
+ var ho = holdings.online();
+ var hm = holdings.missing();
+ var hinc = holdings.incomplete();
+ var hloc = holdings.location() || 'MFHD';
+
+ if ( hb.length == 0 && hba.length == 0 && hs.length == 0 &&
+ hsa.length == 0 && hi.length == 0 && hia.length == 0 &&
+ ho.length == 0 && hm.length == 0 && hinc.length == 0
+ ) {
+
+ if (isXUL()) {
+ /*
+ * If we have a record, but nothing to show for it, then the
+ * record is likely empty or corrupt. This gives cataloguers a
+ * chance to add holdings or correct the record
+ */
+ hb = ['PLACEHOLDER'];
+ } else {
+ return null;
+ }
+ }
+
+ // Show entryNum + 1 in staff client for better menu correlation
+ // Maybe this should be holdings.sre_id() instead? (which could get long after time)
+ var entryNumString = '';
+ if (isXUL()) {
+ var entryNumInc = entryNum + 1;
+ entryNumString = ' [Entry #'+entryNumInc+'] ';
+ }
+
+ var refNode;
+ if (entryNum > 0) {
+ refNode = 'rdetail_holdings_table_' + (entryNum - 1);
+ } else {
+ refNode = 'rdetail_details_table';
+ }
+
+ dojo.place("<table style='width: 100%;' id='rdetail_holdings_table_"+entryNum+"'><caption id='mfhdHoldingsCaption" + entryNum + "' class='rdetail_header color_1'>" +
+ dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) + entryNumString +
+ "</caption><tbody id='rdetail_holdings_tbody_" + entryNum +
+ "'></tbody></table>", refNode, "after"
+ );
+ if (hb.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.BASIC_HOLDINGS, hb); }
+ if (hba.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.BASIC_HOLDINGS_ADD, hba); }
+ if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENT_HOLDINGS, hs); }
+ if (hsa.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.SUPPLEMENT_HOLDINGS_ADD, hsa); }
+ if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEX_HOLDINGS, hi); }
+ if (hia.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INDEX_HOLDINGS_ADD, hia); }
+ if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.ONLINE_VOLUMES, ho); }
+ if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.MISSING_VOLUMES, hm); }
+ if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, opac_strings.INCOMPLETE_VOLUMES, hinc); }
+
+ if (isXUL() && holdings.sre_id() != -1) { // -1 indicates in-DB only holdings, so no button or menu entries for MFHD
+ mfhdDetails.push({ 'id' : holdings.sre_id(), 'label' : hloc, 'entryNum' : entryNum, 'owning_lib' : holdings.owning_lib() });
+ dojo.require('openils.Event');
+ dojo.require('openils.PermaCrud');
+ var mfhd_edit = new dijit.Menu({});
+ new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.sre_id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first");
+ new dijit.MenuItem({onClick:function(){
+ // Avoid accidental deletion of MFHD records
+ if (!confirm(opac_strings.DELETE_MFHD_CONFIRM)) {
+ return;
+ }
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var mfhd_rec = pcrud.retrieve("sre", holdings.sre_id());
+ if (mfhd_rec) {
+ pcrud.eliminate(mfhd_rec);
+ alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.sre_id()]));
+ }
+ }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last");
+ // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.sre_id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last");
+ var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"});
+ mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last");
+ mfhd_edit.startup();
+ }
+}
+
+function _holdingsDrawMFHDEntry(entryNum, entryName, entry) {
+ var flatEntry = entry.toString().replace(/,/g, ', ');
+ dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>" + entryName + "</td><td class='rdetail_item'>" + flatEntry + "</td></tr>", "rdetail_holdings_tbody_" + entryNum, "last");
+}
+
+function _rdetailDraw(r) {
+ record = r.getResultObject();
+
+ runEvt('rdetail', 'recordRetrieved', record.doc_id());
+
+ G.ui.rdetail.title.appendChild(text(record.title()));
+ buildSearchLink(STYPE_AUTHOR, record.author(), G.ui.rdetail.author);
+ G.ui.rdetail.isbn.appendChild(text(cleanISBN(record.isbn())));
+ G.ui.rdetail.edition.appendChild(text(record.edition()));
+ G.ui.rdetail.pubdate.appendChild(text(record.pubdate()));
+ G.ui.rdetail.publisher.appendChild(text(record.publisher()));
+ $('rdetail_physical_desc').appendChild(text(record.physical_description()));
+ r = record.types_of_resource();
+ if(r) {
+ G.ui.rdetail.tor.appendChild(text(r[0]));
+ setResourcePic( G.ui.rdetail.tor_pic, r[0]);
+ }
+ G.ui.rdetail.abstr.appendChild(text(record.synopsis()));
+
+ try{
+ if(record.isbn()) {
+ if(ENABLE_ADDED_CONTENT_ATTRIB_LINKS) {
+ unHideMe($('rdetail.jacket_attrib_div'));
+ var href = $('rdetail.jacket_attrib_link').getAttribute('href') +cleanISBN(record.isbn());
+ $('rdetail.jacket_attrib_link').setAttribute('href', href);
+ }
+ rdetailCheckForGBPreview();
+
+ } else {
+ hideMe($("rdetail.jacket_attrib_div"));
+ hideMe($("rdetail_img_link"));
+ }
+ } catch(E) {}
+
+
+ // see if the record has any external links
+ var links = record.online_loc();
+ for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) {
+ var href = links[i];
+ // avoid matching "HTTP: The Complete Reference"
+ if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) {
+ unHideMe($('rdetail_online_row'));
+ // MODS can contain a display label (used for the text of the link)
+ // as well as a note about the URL; many legacy systems conflate the
+ // two and generate MARC records that expect the note to be used as
+ // the text of the link, with no display label; here's the canonical
+ // format:
+ //
+ // 856 40 $uhttp://localhost$yDisplay label$zPublic note
+ //
+ // Note that the MARC21slim2MODS XSL concatenates $3 and $y together
+ // (as $y was defined later in MARC21's life as the display label)
+ var displayLabel = '' + links[i+1];
+ var note = '' + links[i+2];
+ if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) {
+ if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) {
+ displayLabel = href;
+ } else {
+ displayLabel = note;
+ }
+ }
+ $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel));
+ if (note && note != displayLabel) {
+ $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note));
+ }
+ $('rdetail_online').appendChild(elem('br'));
+ }
+ }
+
+ // Fill in our unAPI ID, if anyone cares
+ var abbrs = document.getElementsByTagName('abbr');
+ var span;
+ for (var i = 0; i < abbrs.length; i++) {
+ if (abbrs[i].getAttribute('name') == 'unapi') {
+ span = abbrs[i];
+ break;
+ }
+ }
+ buildunAPISpan( span, 'biblio-record_entry', record.doc_id() );
+
+ $('rdetail_place_hold').onclick = function() {
+ var src = location.href;
+
+ if(forceLoginSSL && src.match(/^http:/)) {
+
+ src = src.replace(/^http:/, 'https:');
+
+ if(!src.match(/&place_hold=1/)) {
+ src += '&place_hold=1';
+ }
+
+ location.href = src;
+
+ } else {
+ holdsDrawEditor({record:record.doc_id(), type:'T'});
+ }
+ }
+
+
+ var RW = $('rdetail_exp_refworks');
+ if (RW && rdetailEnableRefWorks) {
+
+ var here = (findOrgUnit(getLocation())).name();
+ var org_name = here.replace(" ", "+");
+ var cgi = new CGI();
+
+ RW.setAttribute(
+ 'href',
+ rdetailRefWorksHost + '/express/expressimport.asp?vendor='
+ + org_name
+ + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
+ + cgi.server_name + '/opac/extras/supercat/marctxt/record/'
+ + record.doc_id()
+ );
+
+ RW.setAttribute('target', 'RefWorksMain');
+
+ unHideMe($('rdetail_exp_refworks_span'));
+ }
+
+ $('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large'));
+ G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
+ runEvt("rdetail", "recordDrawn");
+ recordsCache.push(record);
+
+ rdetailSetExtrasSelector();
+
+ var breq = new Request(FETCH_BRE, [getRid()]);
+ breq.callback( rdetailCheckDeleted );
+ breq.send();
+
+ //resultBuildCaches( [ record ] );
+ //resultDrawSubjects();
+ //resultDrawSeries();
+
+ // grab added content
+
+ // Proxied through Evergreen AddedContent module
+ acCollectData(cleanISBN(record.isbn()), rdetailhandleAC);
+
+ var currentISBN = cleanISBN(record.isbn());
+
+ // Not proxied, cross-site javascript
+
+ // ChiliFresh
+ if (chilifresh && chilifresh != '(none)' && currentISBN) {
+ $('chilifreshReviewLink').setAttribute('id','isbn_'+currentISBN);
+ $('chilifreshReviewResult').setAttribute('id','chili_review_'+currentISBN);
+ unHideMe($('rdetail_reviews_link'));
+ unHideMe($('rdetail_chilifresh_reviews'));
+ try {
+ chili_init();
+ } catch(E) {
+ console.log(E + '\n');
+ hideMe($('rdetail_reviews_link'));
+ hideMe($('rdetail_chilifresh_reviews'));
+ }
+ }
+
+ // Novelist
+ if (novelist && currentISBN) {
+ unHideMe($('rdetail_novelist_link'));
+ }
+
+ // Multi-Home / Foreign Items / Peer Bibs
+ var req = new Request( TEST_PEER_BIBS, record.doc_id() );
+ req.callback(function(r){
+ var test = r.getResultObject();
+ if (test == "1") {
+ unHideMe($('rdetail_foreign_items_link'));
+ }
+ });
+ req.send();
+}
+
+
+
+function rdetailCheckDeleted(r) {
+ var br = r.getResultObject()[0];
+ if( isTrue(br.deleted()) ) {
+ hideMe($('rdetail_place_hold'));
+ $('rdetail_more_actions_selector').disabled = true;
+ unHideMe($('rdetail_deleted_exp'));
+ }
+}
+
+function rdetailSetExtrasSelector() {
+ if(!grabUser()) return;
+ unHideMe($('rdetail_more_actions'));
+
+ var req = new Request(
+ FETCH_CONTAINERS, G.user.session, G.user.id(), 'biblio', 'bookbag' );
+ req.callback(rdetailAddBookbags);
+ req.send();
+}
+
+function rdetailAddBookbags(r) {
+
+ var containers = r.getResultObject();
+ var selector = $('rdetail_more_actions_selector');
+ var found = false;
+ var index = 3;
+ doSelectorActions(selector);
+
+ for( var i = 0; i < containers.length; i++ ) {
+ found = true;
+ var container = containers[i];
+ insertSelectorVal( selector, index++, container.name(),
+ "container_" + container.id(), rdetailAddToBookbag, 1 );
+ }
+
+ nextContainerIndex = index;
+}
+
+var _actions = {};
+/**
+ * Adds a new bookbag and exits.
+ *
+ * exitstatus should be 0 if the status is to be read.
+ */
+function finishBookbag(exitstatus) {
+ var name = bbName.attr('value');
+
+ newBBDialog.hide();
+ bbName.attr("value", ""); // Do this after hide so the text doesn't disappear.
+
+ if(exitstatus != 0) return; // If the user canceled, just drop off here.
+
+ var id;
+
+ if( id = containerCreate( name ) ) {
+ alert( $('rdetail_bb_success').innerHTML );
+ var selector = $('rdetail_more_actions_selector');
+ insertSelectorVal( selector, nextContainerIndex++, name,
+ "container_" + id, rdetailAddToBookbag, 1 );
+ setSelector( selector, 'start' );
+ }
+}
+
+/**
+ * Creates a new Bookbag for the user.
+ */
+function rdetailNewBookbag() {
+ newBBDialog.show(); // Show the bookbag dialog.
+ dojo.connect(dijit.byId('newBBDialog'), 'onKeyPress', function(evt) {
+ if (evt.keyCode == dojo.keys.ENTER) {
+ finishBookbag(0);
+ }
+ });
+}
+
+function rdetailAddToBookbag() {
+ var selector = $('rdetail_more_actions_selector');
+ var id = selector.options[selector.selectedIndex].value;
+ setSelector( selector, 'start' );
+
+ if( containerCreateItem( id.substring(10), record.doc_id() )) {
+ alert($('rdetail_bb_item_success').innerHTML);
+ }
+}
+
+
+var rdetailMarcFetched = false;
+var rdetailForeignItemsFetched = false;
+function rdetailShowExtra(type, args) {
+
+ hideMe($('rdetail_copy_info_div'));
+ hideMe($('rdetail_summary_div'));
+ hideMe($('rdetail_reviews_div'));
+ hideMe($('rdetail_toc_div'));
+ hideMe($('rdetail_anotes_div'));
+ hideMe($('rdetail_excerpt_div'));
+ hideMe($('rdetail_preview_div'));
+ hideMe($('rdetail_marc_div'));
+ hideMe($('cn_browse'));
+ hideMe($('rdetail_cn_browse_div'));
+ hideMe($('rdetail_novelist_div'));
+ hideMe($('rdetail_foreign_items_div'));
+ hideMe($('rdetail_notes_div'));
+
+ removeCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_summary_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_annotation_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
+ removeCSSClass($('rdetail_foreign_items_link'), 'rdetail_extras_selected');
+
+ switch(type) {
+
+ case "copyinfo":
+ unHideMe($('rdetail_copy_info_div'));
+ addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
+ break;
+
+ case "summary":
+ addCSSClass($('rdetail_summary_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_summary_div'));
+ break;
+
+ case "reviews":
+ addCSSClass($('rdetail_reviews_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_reviews_div'));
+ break;
+
+ case "excerpt":
+ addCSSClass($('rdetail_excerpt_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_excerpt_div'));
+ break;
+
+ case "preview":
+ addCSSClass($('rdetail_preview_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_preview_div'));
+ rdetailDisplayGBPreview();
+ break;
+
+ case "anotes":
+ addCSSClass($('rdetail_anotes_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_anotes_div'));
+ break;
+
+ case "toc":
+ addCSSClass($('rdetail_toc_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_toc_div'));
+ break;
+
+ case "marc":
+ addCSSClass($('rdetail_viewmarc_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_marc_div'));
+ if(rdetailMarcFetched) return;
+ unHideMe($('rdetail_extras_loading'));
+ rdetailMarcFetched = true;
+ var req = new Request( FETCH_MARC_HTML, record.doc_id() );
+ req.callback(rdetailViewMarc);
+ req.send();
+ break;
+
+ case "novelist":
+ addCSSClass($('rdetail_novelist_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_novelist_div'));
+ break;
+
+ case "foreign_items":
+ addCSSClass($('rdetail_foreign_items_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_foreign_items_div'));
+ if(rdetailForeignItemsFetched) return;
+ unHideMe($('rdetail_extras_loading'));
+ rdetailForeignItemsFetched = true;
+ var req = new Request( FETCH_PEER_BIBS, record.doc_id() );
+ req.callback(rdetailForeignItems);
+ req.send();
+ break;
+
+ case 'cn':
+ addCSSClass($('rdetail_viewcn_link'), 'rdetail_extras_selected');
+ unHideMe($('rdetail_cn_browse_div'));
+ rdetailShowCNBrowse(defaultCN[1], getLocation(), null, true);
+ break;
+
+ }
+}
+
+function rdetailVolumeDetails(args) {
+ var row = $(args.rowid);
+ var tbody = row.parentNode;
+ cpdBuild( tbody, row, record, [args.cn_prefix, args.cn, args.cn_suffix], args.org, args.depth, args.copy_location );
+ return;
+}
+
+function rdetailBuildCNList() {
+
+ var select = $('cn_browse_selector');
+ var index = 0;
+ var arr = [];
+ for( var cn_json in callnumberCache ) arr.push( cn_json );
+ arr.sort();
+
+ if( arr.length == 0 ) {
+ hideMe($('rdetail_cn_browse_select_div'));
+ return;
+ }
+
+ for( var i = 0; i < arr.length; i++ ) {
+ var cn_json = arr[i];
+ var cn = JSON2js(cn_json);
+ var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
+ var opt = new Option(whole_cn_text,cn_json);
+ select.options[index++] = opt;
+ }
+ select.onchange = rdetailGatherCN;
+}
+
+function rdetailGatherCN() {
+ var cn = getSelectorVal($('cn_browse_selector'));
+ rdetailShowCNBrowse( JSON2js(cn), getLocation(), getDepth(), true );
+ setSelector( $('cn_browse_selector'), cn );
+}
+
+
+function rdetailShowCNBrowse( cn, loc, depth, fromOnclick ) {
+
+ if(!cn) {
+ unHideMe($('cn_browse_none'));
+ hideMe($('rdetail_cn_browse_select_div'));
+ return;
+ }
+
+ unHideMe($('rdetail_cn_browse_select_div'));
+ rdetailBuildCNList();
+ setSelector( $('cn_browse_selector'), js2JSON(cn) );
+ hideMe($('rdetail_copy_info_div'));
+ hideMe($('rdetail_reviews_div'));
+ hideMe($('rdetail_summary_div'));
+ hideMe($('rdetail_toc_div'));
+ hideMe($('rdetail_marc_div'));
+ unHideMe($('rdetail_cn_browse_div'));
+ unHideMe($('cn_browse'));
+ if( !rdetailLocalOnly && ! fromOnclick ) depth = findOrgDepth(globalOrgTree);
+ cnBrowseGo(cn, loc, depth);
+}
+
+function rdetailhandleAC(data) {
+
+ if( data.summary.html ) {
+ $('rdetail_summary_div').innerHTML = data.summary.html;
+ unHideMe($('rdetail_summary_link'));
+ }
+
+ if( data.reviews.html ) {
+ $('rdetail_review_container').innerHTML = data.reviews.html;
+ unHideMe($('rdetail_reviews_link'));
+ }
+
+ if( data.toc.html ) {
+ $('rdetail_toc_div').innerHTML = data.toc.html;
+ unHideMe($('rdetail_toc_link'));
+ }
+
+ if( data.excerpt.html ) {
+ $('rdetail_excerpt_div').innerHTML = data.excerpt.html;
+ unHideMe($('rdetail_excerpt_link'));
+ }
+
+ if( data.anotes.html ) {
+ $('rdetail_anotes_div').innerHTML = data.anotes.html;
+ unHideMe($('rdetail_anotes_link'));
+ }
+}
+
+function rdetailShowReviews(r) {
+ hideMe($('rdetail_extras_loading'));
+ var res = r.getResultObject();
+ var par = $('rdetail_reviews_div');
+ var template = par.removeChild($('rdetail_review_template'));
+ if( res && res.length > 0 ) {
+ unHideMe($('rdetail_reviews_link'));
+ for( var i = 0; i < res.length; i++ ) {
+ var rev = res[i];
+ if( rev.text && rev.info ) {
+ var node = template.cloneNode(true);
+ $n(node, 'review_header').appendChild(text(rev.info));
+ $n(node, 'review_text').appendChild(text(rev.text));
+ par.appendChild(node);
+ }
+ }
+ }
+}
+
+
+function rdetailShowTOC(r) {
+ hideMe($('rdetail_extras_loading'));
+ var resp = r.getResultObject();
+ if(resp) {
+ unHideMe($('rdetail_toc_link'));
+ $('rdetail_toc_div').innerHTML = resp;
+ }
+}
+
+function rdetailBuildInfoRows() {
+ var req;
+ var method = FETCH_COPY_COUNTS_SUMMARY;
+ if (rdetailShowCopyLocation)
+ method = FETCH_COPY_LOCATION_COUNTS_SUMMARY;
+ if( rdetailShowLocal )
+ req = new Request(method, record.doc_id(), getLocation(), getDepth())
+ else
+ req = new Request(method, record.doc_id());
+ req.callback(_rdetailBuildInfoRows);
+ req.send();
+}
+
+function _rdetailRows(node) {
+
+ if( rdetailShowLocal && getLocation() != globalOrgTree.id() ) {
+ var loc = findOrgUnit(getLocation());
+ if( node ) {
+ if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return;
+ } else {
+ var kids = globalOrgTree.children();
+ if (kids) {
+ for( var i = 0; i < kids.length; i++ ) {
+ var org = findOrgUnit(kids[i]);
+ if( orgIsMine(org, loc) ) {
+ node = org;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols())
+ node = globalOrgTree;
+
+
+ /* don't show hidden orgs */
+
+ if(node) {
+
+ if(!isXUL() && !isTrue(node.opac_visible())) return;
+
+ if (orgHiding) {
+ if (isTrue( findOrgType(node.ou_type()).can_have_vols() )) {
+ if ( ! orgIsMine( orgHiding.org, node, orgHiding.depth ) ) {
+ return;
+ }
+ }
+ }
+
+ var row = copyRow.cloneNode(true);
+ row.id = "cp_info_" + node.id();
+
+ var libtd = findNodeByName( row, config.names.rdetail.lib_cell );
+ var cntd = findNodeByName( row, config.names.rdetail.cn_cell );
+ var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell );
+ var actions = $n(row, 'rdetail_actions_cell');
+
+ var p = libtd.getElementsByTagName('a')[0];
+ libtd.insertBefore(text(node.name()), p);
+ libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;");
+
+ if(!findOrgType(node.ou_type()).can_have_vols()) {
+
+ row.removeChild(cntd);
+ row.removeChild(cpctd);
+ row.removeChild(actions);
+ row.setAttribute('novols', '1');
+
+ libtd.setAttribute("colspan", numStatuses + 3 );
+ libtd.colSpan = numStatuses + 3;
+ addCSSClass(row, 'copy_info_region_row');
+ }
+
+ copyRowParent.appendChild(row);
+
+ } else { node = globalOrgTree; }
+
+ var kids = node.children();
+ if (kids) {
+ for( var c = 0; c < kids.length; c++ )
+ _rdetailRows(kids[c]);
+ }
+}
+
+function rdetailCNPrint(orgid, cn) {
+ var div = cpdBuildPrintWindow( record, orgid);
+ var template = div.removeChild($n(div, 'cnrow'));
+ var rowNode = $("cp_info_" + orgid);
+ cpdStylePopupWindow(div);
+ openWindow(div.innerHTML);
+}
+
+var localCNFound = false;
+var ctr = 0;
+function _rdetailBuildInfoRows(r) {
+
+ if (rdetailShowCopyLocation)
+ unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ) );
+
+ removeChildren(copyRowParent);
+
+ orgHiding = checkOrgHiding();
+
+ _rdetailRows();
+
+ var summary = r.getResultObject();
+ if(!summary) return;
+
+ var found = false;
+ for( var i = 0; i < summary.length; i++ ) {
+
+ var arr = summary[i];
+ globalCNCache[js2JSON([arr[1],arr[2],arr[3]])] = 1; // prefix, label, suffix. FIXME - Am I used anywhere?
+ var thisOrg = findOrgUnit(arr[0]);
+ var rowNode = $("cp_info_" + thisOrg.id());
+ if(!rowNode) continue;
+
+ if(rowNode.getAttribute("used")) {
+
+ if( rowNode.nextSibling ) {
+ sib = rowNode.nextSibling;
+ o ='cp_info_'+thisOrg.id()+'_';
+ /* push the new row on as the last row for this org unit */
+ while( sib && sib.id.match(o) ) {
+ sib = sib.nextSibling;
+ }
+ if(sib)
+ rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
+ else
+ rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
+ } else {
+ rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
+ }
+
+ var n = findNodeByName( rowNode, config.names.rdetail.lib_cell );
+ n.appendChild(text(thisOrg.name()));
+ n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;");
+ rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr);
+
+ } else {
+ rowNode.setAttribute("used", "1");
+ }
+
+ var cpc_temp = rowNode.removeChild(
+ findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
+
+ var statuses = arr[4];
+ var cl = '';
+ if (rdetailShowCopyLocation) {
+ cl = arr[4];
+ statuses = arr[5];
+ }
+
+
+ rdetailApplyStatuses(rowNode, cpc_temp, statuses);
+
+ var isLocal = false;
+ if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) {
+ found = true;
+ isLocal = true;
+ if(!localCNFound) {
+ localCNFound = true;
+ defaultCN = [arr[1],arr[2],arr[3]]; // prefix, label, suffix
+ }
+ }
+
+ //if(isLocal) unHideMe(rowNode);
+ unHideMe(rowNode);
+
+ rdetailSetPath( thisOrg, isLocal );
+ rdetailBuildBrowseInfo( rowNode, [arr[1],arr[2],arr[3]], isLocal, thisOrg, cl );
+
+ if( i == summary.length - 1 && !defaultCN) defaultCN = [arr[1],arr[2],arr[3]]; // prefix, label, suffix
+ }
+
+ if(!found) unHideMe(G.ui.rdetail.cp_info_none);
+}
+
+function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
+
+ var whole_cn_json = js2JSON(cn);
+ var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
+
+ if(local) {
+ var cache = callnumberCache[whole_cn_json];
+ if( cache ) cache.count++;
+ else callnumberCache[whole_cn_json] = { count : 1 };
+ }
+
+ var depth = getDepth();
+ if( !local ) depth = findOrgDepth(globalOrgTree);
+
+ $n(row, 'rdetail_callnumber_cell').appendChild(text(whole_cn_text));
+
+ if (rdetailShowCopyLocation) {
+ var cl_cell = $n(row, 'rdetail_copylocation_cell');
+ cl_cell.appendChild(text(cl));
+ unHideMe(cl_cell);
+ }
+
+ _debug('setting action clicks for cn ' + whole_cn_text);
+
+ var dHref = 'javascript:rdetailVolumeDetails('+
+ '{copy_location : "'+cl.replace(/\"/g, '\\"')+'", rowid : "'+row.id+'", cn_prefix :"'+cn[0].replace(/\"/g, '\\"')+'",cn :"'+cn[1].replace(/\"/g, '\\"')+'",cn_suffix :"'+cn[2].replace(/\"/g, '\\"')+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});';
+
+ var bHref = 'javascript:rdetailShowCNBrowse("'+cn[1].replace(/\"/g, '\\"') + '", '+orgNode.id()+', "'+depth+'");';
+
+ unHideMe( $n(row, 'details') )
+ $n(row, 'details').setAttribute('href', dHref);
+ unHideMe( $n(row, 'browse') )
+ $n(row, 'browse').setAttribute('href', bHref);
+
+ if(isXUL()) {
+ unHideMe($n(row, 'hold_div'));
+ $n(row, 'hold').onclick = function() {
+ var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id());
+ req.callback(
+ function(r) {
+ var vol = r.getResultObject();
+ holdsDrawEditor({type: 'V', volumeObject : vol});
+ }
+ );
+ req.send();
+ };
+ }
+}
+
+// sets the path to org as 'active' and displays the path if it's local
+function rdetailSetPath(org, local) {
+ if( findOrgDepth(org) == 0 ) return;
+ var row = $("cp_info_" + org.id());
+ row.setAttribute("hasinfo", "1");
+ unHideMe(row);
+ rdetailSetPath(findOrgUnit(org.parent_ou()), local);
+}
+
+//Append all the statuses for a given summary to the
+//copy summary table
+function rdetailApplyStatuses( row, template, statuses ) {
+ for( var j in _statusPositions ) {
+ var stat = _statusPositions[j];
+ var val = statuses[stat.id()];
+ var nn = template.cloneNode(true);
+ if(val) nn.appendChild(text(val));
+ else nn.appendChild(text(0));
+ row.appendChild(nn);
+ }
+}
+
+//Add one td (creating a new column) to the copy summary
+//table for each opac_visible copy status
+function rdetailBuildStatusColumns() {
+
+ rdetailGrabCopyStatuses();
+ var parent = statusRow;
+ var template = parent.removeChild(G.ui.rdetail.cp_status);
+
+ var i = 0;
+ for( i = 0; i < cp_statuses.length; i++ ) {
+
+ var c = cp_statuses[i];
+ if( c && isTrue(c.opac_visible()) ) {
+ var name = c.name();
+ _statusPositions[i] = c;
+ var node = template.cloneNode(true);
+ var data = findNodeByName( node, config.names.rdetail.cp_status);
+
+ data.appendChild(text(name));
+ parent.appendChild(node);
+ }
+ }
+
+ numStatuses = 0;
+ for(x in _statusPositions) numStatuses++;
+}
+
+function rdetailGrabCopyStatuses() {
+ if(cp_statuses) return cp_statuses;
+ var req = new Request(FETCH_COPY_STATUSES);
+ req.send(true);
+ cp_statuses = req.result();
+ cp_statuses = cp_statuses.sort(_rdetailSortStatuses);
+}
+
+function _rdetailSortStatuses(a, b) {
+ return parseInt(a.id()) - parseInt(b.id());
+}
+
+/**
+ * Check for a Google Book preview after the main page loads
+ */
+function rdetailCheckForGBPreview() {
+ if (!rdetailGoogleBookPreview) return;
+ dojo.addOnLoad(function() {
+ searchForGBPreview( cleanISBN(record.isbn()) );
+ });
+}
+
+/**
+ *
+ * @param {DOM object} isbn The form element containing the input parameters "isbns"
+ */
+function searchForGBPreview( isbn ) {
+ dojo.require("dojo.io.script");
+ dojo.io.script.get({"url": "https://www.google.com/jsapi"});
+ dojo.io.script.get({"url": "http://books.google.com/books", "content": { "bibkeys": isbn, "jscmd": "viewapi", "callback": "GBPreviewCallback"}});
+}
+
+/**
+ * This function is the call-back function for the JSON scripts which
+ * executes a Google book search response.
+ *
+ * XXX I18N of text needed
+ *
+ * @param {JSON} GBPBookInfo is the JSON object pulled from the Google books service.
+ */
+function GBPreviewCallback(GBPBookInfo) {
+ var GBPreviewDiv = document.getElementById("rdetail_preview_div");
+ var GBPBook;
+
+ for ( i in GBPBookInfo ) {
+ GBPBook = GBPBookInfo[i];
+ }
+
+ if ( !GBPBook ) {
+ return;
+ }
+
+ if ( GBPBook.preview != "noview" ) {
+ // Add a button below the book cover image to load the preview.
+ GBPBadge = document.createElement( 'img' );
+ GBPBadge.src = 'http://books.google.com/intl/en/googlebooks/images/gbs_preview_button1.gif';
+ GBPBadge.title = $('rdetail_preview_badge').innerHTML;
+ GBPBadge.style.border = 0;
+ GBPBadgelink = document.createElement( 'a' );
+ GBPBadgelink.href = 'javascript:rdetailShowExtra("preview");';
+ GBPBadgelink.appendChild( GBPBadge );
+ $('rdetail_image_cell').appendChild( GBPBadgelink );
+ $('rdetail_preview_div').style.height = 600;
+
+ /* Display the "Preview" tab in the Extras section */
+ unHideMe( $('rdetail_preview_link' ) );
+ }
+}
+
+/**
+ * This is called when the user clicks on the 'Preview' link. We assume
+ * a preview is available from Google if this link was made visible.
+ *
+ * XXX I18N of Google Book Preview language attribute needed
+ */
+function rdetailDisplayGBPreview() {
+ unHideMe($('rdetail_extras_loading'));
+ GBPreviewPane = $('rdetail_preview_div');
+ if ( GBPreviewPane.getAttribute('loaded') == null ||
+ GBPreviewPane.getAttribute('loaded') == "false" ) {
+ google.load("books", "0", {"callback" : rdetailGBPViewerLoadCallback, "language": "en"} );
+ GBPreviewPane.setAttribute('loaded', 'true');
+ }
+}
+
+function rdetailGBPViewerLoadCallback() {
+ hideMe($('rdetail_extras_loading'));
+ var GBPViewer = new google.books.DefaultViewer(document.getElementById('rdetail_preview_div'));
+ GBPViewer.load('ISBN:' + cleanISBN(record.isbn()) );
+
+}
+
+function rdetailDrawExpandedHoldings(anchor, bibid, type) {
+ var offsets = {"basic": 0, "index": 0, "supplement": 0};
+ var limit = 10; /* XXX give user control over this? */
+ var target_id = "holding_type_" + type;
+ var target = dojo.byId(target_id);
+
+ anchor.innerHTML = "[-]";
+ anchor.oldonclick = anchor.onclick;
+ anchor.onclick = function() {
+ anchor.onclick = anchor.oldonclick;
+ anchor.innerHTML = "[+]";
+ dojo.empty(target);
+ };
+
+ function _load() {
+ dojo.empty(target);
+ fieldmapper.standardRequest(
+ ["open-ils.serial",
+ "open-ils.serial.received_siss.retrieve.by_bib.atomic"], {
+ "params": [bibid, {"offset": offsets[type], "limit": limit}],
+ "async": true,
+ "oncomplete": function(r) {
+ try {
+ if (msg = r.recv().content()) { /* sic, assignment */
+ if (!msg.length) return;
+ offsets[type] += msg.length;
+ var table = dojo.create("table", null, target);
+ dojo.forEach(
+ msg, function(o) {
+ var tr = dojo.create("tr", null, table);
+ dojo.create(
+ "td", {
+ "innerHTML": o.issuance.label(),
+ "style": {"paddingLeft": "3em"}
+ }, tr
+ );
+
+ if (!o.has_units) return;
+ /* can't place holds if no units */
+ var td = dojo.create("td", null, tr);
+ dojo.create(
+ "a", {
+ "href":"javascript:void(0);",
+ "style": {"marginLeft": "1.5em"},
+ "onclick": function() {
+ holdsDrawEditor({
+ "type": "I",
+ "issuance": o.issuance.id()
+ });
+ },
+ "innerHTML": "[" +
+ opac_strings.PLACE_HOLD + "]"
+ }, td
+ );
+ }
+ );
+ if (msg.length == limit) {
+ dojo.create("br", null, target);
+ dojo.create(
+ "a", {
+ "href": "javascript:void(0);",
+ "innerHTML":
+ "[" + opac_strings.MORE + "]",
+ "onclick": _load
+ }, target
+ );
+ }
+ }
+ } catch (E) {
+ void(0);
+ }
+ }
+ }
+ );
+ }
+ _load();
+}
--- /dev/null
+dojo.require('openils.BibTemplate');
+dojo.requireLocalization("openils.opac", "opac");
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+
+var recordsHandled = 0;
+var recordsCache = [];
+var lowHitCount = 4;
+var isbnList = '';
+var googleBooksLink = false;
+
+var resultFetchAllRecords = false;
+var resultCompiledSearch = null;
+
+/* set up the event handlers */
+if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
+ G.evt.result.hitCountReceived.push(resultSetHitInfo);
+ G.evt.result.recordReceived.push(resultDisplayRecord, resultAddCopyCounts);
+ G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
+ G.evt.result.allRecordsReceived.push( function(){unHideMe($('result_info_2'))}, fetchGoogleBooksLink, fetchChiliFreshReviews);
+
+ attachEvt('result','lowHits',resultLowHits);
+ attachEvt('result','zeroHits',resultZeroHits);
+ attachEvt( "common", "locationUpdated", resultSBSubmit );
+ /* do this after we have ID's so the rank for mr pages will be correct */
+ attachEvt("result", "preCollectRecords", resultPaginate);
+}
+
+function resultSBSubmit(){searchBarSubmit();}
+
+/* returns the last 'index' postion ocurring in this page */
+function resultFinalPageIndex() {
+ if(getHitCount() < (getOffset() + getDisplayCount()))
+ return getHitCount() - 1;
+ return getOffset() + getDisplayCount() - 1;
+}
+
+
+
+
+/* generic search method */
+function resultCollectSearchIds( type, method, handler ) {
+
+ var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
+ var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
+
+ var item_type;
+ var item_form;
+ var args = {};
+
+ if( type ) {
+ var form = parseForm(getForm());
+ item_type = form.item_type;
+ item_form = form.item_form;
+
+ } else {
+ item_type = (getItemType()) ? getItemType().split(/,/) : null;
+ item_form = (getItemForm()) ? getItemForm().split(/,/) : null;
+ }
+
+ var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount();
+
+ if( getOffset() > 0 ) {
+ if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() )
+ limit = getHitCount() - getOffset();
+ }
+
+ var lasso = getLasso();
+
+ if (lasso) args.org_unit = -lasso;
+ else args.org_unit = getLocation();
+
+ args.depth = getDepth();
+ args.limit = limit;
+ args.offset = getOffset();
+ args.visibility_limit = 3000;
+ args.default_class = getStype();
+
+ if(sort) args.sort = sort;
+ if(sortdir) args.sort_dir = sortdir;
+ if(item_type) args.item_type = item_type;
+ if(item_form) args.item_form = item_form;
+ if(getAvail()) args.available = 1;
+
+
+ if(getFacet()) args.facets = getFacet();
+
+ if(getAudience()) args.audience = getAudience().split(/,/);
+ if(getLitForm()) args.lit_form = getLitForm().split(/,/);
+ if(getLanguage()) args.language = getLanguage().split(/,/);
+ if(getBibLevel()) args.bib_level = getBibLevel().split(/,/);
+ if(getCopyLocs()) args.locations = getCopyLocs().split(/,/);
+ if(getPubdBefore()) args.before = getPubdBefore();
+ else if(getPubdAfter()) args.after = getPubdAfter();
+ else if(getPubdBetween()) args.between = getPubdBetween().split(/,/);
+
+ _debug('Search args: ' + js2JSON(args));
+ _debug('Raw query: ' + getTerm());
+
+ var my_ou = findOrgUnit(args.org_unit);
+ if (my_ou && my_ou.shortname()) {
+ var atomfeed = "/opac/extras/opensearch/1.1/" + my_ou.shortname() + "/atom-full/" + getStype() + '?searchTerms=' + getTerm();
+ if (args.facets) { atomfeed += ' ' + args.facets; }
+ if (sort) { atomfeed += '&searchSort=' + sort; }
+ if (sortdir) { atomfeed += '&searchSortDir=' + sortdir; }
+ dojo.create('link', {"rel":"alternate", "href":atomfeed, "type":"application/atom+xml"}, dojo.query('head')[0]);
+ }
+
+ var req = new Request(method, args, getTerm(), 1);
+ req.callback(handler);
+ req.send();
+}
+
+
+
+
+
+/* set the search result info, number of hits, which results we're
+ displaying, links to the next/prev pages, etc. */
+function resultSetHitInfo() {
+
+ var lasso = getLasso();
+ if (!lasso) {
+ /* tell the user where the results are coming from */
+ var baseorg = findOrgUnit(getLocation());
+ var depth = getDepth();
+ var mydepth = findOrgDepth(baseorg);
+ if( findOrgDepth(baseorg) != depth ) {
+ var tmporg = baseorg;
+ while( mydepth > depth ) {
+ mydepth--;
+ tmporg = findOrgUnit(tmporg.parent_ou());
+ }
+ unHideMe($('including_results_for'));
+ $('including_results_location').appendChild(text(tmporg.name()));
+ }
+ }
+
+
+ try{searchTimer.stop()}catch(e){}
+
+ //if( findCurrentPage() == MRESULT ) {
+ if( findCurrentPage() == MRESULT ||
+
+ (findCurrentPage() == RRESULT &&
+ (
+ getRtype() == RTYPE_TITLE ||
+ getRtype() == RTYPE_AUTHOR ||
+ getRtype() == RTYPE_SUBJECT ||
+ getRtype() == RTYPE_SERIES ||
+ getRtype() == RTYPE_KEYWORD
+ )
+
+ ) ) {
+
+ if(getHitCount() <= lowHitCount && getTerm())
+ runEvt('result', 'lowHits');
+ }
+
+ if(getHitCount() == 0) {
+ runEvt('result', 'zeroHits');
+ return;
+ }
+
+
+ var pages = getHitCount() / getDisplayCount();
+ if(pages % 1) pages = parseInt(pages) + 1;
+
+
+
+ var cpage = (getOffset()/getDisplayCount()) + 1;
+
+ G.ui.result.current_page.appendChild(text(cpage));
+ G.ui.result.num_pages.appendChild(text(pages + ")")); /* the ) is dumb */
+
+ $('current_page2').appendChild(text(cpage));
+ $('num_pages2').appendChild(text(pages + ")")); /* the ) is dumb */
+
+ /* set the offsets */
+ var offsetEnd = getDisplayCount() + getOffset();
+ if( getDisplayCount() > (getHitCount() - getOffset()))
+ offsetEnd = getHitCount();
+
+ G.ui.result.offset_end.appendChild(text(offsetEnd));
+ G.ui.result.offset_start.appendChild(text(getOffset() + 1));
+
+ $('offset_end2').appendChild(text(offsetEnd));
+ $('offset_start2').appendChild(text(getOffset() + 1));
+
+ G.ui.result.result_count.appendChild(text(getHitCount()));
+ unHideMe(G.ui.result.info);
+
+ $('result_count2').appendChild(text(getHitCount()));
+ unHideMe($('result_info_div2'));
+}
+
+function resultLowHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ if(getHitCount() > 0)
+ unHideMe($('result_low_hits_msg'));
+
+ var words = [];
+ for(var key in resultCompiledSearch.searches)
+ words.push(resultCompiledSearch.searches[key].term);
+
+ var sreq = new Request(CHECK_SPELL, words.join(' '));
+ sreq.callback(resultSuggestSpelling);
+ sreq.send();
+
+ for(var key in resultCompiledSearch.searches) {
+ var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term);
+ areq.callback(resultLowHitXRef);
+ areq.send();
+ }
+
+ if( !(getForm() == null || getForm() == 'all' || getForm() == "") ) {
+ var a = {};
+ a[PARAM_FORM] = "all";
+ $('low_hits_remove_format_link').setAttribute('href',buildOPACLink(a));
+ unHideMe($('low_hits_remove_format'));
+ }
+
+ resultSuggestSearchClass();
+
+ if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+var lowHitsXRefSet = {};
+var lowHitsXRefLink;
+var lowHitsXRefLinkParent;
+function resultLowHitXRef(r) {
+ if(!lowHitsXRefLink){
+ lowHitsXRefLinkParent = $('low_hits_xref_link').parentNode;
+ lowHitsXRefLink = lowHitsXRefLinkParent.removeChild($('low_hits_xref_link'));
+ }
+ var res = r.getResultObject();
+ var arr = res.from;
+ arr.concat(res.also);
+ if(arr && arr.length > 0) {
+ unHideMe($('low_hits_cross_ref'));
+ var word;
+ var c = 0;
+ while( word = arr.shift() ) {
+
+ if (lowHitsXRefSet[word] == 1) continue;
+ lowHitsXRefSet[word] = 1;
+
+ if(c++ > 20) break;
+ var a = {};
+ a[PARAM_TERM] = word;
+ var template = lowHitsXRefLink.cloneNode(true);
+ template.setAttribute('href',buildOPACLink(a));
+ template.appendChild(text(word));
+ lowHitsXRefLinkParent.appendChild(template);
+ lowHitsXRefLinkParent.appendChild(text(' '));
+ }
+ }
+}
+
+function resultZeroHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ unHideMe($('result_zero_hits_msg'));
+ //if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+function resultExpandSearch() {
+ var top = findOrgDepth(globalOrgTree);
+ if(getDepth() == top) return;
+ unHideMe($('low_hits_expand_range'));
+ var par = $('low_hits_expand_link').parentNode;
+ var template = par.removeChild($('low_hits_expand_link'));
+
+ var bottom = getDepth();
+ while( top < bottom ) {
+ var a = {};
+ a[PARAM_DEPTH] = top;
+ var temp = template.cloneNode(true);
+ temp.appendChild(text(findOrgTypeFromDepth(top).opac_label()))
+ temp.setAttribute('href',buildOPACLink(a));
+ par.appendChild(temp);
+ top++;
+ }
+}
+
+function resultSuggestSearchClass() {
+ var stype = getStype();
+ if(stype == STYPE_KEYWORD) return;
+ var a = {}; var ref;
+ unHideMe($('low_hits_search_type'));
+ if(stype != STYPE_TITLE) {
+ ref = $('low_hits_title_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_TITLE;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_AUTHOR) {
+ ref = $('low_hits_author_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_AUTHOR;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SUBJECT) {
+ ref = $('low_hits_subject_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SUBJECT;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_KEYWORD) {
+ ref = $('low_hits_keyword_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_KEYWORD;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SERIES) {
+ ref = $('low_hits_series_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SERIES;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+}
+
+function resultSuggestSpelling(r) {
+ var res = r.getResultObject();
+ var phrase = getTerm();
+ var words = phrase.split(/ /);
+
+ var newterm = "";
+
+ for( var w = 0; w < words.length; w++ ) {
+ var word = words[w];
+ var blob = grep(res, function(i){return (i.word == word);});
+ if( blob ) blob = blob[0];
+ else continue;
+ if( blob.word == word ) {
+ if( !blob.found && blob.suggestions && blob.suggestions[0] ) {
+ newterm += " " + blob.suggestions[0];
+ unHideMe($('did_you_mean'));
+ } else {
+ newterm += " " + word;
+ }
+ }
+ }
+
+ var arg = {};
+ arg[PARAM_TERM] = newterm;
+ $('spell_check_link').setAttribute('href', buildOPACLink(arg));
+ $('spell_check_link').appendChild(text(newterm));
+}
+
+
+function resultPaginate() {
+ var o = getOffset();
+
+ if( !( ((o) + getDisplayCount()) >= getHitCount()) ) {
+
+ var args = {};
+ args[PARAM_OFFSET] = o + getDisplayCount();
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ G.ui.result.next_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.next_link, config.css.result.nav_active);
+
+ $('next_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('next_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount());
+
+ /* when hit count is divisible by display count, we have to adjust */
+ if( getHitCount() % getDisplayCount() == 0 )
+ args[PARAM_OFFSET] -= getDisplayCount();
+
+ /*
+ G.ui.result.end_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.end_link, config.css.result.nav_active);
+
+ $('end_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('end_link2'), config.css.result.nav_active);
+ */
+ }
+
+ if( o > 0 ) {
+
+ var args = {};
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ args[PARAM_OFFSET] = o - getDisplayCount();
+ G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.prev_link, config.css.result.nav_active);
+
+ $('prev_link2').setAttribute( "href", buildOPACLink(args));
+ addCSSClass($('prev_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = 0;
+ G.ui.result.home_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.home_link, config.css.result.nav_active);
+
+ $('search_home_link2').setAttribute( "href", buildOPACLink(args));
+ addCSSClass($('search_home_link2'), config.css.result.nav_active);
+ }
+
+ if(getDisplayCount() < getHitCount()) {
+ unHideMe($('start_end_links_span'));
+ unHideMe($('start_end_links_span2'));
+ }
+
+ showCanvas();
+ try{searchTimer.stop()}catch(e){}
+}
+
+function buildunAPISpan (span, type, id) {
+ var cgi = new CGI();
+ var d = new Date();
+
+ addCSSClass(span,'unapi-id');
+
+ span.setAttribute(
+ 'title',
+ 'tag:' + cgi.server_name + ',' +
+ d.getFullYear() +
+ ':' + type + '/' + id
+ );
+}
+
+function unhideGoogleBooksLink (data) {
+ for ( var i in data ) {
+ //if (data[i].preview == 'noview') continue;
+
+ var gbspan = $n(document.documentElement, 'googleBooksLink-' + i);
+ var gba = $n(gbspan, "googleBooks-link");
+
+ gba.setAttribute(
+ 'href',
+ data[i].info_url
+ );
+ removeCSSClass( gbspan, 'hide_me' );
+ }
+}
+
+/* display the record info in the record display table 'pos' is the
+ zero based position the record should have in the display table */
+function resultDisplayRecord(rec, pos, is_mr) {
+
+ fieldmapper.IDL.load(['mvr']);
+ if(rec == null) rec = new mvr(); /* so the page won't die if there was an error */
+ recordsHandled++;
+ recordsCache.push(rec);
+
+ var r = table.rows[pos + 1];
+ var currentISBN = cleanISBN(rec.isbn());
+
+ if (googleBooksLink) {
+ var gbspan = $n(r, "googleBooksLink");
+ if (currentISBN) {
+ gbspan.setAttribute(
+ 'name',
+ gbspan.getAttribute('name') + '-' + currentISBN
+ );
+
+ if (isbnList) isbnList += ', ';
+ isbnList += currentISBN;
+ }
+ }
+
+ if (currentISBN && chilifresh && chilifresh != '(none)') {
+ var cfrow = $n(r, "chilifreshReview");
+ if (cfrow) {
+ removeCSSClass( cfrow, 'hide_me' );
+ }
+ var cflink = $n(r, "chilifreshReviewLink");
+ if (cflink) {
+ cflink.setAttribute(
+ 'id',
+ 'isbn_' + currentISBN
+ );
+ }
+ var cfdiv = $n(r, "chilifreshReviewResult");
+ if (cfdiv) {
+ cfdiv.setAttribute(
+ 'id',
+ 'chili_review_' + currentISBN
+ )
+ }
+ }
+
+/*
+ try {
+ var rank = parseFloat(ranks[pos + getOffset()]);
+ rank = parseInt( rank * 100 );
+ var relspan = $n(r, "relevancy_span");
+ relspan.appendChild(text(rank));
+ unHideMe(relspan.parentNode);
+ } catch(e){ }
+*/
+
+
+ var pic = $n(r, config.names.result.item_jacket);
+ if (currentISBN) {
+ pic.setAttribute("src", buildISBNSrc(currentISBN));
+ } else {
+ pic.setAttribute("src", "/opac/images/blank.png");
+ }
+
+
+ var title_link = $n(r, config.names.result.item_title);
+ var author_link = $n(r, config.names.result.item_author);
+
+ var onlyrec;
+ if( is_mr ) {
+ onlyrec = onlyrecord[ getOffset() + pos ];
+ if(onlyrec) {
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec);
+
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = onlyrec;
+ args[PARAM_MRID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ title_link.setAttribute("href", buildOPACLink(args));
+ title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
+
+ } else {
+ buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id());
+
+ buildTitleLink(rec, title_link);
+ var args = {};
+ args.page = RRESULT;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_MRID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ }
+
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').onclick = function() { resultDrawHoldsWindow(rec.doc_id(), 'M'); }
+
+
+ } else {
+ onlyrec = rec.doc_id();
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', rec.doc_id());
+
+ buildTitleDetailLink(rec, title_link);
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').onclick = function() { resultDrawHoldsWindow(rec.doc_id(), 'T'); }
+ }
+
+ buildSearchLink(STYPE_AUTHOR, rec.author(), author_link);
+
+ if(! is_mr ) {
+
+ if(!isNull(rec.edition())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ $n(r, "result_table_edition_span").appendChild( text( rec.edition()) );
+ }
+ if(!isNull(rec.pubdate())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( rec.pubdate() ));
+ }
+ if(!isNull(rec.publisher()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( " " + rec.publisher() ));
+ }
+
+ if(!isNull(rec.physical_description()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ var t = " " + rec.physical_description();
+ //$n(r, "result_table_phys_span").appendChild( text(t.replace(/:.*/g,'')));
+ $n(r, "result_table_phys_span").appendChild( text(t));
+ }
+
+ }
+
+ resultBuildFormatIcons( r, rec, is_mr );
+
+ var bt_params = {
+ sync : false,
+ root : r,
+ subObjectLimit : 10,
+ org_unit : findOrgUnit(getLocation()).shortname(),
+ depth : getDepth()
+ };
+
+ if (!is_mr) {
+ bt_params = dojo.mixin( bt_params, { record : onlyrec } );
+ } else {
+ bt_params = dojo.mixin( bt_params, { metarecord : onlyrec } );
+ }
+
+ if (findOrgType(findOrgUnit(getLocation()).ou_type()).can_have_vols())
+ unHideMe($n(r,'local_callnumber_list'));
+
+ new openils.BibTemplate( bt_params ).render();
+
+ unHideMe(r);
+
+ runEvt("result", "recordDrawn", rec.doc_id(), title_link);
+
+ /*
+ if(resultPageIsDone()) {
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ }
+ */
+}
+
+function resultDrawHoldsWindow(hold_target, hold_type) {
+ var src = location.href;
+
+ if(forceLoginSSL && src.match(/^http:/)) {
+
+ src = src.replace(/^http:/, 'https:');
+
+ if(src.match(/&hold_target=/)) {
+ src.replace(/&hold_target=(\d+)/, hold_target);
+
+ } else {
+ src += '&hold_target=' + hold_target;
+ }
+
+ location.href = src;
+
+ } else {
+ holdsDrawEditor({record:hold_target, type:hold_type});
+ }
+}
+
+
+
+function _resultFindRec(id) {
+ for( var i = 0; i != recordsCache.length; i++ ) {
+ var rec = recordsCache[i];
+ if( rec && rec.doc_id() == id )
+ return rec;
+ }
+ return null;
+}
+
+
+function resultBuildFormatIcons( row, rec, is_mr ) {
+
+ var ress = rec.types_of_resource();
+
+ for( var i in ress ) {
+
+ var res = ress[i];
+ if(!res) continue;
+
+ var link = $n(row, res + "_link");
+ link.title = res;
+ var img = link.getElementsByTagName("img")[0];
+ removeCSSClass( img, config.css.dim );
+
+ var f = getForm();
+ if( f != "all" ) {
+ if( f == modsFormatToMARC(res) )
+ addCSSClass( img, "dim2_border");
+ }
+
+ var args = {};
+ args[PARAM_OFFSET] = 0;
+
+ if(is_mr) {
+ args.page = RRESULT;
+ args[PARAM_TFORM] = modsFormatToMARC(res);
+ args[PARAM_MRID] = rec.doc_id();
+
+ } else {
+ args.page = RDETAIL
+ args[PARAM_RID] = rec.doc_id();
+ }
+
+ link.setAttribute("href", buildOPACLink(args));
+
+ }
+}
+
+function fetchGoogleBooksLink () {
+ if (isbnList && googleBooksLink) {
+ var scriptElement = document.createElement("script");
+ scriptElement.setAttribute("id", "jsonScript");
+ scriptElement.setAttribute("src",
+ "http://books.google.com/books?bibkeys=" +
+ escape(isbnList) + "&jscmd=viewapi&callback=unhideGoogleBooksLink");
+ scriptElement.setAttribute("type", "text/javascript");
+ // make the request to Google Book Search
+ document.documentElement.firstChild.appendChild(scriptElement);
+ }
+}
+
+function fetchChiliFreshReviews() {
+ if (chilifresh && chilifresh != '(none)') {
+ try { chili_init(); } catch(E) { console.log(E + '\n'); }
+ }
+}
+
+function resultPageIsDone(pos) {
+
+ return (recordsHandled == getDisplayCount()
+ || recordsHandled + getOffset() == getHitCount());
+}
+
+var resultCCHeaderApplied = false;
+
+/* -------------------------------------------------------------------- */
+/* dynamically add the copy count rows based on the org type 'countsrow'
+ is the row into which we will add TD's to hold the copy counts
+ This code generates copy count cells with an id of
+ 'copy_count_cell_<depth>_<pagePosition>' */
+function resultAddCopyCounts(rec, pagePosition) {
+
+ var r = table.rows[pagePosition + 1];
+ var countsrow = $n(r, config.names.result.counts_row );
+ var ccell = $n(countsrow, config.names.result.count_cell);
+
+ var nodes = orgNodeTrail(findOrgUnit(getLocation()));
+ var start_here = 0;
+ var orgHiding = checkOrgHiding();
+ if (orgHiding) {
+ for (var i = 0; i < nodes.length; i++) {
+ if (orgHiding.depth == findOrgDepth(nodes[i])) {
+ start_here = i;
+ }
+ }
+ }
+
+ var node = nodes[start_here];
+ var type = findOrgType(node.ou_type());
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ //addCSSClass(ccell, config.css.result.cc_cell_even);
+
+ var lastcell = ccell;
+ var lastheadcell = null;
+
+ var cchead = null;
+ var ccheadcell = null;
+ if(!resultCCHeaderApplied && !getLasso()) {
+ ccrow = $('result_thead_row');
+ ccheadcell = ccrow.removeChild($n(ccrow, "result_thead_ccell"));
+ var t = ccheadcell.cloneNode(true);
+ lastheadcell = t;
+ t.appendChild(text(type.opac_label()));
+ ccrow.appendChild(t);
+ resultCCHeaderApplied = true;
+ }
+
+ if(nodes[start_here+1]) {
+
+ var x = start_here+1;
+ var d = findOrgDepth(nodes[start_here+1]);
+ var d2 = findOrgDepth(nodes[nodes.length -1]);
+
+ for( var i = d; i <= d2 ; i++ ) {
+
+ ccell = ccell.cloneNode(true);
+
+ //if((i % 2)) removeCSSClass(ccell, "copy_count_cell_even");
+ //else addCSSClass(ccell, "copy_count_cell_even");
+
+ var node = nodes[x++];
+ var type = findOrgType(node.ou_type());
+
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ countsrow.insertBefore(ccell, lastcell);
+ lastcell = ccell;
+
+ if(ccheadcell) {
+ var t = ccheadcell.cloneNode(true);
+ t.appendChild(text(type.opac_label()));
+ ccrow.insertBefore(t, lastheadcell);
+ lastheadcell = t;
+ }
+ }
+ }
+
+ unHideMe($("search_info_table"));
+}
+
+/* collect copy counts for a record using method 'methodName' */
+function resultCollectCopyCounts(rec, pagePosition, methodName) {
+ if(rec == null || rec.doc_id() == null) return;
+
+ var loc = getLasso();
+ if (loc) loc = -loc;
+ else loc= getLocation();
+
+ var req = new Request(methodName, loc, rec.doc_id(), getForm() );
+ req.request.userdata = [ rec, pagePosition ];
+ req.callback(resultHandleCopyCounts);
+ req.send();
+}
+
+function resultHandleCopyCounts(r) {
+ runEvt('result', 'copyCountsReceived', r.userdata[0], r.userdata[1], r.getResultObject());
+}
+
+
+/* XXX Needs to understand Lasso copy counts... */
+/* display the collected copy counts */
+function resultDisplayCopyCounts(rec, pagePosition, copy_counts) {
+ if(copy_counts == null || rec == null) return;
+
+ if (getLasso()) {
+ var copy_counts_lasso = {
+ transcendant : null,
+ count : 0,
+ unshadow : 0,
+ available : 0,
+ depth : -1,
+ org_unit : getLasso()
+ };
+
+ for (var i in copy_counts) {
+ copy_counts_lasso.transcendant = copy_counts[i].transcendant;
+ copy_counts_lasso.count += parseInt(copy_counts[i].count);
+ copy_counts_lasso.unshadow += parseInt(copy_counts[i].unshadow);
+ copy_counts_lasso.available += parseInt(copy_counts[i].available);
+ }
+
+ copy_counts = [ copy_counts_lasso ];
+ }
+
+ var i = 0;
+ while(copy_counts[i] != null) {
+ var cell = $("copy_count_cell_" + i +"_" + pagePosition);
+ if (cell) {
+ var cts = copy_counts[i];
+ cell.appendChild(text(cts.available + " / " + cts.count));
+
+ if(isXUL()) {
+ /* here we style opac-invisible records for xul */
+
+ if( cts.depth == 0 ) {
+ if(cts.transcendant == null && cts.unshadow == 0) {
+ _debug("found an opac-shadowed record: " + rec.doc_id());
+ var row = cell.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if( cts.count == 0 )
+ addCSSClass( row, 'no_copies' );
+ else
+ addCSSClass( row, 'shadowed' );
+ }
+ }
+ }
+ }
+ i++;
+ }
+}
+
+
--- /dev/null
+dojo.require('openils.BibTemplate');
+dojo.requireLocalization("openils.opac", "opac");
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+
+var recordsHandled = 0;
+var recordsCache = [];
+var lowHitCount = 4;
+var isbnList = '';
+var googleBooksLink = true;
+
+var resultFetchAllRecords = false;
+var resultCompiledSearch = null;
+
+/* set up the event handlers */
+if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
+ G.evt.result.hitCountReceived.push(resultSetHitInfo);
+ G.evt.result.recordReceived.push(resultDisplayRecord, resultAddCopyCounts);
+ G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
+ G.evt.result.allRecordsReceived.push( function(){unHideMe($('result_info_2'))}, fetchGoogleBooksLink, fetchChiliFreshReviews);
+
+ attachEvt('result','lowHits',resultLowHits);
+ attachEvt('result','zeroHits',resultZeroHits);
+ attachEvt( "common", "locationUpdated", resultSBSubmit );
+ /* do this after we have ID's so the rank for mr pages will be correct */
+ attachEvt("result", "preCollectRecords", resultPaginate);
+}
+
+function resultSBSubmit(){searchBarSubmit();}
+
+/* returns the last 'index' postion ocurring in this page */
+function resultFinalPageIndex() {
+ if(getHitCount() < (getOffset() + getDisplayCount()))
+ return getHitCount() - 1;
+ return getOffset() + getDisplayCount() - 1;
+}
+
+
+
+
+/* generic search method */
+function resultCollectSearchIds( type, method, handler ) {
+
+ var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
+ var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
+
+ var item_type;
+ var item_form;
+ var args = {};
+
+ if( type ) {
+ var form = parseForm(getForm());
+ item_type = form.item_type;
+ item_form = form.item_form;
+
+ } else {
+ item_type = (getItemType()) ? getItemType().split(/,/) : null;
+ item_form = (getItemForm()) ? getItemForm().split(/,/) : null;
+ }
+
+ var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount();
+
+ if( getOffset() > 0 ) {
+ if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() )
+ limit = getHitCount() - getOffset();
+ }
+
+ var lasso = getLasso();
+
+ if (lasso) args.org_unit = -lasso;
+ else args.org_unit = getLocation();
+
+ args.depth = getDepth();
+ args.limit = limit;
+ args.offset = getOffset();
+ args.visibility_limit = 3000;
+ args.default_class = getStype();
+
+ if(sort) args.sort = sort;
+ if(sortdir) args.sort_dir = sortdir;
+ if(item_type) args.item_type = item_type;
+ if(item_form) args.item_form = item_form;
+ if(getAvail()) args.available = 1;
+
+
+ if(getFacet()) args.facets = getFacet();
+
+ if(getAudience()) args.audience = getAudience().split(/,/);
+ if(getLitForm()) args.lit_form = getLitForm().split(/,/);
+ if(getLanguage()) args.language = getLanguage().split(/,/);
+ if(getBibLevel()) args.bib_level = getBibLevel().split(/,/);
+ if(getCopyLocs()) args.locations = getCopyLocs().split(/,/);
+ if(getPubdBefore()) args.before = getPubdBefore();
+ else if(getPubdAfter()) args.after = getPubdAfter();
+ else if(getPubdBetween()) args.between = getPubdBetween().split(/,/);
+
+ _debug('Search args: ' + js2JSON(args));
+ _debug('Raw query: ' + getTerm());
+
+ var my_ou = findOrgUnit(args.org_unit);
+ if (my_ou && my_ou.shortname()) {
+ var atomfeed = "/opac/extras/opensearch/1.1/" + my_ou.shortname() + "/atom-full/" + getStype() + '?searchTerms=' + getTerm();
+ if (args.facets) { atomfeed += ' ' + args.facets; }
+ if (sort) { atomfeed += '&searchSort=' + sort; }
+ if (sortdir) { atomfeed += '&searchSortDir=' + sortdir; }
+ dojo.create('link', {"rel":"alternate", "href":atomfeed, "type":"application/atom+xml"}, dojo.query('head')[0]);
+ }
+
+ var req = new Request(method, args, getTerm(), 1);
+ req.callback(handler);
+ req.send();
+}
+
+
+
+
+
+/* set the search result info, number of hits, which results we're
+ displaying, links to the next/prev pages, etc. */
+function resultSetHitInfo() {
+
+ var lasso = getLasso();
+ if (!lasso) {
+ /* tell the user where the results are coming from */
+ var baseorg = findOrgUnit(getLocation());
+ var depth = getDepth();
+ var mydepth = findOrgDepth(baseorg);
+ if( findOrgDepth(baseorg) != depth ) {
+ var tmporg = baseorg;
+ while( mydepth > depth ) {
+ mydepth--;
+ tmporg = findOrgUnit(tmporg.parent_ou());
+ }
+ unHideMe($('including_results_for'));
+ $('including_results_location').appendChild(text(tmporg.name()));
+ }
+ }
+
+
+ try{searchTimer.stop()}catch(e){}
+
+ //if( findCurrentPage() == MRESULT ) {
+ if( findCurrentPage() == MRESULT ||
+
+ (findCurrentPage() == RRESULT &&
+ (
+ getRtype() == RTYPE_TITLE ||
+ getRtype() == RTYPE_AUTHOR ||
+ getRtype() == RTYPE_SUBJECT ||
+ getRtype() == RTYPE_SERIES ||
+ getRtype() == RTYPE_KEYWORD
+ )
+
+ ) ) {
+
+ if(getHitCount() <= lowHitCount && getTerm())
+ runEvt('result', 'lowHits');
+ }
+
+ if(getHitCount() == 0) {
+ runEvt('result', 'zeroHits');
+ return;
+ }
+
+
+ var pages = getHitCount() / getDisplayCount();
+ if(pages % 1) pages = parseInt(pages) + 1;
+
+
+
+ var cpage = (getOffset()/getDisplayCount()) + 1;
+
+ G.ui.result.current_page.appendChild(text(cpage));
+ G.ui.result.num_pages.appendChild(text(pages + ")")); /* the ) is dumb */
+
+ $('current_page2').appendChild(text(cpage));
+ $('num_pages2').appendChild(text(pages + ")")); /* the ) is dumb */
+
+ /* set the offsets */
+ var offsetEnd = getDisplayCount() + getOffset();
+ if( getDisplayCount() > (getHitCount() - getOffset()))
+ offsetEnd = getHitCount();
+
+ G.ui.result.offset_end.appendChild(text(offsetEnd));
+ G.ui.result.offset_start.appendChild(text(getOffset() + 1));
+
+ $('offset_end2').appendChild(text(offsetEnd));
+ $('offset_start2').appendChild(text(getOffset() + 1));
+
+ G.ui.result.result_count.appendChild(text(getHitCount()));
+ unHideMe(G.ui.result.info);
+
+ $('result_count2').appendChild(text(getHitCount()));
+ unHideMe($('result_info_div2'));
+}
+
+function resultLowHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ if(getHitCount() > 0)
+ unHideMe($('result_low_hits_msg'));
+
+ var words = [];
+ for(var key in resultCompiledSearch.searches)
+ words.push(resultCompiledSearch.searches[key].term);
+
+ var sreq = new Request(CHECK_SPELL, words.join(' '));
+ sreq.callback(resultSuggestSpelling);
+ sreq.send();
+
+ for(var key in resultCompiledSearch.searches) {
+ var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term);
+ areq.callback(resultLowHitXRef);
+ areq.send();
+ }
+
+ if( !(getForm() == null || getForm() == 'all' || getForm() == "") ) {
+ var a = {};
+ a[PARAM_FORM] = "all";
+ $('low_hits_remove_format_link').setAttribute('href',buildOPACLink(a));
+ unHideMe($('low_hits_remove_format'));
+ }
+
+ resultSuggestSearchClass();
+
+ if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+var lowHitsXRefSet = {};
+var lowHitsXRefLink;
+var lowHitsXRefLinkParent;
+function resultLowHitXRef(r) {
+ if(!lowHitsXRefLink){
+ lowHitsXRefLinkParent = $('low_hits_xref_link').parentNode;
+ lowHitsXRefLink = lowHitsXRefLinkParent.removeChild($('low_hits_xref_link'));
+ }
+ var res = r.getResultObject();
+ var arr = res.from;
+ arr.concat(res.also);
+ if(arr && arr.length > 0) {
+ unHideMe($('low_hits_cross_ref'));
+ var word;
+ var c = 0;
+ while( word = arr.shift() ) {
+
+ if (lowHitsXRefSet[word] == 1) continue;
+ lowHitsXRefSet[word] = 1;
+
+ if(c++ > 20) break;
+ var a = {};
+ a[PARAM_TERM] = word;
+ var template = lowHitsXRefLink.cloneNode(true);
+ template.setAttribute('href',buildOPACLink(a));
+ template.appendChild(text(word));
+ lowHitsXRefLinkParent.appendChild(template);
+ lowHitsXRefLinkParent.appendChild(text(' '));
+ }
+ }
+}
+
+function resultZeroHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ unHideMe($('result_zero_hits_msg'));
+ //if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+function resultExpandSearch() {
+ var top = findOrgDepth(globalOrgTree);
+ if(getDepth() == top) return;
+ unHideMe($('low_hits_expand_range'));
+ var par = $('low_hits_expand_link').parentNode;
+ var template = par.removeChild($('low_hits_expand_link'));
+
+ var bottom = getDepth();
+ while( top < bottom ) {
+ var a = {};
+ a[PARAM_DEPTH] = top;
+ var temp = template.cloneNode(true);
+ temp.appendChild(text(findOrgTypeFromDepth(top).opac_label()))
+ temp.setAttribute('href',buildOPACLink(a));
+ par.appendChild(temp);
+ top++;
+ }
+}
+
+function resultSuggestSearchClass() {
+ var stype = getStype();
+ if(stype == STYPE_KEYWORD) return;
+ var a = {}; var ref;
+ unHideMe($('low_hits_search_type'));
+ if(stype != STYPE_TITLE) {
+ ref = $('low_hits_title_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_TITLE;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_AUTHOR) {
+ ref = $('low_hits_author_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_AUTHOR;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SUBJECT) {
+ ref = $('low_hits_subject_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SUBJECT;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_KEYWORD) {
+ ref = $('low_hits_keyword_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_KEYWORD;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SERIES) {
+ ref = $('low_hits_series_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SERIES;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+}
+
+function resultSuggestSpelling(r) {
+ var res = r.getResultObject();
+ var phrase = getTerm();
+ var words = phrase.split(/ /);
+
+ var newterm = "";
+
+ for( var w = 0; w < words.length; w++ ) {
+ var word = words[w];
+ var blob = grep(res, function(i){return (i.word == word);});
+ if( blob ) blob = blob[0];
+ else continue;
+ if( blob.word == word ) {
+ if( !blob.found && blob.suggestions && blob.suggestions[0] ) {
+ newterm += " " + blob.suggestions[0];
+ unHideMe($('did_you_mean'));
+ } else {
+ newterm += " " + word;
+ }
+ }
+ }
+
+ var arg = {};
+ arg[PARAM_TERM] = newterm;
+ $('spell_check_link').setAttribute('href', buildOPACLink(arg));
+ $('spell_check_link').appendChild(text(newterm));
+}
+
+
+function resultPaginate() {
+ var o = getOffset();
+
+ if( !( ((o) + getDisplayCount()) >= getHitCount()) ) {
+
+ var args = {};
+ args[PARAM_OFFSET] = o + getDisplayCount();
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ G.ui.result.next_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.next_link, config.css.result.nav_active);
+
+ $('next_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('next_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount());
+
+ /* when hit count is divisible by display count, we have to adjust */
+ if( getHitCount() % getDisplayCount() == 0 )
+ args[PARAM_OFFSET] -= getDisplayCount();
+
+ /*
+ G.ui.result.end_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.end_link, config.css.result.nav_active);
+
+ $('end_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('end_link2'), config.css.result.nav_active);
+ */
+ }
+
+ if( o > 0 ) {
+
+ var args = {};
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ args[PARAM_OFFSET] = o - getDisplayCount();
+ G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.prev_link, config.css.result.nav_active);
+
+ $('prev_link2').setAttribute( "href", buildOPACLink(args));
+ addCSSClass($('prev_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = 0;
+ G.ui.result.home_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.home_link, config.css.result.nav_active);
+
+ $('search_home_link2').setAttribute( "href", buildOPACLink(args));
+ addCSSClass($('search_home_link2'), config.css.result.nav_active);
+ }
+
+ if(getDisplayCount() < getHitCount()) {
+ unHideMe($('start_end_links_span'));
+ unHideMe($('start_end_links_span2'));
+ }
+
+ showCanvas();
+ try{searchTimer.stop()}catch(e){}
+}
+
+function buildunAPISpan (span, type, id) {
+ var cgi = new CGI();
+ var d = new Date();
+
+ addCSSClass(span,'unapi-id');
+
+ span.setAttribute(
+ 'title',
+ 'tag:' + cgi.server_name + ',' +
+ d.getFullYear() +
+ ':' + type + '/' + id
+ );
+}
+
+function unhideGoogleBooksLink (data) {
+ for ( var i in data ) {
+ //if (data[i].preview == 'noview') continue;
+
+ var gbspan = $n(document.documentElement, 'googleBooksLink-' + i);
+ var gba = $n(gbspan, "googleBooks-link");
+
+ gba.setAttribute(
+ 'href',
+ data[i].info_url
+ );
+ removeCSSClass( gbspan, 'hide_me' );
+ }
+}
+
+/* display the record info in the record display table 'pos' is the
+ zero based position the record should have in the display table */
+function resultDisplayRecord(rec, pos, is_mr) {
+
+ fieldmapper.IDL.load(['mvr']);
+ if(rec == null) rec = new mvr(); /* so the page won't die if there was an error */
+ recordsHandled++;
+ recordsCache.push(rec);
+
+ var r = table.rows[pos + 1];
+ var currentISBN = cleanISBN(rec.isbn());
+
+ if (googleBooksLink) {
+ var gbspan = $n(r, "googleBooksLink");
+ if (currentISBN) {
+ gbspan.setAttribute(
+ 'name',
+ gbspan.getAttribute('name') + '-' + currentISBN
+ );
+
+ if (isbnList) isbnList += ', ';
+ isbnList += currentISBN;
+ }
+ }
+
+ if (currentISBN && chilifresh && chilifresh != '(none)') {
+ var cfrow = $n(r, "chilifreshReview");
+ if (cfrow) {
+ removeCSSClass( cfrow, 'hide_me' );
+ }
+ var cflink = $n(r, "chilifreshReviewLink");
+ if (cflink) {
+ cflink.setAttribute(
+ 'id',
+ 'isbn_' + currentISBN
+ );
+ }
+ var cfdiv = $n(r, "chilifreshReviewResult");
+ if (cfdiv) {
+ cfdiv.setAttribute(
+ 'id',
+ 'chili_review_' + currentISBN
+ )
+ }
+ }
+
+/*
+ try {
+ var rank = parseFloat(ranks[pos + getOffset()]);
+ rank = parseInt( rank * 100 );
+ var relspan = $n(r, "relevancy_span");
+ relspan.appendChild(text(rank));
+ unHideMe(relspan.parentNode);
+ } catch(e){ }
+*/
+
+ var pic = $n(r, config.names.result.item_jacket);
+ if (currentISBN) {
+ pic.setAttribute("src", buildISBNSrc(currentISBN));
+ } else {
+ pic.setAttribute("src", "/opac/images/blank.png");
+ }
+
+ var title_link = $n(r, config.names.result.item_title);
+ var author_link = $n(r, config.names.result.item_author);
+
+ var onlyrec;
+ if( is_mr ) {
+ onlyrec = onlyrecord[ getOffset() + pos ];
+ if(onlyrec) {
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec);
+
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = onlyrec;
+ args[PARAM_MRID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ title_link.setAttribute("href", buildOPACLink(args));
+ title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
+
+ } else {
+ buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id());
+
+ buildTitleLink(rec, title_link);
+ var args = {};
+ args.page = RRESULT;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_MRID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ }
+
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').onclick = function() { resultDrawHoldsWindow(rec.doc_id(), 'M'); }
+
+
+ } else {
+ onlyrec = rec.doc_id();
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', rec.doc_id());
+
+ buildTitleDetailLink(rec, title_link);
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = rec.doc_id();
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').onclick = function() { resultDrawHoldsWindow(rec.doc_id(), 'T'); }
+ }
+
+ buildSearchLink(STYPE_AUTHOR, rec.author(), author_link);
+
+ if(! is_mr ) {
+
+ if(!isNull(rec.edition())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ $n(r, "result_table_edition_span").appendChild( text( rec.edition()) );
+ }
+ if(!isNull(rec.pubdate())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( rec.pubdate() ));
+ }
+ if(!isNull(rec.publisher()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( " " + rec.publisher() ));
+ }
+
+ if(!isNull(rec.physical_description()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ var t = " " + rec.physical_description();
+ //$n(r, "result_table_phys_span").appendChild( text(t.replace(/:.*/g,'')));
+ $n(r, "result_table_phys_span").appendChild( text(t));
+ }
+
+ }
+
+ resultBuildFormatIcons( r, rec, is_mr );
+
+ var bt_params = {
+ sync : false,
+ root : r,
+ subObjectLimit : 10,
+ org_unit : findOrgUnit(getLocation()).shortname(),
+ depth : getDepth()
+ };
+
+ if (!is_mr) {
+ bt_params = dojo.mixin( bt_params, { record : onlyrec } );
+ } else {
+ bt_params = dojo.mixin( bt_params, { metarecord : onlyrec } );
+ }
+
+ if (findOrgType(findOrgUnit(getLocation()).ou_type()).can_have_vols())
+ unHideMe($n(r,'local_callnumber_list'));
+
+ new openils.BibTemplate( bt_params ).render();
+
+ unHideMe(r);
+
+ runEvt("result", "recordDrawn", rec.doc_id(), title_link);
+
+ /*
+ if(resultPageIsDone()) {
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ }
+ */
+}
+
+function resultDrawHoldsWindow(hold_target, hold_type) {
+ var src = location.href;
+
+ if(forceLoginSSL && src.match(/^http:/)) {
+
+ src = src.replace(/^http:/, 'https:');
+
+ if(src.match(/&hold_target=/)) {
+ src.replace(/&hold_target=(\d+)/, hold_target);
+
+ } else {
+ src += '&hold_target=' + hold_target;
+ }
+
+ location.href = src;
+
+ } else {
+ holdsDrawEditor({record:hold_target, type:hold_type});
+ }
+}
+
+
+
+function _resultFindRec(id) {
+ for( var i = 0; i != recordsCache.length; i++ ) {
+ var rec = recordsCache[i];
+ if( rec && rec.doc_id() == id )
+ return rec;
+ }
+ return null;
+}
+
+
+function resultBuildFormatIcons( row, rec, is_mr ) {
+
+ var ress = rec.types_of_resource();
+
+ for( var i in ress ) {
+
+ var res = ress[i];
+ if(!res) continue;
+
+ var link = $n(row, res + "_link");
+ link.title = res;
+ var img = link.getElementsByTagName("img")[0];
+ removeCSSClass( img, config.css.dim );
+
+ var f = getForm();
+ if( f != "all" ) {
+ if( f == modsFormatToMARC(res) )
+ addCSSClass( img, "dim2_border");
+ }
+
+ var args = {};
+ args[PARAM_OFFSET] = 0;
+
+ if(is_mr) {
+ args.page = RRESULT;
+ args[PARAM_TFORM] = modsFormatToMARC(res);
+ args[PARAM_MRID] = rec.doc_id();
+
+ } else {
+ args.page = RDETAIL
+ args[PARAM_RID] = rec.doc_id();
+ }
+
+ link.setAttribute("href", buildOPACLink(args));
+
+ }
+}
+
+function fetchGoogleBooksLink () {
+ if (isbnList && googleBooksLink) {
+ var scriptElement = document.createElement("script");
+ scriptElement.setAttribute("id", "jsonScript");
+ scriptElement.setAttribute("src",
+ "http://books.google.com/books?bibkeys=" +
+ escape(isbnList) + "&jscmd=viewapi&callback=unhideGoogleBooksLink");
+ scriptElement.setAttribute("type", "text/javascript");
+ // make the request to Google Book Search
+ document.documentElement.firstChild.appendChild(scriptElement);
+ }
+}
+
+function fetchChiliFreshReviews() {
+ if (chilifresh && chilifresh != '(none)') {
+ try { chili_init(); } catch(E) { console.log(E + '\n'); }
+ }
+}
+
+function resultPageIsDone(pos) {
+
+ return (recordsHandled == getDisplayCount()
+ || recordsHandled + getOffset() == getHitCount());
+}
+
+var resultCCHeaderApplied = false;
+
+/* -------------------------------------------------------------------- */
+/* dynamically add the copy count rows based on the org type 'countsrow'
+ is the row into which we will add TD's to hold the copy counts
+ This code generates copy count cells with an id of
+ 'copy_count_cell_<depth>_<pagePosition>' */
+function resultAddCopyCounts(rec, pagePosition) {
+
+ var r = table.rows[pagePosition + 1];
+ var countsrow = $n(r, config.names.result.counts_row );
+ var ccell = $n(countsrow, config.names.result.count_cell);
+
+ var nodes = orgNodeTrail(findOrgUnit(getLocation()));
+ var start_here = 0;
+ var orgHiding = checkOrgHiding();
+ if (orgHiding) {
+ for (var i = 0; i < nodes.length; i++) {
+ if (orgHiding.depth == findOrgDepth(nodes[i])) {
+ start_here = i;
+ }
+ }
+ }
+
+ var node = nodes[start_here];
+ var type = findOrgType(node.ou_type());
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ //addCSSClass(ccell, config.css.result.cc_cell_even);
+
+ var lastcell = ccell;
+ var lastheadcell = null;
+
+ var cchead = null;
+ var ccheadcell = null;
+ if(!resultCCHeaderApplied && !getLasso()) {
+ ccrow = $('result_thead_row');
+ ccheadcell = ccrow.removeChild($n(ccrow, "result_thead_ccell"));
+ var t = ccheadcell.cloneNode(true);
+ lastheadcell = t;
+ t.appendChild(text(type.opac_label()));
+ ccrow.appendChild(t);
+ resultCCHeaderApplied = true;
+ }
+
+ if(nodes[start_here+1]) {
+
+ var x = start_here+1;
+ var d = findOrgDepth(nodes[start_here+1]);
+ var d2 = findOrgDepth(nodes[nodes.length -1]);
+
+ for( var i = d; i <= d2 ; i++ ) {
+
+ ccell = ccell.cloneNode(true);
+
+ //if((i % 2)) removeCSSClass(ccell, "copy_count_cell_even");
+ //else addCSSClass(ccell, "copy_count_cell_even");
+
+ var node = nodes[x++];
+ var type = findOrgType(node.ou_type());
+
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ countsrow.insertBefore(ccell, lastcell);
+ lastcell = ccell;
+
+ if(ccheadcell) {
+ var t = ccheadcell.cloneNode(true);
+ t.appendChild(text(type.opac_label()));
+ ccrow.insertBefore(t, lastheadcell);
+ lastheadcell = t;
+ }
+ }
+ }
+
+ unHideMe($("search_info_table"));
+}
+
+/* collect copy counts for a record using method 'methodName' */
+function resultCollectCopyCounts(rec, pagePosition, methodName) {
+ if(rec == null || rec.doc_id() == null) return;
+
+ var loc = getLasso();
+ if (loc) loc = -loc;
+ else loc= getLocation();
+
+ var req = new Request(methodName, loc, rec.doc_id(), getForm() );
+ req.request.userdata = [ rec, pagePosition ];
+ req.callback(resultHandleCopyCounts);
+ req.send();
+}
+
+function resultHandleCopyCounts(r) {
+ runEvt('result', 'copyCountsReceived', r.userdata[0], r.userdata[1], r.getResultObject());
+}
+
+
+/* XXX Needs to understand Lasso copy counts... */
+/* display the collected copy counts */
+function resultDisplayCopyCounts(rec, pagePosition, copy_counts) {
+ if(copy_counts == null || rec == null) return;
+
+ if (getLasso()) {
+ var copy_counts_lasso = {
+ transcendant : null,
+ count : 0,
+ unshadow : 0,
+ available : 0,
+ depth : -1,
+ org_unit : getLasso()
+ };
+
+ for (var i in copy_counts) {
+ copy_counts_lasso.transcendant = copy_counts[i].transcendant;
+ copy_counts_lasso.count += parseInt(copy_counts[i].count);
+ copy_counts_lasso.unshadow += parseInt(copy_counts[i].unshadow);
+ copy_counts_lasso.available += parseInt(copy_counts[i].available);
+ }
+
+ copy_counts = [ copy_counts_lasso ];
+ }
+
+ var i = 0;
+ while(copy_counts[i] != null) {
+ var cell = $("copy_count_cell_" + i +"_" + pagePosition);
+ if (cell) {
+ var cts = copy_counts[i];
+ cell.appendChild(text(cts.available + " / " + cts.count));
+
+ if(isXUL()) {
+ /* here we style opac-invisible records for xul */
+
+ if( cts.depth == 0 ) {
+ if(cts.transcendant == null && cts.unshadow == 0) {
+ _debug("found an opac-shadowed record: " + rec.doc_id());
+ var row = cell.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if( cts.count == 0 )
+ addCSSClass( row, 'no_copies' );
+ else
+ addCSSClass( row, 'shadowed' );
+ }
+ }
+ }
+ }
+ i++;
+ }
+}
+
+
--- /dev/null
+var records = new Array();
+var table;
+var rowtemplate;
+var rresultLimit = 200;
+var resultFacetKey;
+
+var rresultIsPaged = false;
+
+function rresultUnload() { removeChildren(table); table = null;}
+
+attachEvt("common", "unload", rresultUnload);
+attachEvt("common", "run", rresultDoSearch);
+attachEvt("result", "idsReceived", rresultCollectRecords);
+attachEvt("result", "recordDrawn", rresultLaunchDrawn);
+
+hideMe($('copyright_block'));
+
+function rresultDoSearch() {
+
+ swapCanvas($('loading_alt'));
+
+ table = G.ui.result.main_table;
+ hideMe(G.ui.result.row_template);
+ if( table && table.parentNode ) {
+ while( table.parentNode.rows.length <= (getDisplayCount() +1) )
+ hideMe(table.appendChild(G.ui.result.row_template.cloneNode(true)));
+ }
+ rresultCollectIds();
+}
+
+function rresultCollectIds() {
+ var ids;
+
+
+ var holdTarget = new CGI().param('hold_target');
+ if(holdTarget != null) {
+ rresultHandlePlaceHold(holdTarget);
+ return;
+ }
+
+ var rtype = getRtype();
+ if (rtype && rtype.indexOf('|') > -1)
+ rtype = rtype.substring(0,rtype.indexOf('|'));
+
+ switch(rtype) {
+
+ case RTYPE_COOKIE:
+ ids = JSON2js(dojo.cookie(COOKIE_RIDS));
+ _rresultHandleIds( ids, ids.length );
+ break;
+
+ case RTYPE_TITLE:
+ case RTYPE_AUTHOR:
+ case RTYPE_SUBJECT:
+ case RTYPE_SERIES:
+ case RTYPE_KEYWORD:
+ rresultDoRecordSearch();
+ break;
+
+ case RTYPE_MULTI:
+ rresultDoRecordMultiSearch();
+ break;
+
+ case RTYPE_LIST :
+ rresultHandleList();
+ break;
+
+ case RTYPE_MARC :
+ rresultCollectMARCIds();
+ break;
+
+ case RTYPE_ISBN :
+ rresultCollectISBNIds();
+ break;
+
+ case RTYPE_TCN :
+ rresultCollectTCNIds();
+ break;
+
+ case RTYPE_ISSN :
+ rresultCollectISSNIds();
+ break;
+
+
+ case RTYPE_MRID :
+ case null :
+ case "" :
+ default:
+ var form = rresultGetForm();
+ var args = { format : form, org : getLocation(), depth : rresultGetDepth() };
+
+ var lasso = getLasso();
+ if (lasso) args.org = -lasso;
+
+ var req = new Request(FETCH_RIDS, getMrid(), args);
+ req.callback( rresultHandleRIds );
+ req.send();
+
+ if( rresultGetDepth() != findOrgDepth(globalOrgTree) ) {
+ var link = $('rresult_show_all_link');
+ if(link) {
+ unHideMe($('rresult_show_all'));
+ link.appendChild( text(
+ findOrgType(globalOrgTree.ou_type()).opac_label()));
+ }
+
+ } else {
+ if( rresultGetDepth() != getDepth() ) { /* inside a limited display */
+ var link = $('rresult_show_here_link');
+ if(link) {
+ link.appendChild( text(
+ findOrgType(findOrgUnit(getLocation()).ou_type()).opac_label()));
+ unHideMe($('rresult_show_here'));
+ }
+ }
+ }
+ }
+}
+
+function rresultExpandSearch() {
+ var args = {};
+ args[PARAM_RDEPTH] = findOrgDepth(globalOrgTree);
+ goTo(buildOPACLink(args));
+}
+
+function rresultContractSearch() {
+ var args = {};
+ RDEPTH = null;
+ args[PARAM_OFFSET] = 0;
+ goTo(buildOPACLink(args));
+}
+
+
+function rresultGetDepth() {
+ if( getRdepth() != null) return getRdepth();
+ return getDepth();
+}
+
+
+function rresultGetForm() {
+ var form;
+
+ if(getTform()) /* did the user select a format from the icon list (temporary) */
+ form = (getTform() == 'all') ? null : getTform();
+ else /* did the use select a format from simple search dropdown */
+ form = (getForm() == 'all') ? null : getForm();
+
+ if(!form) { /* did the user select a format from the advanced search */
+ form = getItemType();
+ var f = getItemForm();
+
+ if(form) {
+ form = form.replace(/,/,'');
+ if(f) form += '-' + f;
+ } else {
+ if(f) form = '-' + f;
+ }
+ }
+
+ return form;
+}
+
+
+function rresultCollectMARCIds() {
+
+ var args = {};
+ args.searches = JSON2js(getSearches());
+ args.limit = 200;
+ args.org_unit = globalOrgTree.id();
+ args.depth = 0;
+
+ rresultIsPaged = true;
+ var req = new Request(FETCH_ADV_MARC_MRIDS, args, getDisplayCount(), getOffset());
+ req.callback(rresultHandleRIds);
+ req.request.noretry = true;
+ req.send();
+}
+
+
+function rresultCollectISBNIds() {
+ var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() );
+ req.callback(
+ function(r) {
+ var blob = r.getResultObject();
+ _rresultHandleIds(blob.ids, blob.count);
+ }
+ );
+ req.send();
+}
+
+function rresultCollectTCNIds() {
+ var req = new Request(FETCH_ADV_TCN_RIDS, getAdvTerm() );
+ req.callback(
+ function(r) {
+ var blob = r.getResultObject();
+ _rresultHandleIds(blob.ids, blob.count);
+ }
+ );
+ req.send();
+}
+
+function rresultCollectISSNIds() {
+ var req = new Request(FETCH_ADV_ISSN_RIDS, getAdvTerm() );
+ req.callback(
+ function(r) {
+ var blob = r.getResultObject();
+ _rresultHandleIds(blob.ids, blob.count);
+ }
+ );
+ req.send();
+}
+
+function rresultHandleList() {
+ var ids = new CGI().param(PARAM_RLIST);
+ var count;
+ if(!dojo.isArray(ids)) {
+ count = 1;
+ ids = [ids];
+ } else {
+ count = ids.length;
+ }
+ if(ids) _rresultHandleIds(ids, count);
+}
+
+var rresultTries = 0;
+function rresultHandleRIds(r) {
+ var res = r.getResultObject();
+
+ if(!res) res = {count:0,ids:[]};
+
+ if( res.count == 0 && rresultTries == 0 && ! r.noretry) {
+
+ rresultTries++;
+ var form = rresultGetForm();
+ var args = { format : form, org : getLocation(), depth : findOrgDepth(globalOrgTree) };
+
+ var lasso = getLasso();
+ if (lasso) args.org = -lasso;
+
+ var req = new Request(FETCH_RIDS, getMrid(), args );
+ req.callback( rresultHandleRIds );
+ req.send();
+ unHideMe($('no_formats'));
+ hideMe($('rresult_show_all'));
+
+ } else {
+
+ _rresultHandleIds(res.ids, res.count);
+ }
+}
+
+function _rresultHandleIds(ids, count) {
+ //var json = js2JSON({ids:ids,count:count});
+ /*
+ dojo.cookie(COOKIE_SRIDS, json, {'expires':1});
+ */
+
+ HITCOUNT = parseInt(count);
+ runEvt('result', 'hitCountReceived');
+ runEvt('result', 'idsReceived', ids, getOffset());
+}
+
+/*
+function rresultCollectRecords(ids) {
+ runEvt("result", "preCollectRecords");
+ var x = 0;
+ for( var i = getOffset(); i!= getDisplayCount() + getOffset(); i++ ) {
+ if(ids[i] == null) break;
+ var req = new Request(FETCH_RMODS, parseInt(ids[i]));
+ req.callback(rresultHandleMods);
+ req.request.userdata = x++;
+ req.send();
+ }
+}
+*/
+
+
+function rresultCollectRecords(ids, base) {
+ runEvt("result", "preCollectRecords");
+ var x = 0;
+
+ // don't perform rdetail redirect if user was on rdetail and cliecked Back
+ if(findCurrentPage() == RRESULT && isXUL()) {
+ if(ids.length == 1 && !xulG.fromBack) {
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = ids[0];
+ location.href = buildOPACLink(args);
+ }
+ }
+
+ if (!base) base = 0;
+ if( rresultIsPaged ) base = 0;
+
+ for( var i = base; i!= getDisplayCount() + base; i++ ) {
+ if(ids[i] == null) break;
+ var req = new Request(FETCH_RMODS, parseInt(ids[i]));
+ req.callback(rresultHandleMods);
+ req.request.userdata = x++;
+ req.send();
+ }
+}
+
+
+var recsReceivedCalled = false;
+function rresultHandleMods(r) {
+ var rec = r.getResultObject();
+ runEvt('result', 'recordReceived', rec, r.userdata, false);
+ resultCollectCopyCounts(rec, r.userdata, FETCH_R_COPY_COUNTS);
+ if(resultPageIsDone() && !recsReceivedCalled) {
+ recsReceivedCalled = true;
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ unHideMe($('copyright_block'));
+ }
+}
+
+function rresultLaunchDrawn(id, node) {
+ runEvt("rresult", "recordDrawn", id, node);
+}
+
+
+function rresultDoRecordSearch() {
+ rresultIsPaged = true;
+ resultCollectSearchIds(true, SEARCH_RS_QUERY, rresultFilterSearchResults );
+}
+
+function rresultDoRecordMultiSearch() {
+ rresultIsPaged = true;
+ resultCollectSearchIds(false, SEARCH_RS_QUERY, rresultFilterSearchResults );
+}
+
+
+function rresultFilterSearchResults(r) {
+ var result = r.getResultObject();
+ var ids = [];
+ if( result.count > 0 ) {
+ for( var i = 0; i != result.ids.length; i++ )
+ ids.push(result.ids[i][0]);
+ }
+
+ resultFacetKey = result.facet_key;
+ resultCompiledSearch = result.compiled_search;
+ dojo.require('dojo.cookie');
+ dojo.cookie(COOKIE_SEARCH, js2JSON(result.compiled_search));
+ _rresultHandleIds( ids, result.count );
+}
+
+
+function rresultHandlePlaceHold(target) {
+ function reload() {
+ location.href = location.href.replace(/&hold_target=\d+/, '');
+ }
+ attachEvt("common", "holdUpdated", reload);
+ attachEvt("common", "holdUpdateCanceled", reload);
+ attachEvt("common", "loginCanceled", reload);
+ holdsDrawEditor({record:target, type: 'T'});
+}
+
--- /dev/null
+var searchBarExpanded = false;
+/* our search selector boxes */
+var _ts, _fs;
+
+
+var isFrontPage = false;
+
+
+G.evt.common.init.push(searchBarInit);
+
+/* if set by the org selector, this will be the location used the
+ next time the search is submitted */
+var newSearchLocation;
+var newSearchDepth = null;
+
+
+function searchBarInit() {
+
+ _ts = G.ui.searchbar.type_selector;
+ _fs = G.ui.searchbar.form_selector;
+
+ try{G.ui.searchbar.text.focus();}catch(e){}
+ G.ui.searchbar.text.onkeydown =
+ function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } };
+ _ts.onkeydown =
+ function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } };
+ _fs.onkeydown =
+ function(evt) {if(userPressedEnter(evt)) { searchBarSubmit(); } };
+
+ G.ui.searchbar.submit.onclick = searchBarSubmit;
+
+ /* set up the selector objects, etc */
+ G.ui.searchbar.text.value = (getTerm() != null) ? getTerm() : "";
+ if (!isFrontPage) G.ui.searchbar.facets.value = (getFacet() != null) ? getFacet() : "";
+ setSelector(_ts, getStype());
+ setSelector(_fs, getForm());
+
+ depthSelInit();
+
+
+ if(!isFrontPage && (findCurrentPage() != MYOPAC)) {
+ attachEvt('common','depthChanged', searchBarSubmit);
+ }
+
+ if( (limit = $('opac.result.limit2avail')) ) {
+ if(getAvail()) limit.checked = true;
+ if(getSort() && getSortDir())
+ setSelector($('opac.result.sort'), getSort()+'.'+getSortDir());
+ }
+}
+
+function searchBarSubmit(isFilterSort) {
+
+ var text = G.ui.searchbar.text.value;
+ var facet_text = isFrontPage ? '' : G.ui.searchbar.facets.value;
+
+ clearSearchParams();
+
+ if(!text || text == "") return;
+
+ var d = (newSearchDepth != null) ? newSearchDepth : depthSelGetDepth();
+ if(isNaN(d)) d = 0;
+
+ var args = {};
+
+ if(SHOW_MR_DEFAULT || findCurrentPage() == MRESULT) {
+ args.page = MRESULT;
+ } else {
+ args.page = RRESULT;
+ args[PARAM_RTYPE] = _ts.options[_ts.selectedIndex].value;
+ }
+
+ args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value;
+ args[PARAM_TERM] = text;
+ args[PARAM_FACET] = facet_text;
+ args[PARAM_LOCATION] = depthSelGetNewLoc();
+ args[PARAM_DEPTH] = d;
+ args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value;
+
+ if($('opac.result.limit2avail')) {
+ args[PARAM_AVAIL] = ($('opac.result.limit2avail').checked) ? 1 : '';
+ if( (val = getSelectorVal($('opac.result.sort'))) ) {
+ args[PARAM_SORT] = val.split('.')[0]
+ args[PARAM_SORT_DIR] = val.split('.')[1]
+ }
+ }
+
+ goTo(buildOPACLink(args));
+}
+
+
--- /dev/null
+/* set up the colors in the sidebar
+ Disables/Enables certain components based on various state data */
+
+attachEvt("common", "init", initSideBar);
+attachEvt("common", "init", setSidebarLinks);
+
+attachEvt("common", "unload", sidebarTreesFree );
+
+function prevRResults() {
+ return buildOPACLink({ page : RRESULT });
+}
+
+function prevMResults() {
+ return buildOPACLink({ page : MRESULT });
+}
+
+function initSideBar() {
+ var page = findCurrentPage();
+
+ if( page == MRESULT )
+ unHideMe($("sidebar_results_wrapper"));
+
+ if( page == RRESULT ) {
+ unHideMe($("sidebar_results_wrapper"));
+ unHideMe(G.ui.sidebar[MRESULT]);
+ if( getRtype() == RTYPE_MRID )
+ $("sidebar_title_group_results").setAttribute("href", prevMResults());
+ else hideMe($("sidebar_title_group_results").parentNode);
+ }
+
+ if( page == RDETAIL ) {
+ unHideMe($("sidebar_results_wrapper"));
+
+
+ unHideMe(G.ui.sidebar[MRESULT]);
+ if(getRtype())
+ $("sidebar_title_results").setAttribute("href", prevRResults());
+ unHideMe(G.ui.sidebar[RRESULT]);
+
+ if( getRtype() == RTYPE_MRID )
+ $("sidebar_title_group_results").setAttribute("href", prevMResults());
+ else hideMe($("sidebar_title_group_results").parentNode);
+ }
+
+ unHideMe(G.ui.sidebar[page]);
+ addCSSClass(G.ui.sidebar[page], "sidebar_item_active");
+
+ /* if we're logged in, show it and replace the Login link with the Logout link */
+ if(grabUser()) {
+ G.ui.sidebar.username_dest.appendChild(text(G.user.usrname()));
+ unHideMe(G.ui.sidebar.logoutbox);
+ unHideMe(G.ui.sidebar.logged_in_as);
+ hideMe(G.ui.sidebar.loginbox);
+ }
+
+ if(G.ui.sidebar.login) G.ui.sidebar.login.onclick = initLogin;
+ if(G.ui.sidebar.logout) G.ui.sidebar.logout.onclick = doLogout;
+
+ if(isXUL()) hideMe( G.ui.sidebar.logoutbox );
+}
+
+/* sets up the login ui components */
+var loginBoxVisible = false;
+
+function loginDance() {
+
+ if(doLogin(true)) {
+
+ if(!strongPassword( G.ui.login.password.value ) ) {
+
+ dojo.require('dojo.cookie');
+ dojo.cookie(COOKIE_SES, "");
+ hideMe($('login_table'));
+ unHideMe($('change_pw_table'));
+ $('change_pw_current').focus();
+ $('change_pw_button').onclick = changePassword;
+ setEnterFunc($('change_pw_2'), changePassword);
+
+ } else {
+ loggedInOK();
+ }
+ }
+}
+
+function loggedInOK() {
+ showCanvas();
+ G.ui.sidebar.username_dest.appendChild(text(G.user.usrname()));
+ unHideMe(G.ui.sidebar.logoutbox);
+ unHideMe(G.ui.sidebar.logged_in_as);
+ hideMe(G.ui.sidebar.loginbox);
+ runEvt( 'common', 'loggedIn');
+
+ var org = G.user.prefs[PREF_DEF_LOCATION];
+ if(!org) org = G.user.home_ou();
+
+ var depth = G.user.prefs[PREF_DEF_DEPTH];
+ if(! ( depth && depth <= findOrgDepth(org)) )
+ depth = findOrgDepth(org);
+
+ runEvt( "common", "locationChanged", org, depth);
+}
+
+
+function changePassword() {
+
+ var pc = $('change_pw_current').value;
+ var p1 = $('change_pw_1').value;
+ var p2 = $('change_pw_2').value;
+
+ if( p1 != p2 ) {
+ alert($('pw_no_match').innerHTML);
+ return;
+ }
+
+ if(!strongPassword(p2, true) ) return;
+
+ var req = new Request(UPDATE_PASSWORD, G.user.session, p2, pc );
+ req.send(true);
+ if(req.result()) {
+ alert($('pw_update_successful').innerHTML);
+ loggedInOK();
+ }
+}
+
+var pwRegexSetting;
+function strongPassword(pass, alrt) {
+
+ /* first, let's see if there is a configured regex */
+ if(!pwRegexSetting) {
+ var regex = fetchOrgSettingDefault(G.user.home_ou(), 'global.password_regex');
+ if(regex) {
+ if(pass.match(new RegExp(regex))) {
+ return true;
+ } else {
+ if(alrt)
+ alert($('pw_not_strong').innerHTML);
+ return false;
+ }
+ }
+ }
+
+ /* no regex configured, use the default */
+
+ var good = false;
+
+ do {
+
+ if(pass.length < 7) break;
+ if(!pass.match(/.*\d+.*/)) break;
+ if(!pass.match(/.*[A-Za-z]+.*/)) break;
+ good = true;
+
+ } while(0);
+
+ if(!good && alrt) alert($('pw_not_strong').innerHTML);
+ return good;
+}
+
+function initLogin() {
+ swapCanvas(G.ui.login.box);
+ try{G.ui.login.username.focus();} catch(e) {}
+
+ G.ui.login.cancel.onclick = function(evt) {
+ G.ui.login.form.setAttribute('action',
+ 'javascript:showCanvas();runEvt("common", "loginCanceled");');
+ };
+
+ if(findCurrentPage() == MYOPAC) {
+ G.ui.login.cancel.onclick = function(evt) {
+ G.ui.login.form.setAttribute('action','javascript:goHome();'); };
+ }
+}
+
+function setSidebarLinks() {
+ G.ui.sidebar.home_link.setAttribute("href", buildOPACLink({page:HOME}));
+ G.ui.sidebar.advanced_link.setAttribute("href", buildOPACLink({page:ADVANCED}));
+ G.ui.sidebar.myopac_link.setAttribute("href", buildOPACLink({page:MYOPAC}, false, true));
+}
+
+function sidebarTreesFree() {
+/*
+ removeChildren($(subjectSidebarTree.rootid));
+ removeChildren($(authorSidebarTree.rootid));
+ removeChildren($(seriesSidebarTree.rootid));
+ subjectSidebarTree = null;
+ authorSidebarTree = null;
+ seriesSidebarTree = null;
+*/
+}
+
+
+
+
+/* --------------------------------------------------------------------------------- */
+/* Code to support GALILEO links for PINES. Fails gracefully
+/* --------------------------------------------------------------------------------- */
+attachEvt('common', 'init', buildEGGalLink);
+function buildEGGalLink() {
+
+ /* we're in a lib, nothing to do here */
+ if( getOrigLocation() ) return;
+ if(!$('eg_gal_link')) return;
+
+ //var link = 'http://demo.galib.uga.edu/express?pinesid=';
+ var link = 'http://www.galileo.usg.edu/express?pinesid=';
+ if(grabUser()) {
+ $('eg_gal_link').setAttribute('href', link + G.user.session);
+ return;
+ }
+
+ $('eg_gal_link').setAttribute('href', 'javascript:void(0);');
+ $('eg_gal_link').setAttribute('target', '');
+ $('eg_gal_link').onclick = function() {
+ /* we're not logged in. go ahead and login */
+ detachAllEvt('common','locationChanged');
+ detachAllEvt('common','loggedIn');
+ attachEvt('common','loggedIn', function() { goTo(link + G.user.session); })
+ initLogin();
+ };
+}
+/* --------------------------------------------------------------------------------- */
+
+
--- /dev/null
+
+/* captures extraneous info from each record */
+
+var subjectCache = {};
+var authorCache = {};
+var seriesCache = {};
+
+function resultBuildCaches(records) {
+ for( var r in records ) {
+ var rec = records[r];
+ for( var s in rec.subject() )
+ subjectCache[s] == null ? subjectCache[s] = 1 : subjectCache[s]++;
+ authorCache[rec.author()] = 1;
+ for( var s in rec.series() ) seriesCache[rec.series()[s]] = 1;
+ }
+}
+
+function resultSortSubjects(a, b) { return -(a.count - b.count); } /* sort in reverse */
+function resultDrawSubjects() {
+
+ var subjs = [];
+ for( var s in subjectCache )
+ subjs.push( { sub : s, count : subjectCache[s] } );
+ subjs.sort(resultSortSubjects);
+
+ var ss = [];
+ for( var s in subjs ) ss.push(subjs[s].sub);
+
+ resultDrawSidebarTrees(
+ STYPE_SUBJECT,
+ "subjectSidebarTree", ss,
+ $("subject_tree_sidebar"),
+ $("subject_sidebar_tree_div") );
+}
+
+function resultDrawAuthors() {
+ var auths = new Array();
+ for( var s in authorCache ) auths.push(s);
+
+ resultDrawSidebarTrees(
+ STYPE_AUTHOR,
+ "authorSidebarTree", auths.sort(),
+ $("author_tree_sidebar"),
+ $("author_sidebar_tree_div") );
+}
+
+function resultDrawSeries() {
+ var sers = new Array();
+ for( var s in seriesCache ) sers.push(s);
+ resultDrawSidebarTrees(
+ STYPE_SERIES,
+ "seriesSidebarTree", sers.sort(),
+ $("series_tree_sidebar"),
+ $("series_sidebar_tree_div") );
+}
+
+var IESux = true;
+
+function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode ) {
+ eval("tree = " + treeName);
+
+ var xrefCache = [];
+ var found = false;
+ var x = 0;
+ for( var i in items ) {
+
+ if(isNull(items[i])) continue;
+
+ /* again, IE is a turd */
+ if(IE) { if(x++ > 5) break; }
+ else { if(x++ > 7) break; }
+
+ found = true;
+
+ var item = normalize(truncate(items[i], 65));
+ var args = {};
+ var href = resultQuickLink( items[i], stype );
+ tree.addNode( stype + "_" + items[i], treeName + 'Root', item, href );
+
+// if( !IE ) resultFireXRefReq(treeName, stype, items[i]);
+
+ var a = {};
+ a.type = stype;
+ a.term = item;
+ xrefCache.push(a);
+ }
+
+ if(found) {
+ unHideMe(wrapperNode);
+// if(IE) resultFireXRefSingle(treeName, xrefCache, stype);
+ /* XXX */ // disabled auth lookups for now
+
+ if( DO_AUTHORITY_LOOKUPS ) {
+ resultFireXRefBatch(treeName, xrefCache, stype);
+ }
+ }
+}
+
+/* XXX */
+function resultFireXRefBatch(treeName, xrefCache, stype) {
+ var query = [];
+ for( var i = 0; i != xrefCache.length; i++ ) {
+ var topic = xrefCache[i];
+ query.push( [ topic.type, topic.term ] );
+ }
+ var req = new Request(FETCH_CROSSREF_BATCH, query);
+ var tree;
+ eval('tree=' + treeName);
+ req.request._tree = tree;
+ req.request._stype = stype;
+ req.callback(resultRenderXRefTree);
+ req.send();
+}
+
+var xrefCacheIndex = {};
+xrefCacheIndex['subject'] = 0;
+xrefCacheIndex['author'] = 0;
+xrefCacheIndex['series'] = 0;
+
+function resultHandleXRefResponse(r) {
+ resultFireXRefSingle( r._treename, r._cache, r._stype );
+ resultAppendCrossRef(r);
+}
+
+
+function resultFireXRefSingle( treeName, xrefCache, stype ) {
+ var i = xrefCacheIndex[stype]++;
+ if(xrefCache[i] == null) return;
+ var item = xrefCache[i].term;
+ var tree;
+ eval('tree=' + treeName);
+ var req = new Request(FETCH_CROSSREF, stype, item);
+ req.request._tree = tree;
+ req.request._item = item;
+ req.request._stype = stype;
+ req.request._cache = xrefCache;
+ req.request._treename = treeName;
+ req.callback(resultHandleXRefResponse);
+ req.send();
+}
+
+function resultFireXRefReq( treeName, stype, item ) {
+ var tree;
+ eval('tree=' + treeName);
+ var req = new Request(FETCH_CROSSREF, stype, item);
+ req.request._tree = tree;
+ req.request._item = item;
+ req.request._stype = stype;
+ req.callback(resultAppendCrossRef);
+ req.send();
+}
+
+
+function resultQuickLink( term, type ) {
+ var args = {};
+ if(SHOW_MR_DEFAULT) {
+ args.page = MRESULT;
+ } else {
+ args.page = RRESULT;
+ args[PARAM_RTYPE] = type;
+ }
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_TERM] = term;
+ args[PARAM_STYPE] = type;
+ return buildOPACLink(args);
+}
+
+/* XXX */
+function resultRenderXRefTree(r) {
+ var tree = r._tree;
+ var res = r.getResultObject();
+ var stype = r._stype;
+
+ for( var c in res ) {
+ var cls = res[c];
+ for( var t in cls ) {
+ var term = res[c][t];
+ var froms = term['from'];
+ var alsos = term['also'];
+ var total = 0;
+
+ for( var i = 0; (total++ < 5 && i < froms.length); i++ ) {
+ var string = normalize(truncate(froms[i], 45));
+ if($(stype + '_' + froms[i])) continue;
+ tree.addNode(stype + '_' + froms[i],
+ stype + '_' + t, string, resultQuickLink(froms[i],stype));
+ }
+ for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) {
+ var string = normalize(truncate(alsos[i], 45));
+ if($(stype + '_' + alsos[i])) continue;
+ tree.addNode(stype + '_' + alsos[i],
+ stype + '_' + t, string, resultQuickLink(alsos[i],stype));
+ }
+ }
+ }
+}
+
+
+/* Addes the see-from/see-also entries for this subject item */
+function resultAppendCrossRef(r) {
+ var tree = r._tree
+ var item = r._item
+ var stype = r._stype;
+ var result = r.getResultObject();
+ if(!result) return;
+ var froms = result['from'];
+ var alsos = result['also'];
+
+ var total = 0;
+
+ for( var i = 0; (total++ < 5 && i < froms.length); i++ )
+ resultAddXRefItem( tree, item, stype, froms, i );
+
+ for( var i = 0; (total++ < 10 && i < alsos.length); i++ )
+ resultAddXRefItem( tree, item, stype, alsos, i );
+}
+
+/**
+ * Adds a single entry into the see-from/also sidebar tree
+ */
+var collectedStrings = [];
+function resultAddXRefItem(tree, rootItem, stype, arr, idx) {
+
+ var string = normalize(truncate(arr[idx], 45));
+
+ if( string == rootItem ) return;
+
+ if( grep( collectedStrings,
+ function(a) { return (a == string); }) ) return;
+
+ if($(stype + '_' + arr[idx])) return;
+
+ tree.addNode(stype + '_' + arr[idx],
+ stype + '_' + rootItem, string, resultQuickLink(arr[idx],stype));
+
+ collectedStrings.push(string);
+}
+
+
+
+
+
+
--- /dev/null
+attachEvt('result', 'allRecordsReceived', insertTip);
+
+/*
+var user_tips = [
+ 'Click on a folder icon in the sidebar to access related quick searches',
+ "If you don't find what you want try expanding your search using the range selector at the right of the search bar"
+];
+*/
+
+function insertTip () {
+ var tip_div = document.getElementById('tips');
+ if (tip_div) {
+ var tips = tip_div.getElementsByTagName('div')[0].getElementsByTagName('span');
+ var index = Math.floor(Math.random() * tips.length);
+ try { tip_div.appendChild( tips[index] ); } catch(E) {}
+ removeCSSClass(tip_div, 'hide_me');
+ }
+}
+
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+<!--
+<tr id='adv_global_trow' type='input'>
+-->
+<tr id='<!--#echo var="adv_global_row_id"-->' type='input'>
+ <td align='center' width='100%' nowrap='nowrap'>
+
+ <!-- select the search class -->
+ <select name='type' style='margin-right: 7px;'>
+ <option value='keyword' selected='selected'>&common.keyword;</option>
+ <option value='title'>&common.title;</option>
+ <option value='author'>&common.author;</option>
+ <option value='subject'>&common.subject;</option>
+ <option value='series'>&common.series;</option>
+ </select>
+
+ <!-- select how to treat the text -->
+ <select name='contains' style='margin-right: 7px;'>
+ <option value='contains'>&opac.advanced.refined.contains;</option>
+ <option value='nocontains'>&opac.advanced.refined.nocontains;</option>
+ <option value='exact'>&opac.advanced.refined.exact;</option>
+ </select>
+
+ <!-- search term -->
+ <input type='text' size='18' name='term' style='margin-right: 3px;' />
+
+ <!-- Remove this row -->
+ <button
+ onclick='
+ var row = this.parentNode.parentNode;
+ var tbody = row.parentNode;
+ if( tbody.getElementsByTagName("tr").length > 2 )
+ row.parentNode.removeChild(row);'>X</button>
+
+ </td>
+</tr>
+
--- /dev/null
+<table id='adv_global_search' class='data_grid data_grid_center' width='100%'>
+
+ <style type="text/css">
+ #adv_global_search select { width: 13em; }
+ #adv_global_input_table select { width: 7em; }
+ .adv_adv_link { font-size: 8pt; color: red; }
+ </style>
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/adv_global.js'> </script>
+
+ <tr style='border-bottom: none;'>
+
+ <!-- Contains the user-addable(?) rows to define search class, containment and text -->
+ <td valign='top' width='65%' style='border-bottom: none;'>
+ <table width='100%' id='adv_global_input_table'>
+
+ <thead>
+ <tr><td colspan='2' align='center'>&advanced.search.title;</td></tr>
+ </thead>
+ <tbody id='adv_global_tbody'>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.common.now_searching = 'now_searching_location';
+ </script>
+
+ <!--#set var="adv_global_row_id" value="adv_global_trow"-->
+ <!--#include virtual="adv_global_row.xml"-->
+
+ <!--#set var="adv_global_row_id" value=""-->
+ <!--#include virtual="adv_global_row.xml"-->
+ <!--#include virtual="adv_global_row.xml"-->
+
+ <!-- add a new row -->
+ <tr id='adv_global_addrow'>
+ <td align='center'>
+ <button onclick='clearSearchBoxes();'>&advanced.search.reset;</button>
+ <span style='padding-left: 10px;'> </span>
+ <button id='myopac_new_global_row' onclick='advAddGblRow();'>&advanced.add.row;</button>
+ <span style='padding-left: 10px;'> </span>
+ <button onclick='advSubmitGlobal();'>&advanced.search.submit;</button>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ </td>
+
+
+ <td rowspan='2'>
+
+ <table width='100%'>
+ <thead>
+ <tr><td colspan='2' align='center'>&advanced.search.filters;</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td align='right'>
+ <span>&advanced.item.form;</span>
+ </td>
+ <td align='left'>
+ <select multiple='multiple' size='3' id='adv_global_item_form'>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align='right'>
+ <span>&advanced.item.type;</span>
+ <a id='adv_global_item_type_link_adv' class='classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ hideMe($("adv_global_item_type_basic"));
+ unHideMe($("adv_global_item_type"));
+ hideMe(this);
+ unHideMe($("adv_global_item_type_link_basic"));
+ '>&advanced.link;</a>
+
+ <a id='adv_global_item_type_link_basic' class='hide_me classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ unHideMe($("adv_global_item_type_basic"));
+ hideMe($("adv_global_item_type"));
+ unHideMe($("adv_global_item_type_link_adv"));
+ hideMe(this);
+ '>&advanced.basic.link;</a>
+ </td>
+
+ <td align='left'>
+ <select multiple='multiple' size='3' id='adv_global_item_type' class='hide_me'>
+ </select>
+ <select multiple='multiple' size='3' id='adv_global_item_type_basic'>
+ <option value='at'>&opac.search.books;</option>
+ <option value='i'>&opac.search.audioBooks;</option>
+ <option value='g'>&opac.search.videoRecordings;</option>
+ <option value='j'>&opac.search.music;</option>
+ <option value='m'>&opac.search.electronic;</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align='right'>
+ <span>&advanced.literary.form;</span>
+ <a id='adv_global_lit_form_link_adv' class='classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ hideMe($("adv_global_lit_form_basic"));
+ unHideMe($("adv_global_lit_form"));
+ hideMe(this);
+ unHideMe($("adv_global_lit_form_link_basic"));
+ '>&advanced.link;</a>
+
+ <a id='adv_global_lit_form_link_basic' class='hide_me classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ unHideMe($("adv_global_lit_form_basic"));
+ hideMe($("adv_global_lit_form"));
+ unHideMe($("adv_global_lit_form_link_adv"));
+ hideMe(this);
+ '>&advanced.basic.link;</a>
+ </td>
+ <td align='left'>
+ <select multiple='multiple' size='3' id='adv_global_lit_form' class='hide_me'>
+ </select>
+ <select multiple='multiple' size='3' id='adv_global_lit_form_basic'>
+ <option value='0 '>&advanced.non.fiction;</option>
+ <option value='1'>&advanced.fiction;</option>
+ </select>
+ </td>
+ </tr>
+
+
+ <!-- Language selector -->
+
+
+ <!-- Audience selector -->
+ <tr>
+ <td align='right'>
+ <span>&advanced.audience;</span>
+
+ <a id='adv_global_audience_link_adv' class='classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ hideMe($("adv_global_audience_basic"));
+ unHideMe($("adv_global_audience"));
+ hideMe(this);
+ unHideMe($("adv_global_audience_link_basic"));
+ '>&advanced.link;</a>
+
+ <a id='adv_global_audience_link_basic' class='hide_me classic_link adv_adv_link'
+ href='javascript:void(0);' onclick='
+ unHideMe($("adv_global_audience_basic"));
+ hideMe($("adv_global_audience"));
+ unHideMe($("adv_global_audience_link_adv"));
+ hideMe(this);'>&advanced.basic.link;</a>
+ </td>
+
+ <td align='left'>
+ <select multiple='multiple' size='3' id='adv_global_audience' class='hide_me'>
+ </select>
+ <select multiple='multiple' size='3' id='adv_global_audience_basic'>
+ <option value='e '>&advanced.adult;</option>
+ <option value='abcdj'>&advanced.juvenile;</option>
+ <option value='fg '>&advanced.general;</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align='right'>
+ <span>&advanced.biblevel;</span>
+ </td>
+ <td align='left'>
+ <select multiple='multiple' size='3' id='adv_global_bib_level'>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align='right'>
+ <span>&advanced.filter.pubyear;</span>
+ </td>
+ <td align='left'>
+ <select id='adv_global_pub_date_type' onchange='
+ if($("adv_global_pub_date_type").selectedIndex == 3)
+ unHideMe($("adv_global_pub_date_2_span"));
+ else
+ hideMe($("adv_global_pub_date_2_span"));'>
+ <option value='equals' selected='selected'>&advanced.filter.pubyear.equals;</option>
+ <option value='before'>&advanced.filter.pubyear.before;</option>
+ <option value='after'>&advanced.filter.pubyear.after;</option>
+ <option value='between'>&advanced.filter.pubyear.between;</option>
+ </select>
+ <div style='margin-top:5px;'>
+ <input id='adv_global_pub_date_1' type='text' size='4' maxlength='4'/>
+ <span id='adv_global_pub_date_2_span' class='hide_me'>
+ &common.and; <input id='adv_global_pub_date_2' type='text' size='4' maxlength='4'/>
+ </span>
+ </div>
+ </td>
+ </tr>
+
+
+ <!-- copy location selector -->
+ <tr id='adv_copy_location_filter_row' class='hide_me'>
+ <td align='right'>&opac.advanced.copy_loc_filter;</td>
+ <td align='left' id='adv_copy_location_filter_td'>
+ <select size='3' id='adv_copy_location_filter_select' multiple='multiple'>
+ </select>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ <tr style='border-top: none;'>
+ <td align='center' valign='top' style='border-top: none;'>
+
+ <table style='border: none; width: 100%;'>
+ <tr>
+ <td align='center' width='100%'>
+ <table class='' width='100%'>
+
+ <thead>
+ <tr>
+ <td align='center' width='50%'>&advanced.sort.criteria;</td>
+ <td align='center'>&advanced.search.library;</td>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+
+ <script language='javascript' type='text/javascript'>
+ function __setsortsel() {
+ var sel = $('adv_global_sort_by')
+ if(sel.selectedIndex == 0) {
+ $("adv_global_sort_dir").disabled = true;
+ $("adv_global_sort_dir").selectedIndex = 0;
+ } else $("adv_global_sort_dir").disabled = false;
+ }
+ </script>
+
+ <td align=''>
+ <select id='adv_global_sort_by' onchange='__setsortsel();'>
+ <option value='rel'>&advanced.relevance;</option>
+ <option value='titlesort'>&common.title;</option>
+ <option value='authorsort'>&common.author;</option>
+ <option value='pubdate'>&advanced.pubdate;</option>
+ </select>
+ </td>
+
+
+ <td align='center' width='100%' nowrap='nowrap'>
+ <b id='now_searching_location'> </b>
+ </td>
+
+ </tr>
+
+ <tr>
+
+ <td>
+ <select id='adv_global_sort_dir' disabled='disabled'>
+ <option value='asc'>&advanced.sort.asc;</option>
+ <option value='desc'>&advanced.sort.desc;</option>
+ </select>
+ </td>
+
+ <!-- force the enable/disable sort dir code to run -->
+ <script language='javascript' type='text/javascript'>__setsortsel();</script>
+
+ <td align='center'>
+ <!--#include virtual="../common/libselect.xml"-->
+ </td>
+
+ </tr>
+ <tr>
+ <td align='center'>
+ <span>&advanced.frbrize;</span>
+ <input id='adv_group_titles' type='checkbox' />
+ </td>
+ <td align='center'>
+ <span>&result.limit2avail;</span>
+ <input type='checkbox' id='opac.result.limit2avail'/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ </tr>
+
+ <tr class='border_4_2'>
+ <td colspan='2'><input type='submit' onclick='advSubmitGlobal();' value='&advanced.search.submit;'></input></td>
+ </tr>
+
+</table>
+
+
--- /dev/null
+<!--
+XXX Deprecate me
+-->
+
+<table class='data_grid' width='100%'>
+ <thead>
+ <tr>
+ <td colspan='6'>&opac.advanced.marc.title;</td>
+ </tr>
+ </thead>
+ <tbody id='advanced.marc.tbody'>
+ <tr id='advanced.marc.template'>
+ <td>
+ <span>&opac.advanced.marc.tag;: </span>
+ <input name='advanced.marc.tag' maxlength='3' size='3' />
+ </td>
+ <td>
+ <span>&opac.advanced.marc.subfield;: </span>
+ <input name='advanced.marc.subfield' maxlength='1' size='1' />
+ </td>
+ <td>
+ <span>&opac.advanced.marc.value;: </span>
+ <input name='advanced.marc.value' size='36' />
+ </td>
+
+ <td>
+ <input type='submit' value='X' onclick='
+ var row = this.parentNode.parentNode;
+ var tbody = row.parentNode;
+ if(tbody.getElementsByTagName("tr").length > 2)
+ tbody.removeChild(row);
+ ' />
+ </td>
+ </tr>
+ <tr id='advanced.marc.submit.row'>
+ <td colspan='4' align='center'>
+
+ <input name='advanced.marc.addrow' type='submit' onclick='advAddMARC();'
+ value='&opac.advanced.marc.addrow;' />
+
+ <input style='margin-left: 10px;'
+ onclick='advMARCRun();' type='submit' value='&common.submit;' />
+ </td>
+ </tr>
+ </tbody>
+</table>
--- /dev/null
+<!--
+XXX Deprecate me
+-->
+
+<table class='data_grid' width='95%'>
+ <thead>
+ <tr>
+ <td colspan='6'>&opac.advanced.quick.title;</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <span style='padding-right: 0px;'>&common.call.number.label;</span>
+ <input id='opac.advanced.quick.cn' style='margin: 2px;' type='text' size='12' />
+ <input type='submit' onclick='advCNRun();' value='&advanced.go;' />
+ </td>
+ <td>
+ <span style='padding-right: 0px;'>&common.isbn.label;</span>
+ <input id='opac.advanced.quick.isbn' style='margin: 2px;' type='text' size='13' maxlength='13' />
+ <input type='submit' onclick='advISBNRun();' value='&advanced.go;' />
+ </td>
+ <td>
+ <span style='padding-right: 0px;'>&common.issn.label;</span>
+ <input id='opac.advanced.quick.issn' style='margin: 2px;' type='text' size='9' maxlength='9' />
+ <input type='submit' onclick='advISSNRun();' value='&advanced.go;' />
+ </td>
+ </tr>
+ </tbody>
+</table>
--- /dev/null
+<body class="tundra">
+ <table width='100%'>
+ <tbody>
+ <tr>
+ <td id='main_left_cell'>
+ <!--#include virtual="common/logo.xml"-->
+ <!--#include virtual="common/sidebar.xml"-->
+ </td>
+ <td id='main_right_cell'>
+ <div id='content' class=''>
+
+ <!--#if expr="$OILS_PAGE!='advanced.xml'"-->
+ <!--#include virtual="common/searchbar.xml"-->
+ <!--#include virtual="common/statusbar.xml"-->
+ <!--#endif-->
+
+ <!--#include virtual="common/fonts.xml"-->
+
+ <!--#include virtual="common/altcanvas.xml"-->
+ <!--#include virtual="common/ilsevents.xml"-->
+ <!--#include virtual="page_${OILS_PAGE}"-->
+ </div>
+ <br/>
+ <!--#include virtual="common/tips.xml"-->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <!--#include virtual='footer.xml'-->
+ <center>
+ <div id='gcfPrompt' class='hide_me'>
+ <script>dojo.require('dojo.cookie')</script>;
+ <div><span>&common.googlechromeframe.why;</span></div>
+ <button onclick='CFInstall.check({preventPrompt: false, mode: "popup"});'>&common.googlechromeframe.install;</button>
+ <button onclick='dojo.cookie("noGCF", "true", {path:"/", expires: 365}); hideMe($("gcfPrompt"));'>&common.googlechromeframe.dontask;</button>
+ </div>
+ </center>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
+ <script><![CDATA[
+ CFInstall.check({
+ preventPrompt: true,
+ onmissing: function() {
+ if (dojo.cookie("noGCF") != "true")
+ unHideMe($('gcfPrompt'));
+ }
+ });]]>
+ </script>
+
+ <script language="javascript" type="text/javascript">
+ dojo.addOnLoad(init);
+ dojo.require("dijit._Calendar");
+ dojo.require("dijit.form.DateTextBox");
+ dojo.require("dijit.form.FilteringSelect");
+ dojo.require("dojo.date.locale");
+ dojo.require("dojo.date.stamp");
+ dojo.require("dojo.parser");
+ dojo.require("openils.widget.FacetSidebar"); // pulls in Searcher and I18N
+ </script>
+
+</body>
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+
+<!-- These are the UI components that may be needed on any given page. The must be
+ set to class += 'hide_me' by default -->
+
+<div id='not_the_canvas' xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <!-- the login page -->
+ <!--#if expr="$FRONT_PAGE!='true'"-->
+ <!--#include virtual="login.xml"-->
+ <!--#endif-->
+
+ <!-- The org tree -->
+ <!--#include virtual="orgtree.xml"-->
+
+ <!-- ============================================================================= -->
+ <!-- Register the alternate canvases -->
+ <script language='javascript' type='text/javascript'>
+ config.ids.altcanvas.org_tree = config.ids.common.org_container;
+ config.ids.altcanvas.holds = 'holds_box';
+ config.ids.altcanvas.check_holds = 'check_holds_box';
+ config.ids.altcanvas.xulholds = 'xulholds_box';
+ config.ids.altcanvas.loading = 'loading_alt';
+ //config.ids.altcanvas.cnbrowse = 'cn_browse';
+ </script>
+
+ <!--#if expr="$FRONT_PAGE!='true'"-->
+ <!--#include virtual="holds.xml"-->
+ <!-- #include virtual="cn_browse.xml"-->
+ <!--#endif-->
+
+ <div id='loading_alt' class='hide_me canvas' style='margin-top: 6px;'>
+ <div style='margin-top: 30px; margin-bottom: 30px; text-align: center; font-weight: 700;' class='color_3'>
+ <img src='../../../../images/progressbar_green.gif' style='margin: 5px; height: 32px; width: 32px;' />
+ </div>
+ </div>
+
+</div>
--- /dev/null
+<div id='cn_browse' class='hide_me cn_browser'
+ style='width: 95%; text-align: center; padding: 15px;'>
+ <div id='cn_browse_loading' class='cn_browse_loading hide_me'>&common.cn.loading;</div>
+ <div id='cn_browse_div'>
+
+
+ <div style='width: 90%; text-align: center; margin: 10px;' class='color_4'>
+ <span>&common.cn.browsing;</span><b style='margin-left: 6px;' id='cn_browse_where'> </b>
+ </div>
+ <table class='data_grid bookshelf' width='100%'>
+ <thead>
+ <tr>
+ <td><a id='cn_browse_next' class='classic_link'
+ href='javascript:cnBrowsePrev();'><b>&common.cn.previous;</b></a></td>
+ <td colspan='1' align='center'>&common.cn.shelf;</td>
+ <td><a id='cn_browse_prev' class='classic_link'
+ href='javascript:cnBrowseNext();'><b>&common.cn.next;</b></a></td>
+ </tr>
+ </thead>
+ <tbody id='cn_tbody'>
+ <tr id='cn_browse_row'>
+ <td id='cn_browse_td' class='cn_browse_item' width='25%' valign='top'>
+ <a><img height='60' width='50'
+ class='cn_browse_info' name='cn_browse_pic' border='0' /></a>
+ <div style='font-weight: bold;' class='cn_browse_info' name='cn_browse_cn'> </div>
+ <div class='cn_browse_info'><a name='cn_browse_title' class='classic_link'> </a></div>
+ <div class='cn_browse_info'><a name='cn_browse_author' class='classic_link'> </a></div>
+ <div class='cn_browse_info' name='cn_browse_lib'> </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
--- /dev/null
+<!-- CSS shared across pages goes here -->
+
+<link type='text/css' rel='stylesheet' href="<!--#echo var='OILS_SKIN_BASE'-->/default/css/layout.css"/>
+
+<!-- Our font CSS's -->
+<link type='text/css' rel='stylesheet' href='<!--#echo var="OILS_CSS_BASE"-->/mediumfont.css' />
+
+<!-- Our colors -->
+<link type='text/css' rel="stylesheet" href="<!--#echo var='OILS_THEME_BASE'-->/mansion/css/colors.css" />
+
+<!-- An alternate stylesheet -->
+<link type='text/css' rel="alternate stylesheet" title='&opac.style.reddish;' href="<!--#echo var='OILS_THEME_BASE'-->/reddish/css/colors.css" />
+
+<!-- OpenSearch auto discovery -->
+<link type="application/opensearchdescription+xml"
+ rel='search' title="Evergreen"
+ href="http://<!--#echo var='SERVER_NAME'-->/opac/extras/opensearch/1.1/-/osd.xml" />
+
+<!-- enable Dojo date picker -->
+<style type="text/css">
+ @import '/js/dojo/dojo/resources/dojo.css';
+ @import '/js/dojo/dijit/themes/tundra/tundra.css';
+</style>
--- /dev/null
+<div id='fonts_div'>
+
+ <div id='text_size_div' style='position:absolute; top: 2px; right: 6px;'>
+ <span style='vertical-align: top;'>&common.textsize.title;</span>
+ <span style='vertical-align: top;'><a href="javascript:void(0);" onclick="setFontSize('regular');"> &common.textsize.regular; </a></span>
+ <span style='vertical-align: top;'> &common.textsize.separator; </span>
+ <span style='vertical-align: top;'><a href="javascript:void(0);" onclick="setFontSize('large');"> &common.textsize.large; </a></span>
+
+<!--
+<span style='vertical-align: top;'>&common.language;</span>
+-->
+<!-- <span id='translation_switch' dojoType="dijit.form.FilteringSelect" store="openils.I18N.localeStore"
+ searchAttr="label" required="false" jsId='opacLocaleSelector'>
+
+ <script type="text/javascript">
+ dojo.addOnLoad(function() {
+ opacLocaleSelector.setValue(locale);
+ dojo.connect(opacLocaleSelector, 'onChange',
+ function () {
+ location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+ }
+ );
+ });
+ </script>
+
+ </span>
+-->
+ </div>
+
+</div>
--- /dev/null
+<select id='<!--#echo var="FORM_SEL_ID"-->' >
+ <option value=''>&opac.search.allFormats;</option>
+ <option value='at'>&opac.search.books;</option>
+ <option value='at-d'>&opac.search.largePrint;</option>
+ <option value='at-s'>&opac.search.ebook;</option>
+ <option value='i'>&opac.search.audioBooks;</option>
+ <option value='g'>&opac.search.videoRecordings;</option>
+ <option value='j'>&opac.search.music;</option>
+ <option value='m'>&opac.search.electronic;</option>
+</select>
+
--- /dev/null
+<div>
+ <div id='xulholds_box' class='hide_me canvas' style='margin-top: 6px;'>
+ <center>
+ <table class='data_grid' style='margin-top: 20px;'>
+ <tbody>
+ <tr>
+ <td>&opac.holds.xulRecipient;:</td>
+ <td><input type='text' id='xul_recipient_barcode' /></td>
+ <td><input type='submit' value='&common.submit;' id='xul_recipient_barcode_submit' /></td>
+ <td><input type='submit' value='&common.cancel;' onclick='showCanvas();' /></td>
+ <td><input type='submit' value='&common.hold.place;' id='xul_recipient_me' /></td>
+ </tr>
+ </tbody>
+ </table>
+ </center>
+ </div>
+
+ <div id='check_holds_box' class='hide_me canvas'
+ style='margin-top: 6px; width: 100%; text-align: center'>
+ <br/><br/><br/>
+ <b>&common.hold.check;</b>
+ </div>
+
+ <div id='holds_box' class='hide_me canvas' style='margin-top: 6px;'>
+
+ <br/>
+ <table width='90%'>
+ <tbody>
+ <tr>
+ <td class='holds_cell color_1'
+ align='center' colspan='2'>&common.hold.create;</td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&opac.holds.recipient;:</td>
+ <td class='holds_cell' id='holds_recipient'> </td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&common.title.label;</td>
+ <td class='holds_cell' id='holds_title'> </td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&common.author;</td>
+ <td class='holds_cell' id='holds_author'> </td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&common.format;</td>
+ <td class='holds_cell' id='holds_format'> </td>
+ </tr>
+ <tr id='hold_physical_desc_row'>
+ <td class='holds_cell'>&common.physical.label;</td>
+ <td class='holds_cell' id='holds_physical_desc'> </td>
+ </tr>
+
+ <tr class='hide_me' id='holds_parts_row'>
+ <td class='holds_cell'>&common.mono_parts.label;</td>
+ <td class='holds_cell'>
+ <span class='hide_me' id='holds_parts_label'></span>
+ <select id='holds_parts_selector' class='hide_me'>
+ <option value=''></option>
+ </select>
+ </td>
+ </tr>
+
+ <tr class='hide_me' id='holds_cn_row'>
+ <td class='holds_cell'>&common.call.number.label;</td>
+ <td class='holds_cell'><b id='holds_cn'/> </td>
+ </tr>
+
+ <tr class='hide_me' id='holds_copy_row'>
+ <td class='holds_cell'>&common.copy.barcode.label;</td>
+ <td class='holds_cell'><b id='holds_copy'/> </td>
+ </tr>
+
+ <tr class='hide_me' id='holds_issuance_row'>
+ <td class='holds_cell'>&common.issuance_label.label;</td>
+ <td class='holds_cell'><b id='holds_issuance_label'/> </td>
+ </tr>
+
+ <tr class='hide_me' id='holds_type_row'>
+ <td class='holds_cell'>&common.hold.type.label;</td>
+ <td class='holds_cell hide_me' id='holds_is_cn'><b>&common.hold.volume;</b></td>
+ <td class='holds_cell hide_me' id='holds_is_copy'><b>&common.hold.copy;</b></td>
+ <td class='holds_cell hide_me' id='holds_is_issuance'><b>&common.hold.issuance;</b></td>
+ </tr>
+
+ <tr>
+ <td class='holds_cell'>&opac.holds.contactPhone;:</td>
+ <td class='holds_cell'>
+ <input id='holds_phone' size='13' maxlength='12'/>
+ <span style='margin-left: 4px; font-size: 7pt;'>&common.phone.format;</span>
+ </td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&common.phone.enable;</td>
+ <td class='holds_cell'>
+ <input type='checkbox' id='holds_enable_phone' checked='checked'
+ onchange='
+ if (this.checked) $("holds_phone").disabled=false;
+ else $("holds_phone").disabled = true;'/>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='holds_cell'>&opac.holds.contactEmail;:</td>
+ <td class='holds_cell' id='holds_email'>
+ <span class='hide_me' id='holds.no_email'>
+ &common.email.none;<br/>
+ &common.email.set;
+ </span>
+ <span class='hide_me' id='holds.no_email.xul'>
+ &common.email.none;
+ </span>
+
+ </td>
+ </tr>
+ <tr>
+ <td class='holds_cell'>&common.email.enable;</td>
+ <td class='holds_cell'>
+ <input type='checkbox' id='holds_enable_email' checked='checked'/>
+ </td>
+ </tr>
+ <!--
+ <tr id='holds_depth_selector_row' class='hide_me'>
+ <td class='holds_cell'>Hold Range</td>
+ <td class='holds_cell'>
+ <select id='holds_depth_selector'></select>
+ </td>
+ </tr>
+ -->
+ <tr>
+ <td class='holds_cell'>&opac.holds.pickupLocation;</td>
+ <td class='holds_cell'>
+ <select id='holds_org_selector'> </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='holds_cell'>&opac.holds.expire_time;</td>
+ <td class='holds_cell'>
+ <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' id='holds_expire_time' />
+ </td>
+ </tr>
+
+ <tr>
+ <td class='holds_cell'>
+ &opac.holds.freeze;
+ <a class='classic_link' href='javascript:alert("&opac.holds.freeze.help;");'>&common.help;</a>
+ </td>
+ <td class='holds_cell'>
+ <input type='checkbox' id='holds_frozen_chkbox'
+ onchange='
+ if($("holds_frozen_chkbox").checked)
+ unHideMe($("hold_frozen_thaw_row"));
+ else
+ hideMe($("hold_frozen_thaw_row"));
+ ' />
+ </td>
+ </tr>
+
+ <tr id='hold_frozen_thaw_row' class='hide_me'>
+ <td class='holds_cell'>
+ <script language='javascript' type='text/javascript'> if($('holds_frozen_chkbox').checked) unHideMe($("hold_frozen_thaw_row"));</script>
+ &opac.holds.freeze.thaw_date;
+ </td>
+ <td class='holds_cell'>
+ <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' id='holds_frozen_thaw_input' />
+ </td>
+ </tr>
+
+ <tr id='holds_alt_formats_row_extras' class='hide_me'>
+ <td colspan='2' align='center'>
+ <div style='padding: 8px;'>
+ <a class='classic_link' href='javascript:void(0);' style='padding: 5px;'
+ onclick='unHideMe($("holds_alt_formats_row"));'>&common.hold.advanced;</a>
+ </div>
+ </td>
+ </tr>
+
+ <tr id='holds_alt_formats_row' class='hide_me'>
+
+ <td class='holds_cell'>
+ <div style='margin-bottom: 5px;'>
+ <span>&common.format.alternatives; </span>
+ <span> <a class='classic_link' style='color:red;' href='javascript:void(0);'
+ onclick='alert($("holds_explain_adv").innerHTML)'>&common.help;</a></span>
+ </div>
+ <div>&common.control.click;</div>
+ </td>
+
+ <td class='holds_cell'>
+ <select id='hold_alt_form_selector' multiple='multiple' style='width: 14em;'>
+ <option value='at' class='hide_me'>&opac.search.books;</option>
+ <option value='at-d' class='hide_me'>&opac.search.largePrint;</option>
+ <option value='at-s' class='hide_me'>&opac.search.ebook;</option>
+ <option value='i' class='hide_me'>&opac.search.audioBooks;</option>
+ <option value='g' class='hide_me'>&opac.search.videoRecordings;</option>
+ <option value='j' class='hide_me'>&opac.search.music;</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='holds_cell' align='center' colspan='2'>
+ <button id='holds_submit'>&opac.holds.placeHold;</button>
+ <button class='hide_me' id='holds_update'>&common.hold.update;</button>
+ <span style='padding: 20px;'> </span>
+ <button id='holds_cancel'>&common.cancel;</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class='hide_me' id='holds_success'>&opac.holds.success;</div>
+ <div class='hide_me' id='holds_failure'>&opac.holds.failure;</div>
+ <span class='hide_me' id='holds_bad_phone'>
+ &common.phone.format.help;
+ </span>
+
+ <span class='hide_me' id='hold_not_allowed'>
+ &common.hold.failed;
+ </span>
+ <span class='hide_me' id='hold_has_parts'>&opac.hold.has_parts;</span>
+
+ </div>
+
+ <span class='hide_me' id='format_words'>
+ <span name='at'>&opac.search.books;</span>
+ <span name='at-d'>&opac.search.largePrint;</span>
+ <span name='i'>&opac.search.audioBooks;</span>
+ <span name='g'>&opac.search.videoRecordings;</span>
+ <span name='j'>&opac.search.music;</span>
+ <span name='m'>&opac.search.electronic;</span>
+ </span>
+
+ <span class='hide_me' id='holds_explain_adv'>&holds.advanced_options;</span>
+
+ <span class='hide_me' id='holds_pick_good_org'>&common.hold.delivery;</span>
+
+ <span class='hide_me' id='hold_dup_exists'>&common.hold.exists;</span>
+ <span class='hide_me' id='hold_checked_out'>&common.hold.checked_out;</span>
+
+ <span class='hide_me' id='hold_dup_exists_override'>&common.hold.exists.override;</span>
+ <span class='hide_me' id='hold_checked_out_override'>&common.hold.checked_out.override;</span>
+
+ <span id='hold_failed_patron_barred' class='hide_me'>&common.hold.barred;</span>
+
+ <span id='invalid_hold' class='hide_me'>&common.hold.item.invalid;</span>
+
+ <span id='holds_invalid_recipient' class='hide_me'>&common.hold.patron.invalid;</span>
+
+</div>
--- /dev/null
+<span class='hide_me'>
+ <span id='ilsevent.1000'>&ilsevent.1000;</span>
+ <span id='ilsevent.1001'>&ilsevent.1001;</span>
+ <span id='ilsevent.1002'>&ilsevent.1002;</span>
+ <span id='ilsevent.1200'>&ilsevent.1200;</span>
+ <span id='ilsevent.5000'>&ilsevent.5000;</span>
+ <span id='ilsperm.CREATE_HOLD'>&ilsperm.CREATE_HOLD;</span>
+
+ <!-- Local OPAC Specific strings/events -->
+ <span id='auth_session_expiring'>&opac.session_expiring;</span>
+ <span id='auth_session_expired'>&opac.session_expired;</span>
+ <span id='user_not_found'>&common.user_not_found;</span>
+</span>
+
--- /dev/null
+<!--#if expr="$OILS_PAGE='myopac.xml'"-->
+<!-- my acccount uses a lot more classes -->
+<script language='javascript'
+ src='/IDL2js?mvr,bre,aou,aout,pgt,lasso,cmf,cmc,cmsa,cam,cifm,clfm,citm,cblvl,ccs,accs,au,ahr,ahrn,acn,actscecm,cbreb,cbreb,cbrebi,acp,cust,ac,aua,mous,circ,mbts,mb,ausp,csp'
+ type='text/javascript'></script>
+<!--#else-->
+<script language='javascript'
+ src='/IDL2js?mvr,bre,aou,aout,pgt,lasso,cmf,cmc,cmsa,cam,cifm,clfm,citm,cblvl,ccs'
+ type='text/javascript'></script>
+<!--#endif-->
+
+<script language='javascript' type="text/javascript">
+ var locale = location.href.replace( /.+opac\/([^\/]+)\/skin.+/, '$1' );
+ if (!locale) locale = '<!--#echo var="locale"-->';
+ var djConfig = {
+ locale: locale.toLowerCase(),
+ parseOnLoad: true,
+ isDebug: false
+ }, lang, bidi;
+</script>
+
+<script language='javascript' src='/js/dojo/dojo/dojo.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/JSON_v1.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type="text/javascript" src='/js/dojo/opensrf/opensrf.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type="text/javascript" src='/js/dojo/dojo/openils_dojo.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type="text/javascript" src='/js/dojo/fieldmapper/AutoIDL.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+
+<script language='javascript' type="text/javascript" src='<!--#echo var="OILS_JS_BASE"-->/<!--#echo var="locale"-->/OrgTree.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type="text/javascript" src='<!--#echo var="OILS_JS_BASE"-->/<!--#echo var="locale"-->/FacetDefs.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<script language='javascript' type="text/javascript" src='<!--#echo var="OILS_JS_BASE"-->/OrgLasso.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+
+<!--#if expr="$OILS_OPAC_COMBINED_JS"-->
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/combined.js?<!--#include virtual="/eg_cache_hash"-->'></script>
+<!--#else -->
+<!--
+ When combined JS is enabled in the Apache config, the block
+ below defines which files are added to the final combined JS file.
+ Currently, only files in $OPAC/common/js/ are eligible for automatic combination.
+-->
+<!--START COMPRESSION-->
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/utils.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/config.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/CGI.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/md5.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/slimtree.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/opac_utils.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/org_utils.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/RemoteRequest.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/init.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/added_content.js'></script>
+<!--END COMPRESSION-->
+<!--#endif -->
+
+<!-- Some global js -->
+<script language='javascript' type='text/javascript'>
+ config.css.color_1 = "color_1";
+ config.css.color_2 = "color_2";
+ config.css.color_3 = "color_3";
+ <!-- set up some global JS config variables, read from the Apache config -->
+ var OILS_OPAC_IMAGES_HOST = null;
+ <!--#if expr="$OILS_OPAC_IMAGES_HOST"-->
+ OILS_OPAC_IMAGES_HOST = '<!--#echo var="OILS_OPAC_IMAGES_HOST"-->extras/ac/jacket/';
+ <!--#endif -->
+ var OILS_OPAC_STATIC_PROTOCOL = null;
+ <!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+ OILS_OPAC_STATIC_PROTOCOL = '<!--#echo var="OILS_OPAC_STATIC_PROTOCOL"-->';
+ <!--#endif -->
+ <!-- builds the "Now searching: <org_unit>" text on the home page -->
+ function home_init() {
+ getId("home_adv_search_link").setAttribute("href", buildOPACLink({page:ADVANCED}));
+ getId("home_myopac_link").setAttribute("href", buildOPACLink({page:MYOPAC}, false, true));
+ }
+ <!--#if expr="$OILS_OPAC_FORCE_LOGIN_SSL"-->
+ forceLoginSSL = true;
+ <!--#endif -->
+</script>
--- /dev/null
+<span>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/depth_selector.js'></script>
+ <span class='hide_me' id='depth_selector_span'>
+ <!--#if expr="$SHOW_DEPTHSEL_TEXT='true'"-->
+ <span>&library.select; </span>
+ <!--#endif-->
+ <select id='depth_selector' >
+ <option value='new'>&library.select.label;</option>
+ </select>
+ </span>
+ <span class='hide_me' id='lib_selector_span'>
+ <a id='lib_selector_link' class='classic_link' href='javascript:void(0)'>&library.select.help;</a>
+ </span>
+</span>
+
--- /dev/null
+
+<div id='login_box' class='hide_me canvas' style='margin-top: 6px;'>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.login = {};
+ config.css.login = {};
+ config.ids.login.form = "login_form";
+ config.ids.login.box = "login_box";
+ config.ids.login.tbody = "login_tbody";
+ config.ids.login.username = "login_username";
+ config.ids.login.password = "login_password";
+ config.ids.login.button = "login_button";
+ config.ids.login.cancel = "login_cancel_button";
+ config.ids.altcanvas.login = config.ids.login.box;
+ </script>
+ <script type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/password_reset.js'></script>
+
+ <br/>
+
+ <div class='login_text color_1' style='padding: 4px; text-align: center;'>
+ <span>&opac.login.login;</span>
+ </div>
+
+ <br/>
+
+ <form id='login_form' method='POST' action='javascript:loginDance();'>
+ <table id='login_table' class='data_grid' style='margin-left: 20px;' width='95%'>
+ <tbody id='login_tbody'>
+ <tr>
+ <td><span class='login_text'>&login.username;</span></td>
+ <td>
+ <span class='login_text'>
+ <input id='login_username' name='login_username' type='text' size='16'></input>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span class='login_text'>&common.password;</span>
+ </td>
+ <td>
+ <span class='login_text'>
+ <input id='login_password' name='login_password' type='password' size='16'></input>
+ </span>
+ </td>
+ </tr>
+ <tr><td><br/></td><td/></tr>
+ <tr class='color_1'>
+ <td colspan='2' align='center'>
+ <span class='login_text' style='margin-right: 20px;'>
+ <input type='submit' value='&common.login;' name='login_button' id='login_button'></input>
+ </span>
+ <span class='login_text' style='margin-left: 20px;'>
+ <input type='submit' name='login_cancel_button' id='login_cancel_button' value='&common.cancel;'></input>
+ </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+
+ <table id='change_pw_table' class='data_grid hide_me' style='margin-left: 20px;' width='95%'>
+ <thead>
+ <tr><td colspan='2' align='center'><b>&login.password;</b></td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td colspan='2' style='padding:10px;'>
+ &login.first.time;
+ &common.password_criteria;
+ </td>
+ </tr>
+
+ <tr>
+ <td>&login.password.current.enter;</td>
+ <td><input type='password' id='change_pw_current'/></td>
+ </tr>
+
+ <tr>
+ <td>&login.password.new.enter;</td>
+ <td><input type='password' id='change_pw_1'/></td>
+ </tr>
+ <tr>
+ <td>&login.password.new.reenter;</td>
+ <td><input type='password' id='change_pw_2'/></td>
+ </tr>
+ <tr><td><br/></td><td/></tr>
+ <tr class='color_1'>
+ <td colspan='2' align='center'>
+ <span class='login_text' style='margin-right: 20px;'>
+ <input type='submit' value='&login.password.update;' id='change_pw_button'/>
+ </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <span id='pw_no_match' class='hide_me'>&login.password.nomatch;</span>
+ <span id='pw_update_successful' class='hide_me'>&login.password.success;</span>
+
+ <span id='pw_not_strong' class='hide_me'>
+ &login.password.strength;
+ &common.password_criteria;
+ </span>
+
+ <span id='patron_card_inactive_alert' class='hide_me'>&login.barcode.inactive;</span>
+
+ <span id='patron_inactive_alert' class='hide_me'>&login.account.inactive;</span>
+
+ <span id='patron_login_failed' class='hide_me'>&login.failed;</span>
+
+</div>
+
+
--- /dev/null
+<div id='logo_div'>
+ <script language='javascript' type='text/javascript'>config.ids.common.top_logo = "top_left_logo";</script>
+ <img style='margin-right: 4px; height: 48px; width: 187px;' src='<!--#echo var="OILS_BASE"-->/images/small_logo.jpg' id='top_left_logo' border='0' class='logo' />
+</div>
--- /dev/null
+
+<!-- the org tree -->
+<div id='org_container' class='hide_me canvas'>
+
+ <div id='org_link_container' class='color_1'>
+ <span class='org_link'>
+ <a onclick='orgTreeSelector.expandAll();'
+ href='javascript:void(0);'>&common.org.openAll;</a>
+ </span>
+ <span class='org_link'>
+ <a onclick='orgTreeSelector.closeAll();'
+ href='javascript:void(0);'>&common.org.closeAll;</a>
+ </span>
+ <span class='org_link'>
+ <a onclick='showCanvas();' href='javascript:void(0);'>&common.org.cancel;</a>
+ </span>
+ </div>
+
+ <div id='org_loading_div'><br/><span>&common.org.loading;</span></div>
+ <br/>
+ <div id='org_selector_tip' class='tips hide_me'><b>&common.org.note;</b>
+ <span>&common.org.notetext;</span>
+ </div>
+ <br/>
+ <div id='org_tree' class='org_tree'> </div>
+ <br/>
+</div>
--- /dev/null
+
+<!-- Navigation bar -->
+
+<div id="sidebar_div" class="sidebar_div" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <div class='sidebar_chunk'>
+
+ <div title="&navigate.home.title;"
+ id='home_link_div' class="side_bar_item ">
+ <a id='home_link' href='index.xml'>&navigate.home;</a>
+ </div>
+
+ <div title="&opac.navigate.advanced.title;"
+ id='advanced_link_div' class="side_bar_item ">
+ <a id='advanced_link' href='advanced.xml'>&opac.navigate.advanced;</a>
+ </div>
+
+ <div title="&navigate.myopac.title;"
+ id='myopac_link_div' class="side_bar_item ">
+ <a id='myopac_link' href='myopac/myopac.xml'>&navigate.myopac;</a>
+ </div>
+
+ <div title="&navigate.login.title;"
+ id='login_link_div' class="side_bar_item ">
+ <a id='login_link' href='javascript:void(0);'>&navigate.login;</a>
+ </div>
+
+ <div title="&navigate.logout.title;"
+ id='logout_link_div' class="side_bar_item hide_me ">
+ <a id='logout_link' href='javascript:void(0);'>&navigate.logout;</a>
+ </div>
+
+
+ <!-- Informational sidebar components -->
+
+ <div id='logged_in_as_div' title="&navigate.loggedinas.title;" class="side_bar_item hide_me">
+ <span>&navigate.loggedinas;<b id='username_dest'> </b></span>
+ </div>
+
+ <div id='sidebar_results_wrapper' class='hide_me border_1'>
+ <div title="&navigate.titleGroupResults;"
+ id='mresult_link_div' class="side_bar_item hide_me">
+ <a id='sidebar_title_group_results'>&navigate.titleGroupResults;</a>
+ </div>
+
+ <div title="&navigate.titleResults;"
+ id='result_link_div' class="side_bar_item hide_me">
+ <a id='sidebar_title_results'>&navigate.titleResults;</a>
+ </div>
+
+ <div title="&navigate.record.details;"
+ id='rdetail_link_div' class="side_bar_item hide_me">
+ <span>&navigate.title.details;</span>
+ </div>
+ </div>
+ </div>
+
+ <div id='facetSidebarContainer' class='hide_me'>
+
+ <div class="side_bar_item" style="margin-top: 10px; font-weight: bold;">
+ <span>&navigate.facetRefine;</span>
+ </div>
+
+ <div dojoType='openils.widget.FacetSidebar' searchBox='facet_box' searchSubmit='search_submit' facetLimit='5' classOrder='["author","subject","series","title","keyword"]'>
+ <script type='dojo/method' event='populate'><![CDATA[
+ var fblob = this;
+ attachEvt("result", "allRecordsReceived", function () {
+ if(!resultFacetKey) return;
+ if (fblob.facetCacheKey) return; // already rendered it
+
+ dojo.removeClass('facetSidebarContainer','hide_me');
+
+ fblob.facetCacheKey = resultFacetKey;
+ fblob.render();
+ });
+ ]]></script>
+ </div>
+ </div>
+
+ <div id='adv_quick_search_sidebar' class='sidebar_chunk hide_me'
+ style='text-align:center; margin-top: 20px;'>
+ <hr/>
+ <div id='adv_quick_search'>
+ <div class='adv_quick_search color_4'><b>&sidebar.quick.search;</b></div>
+ <div style='margin-top: 8px;'>
+ <table><tbody><tr>
+ <td>
+ <select id='adv_quick_type' style='width: 6em;'>
+ <option value='isbn'>&opac.advanced.quick.isbn;</option>
+ <option value='issn'>&opac.advanced.quick.issn;</option>
+ <option value='cn'>&opac.advanced.quick.cn;</option>
+ <option value='lccn'>&opac.advanced.quick.lccn;</option>
+ <option value='tcn'>&opac.advanced.quick.tcn;</option>
+ <option value='barcode'>&opac.advanced.quick.barcode;</option>
+ </select>
+ </td><td>
+ <input type='text' id='adv_quick_text' size='16' />
+ </td>
+ </tr></tbody></table>
+ </div>
+
+ <span class='hide_me' id='myopac.copy.not.found'>&sidebar.copy.not.found;</span>
+ <span class='hide_me' id='myopac.copy.not.cataloged'>&sidebar.copy.not.cataloged;</span>
+ <div style='margin-top: 8px;' class='adv_quick_search_submit'>
+ <a id='adv_quick_submit' href='javascript:advGenericSearch();' class='classic_link'>&common.submit;</a>
+ </div>
+ </div>
+ </div>
+
+ <div id='adv_marc_search_sidebar' class='sidebar_chunk hide_me'
+ style='text-align:center; margin-top: 20px;'>
+ <hr/>
+ <div class='adv_quick_search color_4'><b>&search.marc;</b></div>
+ <table style='margin: 3px; width: 100%;' id='adv_sdbar_table' class='border_4_3'>
+ <tbody>
+ <tr>
+ <td>&search.marc.tag;</td>
+ <td><input name='advanced.marc.tag' maxlength='3' size='3' /></td>
+ <td>&search.marc.subfield;</td>
+ <td><input name='advanced.marc.subfield' maxlength='1' size='1' /></td>
+ </tr>
+ <tr>
+ <td>&search.marc.value;</td>
+ <td colspan='3'><input name='advanced.marc.value' size='18' /></td>
+ </tr>
+ <tr name='crow' class='hide_me'>
+ <td colspan='4' align='center'>
+ <a href='javascript:void(0);' class='classic_link'
+ onclick='
+ var div = $("adv_marc_search_sidebar");
+ if( div.getElementsByTagName("table").length > 1 )
+ div.removeChild(this.parentNode.parentNode.parentNode.parentNode);'>&common.close;</a>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ <div id='adv_marc_submit' class='adv_quick_search_submit'>
+ <a style='margin-right: 4px;' class='classic_link' href='javascript:advAddMARC();'>&search.marc.add.row;</a>
+ <a style='margin-left: 4px;' class='classic_link' href='javascript:advMARCRun();'>&common.submit;</a>
+ </div>
+ </div>
+
+
+
+
+ <!-- ============================================================================= -->
+ <!-- Our javascript -->
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/sidebar.js'></script>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.sidebar = {};
+ config.css.sidebar = {};
+ config.names.sidebar = {};
+ config.css.sidebar.item = {};
+ config.ids.sidebar.home = 'home_link_div';
+ config.ids.sidebar.advanced = 'advanced_link_div';
+ config.ids.sidebar.myopac = 'myopac_link_div';
+ config.ids.sidebar.prefs = 'prefs_link_div';
+ config.ids.sidebar.mresult = 'mresult_link_div';
+ config.ids.sidebar.rresult = 'result_link_div';
+ config.ids.sidebar.rdetail = "rdetail_link_div";
+ config.ids.sidebar.login = 'login_link';
+ config.ids.sidebar.logout = 'logout_link';
+ config.ids.sidebar.logoutbox = 'logout_link_div';
+ config.ids.sidebar.loginbox = 'login_link_div';
+ config.ids.sidebar.logged_in_as = 'logged_in_as_div';
+ config.ids.sidebar.username_dest = 'username_dest';
+
+ config.ids.sidebar.home_link = 'home_link'
+ config.ids.sidebar.advanced_link = 'advanced_link'
+ config.ids.sidebar.myopac_link = 'myopac_link'
+
+ config.css.encircled = 'encircled';
+ </script>
+
+</div>
+
--- /dev/null
+
+<!-- Searchbar for doing metarecord searches -->
+
+<div id='searchbar' dojoType="openils.widget.Searcher" basicTextBox='search_box'>
+ <script type='dojo/method' event='performSearch'>
+ this.compileFullSearch();
+ dojo.byId(this.basicTextBox).value = this.basic_query;
+ dojo.byId(this.facetTextBox).value += this.facet_query;
+ dojo.byId('search_submit').click();
+ </script>
+ <script type='dojo/method' event='populate'><![CDATA[
+ var searcher = this;
+ attachEvt("result", "allRecordsReceived", function () {
+ if(!resultCompiledSearch) {
+ return;
+ }
+
+ var all_search = dojo.query( '.classedSearch', searcher.classedSearches );
+ if (all_search.length > 1) {
+ for (var i = 1; i < all_search.length; i++) {
+ dojo.destroy(all_search[i]);
+ }
+ }
+
+ var csearch = dijit.byNode(dojo.query( '.classedSearch', searcher.classedSearches )[0]);
+
+ for (var type in resultCompiledSearch.searches) {
+ csearch.matchIndex.attr('value',type);
+ csearch.searchValue.attr('value',resultCompiledSearch.searches[type].term);
+ csearch = searcher.addClassAnd();
+ }
+ });
+ ]]></script>
+
+
+ <!-- load my js -->
+ <script language='javascript' type='text/javascript'>
+ config.ids.searchbar = {};
+ config.css.searchbar = {};
+ config.ids.searchbar.text = 'search_box';
+ config.ids.searchbar.facets = 'facet_box';
+ config.ids.searchbar.submit = 'search_submit';
+ config.ids.searchbar.type_selector = 'search_type_selector';
+ config.ids.searchbar.depth_selector = 'depth_selector';
+ config.ids.searchbar.form_selector = 'form_selector';
+ config.ids.searchbar.extra_row = 'searchbar_extra';
+ config.ids.searchbar.main_row = 'searchbar_main_row';
+ config.ids.searchbar.table = 'searchbar_table';
+ config.ids.searchbar.location_tag = 'search_location_tag_link';
+ config.ids.searchbar.lib_sel_span = 'lib_selector_span';
+ config.ids.searchbar.lib_sel_link = 'lib_selector_link';
+ config.ids.searchbar.depth_sel_span = 'depth_selector_span';
+ </script>
+
+
+ <table class='color_1 color_border1' width='100%' style='border-collapse: collapse;'>
+ <tbody>
+ <tr>
+
+ <td nowrap='nowrap' align='center' class='search_box_container color_2'>
+
+ <input id='search_box' type='text' onkeyup='dojo.byId("facet_box").value = "";'/>
+ <input id='facet_box' type='hidden' />
+ <span style='padding-left: 6px;'>
+ <input type='button' style='width: 40px;' id='search_submit' value='&button.go;' />
+ </span>
+ </td>
+
+ <td nowrap='nowrap' style='padding: 3px;' align='right' >
+
+ <span style='padding-right:9px;'>
+ <!--
+ <span>&common.type;: </span>
+ -->
+ <!--#include virtual="stypes_selector.xml"-->
+ </span>
+
+ <span style='padding-right:9px;'>
+ <!--#set var='FORM_SEL_ID' value='form_selector'-->
+ <!--#include virtual="format_selector.xml"-->
+ </span>
+
+ <!--#include virtual="libselect.xml"-->
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/search_bar.js'></script>
+</div>
+
+
+
+
+
+
--- /dev/null
+
+<!-- Navigation bar -->
+
+<div id="sidebar_div" class="sidebar_div" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <div class='sidebar_chunk'>
+
+ <div title="&navigate.home.title;"
+ id='home_link_div' class="side_bar_item ">
+ <a id='home_link' href='index.xml'>&navigate.home;</a>
+ </div>
+
+ <div title="&opac.navigate.advanced.title;"
+ id='advanced_link_div' class="side_bar_item ">
+ <a id='advanced_link' href='advanced.xml'>&opac.navigate.advanced;</a>
+ </div>
+
+ <div title="&navigate.myopac.title;"
+ id='myopac_link_div' class="side_bar_item ">
+ <a id='myopac_link' href='myopac/myopac.xml'></a>
+ </div>
+
+<!--
+ <div title="&navigate.login.title;"
+ id='login_link_div' class="side_bar_item ">
+ <a id='login_link' href='javascript:void(0);'>&navigate.login;</a>
+ </div>
+
+ <div title="&navigate.logout.title;"
+ id='logout_link_div' class="side_bar_item hide_me ">
+ <a id='logout_link' href='javascript:void(0);'>&navigate.logout;</a>
+ </div>
+-->
+
+ <!-- Informational sidebar components -->
+
+ <div id='logged_in_as_div' title="&navigate.loggedinas.title;" class="side_bar_item hide_me">
+ <span>&navigate.loggedinas;<b id='username_dest'> </b></span>
+ </div>
+
+ <div id='sidebar_results_wrapper' class='hide_me border_1'>
+ <div title="&navigate.titleGroupResults;"
+ id='mresult_link_div' class="side_bar_item hide_me">
+ <a id='sidebar_title_group_results'>&navigate.titleGroupResults;</a>
+ </div>
+
+ <div title="&navigate.titleResults;"
+ id='result_link_div' class="side_bar_item hide_me">
+ <a id='sidebar_title_results'>&navigate.titleResults;</a>
+ </div>
+
+ <div title="&navigate.record.details;"
+ id='rdetail_link_div' class="side_bar_item hide_me">
+ <span>&navigate.title.details;</span>
+ </div>
+ </div>
+ </div>
+
+ <div id='facetSidebarContainer' class='hide_me'>
+
+ <div class="side_bar_item" style="margin-top: 10px; font-weight: bold;">
+ <span>&navigate.facetRefine;</span>
+ </div>
+
+ <div dojoType='openils.widget.FacetSidebar' searchBox='facet_box' searchSubmit='search_submit' facetLimit='5' classOrder='["author","subject","series","title","keyword"]'>
+ <script type='dojo/method' event='populate'><![CDATA[
+ var fblob = this;
+ attachEvt("result", "allRecordsReceived", function () {
+ if(!resultFacetKey) return;
+ if (fblob.facetCacheKey) return; // already rendered it
+
+ dojo.removeClass('facetSidebarContainer','hide_me');
+
+ fblob.facetCacheKey = resultFacetKey;
+ fblob.render();
+ });
+ ]]></script>
+ </div>
+ </div>
+
+ <div id='adv_quick_search_sidebar' class='sidebar_chunk hide_me'
+ style='text-align:center; margin-top: 20px;'>
+ <hr/>
+ <div id='adv_quick_search'>
+ <div class='adv_quick_search color_4'><b>&sidebar.quick.search;</b></div>
+ <div style='margin-top: 8px;'>
+ <table><tbody><tr>
+ <td>
+ <select id='adv_quick_type' style='width: 6em;'>
+ <option value='isbn'>&opac.advanced.quick.isbn;</option>
+ <option value='issn'>&opac.advanced.quick.issn;</option>
+ <option value='cn'>&opac.advanced.quick.cn;</option>
+ <option value='lccn'>&opac.advanced.quick.lccn;</option>
+ <option value='tcn'>&opac.advanced.quick.tcn;</option>
+ <option value='barcode'>&opac.advanced.quick.barcode;</option>
+ </select>
+ </td><td>
+ <input type='text' id='adv_quick_text' size='16' />
+ </td>
+ </tr></tbody></table>
+ </div>
+
+ <span class='hide_me' id='myopac.copy.not.found'>&sidebar.copy.not.found;</span>
+ <span class='hide_me' id='myopac.copy.not.cataloged'>&sidebar.copy.not.cataloged;</span>
+ <div style='margin-top: 8px;' class='adv_quick_search_submit'>
+ <a id='adv_quick_submit' href='javascript:advGenericSearch();' class='classic_link'>&common.submit;</a>
+ </div>
+ </div>
+ </div>
+
+ <div id='adv_marc_search_sidebar' class='sidebar_chunk hide_me'
+ style='text-align:center; margin-top: 20px;'>
+ <hr/>
+ <div class='adv_quick_search color_4'><b>&search.marc;</b></div>
+ <table style='margin: 3px; width: 100%;' id='adv_sdbar_table' class='border_4_3'>
+ <tbody>
+ <tr>
+ <td>&search.marc.tag;</td>
+ <td><input name='advanced.marc.tag' maxlength='3' size='3' /></td>
+ <td>&search.marc.subfield;</td>
+ <td><input name='advanced.marc.subfield' maxlength='1' size='1' /></td>
+ </tr>
+ <tr>
+ <td>&search.marc.value;</td>
+ <td colspan='3'><input name='advanced.marc.value' size='18' /></td>
+ </tr>
+ <tr name='crow' class='hide_me'>
+ <td colspan='4' align='center'>
+ <a href='javascript:void(0);' class='classic_link'
+ onclick='
+ var div = $("adv_marc_search_sidebar");
+ if( div.getElementsByTagName("table").length > 1 )
+ div.removeChild(this.parentNode.parentNode.parentNode.parentNode);'>&common.close;</a>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ <div id='adv_marc_submit' class='adv_quick_search_submit'>
+ <a style='margin-right: 4px;' class='classic_link' href='javascript:advAddMARC();'>&search.marc.add.row;</a>
+ <a style='margin-left: 4px;' class='classic_link' href='javascript:advMARCRun();'>&common.submit;</a>
+ </div>
+ </div>
+
+
+
+
+ <!-- ============================================================================= -->
+ <!-- Our javascript -->
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/sidebar.js'></script>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.sidebar = {};
+ config.css.sidebar = {};
+ config.names.sidebar = {};
+ config.css.sidebar.item = {};
+ config.ids.sidebar.home = 'home_link_div';
+ config.ids.sidebar.advanced = 'advanced_link_div';
+ config.ids.sidebar.myopac = 'myopac_link_div';
+ config.ids.sidebar.prefs = 'prefs_link_div';
+ config.ids.sidebar.mresult = 'mresult_link_div';
+ config.ids.sidebar.rresult = 'result_link_div';
+ config.ids.sidebar.rdetail = "rdetail_link_div";
+ config.ids.sidebar.login = 'login_link';
+ config.ids.sidebar.logout = 'logout_link';
+ config.ids.sidebar.logoutbox = 'logout_link_div';
+ config.ids.sidebar.loginbox = 'login_link_div';
+ config.ids.sidebar.logged_in_as = 'logged_in_as_div';
+ config.ids.sidebar.username_dest = 'username_dest';
+
+ config.ids.sidebar.home_link = 'home_link'
+ config.ids.sidebar.advanced_link = 'advanced_link'
+ config.ids.sidebar.myopac_link = 'myopac_link'
+
+ config.css.encircled = 'encircled';
+ </script>
+
+</div>
+
--- /dev/null
+
+<div id='statusbar' style='margin-bottom: 6px; margin-top: 6px;'>
+
+ <table width='100%'>
+ <tbody>
+ <tr>
+ <td align='left'>
+ <b>
+ <span style='padding: 1px; ' id='now_searching_location'> </span>
+ </b>
+ <i id='including_results_for' class='hide_me'>
+ <span>&status.results;</span> <b id='including_results_location'> </b>
+ </i>
+ </td>
+ <td align='right'>
+ <!--#if expr="$OILS_PAGE='rresult.xml' || $OILS_PAGE='mresult.xml'"-->
+ <!--#include virtual="../result/filtersort.xml" -->
+ <!--#endif -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.common.now_searching = 'now_searching_location';
+ </script>
+
+</div>
--- /dev/null
+<select id='search_type_selector'>
+ <option value='keyword' selected='selected'>&common.keyword;</option>
+ <option value='title'>&common.title;</option>
+ <option value='author'>&common.author;</option>
+ <option value='subject'>&common.subject;</option>
+ <option value='series'>&common.series;</option>
+</select>
+
--- /dev/null
+
+<div id='tips' class='tips hide_me'>
+ <div class='hide_me'>
+ <span>&common.tips.tip1;</span>
+ <span>&common.tips.tip2;</span>
+ </div>
+ <span style="font-weight: bold;">&tips.label; </span>
+</div>
--- /dev/null
+ <div id='copyright_block'>
+ <div id='footer_links'>
+ <span class='footer_link'>
+ <a class='classic_link'
+ href='/opac/<!--#echo var="locale"-->/extras/slimpac/start.html'>&opac.basic;</a>
+ </span>
+ <span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link' href='http://www.georgialibraries.org/directories/publicdir.php'>Find a Library Near Me</a>
+ </span>
+ <span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link'
+ href='&footer.help.url;'>&footer.help;</a>
+ </span>
+ <span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link'
+ href='&footer.library.url;'>&footer.library.about;</a>
+ </span>
+ <span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link' id='eg_gal_link'
+ href='&footer.union.url;'>&footer.union;</a>
+ </span>
+<span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link' href='http://www.georgialibraries.org'>GPLS</a>
+ </span>
+<span> | </span>
+ <span class='footer_link'>
+ <a target='_blank' class='classic_link' href='http://www.georgiahumanities.org'>GA Humanities</a>
+ </span>
+
+ </div>
+ <div id='copyright_text'>
+ <span>&footer.copyright;</span>
+ </div>
+ <div id='footer_logo'>&footer.logo;
+ <a href='http://open-ils.org'><img style='border:none; width: 94px; height: 16px;' src='../../../../images/eg_tiny_logo.jpg'/></a>
+<span> | </span>
+ <span class='footer_link'>
+ A program created by <a href='http://www.georgialibraries.org'><img style='border:none; width: 151px; height: 53px;' src='http://www.georgialibraries.org/images/GPLS_logo_stacked.gif'/></a>
+ </span>
+<span> | </span>
+ <span class='footer_link'>
+ Supported with a grant from the <a href='http://www.georgiahumanities.org'><img style='border:none; width: 100px; height: 53px;' src='http://www.georgiahumanities.org/logo.png'/></a>
+ </span>
+
+ </div>
+</div>
--- /dev/null
+<head>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1"></meta>
+ <!-- Set the page title -->
+
+ <!--#include virtual="common/css_common.xml"-->
+
+ <title>&<!--#echo var="OILS_TITLE"-->;</title>
+ <link rel="unapi-server" type="application/xml" title="unAPI" href="http://<!--#echo var='HTTP_HOST'-->/opac/extras/unapi"/>
+ <link rel="icon" type="image/ico" href="http://governor.gapines.org/opac/images/favicon.ico"/>
+
+ <!--#if expr="$slimpac!='true'"-->
+ <!--#include virtual="common/js_common.xml"-->
+ <!--#endif-->
+
+</head>
--- /dev/null
+
+<div id='canvas_main' class='home_search canvas'
+ style='-moz-border-radius: 6px; padding: 6px; margin-top: 65px;'
+ xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <!-- load my js -->
+ <script language='javascript' type='text/javascript'
+ src="<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/depth_selector.js"> </script>
+ <script language='javascript' type='text/javascript'
+ src="<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/search_bar.js"> </script>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.searchbar = {};
+ config.css.searchbar = {};
+ config.ids.searchbar.text = 'search_box';
+ config.ids.searchbar.submit = 'search_submit';
+ config.ids.searchbar.type_selector = 'search_type_selector';
+ config.ids.searchbar.depth_selector = 'depth_selector';
+ config.ids.searchbar.form_selector = 'form_selector';
+ config.ids.searchbar.extra_row = 'searchbar_extra';
+ config.ids.searchbar.main_row = 'searchbar_main_row';
+ config.ids.searchbar.table = 'searchbar_table';
+ config.ids.searchbar.location_tag = 'search_location_tag_link';
+ config.ids.searchbar.lib_sel_span = 'lib_selector_span';
+ config.ids.searchbar.lib_sel_link = 'lib_selector_link';
+ config.ids.searchbar.depth_sel_span = 'depth_selector_span';
+ </script>
+
+
+ <div style='width: 100%; text-align: center'>
+ <img src='<!--#echo var="OILS_BASE"-->/images/main_logo.jpg' />
+ </div>
+
+ <style type="text/css">.rowpad { height: 20px; }</style>
+
+ <table id='frontsearch_table' height='100%' width='100%'
+ style='margin-top: 10px; border-collapse: collapse;'>
+
+ <tbody>
+
+ <tr class='color_3'>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.common.now_searching = 'now_searching_location';
+ </script>
+
+ <td style='padding: 6px;' class='border_5' align='center'>
+ <span>&opac.search.nowSearching;</span>
+ <span style='padding: 1px;' id='now_searching_location'> </span>
+ </td>
+ </tr>
+
+
+ <tr class='rowpad'><td></td></tr>
+
+ <tr>
+ <td nowrap='nowrap' align='center' class='color_1 border_5'>
+ <input id='search_box' style='width: 300px;' type='text' />
+ <span style='padding-left: 6px;'>
+ <input type='button' style='width: 40px;' id='search_submit' value='Go!' />
+ </span>
+ </td>
+ </tr>
+
+ <tr class='rowpad'><td></td></tr>
+
+ <tr class='color_3 border_5'>
+
+ <td nowrap='nowrap' align='center' style='padding: 4px;'>
+
+ <span style='padding-right:40px;'>
+ <!--#include virtual="../common/stypes_selector.xml"-->
+ </span>
+
+ <span>
+ <!--
+ <span>&common.format;: </span>
+ -->
+ <!--#set var='FORM_SEL_ID' value='form_selector'-->
+ <!--#include virtual="../common/format_selector.xml"-->
+ </span>
+
+ </td>
+ </tr>
+
+ <tr class='rowpad'><td></td></tr>
+
+ <tr class='color_1 border_5'>
+ <td align='center' style='padding: 4px; padding-bottom: 6px;'>
+ <span style='padding-right: 15px;'>
+ <a id='home_adv_search_link' href='javascript:void(0);'>&opac.navigate.advanced;</a></span>
+ <span>
+ <span class='hide_me' id='depth_selector_span'>
+ <select id='depth_selector' >
+ <option value='new'>&opac.navigate.selectNewOrg;...</option>
+ </select>
+ </span>
+ <span class='hide_me' id='lib_selector_span'>
+ <a id='lib_selector_link' href='javascript:void(0)'>&opac.navigate.selectOrg;</a>
+ </span>
+ </span>
+ <!--
+<span style='padding-left: 15px;'>
+ <a id='home_myopac_link' href='javascript:void(0);'>&opac.navigate.myopac;</a>
+ </span>
+-->
+ </td>
+ </tr>
+
+ <!-- locale picker -->
+ <!--
+<tr><td align='center' valign='bottom' style='padding-top:10px;'>
+ <span style='vertical-align: top;'>&common.language;</span>
+ <span dojoType="dijit.form.FilteringSelect" store="openils.I18N.localeStore"
+ searchAttr="label" required="false" jsId='opacLocaleSelector'>
+ <script type="text/javascript">
+ dojo.addOnLoad(function() {
+ opacLocaleSelector.setValue(locale);
+ dojo.connect(opacLocaleSelector, 'onChange',
+ function () {
+ location.href = location.href.replace(/opac\/[^\/]+\/skin/, 'opac/' + this.getValue() + '/skin');
+ }
+ );
+ });
+ </script>
+ </span>
+ </td></tr>
+-->
+
+ </tbody>
+ </table>
+
+</div>
+
+
+
+
+
+
--- /dev/null
+<body class="tundra">
+
+ <noscript>
+ <style type="text/css">#toptable { display: none; }</style>
+ <p style="font-size: 1.3em; padding: 3em; text-align: center;">
+ &home.js.disabled;
+ </p>
+ </noscript>
+
+ <table id='toptable' width='100%' style='border-collapse: collapse;'>
+ <tbody>
+ <tr>
+ <td width='10%'> </td>
+ <td width='80%'>
+ <div id='canvas'>
+ <!--#include virtual="../common/altcanvas.xml"-->
+ <!--#include virtual="homesearch.xml"-->
+ </div>
+ </td>
+ <td width='10%'> </td>
+ </tr>
+ </tbody>
+ </table>
+ <!--#include virtual='../footer.xml'-->
+ <center>
+ <div id='gcfPrompt' class='hide_me'>
+ <script>dojo.require('dojo.cookie');</script>
+ <div><span>&common.googlechromeframe.why;</span></div>
+ <button onclick='CFInstall.check({preventPrompt: false, mode: "popup"});'>&common.googlechromeframe.install;</button>
+ <button onclick='dojo.cookie("noGCF", "true", {path:"/", expires: 365}); hideMe($("gcfPrompt"));'>&common.googlechromeframe.dontask;</button>
+ </div>
+ </center>
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
+ <script><![CDATA[
+ CFInstall.check({
+ preventPrompt: true,
+ onmissing: function() {
+ if (dojo.cookie("noGCF") != "true")
+ unHideMe($('gcfPrompt'));
+ }
+ });]]>
+ </script>
+
+ <script language="javascript" type="text/javascript">
+ isFrontPage = true;
+ dojo.addOnLoad(init);
+ dojo.addOnLoad(home_init);
+
+ try {
+ dojo.style(dojo.byId('toptable'), 'display', 'table');
+ } catch(e) {
+ try {
+ dojo.style(dojo.byId('toptable'), 'display', '');
+ } catch(ee) {}
+ }
+
+ dojo.require("dijit._Calendar");
+ dojo.require("dijit.form.DateTextBox");
+ dojo.require("dijit.form.FilteringSelect");
+ dojo.require("dojo.date.locale");
+ dojo.require("dojo.date.stamp");
+ dojo.require("dojo.parser");
+ dojo.require("openils.widget.FacetSidebar"); // pulls in Searcher and I18N
+ </script>
+</body>
+
+
--- /dev/null
+
+<xsl:stylesheet version="1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="html" indent="yes" encoding="utf-8"/>
+ <xsl:template match="/">
+ <xsl:copy-of select='/*[local-name()="html"]'/>
+ </xsl:template>
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Loads the environment -->
+<!--#include virtual="setenv.xml"-->
+
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
+ <!--#include virtual="/opac/locale/${locale}/opac.dtd"-->
+]>
+
+<html xmlns='http://www.w3.org/1999/xhtml'>
+ <!--#include virtual="header.xml"-->
+ <!--#if expr="$OILS_PAGE='index.xml'"-->
+ <!--#include virtual="home/index_body.xml"-->
+ <!--#else-->
+ <!--#include virtual="body.xml"-->
+ <!--#endif-->
+</html>
+
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+
+<div id='myopac_bookbag_div' class='hide_me' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/container.js'> </script>
+
+ <div id='myopac_delete_bookbag_warn' class='hide_me'>
+ &myopac.delete.bookbag;
+ </div>
+
+ <div style='text-align: center; font-weight: bold;'
+ class='hide_me' id='myopac_bookbags_none'>&myopac.no.bookbags;</div>
+
+ <div style='width: 99%; text-align: center; margin-bottom: 10px;'>
+ <b>&myopac.bookbags.title;</b>
+ <!--
+ <a class='classic_link' style='margin-left: 5px; font-size: 8pt;'
+ href='javascript:alert($("myopac_bb_what_are").innerHTML);'>(What are Bookbags?)</a>
+ -->
+ </div>
+
+ <table width='100%' class='data_grid data_grid_center hide_me' id='myopac_bookbag_table'>
+ <thead>
+ <tr><td>&common.name;</td><td>&myopac.bookbag.items;</td><td>&myopac.bookbag.shared;</td><td>&myopac.bookbag.toggle;</td><td>&myopac.bookbag.delete;</td></tr>
+ </thead>
+ <tbody id='myopac_bookbag_tbody'>
+ <tr id='myopac_bookbag_tr'>
+ <td>
+ <a href='javascript:void(0);' class='classic_link' name='myopac_expand_bookbag'> </a>
+ </td>
+ <td><span name='myopac_bookbag_item_count'> </span> <span> &myopac.items;</span></td>
+ <td>
+ <span name='myopac_bb_published_no' class='hide_me'>&common.no;</span>
+ <span name='myopac_bb_published_yes' class='hide_me'>&common.yes;</span>
+ <a name='myopac_bb_published_view' class='classic_link hide_me'>&myopac.view;</a>
+ <a name='myopac_bb_published_atom' class='unadorned_link hide_me'>
+ <img border="0" src="/opac/images/small-rss.png" title="&myopac.atom.feed;" alt="&myopac.atom.feed;"/>
+ </a>
+ <br/><a name='myopac_bb_exp_refworks' class='classic_link hide_me'>&myopac.bookbag.refworks;</a>
+ </td>
+
+ <td>
+ <a name='myopac_bb_make_unpublished' class='classic_link hide_me'>&myopac.bookbag.hide;</a>
+ <a name='myopac_bb_make_published' class='classic_link hide_me'>&myopac.bookbag.share;</a>
+ </td>
+
+ <td>
+ <a class='classic_link' href='javascript:void(0);' name='myopac_container_delete'>&myopac.delete;</a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table width='100%' class='data_grid data_grid_center' style='margin-top: 10px;'>
+ <thead>
+ <tr><td>&myopac.bookbag.create;</td></tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <span style='padding-right: 5px;'>&myopac.bookbag.naming;</span>
+ <input id='myopac_bookbag_new_name' type='text' />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span style='padding: 5px;'>&myopac.bookbag.share;</span>
+ <a class='classic_link' href='javascript:alert($("bb_publish_text").innerHTML);'><b>&common.help;</b></a>
+ <span>&common.yes;</span> <input type='radio' name='bb_public' id='bb_public_yes'/>
+ <span>&common.no;</span> <input type='radio' name='bb_public' id='bb_public_no' checked='checked'/>
+ <input style='padding-left: 10px;' onclick='myOPACCreateBookbag();'
+ type='submit' value='&common.submit;' />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <!--
+ <div style='overflow: auto; max-height: 200px;' class='hide_me'>
+ -->
+ <div style='width: 99%; text-align: center'> <b id='myopac_bookbag_items_name'> </b></div>
+
+ <div class='hide_me' style='width: 100%; text-align: center; font-weight: 700; margin-top: 10px;'
+ id='myopac_bookbag_no_items'>&myopac.bookbag.no.items;</div>
+
+ <table width='100%' class='hide_me data_grid data_grid_center' id='myopac_bookbag_items_table'>
+ <thead>
+ <tr> <td>&common.title;</td> <td>&common.authors;</td> <td>&myopac.bookbag.remove;</td> </tr>
+ </thead>
+ <tbody id='myopac_bookbag_items_tbody'>
+ <tr id='myopac_bookbag_items_row'>
+ <td> <a name='myopac_bookbag_items_title' class='classic_link'> </a> </td>
+ <!--
+ <td> <a name='myopac_bookbag_items_author' class='classic_link'> </a> </td>
+ -->
+ <td name='myopac_bookbag_items_author'> </td>
+ <td><a name='myopac_bookbag_items_remove' class='classic_link'>&myopac.remove.link;</a></td>
+ </tr>
+ </tbody>
+ </table>
+ <!--</div>-->
+
+ <span id='bb_publish_text' class='hide_me'>
+ &myopac.publish.text;
+ </span>
+
+ <span id='myopac_remove_bb_item_confirm' class='hide_me'>
+ &myopac.item.confirm;
+ </span>
+
+ <span id='myopac_make_published_confirm' class='hide_me'>
+ &myopac.publish.confirm;
+ </span>
+
+ <span id='myopac_make_unpublished_confirm' class='hide_me'>
+ &myopac.unpublish.confirm;
+ </span>
+
+ <span id='myopac_bb_update_success' class='hide_me'>
+ &myopac.update.success;
+ </span>
+
+ <span id='bb_create_warning' class='hide_me'>
+ &myopac.create.warning;
+ </span>
+
+ <span id='myopac_bb_what_are' class='hide_me'>
+ &myopac.describe.bookbags;
+ </span>
+
+ <span class='hide_me' id='bb_update_success'>
+ &myopac.updated.success;
+ </span>
+
+</div>
+
+
--- /dev/null
+
+<div id='myopac_checked_div' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <!--
+ <script language='javascript' type='text/javascript' src='<!||#echo var="OILS_JS_BASE"||>/Date.W3CDTF.js'/>
+ -->
+
+ <table width='100%'><tbody>
+ <tr>
+ <td aligh='left' class='data_grid'>
+ <!--
+ Total items out: <b id='mo_items_out_count' style='padding-right: 20px;'>0</b>
+ -->
+ &myopac.checked.out; <b id='mo_items_out_count' style='padding: 5px;'>0</b> /
+ &myopac.checked.overdue; <b id='mo_items_overdue_count' style='padding: 5px;'>0</b>
+ </td>
+ <td align='right'>
+ <button onclick='myOPACRenewSelected();' id='mo_renew_button' disabled='disabled'>&myopac.checked.renew;</button>
+ </td>
+ </tr>
+ <tr id='my_renewing' class='hide_me'><td align='center'><b>&myopac.checked.renewing;</b></td></tr>
+ </tbody></table>
+
+ <table width='100%' class='light_border data_grid'>
+
+ <thead class='color_3'>
+ <tr>
+ <td width='45%'>&common.title;</td>
+ <td width='20%'>&common.author;</td>
+ <td width='10%' nowrap='nowrap' align='center'>&myopac.fines.due;</td>
+ <td width='10%' nowrap='nowrap' align='center'>&myopac.checked.renew.remaining;</td>
+ <td width='15%'>&common.select;
+ (<a id='myopac_select_all_checked' onclick='myopacSelectAllChecked();'
+ class='classic_link' href='javascript:void(0);'>&common.all;</a>/<a id='myopac_select_none_checked'
+ onclick='myopacSelectNoneChecked();' class='classic_link' href='javascript:void(0);'>&common.none;</a>)
+ </td>
+ </tr>
+ </thead>
+
+
+ <tbody id='myopac_checked_tbody'>
+
+ <tr id='myopac_checked_none' class='hide_me'>
+ <td colspan='10' align='center'><b>&myopac.checked.noitems;</b></td>
+ </tr>
+
+
+ <tr id='myopac_checked_loading'><td>&common.loading;</td></tr>
+
+ <tr id='myopac_checked_row' class='light_border hide_me'>
+
+ <td name='myopac_checked_title' class='light_border'>
+ <a href='javascript:void(0);' name='myopac_checked_title_link'> </a>
+ </td>
+
+ <td name='myopac_checked_author' class='light_border'>
+ <a href='javascript:void(0);' name='myopac_checked_author_link'> </a>
+ </td>
+
+ <td align='center' name='myopac_checked_due' class='light_border'> </td>
+ <td align='center' name='myopac_checked_renewals' class='light_border'> </td>
+
+ <!--
+ <td align='center' name='myopac_checked_renew' class='light_border'>
+ <a style='text-decoration:underline;' href='javascript:void(0);'
+ name='myopac_checked_renew_link' class='class_link'>Renew</a>
+ </td>
+ -->
+
+ <td align='center'><input type='checkbox' name='selectme'/></td>
+
+ </tr>
+ </tbody>
+ </table>
+
+ <div id='non_cat_circs_div' class='hide_me'>
+ <br/>
+ <div style='text-align: center'><b>&myopac.common.other.circ;</b></div>
+ <table class='data_grid' width='100%'>
+ <thead>
+ <tr>
+ <td>&myopac.checked.circ.lib;</td>
+ <td>&myopac.checked.item.type;</td>
+ <td>&myopac.checked.circ.time;</td>
+ </tr>
+ </thead>
+ <tbody id='non_cat_circs_tbody'>
+ <tr id='non_cat_circs_row'>
+ <td name='circ_lib'/>
+ <td name='item_type'/>
+ <td name='circ_time'/>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div id='myopac_renew_success' class='hide_me'>&myopac.checked.renew.success;</div>
+
+ <span class='hide_me' id='myopac_renew_confirm'>&myopac.checked.renew.confirm;</span>
+
+ <span class='hide_me' id='myopac_renew_fail'>&myopac.checked.renew.fail;</span>
+
+ <span class='hide_me' id='myopac_renew_fail2'>&myopac.checked.renew.fail2;</span>
+
+</div>
+
+
--- /dev/null
+
+<div id='myopac_fines_div' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <table width='100%' class='data_grid data_grid_center'>
+
+ <thead class='color_3'>
+ <tr><td colspan='3' style='padding: 6px'><b>&myopac.fines.title;</b></td></tr>
+ <tr>
+ <td width='33%'>&myopac.fines.owed;</td>
+ <td width='33%'>&myopac.fines.paid;</td>
+ <td width='33%'>&myopac.fines.balance;</td>
+ </tr>
+ </thead>
+
+ <tbody id='myopac_fines_summary_tbody'>
+ <tr id='myopac_fines_summary_loading'><td>&myopac.fines.status;</td></tr>
+ <tr id='myopac_fines_summary_row' class='hide_me'>
+ <td id='myopac_fines_summary_total' >&common.currency;</td>
+ <td id='myopac_fines_summary_paid' >&common.currency;</td>
+ <td id='myopac_fines_summary_balance' style='color:red;font-weight: bold;'>&common.currency;</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <!--
+ <div id='accrue_explanation' class='hide_me'>
+ <span>Transactions whose balances are marked with a</span>
+ <span style='color:red; font-weight: bold'>*</span>
+ <span>will continue to accrue fines until the checked out item is returned.</span>
+ </div>
+ -->
+
+
+ <!-- Table for circulation transactions only -->
+ <div id='myopac_circ_trans_div' class='hide_me'>
+ <br/><hr/><br/>
+ <table width='100%' class='data_grid data_grid_center' id='myopac_circ_trans_table'>
+ <thead>
+ <tr><td colspan='10' style='padding: 6px'><b>&myopac.fines.overdue;</b></td></tr>
+ <tr>
+ <td>&common.title;</td>
+ <td>&common.author;</td>
+ <td>&myopac.fines.checkout;</td>
+ <td>&myopac.fines.due;</td>
+ <td>&myopac.fines.returned;</td>
+ <td>&myopac.fines.balance;</td>
+ </tr>
+ </thead>
+ <tbody id='myopac_circ_trans_tbody'>
+ <tr id='myopac_circ_trans_row'>
+ <td><a class='classic_link' name='myopac_circ_trans_title'> </a></td>
+ <td name='myopac_circ_trans_author'> </td>
+ <td name='myopac_circ_trans_start'> </td>
+ <td name='myopac_circ_trans_due'> </td>
+ <td name='myopac_circ_trans_finished'><span style='color:red;'>&myopac.fines.accruing;</span></td>
+ <td>
+ <span style='color: red; font-weight: bold;'
+ name='myopac_circ_trans_balance'>&common.currency;</span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <!-- Table for all non-circulation transactions -->
+ <div id='myopac_trans_div' class='hide_me'>
+ <br/><hr/><br/>
+ <table width='100%' class='data_grid data_grid_center' id='myopac_trans_table'>
+ <thead>
+ <tr><td colspan='8' style='padding: 6px'><b>&myopac.fines.other;</b></td></tr>
+ <tr>
+ <td width='12%'>&myopac.fines.time.start;</td>
+ <td width='12%'>&myopac.fines.time.paid;</td>
+ <td width='12%'>&myopac.fines.owed.initial;</td>
+ <td width='12%'>&myopac.fines.paid.amount;</td>
+ <td width='12%'>&myopac.fines.balance;</td>
+ <td width='12%'>&myopac.fines.type;</td>
+ </tr>
+ </thead>
+
+ <tbody id='myopac_trans_tbody'>
+ <tr id='myopac_trans_row'>
+ <td name='myopac_trans_start'> </td>
+ <td name='myopac_trans_last_payment'> </td>
+ <td name='myopac_trans_init_amount'>&common.currency;</td>
+ <td name='myopac_trans_total_paid'>&common.currency;</td>
+ <td style='color:red; font-weight: bold;'>
+ <span name='myopac_trans_balance_recur' class='hide_me'> * </span>
+ <span name='myopac_trans_balance'>&common.currency;</span>
+ </td>
+ <td name='myopac_trans_bill_type'> </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <br/>
+
+</div>
+
+
--- /dev/null
+
+<div id='myopac_holds_div' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/holds.js'> </script>
+
+ <table width='100%'>
+ <tbody><tr><td width='100%' align='right'>
+ <select id='myopac_holds_actions' onchange='myopacDoHoldAction();'>
+ <option id='myopac_holds_actions_none' value=''>-- &myopac.holds.actions; --</option>
+ <option value='freeze'>&myopac.holds.freeze_selected;</option>
+ <option value='thaw'>&myopac.holds.thaw_selected;</option>
+ <option value='thaw_date'>&myopac.holds.thaw_date_selected;</option>
+ <option value='cancel'>&myopac.holds.cancel_selected;</option>
+ </select>
+ </td></tr></tbody>
+ <script language='javascript' type='text/javascript'>$('myopac_holds_actions_none').selected = true;</script>
+ </table>
+
+ <span id='myopac.holds.cancel.confirm' class='hide_me'>&myopac.holds.cancel.confirm;</span>
+ <span id='myopac.holds.freeze.confirm' class='hide_me'>&myopac.holds.freeze.confirm;</span>
+ <span id='myopac.holds.thaw.confirm' class='hide_me'>&myopac.holds.thaw.confirm;</span>
+ <span id='myopac.holds.thaw_date.confirm' class='hide_me'>&myopac.holds.thaw_date.confirm;</span>
+ <span id='myopac.holds.freeze.select_thaw' class='hide_me'>&myopac.holds.freeze.select_thaw;</span>
+
+ <table width='100%' id='myopac_holds_processing' class='hide_me'>
+ <tr><td>&myopac.holds.processing;</td></tr>
+ </table>
+
+ <div id='myopac_holds_thaw_date_form' class='hide_me'>
+ <div id='myopac_holds_freeze_select_thaw'>&myopac.holds.freeze.select_thaw;</div>
+ <p>
+ <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' type='text' id='myopac_holds_thaw_date_input' />
+ </p>
+ <p>
+ <button onclick='myopacApplyThawDate();'>&common.submit;</button>
+ </p>
+ </div>
+
+ <table width='100%' class='light_border data_grid data_grid_center' id='myopac_holds_main_table'>
+
+ <thead class='color_3'>
+ <tr>
+ <td width=''>&common.title;</td>
+ <td width=''>&common.author;</td>
+ <td>&myopac.holds.formats;</td>
+ <td>&myopac.holds.location;</td>
+ <td>&common.status;</td>
+ <td class='hide_me' id='myopac_holds_estimated_wait_column'>&myopac.holds.estimated_wait;</td>
+ <td>&myopac.holds.unfrozen;</td>
+ <td>&myopac.holds.frozen.until;</td>
+ <td>&opac.holds.expire_time;</td>
+ <td width=''>&common.select;
+ (<a id='myopac_select_all_holds' onclick='myopacSelectAllHolds();'
+ class='classic_link' href='javascript:void(0);'>&common.all;</a>/<a id='myopac_select_none_holds'
+ onclick='myopacSelectNoneHolds();' class='classic_link' href='javascript:void(0);'>&common.none;</a>)
+ </td>
+
+ <td>&myopac.holds.edit;</td>
+ </tr>
+ </thead>
+
+ <tbody id='myopac_holds_tbody'>
+
+ <tr id='myopac_holds_none' class='hide_me'>
+ <td colspan='10'><b>&myopac.holds.status.none;</b></td>
+ </tr>
+ <tr id='myopac_holds_loading'><td>&myopac.loading;</td></tr>
+
+ <tr id='myopac_holds_row' class='hide_me'>
+
+ <td name='myopac_holds_title'>
+ <a href='javascript:void(0);' name='myopac_holds_title_link'> </a>
+ <div name='vol_copy' style='border: 1px solid #808080; width:98%; margin-top: 2px;' class='hide_me'>
+ <div style='font-size: 90%' name='part'></div>
+ <div style='font-size: 90%' name='volume'></div>
+ <div style='font-size: 90%' name='copy'></div>
+ </div>
+ </td>
+
+ <td name='myopac_holds_author'>
+ <a href='javascript:void(0);' name='myopac_holds_author_link'> </a>
+ </td>
+
+ <td name='myopac_holds_formats'> </td>
+
+ <td name='myopac_holds_location'></td>
+ <td>
+ <span class='hide_me' name='hold_status_waiting'>&myopac.holds.status.waiting;</span>
+ <span class='hide_me' name='hold_status_transit'>&myopac.holds.status.intransit;</span>
+ <span class='hide_me' name='hold_status_available'><b style='color:red'>&myopac.holds.status.available;</b></span>
+ <span class='hide_me' name='hold_qstats'></span>
+ </td>
+ <td class='hide_me' name='myopac_holds_estimated_wait'/>
+
+ <td>
+ <!-- These characaters do not display in Internet Exploror, *sigh*
+ <span name='myopac_hold_unfrozen_false' class='x_mark'>✗</span>
+ <span name='myopac_hold_unfrozen_true' class='hide_me check_mark'>✓</span>
+ -->
+ <span name='myopac_hold_unfrozen_false' class='x_mark'>&common.no;</span>
+ <span name='myopac_hold_unfrozen_true' class='hide_me check_mark'>&common.yes;</span>
+ </td>
+
+
+ <td name='myopac_holds_frozen_until'></td>
+ <td name='myopac_hold_expire_time'></td>
+ <td><input type='checkbox' name='myopac_holds_selected_chkbx'/></td>
+
+ <td name='myopac_holds_cancel' style='border-left: 3px solid #E0E0E0; border-right: 3px solid #E0E0E0;'>
+ <a href='javascript:void(0);'
+ name='myopac_holds_edit_link' class='classic_link'>&myopac.holds.edit;</a>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <span class='hide_me' id='myopac_holds_cancel_verify'>
+ &myopac.holds.verify;
+ </span>
+
+</div>
+
+
--- /dev/null
+
+<div id='myopac_prefs_div' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <table width='100%' class='data_grid'>
+
+ <thead>
+ <tr>
+ <td colspan='2' align='center'>
+ <b>&myopac.prefs.title;</b>
+ </td>
+ </tr>
+ </thead>
+
+ <tbody id='myopac_prefs_tbody'>
+ <tr id='myopac_prefs_loading'><td colspan='3'><b>&myopac.loading;</b></td></tr>
+ <tr id='myopac_prefs_row'>
+ <td width='50%'>&myopac.prefs.hits;</td>
+ <td>
+ <select id='prefs_hits_per'>
+ <option value='5'>5</option>
+ <option value='8'>8</option>
+ <option value='10'>10</option>
+ <option value='15'>15</option>
+ <option value='20'>20</option>
+ <option value='25'>25</option>
+ <option value='50'>50</option>
+ </select>
+ </td>
+ </tr>
+
+ <!-- FONT size preference -->
+ <tr>
+ <td>&myopac.prefs.font;</td>
+ <td>
+ <select id='prefs_def_font'>
+ <option value='regular'>&myopac.prefs.font.regular;</option>
+ <option value='large'>&myopac.prefs.font.large;</option>
+ </select>
+ </td>
+ </tr>
+
+ <!-- default hold notification type -->
+ <tr>
+ <td>
+ <span>&myopac.prefs.holds.notify;</span>
+ <a class='classic_link' href='javascript:void(0);'
+ onclick='alert($("myopac_pref_hold_notify_alert").textContent);' >&common.help;</a>
+ </td>
+ <td>
+ <select id='prefs_hold_notify'>
+ <option value='phone:email' selected='selected'>&myopac.prefs.holds.both;</option>
+ <option value='phone'>&myopac.prefs.holds.phone;</option>
+ <option value='email'>&myopac.prefs.holds.email;</option>
+ </select>
+ </td>
+ </tr>
+
+
+ <tr id='prefs_def_location_row'>
+ <td>&myopac.prefs.search.location;</td>
+ <td>
+ <div style='margin-bottom: 5px;'>
+ <input type='checkbox' id='myopac_pref_home_lib'
+ onclick='
+ if( this.checked ) $("prefs_def_location").disabled = true;
+ else $("prefs_def_location").disabled = false;
+ ' /> &myopac.prefs.search.home;
+ </div>
+ <select id='prefs_def_location'>
+ </select>
+ </td>
+ </tr>
+
+ <tr id='prefs_def_range_row'>
+ <td>&myopac.prefs.search.range;</td>
+ <td>
+ <select id='prefs_def_range'>
+ </select>
+ </td>
+ </tr>
+
+
+
+ <!-- Save the preferences -->
+ <tr><td colspan='2'><br/></td></tr>
+
+ <tr>
+ <td align='center' class='color_3' colspan='2'>
+ <button onclick='myOPACSavePrefs();'
+ id='myopac_prefs_submit'>&myopac.prefs.save;</button>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <div class='hide_me' id='prefs_update_success'>&myopac.prefs.save.success;</div>
+ <div class='hide_me' id='prefs_update_failure'>&myopac.prefs.save.failed;</div>
+ <span class='hide_me' id='myopac_pref_hold_notify_alert'>
+ &myopac.prefs.help;
+ </span>
+
+</div>
+
+
--- /dev/null
+
+<div id='myopac_summary_div' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+
+ <div id='myopac.expired.alert' class='hide_me' style='margin-bottom: 20px;'>
+ <table class='data_grid' width='100%'>
+ <tbody>
+ <tr>
+ <td width='100%' style='color:red;'>
+ &myopac.summary.expired;
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div id='myopac.notes.div' class='hide_me'>
+ <table class='data_grid' width='100%'>
+ <thead>
+ <tr>
+ <td colspan='2'><b> &myopac.summary.notes;</b></td>
+ </tr>
+ </thead>
+ <tbody id='myopac.notes.tbody'>
+ <tr id='myopac.notes.tr'>
+ <td>
+ <b name='title'/> : <span name='value'/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <br/>
+ </div>
+
+ <table width='70%' class='light_border myopac_summary_table'>
+ <tbody id='myopac_summary_tbody'>
+ <tr>
+ <td width='30%' class='color_4 light_border'>&common.name;</td>
+ <td class='light_border'>
+ <span id='myopac_summary_prefix' style='padding-right: 5px;'> </span>
+ <span id='myopac_summary_first' style='padding-right: 5px;'> </span>
+ <span id='myopac_summary_middle' style='padding-right: 5px;'> </span>
+ <span id='myopac_summary_last' style='padding-right: 5px;'> </span>
+ <span id='myopac_summary_suffix'> </span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.phone.day;</td>
+ <td class='light_border' id='myopac_summary_dayphone'> </td>
+ </tr>
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.phone.evening;</td>
+ <td class='light_border' id='myopac_summary_eveningphone'> </td>
+ </tr>
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.phone.other;</td>
+ <td class='light_border' id='myopac_summary_otherphone'> </td>
+ </tr>
+ <tr>
+ <td class='color_4 light_border'>&common.username;</td>
+ <td class='light_border' id='myopac_summary_username'> </td>
+ <td class='light_border'><a href='javascript:void(0);'
+ onclick='unHideMe($("myopac_update_username_row"));$("myopac_username_current_password").focus();'
+ id='myopac_summary_username_change' style='text-decoration: underline;'>&myopac.summary.change;</a></td>
+ </tr>
+
+ <tr id='myopac_update_username_row' class='hide_me'>
+ <td class='myopac_update_cell' colspan='3'>
+
+ <table><tbody>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.password.current; </span></td>
+ <td><input type='password' size='24' id='myopac_username_current_password'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdateUsername();' /></td>
+ </tr>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.username.enter; </span></td>
+ <td><input type='text' size='24' id='myopac_new_username'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdateUsername();' /></td>
+ </tr>
+ </tbody></table>
+
+ <span class='myopac_update_span'>
+ <button onclick='myOPACUpdateUsername();'>&common.submit;</button>
+ </span>
+ <span class='myopac_update_span'>
+ <button onclick='hideMe($("myopac_update_username_row"));'>&common.cancel;</button>
+ </span>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class='color_4 light_border'>&common.password;</td>
+ <td class='light_border' id='myopac_summary_password'>&myopac.summary.password.text;</td>
+ <td class='light_border'><a href='javascript:void(0);'
+ onclick='unHideMe($("myopac_update_password_row"));$("myopac_current_password").focus();'
+ id='myopac_summary_password_change' style='text-decoration: underline;'>&myopac.summary.change;</a></td>
+ </tr>
+
+ <tr id='myopac_update_password_row' class='hide_me'>
+ <td class='myopac_update_cell' colspan='3'>
+
+ <table><tbody>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.password.current; </span></td>
+ <td><input type='password' size='24' id='myopac_current_password'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdatePassword();' /></td>
+ </tr>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.password.new; </span></td>
+ <td><input type='password' size='24' id='myopac_new_password'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdatePassword();' /></td>
+ </tr>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.password.reenter; </span></td>
+ <td><input type='password' size='24' id='myopac_new_password2'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdatePassword();' /></td>
+ </tr>
+ </tbody></table>
+
+ <span class='myopac_update_span'>
+ <button onclick='myOPACUpdatePassword();'>&common.submit;</button>
+ </span>
+ <span class='myopac_update_span'>
+ <button onclick='hideMe($("myopac_update_password_row"));'>&common.cancel;</button>
+ </span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.email;</td>
+ <td class='light_border' id='myopac_summary_email'> </td>
+ <td class='light_border'><a href='javascript:void(0);'
+ onclick='unHideMe($("myopac_update_email_row"));$("myopac_email_current_password").focus();'
+ id='myopac_summary_email_change' style='text-decoration: underline;'>&myopac.summary.change;</a></td>
+ </tr>
+
+ <tr id='myopac_update_email_row' class='hide_me'>
+ <td class='myopac_update_cell' colspan='3'>
+
+ <table><tbody>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.password.current; </span></td>
+ <td><input type='password' size='24' id='myopac_email_current_password'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdateEmail();' /></td>
+ </tr>
+ <tr>
+ <td><span class='myopac_update_span'>&myopac.summary.email.new; </span></td>
+ <td><input type='text' size='24' id='myopac_new_email'
+ onkeydown='if(userPressedEnter(event)) myOPACUpdateEmail();' /></td>
+ </tr>
+ </tbody></table>
+
+ <span class='myopac_update_span'>
+ <button onclick='myOPACUpdateEmail();'>&common.submit;</button>
+ </span>
+ <span class='myopac_update_span'>
+ <button onclick='hideMe($("myopac_update_email_row"));'>&common.cancel;</button>
+ </span>
+ </td>
+ </tr>
+
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.id.primary;</td>
+ <td class='light_border' id='myopac_summary_ident1'> </td>
+ </tr>
+ <!--
+ <tr>
+ <td class='color_4 light_border'>Secondary Identification</td>
+ <td class='light_border' id='myopac_summary_ident2'> </td>
+ </tr>
+ -->
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.barcode;</td>
+ <td class='light_border' id='myopac_summary_barcode'> </td>
+ </tr>
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.home;</td>
+ <td class='light_border' id='myopac_summary_homelib'> </td>
+ </tr>
+ <tr>
+ <td class='color_4 light_border'>&myopac.summary.genesis;</td>
+ <td class='light_border' id='myopac_summary_create_date'> </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+ <br/><hr/><br/>
+
+ <table width='100%' class='light_border data_grid'>
+ <thead>
+ <tr>
+ <td>&myopac.summary.addresses;</td>
+ <td id='myopac_pending_addr_td' class='hide_me'>&myopac.summary.addresses.pending;</td>
+ </tr>
+ </thead>
+ <tbody id='myopac_addr_tbody'>
+ <tr id='myopac_addr_row' class='light_border'>
+ <td>
+ <table>
+ <tr>
+ <td>&myopac.summary.address.type;</td>
+ <td name='myopac_addr_type'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.street;</td>
+ <td name='myopac_addr_street'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.street;</td>
+ <td name='myopac_addr_street2'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.city;</td>
+ <td name='myopac_addr_city'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.county;</td>
+ <td name='myopac_addr_county'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.state;</td>
+ <td name='myopac_addr_state'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.country;</td>
+ <td name='myopac_addr_country'> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.zip;</td>
+ <td name='myopac_addr_zip'> </td>
+ </tr>
+ <tr name='myopac_invalid_addr_row' class='hide_me'>
+ <td colspan='2'>&myopac.summary.address.invalid;</td>
+ </tr>
+ <tr>
+ <td name='myopac_addr_edit_td' colspan='2' class='hide_me'>
+ <a class='classic_link' name='myopac_addr_edit_link' href='javascript:void(0);'>&myopac.summary.address.edit;</a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td class='hide_me' name='myopac_pending_addr_td'>
+ <table>
+ <tr>
+ <td>&myopac.summary.address.type;</td>
+ <td><input name='myopac_pending_addr_type'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.street;</td>
+ <td><input name='myopac_pending_addr_street'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.street;</td>
+ <td><input name='myopac_pending_addr_street2'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.city;</td>
+ <td><input name='myopac_pending_addr_city'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.county;</td>
+ <td><input name='myopac_pending_addr_county'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.state;</td>
+ <td><input name='myopac_pending_addr_state'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.country;</td>
+ <td><input name='myopac_pending_addr_country'/> </td>
+ </tr>
+ <tr>
+ <td>&myopac.summary.address.zip;</td>
+ <td><input name='myopac_pending_addr_zip'/> </td>
+ </tr>
+ <tr>
+ <td name='myopac_addr_edit_td' colspan='2'>
+ <a class='classic_link' name='myopac_pending_addr_edit_link' href='javascript:void(0);'>Save Changes</a>
+ <a style='padding-left:10px;' class='classic_link' name='myopac_pending_addr_del_link' href='javascript:void(0);'>Discard Pending Address</a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class='hide_me' id='myopac_username_error'>&myopac.summary.username.error;</div>
+ <div class='hide_me' id='myopac_username_dup'>
+ &myopac.summary.username.dup;
+ </div>
+ <div class='hide_me' id='myopac_username_success'>&myopac.summary.username.success;</div>
+ <div class='hide_me' id='myopac_username_failure'>&myopac.summary.username.failure;</div>
+
+ <div class='hide_me' id='myopac_email_error'>&myopac.summary.email.error;</div>
+ <div class='hide_me' id='myopac_email_success'>&myopac.summary.email.success;</div>
+ <div class='hide_me' id='myopac_email_failure'>&myopac.summary.email.failed;</div>
+
+ <div class='hide_me' id='myopac_password_error'>&myopac.summary.password.error;</div>
+ <div class='hide_me' id='myopac_password_success'>&myopac.summary.password.success;</div>
+ <div class='hide_me' id='myopac_password_failure'>&myopac.summary.password.failure;</div>
+ <span class='hide_me' id='myopac_invalid_username'>&myopac.summary.username.invalid;</span>
+ <span class='hide_me' id='myopac_addr_changes_saved'>Address Saved</span>
+</div>
+
+
--- /dev/null
+<div id='canvas_main' class='canvas' style='margin-top: 20px;'>
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/advanced.js'></script>
+
+ <style type='text/css'>
+ .advanced_div { text-align: center; margin: 8px; margin-left: 2px; width: 95%; padding: 5px; }
+ </style>
+
+ <div class='advanced_div'>
+ <!--#include virtual="advanced/advanced_global.xml"-->
+ </div>
+</div>
+
+
--- /dev/null
+<div id='canvas_main' class='canvas' style='margin-top: 20px;'>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/cn_browse.js'></script>
+ <!--#include virtual="common/cn_browse.xml"-->
+</div>
+
+
--- /dev/null
+<div>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/sidebar_extras.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/mresult.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/result_common.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/tips.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/holds.js'></script>
+ <!--#include virtual="result/result_common.xml"-->
+</div>
+
--- /dev/null
+<div id='canvas_main' class='canvas hide_me'>
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/myopac.js'></script>
+
+ <script language='javascript' type='text/javascript'> config.ids.altcanvas.myopac_reload = 'myopac_reloading'; </script>
+ <div id='myopac_reloading' class='hide_me canvas'> &common.loading; </div>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.myopac = {};
+ config.css.myopac = {};
+ config.names.myopac = {};
+ </script>
+
+ <br/>
+ <table style='width: 98%; text-align: center;'>
+ <tbody>
+ <tr id='myopac_nav_row'>
+
+ <td class='myopac_link border_6' id='myopac_summary_td' >
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("summary");'>&myopac.account;</a>
+ </td>
+
+ <td class='myopac_link border_6' id='myopac_checked_td' >
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("checked");'>&myopac.checkouts;</a>
+ </td>
+
+ <td class='myopac_link border_6' id='myopac_holds_td' >
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("holds");'>&myopac.holds;</a>
+ </td>
+
+ <td class='myopac_link border_6' id='myopac_fines_td' >
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("fines");'>&myopac.fines;</a>
+ </td>
+
+ <td class='myopac_link border_6' id='myopac_prefs_td' >
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("prefs");'>&myopac.preferences;</a>
+ </td>
+
+ <td class='myopac_link border_6' id='myopac_bookbag_td' nowrap='nowrap'>
+ <a href='javascript:void(0);'
+ onclick='myOPACChangePage("bookbag");'>&myopac.bookbags;</a>
+
+ </td>
+
+ </tr>
+ </tbody>
+ </table>
+
+ <br/>
+
+ <div id='myopac_main_div'>
+ <!--#include virtual="myopac/myopac_summary.xml"-->
+ <!--#include virtual="myopac/myopac_checked.xml"-->
+ <!--#include virtual="myopac/myopac_holds.xml"-->
+ <!--#include virtual="myopac/myopac_fines.xml"-->
+ <!--#include virtual="myopac/myopac_prefs.xml"-->
+ <!--#include virtual="myopac/myopac_bookbags.xml"-->
+ </div>
+
+</div>
+
+
--- /dev/null
+<div id='canvas_main' class='canvas'>
+
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/sidebar_extras.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/result_common.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/rresult.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/rdetail.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/holds.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/cn_browse.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/container.js'></script>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.rdetail = {};
+ config.ids.rdetail.view_marc = "rdetail_view_marc";
+ </script>
+
+ <table width='100%' id='np_table' class='hide_me' style='margin-top: 3px;'>
+ <tbody>
+ <tr class='color_4' style='height: 1em;'>
+ <td style='vertical-align: top;'>
+
+ <span>
+ &rdetail.result; <span id='np_offset'> </span>
+ <span> &common.of; </span>
+ <span id='np_count'> </span>
+ </span>
+
+ <span style='padding-left: 40px;' >
+ <a class='np_nav_link classic_link hide_me' id='np_start'
+ href='javascript:rdetailStart();' title="&rdetail.page.results;">&rdetail.start;</a>
+ <a class='np_nav_link classic_link hide_me' id='np_prev'
+ href='javascript:rdetailPrev();' title='&rdetail.page.previous;'>&rdetail.page.previous.short;</a>
+ <span> </span>
+ <a class='np_nav_link classic_link hide_me' id='np_next'
+ href='javascript:rdetailNext();' title='&rdetail.page.next;'>&rdetail.page.next.short;</a>
+ <a class='np_nav_link classic_link hide_me' id='np_end'
+ href='javascript:rdetailEnd();' title="&rdetail.page.last;">&rdetail.end;</a>
+ </span>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table style='' class='rdetail_header color_1' width='100%'>
+ <tbody>
+
+ <tr>
+ <td width='33%' align='left'>
+ <span>&rdetail.detailMain.headerLabel;</span>
+ </td>
+
+ <td align='right' style='padding-right: 7px;' width='33%'>
+ <span id='rdetail_exp_refworks_span' class='hide_me' style='padding-right: 7px;'>
+ <a id='rdetail_exp_refworks'>&opac.holds.exportRefWorks;</a>
+ </span>
+ <span style='padding-right: 7px;'>
+ <a id='rdetail_place_hold' class='classic_link' href='javascript:;'><!--&opac.holds.placeHold;--></a>
+ </span>
+ <span style='padding-right: 7px;' class='hide_me' id='rdetail_more_actions'>
+ <select id='rdetail_more_actions_selector' style='max-width: 11em;'>
+ <option value='start'>&rdetail.more;</option>
+ <option disabled='disabled'>--------------</option>
+ <option disabled='disabled'>&rdetail.bookbag.add;</option>
+ <option disabled='disabled'>--------------</option>
+ <option value='new_bookbag' onclick='rdetailNewBookbag();'>&rdetail.bookbag.create;</option>
+ <option disabled='disabled'>--------------</option>
+ </select>
+ </span>
+
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div style='font-weight: bold; padding: 5px; margin: 5px; width: 100%;'
+ class='hide_me color_4' id='rdetail_deleted_exp'>
+ &rdetail.record.deleted;
+ </div>
+
+ <!--#include virtual="rdetail/rdetail_summary.xml"-->
+ <br/><br/>
+ <!--#include virtual="rdetail/rdetail_extras.xml"-->
+
+ <div class='hide_me' id='rdetail_bb_none'>&rdetail.none;</div>
+ <div class='hide_me' id='rdetail_bb_item_success'>&rdetail.bookbag.add.success;</div>
+ <div dojoType='dijit.Dialog' id='newBBDialog' jsId='newBBDialog' title='&rdetail.bookbag.name;' style="width: 20em;">
+ <input id='bbName' jsId='bbName' dojoType='dijit.form.TextBox'></input><br/>
+ <button id='bbok' dojoType='dijit.form.Button' onClick='finishBookbag(0);' type='button'>&common.submit;</button>
+ <button id='bbca' dojoType='dijit.form.Button' onClick='finishBookbag(1);' type='button'>&common.cancel;</button>
+ </div>
+ <div class='hide_me' id='rdetail_bb_success'>&rdetail.bookbag.create.success;</div>
+
+</div>
--- /dev/null
+<div>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/sidebar_extras.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/rresult.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/result_common.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/tips.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/holds.js'></script>
+ <!--#include virtual="result/result_common.xml"-->
+</div>
+
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+
+<!-- record details alternate canvases -->
+<div class=''>
+
+ <!--
+ <script language='javascript' type='text/javascript'>
+ config.ids.rdetail.view_marc_div = 'view_marc_div';
+ config.ids.altcanvas.view_marc_div = config.ids.rdetail.view_marc_div;
+ config.ids.rdetail.hide_marc = "rdetail_hide_marc";
+ config.ids.rdetail.view_marc_box = "rdetail_view_marc_box";
+ </script>
+
+ <div class='hide_me canvas' id='view_marc_div'>
+ <div>
+ <table width='100%'><tbody><tr>
+ <td class='color_1' align='left' style='padding-left: 7px;text-decoration: underline;'>
+ <a href="javascript:void(0);" id='rdetail_hide_marc'>&rdetail.detailMain.hideMarc;</a>
+ </td>
+ </tr></tbody></table>
+ </div>
+ <br/>
+ <div id='rdetail_view_marc_box'> </div>
+ <br/><br/>
+ </div>
+ -->
+
+</div>
+
--- /dev/null
+<table class='hide_me'>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/skin/default/js/copy_details.js'></script>
+ <script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/common/js/Date.W3CDTF.js'></script>
+ <tbody>
+ <tr style='border: 3px solid #E0E0E0;' id='rdetail_volume_details_row' templateRow='1'>
+ <td colspan='10'>
+ <div style='text-align: center; margin-top: 6px; margin-bottom: 6px'>
+
+ <a name='print' href='javascript:void(0);' class='classic_link'>&rdetail.print;</a>
+ <table class='data_grid data_grid_center' style='width: 100%'>
+ <thead>
+ <tr>
+ <td width='33%'>&rdetail.cn.barcode;</td>
+ <td>&common.status;</td>
+ <td>&rdetail.cn.location;</td>
+ <td name='copy_part_label' class='hide_me'>&rdetail.cn.part;</td>
+ <td name='age_protect_label' class='hide_me'>&rdetail.cn.hold.age;</td>
+ <td name='create_date_label' class='hide_me'>&rdetail.cn.genesis;</td>
+ <td name='holdable_label' class='hide_me'>&rdetail.cn.holdable;</td>
+ <td name='due_date_label' class='hide_me'>&rdetail.cn.due;</td>
+ </tr>
+ </thead>
+ <tbody name='copies_tbody' class='copy_details_table' width='100%'>
+
+ <tr name='copies_row'>
+
+ <td>
+ <span name='barcode'> </span>
+ <a class='hide_me classic_link copy_more_info' name='details_link'>&rdetail.cn.more;</a>
+ <a class='hide_me classic_link copy_more_info' name='less_details_link'>&rdetail.cn.less;</a>
+ <a class='hide_me classic_link copy_more_info' name='copy_hold_link'
+ href='javascript:void(0);'>&rdetail.cn.hold;</a>
+ <a class='hide_me classic_link copy_more_info' name='copy_reserve_link'
+ href='javascript:void(0);'>&rdetail.cn.reserve;</a>
+ <a class='hide_me classic_link copy_more_info' name='copy_multi_home'
+ href='javascript:void(0);'>&rdetail.cn.multi_home;</a>
+ </td>
+
+ <td name='status'> </td>
+ <td name='location'> </td>
+ <td name='copy_part' class='hide_me'> </td>
+ <td name='age_protect_value' class='hide_me'>&rdetail.cn.disabled;</td>
+ <td name='create_date_value' class='hide_me'> </td>
+
+ <td name='copy_holdable_td' class='hide_me'>
+ <span name='copy_is_holdable'> </span>
+ </td>
+
+ <td name='copy_due_date_td' class='hide_me'>
+ <span name='copy_due_date'> </span>
+ </td>
+
+ </tr>
+
+ <tr name='copy_extras_row' class='hide_me'>
+ <td colspan='10'>
+ <table width='100%' class='data_grid'>
+ <tbody name='extras_tbody'>
+ <tr name='extras_row' class='hide_me'>
+ <td name='type' width='20%'>
+ <span name='note' class='hide_me'><b>&rdetail.cn.note;</b></span>
+ <span name='cat' class='hide_me'><b>&rdetail.cn.category;</b></span>
+ </td>
+ <td>
+ <span name='key'> </span> : <span name='value'> </span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<span class='hide_me' id='rdetail.yes'>&common.yes;</span>
+<span class='hide_me' id='rdetail.no'>&common.no;</span>
+
+
+<div id='rdetail_print_details' class='hide_me'>
+ <div style='text-align: center; padding: 20px; width: 100%'>
+ <div style='width:100%; border: 2px solid #E0F0E0; margin-bottom: 20px;'>
+ <input type='submit' value='&rdetail.cn.print;' onclick='window.print();'> </input>
+ </div>
+ <div name='body'>
+ <table>
+ <tbody name='tbody'>
+ <tr><td>&common.library;</td><td colspan='2' name='lib'></td></tr>
+ <tr><td>&common.title;</td><td colspan='2' name='title'></td></tr>
+ <tr><td>&common.author;</td><td colspan='2' name='author'></td></tr>
+ <tr><td>&common.edition;</td><td colspan='2' name='edition'></td></tr>
+ <tr><td>&common.pubdate;</td><td colspan='2' name='pubdate'></td></tr>
+ <tr><td>&common.publisher;</td><td colspan='2' name='publisher'></td></tr>
+ <tr><td>&common.physical;</td><td colspan='2' name='phys'></td></tr>
+ <tr>
+ <td colspan='3' style='background: #E0F0E0;'> </td>
+ </tr>
+ <tr name='cnrow'><td><b>&common.callnumber;</b></td><td><b colspan='2' name='cn'></b></td></tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
+
--- /dev/null
+
+<!-- This holds information for copies attached to this record -->
+<div id='rdetail_copy_info_div' class='rdetail_extras_div'>
+
+ <div style='width: 100%; text-align: center; padding-bottom: 5px;'>
+ <span>
+ <a href='javascript:void(0);' id='copy_info_local_link'
+ class='rdetail_copy_nav_link hide_me classic_link'><b>&rdetail.copyInfo.local;</b></a>
+ </span>
+ <span width=''>
+ <a href='javascript:void(0);' id='copy_info_all_link'
+ class='rdetail_copy_nav_link classic_link'><b>&rdetail.copyInfo.all;</b></a>
+ </span>
+ </div>
+
+ <table id='rdetail_copy_info_table' class='data_grid'>
+ <thead>
+
+ <tr>
+ <td class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.library;</td>
+ <td class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.callnumber;</td>
+ <td name='rdetail_copylocation_header' class='rdetail_copy_info_header_cell hide_me'>&rdetail.copyInfo.copylocation;</td>
+ <td class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.actions;</td>
+ <td nowrap='nowrap' class='rdetail_copy_info_header_cell' id='rdetail_copy_info_status'>
+ <div name='rdetail_status_cell'> </div>
+ </td>
+ </tr>
+
+ </thead>
+ <tbody id='rdetail_copy_info_tbody'>
+ <tr id='rdetail_copy_info_row' class='hide_me'>
+ <td name='rdetail_library_cell'>
+ <a name='lib_print_link' class='hide_me classic_link' style='font-size: 8pt; padding-left: 20px;'>
+ &rdetail.copyInfo.print;
+ </a>
+ </td>
+ <td name='rdetail_callnumber_cell'> </td>
+ <td class="hide_me" name='rdetail_copylocation_cell'> </td>
+ <td name='rdetail_actions_cell'>
+ <div style='padding-bottom: 1px;'>
+ <a style='font-size: 8pt;'
+ name='details' class='hide_me classic_link'>&rdetail.copyInfo.details;</a>
+ </div>
+ <div style='margin-top: 2px;'>
+ <a name='browse' style='font-size: 8pt;'
+ class='hide_me classic_link'>&rdetail.copyInfo.browse;</a>
+ </div>
+ <div style='margin-top: 2px;' name='hold_div' class='hide_me'>
+ <a name='hold' style='font-size: 8pt;' href='javascript:void(0);'
+ class='classic_link'>&rdetail.copyInfo.hold;</a>
+ </div>
+ </td>
+ <td nowrap='nowrap' class='rdetail_copy_count_cell vertical'
+ name='rdetail_copy_count_cell'> </td>
+ </tr>
+
+ <tr id='rdetail_copy_info_loading'><td>&rdetail.loading;</td></tr>
+
+ </tbody>
+ </table>
+
+ <!--
+ <table class='hide_me'>
+ <tbody>
+ <tr style='border: 3px solid #E0E0E0;' id='rdetail_volume_details_row'><td colspan='10'></td></tr>
+ </tbody>
+ </table>
+ -->
+
+ <br/><br/>
+
+ <div id='rdetail_copy_info_none' class='hide_me'>&rdetail.noneAvailable;</div>
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.rdetail.cp_status = "rdetail_copy_info_status";
+ config.ids.rdetail.cp_info_row = "rdetail_copy_info_row";
+ config.ids.rdetail.cp_info_loading = "rdetail_copy_info_loading";
+ config.ids.rdetail.cp_info_local = "copy_info_local_link";
+ config.ids.rdetail.cp_info_all = "copy_info_all_link";
+ config.ids.rdetail.cp_info_none = "rdetail_copy_info_none";
+ config.names.rdetail.lib_cell = "rdetail_library_cell";
+ config.names.rdetail.cn_cell = "rdetail_callnumber_cell";
+ config.names.rdetail.cp_count_cell = "rdetail_copy_count_cell";
+ config.names.rdetail.cp_status = 'rdetail_status_cell';
+ </script>
+
+</div> <!-- copy info -->
+
+
--- /dev/null
+
+<div xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <table class='rdetails_extra_links'>
+ <thead>
+ <tr>
+ <td id='rdetail_copy_info_link' class='rdetail_extras_td rdetail_extras_selected'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("copyinfo");'
+ class='classic_link'>&rdetail.extras.summary;</a>
+ </td>
+
+ <td id='rdetail_viewcn_link' class='rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("cn");'
+ class='classic_link'>&rdetail.extras.browser;</a>
+ </td>
+
+ <td id='rdetail_summary_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("summary");'
+ class='classic_link'>&rdetail.extras.bib_summary;</a>
+ </td>
+
+ <td id='rdetail_reviews_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("reviews");'
+ class='classic_link'>&rdetail.extras.reviews;</a>
+ </td>
+
+ <td id='rdetail_toc_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("toc");'
+ class='classic_link'>&rdetail.extras.toc;</a>
+ </td>
+
+ <td id='rdetail_excerpt_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("excerpt");'
+ class='classic_link'>&rdetail.extras.excerpt;</a>
+ </td>
+
+ <td id='rdetail_preview_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("preview");'
+ class='classic_link'>&rdetail.extras.preview;</a>
+ </td>
+
+ <td id='rdetail_anotes_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("anotes");'
+ class='classic_link'>&rdetail.extras.author.notes;</a>
+ </td>
+
+ <td id='rdetail_annotation_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("annotation");'
+ class='classic_link'>&rdetail.extras.annotation;</a>
+ </td>
+
+ <td id='rdetail_viewmarc_link' class='rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("marc");'
+ class='classic_link'>&rdetail.extras.marc;</a>
+ </td>
+
+ <td id='rdetail_novelist_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("novelist");'
+ class='classic_link'>&rdetail.extras.novelist;</a>
+ </td>
+
+ <td id='rdetail_foreign_items_link' class='hide_me rdetail_extras_td'
+ style='padding-right: 15px; padding-left: 15px;' >
+ <a href='javascript:rdetailShowExtra("foreign_items");'
+ class='classic_link'>&rdetail.extras.foreign_items;</a>
+ </td>
+
+ </tr>
+ </thead>
+ </table>
+
+ <div id='rdetail_extras_div' style='width: 95%;'>
+ <div id='rdetail_extras_loading' class='hide_me'
+ style='padding: 10px;'>&common.loading;</div>
+ <!--#include virtual="rdetail_copyinfo.xml"-->
+
+ <div id='rdetail_summary_div' class='rdetail_extras_div hide_me'> </div>
+
+ <div id='rdetail_reviews_div' class='rdetail_extras_div hide_me'>
+ <div id='rdetail_review_container'/>
+ <!--
+ <div id='rdetail_review_template' style='width: 100%;'>
+ <div name='review_header' style='width: 100%; padding: 15px; border: 1px solid #E0E0E0;'> </div>
+ <div name='review_text' style='width: 100%; padding: 15px; border: 1px solid #E0E0E0;'> </div>
+ </div>
+ -->
+ <div id='rdetail_chilifresh_reviews' class='hide_me'>
+ <div id='chilifreshReviewLink' name='chilifreshReviewLink' class='chili_review'></div>
+ <div id='chilifreshReviewResult' name='chilifreshReviewResult' style='display:none'></div>
+ </div>
+ </div>
+
+ <div id='rdetail_toc_div' class='rdetail_extras_div hide_me'> </div>
+
+ <div id='rdetail_excerpt_div' class='rdetail_extras_div hide_me'> </div>
+
+ <div id='rdetail_preview_div' class='rdetail_extras_div hide_me'> </div>
+
+ <div id='rdetail_anotes_div' class='rdetail_extras_div hide_me'> </div>
+
+ <div id='rdetail_marc_div' class='rdetail_extras_div hide_me'>
+ <div id='rdetail_view_marc_box'> </div>
+ </div>
+
+ <div id='rdetail_novelist_div' class='rdetail_extras_div hide_me'>
+ <div id="NoveListSelect" class="NoveListSelect">
+ <div id="NoveListAnchor" class="NoveListSelect"></div>
+ <div id="novsuggestions"></div>
+ <div id="nextreads"></div>
+ <div id="novrelatedauthors"></div>
+ <div id="novrelateditems"></div>
+ </div>
+ </div>
+
+ <div id='rdetail_foreign_items_div' class='rdetail_extras_div hide_me'>
+ <table width='100%' class='data_grid data_grid_center' id='rdetail_foreign_items_table'>
+ <thead>
+ <tr> <td>&common.title;</td> <td>&common.authors;</td> <td> </td></tr>
+ </thead>
+ <tbody id='rdetail_foreign_items_tbody'>
+ </tbody>
+ </table>
+ </div>
+
+ <div id='rdetail_cn_browse_div' style='text-align: center;' class='hide_me'>
+
+ <div id='cn_browse_none' class='hide_me color_4' style='width: 90%; text-align: center; margin: 10px;'>
+ &rdetail.extras.call.null;
+ </div>
+
+ <div id='rdetail_cn_browse_select_div'
+ style='width: 100%; border: 1px solid black; padding: 6px; margin-top: 5px;'>
+ <span>&rdetail.extras.call.local; </span>
+ <select id='cn_browse_selector'>
+ </select>
+ </div>
+
+ <!--#include virtual="../common/cn_browse.xml"-->
+ </div>
+
+ <!--#include virtual="rdetail_cn_details.xml"-->
+
+ </div>
+ <!-- Text for dynamic JavaScript -->
+ <div id='rdetail_preview_full_text' class='hide_me'>&rdetail.extras.preview.fulltext;</div>
+ <div id='rdetail_preview_title' class='hide_me'>&rdetail.extras.preview.title;</div>
+ <div id='rdetail_preview_badge' class='hide_me'>&rdetail.extras.preview.badge;</div>
+
+ <!-- ChiliFresh setup -->
+ <script language='javascript' type='text/javascript'>
+ var chilifresh = '<!--#echo var="OILS_CHILIFRESH_ACCOUNT"-->';
+ if (chilifresh == '(none)') { chilifresh = false; }
+ </script>
+ <!--#if expr="${OILS_CHILIFRESH_ACCOUNT} && ${OILS_CHILIFRESH_ACCOUNT}!='(none)'"-->
+ <input type="hidden" id="chilifresh_account" name="chilifresh_account"
+ value="<!--#echo var='OILS_CHILIFRESH_ACCOUNT'-->" />
+ <input type="hidden" id="chilifresh_profile" name="chilifresh_profile"
+ value="<!--#echo var='OILS_CHILIFRESH_PROFILE'-->" />
+ <input type="hidden" id="chilifresh_version" name="chilifresh_version" value="onsite_v1" />
+ <input type="hidden" id="chilifresh_type" name="chilifresh_type" value="search" />
+ <script language="javascript" type="text/javascript" src="<!--#echo var='OILS_CHILIFRESH_URL'-->"></script>
+ <!--#endif-->
+
+ <!-- Novelist setup -->
+ <!--#if expr="${OILS_NOVELIST_URL} && ${OILS_NOVELIST_URL}!='(none)'"-->
+ <script type="text/javascript" id="EIT" src="<!--#echo var='OILS_NOVELIST_URL'-->"></script>
+ <!--#endif-->
+ <script language='javascript' type='text/javascript'>
+ var novelist = '<!--#echo var="OILS_NOVELIST_URL"-->';
+ if (novelist == '(none)') { novelist = false; }
+ </script>
+
+</div>
--- /dev/null
+
+<abbr class="unapi-id" title='tag:<!--#echo var="HTTP_HOST"-->,<!--#echo var="OILS_TIME_YEAR"-->:biblio-record_entry/<!--#echo var="OILS_OPAC_RID"-->'></abbr>
+<!-- This holds the record summary information -->
+<div>
+ <!-- temporary hack to give IE somewhere to put these things; should just rip out from rdetail.js
+ See https://bugs.launchpad.net/evergreen/+bug/532217 -->
+ <span class='hide_me' id='rdetail_title'></span>
+ <table id='rdetail_details_table'>
+ <tbody id='rdetail_details_tbody'>
+
+ <tr>
+ <td id='rdetail_image_cell' rowspan='30'>
+ <a id='rdetail_img_link'>
+ <img style='border: none;' id='rdetail_image'
+ onerror='
+ hideMe($("rdetail.jacket_attrib_div"));
+ hideMe($("rdetail_img_link"));'/>
+ </a>
+ <!-- vendor attribution link -->
+ <div class='jacket_attrib hide_me' id='rdetail.jacket_attrib_div'>
+ <div>&opac.image_provided;</div>
+ <div><a target='_blank' href='&vendor.base_link;'
+ class='classic_link' id='rdetail.jacket_attrib_link'>&vendor.name;</a></div>
+ </div>
+ </td>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.title;</td>
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with more and/or different information. In this case, the raw MARC 245. -->
+ <td type='opac/slot-data' query='datafield[tag="245"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+ <!-- Started testing things out here - dz -->
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="590"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="110"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="111"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="520"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="521"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="505"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="600"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="610"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="611"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="651"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="655"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="690"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="691"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="700"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="710"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="711"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+<tr>
+ <td type='opac/slot-data' query='datafield[tag="740"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+</tr>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.author;</td>
+ <td class='rdetail_item'>
+ <a title='&rdetail.author.search;' id='rdetail_author'> </a>
+ </td>
+ </tr>
+
+ <!-- <tr class='hide_me' id='tag020'> -->
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.isbn;</td>
+ <!-- <td type='opac/slot-data' query='datafield[tag=020]'>
+ <script type='opac/slot-format'><![CDATA[
+ dojo.query('#tag020').removeClass('hide_me');
+ return '<span>' + dojox.data.dom.textContent(item) +
+ '</span><br/>';
+ ]]></script>
+ </td></tr> -->
+ <td class='rdetail_item' id='rdetail_isbn'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.edition;</td>
+ <td class='rdetail_item' id='rdetail_edition'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.pubdate;</td>
+ <td class='rdetail_item' id='rdetail_pubdate'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.publisher;</td>
+ <td class='rdetail_item' id='rdetail_publisher'> </td>
+ </tr>
+
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.physical;</td>
+ <td class='rdetail_item' id='rdetail_physical_desc'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.format;</td>
+ <td class='rdetail_item'>
+ <img id='rdetail_tor_pic' class='tor_pic' />
+ <span id='rdetail_tor' style='padding-left: 5px;'> </span>
+ </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.abstract;</td>
+ <td class='rdetail_item' id='rdetail_abstract'> </td>
+ </tr>
+
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with complex information, such as new search links on subjects. -->
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.subjects;</td>
+ <td type='opac/slot-data' query='datafield[tag^="6"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var cgi = new CGI();
+ var other_params = [ 'd', 'l', 'r', 'av', 's', 'sd', 'ol' ];
+ var total = '';
+ var output = [];
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ var sub_code = list[i].getAttribute('code');
+ if ( sub_code.match(/[a-z]/i) ) {
+ var current = '';
+ if ( sub_code.match(/[vxyz]/) ) {
+ current += '-- ';
+ }
+ total += BT.textContent(list[i]) + ' ';
+ current += '<a href="rresult.xml?rt=subject&tp=subject&t=' + total.replace(/\s+$/, '');
+ for (var p in other_params) {
+ if (cgi.param(other_params[p]))
+ current += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
+ }
+ current += '">' + BT.textContent(list[i]) + '</a>'
+ output.push(current);
+ }
+ }
+ return '<span>' + output.join(' ') + '</span><br/>';
+ ]]></script>
+ </td>
+ </tr>
+
+ <tr class='hide_me' id='rdetail_online_row'>
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with complex information, such as location-specific URIs (856$9). -->
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.online;</td>
+ <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query='volumes volume uris uri' join=", ">
+ <script type='opac/slot-format'><![CDATA[
+ var link = '<a href="' + item.getAttribute('href') + '">' + item.getAttribute('label') + '</a>';
+ if (item.getAttribute('use_restriction'))
+ link += ' (Use restriction: ' + item.getAttribute('use_restriction') + ')';
+ return link;
+ ]]></script>
+ </td>
+ </tr>
+ <tr name="serial_holdings_label"
+ class="result_table_title_cell hide_me">
+ <td class="rdetail_desc">&rdetail.summary.issues_held;</td>
+ <td templated="true" type="opac/slot-data"
+ query="datafield[tag='901'] subfield[code='c']"
+ class="rdetail_item">
+ ${holdingsStatement}
+ <span class="hide_me" name="holdingsStatement" type="opac/template-value"><![CDATA[
+ if (fetchOrgSettingDefault(
+ getLocation(),
+ "opac.fully_compressed_serial_holdings"
+ )) {
+ var bibid = BT.textContent(item_list[0]);
+ var blob = fieldmapper.standardRequest(
+ ["open-ils.serial",
+ "open-ils.serial.bib.summary_statements"],
+ [bibid, {
+ "orgid": getLocation(), "depth": getDepth()
+ }]
+ );
+
+ var fake = dojo.create("td");
+ var something = false;
+
+ for (var i in blob) {
+ if (!blob[i].length) continue;
+ if (something) dojo.create("br", null, fake);
+ something = true;
+
+ var a = dojo.create(
+ "a", {
+ "innerHTML": "[+]",
+ "href": "javascript:void(0);",
+ "onclick":
+ "rdetailDrawExpandedHoldings(this,"+
+ bibid + ",'" + i + "');",
+ "style": {"marginRight": "1.5em"}
+ }, fake
+ );
+ dojo.create(
+ "span", {
+ "innerHTML": blob[i].join(", ")
+ }, fake
+ );
+ dojo.create(
+ "span", {"id": "holding_type_" + i}, fake
+ );
+ }
+
+ if (something)
+ unHideMe(slot.parentNode);
+
+ return fake.innerHTML;
+ } else {
+ return "";
+ }
+ ]]></span>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <!-- Empty span used for creating unAPI links -->
+ <abbr name="unapi" class="unapi-id">
+ <!-- unAPI URI goes here -->
+ </abbr>
+
+ <script language='javascript' type='text/javascript'><![CDATA[
+
+ config.ids.rdetail.details_body = 'rdetail_details_body';
+ config.ids.rdetail.title = 'rdetail_title';
+ config.ids.rdetail.author = 'rdetail_author';
+ config.ids.rdetail.isbn = 'rdetail_isbn';
+ config.ids.rdetail.edition = 'rdetail_edition';
+ config.ids.rdetail.pubdate = 'rdetail_pubdate';
+ config.ids.rdetail.publisher = 'rdetail_publisher';
+ config.ids.rdetail.tor = 'rdetail_tor';
+ config.ids.rdetail.abstr = 'rdetail_abstract';
+ config.ids.rdetail.image = 'rdetail_image';
+ config.ids.rdetail.tor_pic = 'rdetail_tor_pic';
+
+ dojo.addOnLoad(function() {
+ setTimeout( function () {
+ var here = findOrgUnit(getLocation());
+ if (getDepth() > 0 || getDepth === 0 ) {
+ while (getDepth() < findOrgDepth(here))
+ here = findOrgUnit( here.parent_ou() );
+ }
+
+ dojo.require('openils.BibTemplate');
+ new openils.BibTemplate({ record : new CGI().param('r'), org_unit : here.shortname() }).render();
+ }, 0);
+ });
+ ]]></script>
+
+</div> <!-- details_body -->
+
--- /dev/null
+
+<abbr class="unapi-id" title='tag:<!--#echo var="HTTP_HOST"-->,<!--#echo var="OILS_TIME_YEAR"-->:biblio-record_entry/<!--#echo var="OILS_OPAC_RID"-->'></abbr>
+<!-- This holds the record summary information -->
+<div>
+ <!-- temporary hack to give IE somewhere to put these things; should just rip out from rdetail.js
+ See https://bugs.launchpad.net/evergreen/+bug/532217 -->
+ <span class='hide_me' id='rdetail_title'></span>
+ <table id='rdetail_details_table'>
+ <tbody id='rdetail_details_tbody'>
+
+ <tr>
+ <td id='rdetail_image_cell' rowspan='30'>
+ <a id='rdetail_img_link'>
+ <img style='border: none;' id='rdetail_image'
+ onerror='
+ hideMe($("rdetail.jacket_attrib_div"));
+ hideMe($("rdetail_img_link"));'/>
+ </a>
+ <!-- vendor attribution link -->
+ <div class='jacket_attrib hide_me' id='rdetail.jacket_attrib_div'>
+ <div>&opac.image_provided;</div>
+ <div><a target='_blank' href='&vendor.base_link;'
+ class='classic_link' id='rdetail.jacket_attrib_link'>&vendor.name;</a></div>
+ </div>
+ </td>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.title;</td>
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with more and/or different information. In this case, the raw MARC 245. -->
+ <td type='opac/slot-data' query='datafield[tag="245"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var out = '';
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ out += BT.textContent(list[i]) + ' ';
+ }
+ document.title += ': ' + out;
+ return out;
+ ]]></script>
+ </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.author;</td>
+ <td class='rdetail_item'>
+ <a title='&rdetail.author.search;' id='rdetail_author'> </a>
+ </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.isbn;</td>
+ <td class='rdetail_item' id='rdetail_isbn'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.edition;</td>
+ <td class='rdetail_item' id='rdetail_edition'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.pubdate;</td>
+ <td class='rdetail_item' id='rdetail_pubdate'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.publisher;</td>
+ <td class='rdetail_item' id='rdetail_publisher'> </td>
+ </tr>
+
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.physical;</td>
+ <td class='rdetail_item' id='rdetail_physical_desc'> </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&common.format;</td>
+ <td class='rdetail_item'>
+ <img id='rdetail_tor_pic' class='tor_pic' />
+ <span id='rdetail_tor' style='padding-left: 5px;'> </span>
+ </td>
+ </tr>
+
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.abstract;</td>
+ <td class='rdetail_item' id='rdetail_abstract'> </td>
+ </tr>
+
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with complex information, such as new search links on subjects. -->
+ <tr>
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.subjects;</td>
+ <td type='opac/slot-data' query='datafield[tag^="6"]' class='rdetail_item'>
+ <script type='opac/slot-format'><![CDATA[
+ var cgi = new CGI();
+ var other_params = [ 'd', 'l', 'r', 'av', 's', 'sd', 'ol' ];
+ var total = '';
+ var output = [];
+ var list = dojo.query( 'subfield', item );
+ for (var i = 0; i < list.length; i++) {
+ var sub_code = list[i].getAttribute('code');
+ if ( sub_code.match(/[a-z]/i) ) {
+ var current = '';
+ if ( sub_code.match(/[vxyz]/) ) {
+ current += '-- ';
+ }
+ total += BT.textContent(list[i]) + ' ';
+ current += '<a href="rresult.xml?rt=subject&tp=subject&t=' + total.replace(/\s+$/, '');
+ for (var p in other_params) {
+ if (cgi.param(other_params[p]))
+ current += '&' + other_params[p] + '=' + cgi.param(other_params[p]);
+ }
+ current += '">' + BT.textContent(list[i]) + '</a>'
+ output.push(current);
+ }
+ }
+ return '<span>' + output.join(' ') + '</span><br/>';
+ ]]></script>
+ </td>
+ </tr>
+
+ <tr class='hide_me' id='rdetail_online_row'>
+ <!-- *** Example of how to use the openils.BibTemplate infrastructure to augment the stock
+ *** summary screen with complex information, such as location-specific URIs (856$9). -->
+ <td nowrap='nowrap' class='rdetail_desc'>&rdetail.summary.online;</td>
+ <td class='rdetail_item' id='rdetail_online' type='opac/slot-data' query='volumes volume uris uri' join=", ">
+ <script type='opac/slot-format'><![CDATA[
+ var link = '<a href="' + item.getAttribute('href') + '">' + item.getAttribute('label') + '</a>';
+ if (item.getAttribute('use_restriction'))
+ link += ' (Use restriction: ' + item.getAttribute('use_restriction') + ')';
+ return link;
+ ]]></script>
+ </td>
+ </tr>
+ <tr name="serial_holdings_label"
+ class="result_table_title_cell hide_me">
+ <td class="rdetail_desc">&rdetail.summary.issues_held;</td>
+ <td templated="true" type="opac/slot-data"
+ query="datafield[tag='901'] subfield[code='c']"
+ class="rdetail_item">
+ ${holdingsStatement}
+ <span class="hide_me" name="holdingsStatement" type="opac/template-value"><![CDATA[
+ if (fetchOrgSettingDefault(
+ getLocation(),
+ "opac.fully_compressed_serial_holdings"
+ )) {
+ var bibid = BT.textContent(item_list[0]);
+ var blob = fieldmapper.standardRequest(
+ ["open-ils.serial",
+ "open-ils.serial.bib.summary_statements"],
+ [bibid, {
+ "orgid": getLocation(), "depth": getDepth()
+ }]
+ );
+
+ var fake = dojo.create("td");
+ var something = false;
+
+ for (var i in blob) {
+ if (!blob[i].length) continue;
+ if (something) dojo.create("br", null, fake);
+ something = true;
+
+ var a = dojo.create(
+ "a", {
+ "innerHTML": "[+]",
+ "href": "javascript:void(0);",
+ "onclick":
+ "rdetailDrawExpandedHoldings(this,"+
+ bibid + ",'" + i + "');",
+ "style": {"marginRight": "1.5em"}
+ }, fake
+ );
+ dojo.create(
+ "span", {
+ "innerHTML": blob[i].join(", ")
+ }, fake
+ );
+ dojo.create(
+ "span", {"id": "holding_type_" + i}, fake
+ );
+ }
+
+ if (something)
+ unHideMe(slot.parentNode);
+
+ return fake.innerHTML;
+ } else {
+ return "";
+ }
+ ]]></span>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <!-- Empty span used for creating unAPI links -->
+ <abbr name="unapi" class="unapi-id">
+ <!-- unAPI URI goes here -->
+ </abbr>
+
+ <script language='javascript' type='text/javascript'><![CDATA[
+
+ config.ids.rdetail.details_body = 'rdetail_details_body';
+ config.ids.rdetail.title = 'rdetail_title';
+ config.ids.rdetail.author = 'rdetail_author';
+ config.ids.rdetail.isbn = 'rdetail_isbn';
+ config.ids.rdetail.edition = 'rdetail_edition';
+ config.ids.rdetail.pubdate = 'rdetail_pubdate';
+ config.ids.rdetail.publisher = 'rdetail_publisher';
+ config.ids.rdetail.tor = 'rdetail_tor';
+ config.ids.rdetail.abstr = 'rdetail_abstract';
+ config.ids.rdetail.image = 'rdetail_image';
+ config.ids.rdetail.tor_pic = 'rdetail_tor_pic';
+
+ dojo.addOnLoad(function() {
+ setTimeout( function () {
+ var here = findOrgUnit(getLocation());
+ if (getDepth() > 0 || getDepth === 0 ) {
+ while (getDepth() < findOrgDepth(here))
+ here = findOrgUnit( here.parent_ou() );
+ }
+
+ dojo.require('openils.BibTemplate');
+ new openils.BibTemplate({ record : new CGI().param('r'), org_unit : here.shortname() }).render();
+ }, 0);
+ });
+ ]]></script>
+
+</div> <!-- details_body -->
+
--- /dev/null
+<span>
+ &result.limit2avail;<input type='checkbox' id='opac.result.limit2avail' onclick='searchBarSubmit(true);'/>
+ <select id='opac.result.sort' onchange='searchBarSubmit(true);'>
+ <option selected='selected' value=''>&result.sort_by;</option>
+ <optgroup label='&result.sort_by.title;'>
+ <option id='opac.result.title.a2z' label='&common.a2z.titla;' value='titlesort.asc'>&common.a2z.title;</option>
+ <option id='opac.result.title.z2a' label='&common.z2a.titla;' value='titlesort.desc'>&common.z2a.title;</option>
+ </optgroup>
+ <optgroup label='&result.sort_by.author;'>
+ <option id='opac.result.author.a2z' label='&common.a2z.author;' value='authorsort.asc'>&common.a2z.author;</option>
+ <option id='opac.result.author.z2a' label='&common.z2a.author;' value='authorsort.desc'>&common.z2a.author;</option>
+ </optgroup>
+ <optgroup label='&result.sort_by.pubdate;'>
+ <option id='opac.result.pubdate.new2old' label='&common.new2old.pubdate;'
+ value='pubdate.desc'>&common.new2old.pubdate;</option>
+ <option id='opac.result.pubdate.old2new' label='&common.old2new.pubdate;'
+ value='pubdate.asc'>&common.old2new.pubdate;</option>
+ </optgroup>
+ </select>
+</span>
--- /dev/null
+
+<div id='canvas_main' class='canvas' xmlns:xi="http://www.w3.org/2001/XInclude" >
+
+ <script language='javascript' type='text/javascript'>
+ config.ids.result = {};
+ config.css.result = {};
+ config.names.result = {};
+ config.ids.result.offset_start = "offset_start";
+ config.ids.result.offset_end = "offset_end";
+ config.ids.result.result_count = "result_count";
+ config.ids.result.next_link = 'next_link';
+ config.ids.result.prev_link = 'prev_link';
+ config.ids.result.home_link = 'search_home_link';
+ config.ids.result.end_link = 'end_link';
+ config.ids.result.main_table = 'result_table';
+ config.ids.result.row_template = 'result_table_template';
+ config.ids.result.num_pages = 'num_pages';
+ config.ids.result.current_page = 'current_page';
+ config.css.result.nav_active = "nav_link_active";
+ config.ids.result.top_div = "result_table_div";
+ config.ids.result.nav_links = "search_nav_links";
+ config.ids.result.info = "result_info_div";
+ config.css.result.cc_cell_even = "copy_count_cell_even";
+ config.names.result.item_jacket = "item_jacket";
+ config.names.result.item_title = "item_title";
+ config.names.result.item_author = "item_author";
+ config.names.result.counts_row = "counts_row";
+ config.names.result.count_cell = "copy_count_cell";
+ </script>
+
+ <!--#include virtual="result_table.xml"-->
+ <!--#include virtual="result_lowhits.xml"-->
+
+</div>
+
+
--- /dev/null
+<table style='width: 100%;'>
+ <tbody>
+
+ <tr class='color_4' style='height: 1em;'>
+
+ <td style='vertical-align: top;' id='next_prev_links'>
+
+ <span class='hide_me' id='result_info_div' style='font-size: 9pt;'>
+ <span> &common.results; </span>
+ <span id='offset_start'> </span>
+ <span> - </span>
+ <span id='offset_end'> </span>
+ <span> &common.ofAtLeast; </span>
+ <span id='result_count'> </span>
+ <span style='padding-left: 6px;'> (page </span>
+ <span id='current_page'> </span>
+ <span> &common.of; </span>
+ <span id='num_pages'> </span>
+ </span>
+
+ <span id='start_end_links_span' class='hide_me'
+ style='padding-left: 40px;' >
+ <a class='search_page_nav_link' id='search_home_link'
+ title="&rdetail.page.results;">&rdetail.start;</a><a class='search_page_nav_link'
+ id='prev_link' title='&rdetail.page.previous;'>&rdetail.page.previous.short;</a>
+
+ <span class='search_page_nav_link' id='page_numbers'> </span>
+
+ <a class='search_page_nav_link' id='next_link'
+ title='&rdetail.page.next;'>&rdetail.page.next.short;</a>
+ <!--
+ <a class='search_page_nav_link'
+ id='end_link' title="&rdetail.page.last;">&rdetail.end;</a>
+ -->
+ </span>
+
+ </td>
+
+ <td colspan='5'
+ style='padding-bottom: 4px; text-align:center; vertical-align: top; border-bottom: 1px solid #E0E0E0;'>
+ <span id='search_info_table' class='hide_me' style='font-size: 8pt;'>
+ <b>&result.info.copies; </b>
+ </span>
+ </td>
+ </tr>
+
+ <tr style='height: 2em;' id='result_thead_row'>
+ <td>
+ <div class='hide_me' id='no_formats' style='padding: 4px;'>
+ <b>
+ <span style='color:red;'>*</span>
+ &result.info.no.items;
+ <div>&result.info.format.items;</div>
+ </b>
+ </div>
+
+ <div class='hide_me' id='rresult_show_all' style='padding: 4px;'>
+ <a href='javascript:rresultExpandSearch();' id='rresult_show_all_link'
+ class='classic_link'>&result.info.show; </a>
+ </div>
+
+ <div class='hide_me' id='rresult_show_here' style='padding: 4px;'>
+ <a href='javascript:rresultContractSearch();' id='rresult_show_here_link'
+ class='classic_link'>&result.info.show; </a>
+ </div>
+
+ </td>
+ <td rowspan='2' style='font-size: 8pt; padding-top: 4px;' class='copy_count_cell'
+ width='12%' align='center' name='result_thead_ccell'> </td>
+ </tr>
+
+ </tbody>
+</table>
+
--- /dev/null
+
+<div id='result_low_hits' class='hide_me'>
+
+ <br/><br/><br/>
+
+ <div style='text-align: center; padding-bottom: 8px;'>
+ <div id='result_low_hits_msg' class='hide_me'>&result.lowhits.few;</div>
+ <div id='result_zero_hits_msg' class='hide_me'>&result.lowhits.zero;</div>
+ </div>
+
+ <!-- spell checker -->
+ <div id='did_you_mean' class='lowhits_div hide_me'>
+ <span>&result.lowhits.did.you.mean; </span>
+ <a class='classic_link' id='spell_check_link'> </a>
+ </div>
+
+ <div id='low_hits_remove_format' class='lowhits_div hide_me'>
+ <span>&result.lowhits.formats; </span>
+ <a id='low_hits_remove_format_link' class='classic_link'>&result.lowhits.formats.search;</a>
+ </div>
+
+ <div id='low_hits_cross_ref' class='lowhits_div hide_me'>
+ <span>&result.lowhits.related;</span>
+ <div style='padding: 5px;'>
+ <a id='low_hits_xref_link' class='classic_link' style='padding-right: 5px;'> </a>
+ </div>
+ </div>
+
+ <div id='low_hits_expand_range' class='lowhits_div hide_me'>
+ <span>&result.lowhits.expand; </span>
+ <a id='low_hits_expand_link' class='classic_link' style='padding-right: 5px;'> </a>
+ </div>
+
+ <div id='low_hits_search_type' class='lowhits_div hide_me'>
+ <span>&result.lowhits.class;</span>
+ <a id='low_hits_title_search' class='hide_me classic_link'
+ style='padding-right: 5px;'>&result.lowhits.title;</a>
+ <a id='low_hits_author_search' class='hide_me classic_link'
+ style='padding-right: 5px;'>&result.lowhits.author;</a>
+ <a id='low_hits_subject_search' class='hide_me classic_link'
+ style='padding-right: 5px;'>&result.lowhits.subject;</a>
+ <a id='low_hits_series_search' class='hide_me classic_link'
+ style='padding-right: 5px;'>&result.lowhits.series;</a>
+ <a id='low_hits_keyword_search' class='hide_me classic_link'
+ style='padding-right: 5px;'>&result.lowhits.keyword;</a>
+ </div>
+
+</div>
+
--- /dev/null
+<!-- Search results are spit into this table -->
+
+<div id='result_table_div' xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <table id='res_table'>
+
+ <!-- for some reason, this is the only way i can force the cell widths -->
+ <thead id='result_thead'>
+<!--
+ <tr>
+ <td class='result_table_pic_header'></td>
+ <td> </td>
+ </tr>
+-->
+ </thead>
+
+ <tbody id='result_table'>
+ <tr>
+
+ <td class='result_table_row'>
+ <!--#include virtual="result_info.xml"-->
+ </td>
+ </tr>
+
+ <!-- Template for displaying a search result. This row template is cloned and inserted
+ for each result returned -->
+
+ <tr id='result_table_template' class='hide_me'>
+
+ <!-- Jacket image goes here -->
+
+ <td class='result_table_row' align='left'>
+ <table class='result_table_subtable'>
+ <tbody class='result_table_subtbody'>
+
+ <tr style='height: 1em' name='counts_row' valign="top">
+
+ <td rowspan='4' class='result_table_pic_header'>
+ <a><img name='item_jacket' class='result_table_pic'/></a>
+ </td>
+
+ <td class='result_table_title_cell' name='result_table_title_cell'>
+ <!-- Title goes here -->
+ <a title="&result.table.keyword;" name='item_title' class='search_link'>
+ <!-- Title goes here -->
+ </a>
+ </td>
+
+ <!-- Copy this td for each copy count appended -->
+ <td rowspan='4' nowrap='nowrap' name="copy_count_cell" class='copy_count_cell'>
+ </td>
+
+ </tr>
+
+ <tr style='height: 1em' >
+ <td class='result_table_author_cell'>
+ <a title="&result.table.author;" name='item_author' class='search_link'>
+ <!-- Author goes here -->
+ </a>
+ <div>
+ <span name='result_table_extra_span' class='hide_me'>
+ <span name='result_table_pub_box' style='padding-left: 10px;'>
+ <span name='result_table_edition_span' style='padding-left: 10px;'></span> |
+ <span name='result_table_pub_span'> </span> |
+ <span name='result_table_phys_span'> </span>
+ </span>
+ </span>
+ </div>
+ </td>
+ </tr>
+
+ <tr style='height:1em;' >
+ <td name='result_table_format_cell' class='result_table_format_cell'>
+
+ <a name='text_link' class='search_link'>
+ <img src='../../../../images/tor/text.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='sound recording-nonmusical_link' class='search_link'>
+ <img src='../../../../images/tor/sound recording-nonmusical.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='moving image_link' class='search_link'>
+ <img src='../../../../images/tor/moving image.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='software, multimedia_link' class='search_link'>
+ <img src='../../../../images/tor/software, multimedia.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='sound recording-musical_link' class='search_link'>
+ <img src='../../../../images/tor/sound recording-musical.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='cartographic_link' class='search_link'>
+ <img src='../../../../images/tor/cartographic.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='mixed material_link' class='search_link'>
+ <img src='../../../../images/tor/mixed material.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='notated music_link' class='search_link'>
+ <img src='../../../../images/tor/notated music.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='sound recording_link' class='search_link'>
+ <img src='../../../../images/tor/sound recording.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='still image_link' class='search_link'>
+ <img src='../../../../images/tor/still images.jpg' class='dim tor_pic' />
+ </a>
+
+ <a name='three dimensional object_link' class='search_link'>
+ <img src='../../../../images/tor/three dimensional object.jpg' class='dim tor_pic' />
+ </a>
+
+ <span class='hide_me'
+ style='color: #9999FF; padding-left: 10px; font-size: 7pt; font-weight: 300;'>
+ <span>&common.relevancy; </span><span name='relevancy_span'> </span>
+ </span>
+
+ <span class='hide_me' name='place_hold_span'>
+ <a style='padding-left: 8px;' href='javascript:void(0);'
+ class='classic_link' name='place_hold_link'></a><!--this goes in link of prev code:&opac.holds.placeHold;-->
+ </span>
+
+ <!-- Empty span used for creating unAPI links -->
+ <abbr style='padding-left: 8px;' name="unapi" class="unapi-id">
+ <!-- unAPI URI goes here -->
+ </abbr>
+
+ <!-- Empty span used for creating Google Book Search-->
+ <span name="googleBooksLink" class="hide_me">
+ <a style='padding-left: 8px;' class='classic_link' name="googleBooks-link">&result.googleBooks.browse;</a>
+ </span>
+
+ </td>
+ </tr>
+ <tr name="local_callnumber_list" class="result_table_title_cell">
+ <td>
+ <span type='opac/slot-data+holdings_xml-full' query='volumes'>
+ <span class='hide_me' debug='true' type='opac/slot-format'><![CDATA[
+ var output = dojo.create('span');
+
+ var item_cnt = 0;
+ var max_items = 4;
+
+ dojo.query('volume', item).forEach(function(vol) {
+ if (item_cnt >= max_items) {
+ return output.innerHTML;
+ }
+ if (vol.getAttribute('deleted') == 't') {
+ return;
+ }
+ if (vol.getAttribute('opac_visible') == 'f') {
+ return;
+ }
+ dojo.query('copy', vol).forEach(function (cp) {
+ if (item_cnt >= max_items) {
+ return;
+ }
+ if (cp.getAttribute('deleted') == 't') {
+ return;
+ }
+ if (cp.getAttribute('opac_visible') == 'f') {
+ return;
+ }
+
+ /* Ensure the status is visible */
+ var visible_status;
+ dojo.query('status', cp).forEach(function (status) {
+ visible_status = status.getAttribute('opac_visible');
+ });
+ if (visible_status == 'f') {
+ return;
+ }
+
+ /* Ensure the circulation library is visible */
+ var lib_vis;
+ dojo.query('circlib', cp).forEach(function (status) {
+ lib_vis = status.getAttribute('opac_visible');
+ });
+ if (lib_vis != 't') {
+ return;
+ }
+
+ var cp_entry = dojo.create('div');
+ var loc_visible;
+ var vol_appended = false;
+ dojo.query('location', cp).forEach(function (location) {
+ loc_visible = location.getAttribute('opac_visible');
+ if (loc_visible == 't') {
+ if (!vol_appended) {
+ var cn = dojo.create('span', { style: "font-weight: bold;" }, cp_entry);
+ var cn_txt = dojo.doc.createTextNode(vol.getAttribute('label'));
+ cn.appendChild(cn_txt);
+ vol_appended = true;
+ }
+ var loc = dojo.create('span', { "style": "font-weight: bold;"}, cp_entry);
+ var loc_txt = dojo.doc.createTextNode(' - ' + BT.textContent(location));
+ loc.appendChild(loc_txt);
+ }
+ });
+ if (loc_visible != 't') {
+ return;
+ }
+ dojo.query('circ_lib', cp).forEach(function (circ_lib) {
+ var cp_lib = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry, "first");
+ var cp_lib_txt = dojo.doc.createTextNode(circ_lib.getAttribute('name') + ' - ');
+ cp_lib.appendChild(cp_lib_txt);
+ });
+ dojo.query('status', cp).forEach(function (status) {
+ var cp_status = dojo.create('span', { "style": "font-weight: bold;" }, cp_entry);
+ var cp_status_txt = dojo.doc.createTextNode(' (' + BT.textContent(status) + ')');
+ cp_status.appendChild(cp_status_txt);
+ });
+
+ item_cnt++;
+ if (item_cnt >= max_items) {
+ dojo.create('br', null, cp_entry);
+ cp_entry.appendChild(dojo.doc.createTextNode(opac_strings.MORE_COPIES_FULL_RECORD));
+ }
+ output.appendChild(cp_entry);
+ });
+ });
+
+ return output.innerHTML;
+ ]]></span>
+ </span>
+ </td>
+ </tr>
+ <!-- Placeholder for ChiliFresh Review -->
+ <tr class="hide_me" name="chilifreshReview">
+ <td valign="top" colspan="2">
+ <span name="chilifreshReviewLink" class="chili_review"></span>
+ <div name="chilifreshReviewResult" style="display:none"></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+ <!-- ====================== -->
+ <table style='width: 100%; margin-top: 12px;' id='result_info_2' class='hide_me'>
+ <tbody>
+
+ <tr class='color_4' style='height: 1em;'>
+
+ <td style='vertical-align: top;' id='next_prev_links2'>
+
+ <span class='hide_me' id='result_info_div2' style='font-size: 9pt;'>
+ <span> &common.results; </span>
+ <b id='offset_start2'> </b>
+ <span> - </span>
+ <b id='offset_end2'> </b>
+ <span> &common.ofAtLeast; </span>
+ <b id='result_count2'> </b>
+ <span style='padding-left: 6px;'> (page </span>
+ <span id='current_page2'> </span>
+ <span> &common.of; </span>
+ <span id='num_pages2'> </span>
+ </span>
+
+ <span id='start_end_links_span2' class='hide_me'
+ style='padding-left: 40px;' >
+ <a class='search_page_nav_link' id='search_home_link2'
+ title="&rdetail.page.results;">&rdetail.start;</a><a class='search_page_nav_link'
+ id='prev_link2' title='&rdetail.page.previous;'>&rdetail.page.previous.short;</a>
+
+ <span class='search_page_nav_link' id='page_numbers2'> </span>
+ <a class='search_page_nav_link' id='next_link2'
+ title='&rdetail.page.next;'>&rdetail.page.next.short;</a>
+ <!--
+ <a class='search_page_nav_link'
+ id='end_link2' title="&rdetail.page.last;">&rdetail.end;</a>
+ -->
+ </span>
+
+ </td>
+
+ <td colspan='5'
+ style='padding-bottom: 4px; text-align:center; vertical-align: top; border-bottom: 1px solid #E0E0E0;'>
+ <!--
+ <span id='search_info_table2' style='font-size: 8pt;'>
+ <b>Available copies / Total copies </b>
+ </span>
+ -->
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <!-- ====================== -->
+
+
+ <script language='javascript' type='text/javascript'>
+ config.names.result.format_cell = 'result_table_format_cell';
+ config.names.result.format_link = 'resource_link'
+ config.names.result.format_pic = 'format_pic'
+ </script>
+
+ <!-- ChiliFresh setup -->
+ <script language='javascript' type='text/javascript'>
+ var chilifresh = '<!--#echo var="OILS_CHILIFRESH_ACCOUNT"-->';
+ if (chilifresh=='(none)') { chilifresh = false; }
+ </script>
+ <!--#if expr="${OILS_CHILIFRESH_ACCOUNT} && ${OILS_CHILIFRESH_ACCOUNT}!='(none)'"-->
+ <input type="hidden" id="chilifresh_account" name="chilifresh_account"
+ value="<!--#echo var='OILS_CHILIFRESH_ACCOUNT'-->" />
+ <input type="hidden" id="chilifresh_profile" name="chilifresh_profile"
+ value="<!--#echo var='OILS_CHILIFRESH_PROFILE'-->" />
+ <input type="hidden" id="chilifresh_version" name="chilifresh_version" value="onsite_v1" />
+ <input type="hidden" id="chilifresh_type" name="chilifresh_type" value="search" />
+ <script language="javascript" type="text/javascript" src="<!--#echo var='OILS_CHILIFRESH_URL'-->"></script>
+ <!--#endif-->
+</div>
+
+
--- /dev/null
+index.xml
\ No newline at end of file
--- /dev/null
+<!-- Sets our environment variables for convenience and determining which page we're on -->
+
+<!--#set var='OILS_PAGE' value="$DOCUMENT_NAME"-->
+
+<!--#if expr="$DOCUMENT_NAME='index.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.home'-->
+ <!--#set var='FRONT_PAGE' value='true'-->
+
+<!--#elif expr="$DOCUMENT_NAME='mresult.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.mresult'-->
+
+
+<!--#elif expr="$DOCUMENT_NAME='rresult.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.rresult'-->
+
+<!--#elif expr="$DOCUMENT_NAME='rdetail.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.rdetail'-->
+
+<!--#elif expr="$DOCUMENT_NAME='myopac.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.myopac'-->
+
+<!--#elif expr="$DOCUMENT_NAME='advanced.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.advanced'-->
+
+<!--#elif expr="$DOCUMENT_NAME='reqitems.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.reqitems'-->
+
+<!--#elif expr="$DOCUMENT_NAME='cnbrowse.xml'"-->
+ <!--#set var='OILS_TITLE' value='opac.title.cnbrowse'-->
+
+<!--#endif-->
+
+<!--#if expr="$HTTPS"-->
+ <!--#set var="OILS_PROTOCOL" value="https"-->
+ <!--#if expr="$OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=='yes'"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value=""-->
+ <!--#set var="OILS_OPAC_JS_HOST" value=""-->
+ <!--#endif-->
+<!--#else-->
+ <!--#set var="OILS_PROTOCOL" value="http"-->
+<!--#endif-->
+
+<!--#if expr="$OILS_OPAC_STATIC_PROTOCOL"-->
+
+<!--#else-->
+ <!--#set var="OILS_OPAC_STATIC_PROTOCOL" value="$OILS_PROTOCOL"-->
+<!--#endif-->
+
+<!--#set var="OILS_BASE" value="${OILS_PROTOCOL}://${SERVER_NAME}/${OILS_OPAC_BASE}"-->
+<!--#set var="OILS_XML_BASE" value="${OILS_BASE}/common/xml"-->
+
+
+<!-- Javascript host -->
+<!--#if expr="$OILS_OPAC_JS_HOST"-->
+ <!--#set var="OILS_OPAC_JS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_JS_HOST}"-->
+<!--#else -->
+ <!--#set var="OILS_OPAC_JS_HOST" value="$OILS_BASE"-->
+<!--#endif -->
+<!--#set var="OILS_JS_BASE" value="${OILS_OPAC_JS_HOST}/common/js"-->
+
+
+<!--#if expr="$OILS_OPAC_CSS_HOST"-->
+ <!--#set var="OILS_OPAC_CSS_HOST" value="${OILS_OPAC_STATIC_PROTOCOL}://${OILS_OPAC_CSS_HOST}"-->
+<!--#else -->
+ <!--#set var="OILS_OPAC_CSS_HOST" value="$OILS_BASE"-->
+<!--#endif -->
+<!--#set var="OILS_THEME_BASE" value="${OILS_OPAC_CSS_HOST}/theme"-->
+<!--#set var="OILS_SKIN_BASE" value="${OILS_OPAC_CSS_HOST}/skin"-->
+<!--#set var="OILS_CSS_BASE" value="${OILS_OPAC_CSS_HOST}/common/css"-->
+
+
+<!--#if expr="!$locale || $locale=''"-->
+ <!--#set var="locale" value="en-US"-->
+<!--#endif-->