Author: dpillot
Date: Thu Jun 7 15:03:39 2007
New Revision: 17504
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17504&repname=
=3Djahia
Log:
JAHIA-2001
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=
=3D17504&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 Thu Jun 7 15:03:39 2007
@@ -65,27 +65,28 @@
*/
private String extractDescriptionTeaser(String description, int max, b=
oolean cleantag) {
String pattern =3D "<.*?>";
- String result =3D description.replaceAll(pattern," ");//removing t=
ags
- pattern=3D"\\s+";
- result =3D result.replaceAll(pattern," ").trim(); //removing extra=
space
+ String result =3D description.replaceAll(pattern, " ");//removing =
tags
+ pattern =3D "\\s+";
+ result =3D result.replaceAll(pattern, " ").trim(); //removing extr=
aspace
StringTokenizer tok =3D new StringTokenizer(result, " ");
- int wordcount=3Dtok.countTokens();
- if(wordcount>max){
+ int wordcount =3D tok.countTokens();
+ if (wordcount > max) {
//create the minidescription
- String minidescription =3D"";
+ String minidescription =3D "";
int c =3D 0;
- while (tok.hasMoreTokens() && c < max+1) {
- String el =3D tok.nextToken();
- minidescription =3D minidescription + el + " ";
- c++;
- }
+ while (tok.hasMoreTokens() && c < max + 1) {
+ String el =3D tok.nextToken();
+ minidescription =3D minidescription + el + " ";
+ c++;
+ }
return minidescription;
} else {
//return the description cleaned
- if(cleantag) return result;
+ if (cleantag) return result;
}
return "";//this return means
}
+
/**
* to format a hit date in a friendly way
* @param hit the hit object
@@ -128,14 +129,14 @@
long difmin =3D diftime / 60000;
if (difmin < 60) {
String pref =3D getRessource(ResourceBundle.getBun=
dle("JahiaEnginesResources", l), ".today.rangeprefix");
- return pref + " " + difmin + " minutes";
+ return pref + " " + difmin + " minutes";
} else {
String pref =3D getRessource(ResourceBundle.getBun=
dle("JahiaEnginesResources", l), ".today.prefix");
- return pref + " " + sd.format(new Date(d));
+ return pref + " " + sd.format(new Date(d));
}
} else if (c.after(hier) && c.before(now)) {
String pref =3D getRessource(ResourceBundle.getBundle(=
"JahiaEnginesResources", l), ".yesterday.prefix");
- return pref + " " + sd.format(new Date(d));
+ return pref + " " + sd.format(new Date(d));
}
=
s =3D df.format(new Date(d));
@@ -185,17 +186,26 @@
return ukey;
}
=
- private String getPagePath(JahiaPage page, ProcessingContext jParams, =
EntryLoadRequest elr) {
+ private String getPagePath(JahiaPage page, ProcessingContext jParams, =
EntryLoadRequest elr,int pathsize) {
Enumeration pages;
StringBuffer bf =3D new StringBuffer();
-
+ int cpath=3D0;
try {
pages =3D page.getContentPagePath(jParams.getOperationMode(), =
jParams.getUser());
while (pages.hasMoreElements()) {
ContentPage thePage =3D (ContentPage) pages.nextElement();
+ String _label =3D thePage.getTitle(elr);
+ cpath +=3D_label.length();
+ if(cpath<pathsize-3){
bf.append("<a href=3D\"").append(thePage.getUrl(jParams)).=
append("\" target=3D\"_new\">").append(thePage.getTitle(elr)).append("</a>"=
);
bf.append(" / ");
+ cpath ++;
+ } else {
+ bf.append("...");
+ break;
+ }
}
+
} catch (JahiaException e) {
return "";
}
@@ -1222,7 +1232,12 @@
String pdate =3D printFriendlyDate(thisHit, "lastpublishingdate", =
request.getLocale());
//object info
String pageId =3D "" + thisHit.getPageId();
- String pagepath=3DgetPagePath(thisHit.getPage(),jParams,elh.getPre=
viousEntryLoadRequest());
+ 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 theUkey=3D getUrlKey(thisHit.getPageId());
String siteLocalisation=3D"";
if (!theUkey.equals(""))
@@ -1258,7 +1273,7 @@
sb.append(sitekey);
sb.append(" (score: ").append(thisHit.getScore()).append(")");
sb.append("\" target=3D\"_new\"><b>");
- sb.append(thisHit.getTeaser());
+ sb.append(pagetitle);
sb.append("</b></a><br><font size=3D\"1\"><i>(");
sb.append(siteLocalisation);
sb.append(")</i></font></td>");
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list