tag.
+ * See create-form-wizard/summary.jsp
+ */
+ public String getFormDescriptionAttribute()
+ {
+ if (StringUtils.isEmpty(formDescriptionAttribute))
+ {
+ this.formDescriptionAttribute = buildFormDescriptionAttribute();
+ }
+ return this.formDescriptionAttribute;
+ }
+
+ /**
+ *
+ * @return Returns HTML code of the formDescriptionAttribute
+ * for the attribute "description" of the
tag.
+ * See create-form-wizard/summary.jsp
+ */
+ public String getWorkflowDescriptionAttribute()
+ {
+ if (StringUtils.isEmpty(workflowDescriptionAttribute))
+ {
+ this.workflowDescriptionAttribute = buildWorkflowDescriptionAttribute();
+ }
+ return this.workflowDescriptionAttribute;
+ }
+
+ /**
* @return Returns the output path for the rendition.
*/
public String getOutputPathPatternForRendition()
@@ -1252,4 +1314,47 @@ public class CreateFormWizard extends BaseWizardBean
final FileUploadBean fileBean = this.getFileUploadBean(id);
return fileBean != null ? fileBean.getFile() : null;
}
+
+ /**
+ *
+ * @return Returns a HTML code for "description" attribute
+ */
+ private String buildFormDescriptionAttribute()
+ {
+ FacesContext fc = FacesContext.getCurrentInstance();
+ StringBuilder attribute = new StringBuilder(255);
+ attribute.append(DescriptionAttributeHelper.getTableBegin());
+ attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description",
+ DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getFormDescription())));
+ attribute.append(DescriptionAttributeHelper.getTableLine(fc, "schema_root_element_name",
+ getSchemaRootElementName()));
+ attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern",
+ getOutputPathPatternForFormInstanceData()));
+ attribute.append(DescriptionAttributeHelper.getTableEnd());
+ return attribute.toString();
+ }
+ /**
+ *
+ * @return Returns a HTML code for "description" attribute
+ */
+ private String buildWorkflowDescriptionAttribute()
+ {
+ FacesContext fc = FacesContext.getCurrentInstance();
+ StringBuilder attribute = new StringBuilder(255);
+ attribute.append(DescriptionAttributeHelper.getTableBegin());
+
+ // get workflow description
+ String desc = null;
+ WorkflowDefinition def = getDefaultWorkflowDefinition();
+ if (def != null)
+ {
+ desc = def.getDescription();
+ }
+
+ attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description",
+ DescriptionAttributeHelper.getDescriptionNotEmpty(fc, desc)));
+ attribute.append(DescriptionAttributeHelper.getTableEnd());
+ return attribute.toString();
+ }
+
}
diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
index df66703e39..ea4f2dd654 100644
--- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
+++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java
@@ -80,6 +80,7 @@ import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.wcm.component.UIUserSandboxes;
import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
@@ -104,6 +105,7 @@ public class CreateWebContentWizard extends CreateContentWizard
protected boolean formSelectDisabled = false;
protected boolean startWorkflow = false;
protected List
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 = "Localised field name: Field value
+ */
+ 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);
+ 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;
+ }
+
+}
diff --git a/source/java/org/alfresco/web/forms/Rendition.java b/source/java/org/alfresco/web/forms/Rendition.java
index d3111520d1..32f1d63a87 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 description attribute for UI */
+ public String getDescriptionAttribute();
+
/** regenerates the contents of this rendition using the primary form instance data */
public void regenerate()
throws IOException,
diff --git a/source/java/org/alfresco/web/forms/RenditionImpl.java b/source/java/org/alfresco/web/forms/RenditionImpl.java
index b02d7f0800..d3949a3289 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.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.xml.sax.SAXException;
@@ -62,6 +63,7 @@ import org.xml.sax.SAXException;
private final NodeRef nodeRef;
transient private FormsService formsService;
transient private RenderingEngineTemplate renderingEngineTemplate;
+ private String descriptionAttribute;
/* package */ RenditionImpl(final NodeRef nodeRef, final FormsService formsService)
{
@@ -267,4 +269,28 @@ import org.xml.sax.SAXException;
", rendering_engine_template : " + this.getRenderingEngineTemplate() +
"}");
}
+
+ public String getDescriptionAttribute()
+ {
+ if (StringUtils.isEmpty(this.descriptionAttribute))
+ {
+ this.descriptionAttribute = buildDescriptionAttribute();
+ }
+ return this.descriptionAttribute;
+ }
+
+ private String buildDescriptionAttribute()
+ {
+ int hashCode = hashCode();
+ String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
+ StringBuilder attribute = new StringBuilder(255);
+ attribute.append("");
+ attribute.append("${msg.description}: | -
- |
-
${msg.schema_root_element_name}: | ${WizardManager.bean.schemaRootElementName} |
${msg.description}: | -
- |
-
${msg.schema_root_element_name}: | ${WizardManager.bean.schemaRootElementName} |
${msg.output_path_pattern}: | ${WizardManager.bean.outputPathPatternForFormInstanceData} |
${msg.description}: | -
- |
-
${msg.rendering_engine_type}: | ${ret.renderingEngine.name} |
${msg.output_path_pattern}: | ${ret.outputPathPatternForRendition} |
${msg.mimetype_for_renditions}: | ${ret.mimetypeForRendition} |
${msg.description}: | -
- |
-
${msg.website_sourcewebsite}: | ${WizardManager.bean.sourceWebProjectName} |
${msg.website_dnsname}: | ${WizardManager.bean.dnsName} |
${msg.website_webapp}: | ${WizardManager.bean.webapp} |
${msg.title}: | ${WizardManager.bean.title} |
${msg.description}: | -
- |
-
${msg.name}: | ${r.name} |
${msg.title}: | ${r.title} |
${msg.output_path_pattern}: | ${r.outputPathPattern} |
${msg.description}: | -
- |
-
${msg.workflow}: | -
- |
-
${msg.description}: | -
- |
-
${msg.website_filename_pattern}: | ${r.filenamePattern} |
${msg.roles}: | ${r.role} |