From: Andrew N. <and...@vi...> - 2007-10-04 14:19:57
|
Chris, thanks for the patch! I had been working on a similar concept. However, with my implementation w= e had the narrow list reloaded as to not flood the browser with extra data.= I think reloading the facets will be much more efficient. I also will have a configuration setting so that the library can configure = how many facets to display. Andrew > -----Original Message----- > From: vuf...@li... [mailto:vufind- > gen...@li...] On Behalf Of Chris Delis > Sent: Wednesday, October 03, 2007 8:12 PM > To: Matt Mackey; vuf...@li... > Subject: Re: [VuFind-General] Add location to "Narrow Search" > > > 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++ =3D=3D 10) { > > if (facetCnt >=3D 10) { > > > > to: > > > > if (facetCnt++ =3D=3D 5) { > > if (facetCnt >=3D 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 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- 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=3D"JavaScript" type=3D"text/javascript"> > > - getNarrowOptions('{$query}', '{$filterQuery}', > '{$recordCount}', '5'); > > + getNarrowOptions('{$query}', '{$filterQuery}', > > + '{$recordCount}', '30'); > > </script> > > </div> > > </div> > > Index: web/services/Search/ajax.js > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- web/services/Search/ajax.js (revision 167) > > +++ web/services/Search/ajax.js (working copy) > > @@ -286,6 +286,7 @@ > > var narrowList =3D getElem('narrowList'); > > var loading =3D getElem('narrowLoading'); > > var responseHTML =3D ''; > > + var totalHTML =3D ''; > > var facet; > > > > var http =3D createRequestObject(); @@ -326,6 +327,7 @@ > > } > > > > var facetText; > > + var facetCnt=3D0; > > for (j=3D0; j<facets.length; j++) { > > // Darn browser non compliance! > > dummy =3D document.createTextNode('test'); > > @@ -345,6 +347,18 @@ > > } > > > > if (facets[j].attributes && > > (facets[j].getAttribute('count') > 0) && (facetText !=3D '')) { > > + if (facetCnt++ =3D=3D 10) { > > + var facetName =3D > options.item(i).getAttribute('name'); > > + totalHTML +=3D '<dl > class=3D"narrowList navmenu narrow_begin" id=3D"facet_begin_' + facetName= + > '">'; > > + totalHTML +=3D responseHTML; > > + totalHTML +=3D '</dd><dd>'; > > + totalHTML +=3D '<a href=3D"" > onclick=3D"hideThese(\'facet_begin_' + facetName + '\'); > showThese(\'facet_end_' + facetName + '\'); return > false;">more...</a></dd></dl>'; > > + totalHTML +=3D '<dl > class=3D"narrowList navmenu narrow_end" id=3D"facet_end_' + facetName + > '">'; > > + totalHTML +=3D responseHTML; > > + responseHTML =3D ''; > > + } > > + > > + > > responseHTML +=3D '<dd><a > href=3D"'+window.location+'&filter[]=3D'+facets[j].nodeName+':%22'+facetT= ex > t+'%22">'; > > if > (options.item(i).getAttribute('name') =3D=3D 'language') { > > switch > (facetText.replace(/^\s+/, > > '').replace(/\s+$/, '')) { @@ -461,12 +475,18 @@ > > responseHTML +=3D '</a> > ('+facets[j].getAttribute('count')+')</dd>'; > > } > > } > > + totalHTML +=3D responseHTML; > > + responseHTML =3D ''; > > + if (facetCnt >=3D 10) { > > + totalHTML +=3D '<dd><a href=3D"" > onclick=3D"hideThese(\'facet_end_' + facetName + '\'); > showThese(\'facet_begin_' + facetName + '\'); return > false;">less...</a></dd></dl>'; > > + totalHTML +=3D '</dl>'; > > + } > > } > > } > > } > > > > loading.style.display =3D 'none'; > > - narrowList.innerHTML =3D responseHTML; > > + narrowList.innerHTML =3D totalHTML; > > } > > } > > http.send(null); > > @@ -549,4 +569,16 @@ > > } > > } > > return list.join('&'); > > -} > > \ No newline at end of file > > +} > > + > > +function showThese(elemId) > > +{ > > + var el =3D getElem(elemId); > > + el.style.display=3D'block'; > > +} > > + > > +function hideThese(elemId) > > +{ > > + var el =3D getElem(elemId); > > + el.style.display=3D'none'; > > +} > > Index: web/css/styles.css > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- 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; > |