19. Araxis Merge File Comparison Report

Produced by Araxis Merge on Fri Oct 19 14:26:00 2007 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Internet Explorer. For optimum results when printing this report, enable printing of background images and colours in your browser and use landscape orientation.

19.1 Files compared

#FileLocationLast Modified
1declarations.incC:\jahia\template_diff\V2_JAHIA_5_0_2\src\jsp\commonFri Oct 19 14:17:32 2007 UTC
2declarations.incC:\jahia\template_diff\V2_JAHIA_5_0_3\src\jsp\commonFri Oct 19 14:16:50 2007 UTC

19.2 Comparison summary

DescriptionBetween
Files 1 and 2
BlocksLines
Unchanged5327
Changed414
Inserted00
Removed00

19.3 Comparison options

WhitespaceAll differences in whitespace within lines are ignored
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersHidden in comparison detail

19.4 Active regular expressions

No regular expressions were active.

19.5 Comparison detail

1 <%-- 1 <%--
2 Copyright 2002-2006 Jahia Ltd 2 Copyright 2002-2006 Jahia Ltd
3  3 
4 Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL), 4 Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDDL),
5 Version 1.0 (the "License"), or (at your option) any later version; you may 5 Version 1.0 (the "License"), or (at your option) any later version; you may
6 not use this file except in compliance with the License. You should have 6 not use this file except in compliance with the License. You should have
7 received a copy of the License along with this program; if not, you may obtain 7 received a copy of the License along with this program; if not, you may obtain
8 a copy of the License at 8 a copy of the License at
9  9 
10  http://www.jahia.org/license/ 10  http://www.jahia.org/license/
11  11 
12 Unless required by applicable law or agreed to in writing, software 12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS, 13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and 15 See the License for the specific language governing permissions and
16 limitations under the License. 16 limitations under the License.
17 --%><%@ page import="java.io.IOException, 17 --%><%@ page import="java.io.IOException,
18     java.io.InputStream, 18     java.io.InputStream,
19     java.lang.*, 19     java.lang.*,
20     java.security.Principal, 20     java.security.Principal,
21     java.text.SimpleDateFormat, 21     java.text.*,
22     java.util.*, 22     java.util.*,
23     javax.servlet.*, 23     javax.servlet.*,
24     org.compass.core.CompassHighlighter, 24     org.compass.core.CompassHighlighter,
25     org.jahia.bin.Jahia, 25     org.jahia.bin.Jahia,
26     org.jahia.content.*, 26     org.jahia.content.*,
27     org.jahia.data.*, 27     org.jahia.data.*,
28     org.jahia.data.beans.*, 28     org.jahia.data.beans.*,
29     org.jahia.data.containers.*, 29     org.jahia.data.containers.*,
30     org.jahia.data.fields.*, 30     org.jahia.data.fields.*,
31     org.jahia.data.files.*, 31     org.jahia.data.files.*,
32     org.jahia.data.search.*, 32     org.jahia.data.search.*,
33     org.jahia.data.viewhelper.sitemap.*, 33     org.jahia.data.viewhelper.sitemap.*,
34     org.jahia.engines.mysettings.MySettingsEngine, 34     org.jahia.engines.mysettings.MySettingsEngine,
35     org.jahia.engines.search.*, 35     org.jahia.engines.search.*,
36     org.jahia.services.usermanager.*, 36     org.jahia.services.usermanager.*,
37     org.jahia.exceptions.*, 37     org.jahia.exceptions.*,
38     org.jahia.gui.*, 38     org.jahia.gui.*,
39     org.jahia.params.*, 39     org.jahia.params.*,
40     org.jahia.registries.*, 40     org.jahia.registries.*,
41     org.jahia.resourcebundle.*, 41     org.jahia.resourcebundle.*,
42     org.jahia.security.license.*, 42     org.jahia.security.license.*,
43     org.jahia.services.*, 43     org.jahia.services.*,
44     org.jahia.services.categories.*, 44     org.jahia.services.categories.*,
45     org.jahia.services.containers.*, 45     org.jahia.services.containers.*,
46     org.jahia.services.fields.*, 46     org.jahia.services.fields.*,
47     org.jahia.services.pages.*, 47     org.jahia.services.pages.*,
48     org.jahia.services.search.*, 48     org.jahia.services.search.*,
49     org.jahia.services.search.slide.*, 49     org.jahia.services.search.slide.*,
50     org.jahia.services.search.savedsearch.*, 50     org.jahia.services.search.savedsearch.*,
51     org.jahia.services.sites.*, 51     org.jahia.services.sites.*,
52     org.jahia.services.usermanager.*, 52     org.jahia.services.usermanager.*,
53     org.jahia.services.version.*, 53     org.jahia.services.version.*,
54     org.jahia.services.webdav.*, 54     org.jahia.services.webdav.*,
55     org.jahia.services.workflow.*, 55     org.jahia.services.workflow.*,
56     org.jahia.utils.*, 56     org.jahia.utils.*,
57     org.jahia.utils.fileparsers.CharsetDetection, 57     org.jahia.utils.fileparsers.CharsetDetection,
58     org.jahia.views.engines.JahiaEngineCommonData, 58     org.jahia.views.engines.JahiaEngineCommonData,
59     org.jahia.views.engines.JahiaEngineViewHelper, 59     org.jahia.views.engines.JahiaEngineViewHelper,
60     org.jahia.views.engines.versioning.actions.*, 60     org.jahia.views.engines.versioning.actions.*,
61     org.jahia.views.engines.versioning.ContentVersioningViewHelper, 61     org.jahia.views.engines.versioning.ContentVersioningViewHelper,
62     org.apache.commons.lang.StringUtils, 62     org.apache.commons.lang.StringUtils,
63     org.apache.slide.common.UriPath, 63     org.apache.slide.common.UriPath,
64     org.apache.slide.common.PropertyName, 64     org.apache.slide.common.PropertyName,
65     org.apache.slide.webdav.util.URLUtil, 65     org.apache.slide.webdav.util.URLUtil,
66     org.apache.lucene.queryParser.QueryParser, 66     org.apache.lucene.queryParser.QueryParser,
67     org.jahia.taglibs.esi.JesiConst, 67     org.jahia.taglibs.esi.JesiConst,
68     jahiatemplates.org.jahia.corporateportalv2.search.*, 68     jahiatemplates.org.jahia.corporateportalv2.search.*,
69     org.jahia.ajax.usersession.userSettings" 69     org.jahia.ajax.usersession.userSettings,
  70     org.jahia.services.acl.JahiaBaseACL,
  71     org.jahia.services.acl.JahiaACLEntry,
  72     org.jahia.services.usermanager.JahiaGroupManagerService,
  73     org.jahia.services.usermanager.JahiaUserManagerService,
  74     org.jahia.taglibs.container.ContainerTag
  75     "
70 %><%@ taglib uri="/WEB-INF/etc/struts/struts-bean" prefix="bean" %><%@ 76 %><%@ taglib uri="/WEB-INF/etc/struts/struts-bean" prefix="bean" %><%@
71 taglib uri="/WEB-INF/etc/struts/struts-html" prefix="html" %><%@ 77 taglib uri="/WEB-INF/etc/struts/struts-html" prefix="html" %><%@
72 taglib uri="/WEB-INF/etc/struts/struts-logic" prefix="logic" %><%@ 78 taglib uri="/WEB-INF/etc/struts/struts-logic" prefix="logic" %><%@
73 taglib uri="/WEB-INF/etc/taglibs/jstl/c" prefix="c" %><%@ 79 taglib uri="/WEB-INF/etc/taglibs/jstl/c" prefix="c" %><%@
74 taglib uri="/WEB-INF/etc/taglibs/pager-taglib" prefix="pg" %><%@ 80 taglib uri="/WEB-INF/etc/taglibs/pager-taglib" prefix="pg" %><%@
75 taglib uri="ajaxLib" prefix="ajax" %><%@ 81 taglib uri="ajaxLib" prefix="ajax" %><%@
76 taglib uri="jahiaHtmlLib" prefix="jahiaHtml" %><%@ 82 taglib uri="jahiaHtmlLib" prefix="jahiaHtml" %><%@
77 taglib uri="contentLib" prefix="content" %><%@ 83 taglib uri="contentLib" prefix="content" %><%@
78 taglib uri="http://displaytag.sf.net" prefix="display" %><%@ 84 taglib uri="http://displaytag.sf.net" prefix="display" %><%@
79 taglib uri="/WEB-INF/tld/jesi-tags" prefix="jesi" %><%! 85 taglib uri="/WEB-INF/tld/jesi-tags" prefix="jesi" %><%!
80   final static String[] hex = { 86   final static String[] hex = {
81     "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", 87     "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
82     "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", 88     "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f",
83     "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", 89     "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",
84     "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f", 90     "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",
85     "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", 91     "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27",
86     "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f", 92     "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f",
87     "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", 93     "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37",
88     "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", 94     "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f",
89     "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", 95     "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47",
90     "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f", 96     "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f",
91     "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", 97     "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57",
92     "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f", 98     "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f",
93     "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", 99     "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
94     "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f", 100     "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f",
95     "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", 101     "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77",
96     "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f", 102     "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f",
97     "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", 103     "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",
98     "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f", 104     "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f",
99     "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", 105     "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",
100     "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f", 106     "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f",
101     "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", 107     "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7",
102     "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af", 108     "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af",
103     "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", 109     "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7",
104     "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", 110     "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf",
105     "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7", 111     "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7",
106     "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf", 112     "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf",
107     "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", 113     "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
108     "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df", 114     "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df",
109     "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7", 115     "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7",
110     "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef", 116     "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef",
111     "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", 117     "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
112     "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" 118     "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff"
113   }; 119   };
114  public static String encode(String s) 120  public static String encode(String s)
115   { 121   {
116     StringBuffer sbuf = new StringBuffer(); 122     StringBuffer sbuf = new StringBuffer();
117     int len = s.length(); 123     int len = s.length();
118     for (int i = 0; i < len; i++) { 124     for (int i = 0; i < len; i++) {
119       int ch = s.charAt(i); 125       int ch = s.charAt(i);
120       if ('A' <= ch && ch <= 'Z') {             // 'A'..'Z' 126       if ('A' <= ch && ch <= 'Z') {             // 'A'..'Z'
121         sbuf.append((char)ch); 127         sbuf.append((char)ch);
122       } else if ('a' <= ch && ch <= 'z') {      // 'a'..'z' 128       } else if ('a' <= ch && ch <= 'z') {      // 'a'..'z'
123                sbuf.append((char)ch); 129                sbuf.append((char)ch);
124       } else if ('0' <= ch && ch <= '9') {      // '0'..'9' 130       } else if ('0' <= ch && ch <= '9') {      // '0'..'9'
125                sbuf.append((char)ch); 131                sbuf.append((char)ch);
126       } else if (ch == ' ') {                   // space 132       } else if (ch == ' ') {                   // space
127                sbuf.append('+'); 133                sbuf.append('+');
128       } else if (ch == '-' || ch == '_'         // unreserved 134       } else if (ch == '-' || ch == '_'         // unreserved
129           || ch == '.' || ch == '!' 135           || ch == '.' || ch == '!'
130           || ch == '~' || ch == '*' 136           || ch == '~' || ch == '*'
131           || ch == '\'' || ch == '(' 137           || ch == '\'' || ch == '('
132           || ch == ')') { 138           || ch == ')') {
133         sbuf.append((char)ch); 139         sbuf.append((char)ch);
134       } else if (ch <= 0x007f) {                // other ASCII 140       } else if (ch <= 0x007f) {                // other ASCII
135                sbuf.append(hex[ch]); 141                sbuf.append(hex[ch]);
136       } else if (ch <= 0x07FF) {                // non-ASCII <= 0x7FF 142       } else if (ch <= 0x07FF) {                // non-ASCII <= 0x7FF
137                sbuf.append(hex[0xc0 | (ch >> 6)]); 143                sbuf.append(hex[0xc0 | (ch >> 6)]);
138                sbuf.append(hex[0x80 | (ch & 0x3F)]); 144                sbuf.append(hex[0x80 | (ch & 0x3F)]);
139       } else {                                  // 0x7FF < ch <= 0xFFFF 145       } else {                                  // 0x7FF < ch <= 0xFFFF
140                sbuf.append(hex[0xe0 | (ch >> 12)]); 146                sbuf.append(hex[0xe0 | (ch >> 12)]);
141                sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]); 147                sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]);
142                sbuf.append(hex[0x80 | (ch & 0x3F)]); 148                sbuf.append(hex[0x80 | (ch & 0x3F)]);
143       } 149       }
144     } 150     }
145     return sbuf.toString(); 151     return sbuf.toString();
146   } 152   }
147  153 
148 public String getResourceBundle (String resourceName, String defaultValue, JahiaData jData){ 154 public String getResourceBundle (String resourceName, String defaultValue, JahiaData jData){
149     String resourceBundle = "jahiatemplates.Corporate_portal_templates_v2"; 155     String resourceBundle = "jahiatemplates.Corporate_portal_templates_v2";
150      ResourceBundle res = null; 156      ResourceBundle res = null;
151      String resValue = null; 157      String resValue = null;
152      try { 158      try {
153           res = ResourceBundle.getBundle(resourceBundle,jData.params().getLocale()); 159           res = ResourceBundle.getBundle(resourceBundle,jData.params().getLocale());
154           resValue = res.getString(resourceName); 160           resValue = res.getString(resourceName);
155      } catch ( MissingResourceException mre ) { 161      } catch ( MissingResourceException mre ) {
156      } 162      }
157      if ( resValue == null ){ 163      if ( resValue == null ){
158           resValue = defaultValue; 164           resValue = defaultValue;
159      } 165      }
160      return resValue; 166      return resValue;
161 } // getResourceBundle 167 } // getResourceBundle
162  168 
163 public String getMultivalues(String resBundleID, String values[]){ 169 public String getMultivalues(String resBundleID, String values[]){
164     StringBuffer sb = new StringBuffer("<jahia_multivalue_single["); 170     StringBuffer sb = new StringBuffer("<jahia_multivalue_single[");
165     ArrayList al = new ArrayList(); 171     ArrayList al = new ArrayList();
166     for (int  i = 0; i < values.length; i++){ 172     for (int  i = 0; i < values.length; i++){
167         al.add( values[i] ); 173         al.add( values[i] );
168     } 174     }
169     Collections.sort(al); 175     Collections.sort(al);
170     for (int i = 0; i < al.size(); i++) { 176     for (int i = 0; i < al.size(); i++) {
171         if (i > 0){ 177         if (i > 0){
172             sb.append(":"); 178             sb.append(":");
173         } 179         }
174          sb.append(ResourceBundleMarker.drawMarker(resBundleID,(String)al.get(i),"")); 180          sb.append(ResourceBundleMarker.drawMarker(resBundleID,(String)al.get(i),""));
175     } 181     }
176     sb.append("]>"); 182     sb.append("]>");
177     if (al.size() >= 0){ 183     if (al.size() >= 0){
178          sb.append(ResourceBundleMarker.drawMarker(resBundleID,(String)al.get(0),"")); 184          sb.append(ResourceBundleMarker.drawMarker(resBundleID,(String)al.get(0),""));
179     } 185     }
180     return sb.toString(); 186     return sb.toString();
181 } // getMultivalues 187 } // getMultivalues
182  188 
183 /** 189 /**
184  * Remove all html tags 190  * Remove all html tags
185  * @param str Input string (html code). 191  * @param str Input string (html code).
186  * @return Output string 192  * @return Output string
187  */ 193  */
188 public String removeTags (String str) 194 public String removeTags (String str)
189 throws JahiaException { 195 throws JahiaException {
190     if (str == null) { 196     if (str == null) {
191         return ""; 197         return "";
192     } 198     }
193     StringBuffer result = new StringBuffer(str.length()); 199     StringBuffer result = new StringBuffer(str.length());
194     int startIndex = 0; 200     int startIndex = 0;
195     int i = str.indexOf("<"); 201     int i = str.indexOf("<");
196     while (i != -1){ 202     while (i != -1){
197         result.append(str.substring(startIndex,i)); 203         result.append(str.substring(startIndex,i));
198         i = str.indexOf(">",i); 204         i = str.indexOf(">",i);
199         if (i != -1){ 205         if (i != -1){
200             startIndex = i + 1; 206             startIndex = i + 1;
201         } 207         }
202         i = str.indexOf("<" , startIndex); 208         i = str.indexOf("<" , startIndex);
203     } 209     }
204     str = result.append(str.substring(startIndex,str.length())).toString(); 210     str = result.append(str.substring(startIndex,str.length())).toString();
205     return str; 211     return str;
206 } 212 }
207 public String hl(String str, String strToHighlight, boolean truncate) { 213 public String hl(String str, String strToHighlight, boolean truncate) {
208     org.apache.log4j.Logger logger = 214     org.apache.log4j.Logger logger =
209         org.apache.log4j.Logger.getLogger(getClass()); 215         org.apache.log4j.Logger.getLogger(getClass());
210  216 
211     if (str==null ){ 217     if (str==null ){
212         return str; 218         return str;
213     } 219     }
214     logger.debug("strToHighlight is " + strToHighlight); 220     logger.debug("strToHighlight is " + strToHighlight);
215     int TRUNK_SIZE = 255; 221     int TRUNK_SIZE = 255;
216     int CHARS_BEFORE = 50; 222     int CHARS_BEFORE = 50;
217     String STRING_BEFORE_SEARCH = "<span class='hl'>"; 223     String STRING_BEFORE_SEARCH = "<span class='hl'>";
218     String STRING_AFTER_SEARCH = "</span>"; 224     String STRING_AFTER_SEARCH = "</span>";
219  225 
220     StringBuffer result = new StringBuffer(str.length() + 100); 226     StringBuffer result = new StringBuffer(str.length() + 100);
221  227 
222     String[] searchStrings = JahiaTools.getTokens(strToHighlight," "); 228     String[] searchStrings = JahiaTools.getTokens(strToHighlight," ");
223     if (searchStrings.length > 0) { 229     if (searchStrings.length > 0) {
224         String searchString = JahiaTools.replacePattern(searchStrings[0],"*",""); 230         String searchString = JahiaTools.replacePattern(searchStrings[0],"*","");
225  231 
226         String lcStr = str.toLowerCase(); 232         String lcStr = str.toLowerCase();
227         String lcsearchString = searchString.toLowerCase(); 233         String lcsearchString = searchString.toLowerCase();
228  234 
229         int i = lcStr.indexOf(lcsearchString); 235         int i = lcStr.indexOf(lcsearchString);
230  236 
231         // truncate to 255 chars 237         // truncate to 255 chars
232         int startOfIndex = Math.max(i,CHARS_BEFORE) - CHARS_BEFORE; 238         int startOfIndex = Math.max(i,CHARS_BEFORE) - CHARS_BEFORE;
233         int maxLength = Math.min(TRUNK_SIZE,str.length()-startOfIndex); 239         int maxLength = Math.min(TRUNK_SIZE,str.length()-startOfIndex);
234         if (truncate) { 240         if (truncate) {
235             str = str.substring(startOfIndex, maxLength + startOfIndex); 241             str = str.substring(startOfIndex, maxLength + startOfIndex);
236             lcStr = str.toLowerCase(); 242             lcStr = str.toLowerCase();
237         } 243         }
238  244 
239         for (int  k = 0; k < searchStrings.length; k++){ 245         for (int  k = 0; k < searchStrings.length; k++){
240             result = new StringBuffer(str.length() + 100); 246             result = new StringBuffer(str.length() + 100);
241             searchString  = JahiaTools.replacePattern(searchStrings[k],"*",""); 247             searchString  = JahiaTools.replacePattern(searchStrings[k],"*","");
242             lcStr = str.toLowerCase(); 248             lcStr = str.toLowerCase();
243             lcsearchString = searchString.toLowerCase(); 249             lcsearchString = searchString.toLowerCase();
244             startOfIndex = 0; 250             startOfIndex = 0;
245             i = lcStr.indexOf(lcsearchString,startOfIndex); 251             i = lcStr.indexOf(lcsearchString,startOfIndex);
246             int searchStringLength = searchString.length(); 252             int searchStringLength = searchString.length();
247             while (i != -1) { 253             while (i != -1) {
248                 result.append(str.substring(startOfIndex, i)); 254                 result.append(str.substring(startOfIndex, i));
249                 result.append(STRING_BEFORE_SEARCH); 255                 result.append(STRING_BEFORE_SEARCH);
250                 result.append(str.substring(i, i + searchStringLength) ); 256                 result.append(str.substring(i, i + searchStringLength) );
251                 result.append(STRING_AFTER_SEARCH); 257                 result.append(STRING_AFTER_SEARCH);
252                 startOfIndex = i + searchStringLength; 258                 startOfIndex = i + searchStringLength;
253                 i = lcStr.indexOf(lcsearchString,startOfIndex); 259                 i = lcStr.indexOf(lcsearchString,startOfIndex);
254             } 260             }
255             result.append(str.substring(startOfIndex,str.length())); 261             result.append(str.substring(startOfIndex,str.length()));
256             str = result.toString(); 262             str = result.toString();
257         } 263         }
258         if (maxLength == TRUNK_SIZE && truncate) { 264         if (maxLength == TRUNK_SIZE && truncate) {
259             result.append("[...]"); 265             result.append("[...]");
260         } 266         }
261     } 267     }
262     return result.toString(); 268     return result.toString();
263 } 269 }
264 public String hl(String str, String strToHighlight) { 270 public String hl(String str, String strToHighlight) {
265     return hl(str, strToHighlight,true); 271     return hl(str, strToHighlight,true);
266 } 272 }
267 String extention[] = {"doc", "xls", "ppt", "zip", "pdf", "txt", "html", 273 String extention[] = {"doc", "xls", "ppt", "zip", "pdf", "txt", "html",
268                       "htm", "waw", "mp3", "jpg", "jpeg", "gif", "tif", 274                       "htm", "waw", "mp3", "jpg", "jpeg", "gif", "tif",
269                       "avi", "mpeg", "mpa", "mpg", "mpe", "mov", "exe", 275                       "avi", "mpeg", "mpa", "mpg", "mpe", "mov", "exe",
270                       "text", "rar", "tgz","dir" }; 276                       "text", "rar", "tgz","dir", "png"};
271 String picto[]     = {"doc", "xls", "ppt", "zip", "pdf", "txt", "html", 277 String picto[]     = {"doc", "xls", "ppt", "zip", "pdf", "txt", "html",
272                       "html", "sound", "sound", "img", "img", "img", 278                       "html", "sound", "sound", "img", "img", "img",
273                       "img", "video", "video", "video", "video", 279                       "img", "video", "video", "video", "video",
274                       "video", "video", "exe", "txt", "zip", "tgz","dir" }; 280                       "video", "video", "exe", "txt", "zip", "tgz","dir", "img"};
275  281 
276 public String getPicto (String fileName) 282 public String getPicto (String fileName)
277 throws JahiaException 283 throws JahiaException
278 { 284 {
279     String p = "file"; 285     String p = "file";
280     String f = fileName.toLowerCase(); 286     String f = fileName.toLowerCase();
281     for (int  k = 0; k < extention.length; k++){ 287     for (int  k = 0; k < extention.length; k++){
282         if (f.endsWith(extention[k])){ 288         if (f.endsWith(extention[k])){
283             p = picto[k]; 289             p = picto[k];
284             break; 290             break;
285         } 291         }
286     } 292     }
287     return p; 293     return p;
288 } // getPicto 294 } // getPicto
289 static String emotionSymbol[]  = {"&gt;:D&lt;",":-&quot;","&lt;):)","[-o&lt;",":)&gt;-", 295 static String emotionSymbol[]  = {"&gt;:D&lt;",":-&quot;","&lt;):)","[-o&lt;",":)&gt;-",
290                                "~:&gt;","&gt;-)","\\:D/",":\">","3:-O", 296                                "~:&gt;","&gt;-)","\\:D/",":\">","3:-O",
291                                ":(|)","@};-","**==","(~~)","*-:)", 297                                ":(|)","@};-","**==","(~~)","*-:)",
292                                "<):)","[-o<",":-\"",":)>-",">:D<", 298                                "<):)","[-o<",":-\"",":)>-",">:D<",
293                                ":))",":-)",":((",":-(",";;)", 299                                ":))",":-)",":((",":-(",";;)",
294                                ":-/","X-(","B-)",":-s",">:)", 300                                ":-/","X-(","B-)",":-s",">:)",
295                                "/:)","O:)",":-B","I-)","8-|", 301                                "/:)","O:)",":-B","I-)","8-|",
296                                ":-&",":-$","[-(",":o)","8-}", 302                                ":-&",":-$","[-(",":o)","8-}",
297                                "(:|",":-?","#-o","=D>",":@)", 303                                "(:|",":-?","#-o","=D>",":@)",
298                                "~:>","%%-","%%-","~o)","8-X", 304                                "~:>","%%-","%%-","~o)","8-X",
299                                "=:)",">-)",":-L","@-)","$-)", 305                                "=:)",">-)",":-L","@-)","$-)",
300                                ":^o","b-(","[-X",":)",":(", 306                                ":^o","b-(","[-X",":)",":(",
301                                ";)",":D",":x",":p",":*", 307                                ";)",":D",":x",":p",":*",
302                                ":O",":>",":|","=;"}; 308                                ":O",":>",":|","=;"};
303  309 
304 static String emotionLabel[] = {"hugs","whistling","cowboy","praying","peace", 310 static String emotionLabel[] = {"hugs","whistling","cowboy","praying","peace",
305                                "chicken","alien_2","dancing","blushing","cow", 311                                "chicken","alien_2","dancing","blushing","cow",
306                                "monkey","rose","flag","pumpkin","idea", 312                                "monkey","rose","flag","pumpkin","idea",
307                                "cowboy","praying","whistling","peace","hugs", 313                                "cowboy","praying","whistling","peace","hugs",
308                                "laughing","smile","crying","sad","batting_eyelashes", 314                                "laughing","smile","crying","sad","batting_eyelashes",
309                                "confused","angry","cool","worried","devilish", 315                                "confused","angry","cool","worried","devilish",
310                                "raised_eyebrow","angel","nerd","sleep","rolling_eyes", 316                                "raised_eyebrow","angel","nerd","sleep","rolling_eyes",
311                                "sick","shhh","not_talking","clown","silly", 317                                "sick","shhh","not_talking","clown","silly",
312                                "tired","thinking","d_oh","applause","pig", 318                                "tired","thinking","d_oh","applause","pig",
313                                "chicken","sad","good_luck","coffee","skull", 319                                "chicken","sad","good_luck","coffee","skull",
314                                "alien_1","alien_2","frustrated","hypnotized","money_eyes", 320                                "alien_1","alien_2","frustrated","hypnotized","money_eyes",
315                                "liar","beat_up","shame_on_you","smile","sad", 321                                "liar","beat_up","shame_on_you","smile","sad",
316                                "wink","biggrin","love_struck","tongue","kiss", 322                                "wink","biggrin","love_struck","tongue","kiss",
317                                "shock","smug","straight_face","talk_to_the_hand"}; 323                                "shock","smug","straight_face","talk_to_the_hand"};
318  324 
319 public static String toEmotion(String inputString,String folder) { 325 public static String toEmotion(String inputString,String folder) {
320     for (int i = 0; i < emotionSymbol.length; i++) { 326     for (int i = 0; i < emotionSymbol.length; i++) {
321         int smileyIndex = inputString.indexOf(emotionSymbol[i]); 327         int smileyIndex = inputString.indexOf(emotionSymbol[i]);
322         while (smileyIndex != -1) { 328         while (smileyIndex != -1) {
323             String url = "<img src=\"" + folder + emotionLabel[i] + ".gif\" alt=\"" + emotionLabel[i] + "/\">"; 329             String url = "<img src=\"" + folder + emotionLabel[i] + ".gif\" alt=\"" + emotionLabel[i] + "/\">";
324             inputString = inputString.substring(0, smileyIndex) + url + 330             inputString = inputString.substring(0, smileyIndex) + url +
325                           inputString.substring(smileyIndex + emotionSymbol[i].length()); 331                           inputString.substring(smileyIndex + emotionSymbol[i].length());
326             smileyIndex = inputString.indexOf(emotionSymbol[i]); 332             smileyIndex = inputString.indexOf(emotionSymbol[i]);
327         } 333         }
328     } 334     }
329     return inputString; 335     return inputString;
330 } // toEmotion 336 } // toEmotion
331 %> 337 %>