diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 4e171a5bb7..3dc181ee0f 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -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 diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 1233076456..cb3ac79ca3 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -318,8 +318,7 @@ create_content /images/icons/new_content.gif - createContent - #{CreateContentWizard.startWizard} + wizard:createContent diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 4cff4bd139..294d194086 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -4,13 +4,17 @@ /jsp/dialog/container.jsp + + - + + + diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index 679300baba..0ee698ff88 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -41,7 +41,7 @@ description-id="create_space_step3_desc" instruction-id="default_instruction" /> - + - + - + - + + + + + + + + + + + + + + + + + + + + diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index 74e331a089..9559548672 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -172,6 +172,13 @@ + + + + + + + diff --git a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java index 4f8bdbc250..3be7b8c876 100644 --- a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java +++ b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java @@ -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); } diff --git a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java index ea5cf01d0e..7b123dbeec 100644 --- a/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java +++ b/source/java/org/alfresco/web/bean/actions/BaseActionWizard.java @@ -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 * diff --git a/source/java/org/alfresco/web/bean/content/AddContentDialog.java b/source/java/org/alfresco/web/bean/content/AddContentDialog.java new file mode 100644 index 0000000000..4684a18a1c --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/AddContentDialog.java @@ -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); + } +} diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java new file mode 100644 index 0000000000..ba365a0b9c --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java @@ -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 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 getObjectTypes() + { + if (this.objectTypes == null) + { + FacesContext context = FacesContext.getCurrentInstance(); + + // add the well known object type to start with + this.objectTypes = new ArrayList(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 authorProps = new HashMap(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 titledProps = new HashMap(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 editProps = new HashMap(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 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; + } +} diff --git a/source/java/org/alfresco/web/bean/content/CreateContentWizard.java b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java new file mode 100644 index 0000000000..5daf28b927 --- /dev/null +++ b/source/java/org/alfresco/web/bean/content/CreateContentWizard.java @@ -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 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 getCreateMimeTypes() + { + if (this.createMimeTypes == null) + { + FacesContext context = FacesContext.getCurrentInstance(); + + // add the well known object type to start with + this.createMimeTypes = new ArrayList(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 + +} diff --git a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java index a3f1fcbb27..c47e81652a 100644 --- a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java @@ -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 * diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index d8a73a316a..9c8d503e4c 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -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; @@ -644,24 +641,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 diff --git a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java index c424d8014a..7de1b011d4 100644 --- a/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/EditSpaceDialog.java @@ -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() @@ -55,24 +51,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. diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 68ddab424f..3812693aba 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -373,10 +373,10 @@ - The bean that backs up the Add Content Wizard + The bean that backs up the Add Content Dialog - AddContentWizard - org.alfresco.web.bean.wizard.AddContentWizard + AddContentDialog + org.alfresco.web.bean.content.AddContentDialog session nodeService @@ -413,7 +413,7 @@ The bean that backs up the Create Content Wizard CreateContentWizard - org.alfresco.web.bean.wizard.CreateContentWizard + org.alfresco.web.bean.content.CreateContentWizard session nodeService diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 3dba6f0e99..799faf3a84 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -99,11 +99,7 @@ addContent - /jsp/wizard/add-content/upload.jsp - - - createContent - /jsp/wizard/create-content/select-type.jsp + /jsp/content/add-content-dialog.jsp @@ -180,6 +176,14 @@ + + /jsp/content/add-content-dialog.jsp + + cancel + /jsp/browse/browse.jsp + + + /jsp/admin/admin-console.jsp @@ -703,48 +707,6 @@ /jsp/browse/browse.jsp - - - - /jsp/wizard/create-content/* - - select - /jsp/wizard/create-content/select-type.jsp - - - create-html - /jsp/wizard/create-content/create-html.jsp - - - create-text - /jsp/wizard/create-content/create-text.jsp - - - properties - /jsp/wizard/create-content/properties.jsp - - - summary - /jsp/wizard/create-content/summary.jsp - - - - - - /jsp/wizard/add-content/* - - upload - /jsp/wizard/add-content/upload.jsp - - - properties - /jsp/wizard/add-content/properties.jsp - - - summary - /jsp/wizard/add-content/summary.jsp - - diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index 23adf470ad..1ceadbdf53 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -97,7 +97,7 @@ <%-- Quick upload action --%> - + diff --git a/source/web/jsp/content/add-content-dialog.jsp b/source/web/jsp/content/add-content-dialog.jsp new file mode 100644 index 0000000000..e70466a341 --- /dev/null +++ b/source/web/jsp/content/add-content-dialog.jsp @@ -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; +} +%> + + + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + + + <%-- Details --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
+
+
+ +
+ + + + + + +
+ + + + <% + if (fileUploaded) + { + PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc"); + out.write("  "); + out.write(dialog.getFileUploadSuccessMsg()); + PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner"); + out.write("
"); + } + %> + + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + <% if (fileUploaded == false) { %> + + + + + + + + + + + + + + + + + + + + + + <% } %> + + + <% if (fileUploaded) { %> + + + + + + + + + + + + + + + + + + + + + <% } %> + +
+ +
+ +
+ <%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%> +
+ " /> +
+ + + + + + + +
+ + +
+ + + +
+
+   +
+ + +  * +
+ + + + + +
+ + + +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/source/web/jsp/content/create-content-wizard/create-html.jsp b/source/web/jsp/content/create-content-wizard/create-html.jsp new file mode 100644 index 0000000000..7f5a498b30 --- /dev/null +++ b/source/web/jsp/content/create-content-wizard/create-html.jsp @@ -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" %> + + + + + + + + + +
+ + + +
+
+ diff --git a/source/web/jsp/content/create-content-wizard/create-text.jsp b/source/web/jsp/content/create-content-wizard/create-text.jsp new file mode 100644 index 0000000000..1835e135cb --- /dev/null +++ b/source/web/jsp/content/create-content-wizard/create-text.jsp @@ -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" %> + + + + + + \ No newline at end of file diff --git a/source/web/jsp/content/create-content-wizard/details.jsp b/source/web/jsp/content/create-content-wizard/details.jsp new file mode 100644 index 0000000000..6f29b791fc --- /dev/null +++ b/source/web/jsp/content/create-content-wizard/details.jsp @@ -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" %> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file