mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
first pass at edit form wizard
- modified evaluators to only show Create Form when in the Content Forms directory - edit form evaluator which only shows the edit form action when inside of a form directory git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -239,6 +239,7 @@ create_space=Create Space
|
|||||||
add_content=Add Content
|
add_content=Add Content
|
||||||
create_content=Create Content
|
create_content=Create Content
|
||||||
create_form=Create Form
|
create_form=Create Form
|
||||||
|
edit_form=Edit Form
|
||||||
add_multiple_files=Add Multiple Files
|
add_multiple_files=Add Multiple Files
|
||||||
import_directory=Import Directory
|
import_directory=Import Directory
|
||||||
advanced_space_wizard=Advanced Space Wizard
|
advanced_space_wizard=Advanced Space Wizard
|
||||||
@@ -649,7 +650,9 @@ text_content=Plain Text Content
|
|||||||
html_content=HTML Content
|
html_content=HTML Content
|
||||||
xml_content=XML Content
|
xml_content=XML Content
|
||||||
create_form_title=Create Form Wizard
|
create_form_title=Create Form Wizard
|
||||||
|
edit_form_title=Edit Form Wizard
|
||||||
create_form_desc=This wizard helps you create a new form.
|
create_form_desc=This wizard helps you create a new form.
|
||||||
|
edit_form_desc=This wizard helps you edit a form.
|
||||||
create_form_form_details_title=Step One - Specify details
|
create_form_form_details_title=Step One - Specify details
|
||||||
create_form_form_details_desc=Enter information about the web form you want to create.
|
create_form_form_details_desc=Enter information about the web form you want to create.
|
||||||
create_form_form_details_step1_desc=Select XML schema to use
|
create_form_form_details_step1_desc=Select XML schema to use
|
||||||
|
@@ -376,10 +376,24 @@
|
|||||||
<action id="create_form">
|
<action id="create_form">
|
||||||
<evaluator>org.alfresco.web.action.evaluator.CreateFormEvaluator</evaluator>
|
<evaluator>org.alfresco.web.action.evaluator.CreateFormEvaluator</evaluator>
|
||||||
<label-id>create_form</label-id>
|
<label-id>create_form</label-id>
|
||||||
<image>/images/icons/new_content.gif</image>
|
<image>/images/icons/new_form.gif</image>
|
||||||
<action>wizard:createForm</action>
|
<action>wizard:createForm</action>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
|
<action id="edit_form">
|
||||||
|
<evaluator>org.alfresco.web.action.evaluator.EditFormEvaluator</evaluator>
|
||||||
|
<permissions>
|
||||||
|
<permission allow="true">Write,CreateChildren</permission>
|
||||||
|
</permissions>
|
||||||
|
<label-id>edit_form</label-id>
|
||||||
|
<image>/images/icons/edit_form.gif</image>
|
||||||
|
<action>wizard:editForm</action>
|
||||||
|
<action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
|
||||||
|
<params>
|
||||||
|
<param name="id">#{actionContext.id}</param>
|
||||||
|
</params>
|
||||||
|
</action>
|
||||||
|
|
||||||
<!-- Create space -->
|
<!-- Create space -->
|
||||||
<action id="create_space">
|
<action id="create_space">
|
||||||
<permissions>
|
<permissions>
|
||||||
@@ -641,6 +655,7 @@
|
|||||||
|
|
||||||
<!-- Actions Menu for More Actions in Browse screen -->
|
<!-- Actions Menu for More Actions in Browse screen -->
|
||||||
<action-group id="browse_actions_menu">
|
<action-group id="browse_actions_menu">
|
||||||
|
<action idref="edit_form" />
|
||||||
<action idref="details_space" />
|
<action idref="details_space" />
|
||||||
<action idref="delete_space" />
|
<action idref="delete_space" />
|
||||||
<action idref="cut_node" />
|
<action idref="cut_node" />
|
||||||
|
@@ -345,7 +345,7 @@
|
|||||||
</step>
|
</step>
|
||||||
</wizard>
|
</wizard>
|
||||||
|
|
||||||
<!-- Definition of the Create XML Type wizard -->
|
<!-- Definition of the create form wizard -->
|
||||||
<wizard name="createForm" managed-bean="CreateFormWizard"
|
<wizard name="createForm" managed-bean="CreateFormWizard"
|
||||||
title-id="create_form_title" description-id="create_form_desc"
|
title-id="create_form_title" description-id="create_form_desc"
|
||||||
icon="/images/icons/new_content_large.gif">
|
icon="/images/icons/new_content_large.gif">
|
||||||
@@ -380,6 +380,41 @@
|
|||||||
</step>
|
</step>
|
||||||
</wizard>
|
</wizard>
|
||||||
|
|
||||||
|
<!-- Definition of the edit form wizard -->
|
||||||
|
<wizard name="editForm" managed-bean="EditFormWizard"
|
||||||
|
title-id="edit_form_title" description-id="edit_form_desc"
|
||||||
|
icon="/images/icons/new_content_large.gif">
|
||||||
|
<step name="form_details" title-id="create_form_form_details_title"
|
||||||
|
description-id="create_form_form_details_desc">
|
||||||
|
<page path="/jsp/wcm/create-form-wizard/details.jsp"
|
||||||
|
title-id="create_form_form_details_title"
|
||||||
|
description-id="create_form_form_details_desc"
|
||||||
|
instruction-id="default_instruction" />
|
||||||
|
</step>
|
||||||
|
<step name="configure_rendering_engine_templates"
|
||||||
|
title-id="create_form_configure_rendering_engine_templates_title"
|
||||||
|
description-id="create_form_configure_rendering_engine_templates_desc">
|
||||||
|
<page path="/jsp/wcm/create-form-wizard/configure-rendering-engines.jsp"
|
||||||
|
title-id="create_form_configure_rendering_engine_templates_title"
|
||||||
|
description-id="create_form_configure_rendering_engine_templates_desc"
|
||||||
|
instruction-id="default_instruction" />
|
||||||
|
</step>
|
||||||
|
<step name="select_default_workflow"
|
||||||
|
title-id="create_form_select_default_workflow_title"
|
||||||
|
description-id="create_form_select_default_workflow_desc">
|
||||||
|
<page path="/jsp/wcm/create-form-wizard/select-default-workflow.jsp"
|
||||||
|
title-id="create_form_select_default_workflow_title"
|
||||||
|
description-id="create_form_select_default_workflow_desc"
|
||||||
|
instruction-id="default_instruction" />
|
||||||
|
</step>
|
||||||
|
<step name="summary" title-id="summary" description-id="summary_step_description">
|
||||||
|
<page path="/jsp/wcm/create-form-wizard/summary.jsp"
|
||||||
|
title-id="summary"
|
||||||
|
description-id="summary_desc"
|
||||||
|
instruction-id="content_finish_instruction" />
|
||||||
|
</step>
|
||||||
|
</wizard>
|
||||||
|
|
||||||
<!-- Definition of the Dashboard Layout wizard -->
|
<!-- Definition of the Dashboard Layout wizard -->
|
||||||
<wizard name="configureDashboard" managed-bean="DashboardWizard"
|
<wizard name="configureDashboard" managed-bean="DashboardWizard"
|
||||||
title-id="configure_dashboard_title" description-id="configure_dashboard_desc"
|
title-id="configure_dashboard_title" description-id="configure_dashboard_desc"
|
||||||
|
@@ -18,12 +18,16 @@ package org.alfresco.web.action.evaluator;
|
|||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.repository.Path;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.web.action.ActionEvaluator;
|
import org.alfresco.web.action.ActionEvaluator;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.forms.FormsService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI Action Evaluator - Create Web Form in the Forms DataDictionary folder
|
* UI Action Evaluator - Create Web Form in the Forms DataDictionary folder
|
||||||
@@ -37,10 +41,15 @@ public class CreateFormEvaluator implements ActionEvaluator
|
|||||||
*/
|
*/
|
||||||
public boolean evaluate(Node node)
|
public boolean evaluate(Node node)
|
||||||
{
|
{
|
||||||
PermissionService service =
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
|
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||||
return service.hasPermission(
|
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
FormsService.getInstance().getContentFormsNodeRef(),
|
// get the path to the current name - compare last element with the Website folder assoc name
|
||||||
PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED;
|
final Path path = services.getNodeService().getPath(navigator.getCurrentNode().getNodeRef());
|
||||||
|
final Path.Element element = path.get(path.size() - 1);
|
||||||
|
final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||||
|
// check we have the permission to create nodes in that Website folder
|
||||||
|
return (Application.getContentFormsFolderName(fc).equals(endPath) &&
|
||||||
|
navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.action.evaluator;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
|
import org.alfresco.model.WCMAppModel;
|
||||||
|
import org.alfresco.service.ServiceRegistry;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.web.action.ActionEvaluator;
|
||||||
|
import org.alfresco.web.app.Application;
|
||||||
|
import org.alfresco.web.app.servlet.FacesHelper;
|
||||||
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
|
import org.alfresco.web.bean.repository.Node;
|
||||||
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI Action Evaluator - Edit Web Form in the Forms DataDictionary folder
|
||||||
|
*
|
||||||
|
* @author Ariel Backenroth
|
||||||
|
*/
|
||||||
|
public class EditFormEvaluator implements ActionEvaluator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||||
|
*/
|
||||||
|
public boolean evaluate(Node node)
|
||||||
|
{
|
||||||
|
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||||
|
final NavigationBean navigator = (NavigationBean)
|
||||||
|
FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||||
|
// get the path to the current name - compare last element with the Website folder assoc name
|
||||||
|
final Node currentNode = navigator.getCurrentNode();
|
||||||
|
return (currentNode.hasAspect(WCMAppModel.ASPECT_FORM) &&
|
||||||
|
currentNode.hasPermission(PermissionService.ADD_CHILDREN));
|
||||||
|
}
|
||||||
|
}
|
@@ -73,6 +73,7 @@ public class CreateFormWizard
|
|||||||
implements Serializable
|
implements Serializable
|
||||||
{
|
{
|
||||||
private final String fileName;
|
private final String fileName;
|
||||||
|
private final NodeRef nodeRef;
|
||||||
private final File file;
|
private final File file;
|
||||||
private final String title;
|
private final String title;
|
||||||
private final String description;
|
private final String description;
|
||||||
@@ -80,6 +81,18 @@ public class CreateFormWizard
|
|||||||
private final String outputPathPatternForRendition;
|
private final String outputPathPatternForRendition;
|
||||||
private final RenderingEngine renderingEngine;
|
private final RenderingEngine renderingEngine;
|
||||||
|
|
||||||
|
public RenderingEngineTemplateData(final RenderingEngineTemplate ret)
|
||||||
|
{
|
||||||
|
this.file = null;
|
||||||
|
this.nodeRef = ret.getNodeRef();
|
||||||
|
this.fileName = ret.getName();
|
||||||
|
this.title = ret.getTitle();
|
||||||
|
this.description = ret.getDescription();
|
||||||
|
this.outputPathPatternForRendition = ret.getOutputPathPattern();
|
||||||
|
this.mimetypeForRendition = ret.getMimetypeForRendition();
|
||||||
|
this.renderingEngine = ret.getRenderingEngine();
|
||||||
|
}
|
||||||
|
|
||||||
public RenderingEngineTemplateData(final String fileName,
|
public RenderingEngineTemplateData(final String fileName,
|
||||||
final File file,
|
final File file,
|
||||||
final String title,
|
final String title,
|
||||||
@@ -88,6 +101,7 @@ public class CreateFormWizard
|
|||||||
final String mimetypeForRendition,
|
final String mimetypeForRendition,
|
||||||
final RenderingEngine renderingEngine)
|
final RenderingEngine renderingEngine)
|
||||||
{
|
{
|
||||||
|
this.nodeRef = null;
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@@ -117,6 +131,11 @@ public class CreateFormWizard
|
|||||||
return this.file;
|
return this.file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NodeRef getNodeRef()
|
||||||
|
{
|
||||||
|
return this.nodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
return this.title;
|
return this.title;
|
||||||
@@ -155,20 +174,25 @@ public class CreateFormWizard
|
|||||||
|
|
||||||
private final static Log LOGGER = LogFactory.getLog(CreateFormWizard.class);
|
private final static Log LOGGER = LogFactory.getLog(CreateFormWizard.class);
|
||||||
|
|
||||||
|
protected String defaultWorkflowName = null;
|
||||||
|
protected List<RenderingEngineTemplateData> renderingEngineTemplates = null;
|
||||||
|
protected transient XSModel schema;
|
||||||
|
protected String schemaFileName;
|
||||||
|
protected ContentService contentService;
|
||||||
|
protected MimetypeService mimetypeService;
|
||||||
|
protected WorkflowService workflowService;
|
||||||
|
|
||||||
private String schemaRootElementName = null;
|
private String schemaRootElementName = null;
|
||||||
private String formName = null;
|
private String formName = null;
|
||||||
private String formTitle = null;
|
private String formTitle = null;
|
||||||
private String formDescription = null;
|
private String formDescription = null;
|
||||||
|
private String outputPathPatternForFormInstanceData = null;
|
||||||
private String renderingEngineTemplateTitle = null;
|
private String renderingEngineTemplateTitle = null;
|
||||||
private String renderingEngineTemplateDescription = null;
|
private String renderingEngineTemplateDescription = null;
|
||||||
private String defaultWorkflowName = null;
|
|
||||||
private RenderingEngine renderingEngine = null;
|
private RenderingEngine renderingEngine = null;
|
||||||
protected ContentService contentService;
|
protected transient DataModel renderingEngineTemplatesDataModel;
|
||||||
protected MimetypeService mimetypeService;
|
|
||||||
protected WorkflowService workflowService;
|
|
||||||
private transient DataModel renderingEngineTemplatesDataModel;
|
|
||||||
private List<RenderingEngineTemplateData> renderingEngineTemplates = null;
|
|
||||||
private String outputPathPatternForFormInstanceData = null;
|
|
||||||
private String outputPathPatternForRendition = null;
|
private String outputPathPatternForRendition = null;
|
||||||
private String mimetypeForRendition = null;
|
private String mimetypeForRendition = null;
|
||||||
private transient List<SelectItem> mimetypeChoices = null;
|
private transient List<SelectItem> mimetypeChoices = null;
|
||||||
@@ -180,8 +204,11 @@ public class CreateFormWizard
|
|||||||
@Override
|
@Override
|
||||||
protected String finishImpl(final FacesContext context, final String outcome)
|
protected String finishImpl(final FacesContext context, final String outcome)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
{
|
||||||
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
LOGGER.debug("creating form " + this.getFormName());
|
LOGGER.debug("creating form " + this.getFormName());
|
||||||
|
}
|
||||||
|
|
||||||
final FormsService ts = FormsService.getInstance();
|
final FormsService ts = FormsService.getInstance();
|
||||||
// get the node ref of the node that will contain the content
|
// get the node ref of the node that will contain the content
|
||||||
@@ -223,17 +250,27 @@ public class CreateFormWizard
|
|||||||
this.nodeService.addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props);
|
this.nodeService.addAspect(folderInfo.getNodeRef(), WCMAppModel.ASPECT_FORM, props);
|
||||||
|
|
||||||
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
|
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
|
||||||
|
{
|
||||||
|
this.saveRenderingEngineTemplate(retd, folderInfo.getNodeRef());
|
||||||
|
}
|
||||||
|
// return the default outcome
|
||||||
|
return outcome;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveRenderingEngineTemplate(final RenderingEngineTemplateData retd,
|
||||||
|
final NodeRef formNodeRef)
|
||||||
{
|
{
|
||||||
LOGGER.debug("adding rendering engine template " + retd +
|
LOGGER.debug("adding rendering engine template " + retd +
|
||||||
" to form " + this.getFormName());
|
" to form " + this.getFormName());
|
||||||
|
|
||||||
NodeRef renderingEngineTemplateNodeRef =
|
NodeRef renderingEngineTemplateNodeRef =
|
||||||
this.fileFolderService.searchSimple(folderInfo.getNodeRef(), retd.getFileName());
|
this.fileFolderService.searchSimple(formNodeRef, retd.getFileName());
|
||||||
|
HashMap<QName, Serializable> props;
|
||||||
if (renderingEngineTemplateNodeRef == null)
|
if (renderingEngineTemplateNodeRef == null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fileInfo = this.fileFolderService.create(folderInfo.getNodeRef(),
|
final FileInfo fileInfo = this.fileFolderService.create(formNodeRef,
|
||||||
retd.getFileName(),
|
retd.getFileName(),
|
||||||
ContentModel.TYPE_CONTENT);
|
ContentModel.TYPE_CONTENT);
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
@@ -248,7 +285,7 @@ public class CreateFormWizard
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get a writer for the content and put the file
|
// get a writer for the content and put the file
|
||||||
writer = this.contentService.getWriter(renderingEngineTemplateNodeRef,
|
final ContentWriter writer = this.contentService.getWriter(renderingEngineTemplateNodeRef,
|
||||||
ContentModel.PROP_CONTENT,
|
ContentModel.PROP_CONTENT,
|
||||||
true);
|
true);
|
||||||
// set the mimetype and encoding
|
// set the mimetype and encoding
|
||||||
@@ -257,13 +294,13 @@ public class CreateFormWizard
|
|||||||
writer.setEncoding("UTF-8");
|
writer.setEncoding("UTF-8");
|
||||||
writer.putContent(retd.getFile());
|
writer.putContent(retd.getFile());
|
||||||
|
|
||||||
this.nodeService.createAssociation(folderInfo.getNodeRef(),
|
this.nodeService.createAssociation(formNodeRef,
|
||||||
renderingEngineTemplateNodeRef,
|
renderingEngineTemplateNodeRef,
|
||||||
WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
|
WCMAppModel.ASSOC_RENDERING_ENGINE_TEMPLATES);
|
||||||
props = new HashMap<QName, Serializable>(2, 1.0f);
|
props = new HashMap<QName, Serializable>(2, 1.0f);
|
||||||
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME,
|
props.put(WCMAppModel.PROP_PARENT_RENDERING_ENGINE_NAME,
|
||||||
retd.getRenderingEngine().getName());
|
retd.getRenderingEngine().getName());
|
||||||
props.put(WCMAppModel.PROP_FORM_SOURCE, folderInfo.getNodeRef());
|
props.put(WCMAppModel.PROP_FORM_SOURCE, formNodeRef);
|
||||||
this.nodeService.addAspect(renderingEngineTemplateNodeRef,
|
this.nodeService.addAspect(renderingEngineTemplateNodeRef,
|
||||||
WCMAppModel.ASPECT_RENDERING_ENGINE_TEMPLATE,
|
WCMAppModel.ASPECT_RENDERING_ENGINE_TEMPLATE,
|
||||||
props);
|
props);
|
||||||
@@ -289,9 +326,6 @@ public class CreateFormWizard
|
|||||||
WCMAppModel.TYPE_RENDITION_PROPERTIES,
|
WCMAppModel.TYPE_RENDITION_PROPERTIES,
|
||||||
props);
|
props);
|
||||||
}
|
}
|
||||||
// return the default outcome
|
|
||||||
return outcome;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Map<String, String> parameters)
|
public void init(Map<String, String> parameters)
|
||||||
@@ -300,6 +334,8 @@ public class CreateFormWizard
|
|||||||
|
|
||||||
this.removeUploadedSchemaFile();
|
this.removeUploadedSchemaFile();
|
||||||
this.removeUploadedRenderingEngineTemplateFile();
|
this.removeUploadedRenderingEngineTemplateFile();
|
||||||
|
this.schema = null;
|
||||||
|
this.schemaFileName = null;
|
||||||
this.schemaRootElementName = null;
|
this.schemaRootElementName = null;
|
||||||
this.schemaRootElementNameChoices = null;
|
this.schemaRootElementNameChoices = null;
|
||||||
this.formName = null;
|
this.formName = null;
|
||||||
@@ -331,7 +367,7 @@ public class CreateFormWizard
|
|||||||
// checking step numbers
|
// checking step numbers
|
||||||
|
|
||||||
boolean disabled = false;
|
boolean disabled = false;
|
||||||
int step = Application.getWizardManager().getCurrentStep();
|
final int step = Application.getWizardManager().getCurrentStep();
|
||||||
switch(step)
|
switch(step)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@@ -468,8 +504,10 @@ public class CreateFormWizard
|
|||||||
*/
|
*/
|
||||||
public String removeUploadedSchemaFile()
|
public String removeUploadedSchemaFile()
|
||||||
{
|
{
|
||||||
clearUpload(FILE_SCHEMA);
|
this.clearUpload(FILE_SCHEMA);
|
||||||
this.schemaRootElementNameChoices = null;
|
this.schemaRootElementNameChoices = null;
|
||||||
|
this.schema = null;
|
||||||
|
this.schemaFileName = null;
|
||||||
|
|
||||||
// refresh the current page
|
// refresh the current page
|
||||||
return null;
|
return null;
|
||||||
@@ -491,13 +529,17 @@ public class CreateFormWizard
|
|||||||
*/
|
*/
|
||||||
public String schemaFileValueChanged(final ValueChangeEvent vce)
|
public String schemaFileValueChanged(final ValueChangeEvent vce)
|
||||||
{
|
{
|
||||||
|
if (LOGGER.isDebugEnabled())
|
||||||
|
{
|
||||||
|
LOGGER.debug("schemaFileValueChanged(" + this.getSchemaFile() + ")");
|
||||||
|
}
|
||||||
if (this.getSchemaFile() != null)
|
if (this.getSchemaFile() != null)
|
||||||
{
|
{
|
||||||
final FormsService ts = FormsService.getInstance();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Document d = ts.parseXML(this.getSchemaFile());
|
final FormsService formsService = FormsService.getInstance();
|
||||||
final XSModel xsm = SchemaUtil.loadSchema(d);
|
final Document d = formsService.parseXML(this.getSchemaFile());
|
||||||
|
this.schema = SchemaUtil.parseSchema(d);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -512,6 +554,12 @@ public class CreateFormWizard
|
|||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Bean Getters and Setters
|
// Bean Getters and Setters
|
||||||
|
|
||||||
|
/** Indicates whether or not the wizard is currently in edit mode */
|
||||||
|
public boolean getEditMode()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the properties for current configured output methods JSF DataModel
|
* Returns the properties for current configured output methods JSF DataModel
|
||||||
*
|
*
|
||||||
@@ -645,14 +693,22 @@ public class CreateFormWizard
|
|||||||
return this.getFile(FILE_SCHEMA);
|
return this.getFile(FILE_SCHEMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the schema file name
|
||||||
|
*/
|
||||||
|
public void setSchemaFileName(final String schemaFileName)
|
||||||
|
{
|
||||||
|
this.schemaFileName = (schemaFileName != null && schemaFileName.length() != 0
|
||||||
|
? schemaFileName
|
||||||
|
: null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the schema file or <tt>null</tt>
|
* @return Returns the schema file or <tt>null</tt>
|
||||||
*/
|
*/
|
||||||
public String getSchemaFileName()
|
public String getSchemaFileName()
|
||||||
{
|
{
|
||||||
// try and retrieve the file and filename from the file upload bean
|
return this.schemaFileName;
|
||||||
// representing the file we previously uploaded.
|
|
||||||
return this.getFileName(FILE_SCHEMA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -693,33 +749,27 @@ public class CreateFormWizard
|
|||||||
*/
|
*/
|
||||||
public List<SelectItem> getSchemaRootElementNameChoices()
|
public List<SelectItem> getSchemaRootElementNameChoices()
|
||||||
{
|
{
|
||||||
if (this.getSchemaFile() == null)
|
List<SelectItem> result = Collections.EMPTY_LIST;
|
||||||
|
if (this.schema != null)
|
||||||
{
|
{
|
||||||
return Collections.EMPTY_LIST;
|
|
||||||
}
|
|
||||||
if (this.schemaRootElementNameChoices == null)
|
if (this.schemaRootElementNameChoices == null)
|
||||||
{
|
{
|
||||||
this.schemaRootElementNameChoices = new LinkedList<SelectItem>();
|
this.schemaRootElementNameChoices = new LinkedList<SelectItem>();
|
||||||
final FormsService ts = FormsService.getInstance();
|
final XSNamedMap elementsMap = this.schema.getComponents(XSConstants.ELEMENT_DECLARATION);
|
||||||
try
|
|
||||||
{
|
|
||||||
final Document d = ts.parseXML(this.getSchemaFile());
|
|
||||||
final XSModel xsm = SchemaUtil.loadSchema(d);
|
|
||||||
final XSNamedMap elementsMap = xsm.getComponents(XSConstants.ELEMENT_DECLARATION);
|
|
||||||
for (int i = 0; i < elementsMap.getLength(); i++)
|
for (int i = 0; i < elementsMap.getLength(); i++)
|
||||||
{
|
{
|
||||||
final XSElementDeclaration e = (XSElementDeclaration)elementsMap.item(i);
|
final XSElementDeclaration e = (XSElementDeclaration)elementsMap.item(i);
|
||||||
this.schemaRootElementNameChoices.add(new SelectItem(e.getName(), e.getName()));
|
this.schemaRootElementNameChoices.add(new SelectItem(e.getName(), e.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
result = this.schemaRootElementNameChoices;
|
||||||
|
}
|
||||||
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
final String msg = "unable to parse " + this.getSchemaFileName();
|
LOGGER.debug("getSchemaRootElementNameChoices(" + this.schema +
|
||||||
this.removeUploadedSchemaFile();
|
") = " + result.size());
|
||||||
Utils.addErrorMessage(msg, e);
|
|
||||||
}
|
}
|
||||||
}
|
return result;
|
||||||
return this.schemaRootElementNameChoices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
196
source/java/org/alfresco/web/bean/wcm/EditFormWizard.java
Normal file
196
source/java/org/alfresco/web/bean/wcm/EditFormWizard.java
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.bean.wcm;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.event.ActionEvent;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.model.WCMAppModel;
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||||
|
import org.alfresco.web.forms.xforms.SchemaUtil;
|
||||||
|
import org.alfresco.web.forms.Form;
|
||||||
|
import org.alfresco.web.forms.FormsService;
|
||||||
|
import org.alfresco.web.forms.RenderingEngineTemplate;
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backing bean for the Edit Form wizard.
|
||||||
|
*
|
||||||
|
* @author Ariel Backenroth
|
||||||
|
*/
|
||||||
|
public class EditFormWizard
|
||||||
|
extends CreateFormWizard
|
||||||
|
{
|
||||||
|
|
||||||
|
private List<RenderingEngineTemplateData> removedRenderingEngineTemplates;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Wizard implementation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the wizard
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init(final Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
super.init(parameters);
|
||||||
|
|
||||||
|
// the editMode flag is used to disabled some wizard fields
|
||||||
|
// this.editMode = true;
|
||||||
|
|
||||||
|
final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef();
|
||||||
|
if (formNodeRef == null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Edit Form wizard requires action node context.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Form form = FormsService.getInstance().getForm(formNodeRef);
|
||||||
|
// simple properties
|
||||||
|
this.setFormName(form.getName());
|
||||||
|
this.setFormTitle(form.getTitle());
|
||||||
|
this.setFormDescription(form.getDescription());
|
||||||
|
this.setSchemaRootElementName(form.getSchemaRootElementName());
|
||||||
|
final NodeRef schemaNodeRef = (NodeRef)
|
||||||
|
this.nodeService.getProperty(formNodeRef, WCMAppModel.PROP_XML_SCHEMA);
|
||||||
|
this.setSchemaFileName((String)this.nodeService.getProperty(schemaNodeRef,
|
||||||
|
ContentModel.PROP_NAME));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.schema = SchemaUtil.parseSchema(form.getSchema());
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
final String msg = "unable to parse " + form.getName();
|
||||||
|
Utils.addErrorMessage(msg, t);
|
||||||
|
}
|
||||||
|
final WorkflowDefinition wf = form.getDefaultWorkflow();
|
||||||
|
if (wf != null)
|
||||||
|
{
|
||||||
|
this.defaultWorkflowName = wf.getName();
|
||||||
|
}
|
||||||
|
this.setOutputPathPatternForFormInstanceData(form.getOutputPathPattern());
|
||||||
|
|
||||||
|
for (RenderingEngineTemplate ret : form.getRenderingEngineTemplates())
|
||||||
|
{
|
||||||
|
final RenderingEngineTemplateData data =
|
||||||
|
this.new RenderingEngineTemplateData(ret);
|
||||||
|
this.renderingEngineTemplates.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String finishImpl(FacesContext context, String outcome)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
final NodeRef formNodeRef = this.browseBean.getActionSpace().getNodeRef();
|
||||||
|
|
||||||
|
// apply the name, title and description props
|
||||||
|
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_NAME, this.getFormName());
|
||||||
|
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_TITLE, this.getFormTitle());
|
||||||
|
this.nodeService.setProperty(formNodeRef, ContentModel.PROP_DESCRIPTION, this.getFormDescription());
|
||||||
|
this.nodeService.setProperty(formNodeRef,
|
||||||
|
WCMAppModel.PROP_OUTPUT_PATH_PATTERN_FORM_INSTANCE_DATA,
|
||||||
|
this.getOutputPathPatternForFormInstanceData());
|
||||||
|
this.nodeService.setProperty(formNodeRef,
|
||||||
|
WCMAppModel.PROP_XML_SCHEMA_ROOT_ELEMENT_NAME,
|
||||||
|
this.getSchemaRootElementName());
|
||||||
|
final WorkflowDefinition wd = this.getDefaultWorkflowDefinition();
|
||||||
|
if (wd != null)
|
||||||
|
{
|
||||||
|
this.nodeService.setProperty(formNodeRef,
|
||||||
|
WCMAppModel.PROP_DEFAULT_WORKFLOW_NAME,
|
||||||
|
wd.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getSchemaFile() != null)
|
||||||
|
{
|
||||||
|
FileInfo fileInfo =
|
||||||
|
this.fileFolderService.create(formNodeRef,
|
||||||
|
this.getSchemaFileName(),
|
||||||
|
ContentModel.TYPE_CONTENT);
|
||||||
|
// get a writer for the content and put the file
|
||||||
|
final ContentWriter writer = this.contentService.getWriter(fileInfo.getNodeRef(),
|
||||||
|
ContentModel.PROP_CONTENT,
|
||||||
|
true);
|
||||||
|
// set the mimetype and encoding
|
||||||
|
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
|
||||||
|
writer.setEncoding("UTF-8");
|
||||||
|
writer.putContent(this.getSchemaFile());
|
||||||
|
this.nodeService.setProperty(formNodeRef,
|
||||||
|
WCMAppModel.PROP_XML_SCHEMA,
|
||||||
|
fileInfo.getNodeRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RenderingEngineTemplateData retd : this.removedRenderingEngineTemplates)
|
||||||
|
{
|
||||||
|
this.nodeService.removeChild(formNodeRef, retd.getNodeRef());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RenderingEngineTemplateData retd : this.renderingEngineTemplates)
|
||||||
|
{
|
||||||
|
if (retd.getFile() != null)
|
||||||
|
{
|
||||||
|
this.saveRenderingEngineTemplate(retd, formNodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action handler called when the Remove button is pressed to remove a
|
||||||
|
* rendering engine
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeSelectedRenderingEngineTemplate(final ActionEvent event)
|
||||||
|
{
|
||||||
|
final RenderingEngineTemplateData wrapper = (RenderingEngineTemplateData)
|
||||||
|
this.renderingEngineTemplatesDataModel.getRowData();
|
||||||
|
if (wrapper != null)
|
||||||
|
{
|
||||||
|
if (this.removedRenderingEngineTemplates == null)
|
||||||
|
{
|
||||||
|
this.removedRenderingEngineTemplates = new LinkedList<RenderingEngineTemplateData>();
|
||||||
|
}
|
||||||
|
this.removedRenderingEngineTemplates.add(wrapper);
|
||||||
|
}
|
||||||
|
super.removeSelectedRenderingEngineTemplate(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Indicates whether or not the wizard is currently in edit mode */
|
||||||
|
public boolean getEditMode()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -255,7 +255,7 @@ public class SchemaFormBuilder
|
|||||||
final ResourceBundle resourceBundle)
|
final ResourceBundle resourceBundle)
|
||||||
throws FormBuilderException
|
throws FormBuilderException
|
||||||
{
|
{
|
||||||
final XSModel schema = SchemaUtil.loadSchema(schemaDocument);
|
final XSModel schema = SchemaUtil.parseSchema(schemaDocument);
|
||||||
this.typeTree = SchemaUtil.buildTypeTree(schema);
|
this.typeTree = SchemaUtil.buildTypeTree(schema);
|
||||||
|
|
||||||
//refCounter = 0;
|
//refCounter = 0;
|
||||||
|
@@ -202,7 +202,7 @@ public class SchemaUtil
|
|||||||
return SchemaUtil.DATA_TYPE_TO_NAME.get(type);
|
return SchemaUtil.DATA_TYPE_TO_NAME.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XSModel loadSchema(final Document schemaDocument)
|
public static XSModel parseSchema(final Document schemaDocument)
|
||||||
throws FormBuilderException
|
throws FormBuilderException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@@ -2085,6 +2085,51 @@
|
|||||||
</managed-property>
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
|
<managed-bean>
|
||||||
|
<description>
|
||||||
|
The bean that backs up the Edit Form Wizard
|
||||||
|
</description>
|
||||||
|
<managed-bean-name>EditFormWizard</managed-bean-name>
|
||||||
|
<managed-bean-class>org.alfresco.web.bean.wcm.EditFormWizard</managed-bean-class>
|
||||||
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>nodeService</property-name>
|
||||||
|
<value>#{NodeService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>fileFolderService</property-name>
|
||||||
|
<value>#{FileFolderService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>searchService</property-name>
|
||||||
|
<value>#{SearchService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>namespaceService</property-name>
|
||||||
|
<value>#{NamespaceService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>navigator</property-name>
|
||||||
|
<value>#{NavigationBean}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>browseBean</property-name>
|
||||||
|
<value>#{BrowseBean}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>contentService</property-name>
|
||||||
|
<value>#{ContentService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>mimetypeService</property-name>
|
||||||
|
<value>#{MimetypeService}</value>
|
||||||
|
</managed-property>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>workflowService</property-name>
|
||||||
|
<value>#{WorkflowService}</value>
|
||||||
|
</managed-property>
|
||||||
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>
|
<description>
|
||||||
The bean that backs up the Create Web Content Wizard
|
The bean that backs up the Create Web Content Wizard
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||||
<%@ page import="org.alfresco.web.bean.FileUploadBean" %>
|
|
||||||
<%@ page import="org.alfresco.web.bean.wcm.CreateFormWizard" %>
|
<%@ page import="org.alfresco.web.bean.wcm.CreateFormWizard" %>
|
||||||
<f:verbatim>
|
<f:verbatim>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
@@ -63,18 +62,26 @@
|
|||||||
"<%= request.getContextPath() %>")
|
"<%= request.getContextPath() %>")
|
||||||
}
|
}
|
||||||
|
|
||||||
function upload_complete(id, path)
|
function upload_complete(id, path, filename)
|
||||||
{
|
{
|
||||||
var schema_file_input =
|
var schema_file_input =
|
||||||
document.getElementById("wizard:wizard-body:schema-file");
|
document.getElementById("wizard:wizard-body:schema-file");
|
||||||
schema_file_input.value = path;
|
schema_file_input.value = filename;
|
||||||
schema_file_input.form.submit();
|
schema_file_input.form.submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</f:verbatim>
|
</f:verbatim>
|
||||||
|
|
||||||
|
<h:inputText id="schema-file"
|
||||||
|
value="#{WizardManager.bean.schemaFileName}"
|
||||||
|
immediate="true"
|
||||||
|
style="display:none;"
|
||||||
|
valueChangeListener="#{WizardManager.bean.schemaFileValueChanged}"/>
|
||||||
|
|
||||||
<h:panelGrid id="panel_grid_1"
|
<h:panelGrid id="panel_grid_1"
|
||||||
columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"
|
columns="1" cellpadding="2"
|
||||||
|
style="padding-top: 4px; padding-bottom: 4px;"
|
||||||
width="100%" rowClasses="wizardSectionHeading">
|
width="100%" rowClasses="wizardSectionHeading">
|
||||||
<h:outputText id="panel_grid_1_output_text_1"
|
<h:outputText id="panel_grid_1_output_text_1"
|
||||||
value=" #{msg.general_properties}" escape="false" />
|
value=" #{msg.general_properties}" escape="false" />
|
||||||
@@ -93,13 +100,8 @@
|
|||||||
value="/images/icons/required_field.gif" alt="Required Field" />
|
value="/images/icons/required_field.gif" alt="Required Field" />
|
||||||
<h:outputText id="output_text_schema"
|
<h:outputText id="output_text_schema"
|
||||||
value="#{msg.schema}:"/>
|
value="#{msg.schema}:"/>
|
||||||
<h:column id="column_schema">
|
<h:column id="column_schema_empty"
|
||||||
<%
|
rendered="#{empty WizardManager.bean.schemaFileName}">
|
||||||
FileUploadBean upload = (FileUploadBean)
|
|
||||||
session.getAttribute(FileUploadBean.getKey(CreateFormWizard.FILE_SCHEMA));
|
|
||||||
if (upload == null || upload.getFile() == null)
|
|
||||||
{
|
|
||||||
%>
|
|
||||||
<f:verbatim>
|
<f:verbatim>
|
||||||
<input id="wizard:wizard-body:file-input"
|
<input id="wizard:wizard-body:file-input"
|
||||||
type="file"
|
type="file"
|
||||||
@@ -107,14 +109,9 @@ if (upload == null || upload.getFile() == null)
|
|||||||
name="alfFileInput"
|
name="alfFileInput"
|
||||||
onchange="javascript:handle_upload(this)"/>
|
onchange="javascript:handle_upload(this)"/>
|
||||||
</f:verbatim>
|
</f:verbatim>
|
||||||
<h:inputText id="schema-file"
|
</h:column>
|
||||||
value="#{WizardManager.bean.schemaFileName}"
|
<h:column id="column_schema_not_empty"
|
||||||
rendered="#{empty WizardManager.bean.schemaFileName}"
|
rendered="#{!empty WizardManager.bean.schemaFileName}">
|
||||||
style="display: none"
|
|
||||||
valueChangeListener="#{WizardManager.bean.schemaFileValueChanged}"/>
|
|
||||||
<%
|
|
||||||
} else {
|
|
||||||
%>
|
|
||||||
<h:outputText id="output_text_schema_name"
|
<h:outputText id="output_text_schema_name"
|
||||||
value="#{WizardManager.bean.schemaFileName}"/>
|
value="#{WizardManager.bean.schemaFileName}"/>
|
||||||
<h:outputText id="output_text_schema_space"
|
<h:outputText id="output_text_schema_space"
|
||||||
@@ -126,9 +123,6 @@ if (upload == null || upload.getFile() == null)
|
|||||||
action="#{WizardManager.bean.removeUploadedSchemaFile}"
|
action="#{WizardManager.bean.removeUploadedSchemaFile}"
|
||||||
showLink="false"
|
showLink="false"
|
||||||
target="top"/>
|
target="top"/>
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
</h:column>
|
</h:column>
|
||||||
|
|
||||||
<h:outputText id="no_graphic_image_root_element_name"
|
<h:outputText id="no_graphic_image_root_element_name"
|
||||||
|
@@ -46,5 +46,5 @@ function handle_upload_helper(fileInputElement,
|
|||||||
function upload_complete_helper(id)
|
function upload_complete_helper(id)
|
||||||
{
|
{
|
||||||
var upload = _uploads[id];
|
var upload = _uploads[id];
|
||||||
upload.callback(id, upload.path);
|
upload.callback(id, upload.path, upload.path.replace(/.*[\/\\]([^\/\\]+)/, "$1"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user