function hw_writeSearchResultEntry(params) { var p=params||{}; var is_fulltext=place("extended.search.entry.get_attrib","FullTextQuery"); var is_keyword=place("extended.search.entry.get_attrib","KeyQuery"); writeln('
'); if (global_userCanEdit) { writeln(''); writeln(''); } write(place("extended.search.entry.get_attrib","Score"),'%'); write(''); if (!p.error.error()) { hw_search_addAnchor(p.entry,fulltext); write(''); hw_search_addEndAnchor(p.entry); } else write(''); write(' '); if (!p.error.error()) hw_search_addAnchor(p.entry,fulltext); write("",p.entry.getTitle(),""); if (!p.error.error()) hw_search_addEndAnchor(p.entry); writeln(""); if (p.error.error()) { // display error if there is one write(""); hw_internal_printError(p.error); write("\n"); } writeln('
'); if (p.entry.Description) write(p.entry.getDescription(),"
"); else if (p.entry.DocumentType == "text" && !(entry.HW_Version=="experimental" && entry.HW_EffectiveAccess!="WRITE_ACCESS" && !place("session.user.is_system"))) write(show_preview(p.entry.GOid),"
"); writeln("
"); write(""); if (!p.error.error()) hw_writeSearchResultParents({entry:p.entry}); writeln('
'); } function hw_writeSearchResultParents(params) { // display parents if (typeof params == "undefined") return; var parout=server.parents({objectidentifier:params.entry.getGOid()}); if (parout.error.error()) return; writeln('
'); var parents = parout.objects; if (parents.length) writeln(''); for (var parcount=0; parcount '); write(curpar.getTitle()); hw_search_addEndAnchor(curpar); write(' ',lrc("srDlgTxt8","sear","on server"),': '); write(server.getServerName(curpar)); writeln('
'); } if (parents.length) writeln('
'); } // --------------------------------------------------------------------- // show_preview // ------------- // prints some characters of a document without markup // // parameters: GOID: global object ID of object to be shown // returns: nothing // --------------------------------------------------------------------- function show_preview(goid) { var out = server.content({objectidentifier:goid, mode:2}); // without links var ret = ""; if (!out.error.error()) { ret = out.content.read(Math.min(out.content.length, 2000)); ret = ret.replace(/\n|\r|\t/gi," "); //replace whitespace by blanks ret = ret.replace(/ %%if !session.user.is_noedituser%% %%resdef "v1.0/components/standardpage/langres/standardpage.lrc" stdp%% %%move_copy_script%% %%endif%% %%endmacro%% %%macro searchresultlegend%%
var obj_found = place('extended.search.iterative.objects.found'); var found = parseInt(place('extended.search.count')); write (lrc("srDlgCap3","sear","Documents Found"),": "); if (obj_found > 0) write (''+(obj_found+ap.objc-1)+''); else write (lrc("srDlgTxt5","sear",{foundcount:''+Math.abs(obj_found)+''},"Approximately %foundcount%")); - in %%lrc srDlgTxt2 sear "attributes"%% - %%lrc srDlgTxt3 sear "in content"%% - %%lrc srDlgTxt4 sear "in both"%%
write(lrc("srDlgTxt6","sear",{foundcount:''+Math.abs(obj_found)+'',fromcount:ap.objc,tocount:(ap.objc+found-1)},"Showing %fromcount%-%tocount%"));
%%endmacro%% %%macro searchresultcontent%% writeln(''); if (global_userCanEdit) //write Menu bar { var HW_MenuRetObj=HW_getMenuSearchResult(); var hw_menu_mbarname=HW_MenuRetObj.mainMenuBar.toHTML(); writeln(''); writeln(''); writeln(''); } while(place("extended.search.next_entry")) { // get search result entry entryout=server.object({objectidentifier:place("extended.search.entry.get_attrib","GOid"),attributeselector:["HW_EffectiveAccess","HW_ExtendedAccess"]}); if (entryout.error.error()) //use extended.search.entry (dummy object) entry=hw_makeObjFromPlace({obj:"extended.search.entry"}); else entry=entryout.object; hw_writeSearchResultEntry({entry:entry,error:entryout.error,fulltext:fulltext}); } writeln(''); if (place("extended.search.iterative.start.idx") != "0") writeln(''); else writeln(imgsp(18,24)); if (place("extended.search.iterative.have.more") != "0") writeln(''); else writeln(imgsp(18,24)); writeln(''); %%endmacro%% %%macro searchresultcontenthidden%% writeln(''); while (place("extended.search.vars.next_entry")) { write("'); if (place("extended.search.vars.entry.name") == "fulltext") { fulltext = place("extended.search.vars.entry.value"); fulltext = fulltext.replace(/ü/g,"ü"); fulltext = fulltext.replace(/Ü/g,"Ü"); fulltext = fulltext.replace(/ö/g,"ö"); fulltext = fulltext.replace(/Ö/g,"Ö"); fulltext = fulltext.replace(/ä/g,"ä"); fulltext = fulltext.replace(/Ä/g,"Ä"); fulltext = fulltext.replace(/ß/g,"ß"); fulltext = fulltext.replace(/[&| ]/g," "); // replace native operators fulltext = fulltext.replace(/<[^>]*>/g," "); // replace Verity operators fulltext = fulltext.replace(/[^\w]+/g," "); // replace Verity operators fulltext = fulltext.replace(/(\w) (\w)/g,"$1|$2"); // replace "real" OR operator fulltext = fulltext.replace(/ /g,""); // eliminate other operators } } %%endmacro%% %%macro dialog_searchresult%% var userdata = place('extended.search.userdata'); var like = false; if (userdata.search(/source=likeresult/i) != -1) like=true; var findexpert = false; if (userdata.search(/source=findexpert/i) != -1) findexpert=true; global_userCanEdit=!place("session.user.is_noedituser"); //***** DIALOG SPECS *****// var ap=getSearchresultPars(); if (isNaN(ap.back)) //if we're coming from Portal Search var newSearchExec='window.location.href="/'+request.object.getGOid()+';internal&action=dialog.'+((ap.back=="e")?'extendedsearch.action"':'search.action"'); else var newSearchExec="history.go(-"+ap.back+")"; var srButtons={}; if (!like) { if (!findexpert) { srButtons={"newSearch":{caption:lrc("srFrmLbl2","sear","New Search")+"...",exec:newSearchExec}}; if (global_userCanEdit) //if edit user... { srButtons.saveQuery={caption:lrc("srFrmLbl4","sear","Save Query")+"...",exec:"submitSaveQuery()"}; var out=server.find({keyquery:"(HW_DC_ClassName=HW_PortalTrackQuery)",languages:["en"]}); if (!out.error.error() && out.objects.length) //...and Agent component is installed ->Add button srButtons.createTrack={caption:lrc("srFrmLbl5","sear","Create Track")+"...",exec:"submitCreateTrack()"}; } } else { srButtons={"newSearch":{caption:lrc("srFrmLbl3","sear","Back to experts list"),exec:newSearchExec}}; var helpfuncext="findexpertresults"; } } srButtons.Cancel={caption:"Close",exec:'setCookie("HW_ml","");window.close();'}; srButtons.Help=(typeof helpfuncext!="undefined")?{func:"help",funcext:helpfuncext}:{func:"help"}; var dlg_spec={ caption:lrc("srDlgCap1","sear","Search Results"), buttons:srButtons, boxwidth:"540", macro:"searchresult_scripts", formname:"bodyform", opdlgfunc:1,datefunctions:1 }; var parspecs=hw_writeUnavailableServer(place("extended.search.scope")); var writelegend=parspecs.length==0?0:1; parspecs.push({boxes:[{paramspecs:[{name:"searchresultcontenthidden", type:"plainmacro"},{name:"searchresultcontent", type:"plainmacro"}]}]}); HW_dialogHeader(dlg_spec,parspecs); //write server_unavailable and searchhits boxes if (place("extended.search.iterative.objects.found")) for (var x=0;x'); HW_DC_dialogContent(ms.boxes,dlg_spec);//---content--- writeln(''); write(tableRowRightBottom(dlg_spec.style,{})); //---bottom of box--- } else { writeln(''); writeln('',lrc("srDlgTxt1","sear","No documents found")); writeln('
'); hw_writePLACEWithError("searchresultcontenthidden"); } HW_dialogFooter(dlg_spec);
%%endmacro%%