From d004d9914760f1c0353404b93db427e259c23082 Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 4 Mar 2010 16:52:05 +0000 Subject: [PATCH] Add a "Journal title" search option to the standard search selector git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_0@817 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- web/opac/locale/en-CA/opac_conifer.dtd | 1 + web/opac/locale/en-US/opac_conifer.dtd | 1 + web/opac/locale/fr-CA/opac_conifer.dtd | 1 + web/opac/skin/lul/js/search_bar.js | 92 ++++++++++++++++++++++++ web/opac/skin/lul/xml/common/stypes_selector.xml | 9 +++ 5 files changed, 104 insertions(+) create mode 100644 web/opac/skin/lul/js/search_bar.js create mode 100644 web/opac/skin/lul/xml/common/stypes_selector.xml diff --git a/web/opac/locale/en-CA/opac_conifer.dtd b/web/opac/locale/en-CA/opac_conifer.dtd index c074b6862d..4b61f7623e 100644 --- a/web/opac/locale/en-CA/opac_conifer.dtd +++ b/web/opac/locale/en-CA/opac_conifer.dtd @@ -41,6 +41,7 @@ + diff --git a/web/opac/locale/en-US/opac_conifer.dtd b/web/opac/locale/en-US/opac_conifer.dtd index be07c69056..991f670fa8 100644 --- a/web/opac/locale/en-US/opac_conifer.dtd +++ b/web/opac/locale/en-US/opac_conifer.dtd @@ -40,6 +40,7 @@ + diff --git a/web/opac/locale/fr-CA/opac_conifer.dtd b/web/opac/locale/fr-CA/opac_conifer.dtd index 77393cade8..f93b4ca3ba 100644 --- a/web/opac/locale/fr-CA/opac_conifer.dtd +++ b/web/opac/locale/fr-CA/opac_conifer.dtd @@ -40,6 +40,7 @@ + diff --git a/web/opac/skin/lul/js/search_bar.js b/web/opac/skin/lul/js/search_bar.js new file mode 100644 index 0000000000..6d32bb5f5d --- /dev/null +++ b/web/opac/skin/lul/js/search_bar.js @@ -0,0 +1,92 @@ +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() : ""; + 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; + + clearSearchParams(); + + if(!text || text == "") return; + + var d = (newSearchDepth != null) ? newSearchDepth : depthSelGetDepth(); + if(isNaN(d)) d = 0; + + var args = {}; + + if(SHOW_MR_DEFAULT || (isFilterSort && 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_LOCATION] = depthSelGetNewLoc(); + args[PARAM_DEPTH] = d; + args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value; + if (_ts.options[_ts.selectedIndex].id == 'jtitle') { + args[PARAM_BIBLEVEL] = 's'; + } + + + 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)); +} + + diff --git a/web/opac/skin/lul/xml/common/stypes_selector.xml b/web/opac/skin/lul/xml/common/stypes_selector.xml new file mode 100644 index 0000000000..1ec673c109 --- /dev/null +++ b/web/opac/skin/lul/xml/common/stypes_selector.xml @@ -0,0 +1,9 @@ + + -- 2.11.0