diff --git a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java index 743184e29f..6f18fb00cb 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateFormWizard.java @@ -187,6 +187,14 @@ public class CreateFormWizard extends BaseWizardBean { return this.renderingEngineDescriptionAttribute; } + + public String getRenderingEngineLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.title)); + builder.append(""); + return builder.toString(); + } public String toString() { @@ -538,6 +546,18 @@ public class CreateFormWizard extends BaseWizardBean } return this.formDescriptionAttribute; } + + /** + * + * @return HTML code for the form label + */ + public String getFormLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.getFormTitle())); + builder.append(""); + return builder.toString(); + } /** * @@ -555,6 +575,24 @@ public class CreateFormWizard extends BaseWizardBean } /** + * + * @return Returns HTML code of the workflow label + */ + public String getWorkflowLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + + WorkflowDefinition wkDef = this.getDefaultWorkflowDefinition(); + if (wkDef != null) + { + builder.append(Utils.encode(wkDef.getTitle())); + } + + builder.append(""); + return builder.toString(); + } + + /** * @return Returns the output path for the rendition. */ public String getOutputPathPatternForRendition() diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index 26a01dd8b6..82a9af2bbd 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -894,6 +894,14 @@ public class CreateWebContentWizard extends CreateContentWizard } return this.formDescriptionAttribute; } + + public String getFormLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.getFormInstanceData().getName())); + builder.append(""); + return builder.toString(); + } // ------------------------------------------------------------------------------ // Action event handlers diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index df94156bed..c4cf8a5cba 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -1355,6 +1355,18 @@ public class CreateWebsiteWizard extends BaseWizardBean return this.websiteDescriptionAttribute; } + /** + * + * @return Returns HTML for website label + */ + public String getWebsiteLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.name)); + builder.append(""); + return builder.toString(); + } + /** * * @return Returns a HTML code for "description" attribute @@ -1455,6 +1467,14 @@ public class CreateWebsiteWizard extends BaseWizardBean } return this.formDescriptionAttribute; } + + public String getFormLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.getName())); + builder.append(""); + return builder.toString(); + } /** * @return Returns the workflow. @@ -1744,6 +1764,18 @@ public class CreateWebsiteWizard extends BaseWizardBean return this.workflowDescriptionAttribute; } + /** + * + * @return Returns HTML for the workflow label + */ + public String getWorkflowLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.title)); + builder.append(""); + return builder.toString(); + } + /** * * @return Returns HTML representation of the "description" attribute @@ -1799,6 +1831,14 @@ public class CreateWebsiteWizard extends BaseWizardBean return this.userDescriptionAttribute; } + public String getUserLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.name)); + builder.append(""); + return builder.toString(); + } + private String buildUserDescriptionAttribute() { FacesContext fc = FacesContext.getCurrentInstance(); diff --git a/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java b/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java index 5ea8e76022..1f4ce84033 100644 --- a/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java +++ b/source/java/org/alfresco/web/bean/wcm/DescriptionAttributeHelper.java @@ -3,6 +3,7 @@ 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; /** @@ -43,7 +44,8 @@ public class DescriptionAttributeHelper 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(fieldValue).append(TDTR_END); + line.append(TRTD_BEGIN).append(Application.getMessage(fc, fieldName)). + append(TD_TD).append(Utils.encode(fieldValue)).append(TDTR_END); return line.toString(); } diff --git a/source/java/org/alfresco/web/forms/Rendition.java b/source/java/org/alfresco/web/forms/Rendition.java index 32f1d63a87..2d01f606dd 100644 --- a/source/java/org/alfresco/web/forms/Rendition.java +++ b/source/java/org/alfresco/web/forms/Rendition.java @@ -67,6 +67,9 @@ public interface Rendition /** the output stream for the rendition */ public OutputStream getOutputStream(); + /** the HTML label attribute for UI */ + public String getLabelAttribute(); + /** the HTML description attribute for UI */ public String getDescriptionAttribute(); diff --git a/source/java/org/alfresco/web/forms/RenditionImpl.java b/source/java/org/alfresco/web/forms/RenditionImpl.java index d3949a3289..c5aa6e7921 100644 --- a/source/java/org/alfresco/web/forms/RenditionImpl.java +++ b/source/java/org/alfresco/web/forms/RenditionImpl.java @@ -42,6 +42,7 @@ import org.alfresco.util.Pair; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wcm.AVMUtil; +import org.alfresco.web.ui.common.Utils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -279,6 +280,14 @@ import org.xml.sax.SAXException; return this.descriptionAttribute; } + public String getLabelAttribute() + { + StringBuilder builder = new StringBuilder(""); + builder.append(Utils.encode(this.getName())); + builder.append(""); + return builder.toString(); + } + private String buildDescriptionAttribute() { int hashCode = hashCode(); diff --git a/source/java/org/alfresco/web/ui/common/component/UISelectList.java b/source/java/org/alfresco/web/ui/common/component/UISelectList.java index d63032817f..088f659661 100644 --- a/source/java/org/alfresco/web/ui/common/component/UISelectList.java +++ b/source/java/org/alfresco/web/ui/common/component/UISelectList.java @@ -67,6 +67,8 @@ public class UISelectList extends UIInput implements NamingContainer private int rowIndex = -1; private int itemCount; private String onchange = null; + private Boolean escapeItemLabel; + private Boolean escapeItemDescription; // ------------------------------------------------------------------------------ // Component Impl @@ -99,6 +101,8 @@ public class UISelectList extends UIInput implements NamingContainer this.activeSelect = (Boolean)values[2]; this.itemCount = (Integer)values[3]; this.onchange = (String)values[4]; + this.escapeItemLabel = (Boolean)values[5]; + this.escapeItemDescription = (Boolean)values[6]; } /** @@ -112,7 +116,9 @@ public class UISelectList extends UIInput implements NamingContainer this.multiSelect, this.activeSelect, this.itemCount, - this.onchange + this.onchange, + this.escapeItemLabel, + this.escapeItemDescription }; } @@ -326,6 +332,8 @@ public class UISelectList extends UIInput implements NamingContainer throws IOException { boolean activeSelect = isActiveSelect(); + boolean escapeLabel = getEscapeItemLabel(); + boolean escapeDescription = getEscapeItemDescription(); // begin the row, add tooltip if present String tooltip = item.getTooltip(); @@ -394,17 +402,32 @@ public class UISelectList extends UIInput implements NamingContainer } // label and description text + String label = item.getLabel(); String description = item.getDescription(); out.write("
"); - out.write(Utils.encode(item.getLabel())); + if (escapeLabel) + { + out.write(Utils.encode(label)); + } + else + { + out.write(label); + } out.write("
"); if (description != null) { out.write("
"); - out.write(Utils.encode(description)); + if (escapeDescription) + { + out.write(Utils.encode(description)); + } + else + { + out.write(description); + } out.write("
"); } out.write(""); @@ -520,6 +543,57 @@ public class UISelectList extends UIInput implements NamingContainer this.activeSelect = activeSelect; } + /** + * Get the escape item label flag + * + * @return true if the items label should be escaped, false otherwise + */ + public boolean getEscapeItemLabel() + { + ValueBinding vb = getValueBinding("escapeItemLabel"); + if (vb != null) + { + this.escapeItemLabel = (Boolean)vb.getValue(getFacesContext()); + } + + return this.escapeItemLabel != null ? this.escapeItemLabel.booleanValue() : true; + } + + /** + * Set true to escape the items label, false otherwise + * + * @param escapeItemLabel true to escape the items label + */ + public void setEscapeItemLabel(boolean escapeItemLabel) + { + this.escapeItemLabel = escapeItemLabel; + } + + /** + * Get the escape item description flag + * + * @return true if the items description should be escaped, false otherwise + */ + public boolean getEscapeItemDescription() + { + ValueBinding vb = getValueBinding("escapeItemDescription"); + if (vb != null) + { + this.escapeItemDescription = (Boolean)vb.getValue(getFacesContext()); + } + + return this.escapeItemDescription != null ? this.escapeItemDescription.booleanValue() : true; + } + + /** + * Set true to escape the items description, false otherwise + * + * @param escapeItemDescription true to escape the items description + */ + public void setEscapeItemDescription(boolean escapeItemDescription) + { + this.escapeItemDescription = escapeItemDescription; + } /** * We use a hidden field name based on the parent form component Id and diff --git a/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java b/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java index b935619269..ec2e1e2b69 100644 --- a/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java +++ b/source/java/org/alfresco/web/ui/common/tag/SelectListTag.java @@ -60,6 +60,8 @@ public class SelectListTag extends HtmlComponentTag setStringProperty(component, "itemStyleClass", this.itemStyleClass); setStringProperty(component, "value", this.value); setStringProperty(component, "onchange", this.onchange); + setBooleanProperty(component, "escapeItemLabel", this.escapeItemLabel); + setBooleanProperty(component, "escapeItemDescription", this.escapeItemDescription); } /** @@ -75,6 +77,8 @@ public class SelectListTag extends HtmlComponentTag this.itemStyleClass = null; this.value = null; this.onchange = null; + this.escapeItemLabel = null; + this.escapeItemDescription = null; } /** @@ -146,6 +150,26 @@ public class SelectListTag extends HtmlComponentTag { this.onchange = onchange; } + + /** + * Set the escapeItemLabel flag + * + * @param escapeItemLabel true to escape the items labels + */ + public void setEscapeItemLabel(String escapeItemLabel) + { + this.escapeItemLabel = escapeItemLabel; + } + + /** + * Set the escapeItemDescription flag + * + * @param escapeItemDescription true to escape the items descriptions + */ + public void setEscapeItemDescription(String escapeItemDescription) + { + this.escapeItemDescription = escapeItemDescription; + } /** the selected value */ private String value; @@ -167,4 +191,10 @@ public class SelectListTag extends HtmlComponentTag /** the event handler for a change in selection */ private String onchange; + + /** the escape mode for item's labels */ + private String escapeItemLabel; + + /** the escape mode for item's descriptions */ + private String escapeItemDescription; } diff --git a/source/web/WEB-INF/alfresco.tld b/source/web/WEB-INF/alfresco.tld index 4995e522ed..562d4680be 100644 --- a/source/web/WEB-INF/alfresco.tld +++ b/source/web/WEB-INF/alfresco.tld @@ -2012,6 +2012,18 @@ false true + + + escapeItemLabel + false + true + + + + escapeItemDescription + false + true + diff --git a/source/web/jsp/wcm/create-form-wizard/form-summary.jsp b/source/web/jsp/wcm/create-form-wizard/form-summary.jsp index 1442d02cad..9af0bd9677 100644 --- a/source/web/jsp/wcm/create-form-wizard/form-summary.jsp +++ b/source/web/jsp/wcm/create-form-wizard/form-summary.jsp @@ -41,8 +41,9 @@ multiSelect="false" activeSelect="true" style="width:100%" - itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;"> - + diff --git a/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp b/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp index dda7df03d8..ee93f1d9f5 100644 --- a/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp +++ b/source/web/jsp/wcm/create-form-wizard/web-form-summary.jsp @@ -42,8 +42,9 @@ multiSelect="false" activeSelect="true" style="width:100%" - itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;"> - + @@ -62,9 +63,10 @@ multiSelect="false" itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" activeSelect="true" - style="width:100%"> + style="width:100%" + escapeItemLabel="false" escapeItemDescription="false"> - @@ -85,8 +87,9 @@ multiSelect="false" activeSelect="true" itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" - style="width:100%"> - + diff --git a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp b/source/web/jsp/wcm/create-web-content-wizard/summary.jsp index 0b58f3cc8f..2e67082a05 100644 --- a/source/web/jsp/wcm/create-web-content-wizard/summary.jsp +++ b/source/web/jsp/wcm/create-web-content-wizard/summary.jsp @@ -41,30 +41,32 @@ multiSelect="false" activeSelect="true" style="width:100%" - itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;"> + itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> + rendered="#{!empty WizardManager.bean.renditions}"> + multiSelect="false" + activeSelect="true" + style="width:100%" + itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> diff --git a/source/web/jsp/wcm/create-website-wizard/summary.jsp b/source/web/jsp/wcm/create-website-wizard/summary.jsp index dcbadf081d..eb0731546f 100644 --- a/source/web/jsp/wcm/create-website-wizard/summary.jsp +++ b/source/web/jsp/wcm/create-website-wizard/summary.jsp @@ -41,10 +41,11 @@ + itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> @@ -57,11 +58,12 @@ + itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> @@ -75,11 +77,12 @@ + itemStyle="vertical-align: top; margin-right: 5px; padding-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> @@ -95,12 +98,13 @@ multiSelect="false" activeSelect="true" style="width:100%;" - itemStyle="vertical-align: top; margin-right: 5px;"> - - + itemStyle="vertical-align: top; margin-right: 5px;" + escapeItemLabel="false" escapeItemDescription="false"> + +