Converted add and create content wizards

Moved dictionary and namespace services to BaseDialogBean

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2792 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-05-08 21:13:32 +00:00
parent cc2264ee41
commit 63f98069fe
20 changed files with 1350 additions and 127 deletions

View File

@@ -356,6 +356,7 @@ finish_button=Finish
cancel_button=Cancel
clear_button=Clear
you_may_want=You may want to
summary_step_description=Shows a summary of the information entered.
# Category Management messages
title_categories_list=Categories
@@ -578,12 +579,8 @@ show_details=Show Details
user_search_info=To find a user search for them using their first name, last name and/or user name. Alternatively to see all users click 'Show All', however, this may take some time if there are a lot of users in the system.
# Content Wizard messages
add_content_title=Add Content Wizard
add_content_desc=This wizard helps you to add a document to a space.
add_conent_step1_title=Step One - Upload Document
add_conent_step1_desc=Locate and upload your document to the repository.
add_conent_step2_title=Step Two - Properties
add_conent_step2_desc=Enter information about this content.
add_content_dialog_title=Add Content Dialog
add_content_dialog_desc=This dialog helps you to add a document to a space.
upload_document=Upload Document
properties=Properties
general=General
@@ -593,17 +590,17 @@ content_format=Content Format
inline_editable=Inline Editable
locate_document=Locate document to upload
content_location=Location
upload_document=Upload Document
uploaded_filename=Uploaded File
click_upload=Click upload
file_upload_success=The file ''{0}'' was uploaded successfully. If the file you uploaded does not exist, then an empty file will be created with the name you specified.
content_finish_instruction=To add the content to this space click Finish. To review or change your selections click Back.
create_content_title=Create Content Wizard
create_content_desc=This wizard helps you to create a new document in a space.
create_content_step1_title=Step One - Select Type
create_content_step1_desc=Select the type of content you wish to create.
create_content_step1_title=Step One - Specify name and select type
create_content_step1_desc=Specify the name and select the type of content you wish to create.
create_content_step2_title=Step Two - Enter Content
create_content_step2_desc=Enter your document content into the repository.
create_content_step3_title=Step Three - Properties
create_content_step3_desc=Enter information about this content.
enter_content=Enter Content
select_type=Select Type
content=Content
@@ -848,9 +845,7 @@ title_update_file=Update File Content
title_users=User Management
title_invited_users=Manage Invited Users
title_content_users=Manage Content Users
title_add_content_props=Add Content - Properties
title_add_content_summary=Add Content - Summary
title_add_content_upload=Add Content - Upload
title_add_content=Add Content
title_create_content=Create New Content
title_create_content_props=Create New Content - Properties
title_create_content_summary=Create New Content - Summary

View File

@@ -318,8 +318,7 @@
</permissions>
<label-id>create_content</label-id>
<image>/images/icons/new_content.gif</image>
<action>createContent</action>
<action-listener>#{CreateContentWizard.startWizard}</action-listener>
<action>wizard:createContent</action>
</action>
<!-- Create space -->

View File

@@ -4,13 +4,17 @@
<dialog-container>/jsp/dialog/container.jsp</dialog-container>
<dialogs>
<!-- Definition of the create space dialog -->
<dialog name="createSpace" page="/jsp/spaces/create-space-dialog.jsp" managed-bean="CreateSpaceDialog"
icon="/images/icons/create_space_large.gif" title-id="create_space"
description-id="create_space_description" />
<!-- Definition of the edit space dialog -->
<dialog name="editSpace" page="/jsp/spaces/edit-space-dialog.jsp" managed-bean="EditSpaceDialog"
icon="/images/icons/create_space_large.gif" title-id="modify_space_properties"
description-id="editspace_description" />
</dialogs>
</config>

View File

@@ -41,7 +41,7 @@
description-id="create_space_step3_desc"
instruction-id="default_instruction" />
</step>
<step name="summary" title-id="summary" description-id="summary_desc">
<step name="summary" title-id="summary" description-id="summary_step_description">
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
@@ -59,7 +59,7 @@
description=""
instruction-id="default_instruction" />
</step>
<step name="summary" title-id="summary" description-id="summary_desc">
<step name="summary" title-id="summary" description-id="summary_step_description">
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
@@ -89,7 +89,7 @@
description=""
instruction-id="default_instruction" />
</step>
<step name="summary" title-id="summary" description-id="summary_desc">
<step name="summary" title-id="summary" description-id="summary_step_description">
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
@@ -119,13 +119,46 @@
description=""
instruction-id="default_instruction" />
</step>
<step name="summary" title-id="summary" description-id="summary_desc">
<step name="summary" title-id="summary" description-id="summary_step_description">
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
instruction-id="edit_rule_finish_instruction" />
</step>
</wizard>
<!-- Definition of the add content wizard -->
<wizard name="createContent" managed-bean="CreateContentWizard"
title-id="create_content_title" description-id="create_content_desc"
icon="/images/icons/new_content_large.gif">
<step name="details" title-id="details" description-id="create_content_step1_desc">
<page path="/jsp/content/create-content-wizard/details.jsp"
title-id="create_content_step1_title"
description-id="create_content_step1_desc"
instruction-id="default_instruction" />
</step>
<step name="content" title-id="enter_content" description-id="create_content_step2_desc">
<condition if="#{CreateContentWizard.mimeType == 'text/html'}">
<page path="/jsp/content/create-content-wizard/create-html.jsp"
title-id="create_content_step2_title"
description-id="create_content_step2_desc"
instruction-id="default_instruction" />
</condition>
<condition if="#{CreateContentWizard.mimeType == 'text/plain'}">
<page path="/jsp/content/create-content-wizard/create-text.jsp"
title-id="create_content_step2_title"
description-id="create_content_step2_desc"
instruction-id="default_instruction" />
</condition>
</step>
<step name="summary" title-id="summary" description-id="summary_step_description">
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
instruction-id="content_finish_instruction" />
</step>
</wizard>
</wizards>
</config>

View File

@@ -172,6 +172,13 @@
</folder-types>
</config>
<config evaluator="string-compare" condition="Content Wizards">
<create-mime-types>
<mime-type name="text/html" />
<mime-type name="text/plain" />
</create-mime-types>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<types>
<type name="folder" display-label-id="space"/>

View File

@@ -528,6 +528,8 @@ public class AlfrescoNavigationHandler extends NavigationHandler
}
else
{
logger.warn("Failed to find configuration for dialog '" + name + "'");
// send the dialog name as the outcome to the original handler
handleDispatch(context, fromAction, name);
}
@@ -563,6 +565,8 @@ public class AlfrescoNavigationHandler extends NavigationHandler
}
else
{
logger.warn("Failed to find configuration for wizard '" + name + "'");
// send the dialog name as the outcome to the original handler
handleDispatch(context, fromAction, name);
}

View File

@@ -36,7 +36,6 @@ import org.alfresco.repo.action.executer.TransformActionExecuter;
import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
@@ -98,7 +97,6 @@ public abstract class BaseActionWizard extends BaseWizardBean
public static final String PROP_SCRIPT = "script";
protected ActionService actionService;
protected DictionaryService dictionaryService;
protected MimetypeService mimetypeService;
protected PersonService personService;
protected AuthorityService authorityService;
@@ -751,16 +749,6 @@ public abstract class BaseActionWizard extends BaseWizardBean
this.actionService = actionService;
}
/**
* Sets the dictionary service
*
* @param dictionaryService The dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* Sets the mimetype service
*

View File

@@ -0,0 +1,161 @@
package org.alfresco.web.bean.content;
import java.io.File;
import java.text.MessageFormat;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Repository;
/**
* Bean implementation for the "Add Content" dialog
*
* @author gavinc
*/
public class AddContentDialog extends BaseContentWizard
{
protected File file;
// ------------------------------------------------------------------------------
// Wizard implementation
@Override
protected String finishImpl(FacesContext context, String outcome)
throws Exception
{
saveContent(this.file, null);
return "cancel";
}
@Override
public void init()
{
super.init();
clearUpload();
}
// ------------------------------------------------------------------------------
// Bean getters and setters
/**
* @return Returns the message to display when a file has been uploaded
*/
public String getFileUploadSuccessMsg()
{
// NOTE: This is a far from ideal solution but will do until we have
// a pure JSF upload solution working. This method is only called
// after a file is uploaded, so we can calculate the mime type and
// determine whether to enable inline editing in here.
this.mimeType = Repository.getMimeTypeForFileName(
FacesContext.getCurrentInstance(), this.fileName);
this.inlineEdit = (this.mimeType.equals(MimetypeMap.MIMETYPE_HTML));
// get the file upload message
String msg = Application.getMessage(FacesContext.getCurrentInstance(), "file_upload_success");
return MessageFormat.format(msg, new Object[] {getFileName()});
}
/**
* @return Returns the name of the file
*/
public String getFileName()
{
// try and retrieve the file and filename from the file upload bean
// representing the file we previously uploaded.
FacesContext ctx = FacesContext.getCurrentInstance();
FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap().
get(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
if (fileBean != null)
{
this.file = fileBean.getFile();
this.fileName = fileBean.getFileName();
}
return this.fileName;
}
/**
* @param fileName The name of the file
*/
public void setFileName(String fileName)
{
this.fileName = fileName;
// we also need to keep the file upload bean in sync
FacesContext ctx = FacesContext.getCurrentInstance();
FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap().
get(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
if (fileBean != null)
{
fileBean.setFileName(this.fileName);
}
}
// ------------------------------------------------------------------------------
// Action event handlers
/**
* Action listener called when the add content dialog is called
*/
public void start(ActionEvent event)
{
// NOTE: this is a temporary solution to allow us to use the new dialog
// framework beans outside of the dialog framework, we need to do
// this because the uploading requires a separate non-JSF form, this
// approach can not be used in the current dialog framework. Until
// we have a pure JSF upload solution we need this initialisation
init();
}
/**
* Action handler called when the user wishes to remove an uploaded file
*/
public String removeUploadedFile()
{
clearUpload();
// also clear the file name
this.fileName = null;
// refresh the current page
return null;
}
/**
* Action handler called when the dialog is cancelled
*/
public String cancel()
{
clearUpload();
return "cancel";
}
// ------------------------------------------------------------------------------
// Helper Methods
/**
* Deletes the uploaded file and removes the FileUploadBean from the session
*/
protected void clearUpload()
{
// delete the temporary file we uploaded earlier
if (this.file != null)
{
this.file.delete();
}
this.file = null;
// remove the file upload bean from the session
FacesContext ctx = FacesContext.getCurrentInstance();
ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
}
}

View File

@@ -0,0 +1,420 @@
package org.alfresco.web.bean.content;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.BaseWizardBean;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Base class for the content related wizards and dialogs
*
* @author gavinc
*/
public abstract class BaseContentWizard extends BaseWizardBean
{
protected String fileName;
protected String author;
protected String title;
protected String description;
protected String mimeType;
protected String objectType;
protected boolean inlineEdit;
// the NodeRef of the node created during finish
protected NodeRef createdNode;
protected List<SelectItem> objectTypes;
protected ContentService contentService;
private static Log logger = LogFactory.getLog(BaseContentWizard.class);
// ------------------------------------------------------------------------------
// Wizard implementation
@Override
public void init()
{
super.init();
this.fileName = null;
this.author = null;
this.title = null;
this.description = null;
this.mimeType = null;
this.inlineEdit = false;
this.objectType = ContentModel.TYPE_CONTENT.toString();
}
@Override
public boolean getFinishButtonDisabled()
{
if (this.fileName == null ||
this.fileName.length() == 0 ||
this.mimeType == null)
{
return true;
}
else
{
return false;
}
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* @return Returns the name of the file
*/
public String getFileName()
{
return this.fileName;
}
/**
* @param fileName The name of the file
*/
public void setFileName(String fileName)
{
this.fileName = fileName;
}
/**
* @return Returns the author
*/
public String getAuthor()
{
return this.author;
}
/**
* @param author Sets the author
*/
public void setAuthor(String author)
{
this.author = author;
}
/**
* @return Returns the mime type currenty selected
*/
public String getMimeType()
{
return this.mimeType;
}
/**
* @param mimeType Sets the currently selected mime type
*/
public void setMimeType(String mimeType)
{
this.mimeType = mimeType;
}
/**
* @return Returns the object type currenty selected
*/
public String getObjectType()
{
return this.objectType;
}
/**
* @param objectType Sets the currently selected object type
*/
public void setObjectType(String objectType)
{
this.objectType = objectType;
}
/**
* @return Returns the description
*/
public String getDescription()
{
return this.description;
}
/**
* @param description Sets the description
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return Returns the title
*/
public String getTitle()
{
return this.title;
}
/**
* @param title Sets the title
*/
public void setTitle(String title)
{
this.title = title;
}
/**
* @return Returns the inline edit flag.
*/
public boolean isInlineEdit()
{
return this.inlineEdit;
}
/**
* @param inlineEdit The inline edit flag to set.
*/
public void setInlineEdit(boolean inlineEdit)
{
this.inlineEdit = inlineEdit;
}
/**
* @return Returns a list of object types to allow the user to select from
*/
public List<SelectItem> getObjectTypes()
{
if (this.objectTypes == null)
{
FacesContext context = FacesContext.getCurrentInstance();
// add the well known object type to start with
this.objectTypes = new ArrayList<SelectItem>(5);
this.objectTypes.add(new SelectItem(ContentModel.TYPE_CONTENT.toString(),
Application.getMessage(context, "content")));
// add any configured content sub-types to the list
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Custom Content Types");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("content-types");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
{
QName idQName = Repository.resolveToQName(child.getAttribute("name"));
if (idQName != null)
{
TypeDefinition typeDef = this.dictionaryService.getType(idQName);
if (typeDef != null)
{
if (this.dictionaryService.isSubClass(typeDef.getName(), ContentModel.TYPE_CONTENT))
{
// try and get the display label from config
String label = Utils.getDisplayLabel(context, child);
// if there wasn't a client based label try and get it from the dictionary
if (label == null)
{
label = typeDef.getTitle();
}
// finally, just use the localname
if (label == null)
{
label = idQName.getLocalName();
}
this.objectTypes.add(new SelectItem(idQName.toString(), label));
}
else
{
logger.warn("Failed to add '" + child.getAttribute("name") +
"' to the list of content types as the type is not a subtype of cm:content");
}
}
else
{
logger.warn("Failed to add '" + child.getAttribute("name") +
"' to the list of content types as the type is not recognised");
}
}
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.objectTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
else
{
logger.warn("Could not find 'content-types' configuration element");
}
}
else
{
logger.warn("Could not find 'Custom Content Types' configuration section");
}
}
return this.objectTypes;
}
// ------------------------------------------------------------------------------
// Action event handlers
// ------------------------------------------------------------------------------
// Service Injection
/**
* @param contentService The contentService to set.
*/
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
// ------------------------------------------------------------------------------
// Helper methods
/**
* Save the specified content using the currently set wizard attributes
*
* @param fileContent File content to save
* @param strContent String content to save
*/
protected void saveContent(File fileContent, String strContent) throws Exception
{
// get the node ref of the node that will contain the content
NodeRef containerNodeRef;
String nodeId = this.navigator.getCurrentNodeId();
if (nodeId == null)
{
containerNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
}
else
{
containerNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
}
FileInfo fileInfo = this.fileFolderService.create(
containerNodeRef,
this.fileName,
Repository.resolveToQName(this.objectType));
NodeRef fileNodeRef = fileInfo.getNodeRef();
// set the author aspect (if we have one)
if (this.author != null && this.author.length() > 0)
{
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, this.author);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
}
if (logger.isDebugEnabled())
logger.debug("Created file node for file: " + this.fileName);
// apply the titled aspect - title and description
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(3, 1.0f);
titledProps.put(ContentModel.PROP_TITLE, this.title);
titledProps.put(ContentModel.PROP_DESCRIPTION, this.description);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_TITLED, titledProps);
if (logger.isDebugEnabled())
logger.debug("Added titled aspect with properties: " + titledProps);
// apply the inlineeditable aspect
if (this.inlineEdit == true)
{
Map<QName, Serializable> editProps = new HashMap<QName, Serializable>(1, 1.0f);
editProps.put(ContentModel.PROP_EDITINLINE, this.inlineEdit);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_INLINEEDITABLE, editProps);
if (logger.isDebugEnabled())
logger.debug("Added inlineeditable aspect with properties: " + editProps);
}
// get a writer for the content and put the file
ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
// set the mimetype and encoding
writer.setMimetype(this.mimeType);
writer.setEncoding("UTF-8");
if (fileContent != null)
{
writer.putContent(fileContent);
}
else if (strContent != null)
{
writer.putContent(strContent);
}
else
{
writer.putContent("");
}
// remember the created node now
this.createdNode = fileNodeRef;
}
/**
* Returns the display label for the mime type currently chosen
*
* @param mimeType The mime type to get the display label of
* @return The human readable version of the content type
*/
protected String getSummaryMimeType(String mimeType)
{
ServiceRegistry registry = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
MimetypeService mimetypeService = registry.getMimetypeService();
// get the mime type display name
Map<String, String> mimeTypes = mimetypeService.getDisplaysByMimetype();
return mimeTypes.get(mimeType);
}
/**
* Returns the display label for the currently selected object type
*
* @return The objevt type label
*/
protected String getSummaryObjectType()
{
String objType = null;
for (SelectItem item : this.getObjectTypes())
{
if (item.getValue().equals(this.objectType))
{
objType = item.getLabel();
break;
}
}
return objType;
}
}

View File

@@ -0,0 +1,180 @@
package org.alfresco.web.bean.content;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.web.app.Application;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Create Content Wizard" dialog
*
* @author gavinc
*/
public class CreateContentWizard extends BaseContentWizard
{
protected String content = null;
protected List<SelectItem> createMimeTypes;
private static Log logger = LogFactory.getLog(CreateContentWizard.class);
// ------------------------------------------------------------------------------
// Wizard implementation
@Override
protected String finishImpl(FacesContext context, String outcome)
throws Exception
{
saveContent(null, this.content);
return outcome;
}
@Override
public void init()
{
super.init();
this.content = null;
this.inlineEdit = true;
this.mimeType = MimetypeMap.MIMETYPE_HTML;
}
@Override
public boolean getNextButtonDisabled()
{
// TODO: Allow the next button state to be configured so that
// wizard implementations don't have to worry about
// checking step numbers
boolean disabled = false;
int step = Application.getWizardManager().getCurrentStep();
switch(step)
{
case 1:
{
disabled = (this.fileName == null || this.fileName.length() == 0);
break;
}
}
return disabled;
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* @return Returns the content from the edited form.
*/
public String getContent()
{
return this.content;
}
/**
* @param content The content to edit (should be clear initially)
*/
public void setContent(String content)
{
this.content = content;
}
/**
* @return Returns a list of mime types to allow the user to select from
*/
public List<SelectItem> getCreateMimeTypes()
{
if (this.createMimeTypes == null)
{
FacesContext context = FacesContext.getCurrentInstance();
// add the well known object type to start with
this.createMimeTypes = new ArrayList<SelectItem>(5);
// add the configured create mime types to the list
ConfigService svc = Application.getConfigService(context);
Config wizardCfg = svc.getConfig("Content Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
{
String currentMimeType = child.getAttribute("name");
if (currentMimeType != null)
{
String label = getSummaryMimeType(currentMimeType);
this.createMimeTypes.add(new SelectItem(currentMimeType, label));
}
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.objectTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
else
{
logger.warn("Could not find 'create-mime-types' configuration element");
}
}
else
{
logger.warn("Could not find 'Content Wizards' configuration section");
}
}
return this.createMimeTypes;
}
/**
* @return Returns the summary data for the wizard.
*/
public String getSummary()
{
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
// TODO: show first few lines of content here?
return buildSummary(
new String[] {bundle.getString("file_name"),
bundle.getString("type"),
bundle.getString("content_type")},
new String[] {this.fileName, getSummaryObjectType(),
getSummaryMimeType(this.mimeType)});
}
// ------------------------------------------------------------------------------
// Action event handlers
/**
* Create content type value changed by the user
*/
public void createContentChanged(ValueChangeEvent event)
{
// clear the content as HTML is not compatible with the plain text box etc.
this.content = null;
}
// ------------------------------------------------------------------------------
// Service Injection
// ------------------------------------------------------------------------------
// Helper methods
}

View File

@@ -5,9 +5,11 @@ import java.text.MessageFormat;
import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService;
@@ -31,6 +33,8 @@ public abstract class BaseDialogBean implements IDialogBean
protected NodeService nodeService;
protected FileFolderService fileFolderService;
protected SearchService searchService;
protected DictionaryService dictionaryService;
protected NamespaceService namespaceService;
public void init()
{
@@ -140,6 +144,24 @@ public abstract class BaseDialogBean implements IDialogBean
this.searchService = searchService;
}
/**
* Sets the dictionary service
*
* @param dictionaryService the dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param namespaceService The NamespaceService
*/
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/**
* Returns the default cancel outcome
*

View File

@@ -14,7 +14,6 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileInfo;
@@ -47,8 +46,6 @@ public class CreateSpaceWizard extends BaseWizardBean
private static Log logger = LogFactory.getLog(CreateSpaceWizard.class);
protected NamespaceService namespaceService;
protected DictionaryService dictionaryService;
protected String spaceType;
protected String icon;
protected String createFrom;
@@ -645,24 +642,6 @@ public class CreateSpaceWizard extends BaseWizardBean
return icons;
}
/**
* @param namespaceService The NamespaceService
*/
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/**
* Sets the dictionary service
*
* @param dictionaryService the dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* Formats the error message to display if an error occurs during finish processing
*

View File

@@ -13,13 +13,11 @@ import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
@@ -34,8 +32,6 @@ import org.alfresco.web.ui.common.component.UIListItem;
public class EditSpaceDialog extends BaseDialogBean
{
protected Node editableNode;
protected DictionaryService dictionaryService;
protected NamespaceService namespaceService;
@Override
public void init()
@@ -56,24 +52,6 @@ public class EditSpaceDialog extends BaseDialogBean
return this.editableNode;
}
/**
* Sets the dictionary service
*
* @param dictionaryService the dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param namespaceService The NamespaceService
*/
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
/**
* Returns a list of icons to allow the user to select from.
* The list can change according to the type of space being created.

View File

@@ -373,10 +373,10 @@
<managed-bean>
<description>
The bean that backs up the Add Content Wizard
The bean that backs up the Add Content Dialog
</description>
<managed-bean-name>AddContentWizard</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wizard.AddContentWizard</managed-bean-class>
<managed-bean-name>AddContentDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.content.AddContentDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
@@ -413,7 +413,7 @@
The bean that backs up the Create Content Wizard
</description>
<managed-bean-name>CreateContentWizard</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wizard.CreateContentWizard</managed-bean-class>
<managed-bean-class>org.alfresco.web.bean.content.CreateContentWizard</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>

View File

@@ -99,11 +99,7 @@
</navigation-case>
<navigation-case>
<from-outcome>addContent</from-outcome>
<to-view-id>/jsp/wizard/add-content/upload.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>createContent</from-outcome>
<to-view-id>/jsp/wizard/create-content/select-type.jsp</to-view-id>
<to-view-id>/jsp/content/add-content-dialog.jsp</to-view-id>
</navigation-case>
<!-- showDocDetails and showSpaceDetails moved to /jsp/* above -->
<navigation-case>
@@ -180,6 +176,14 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/content/add-content-dialog.jsp</from-view-id>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/jsp/browse/browse.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Admin Console rules -->
<navigation-rule>
<from-view-id>/jsp/admin/admin-console.jsp</from-view-id>
@@ -704,48 +708,6 @@
</navigation-case>
</navigation-rule>
<!-- navigation rules for the add in-line content wizard -->
<navigation-rule>
<from-view-id>/jsp/wizard/create-content/*</from-view-id>
<navigation-case>
<from-outcome>select</from-outcome>
<to-view-id>/jsp/wizard/create-content/select-type.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>create-html</from-outcome>
<to-view-id>/jsp/wizard/create-content/create-html.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>create-text</from-outcome>
<to-view-id>/jsp/wizard/create-content/create-text.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>properties</from-outcome>
<to-view-id>/jsp/wizard/create-content/properties.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>summary</from-outcome>
<to-view-id>/jsp/wizard/create-content/summary.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- navigation rules for the add content wizard -->
<navigation-rule>
<from-view-id>/jsp/wizard/add-content/*</from-view-id>
<navigation-case>
<from-outcome>upload</from-outcome>
<to-view-id>/jsp/wizard/add-content/upload.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>properties</from-outcome>
<to-view-id>/jsp/wizard/add-content/properties.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>summary</from-outcome>
<to-view-id>/jsp/wizard/add-content/summary.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Navigation for Admin Node Browser -->
<navigation-rule>
<from-view-id>/jsp/admin/*</from-view-id>

View File

@@ -97,7 +97,7 @@
<%-- Quick upload action --%>
<nobr>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="CreateChildren" id="eval2">
<a:actionLink value="#{msg.add_content}" image="/images/icons/add.gif" padding="2" action="addContent" actionListener="#{AddContentWizard.startWizard}" style="white-space:nowrap" id="link3" />
<a:actionLink value="#{msg.add_content}" image="/images/icons/add.gif" padding="2" action="addContent" actionListener="#{AddContentDialog.start}" style="white-space:nowrap" id="link3" />
</r:permissionEvaluator>
</nobr>
</td>

View File

@@ -0,0 +1,314 @@
<%--
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.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="org.alfresco.web.app.Application" %>
<%@ page import="org.alfresco.web.app.portlet.AlfrescoFacesPortlet" %>
<%@ page import="org.alfresco.web.bean.content.AddContentDialog" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<%
boolean fileUploaded = false;
AddContentDialog dialog = (AddContentDialog)session.getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + "AddContentDialog");
if (dialog == null)
{
dialog = (AddContentDialog)session.getAttribute("AddContentDialog");
}
if (dialog != null && dialog.getFileName() != null)
{
fileUploaded = true;
}
%>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<r:page titleId="title_add_content">
<f:view>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<h:form acceptCharset="UTF-8" id="add-content-upload-start">
<%-- Main outer table --%>
<table cellspacing="0" cellpadding="2">
<%-- Title bar --%>
<tr>
<td colspan="2">
<%@ include file="../parts/titlebar.jsp" %>
</td>
</tr>
<%-- Main area --%>
<tr valign="top">
<%-- Shelf --%>
<td>
<%@ include file="../parts/shelf.jsp" %>
</td>
<%-- Work Area --%>
<td width="100%">
<table cellspacing="0" cellpadding="0" width="100%">
<%-- Breadcrumb --%>
<%@ include file="../parts/breadcrumb.jsp" %>
<%-- Status and Actions --%>
<tr>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
<td bgcolor="#EEEEEE">
<%-- Status and Actions inner contents table --%>
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
<table cellspacing="4" cellpadding="0" width="100%">
<tr>
<td width="32">
<h:graphicImage id="dialog-logo" url="/images/icons/add_content_large.gif" />
</td>
<td>
<div class="mainTitle"><h:outputText value="#{msg.add_content_dialog_title}" /></div>
<div class="mainSubText"><h:outputText value="#{msg.add_content_dialog_desc}" /></div>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with gradient shadow --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_7.gif" width="4" height="9"></td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width="4" height="9"></td>
</tr>
</h:form>
<%-- Details --%>
<tr valign=top>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
<td>
<table cellspacing="0" cellpadding="3" border="0" width="100%">
<tr>
<td width="100%" valign="top">
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
<%
if (fileUploaded)
{
PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");
out.write("<img alt='' align='absmiddle' src='");
out.write(request.getContextPath());
out.write("/images/icons/info_icon.gif' />&nbsp;&nbsp;");
out.write(dialog.getFileUploadSuccessMsg());
PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");
out.write("<div style='padding:2px;'></div>");
}
%>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<% if (fileUploaded == false) { %>
<tr>
<td colspan="2" class="wizardSectionHeading"><h:outputText value="#{msg.upload_document}"/></td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td class="mainSubText" colspan="2">
<h:outputText id="text1" value="1. #{msg.locate_document}"/>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<r:uploadForm>
<tr>
<td colspan="2">
<input style="margin-left:12px;" type="file" size="50" name="alfFileInput"/>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td class="mainSubText" colspan="2">
<%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%>
</td>
</tr>
<tr>
<td colspan="2">
<input style="margin-left:12px;" type="submit" value="<%=Application.getMessage(FacesContext.getCurrentInstance(), "upload")%>" />
</td>
</tr>
</r:uploadForm>
<% } %>
<h:form acceptCharset="UTF-8" id="add-content-upload-end" onsubmit="return validate();">
<% if (fileUploaded) { %>
<tr>
<td colspan="2">
<table border="0" cellspacing="2" cellpadding="2" class="selectedItems">
<tr>
<td colspan="2" class="selectedItemsHeader">
<h:outputText id="text2" value="#{msg.uploaded_filename}" />
</th>
</tr>
<tr>
<td class="selectedItemsRow">
<h:outputText id="text3" value="#{AddContentDialog.fileName}" />
</td>
<td>
<a:actionLink image="/images/icons/delete.gif" value="#{msg.remove}"
action="#{AddContentDialog.removeUploadedFile}"
showLink="false" id="link1" />
</td>
</tr>
</table>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td colspan="2" class="wizardSectionHeading">
&nbsp;<h:outputText id="text4" value="#{msg.properties}" />
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td>
<h:outputText id="text5" value="#{msg.file_name}:" />
</td>
<td width="90%">
<h:inputText id="file-name" value="#{AddContentDialog.fileName}"
maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />&nbsp;*
</td>
</tr>
<tr>
<td>
<h:outputText id="text6" value="#{msg.type}:" />
</td>
<td>
<h:selectOneMenu id="object-type" value="#{AddContentDialog.objectType}">
<f:selectItems value="#{AddContentDialog.objectTypes}" />
</h:selectOneMenu>
</td>
</tr>
<tr>
<td>
<h:outputText id="text7" value="#{msg.content_type}:" />
</td>
<td>
<r:mimeTypeSelector id="mime-type" value="#{AddContentDialog.mimeType}" />
</td>
</tr>
<% } %>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td>
<td valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
<table cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="center">
<h:commandButton id="finish-button" styleClass="wizardButton"
value="#{msg.ok}"
action="#{AddContentDialog.finish}"
disabled="#{AddContentDialog.finishButtonDisabled}" />
</td>
</tr>
<tr>
<td align="center">
<h:commandButton id="cancel-button" styleClass="wizardButton"
value="#{msg.cancel}"
action="#{AddContentDialog.cancel}" />
</td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with bottom panel graphics --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("add-content-upload-end:finish-button").onclick = function() {finishButtonPressed = true; clear_add_2Dcontent_2Dupload_2Dend();}
}
function checkButtonState()
{
if (document.getElementById("add-content-upload-end:file-name").value.length == 0 )
{
document.getElementById("add-content-upload-end:finish-button").disabled = true;
}
else
{
document.getElementById("add-content-upload-end:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("add-content-upload-end:file-name"),
'<a:outputText id="text8" value="#{msg.validation_invalid_character}" />', true);
}
else
{
return true;
}
}
</script>
</h:form>
</f:view>
</r:page>

View File

@@ -0,0 +1,61 @@
<%--
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.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<f:verbatim>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/scripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
<%-- Init the Tiny MCE in-line HTML editor --%>
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "editor",
save_callback : "saveContent",
plugins : "table",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,forecolor,backcolor",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_disable: "styleselect",
extended_valid_elements : "a[href|target|name],font[face|size|color|style],span[class|align|style]"
});
function saveContent(id, content)
{
document.getElementById("wizard:wizard-body:editor-output").value = content;
}
var isIE = (document.all);
</script>
</f:verbatim>
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
<f:verbatim>
<div id='editor' style='width:100%; height:360px'>
</f:verbatim>
<h:outputText value="#{WizardManager.bean.content}" escape="false" />
<f:verbatim>
</div>
</f:verbatim>
<h:inputHidden id="editor-output" value="#{WizardManager.bean.content}" />

View File

@@ -0,0 +1,26 @@
<%--
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.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
<h:inputTextarea id="textArea" rows="24" cols="112" value="#{WizardManager.bean.content}" />

View File

@@ -0,0 +1,90 @@
<%--
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.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("wizard:wizard-body:file-name").focus();
document.getElementById("wizard").onsubmit = validate;
document.getElementById("wizard:next-button").onclick = function() {finishButtonPressed = true; clear_wizard();}
document.getElementById("wizard:finish-button").onclick = function() {finishButtonPressed = true; clear_wizard();}
}
function checkButtonState()
{
if (document.getElementById("wizard:wizard-body:file-name").value.length == 0 )
{
document.getElementById("wizard:next-button").disabled = true;
document.getElementById("wizard:finish-button").disabled = true;
}
else
{
document.getElementById("wizard:next-button").disabled = false;
document.getElementById("wizard:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("wizard:wizard-body:file-name"),
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
true);
}
else
{
return true;
}
}
</script>
</f:verbatim>
<a:errors message="#{msg.error_wizard}" styleClass="errorMessage" />
<h:panelGrid columns="2" cellpadding="2" cellspacing="2" border="0">
<h:outputText value="#{msg.file_name}:"/>
<h:inputText id="file-name" value="#{WizardManager.bean.fileName}"
maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />
<h:outputText value="#{msg.type}:"/>
<h:selectOneMenu value="#{WizardManager.bean.objectType}">
<f:selectItems value="#{WizardManager.bean.objectTypes}" />
</h:selectOneMenu>
<h:outputText value="#{msg.content_type}:"/>
<h:selectOneMenu value="#{WizardManager.bean.mimeType}"
valueChangeListener="#{WizardManager.bean.createContentChanged}">
<f:selectItems value="#{WizardManager.bean.createMimeTypes}" />
</h:selectOneMenu>
</h:panelGrid>