[%- USE CGI; USE ws = WebSession; j = ws.bootstrap_client("/openils/conf/opensrf_core.xml"); rank_threshold = 5000; base_url = 'http://dev.gapines.org/'; pagesize = 10; IF CGI.param('pagesize'); pagesize = CGI.param('pagesize'); END; itempage = CGI.param('page'); #type,string,location,depth,limit,offset search_meth = 'open-ils.search.biblio.class'; session = ws.init_app_session('open-ils.search'); type = CGI.param('mr_search_type'); string = CGI.param('mr_search_query'); location = CGI.param('mr_search_location'); depth = CGI.param('mr_search_depth'); max_rank = CGI.param('max_rank') || 0; limit = pagesize; offset = (itempage - 1) * pagesize; IF offset < 0; offset = 0; END; id_req = session.request(search_meth, type, string, location, depth, limit, offset); j = id_req.wait_complete(); list = id_req.recv().content(); j = id_req.finish; count = list.count; IF max_rank == '{relevanceScale}'; max_rank = 0; END; -%] Pines Catalogue Search: [% string | html %] [% base_url %]/opac/extras/opensearch/?target=mr_result&mr_search_type=[% type %]&mr_search_query=[% string | uri | html %]&page=[% itempage %]&mr_search_depth=[% depth %]&mr_search_location=[% location %]&pagesize=[% pagesize %]&max_rank=[% max_rank %] Search results for "[% string | html %]" at dev.gapines.org en-us &copy;2004-2005, Georga Public Library Service. [% count %] [% offset + 1 %] [% pagesize %] [%- mr_list = list.ids; FOREACH mr_id = mr_list; req = session.request('open-ils.search.biblio.metarecord.mods_slim.retrieve', mr_id.0); j = req.wait_complete(); IF max_rank == 0; max_rank = mr_id.1; ' ' _ max_rank _ "\n"; END; rank = mr_id.1 / max_rank; rank = rank * 100; rank = rank.split('\.').0; #''; mods = req.recv().content(); j = req.finish; -%] [% mods.title() | html %] [% base_url %]/opac/en-US/skin/default/xml/rresult.xml?m=[% mr_id.0 %]&l=[% location %] [% rank %] [%- IF mods.isbn(); -%] <div style="float: left;"> <a href="[% base_url %]/opac/en-US/skin/default/xml/rresult.xml?m=[% mr_id.0 %]&l=[% location %]"> <img style="padding: 3px; border: none;" width="45" height="50" src="http://images.amazon.com/images/P/[% mods.isbn().split('\s+').0 %].01.MZZZZZZZ.jpg"> </a> </div> [%- END; IF mods.author(); -%] <b>Author:</b> <a href="[% base_url %]/opac/en-US/skin/default/xml/mresult.xml?tp=author&t=[% mods.author() | uri | html %]&l=[% location %]">[% mods.author() | html %]</a><br> [% END; IF mods.subject(); %] <b>Subjects:</b> [% FOREACH sub IN mods.subject().keys; IF loop.count() > 3; ', ...'; LAST; END; IF loop.index; ', '; END; -%] <a href="[% base_url %]/opac/en-US/skin/default/xml/mresult.xml?tp=subject&mr_search_query=[% sub | uri | html %]">[% sub | html %]</a>[% END; %] <br> [% l = mods.online_loc(); IF l.size; '<b>Other Resources:</b>'; x = l.size / 2; i = 0; saw = { 'no' => 'no' }; %][% WHILE i <= x; h = i * 2; t = h + 1; h = l.list.$h | uri | html; t = l.list.$t | html; %][% IF saw.exists(t); i = i + 1; NEXT; END %][% saw.$t = t; '<a href="' _ h _ '">' _ t _ '</a>&nbsp;'; i = i + 1; END; '<br>'; END; END; %] [%- END; -%]