Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\kbase\frontoffice\knowledge_base.jsp
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% /****************************************************************************** * Copyright (c) 2000-2005 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. ******************************************************************************/ %><%@page session="true" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils"%> <%@ page import="com.edeal.frontline.DataDictionary"%> <%@ page import="org.apache.solr.common.SolrDocumentList"%> <%@ page import="org.apache.solr.common.SolrDocument"%> <%@ page import="org.apache.solr.client.solrj.response.QueryResponse"%> <%@ page import="org.apache.solr.client.solrj.response.SpellCheckResponse"%> <%@ page import="org.apache.solr.client.solrj.response.FacetField" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String query = flRequest.getParameter("query"); String lngCode = flRequest.getParameter("lngCode"); if(Utils.isEmpty(lngCode)) lngCode = "fr_FR"; Boolean deepen = "on".equals(flRequest.getParameter("deepen")); QueryResponse rsp = (QueryResponse) flRequest.getAttribute("solr_response"); Hashtable faqsScores = (Hashtable)flRequest.getAttribute("faqs_score"); Hashtable faqsTags = (Hashtable)flRequest.getAttribute("faqs_tags"); Hashtable faqsStatus = (Hashtable)flRequest.getAttribute("faqs_status"); Hashtable faqsWithAttachment = (Hashtable)flRequest.getAttribute("faqs_with_attachment"); Hashtable faqsWithComment = (Hashtable)flRequest.getAttribute("faqs_with_comment"); String solID = flRequest.getRequestParameterOrAttribute("SolID"); String solTitle = flRequest.getRequestParameterOrAttribute("solToken"); solTitle += " " + flRequest.getRequestParameterOrAttribute("solSubject"); String catID = flRequest.getRequestParameterOrAttribute("catID"); String subCatID = flRequest.getRequestParameterOrAttribute("subCatID"); String crtID = flRequest.getRequestParameterOrAttribute("CrtID"); Vector<Vector> lngCodes = (Vector<Vector>)dico.getRefCodeList("FaqLngID"); String sfwID = flRequest.getRequestParameterOrAttribute("SfwID"); %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <style type="text/css"> .queryInput{font-family:Arial,Verdana,sans-serif;font-weight:bold;font-size:12px;height:18px;border-top:rgb(127,157,185) 1px solid;border-bottom:rgb(127,157,185) 1px solid;border-right:none;border-left:none;outline:none;} .queryInput:focus{outline:none;} .dropdown{float:left;} .dropdown dt{background:#FFF;margin:0;padding:3px 5px 0 5px;height:17px;border-top:rgb(127,157,185) 1px solid;border-bottom:rgb(127,157,185) 1px solid;border-left:rgb(127,157,185) 1px solid;border-right:none;} .dropdown dd,.dropdown ul{margin:0;padding:0;} .dropdown dd{position:relative;} .dropdown a,.dropdown a:visited{color:grey;text-decoration:none;outline:none;} .dropdown a:hover{color:grey;text-decoration:none;} .dropdown dt a{display:block;padding:0 0 0 0;} .dropdown dt a:hover{color:grey;} .dropdown dt a span{cursor:pointer;display:inline;font-size:8px;} .dropdown dd ul{background:#fff none repeat scroll 0 0;border:1px solid grey;color:grey;display:none;left:0;padding:0;position:absolute;top:2px;width:170px;min-width:170px;list-style:none;z-index:10000;} .dropdown span.value{display:none;} .dropdown dd ul li {text-align:left;} .dropdown dd ul li a{padding:5px 5px 5px 4px;display:block;font-size:11px;} .dropdown dd ul li a:hover{background-color:#b5deef;} .dropdown img.flag{border:none;vertical-align:middle;margin-left:10px;} .searcher{background:#FFF;height:20px;border-left:none;border-top:rgb(127,157,185) 1px solid;border-right:rgb(127,157,185) 1px solid;border-bottom:rgb(127,157,185) 1px solid;} .jqueryFileTree LI.directory { background: url('<fl:webapp/>/js/wysiwyg/filemanager/scripts/jquery.filetree/images/directory.png') left top no-repeat; } .jqueryFileTree LI.expanded { background: url('<fl:webapp/>/js/wysiwyg/filemanager/scripts/jquery.filetree/images/folder_open.png') left top no-repeat; } .jqueryFileTree LI.file { background: url('<fl:webapp/>/js/wysiwyg/filemanager/scripts/jquery.filetree/images/file.png') left top no-repeat; } .jqueryFileTree LI.wait { background: url('<fl:webapp/>/js/wysiwyg/filemanager/scripts/jquery.filetree/images/spinner.gif') left top no-repeat; } .even{background-color: #EBF4F6} #grid-data >table{border-collapse: collapse; width:100%} </style> <!-- FileTree --> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/js/frontoffice/jquery.filetree/jqueryFileTree.css" /> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/frontoffice/rating_css.jsp" /> <script type="text/javascript" src="<fl:webapp/>/js/wysiwyg/filemanager/scripts/jquery-1.2.6.min.js"></script> <script> jq12 = jQuery.noConflict(true); </script> <script type="text/javascript" src="<fl:webapp/>/js/frontoffice/jquery.filetree/jqueryFileTree.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/frontoffice/jquery.ratings.js"></script> <script type="text/javascript" src="<fl:webapp/>/js/frontoffice/knowledge_base_js.jsp<%=(!Utils.isEmpty(crtID))? "?CrtID="+crtID : "" %>"></script> <script type="text/javascript" src="<fl:webapp/>/js/jquery-url-params.js"></script> <script type="text/javascript"> jq12(function(){ <%if(Utils.isEmpty(query)){%> loadExplorator(); <%}%> }); $(function () { $(".dropdown dt a").click(function(){ $(".dropdown dd ul").toggle() }); $(document).bind("click",function(g){ var f=$(g.target); if(!f.parents().hasClass("dropdown")){ $(".dropdown dd ul").hide() } }); $(".dropdown dd ul li a").click(function(){ var f=$(this).find("span.value").html(); var e=$("#lang_en_cours").attr("class").substr(0,2); $(".dropdown dd ul").hide() }); }); function finalize(){ window.location.href='<fl:webapp/>/kb_cart_detail.fl<%=(!Utils.isEmpty(solID))? "?SolID="+solID+"&" : "?" %><%="CrtID=" + crtID%>&detail=true&SfwID=<%= sfwID %>'; } function addFaq(id){ $.getJSON("<fl:webapp/>/add_faq_to_cart.fl?CrtID=<%=crtID%>&FaqID="+id, function(data) { if(data.Status == "OK"){ if(data.FaqScore != ""){ data.FaqScore += " <fl:getMessage code="L70F0" alt="avis"/>"; } $("#cart_data").append( "<div id=\"faq_" + id + "\">"+ "<table>"+ "<tr>"+ "<td colspan=\"2\">"+ "<div>"+ "<a href=\"#\" onclick=\"javascript:showFaq('" + data.FaqID + "')\">" + decodeURIComponent(data.FaqTitle) + "</a> " + data.FaqHasAttachment + data.FaqStatus + " <a href=\"#\" onclick=\"javascript:removeFaq('" + data.FaqID + "')\"><img border=\"0\" style=\"vertical-align: middle\" src=\"<fl:webapp/>/icons/frontoffice/cart-delete-icon.png\"/></a>"+ "</div>"+ "</td>"+ "</tr>"+ "<tr>"+ "<td colspan=\"2\">" + decodeURIComponent(data.FaqPreview) + "</td>"+ "</tr>"+ "</table>"+ "<table>"+ "<tr valign=\"top\" class=\"dataLabel\">"+ "<td>"+ "<div>"+ "<span class=\"score_" + id + "\">" + data.FaqScore + "</span>"+ " <span class=\"dataLabel\">" + data.FaqHasComment + "</span>"+ "</div>"+ "</td>"+ "</tr>"+ "</table>"+ "</div>"); $("#cart_empty").hide(); $("#cart_finalize").html( "<table>"+ "<tr>"+ "<td></td>"+ "<td class=\"actions_tablecell_seperator\"></td>"+ "<td> </td>"+ "</tr>"+ "<tr>"+ "<td></td>"+ "<td>"+ "<div class=\"cart_tablecell_1\">"+ "<a href=\"javascript:finalize();\">"+ "<p class=\"actions_tabletext\"><fl:getMessage code="L70E3" alt="Finaliser"/></p>"+ "</a>"+ "</div>"+ "</td>"+ "<td></td>"+ "</tr>"+ "</table>"); $("#cart_finalize").show(); $.closePopupLayer('FaqPopup'); }else{ $("#faq_" + id).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100); } }); } function removeFaq(id){ $.getJSON("<fl:webapp/>/remove_faq_from_cart.fl?CrtID=<%=crtID%>&FaqID="+id, function(data) { if(data.Status == "OK"){ $("#faq_" + id + "").remove(); if(data.IsEmpty == "true"){ $("#cart_finalize").hide(); $("#cart_empty").html( "<table>"+ "<tr>"+ "<td>"+ "<div>"+ "<label class=\"dataLabel\"><fl:getMessage code="L70F1" alt="Aucune fiche séléctionnée"/></label>"+ "</div>"+ "</td>"+ "</tr>"+ "</table>"); $("#cart_empty").show(); } } }); } function loadExplorator(){ $("#explorer").attr("style", "display : block"); $("#queryResult").attr("style", "display : none"); url = "kb_file_tree.fl?lngCode="+$("#lngCode").val(); solCat_initialized = false; solSubCat_initialized = false; jq12('#filetree').fileTree({ root: "", script: url, multiFolder: true, folderCallback: function(path){}, after: function(data){ <%if(!Utils.isEmpty(catID)){%> if(!solCat_initialized){ jq12("#<%=catID%>").click(); solCat_initialized = true; }else if(!solSubCat_initialized){ <%if(!Utils.isEmpty(subCatID)){%> jq12("#<%=subCatID%>").click(); solSubCat_initialized = true; <%}%> } <%}%> } }, function(file){ }); } function search_by_keyword(keyword){ showWaiting(); url = window.location.href; url = $.setUrlVar(url, "query", keyword); url = $.setUrlVar(url, "core", "knowledgebase"); lngCode = $("#lngCode").val(); if(lngCode == null || lngCode == ''){ lngCode = 'fr_FR'; } url = $.setUrlVar(url, "lngCode", lngCode); window.location.href=url; //hideWaiting(); } function load_data(obj, action, nbpages, level){ page = $(obj).parent().find("span").first().html(); if(action == 'first'){ page = 1; $(obj).parent().find('.page_first').hide(); $(obj).parent().find('.page_prev').hide(); $(obj).parent().find('.page_next').show(); }else if(action == 'next'){ $(obj).parent().find('.page_first').show(); $(obj).parent().find('.page_prev').show(); page++; if((page) == nbpages){ $(obj).hide(); } }else if(action == 'prev'){ $(obj).parent().find('.page_next').show(); page--; if((page) == 1){ $(obj).parent().find('.page_first').hide(); $(obj).parent().find('.page_prev').hide(); } } if(level == 0){ rel = ""; }else if(level == 1){ rel = $(obj).parent().parent().prev().attr("rel"); }else{ rel = $(obj).parent().prev().children().attr("rel"); if(typeof rel =='undefined'){ rel = $(obj).parent().parent().prev().attr("rel"); } } $(obj).parent().find("span").first().html(page); $.ajax({ url: "<fl:webapp/>/kb_file_tree_part.fl?page="+(page-1)+"&rel="+rel+"&lngCode=<%=lngCode%>", success:function(data){ $(obj).parent().next().html(data); } }); } </script> <fl:bigTabs listTitle="<%= Utils.getMessage(session, \"L6104\", false, true, \"K. Base\") %>" objectTitle="K. Base" ou=""> <div style="text-align: left"> <fieldset> <legend align=top> <fl:getMessage code="L70E1" alt="Demande"/> </legend> <%=(!Utils.isEmpty(solID))? solTitle : "<span class=\"dataLabel\">"+Utils.getMessage(session, "L8101", "Aucune demande sélectionnée")+"</span>" %> </fieldset> <form id="search" name="search" action="<fl:webapp/>/knowledge_base.fl"> <input type="hidden" name="SolID" id="SolID" value="<%=(!Utils.isEmpty(solID))? solID : "" %>"/> <input type="hidden" name="CrtID" id="CrtID" value="<%=(!Utils.isEmpty(crtID))? crtID : "" %>"/> <% if (sfwID != null) { %> <input type="hidden" name="SfwID" value="<%= sfwID %>"> <% } %> <table class="container" cellpadding="0" cellspacing="0" align="center" border="0"> <tr> <td align="center"> <br/> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <table cellpadding="0" cellspacing="0" class="searchbar"> <tr> <td> <dl class="dropdown"> <dt><a href="#"><span><span id="lang_en_cours"><img valign="top" border="0" src="<fl:webapp/>/icons/flags/gif/<%= lngCode != null ? lngCode.substring(3).toLowerCase() : "fr"%>.gif"></img></span><span class="arrow_picto"><img border="0" valign="bottom" src="<fl:webapp/>/icons/fleche-titre-down2.gif"></img></span></span></a></dt> <dd> <ul> <%if(lngCodes != null){ for(Vector<String> lngCodeVector : lngCodes){ String currentLngDisplay = (String)dico.getRefDisp("FAQLngID", (String)lngCodeVector.get(0)); String currentLngCode = lngCodeVector.get(1); String currentLngFlag = currentLngCode.substring(3).toLowerCase(); %> <li><a href="#" onclick="$('#lang_en_cours').html('<img valign=\'top\' border=\'0\' src=\'<fl:webapp/>/icons/flags/gif/<%=currentLngFlag %>.gif\'></img>');$('#lngCode').val('<%=currentLngCode %>')"><img border="0" src="<fl:webapp/>/icons/flags/gif/<%=currentLngFlag %>.gif" alt="<%=currentLngCode.substring(3).toLowerCase() %>"/> <%=currentLngDisplay %><span class="value"><%=currentLngCode.substring(3).toLowerCase() %></span></a></li> <% } }%> </ul> </dd> </dl> </td> <td> <input id="core" name="core" type="hidden" value="knowledgebase"/> <input id="lngCode" name="lngCode" type="hidden" value="<%= lngCode != null ? lngCode : "fr_FR"%>"/> <input id="query" class="queryInput" name="query" type="text" size="50" maxlength="128" value="<%= query != null ? Utils.formatToWeb(query, true) : "" %>" /> </td> <td> <input style="border-left:none;border-top:rgb(127,157,185) 1px solid;border-right:rgb(127,157,185) 1px solid;border-bottom:rgb(127,157,185) 1px solid;" id="searcher" type="image" src="<fl:webapp/>/icons/frontoffice/search.png" onclick="javascript: document.search.submit();" /> </td> </tr> </table> </td> </tr> <tr class="ftSearchSmall"> <td colspan="3" align="center"> <input name="deepen" type="checkbox" <%=deepen ? "checked=\"checked\"" : ""%>/> <fl:getMessage code="L6625" alt="Recherche approfondie"/> | <a href="#" onclick="javascript:loadExplorator()">Explorer</a> </td> </tr> </table> </td> </tr> <tr class="ligne_separation"><td> </td></tr> </table> </form> <div id="explorer" style="<%=(!Utils.isEmpty(query))? "display:none" : "" %>"> <!-- Explorateur --> <fieldset id="explorer"> <legend align=top><fl:getMessage code="L70E2" alt="Explorateur"/></legend> <div id="splitter"> <div id="filetree"></div> <div id="fileinfo"></div> </div> </fieldset> </div> <!-- Fin explorateur --> <div id="queryResult" style="<%=(Utils.isEmpty(query))? "display:none" : "" %>"> <table class="container" cellpadding="0" border="0" width="100%" style="height:100%;text-align: left"> <% // Query formating error if (flRequest.getAttribute("query_failed") != null) { %> <!-- <tr class="fieldline"> <td class="ftSearchTitle"><fl:getMessage code="XXXXX" alt="Aucun résultat."/></td> </tr> --> <% //Display results } if (rsp != null) { SolrDocumentList results = rsp.getResults(); List<FacetField> facets = rsp.getLimitingFacets(); Map<String, Map<String, List<String>>> highlight = rsp.getHighlighting(); SpellCheckResponse spell = rsp.getSpellCheckResponse(); boolean fFilteredResult=Boolean.TRUE.equals(rsp.getHeader().get("filtered_result")); %> <tr> <td class="titrePartie" style="text-align: left;"> <fl:getMessage code="L200C" alt="Résultat"/> (<%=results.getNumFound()%>) </td> </tr> <% if (fFilteredResult) {%> <tr> <td class="ligne_separation_couleur" style="text-align: left; color:white; "> <b> <fl:getMessage code="L70AF" alt="Des éléments ont été supprimés du résultat pour cause de droits d'accés"/><br/> <fl:getMessage code="L70B0" alt="Les comptages peuvent être erronés"/> </b> </td> </tr> <% } %> <tr class="ligne_separation_couleur"><td colspan="3"></td></tr> <% //SpellChecker if (spell != null && spell.getCollatedResult() != null) { %> <tr class="ftSearchTitle"> <td colspan="3"> <fl:getMessage code="L6627" alt="Essayez plutôt"/> : <% String urlSearch= "/knowledge_base.fl" + ((!Utils.isEmpty(solID))? "?SolID=" + solID + "&" : "?") + "core=knowledgebase&lngCode="+lngCode+"&query="+WebUtils.urlEncode(context, spell.getCollatedResult()) + (deepen ?"&deepen=on":""); %> <a href="<fl:link url="<%= urlSearch %>" />"> <%= spell.getCollatedResult() %> </a> </td> </tr> <tr><td><br/></td></tr> <% } %> <tr> <td class="ftSearchTitle" colspan="3"> <% //Display results table boolean color = true; for (int i = 0; i < results.size(); ) { String last_obj = results.get(i).getFieldValue("meta_cat").toString(); //Display category %> <% while (i < results.size() && (last_obj.equals(results.get(i).getFieldValue("meta_cat")))) { String id = (String)results.get(i).getFieldValue("id"); //Display category content %> <table class="container" cellpadding="0" width="100%"> <tr> <td> <% //Print title w/ link if (results.get(i).getFieldValue("meta_reader") != null) out.print("<a href=\"#\" onclick=\"javascript:showFaq('" + id + "')\">" + results.get(i).getFieldValue("meta_title") + "</a> " + faqsWithAttachment.get(id) + faqsStatus.get(id) + " <a href=\"#\" onclick=addFaq('" + id + "')><img border=\"0\" style=\"vertical-align: middle\" src=\""+flRequest.computeURL("/icons/frontoffice/cart-add-icon.png")+"\"/></a>"); else // Title w/o link out.print(results.get(i).getFieldValue("meta_title")); //Note : meta_title is allocated with EDEAL object's title in IndexSearch.java //basing on object's ID. For non EDEAL objects null is replaced by "[x]" %> <br/> <% //Print text field(s) String str = ""; if(results.get(i).getFieldValue("all") != null ){ str = results.get(i).getFieldValue("all").toString(); } //Add highlighting if ((highlight.get(id) != null) && highlight.get(id).get("all") != null) { for (String hl : highlight.get(id).get("all")) { //str = str.replace(hl, "<b>" + hl + "</b>"); } } int len=str.length(); str=str.substring(0,(len<250)?len:250); int startSubstr=(str.startsWith("["))?1:0; int lenSubstr=(str.endsWith("]"))?1:0; %> <%=str.substring(startSubstr,str.length()-lenSubstr)%>... </td> </tr> <tr valign="top"> <td> <div> <span class="score_<%=id %>" style="color: #777;font-size: 11px;"> <%=faqsScores.get(id) %> <%if(!Utils.isEmpty((String)faqsScores.get(id))){ %> <fl:getMessage code="L70F0" alt="avis"/> <%} %> </span> <span class="dataLabel"><%=faqsWithComment.get(id)%></span> </div> <%if(!Utils.isEmpty((String)faqsTags.get(id))){ %> <div style="color: #777;font-size: 11px;"><fl:getMessage code="F70AC" alt="Mot(s) clé(s)"/>: <%=faqsTags.get(id) %></div> <%} %> </td> </tr> </table> <br/> <% color = !(color); i++; } %> </div> <% } %> </td> </tr> <%} %> <tr class="ligne_separation"><td colspan="3"> </td></tr> </table> </div> </div> </fl:bigTabs>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de