From: dbs Date: Fri, 15 Apr 2011 18:02:03 +0000 (+0000) Subject: Move "Journal title" search into default skin and update NOSM skin X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8990057d6801b92e67608cb9cdc0f7491e36441a;p=contrib%2FConifer.git Move "Journal title" search into default skin and update NOSM skin Who doesn't want a Journal Title search, eh? git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_2_0@1366 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/web/opac/skin/default/js/search_bar.js b/web/opac/skin/default/js/search_bar.js new file mode 100644 index 0000000000..a8ebca1615 --- /dev/null +++ b/web/opac/skin/default/js/search_bar.js @@ -0,0 +1,101 @@ +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()); + + /* If searching for journal title, set it to journal title */ + if (getStype() == 'title' && getBibLevel() == 's') { + dojo.byId('jtitle').selected = true; + } + + 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; + + /* Set the bib level to 's' for serials if the magic "Journal title" has ben chosen */ + 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/default/xml/common/stypes_selector.xml b/web/opac/skin/default/xml/common/stypes_selector.xml new file mode 100644 index 0000000000..d1927b9f5a --- /dev/null +++ b/web/opac/skin/default/xml/common/stypes_selector.xml @@ -0,0 +1,9 @@ + + diff --git a/web/opac/skin/lul/js/search_bar.js b/web/opac/skin/lul/js/search_bar.js deleted file mode 100644 index a8ebca1615..0000000000 --- a/web/opac/skin/lul/js/search_bar.js +++ /dev/null @@ -1,101 +0,0 @@ -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()); - - /* If searching for journal title, set it to journal title */ - if (getStype() == 'title' && getBibLevel() == 's') { - dojo.byId('jtitle').selected = true; - } - - 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; - - /* Set the bib level to 's' for serials if the magic "Journal title" has ben chosen */ - 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 deleted file mode 100644 index d1927b9f5a..0000000000 --- a/web/opac/skin/lul/xml/common/stypes_selector.xml +++ /dev/null @@ -1,9 +0,0 @@ - - diff --git a/web/opac/skin/lul/xml/home/homesearch.xml b/web/opac/skin/lul/xml/home/homesearch.xml index 1a91c02676..97ca3f53e6 100644 --- a/web/opac/skin/lul/xml/home/homesearch.xml +++ b/web/opac/skin/lul/xml/home/homesearch.xml @@ -7,7 +7,7 @@ + src="/skin/default/js/search_bar.js"> - + diff --git a/web/opac/skin/nosm/xml/home/homesearch.xml b/web/opac/skin/nosm/xml/home/homesearch.xml index 9893a63c37..e42254f320 100644 --- a/web/opac/skin/nosm/xml/home/homesearch.xml +++ b/web/opac/skin/nosm/xml/home/homesearch.xml @@ -28,10 +28,10 @@
- +
- + @@ -110,7 +110,7 @@ &common.language; -