mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- fixing the same minor alignment issue in the configure rendering engine templates page.
- using the same hidden upload mechanism as used for uploading schema. - fixing bug where values aren't being prefilled for rendering engine templates after the first has been uploaded. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4823 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -201,6 +201,7 @@ public class CreateFormWizard
|
||||
private String formTitle = null;
|
||||
private String formDescription = null;
|
||||
private String outputPathPatternForFormInstanceData = null;
|
||||
private String renderingEngineTemplateFileName = null;
|
||||
private String renderingEngineTemplateName = null;
|
||||
private String renderingEngineTemplateTitle = null;
|
||||
private String renderingEngineTemplateDescription = null;
|
||||
@@ -370,6 +371,7 @@ public class CreateFormWizard
|
||||
this.formName = null;
|
||||
this.formTitle = null;
|
||||
this.formDescription = null;
|
||||
this.renderingEngineTemplateFileName = null;
|
||||
this.renderingEngineTemplateName = null;
|
||||
this.renderingEngineTemplateTitle = null;
|
||||
this.renderingEngineTemplateDescription = null;
|
||||
@@ -538,6 +540,7 @@ public class CreateFormWizard
|
||||
this.renderingEngine = null;
|
||||
this.outputPathPatternForRendition = null;
|
||||
this.mimetypeForRendition = null;
|
||||
this.renderingEngineTemplateFileName = null;
|
||||
this.renderingEngineTemplateName = null;
|
||||
this.renderingEngineTemplateTitle = null;
|
||||
this.renderingEngineTemplateDescription = null;
|
||||
@@ -598,8 +601,8 @@ public class CreateFormWizard
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("schemaFileValueChanged(" + this.getFileName(FILE_SCHEMA) + "[" +
|
||||
this.getSchemaFile() + "])");
|
||||
LOGGER.debug("schemaFileValueChanged(" + this.getFileName(FILE_SCHEMA) +
|
||||
"[" + this.getSchemaFile() + "])");
|
||||
}
|
||||
if (this.getSchemaFile() != null)
|
||||
{
|
||||
@@ -618,6 +621,19 @@ public class CreateFormWizard
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action handler called when a rendering engine template file has been uploaded.
|
||||
*/
|
||||
public String renderingEngineTemplateFileValueChanged(final ValueChangeEvent vce)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug("renderingEngineTemplateFileValueChanged(" + this.getFileName(FILE_RENDERING_ENGINE_TEMPLATE) +
|
||||
"[" + this.getRenderingEngineTemplateFile() + "])");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean Getters and Setters
|
||||
|
||||
@@ -748,17 +764,27 @@ public class CreateFormWizard
|
||||
{
|
||||
return this.schemaFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the schema file or <tt>null</tt>
|
||||
* Sets the rendering engine template file name
|
||||
*/
|
||||
public String getRenderingEngineTemplateFileName()
|
||||
public void setRenderingEngineTemplateFileName(final String renderingEngineTemplateFileName)
|
||||
{
|
||||
return this.getFileName(FILE_RENDERING_ENGINE_TEMPLATE);
|
||||
this.renderingEngineTemplateFileName =
|
||||
(renderingEngineTemplateFileName != null && renderingEngineTemplateFileName.length() != 0
|
||||
? renderingEngineTemplateFileName
|
||||
: null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the rendering engine file or <tt>null</tt>
|
||||
* @return Returns the rendering engine template file name or <tt>null</tt>
|
||||
*/
|
||||
public String getRenderingEngineTemplateFileName()
|
||||
{
|
||||
return this.renderingEngineTemplateFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the rendering engine template file or <tt>null</tt>
|
||||
*/
|
||||
public File getRenderingEngineTemplateFile()
|
||||
{
|
||||
@@ -826,6 +852,7 @@ public class CreateFormWizard
|
||||
? FilenameUtils.removeExtension(this.getSchemaFileName())
|
||||
: this.formName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the output path for form instance data.
|
||||
*/
|
||||
@@ -885,7 +912,10 @@ public class CreateFormWizard
|
||||
*/
|
||||
public void setRenderingEngineTemplateName(final String renderingEngineTemplateName)
|
||||
{
|
||||
this.renderingEngineTemplateName = renderingEngineTemplateName;
|
||||
this.renderingEngineTemplateName =
|
||||
(renderingEngineTemplateName != null && renderingEngineTemplateName.length() != 0
|
||||
? renderingEngineTemplateName
|
||||
: null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -897,12 +927,16 @@ public class CreateFormWizard
|
||||
? this.getRenderingEngineTemplateFileName()
|
||||
: this.renderingEngineTemplateName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title for this renderingEngineTemplate.
|
||||
*/
|
||||
public void setRenderingEngineTemplateTitle(final String renderingEngineTemplateTitle)
|
||||
{
|
||||
this.renderingEngineTemplateTitle = renderingEngineTemplateTitle;
|
||||
this.renderingEngineTemplateTitle =
|
||||
(renderingEngineTemplateTitle != null && renderingEngineTemplateTitle.length() != 0
|
||||
? renderingEngineTemplateTitle
|
||||
: null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -931,6 +965,9 @@ public class CreateFormWizard
|
||||
return this.renderingEngineTemplateDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the default workflow
|
||||
*/
|
||||
public WorkflowDefinition getDefaultWorkflowDefinition()
|
||||
{
|
||||
return (this.defaultWorkflowName == null || !this.applyDefaultWorkflow
|
||||
@@ -938,12 +975,18 @@ public class CreateFormWizard
|
||||
: this.workflowService.getDefinitionByName(this.defaultWorkflowName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default workflow name
|
||||
*/
|
||||
public void setDefaultWorkflowName(final String[] defaultWorkflowName)
|
||||
{
|
||||
assert defaultWorkflowName.length == 1;
|
||||
this.defaultWorkflowName = defaultWorkflowName[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default workflow name
|
||||
*/
|
||||
public String[] getDefaultWorkflowName()
|
||||
{
|
||||
if (this.defaultWorkflowName == null && this.getDefaultWorkflowChoices().size() != 0)
|
||||
@@ -953,11 +996,17 @@ public class CreateFormWizard
|
||||
return new String[] { this.defaultWorkflowName };
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether or not to configure a default workflow
|
||||
*/
|
||||
public void setApplyDefaultWorkflow(final boolean applyDefaultWorkflow)
|
||||
{
|
||||
this.applyDefaultWorkflow = applyDefaultWorkflow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether or not to configure a default workflow
|
||||
*/
|
||||
public boolean getApplyDefaultWorkflow()
|
||||
{
|
||||
return this.applyDefaultWorkflow;
|
||||
@@ -1033,6 +1082,11 @@ public class CreateFormWizard
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file upload bean given with the given id.
|
||||
*
|
||||
* @return a file upload bean or <tt>null</tt>
|
||||
*/
|
||||
private FileUploadBean getFileUploadBean(final String id)
|
||||
{
|
||||
final FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
|
@@ -26,20 +26,34 @@
|
||||
<jsp:directive.page isELIgnored="false"/>
|
||||
|
||||
<f:verbatim>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/scripts/upload_helper.js">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function upload_file(el)
|
||||
function handle_upload(target)
|
||||
{
|
||||
el.form.method = "post";
|
||||
el.form.enctype = "multipart/form-data";
|
||||
// for IE
|
||||
el.form.encoding = "multipart/form-data";
|
||||
el.form.action = "<%= request.getContextPath() %>/uploadFileServlet";
|
||||
el.form.submit();
|
||||
return false;
|
||||
handle_upload_helper(target,
|
||||
"<%= CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE %>",
|
||||
upload_complete,
|
||||
"<%= request.getContextPath() %>")
|
||||
}
|
||||
|
||||
function upload_complete(id, path, filename)
|
||||
{
|
||||
var rendering_engine_template_file_input =
|
||||
document.getElementById("wizard:wizard-body:rendering-engine-template-file");
|
||||
rendering_engine_template_file_input.value = filename;
|
||||
rendering_engine_template_file_input.form.submit();
|
||||
}
|
||||
</script>
|
||||
</f:verbatim>
|
||||
|
||||
<h:inputText id="rendering-engine-template-file"
|
||||
value="#{WizardManager.bean.renderingEngineTemplateFileName}"
|
||||
immediate="true"
|
||||
style="display:none;"
|
||||
valueChangeListener="#{WizardManager.bean.renderingEngineTemplateFileValueChanged}"/>
|
||||
|
||||
<h:panelGrid id="general-properties-panel-grid"
|
||||
columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
|
||||
width="100%">
|
||||
@@ -47,31 +61,24 @@
|
||||
value="1. #{msg.create_form_configure_rendering_engine_templates_step1_desc}"
|
||||
escape="false" />
|
||||
<h:panelGrid id="panel_grid_3"
|
||||
columns="3" cellpadding="3" cellspacing="3" border="0"
|
||||
columns="4" cellpadding="3" cellspacing="3" border="0"
|
||||
columnClasses="panelGridRequiredImageColumn,panelGridLabelColumn,panelGridValueColumn">
|
||||
width="100%">
|
||||
<h:graphicImage id="required_image_rendering_engine_template_file"
|
||||
value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
|
||||
<h:outputText id="output_text_rendering_engine_template_file"
|
||||
value="#{msg.rendering_engine_template_file}:"/>
|
||||
<h:column id="column_pt">
|
||||
<%
|
||||
final FileUploadBean upload = (FileUploadBean)
|
||||
session.getAttribute(FileUploadBean.getKey(CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE));
|
||||
if (upload == null || upload.getFile() == null)
|
||||
{
|
||||
%>
|
||||
<h:column id="column_rendering_engine_template_file_empty"
|
||||
rendered="#{empty WizardManager.bean.renderingEngineTemplateFileName}">
|
||||
<f:verbatim><input id="wizard:wizard-body:file-input"
|
||||
type="file"
|
||||
size="35"
|
||||
name="alfFileInput"
|
||||
onchange="javascript:handle_upload(this)"/></f:verbatim>
|
||||
|
||||
<f:verbatim>
|
||||
<input type="hidden" name="upload-id" value="<%= CreateFormWizard.FILE_RENDERING_ENGINE_TEMPLATE %>"/>
|
||||
<input type="hidden" name="return-page" value="<%= request.getContextPath() %>/faces<%= request.getServletPath() %>"/>
|
||||
<input id="wizard:wizard-body:file-input" type="file" size="35" name="alfFileInput" onchange="javascript:upload_file(this)"/>
|
||||
</f:verbatim>
|
||||
<%
|
||||
}
|
||||
else
|
||||
{
|
||||
%>
|
||||
</h:column>
|
||||
<h:column id="column_rendering_engine_template_file_not_empty"
|
||||
rendered="#{!empty WizardManager.bean.renderingEngineTemplateFileName}">
|
||||
<h:outputText id="rendering-engine-template-file-name"
|
||||
value="#{WizardManager.bean.renderingEngineTemplateFileName}"/>
|
||||
<h:outputText id="output_text_rendering_engine_template_space"
|
||||
@@ -83,10 +90,10 @@
|
||||
action="#{WizardManager.bean.removeUploadedRenderingEngineTemplateFile}"
|
||||
showLink="false"
|
||||
target="top"/>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</h:column>
|
||||
<%-- we need to include this invisible image in order to get the column to size correctly --%>
|
||||
<h:graphicImage id="invisible_img_rendering_engine_template_file_help"
|
||||
value="/images/icons/Help_icon.gif" style="cursor:help; visibility: hidden;"/>
|
||||
</h:panelGrid>
|
||||
|
||||
<h:outputText id="step-2-text"
|
||||
|
@@ -140,7 +140,7 @@
|
||||
rendered="#{empty WizardManager.bean.schemaRootElementNameChoices}"
|
||||
value="#{msg.create_form_form_details_no_schema_selected}"/>
|
||||
<%-- we need to include this invisible image in order to get the column to size correctly --%>
|
||||
<h:graphicImage id="invisilbe_img_schema_root_element_name_choices_help"
|
||||
<h:graphicImage id="invisible_img_schema_root_element_name_choices_help"
|
||||
value="/images/icons/Help_icon.gif" style="cursor:help; visibility: hidden;"/>
|
||||
</h:panelGrid>
|
||||
|
||||
|
Reference in New Issue
Block a user