mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
12310: Merged V2.2 to V3.0 12306: Merged V2.1 to V2.2 12212: Final set of XSS and HTML encoding fixes for ETWOONE-90 12312: Merged V2.2 to V3.0 12311: Merged V2.1 to V2.2 11667: Fix for ETWOONE-389 - Current page number not always visible on the browse screen. 12316: Fix for merge issue 12317: Merged 2.1 to 3.0 12313: Fix for regression introduced when fixing ETWOONE-91. Also fixes ETHREEOH-1043 12319: Final set of XSS fixes specific to 3.0 codeline see ETWOONE-90 12321: Missing file from previous checkin 12324: Merged 2.2 to 3.0 12320: Merged 2.1 to 2.2 11682: Fix for ETWOONE-87: Behavior of delete cascade 12326: Merge 2.1 to 3.0 11615: Fix for ETWOONE-188: After session has timed out, expanding a space in the Navigator results in unfriendly error git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12531 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -86,6 +86,8 @@ import org.springframework.web.jsf.FacesContextUtils;
|
||||
*/
|
||||
public final class Utils extends StringUtils
|
||||
{
|
||||
public static final String USER_AGENT_FIREFOX = "Firefox";
|
||||
public static final String USER_AGENT_MSIE = "MSIE";
|
||||
private static final String MSG_TIME_PATTERN = "time_pattern";
|
||||
private static final String MSG_DATE_PATTERN = "date_pattern";
|
||||
private static final String MSG_DATE_TIME_PATTERN = "date_time_pattern";
|
||||
@@ -507,6 +509,26 @@ public final class Utils extends StringUtils
|
||||
{
|
||||
return buildImageTag(context, image, width, height, alt, onclick, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a context path safe image tag for the supplied image path.
|
||||
* Image path should be supplied with a leading slash '/'.
|
||||
*
|
||||
* @param context FacesContext
|
||||
* @param image The local image path from the web folder with leading slash '/'
|
||||
* @param width Width in pixels
|
||||
* @param height Height in pixels
|
||||
* @param alt Optional alt/title text
|
||||
* @param onclick JavaScript onclick event handler code
|
||||
* @param verticalAlign Optional HTML alignment value
|
||||
*
|
||||
* @return Populated <code>img</code> tag
|
||||
*/
|
||||
public static String buildImageTag(FacesContext context, String image, int width, int height,
|
||||
String alt, String onclick, String verticalAlign)
|
||||
{
|
||||
return buildImageTag(context, image, width, height, alt, onclick, verticalAlign, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a context path safe image tag for the supplied image path.
|
||||
@@ -518,16 +540,17 @@ public final class Utils extends StringUtils
|
||||
* @param height Height in pixels
|
||||
* @param alt Optional alt/title text
|
||||
* @param onclick JavaScript onclick event handler code
|
||||
* @param verticalAlign Optional HTML alignment value
|
||||
* @param verticalAlign Optional HTML alignment value
|
||||
* @param style Optional inline CSS styling
|
||||
*
|
||||
* @return Populated <code>img</code> tag
|
||||
*/
|
||||
public static String buildImageTag(FacesContext context, String image, int width, int height,
|
||||
String alt, String onclick, String verticalAlign)
|
||||
String alt, String onclick, String verticalAlign, String style)
|
||||
{
|
||||
StringBuilder buf = new StringBuilder(200);
|
||||
|
||||
String style = "border-width:0px;";
|
||||
style = style != null ? "border-width:0px; " + style : "border-width:0px;";
|
||||
buf.append("<img src='")
|
||||
.append(context.getExternalContext().getRequestContextPath())
|
||||
.append(image)
|
||||
@@ -992,4 +1015,24 @@ public final class Utils extends StringUtils
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the browser User-Agent header value trimmed to either "Firefox" or "MSIE" as appropriate.
|
||||
*/
|
||||
public static String getUserAgent(FacesContext context)
|
||||
{
|
||||
final String userAgent = context.getExternalContext().getRequestHeaderMap().get("User-Agent").toString();
|
||||
if (userAgent != null)
|
||||
{
|
||||
if (userAgent.indexOf("Firefox/") != -1)
|
||||
{
|
||||
return USER_AGENT_FIREFOX;
|
||||
}
|
||||
else if (userAgent.indexOf("MSIE") != -1)
|
||||
{
|
||||
return USER_AGENT_MSIE;
|
||||
}
|
||||
}
|
||||
return userAgent;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user