mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
12718: Merged V2.2 to V3.0 12706: Merged V2.1 to V2.2 12693: Fixed regression where summary pages of WCM related wizards do not render correctly after XSS fixes, related to ETWOTWO-987 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12722 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
75 lines
2.5 KiB
Java
75 lines
2.5 KiB
Java
package org.alfresco.web.bean.wcm;
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
import org.alfresco.web.app.Application;
|
|
import org.alfresco.web.ui.common.Utils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
/**
|
|
* Helper class to build a HTML description attribute for the <code><a:listItem></code> tag.
|
|
*
|
|
* @author Arseny Kovalchuk
|
|
*
|
|
* @see org.alfresco.web.bean.wcm.CreateWebsiteWizard
|
|
* @see org.alfresco.web.bean.wcm.CreateFormWizard
|
|
*/
|
|
public class DescriptionAttributeHelper
|
|
{
|
|
static final String BLANK = "";
|
|
static final String TABLE_BEGIN = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"> <colgroup><col width=\"25%\"/><col width=\"75%\"/></colgroup><tbody>";
|
|
static final String TABLE_END = "</tbody></table>";
|
|
static final String TRTD_BEGIN = "<tr><td>";
|
|
static final String TD_TD = ":</td><td>";
|
|
static final String TDTR_END = "</td></tr>";
|
|
static final String SPAN_ITALIC_BEGIN = "<span style=\"font-style:italic\">";
|
|
static final String SPAN_END = "</span>";
|
|
|
|
/**
|
|
*
|
|
* @return Returns beginning tags of the HTML table
|
|
* @see org.alfresco.web.bean.wcm.DescriptionAttributeConstants
|
|
*/
|
|
public static String getTableBegin()
|
|
{
|
|
return TABLE_BEGIN;
|
|
}
|
|
/**
|
|
*
|
|
* @param fc Current FacesContext
|
|
* @param fieldName Field name
|
|
* @param fieldValue Field value
|
|
* @return Returns a table line <code><tr><td>Localised field name:</td><td>Field value</td></tr></code>
|
|
*/
|
|
public static String getTableLine(FacesContext fc, String fieldName, String fieldValue)
|
|
{
|
|
StringBuilder line = new StringBuilder(128);
|
|
line.append(TRTD_BEGIN).append(Application.getMessage(fc, fieldName)).
|
|
append(TD_TD).append(Utils.encode(fieldValue)).append(TDTR_END);
|
|
return line.toString();
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return Returns an ending HTML table tags
|
|
*/
|
|
public static String getTableEnd()
|
|
{
|
|
return TABLE_END;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param fc Current FacesContext
|
|
* @param fieldValue Field value
|
|
* @return Returns localised "description_not_set" message if fieldValue is empty.
|
|
*/
|
|
public static String getDescriptionNotEmpty(FacesContext fc, String fieldValue)
|
|
{
|
|
return StringUtils.isEmpty(fieldValue) ?
|
|
SPAN_ITALIC_BEGIN + Application.getMessage(fc, "description_not_set") + SPAN_END :
|
|
fieldValue;
|
|
}
|
|
|
|
}
|