From: Matt M. <mm...@ba...> - 2007-10-04 13:44:10
|
Hi Chris, Thanks for the attachment and the updated files. It works great. Matt Chris Delis wrote: > Apparently, my last email's attachments were too large. I gzip'ed the > tar file and will try again... > > Chris > > > On Wed, Oct 03, 2007 at 07:05:59PM -0500, Chris Delis wrote: > >> On Tue, Oct 02, 2007 at 03:10:57PM -0400, Matt Mackey wrote: >> >>> Hi All, >>> >>> Is it possible to add "Location" to the choices on the "Narrow Search" >>> column? >>> >>> Also, is it possible to keep the list of choices at 5 but add a >>> button that would expand and show all of the choices? >>> >> I created a quick patch that will initially list 10 choices (I thought >> 5 were too few) and added a "more..." and "less..." link at the >> bottom of each group. Clicking on "more..." will expand the list to >> 30, clicking on "less..." will revert back to 10. I thought about >> expanding the complete list, but thought it was overkill. If you want >> all of them, you can edit list.tpl and change the: >> >> getNarrowOptions('{$query}', '{$filterQuery}', '{$recordCount}', '30'); >> >> to: >> >> getNarrowOptions('{$query}', '{$filterQuery}', '{$recordCount}', ''); >> >> >> If you want to change the initial number of choices listed from 10 to >> 5, edit ajax.js and change the two "if" statements from: >> >> if (facetCnt++ == 10) { >> if (facetCnt >= 10) { >> >> to: >> >> if (facetCnt++ == 5) { >> if (facetCnt >= 5) { >> >> >> I edited 3 files total: >> >> web/services/Search/templates/list.tpl >> web/services/Search/ajax.js >> web/css/styles.css >> >> I will include the svn diff file and also a tarball of the 3 edited >> files above. You can untar the file (but first, I urge you to back up >> the originals, if you aren't already under version control) in your >> main /vufind directory. >> >> Maybe somebody can clean it up and make it better. :-) >> >> --Chris >> >> >> >>> Thanks, >>> Matt >>> >>> -- >>> Matthew Mackey >>> Consortium Manager >>> Lehigh Valley Library System >>> >>> Email: mm...@ba... >>> Tel: 610.867.3761 x261 >>> Fax: 610.867.2767 >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> VuFind-General mailing list >>> VuF...@li... >>> https://lists.sourceforge.net/lists/listinfo/vufind-general >>> > > >> Index: web/services/Search/templates/list.tpl >> =================================================================== >> --- web/services/Search/templates/list.tpl (revision 167) >> +++ web/services/Search/templates/list.tpl (working copy) >> @@ -139,7 +139,7 @@ >> Loading Narrow Options ... >> </div> >> <script language="JavaScript" type="text/javascript"> >> - getNarrowOptions('{$query}', '{$filterQuery}', '{$recordCount}', '5'); >> + getNarrowOptions('{$query}', '{$filterQuery}', '{$recordCount}', '30'); >> </script> >> </div> >> </div> >> Index: web/services/Search/ajax.js >> =================================================================== >> --- web/services/Search/ajax.js (revision 167) >> +++ web/services/Search/ajax.js (working copy) >> @@ -286,6 +286,7 @@ >> var narrowList = getElem('narrowList'); >> var loading = getElem('narrowLoading'); >> var responseHTML = ''; >> + var totalHTML = ''; >> var facet; >> >> var http = createRequestObject(); >> @@ -326,6 +327,7 @@ >> } >> >> var facetText; >> + var facetCnt=0; >> for (j=0; j<facets.length; j++) { >> // Darn browser non compliance! >> dummy = document.createTextNode('test'); >> @@ -345,6 +347,18 @@ >> } >> >> if (facets[j].attributes && (facets[j].getAttribute('count') > 0) && (facetText != '')) { >> + if (facetCnt++ == 10) { >> + var facetName = options.item(i).getAttribute('name'); >> + totalHTML += '<dl class="narrowList navmenu narrow_begin" id="facet_begin_' + facetName + '">'; >> + totalHTML += responseHTML; >> + totalHTML += '</dd><dd>'; >> + totalHTML += '<a href="" onclick="hideThese(\'facet_begin_' + facetName + '\'); showThese(\'facet_end_' + facetName + '\'); return false;">more...</a></dd></dl>'; >> + totalHTML += '<dl class="narrowList navmenu narrow_end" id="facet_end_' + facetName + '">'; >> + totalHTML += responseHTML; >> + responseHTML = ''; >> + } >> + >> + >> responseHTML += '<dd><a href="'+window.location+'&filter[]='+facets[j].nodeName+':%22'+facetText+'%22">'; >> if (options.item(i).getAttribute('name') == 'language') { >> switch (facetText.replace(/^\s+/, '').replace(/\s+$/, '')) { >> @@ -461,12 +475,18 @@ >> responseHTML += '</a> ('+facets[j].getAttribute('count')+')</dd>'; >> } >> } >> + totalHTML += responseHTML; >> + responseHTML = ''; >> + if (facetCnt >= 10) { >> + totalHTML += '<dd><a href="" onclick="hideThese(\'facet_end_' + facetName + '\'); showThese(\'facet_begin_' + facetName + '\'); return false;">less...</a></dd></dl>'; >> + totalHTML += '</dl>'; >> + } >> } >> } >> } >> >> loading.style.display = 'none'; >> - narrowList.innerHTML = responseHTML; >> + narrowList.innerHTML = totalHTML; >> } >> } >> http.send(null); >> @@ -549,4 +569,16 @@ >> } >> } >> return list.join('&'); >> -} >> \ No newline at end of file >> +} >> + >> +function showThese(elemId) >> +{ >> + var el = getElem(elemId); >> + el.style.display='block'; >> +} >> + >> +function hideThese(elemId) >> +{ >> + var el = getElem(elemId); >> + el.style.display='none'; >> +} >> Index: web/css/styles.css >> =================================================================== >> --- web/css/styles.css (revision 167) >> +++ web/css/styles.css (working copy) >> @@ -50,6 +50,12 @@ >> .narrow { >> padding-top:15px; >> } >> +.narrow_begin { >> + display:block; >> +} >> +.narrow_end { >> + display: none; >> +} >> .myblock { >> border: 1px solid #cccccc; >> padding:15px; >> > > > -- Matthew Mackey Consortium Manager Lehigh Valley Library System Email: mm...@ba... Tel: 610.867.3761 x261 Fax: 610.867.2767 |