pvollenweider    2005/06/01 16:16:24 CEST

  Modified files:        (Branch: JAHIA-4-1-BRANCH)
    src/view/jsp/include blog_entries.inc blog_listing_filters.inc 
                         blog_searchbox.inc declarations.inc 
  Log:
  Fix search problems / add highlight for a search
  
  Revision  Changes    Path
  1.1.2.26  +5 -0      
corporate_portal_templates/src/view/jsp/include/blog_entries.inc
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/include/blog_entries.inc.diff?r1=1.1.2.25&r2=1.1.2.26&f=h
  1.1.2.5   +2 -1      
corporate_portal_templates/src/view/jsp/include/blog_listing_filters.inc
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/include/blog_listing_filters.inc.diff?r1=1.1.2.4&r2=1.1.2.5&f=h
  1.1.2.4   +5 -1      
corporate_portal_templates/src/view/jsp/include/blog_searchbox.inc
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/include/blog_searchbox.inc.diff?r1=1.1.2.3&r2=1.1.2.4&f=h
  1.6.4.8   +9 -4      
corporate_portal_templates/src/view/jsp/include/declarations.inc
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/include/declarations.inc.diff?r1=1.6.4.7&r2=1.6.4.8&f=h
  
  
  
  Index: blog_entries.inc
  ===================================================================
  RCS file: 
/home/cvs/repository/corporate_portal_templates/src/view/jsp/include/blog_entries.inc,v
  retrieving revision 1.1.2.25
  retrieving revision 1.1.2.26
  diff -u -r1.1.2.25 -r1.1.2.26
  --- blog_entries.inc  31 May 2005 09:53:16 -0000      1.1.2.25
  +++ blog_entries.inc  1 Jun 2005 14:16:23 -0000       1.1.2.26
  @@ -53,6 +53,11 @@
           String body = entry.getFieldValue("body","");
           String author = entry.getFieldValue("author","");
           String excerpt = body;
  +
  +        if (! "".equals(blogSearchString)) {
  +            title = hl(title,blogSearchString,true);
  +            excerpt = hl(excerpt,blogSearchString,true);
  +        }
           /*
           String excerpt = entry.getFieldValue("excerpt","");;
           if ("".equals(excerpt)){
  
  
  
  Index: blog_listing_filters.inc
  ===================================================================
  RCS file: 
/home/cvs/repository/corporate_portal_templates/src/view/jsp/include/blog_listing_filters.inc,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- blog_listing_filters.inc  31 May 2005 10:20:27 -0000      1.1.2.4
  +++ blog_listing_filters.inc  1 Jun 2005 14:16:24 -0000       1.1.2.5
  @@ -51,7 +51,7 @@
               jData.params().getSiteID(), "entries", blogSearchString,
               jData.params().getEntryLoadRequest());
           request.setAttribute("entries_search_handler",containerSearcher);
  -        blogSearchString = "";
  +        //blogSearchString = "";
   
       } else {
           blogSearchString = "";
  @@ -114,4 +114,5 @@
       //    jParams.getEntryLoadRequest(), true);
   entries_sort_handler.setDescOrdering();
   request.setAttribute("entries_sort_handler",entries_sort_handler);
  +
   %>
  \ No newline at end of file
  
  
  
  Index: blog_searchbox.inc
  ===================================================================
  RCS file: 
/home/cvs/repository/corporate_portal_templates/src/view/jsp/include/blog_searchbox.inc,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- blog_searchbox.inc        31 May 2005 10:26:01 -0000      1.1.2.3
  +++ blog_searchbox.inc        1 Jun 2005 14:16:24 -0000       1.1.2.4
  @@ -15,7 +15,11 @@
   <tr>
       <td class="boxcontentborder1">
           <form action="<%=bypassUrl%>" method="get" name="searchblog">
  -            <input type="hidden" name="category" 
value="<%=requestedCategory%>"/>
  +            <%
  +            if (requestedCategory != null) {
  +                %><input type="hidden" name="category" 
value="<%=requestedCategory%>"/><%
  +            }
  +            %>
               <input name="blogSearchString" type="text" 
value="<%=blogSearchString%>"/>
               <a 
href="javascript:checkMaxPageItems();document.searchblog.submit()"><img
                   src="<jahia:contextURL/>/images/search.gif" 
alt="<jahia:resourceBundle
  
  
  
  Index: declarations.inc
  ===================================================================
  RCS file: 
/home/cvs/repository/corporate_portal_templates/src/view/jsp/include/declarations.inc,v
  retrieving revision 1.6.4.7
  retrieving revision 1.6.4.8
  diff -u -r1.6.4.7 -r1.6.4.8
  --- declarations.inc  24 May 2005 12:27:19 -0000      1.6.4.7
  +++ declarations.inc  1 Jun 2005 14:16:24 -0000       1.6.4.8
  @@ -388,7 +388,7 @@
       str = result.append(str.substring(startIndex,str.length())).toString();
       return str;
   }
  -public String hl(String str, String strToHighlight) {
  +public String hl(String str, String strToHighlight, boolean truncate) {
       if (str==null ){
           return str;
       }
  @@ -411,8 +411,10 @@
           // truncate to 255 chars
           int startOfIndex = Math.max(i,CHARS_BEFORE) - CHARS_BEFORE;
           int maxLength = Math.min(TRUNK_SIZE,str.length()-startOfIndex);
  -        str = str.substring(startOfIndex, maxLength + startOfIndex);
  -        lcStr = str.toLowerCase();
  +        if (truncate) {
  +            str = str.substring(startOfIndex, maxLength + startOfIndex);
  +            lcStr = str.toLowerCase();
  +        }
   
           for (int  k = 0; k < searchStrings.length; k++){
               result = new StringBuffer(str.length() + 100);
  @@ -433,12 +435,15 @@
               result.append(str.substring(startOfIndex,str.length()));
               str = result.toString();
           }
  -        if (maxLength == TRUNK_SIZE) {
  +        if (maxLength == TRUNK_SIZE && truncate) {
               result.append("[...]");
           }
       }
       return result.toString();
   }
  +public String hl(String str, String strToHighlight) {
  +    return hl(str, strToHighlight,false);
  +}
   %>
   <logic:present parameter="addComment">
   <script language="javascript"type="text/javascript"><!--//--><![CDATA[//><!--
  

Reply via email to