mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
10634: Fix for ETWOTWO-600 and ETWOTWO-601: System error happens on various pages in WebLogic. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10790 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -71,6 +71,7 @@ import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
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.apache.xerces.xs.XSConstants;
|
||||
@@ -78,18 +79,19 @@ import org.apache.xerces.xs.XSElementDeclaration;
|
||||
import org.apache.xerces.xs.XSModel;
|
||||
import org.apache.xerces.xs.XSNamedMap;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Create XML Form" dialog
|
||||
*
|
||||
* @author arielb
|
||||
* @author Arseny Kovalchuk (The fixer of the issue https://issues.alfresco.com/jira/browse/ETWOTWO-600,601)
|
||||
*/
|
||||
public class CreateFormWizard extends BaseWizardBean
|
||||
public class CreateFormWizard extends BaseWizardBean
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final long serialVersionUID = 4038447699556408567L;
|
||||
private static final long serialVersionUID = -7133077371875949483L;
|
||||
|
||||
/**
|
||||
* Simple wrapper class to represent a form data renderer
|
||||
@@ -107,6 +109,7 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
private final String mimetypeForRendition;
|
||||
private final String outputPathPatternForRendition;
|
||||
private final RenderingEngine renderingEngine;
|
||||
private final String renderingEngineDescriptionAttribute;
|
||||
|
||||
public RenderingEngineTemplateData(final RenderingEngineTemplate ret)
|
||||
{
|
||||
@@ -118,6 +121,7 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
this.outputPathPatternForRendition = ret.getOutputPathPattern();
|
||||
this.mimetypeForRendition = ret.getMimetypeForRendition();
|
||||
this.renderingEngine = ret.getRenderingEngine();
|
||||
this.renderingEngineDescriptionAttribute = buildREDescriptionAttribute();
|
||||
}
|
||||
|
||||
public RenderingEngineTemplateData(final File file,
|
||||
@@ -136,6 +140,7 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
this.outputPathPatternForRendition = outputPathPatternForRendition;
|
||||
this.mimetypeForRendition = mimetypeForRendition;
|
||||
this.renderingEngine = renderingEngine;
|
||||
this.renderingEngineDescriptionAttribute = buildREDescriptionAttribute();
|
||||
}
|
||||
|
||||
public String getOutputPathPatternForRendition()
|
||||
@@ -178,6 +183,11 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
return this.renderingEngine;
|
||||
}
|
||||
|
||||
public String getRenderingEngineDescriptionAttribute()
|
||||
{
|
||||
return this.renderingEngineDescriptionAttribute;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (this.getClass().getName() + "{" +
|
||||
@@ -187,6 +197,23 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
"renderingEngine: " + this.getRenderingEngine().getName() +
|
||||
"}");
|
||||
}
|
||||
|
||||
private String buildREDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin());
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description",
|
||||
DescriptionAttributeHelper.getDescriptionNotEmpty(fc, this.getDescription())));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "rendering_engine_type",
|
||||
this.getRenderingEngine().getName()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern",
|
||||
this.getOutputPathPatternForRendition()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "mimetype_for_renditions",
|
||||
this.getMimetypeForRendition()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -219,6 +246,8 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
private String renderingEngineTemplateName = null;
|
||||
private String renderingEngineTemplateTitle = null;
|
||||
private String renderingEngineTemplateDescription = null;
|
||||
private String formDescriptionAttribute = null;
|
||||
private String workflowDescriptionAttribute = null;
|
||||
|
||||
private RenderingEngine renderingEngine = null;
|
||||
protected transient DataModel renderingEngineTemplatesDataModel;
|
||||
@@ -407,6 +436,9 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
this.defaultWorkflowName = null;
|
||||
this.defaultWorkflowChoices = null;
|
||||
this.applyDefaultWorkflow = true;
|
||||
this.formDescriptionAttribute = null;
|
||||
this.workflowDescriptionAttribute = null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -493,6 +525,36 @@ public class CreateFormWizard extends BaseWizardBean
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns HTML code of the formDescriptionAttribute
|
||||
* for the attribute "description" of the <code><a:listItem></code> 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 <code><a:listItem></code> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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<String> locksToReturnToMainStoreOnCancel = null;
|
||||
protected String formDescriptionAttribute;
|
||||
|
||||
transient private AVMLockingService avmLockingService;
|
||||
transient private AVMService avmService;
|
||||
@@ -238,6 +240,8 @@ public class CreateWebContentWizard extends CreateContentWizard
|
||||
}
|
||||
}
|
||||
|
||||
// this.formDescriptionAttribute = buildFormDescriptionAttribute();
|
||||
|
||||
// reset the preview layer
|
||||
String storeName = AVMUtil.getStoreName(this.avmBrowseBean.getCurrentPath());
|
||||
storeName = AVMUtil.getCorrespondingPreviewStoreName(storeName);
|
||||
@@ -877,6 +881,15 @@ public class CreateWebContentWizard extends CreateContentWizard
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getFormDescriptionAttribute()
|
||||
{
|
||||
if (StringUtils.isEmpty(this.formDescriptionAttribute))
|
||||
{
|
||||
this.formDescriptionAttribute = buildFormDescriptionAttribute();
|
||||
}
|
||||
return this.formDescriptionAttribute;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Action event handlers
|
||||
|
||||
@@ -888,4 +901,34 @@ public class CreateWebContentWizard extends CreateContentWizard
|
||||
// clear the content as HTML is not compatible with the plain text box etc.
|
||||
this.content = null;
|
||||
}
|
||||
|
||||
private String buildFormDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
String contextPath = fc.getExternalContext().getRequestContextPath();
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
attribute.append("<span style=\"float:right;\">");
|
||||
attribute.append("<a id=\"preview_fid\" href=\"").append(getFormInstanceData().getUrl()).append("\" ");
|
||||
attribute.append("style=\"text-decoration: none;\" ");
|
||||
attribute.append("target=\"window_").append(getFormInstanceData().getName()).append("\">");
|
||||
attribute.append("<img src=\"").append(contextPath).append("/images/icons/preview_website.gif\" ");
|
||||
attribute.append("align=\"absmiddle\" style=\"border: 0px\" ");
|
||||
attribute.append("alt=").append(getFormInstanceData().getName()).append("\">");
|
||||
attribute.append("</a></span>\n");
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin());
|
||||
String formTitle = null;
|
||||
try
|
||||
{
|
||||
formTitle = getForm().getTitle();
|
||||
}
|
||||
catch (FormNotFoundException e)
|
||||
{
|
||||
formTitle = Application.getMessage(FacesContext.getCurrentInstance(),"form_not_found");
|
||||
}
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "form", formTitle));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "location",
|
||||
getFormInstanceData().getSandboxRelativePath()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.UIListItem;
|
||||
import org.alfresco.web.ui.common.component.UISelectList;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -83,6 +84,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* Backing bean for the Create Web Project wizard.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
* @author Arseny Kovalchuk (The fixer of the issue https://issues.alfresco.com/jira/browse/ETWOTWO-600,601)
|
||||
*/
|
||||
public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
@@ -120,6 +122,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
protected List<SelectItem> webappsList;
|
||||
protected boolean isSource;
|
||||
protected boolean showAllSourceProjects;
|
||||
protected String websiteDescriptionAttribute;
|
||||
|
||||
transient private AVMService avmService;
|
||||
transient private WorkflowService workflowService;
|
||||
@@ -1451,6 +1454,42 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns a websiteDescriptionAttribute
|
||||
*/
|
||||
public String getWebsiteDescriptionAttribute()
|
||||
{
|
||||
if (this.websiteDescriptionAttribute == null)
|
||||
{
|
||||
this.websiteDescriptionAttribute = buildWebsiteDescriptionAttribute();
|
||||
}
|
||||
return this.websiteDescriptionAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns a HTML code for "description" attribute
|
||||
*/
|
||||
private String buildWebsiteDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
String sourceWebProjectName = getSourceWebProjectName();
|
||||
sourceWebProjectName = StringUtils.isEmpty(sourceWebProjectName) ?
|
||||
DescriptionAttributeHelper.BLANK : DescriptionAttributeHelper.TRTD_BEGIN +
|
||||
Application.getMessage(fc, "website_sourcewebsite") + DescriptionAttributeHelper.TD_TD +
|
||||
sourceWebProjectName + DescriptionAttributeHelper.TDTR_END;
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin());
|
||||
attribute.append(sourceWebProjectName);
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_dnsname", getDnsName()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_webapp", getWebapp()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", getTitle()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description",
|
||||
DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription())));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Invite users page
|
||||
@@ -1478,6 +1517,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
private Form form;
|
||||
private String title;
|
||||
private String description;
|
||||
private String formDescriptionAttribute;
|
||||
private WorkflowWrapper workflow;
|
||||
private String outputPathPattern;
|
||||
private List<PresentationTemplate> templates = null;
|
||||
@@ -1486,6 +1526,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
this.form = form;
|
||||
this.title = form.getName();
|
||||
this.description = form.getDescription();
|
||||
}
|
||||
|
||||
public Form getForm()
|
||||
@@ -1518,6 +1559,15 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getFormDescriptionAttribute()
|
||||
{
|
||||
if (StringUtils.isEmpty(this.formDescriptionAttribute))
|
||||
{
|
||||
this.formDescriptionAttribute = this.buildFormDescriptionAttribute();
|
||||
}
|
||||
return this.formDescriptionAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the workflow.
|
||||
*/
|
||||
@@ -1600,6 +1650,24 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
private String buildFormDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
String formDescription = DescriptionAttributeHelper.getDescriptionNotEmpty(fc, this.getDescription());
|
||||
String workflowTitle = getWorkflow() == null ?
|
||||
DescriptionAttributeHelper.SPAN_ITALIC_BEGIN + Application.getMessage(fc, "none") +
|
||||
DescriptionAttributeHelper.SPAN_END : getWorkflow().getTitle();
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin());
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "name", this.getName()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "title", this.getTitle()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "output_path_pattern", this.getOutputPathPattern()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", formDescription));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "workflow", workflowTitle));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1682,6 +1750,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
private String title;
|
||||
private String description;
|
||||
private String filenamePattern;
|
||||
private String workflowDescriptionAttribute;
|
||||
private QName type;
|
||||
private Map<QName, Serializable> params;
|
||||
|
||||
@@ -1690,6 +1759,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.name = name;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute();
|
||||
}
|
||||
|
||||
public WorkflowWrapper(String name, String title, String description, String filenamePattern)
|
||||
@@ -1698,6 +1768,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.filenamePattern = filenamePattern;
|
||||
this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1771,6 +1842,35 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns workflowDescriptionAttribute in HTML format (TABLE tag)
|
||||
*/
|
||||
public String getWorkflowDescriptionAttribute()
|
||||
{
|
||||
if (StringUtils.isEmpty(this.workflowDescriptionAttribute))
|
||||
{
|
||||
this.workflowDescriptionAttribute = this.buildWorkflowDescriptionAttribute();
|
||||
}
|
||||
return this.workflowDescriptionAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns HTML representation of the "description" attribute
|
||||
*/
|
||||
private String buildWorkflowDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
String workflowDescription = DescriptionAttributeHelper.getDescriptionNotEmpty(fc, getDescription());
|
||||
StringBuilder attribute = new StringBuilder(255);
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin());
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "description", workflowDescription));
|
||||
attribute.append(DescriptionAttributeHelper.getTableLine(fc, "website_filename_pattern", this.getFilenamePattern()));
|
||||
attribute.append(DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1779,6 +1879,7 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
private static final long serialVersionUID = 6546685548198253273L;
|
||||
|
||||
private final String name, role;
|
||||
private String userDescriptionAttribute;
|
||||
|
||||
public UserWrapper(final String authority, final String role)
|
||||
{
|
||||
@@ -1796,9 +1897,28 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
this.name = authority.substring(PermissionService.GROUP_PREFIX.length());
|
||||
}
|
||||
this.role = Application.getMessage(FacesContext.getCurrentInstance(), role);
|
||||
this.userDescriptionAttribute = this.buildUserDescriptionAttribute();
|
||||
}
|
||||
|
||||
public String getName() { return this.name; }
|
||||
public String getRole() { return this.role; }
|
||||
public String getUserDescriptionAttribute()
|
||||
{
|
||||
if (StringUtils.isEmpty(this.userDescriptionAttribute))
|
||||
{
|
||||
this.userDescriptionAttribute = buildUserDescriptionAttribute();
|
||||
}
|
||||
return this.userDescriptionAttribute;
|
||||
}
|
||||
|
||||
private String buildUserDescriptionAttribute()
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
StringBuilder attribute = new StringBuilder(128);
|
||||
attribute.append(DescriptionAttributeHelper.getTableBegin()).append(
|
||||
DescriptionAttributeHelper.getTableLine(fc, "roles", this.getRole())).append(
|
||||
DescriptionAttributeHelper.getTableEnd());
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,72 @@
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
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(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;
|
||||
}
|
||||
|
||||
}
|
@@ -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,
|
||||
|
@@ -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("<span style=\"float:right;\"><a id=\"preview").append(hashCode).append("\" ");
|
||||
attribute.append("href=\"").append(getUrl()).append("\" ");
|
||||
attribute.append("style=\"text-decoration: none;\" ");
|
||||
attribute.append("target=\"window_").append(hashCode).append("_").append(getName()).append("\">");
|
||||
attribute.append("<img src=\"").append(contextPath).append("/images/icons/preview_website.gif\" ");
|
||||
attribute.append("align=\"absmiddle\" style=\"border: 0px\" alt=\"").append(getName()).append("\">");
|
||||
attribute.append("</a></span><span>").append(getDescription()).append("</span>");
|
||||
return attribute.toString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user