Author: dpillot
Date: Wed Aug 29 14:03:40 2007
New Revision: 18296

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18296&repname=
=3Djahia
Log:
http://www.jahia.net/jira/browse/JAHIA-2181
page title with words over 12 are truncated

Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/engines/importex=
port/contentpick.jsp

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/engines/im=
portexport/contentpick.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/jsp/jahia/engines/importexport/contentpick.jsp&rev=
=3D18296&repname=3Djahia
=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=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/engines/importex=
port/contentpick.jsp (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/engines/importex=
port/contentpick.jsp Wed Aug 29 14:03:40 2007
@@ -1282,10 +1282,30 @@
         String pageId =3D "" + thisHit.getPageId();
         String pagepath=3DgetPagePath(thisHit.getPage(),jParams,elh.getPre=
viousEntryLoadRequest(),40);
         String pagetitle=3D thisHit.getTeaser();
+
+
         // check colum limits and truncate
-        if((pagetitle.length()>6 && pagetitle.indexOf(" ")=3D=3D-1)||(page=
title.indexOf(" ")!=3D-1 && pagetitle.substring(0,pagetitle.indexOf(" ")).l=
ength()>7)){
-            pagetitle=3Dpagetitle.substring(0,5)+"(...)";
+        String[] words=3Dpagetitle.split(" ");
+        int offset=3D0;
+        int maxWord=3D12;//max word length,please change this as you want
+        boolean toCut=3Dfalse;
+        for(int j=3D0;j<words.length;j++){
+
+        if(words[j].length()>maxWord) {
+            toCut=3Dtrue;
+            break;
+        }
+        offset=3Doffset+words[j].length()+1;
         }
+        if(toCut){
+               //out.print("offset:"+offset);
+               if(offset=3D=3D0){
+                       pagetitle=3Dpagetitle.substring(offset,maxWord-4)+"...";
+               }else{
+                       pagetitle=3Dpagetitle.substring(0,offset-1)+"...";
+               }
+        }
+
         String theUkey=3D getUrlKey(thisHit.getPageId());
         String siteLocalisation=3D"";
         if (!theUkey.equals(""))

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to