From e9e3fecbb981cea8031d980e9957318637f0094d Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Wed, 23 May 2007 16:45:42 +0000 Subject: [PATCH] UI related code/jsp fixes and cleanup to new ML space/dialog components. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5764 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/web-client-config-actions.xml | 1 + config/alfresco/web-client-config-dialogs.xml | 6 +- config/alfresco/web-client-config-wizards.xml | 21 +- .../CreateMultilingualPropertiesBean.java | 338 +++++++-------- .../web/bean/DocumentDetailsBean.java | 26 +- .../AddTranslationWithoutContentDialog.java | 4 - .../web/bean/ml/AddTranslationlDialog.java | 36 +- .../web/bean/ml/EditMLContainerDialog.java | 47 +-- .../web/bean/ml/MakeMultilingualDialog.java | 384 +++++++++--------- .../CreateMultilingualPropertiesDialog.java | 55 ++- .../CreateMultilingualPropertiesWizard.java | 172 ++++---- .../spaces/CreateMultilingualSpaceDialog.java | 92 ++--- .../spaces/CreateMultilingualSpaceWizard.java | 306 +++++++------- .../web/bean/spaces/CreateSpaceWizard.java | 3 +- source/web/jsp/dialog/document-details.jsp | 250 ++++++------ source/web/jsp/ml/ml-container-details.jsp | 4 +- .../create-multilingual-properties-dialog.jsp | 38 +- .../ml/create-multilingual-space-dialog.jsp | 124 +++--- 18 files changed, 922 insertions(+), 985 deletions(-) diff --git a/config/alfresco/web-client-config-actions.xml b/config/alfresco/web-client-config-actions.xml index 279d5f497d..920faa52f1 100644 --- a/config/alfresco/web-client-config-actions.xml +++ b/config/alfresco/web-client-config-actions.xml @@ -103,6 +103,7 @@ #{actionContext.id} + diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 5f8d52e6e3..2b35316965 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -14,7 +14,7 @@ icon="/images/icons/make_ml_large.gif" title-id="make_multilingual" description-id="make_multilingual_description" error-message-id="error_make_multilingual_dialog" /> - + @@ -29,7 +29,7 @@ - @@ -38,7 +38,7 @@ icon="/images/icons/create_space_large.gif" title-id="create_multilingual_space" description-id="create_multilingual_space_description" error-message-id="error_create_space_dialog" /> - + diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index 0e652fd01a..8f2895d8d3 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -308,16 +308,16 @@ title-id="create_web_content_title" description-id="create_web_content_desc" icon="/images/icons/new_content_large.gif"> + title-id="create_web_content_details_title" + description-id="create_content_step1_desc"> + title-id="create_web_content_enter_content_title" + description-id="create_content_step2_desc"> - - + + - - + \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/CreateMultilingualPropertiesBean.java b/source/java/org/alfresco/web/bean/CreateMultilingualPropertiesBean.java index 533adb2b73..c7730ffa7c 100644 --- a/source/java/org/alfresco/web/bean/CreateMultilingualPropertiesBean.java +++ b/source/java/org/alfresco/web/bean/CreateMultilingualPropertiesBean.java @@ -42,183 +42,189 @@ import org.alfresco.web.app.servlet.FacesHelper; public class CreateMultilingualPropertiesBean { - /** binding with edit of Other Options */ - private String language = null; - private String newlanguage = null; - private String title = null; - private String description = null; - protected boolean add_new_properties = false; + /** binding with edit of Other Options */ + private String language = null; + private String newlanguage = null; + private String title = null; + private String description = null; + protected boolean add_new_properties = false; - /** The NodeService to be used by the bean */ - protected NodeService nodeService; - /** The user preferences bean reference */ - protected UserPreferencesBean preferences; + /** The NodeService to be used by the bean */ + protected NodeService nodeService; + /** The user preferences bean reference */ + protected UserPreferencesBean preferences; - /** - * @param nodeService The NodeService to set. - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public String getLanguage() - { - return this.language; - } - - public void setLanguage(String x) - { - this.language = x; - Application.setLanguage(FacesContext.getCurrentInstance(), this.language); - } - - public void setNewlanguage(String x) - { - this.newlanguage = x; - } - - public String getNewlanguage() - { - return this.newlanguage; - } - - - public void setUserPreferencesBean(UserPreferencesBean preferences) - { - this.preferences = preferences; - } - - public UserPreferencesBean getUserPreferencesBean() - { - return preferences; - } - - public void setTitle(String x) - { - this.title = x; - } - - public void setDescription(String x) - { - this.description = x; - } - - public String getTitle() - { - return this.title; - } - - public String getDescription() - { - return this.description; - } - - - // Display the list of all multilingual properties - public SelectItem[] getListAllDescriptionsProperties() - { - MLPropertyInterceptor.setMLAware(true); - BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "BrowseBean"); - - // create the space (just create a folder for now) - NodeRef nodeRef = browseBean.getDocument().getNodeRef(); - - if(nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null) + /** + * @param nodeService The NodeService to set. + */ + public void setNodeService(NodeService nodeService) { - List sel = new ArrayList(); - - if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText) - { - MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); - - for(Map.Entry description : descriptions.entrySet()) - { - sel.add(new SelectItem(description.getKey().toString(), description.getValue().toString())); - } - - MLPropertyInterceptor.setMLAware(false); - - // Create the table - SelectItem[] items = new SelectItem[sel.size()]; - - // Copy into table - sel.toArray(items); - - if(sel.size() > 0) - { - return items; - } - else - { - SelectItem[] elements = { new SelectItem("","")}; return elements; - } - } - else - { - SelectItem[] elements = { new SelectItem("","")}; return elements; - } + this.nodeService = nodeService; } - else + + public String getLanguage() { - SelectItem[] elements = { new SelectItem("")}; return elements; + return this.language; } - } - // Display the list of all multilingual properties - public SelectItem[] getListAllTitlesProperties() - { - MLPropertyInterceptor.setMLAware(true); - BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "BrowseBean"); - - // create the space (just create a folder for now) - NodeRef nodeRef = browseBean.getDocument().getNodeRef(); - - if(nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null) + public void setLanguage(String x) { - List sel = new ArrayList(); - - if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText) - { - MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE); - - for(Map.Entry description : descriptions.entrySet()) - { - sel.add(new SelectItem(description.getKey().toString(), description.getValue())); - } - - MLPropertyInterceptor.setMLAware(false); - // Create the table - SelectItem[] items = new SelectItem[sel.size()]; - // Copy into table - sel.toArray(items); - - if(sel.size() > 0) - { - return items; - } - else - { - SelectItem[] elements = { new SelectItem("","")}; return elements; - } - } - else - { - SelectItem[] elements = { new SelectItem("","")}; return elements; - } + this.language = x; + Application.setLanguage(FacesContext.getCurrentInstance(), this.language); } - else + + public void setNewlanguage(String x) { - SelectItem[] elements = { new SelectItem("","")}; return elements; + this.newlanguage = x; } - } - public SelectItem[] getContentFilterLanguages() - { - return preferences.getContentFilterLanguages(false); - } - public boolean isAdd_new_properties() {return this.add_new_properties;} - public void setAdd_new_properties(boolean x){this.add_new_properties = x;} - } + public String getNewlanguage() + { + return this.newlanguage; + } + + public void setUserPreferencesBean(UserPreferencesBean preferences) + { + this.preferences = preferences; + } + + public UserPreferencesBean getUserPreferencesBean() + { + return preferences; + } + + public void setTitle(String x) + { + this.title = x; + } + + public void setDescription(String x) + { + this.description = x; + } + + public String getTitle() + { + return this.title; + } + + public String getDescription() + { + return this.description; + } + + // Display the list of all multilingual properties + public SelectItem[] getListAllDescriptionsProperties() + { + MLPropertyInterceptor.setMLAware(true); + BrowseBean browseBean = (BrowseBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), BrowseBean.BEAN_NAME); + + // create the space (just create a folder for now) + NodeRef nodeRef = browseBean.getDocument().getNodeRef(); + + if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null) + { + List sel = new ArrayList(); + + if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText) + { + MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); + + for(Map.Entry description : descriptions.entrySet()) + { + sel.add(new SelectItem(description.getKey().toString(), description.getValue().toString())); + } + + MLPropertyInterceptor.setMLAware(false); + + // Create the table + SelectItem[] items = new SelectItem[sel.size()]; + + // Copy into table + sel.toArray(items); + + if(sel.size() > 0) + { + return items; + } + else + { + SelectItem[] elements = { new SelectItem("","")}; return elements; + } + } + else + { + SelectItem[] elements = { new SelectItem("","")}; return elements; + } + } + else + { + SelectItem[] elements = { new SelectItem("")}; return elements; + } + } + + // Display the list of all multilingual properties + public SelectItem[] getListAllTitlesProperties() + { + MLPropertyInterceptor.setMLAware(true); + BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "BrowseBean"); + + // create the space (just create a folder for now) + NodeRef nodeRef = browseBean.getDocument().getNodeRef(); + + if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null) + { + List sel = new ArrayList(); + + if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText) + { + MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE); + + for(Map.Entry description : descriptions.entrySet()) + { + sel.add(new SelectItem(description.getKey().toString(), description.getValue())); + } + + MLPropertyInterceptor.setMLAware(false); + // Create the table + SelectItem[] items = new SelectItem[sel.size()]; + // Copy into table + sel.toArray(items); + + if(sel.size() > 0) + { + return items; + } + else + { + SelectItem[] elements = { new SelectItem("","")}; return elements; + } + } + else + { + SelectItem[] elements = { new SelectItem("","")}; return elements; + } + } + else + { + SelectItem[] elements = { new SelectItem("","")}; return elements; + } + } + + public SelectItem[] getContentFilterLanguages() + { + return preferences.getContentFilterLanguages(false); + } + + public boolean isAdd_new_properties() + { + return this.add_new_properties; + } + + public void setAdd_new_properties(boolean x) + { + this.add_new_properties = x; + } +} diff --git a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java index 5e0146a2bd..bf364da97e 100644 --- a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java +++ b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java @@ -262,32 +262,31 @@ public class DocumentDetailsBean extends BaseDetailsBean public List getTranslations() { List translations = new ArrayList(); - + if (getDocument().hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)) { - - Map translationsMap = this.multilingualContentService.getTranslations(getDocument().getNodeRef()); - + Map translationsMap = this.multilingualContentService.getTranslations(getDocument().getNodeRef()); + if (translationsMap != null && translationsMap.size() > 0) { for (Map.Entry entry : translationsMap.entrySet()) { NodeRef nodeRef = (NodeRef) entry.getValue(); - + // create a map node representation of the translation MapNode mapNode = new MapNode(nodeRef); - + Locale locale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE); - + String lgge = (locale != null) ? // convert the locale into new ISO codes contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase() - : null ; + : null; mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); mapNode.put("language", lgge); mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName())); - + // add the client side version to the list translations.add(mapNode); } @@ -789,7 +788,6 @@ public class DocumentDetailsBean extends BaseDetailsBean return new Node(multilingualContentService.getTranslationContainer(nodeRef)); } - /** * Sets the lock service instance the bean should use * @@ -824,16 +822,16 @@ public class DocumentDetailsBean extends BaseDetailsBean * @param multilingualContentService the multilingualContentService to set */ public void setMultilingualContentService( - MultilingualContentService multilingualContentService) + MultilingualContentService multilingualContentService) { - this.multilingualContentService = multilingualContentService; + this.multilingualContentService = multilingualContentService; } - + /** * @param contentFilterLanguagesService The ContentFilterLanguagesService to set. */ public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService) { - this.contentFilterLanguagesService = contentFilterLanguagesService; + this.contentFilterLanguagesService = contentFilterLanguagesService; } } diff --git a/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java b/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java index c0ee0a0c84..fb5b66aa88 100644 --- a/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java +++ b/source/java/org/alfresco/web/bean/ml/AddTranslationWithoutContentDialog.java @@ -48,7 +48,6 @@ import org.alfresco.web.ui.common.Utils; */ public class AddTranslationWithoutContentDialog extends BaseDialogBean { - public static String LOCALE_REGEX = "%locale%"; public static String EMPTY_DOCUMENT_EXTENSION = "." + LOCALE_REGEX + "_properties"; @@ -65,7 +64,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean private String language; - @Override public void init(Map parameters) { @@ -76,7 +74,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean description = null; author = null; language = null; - } @Override @@ -133,7 +130,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean this.multilingualContentService = multilingualContentService; } - /** * @return the author */ diff --git a/source/java/org/alfresco/web/bean/ml/AddTranslationlDialog.java b/source/java/org/alfresco/web/bean/ml/AddTranslationlDialog.java index d945aa720c..ab7750553e 100644 --- a/source/java/org/alfresco/web/bean/ml/AddTranslationlDialog.java +++ b/source/java/org/alfresco/web/bean/ml/AddTranslationlDialog.java @@ -45,7 +45,6 @@ import org.alfresco.web.bean.repository.Node; */ public class AddTranslationlDialog extends AddContentDialog { - private MultilingualContentService multilingualContentService; private UserPreferencesBean userPreferencesBean; @@ -58,6 +57,7 @@ public class AddTranslationlDialog extends AddContentDialog // languages available in the ML container yet private SelectItem[] unusedLanguages; + /* (non-Javadoc) * @see org.alfresco.web.bean.content.AddContentDialog#init(java.util.Map) */ @@ -70,7 +70,6 @@ public class AddTranslationlDialog extends AddContentDialog setMlContainer(this.browseBean.getDocument().getNodeRef()); setFileName(null); unusedLanguages = null; - } /* (non-Javadoc) @@ -79,7 +78,6 @@ public class AddTranslationlDialog extends AddContentDialog @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { - // add the new file to the repository outcome = super.finishImpl(context, outcome); @@ -94,7 +92,6 @@ public class AddTranslationlDialog extends AddContentDialog @Override protected String getDefaultFinishOutcome() { - return "showDocDetails"; } @@ -139,7 +136,7 @@ public class AddTranslationlDialog extends AddContentDialog * Set the Multilingual container where the translation will be associated. * * @param mlContainer mlContainer is a MLDocument, the the MLContainer will - * become it's own MLContainer + * become it's own MLContainer */ public void setMlContainer(NodeRef mlContainer) { @@ -149,15 +146,17 @@ public class AddTranslationlDialog extends AddContentDialog { type = nodeService.getType(mlContainer); - if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type)){ + if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type)) + { this.mlContainer = mlContainer; } - else if(ContentModel.TYPE_CONTENT.equals(type) - && nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)){ - + else if (ContentModel.TYPE_CONTENT.equals(type) + && nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)) + { this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer); } - else{ + else + { this.mlContainer = null; } } @@ -179,7 +178,6 @@ public class AddTranslationlDialog extends AddContentDialog public SelectItem[] getUnusedLanguages() { - if(unusedLanguages == null) { unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false); @@ -189,15 +187,15 @@ public class AddTranslationlDialog extends AddContentDialog } public MultilingualContentService getMultilingualContentService() - { - return multilingualContentService; - } + { + return multilingualContentService; + } - public void setMultilingualContentService( - MultilingualContentService multilingualContentService) - { - this.multilingualContentService = multilingualContentService; - } + public void setMultilingualContentService( + MultilingualContentService multilingualContentService) + { + this.multilingualContentService = multilingualContentService; + } public UserPreferencesBean getUserPreferencesBean() { diff --git a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java index 920e211288..bfa08f1698 100644 --- a/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java +++ b/source/java/org/alfresco/web/bean/ml/EditMLContainerDialog.java @@ -43,54 +43,50 @@ import org.alfresco.web.bean.repository.Node; */ public class EditMLContainerDialog extends BaseDialogBean { - MultilingualContentService multilingualContentService; - + private Node editableNode; - + @Override public void init(Map parameters) { super.init(parameters); - + this.editableNode = initEditableNode(); - } - + @Override public boolean getFinishButtonDisabled() { return false; } - - - + @Override public String getFinishButtonLabel() { return Application.getMessage(FacesContext.getCurrentInstance(), "ok"); } - + @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { // get the container node ref NodeRef container = editableNode.getNodeRef(); - + // get the modified properties Map editProperties = this.editableNode.getProperties(); - + // modify the properties of the container with the user modified properties for(Map.Entry entry : editProperties.entrySet()) { QName qname = QName.createQName(entry.getKey()); - + nodeService.setProperty(container, qname, (Serializable) entry.getValue()); } - - return outcome; + + return outcome; } - + /** * Init the editable Node */ @@ -99,25 +95,26 @@ public class EditMLContainerDialog extends BaseDialogBean return new Node( multilingualContentService.getTranslationContainer( this.browseBean.getDocument().getNodeRef()) - ); + ); } - + /** * @return the editableNode */ - public Node getEditableNode() { + public Node getEditableNode() + { return editableNode; } - + @Override protected String doPostCommitProcessing(FacesContext context, String outcome) { this.browseBean.getDocument().reset(); - + return outcome; } - - + + // ------------------------------------------------------------------------------ // Bean getters and setters @@ -127,7 +124,7 @@ public class EditMLContainerDialog extends BaseDialogBean public MultilingualContentService getMultilingualContentService() { return multilingualContentService; } - + /** * @param multilingualContentService the multilingualContentService to set */ @@ -135,6 +132,4 @@ public class EditMLContainerDialog extends BaseDialogBean MultilingualContentService multilingualContentService) { this.multilingualContentService = multilingualContentService; } - - } diff --git a/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java b/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java index e3ed45a824..1dbd43488f 100644 --- a/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java +++ b/source/java/org/alfresco/web/bean/ml/MakeMultilingualDialog.java @@ -46,213 +46,215 @@ import org.alfresco.web.bean.repository.Node; */ public class MakeMultilingualDialog extends BaseDialogBean { + private MultilingualContentService multilingualContentService; - private MultilingualContentService multilingualContentService; + private UserPreferencesBean userPreferencesBean; - private UserPreferencesBean userPreferencesBean; + /** if needed, add a new translation with content after this dialog closed */ + public static final String OPT_ADD_WITH_CONTENT = "ADD_WITH_CONTENT"; + /** if needed, add a new translation without content after this dialog closed */ + public static final String OPT_ADD_WITHOUT_CONTENT = "ADD_WITHOUT_CONTENT"; - /** if needed, add a new translation with content after this dialog closed */ - public static final String OPT_ADD_WITH_CONTENT = "ADD_WITH_CONTENT"; - /** if needed, add a new translation without content after this dialog closed */ - public static final String OPT_ADD_WITHOUT_CONTENT = "ADD_WITHOUT_CONTENT"; + // The author is a mandatory properties + private String author; - // The author is a mandatory properties - private String author; + // The langage of the node to make multilingual + private String language; - // The langage of the node to make multilingual - private String language; + // set to true, a new translation will be added at the end of this dialog + private boolean addTranslationAfter = true; - // set to true, a new translation will be added at the end of this dialog - private boolean addTranslationAfter = true; + // set if the new translation to add will be an empty document or not + private String addingMode = OPT_ADD_WITH_CONTENT; - // set if the new translation to add will be an empty document or not - private String addingMode = OPT_ADD_WITH_CONTENT; - - // the node to edit - protected Node editableNode; - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // setup the editable node - this.editableNode = initEditableNode(); - - NodeRef nodeRef = this.editableNode.getNodeRef(); - - // propose the author and the language of the content for the properties of the MLContainer - if(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true - && this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null) - { - setAuthor((String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR)); - } - else - { - setAuthor(""); - } - - if(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true - && this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE) != null) - { - setLanguage(((Locale) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString()); - } - else - { - setLanguage(null); - } - - addTranslationAfter = false; - addingMode = OPT_ADD_WITH_CONTENT; - } - - /** - * Init the editable Node - */ - protected Node initEditableNode() - { - return new Node(this.browseBean.getDocument().getNodeRef()); - } - - /* (non-Javadoc) - * @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 - { - Locale loc = I18NUtil.parseLocale(getLanguage()); - - NodeRef nodeRef = this.editableNode.getNodeRef(); - - // make this node multilingual - NodeRef mlContainer = multilingualContentService.makeTranslation(nodeRef, loc); - - // set the local of the current node. - nodeService.setProperty(nodeRef, ContentModel.PROP_LOCALE, getLanguage()); - - // if the author of the node is not set, set it with the default author name of - // the new ML Container - String nodeAuthor = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR); - if(nodeAuthor == null || nodeAuthor.length() < 1) - nodeService.setProperty(nodeRef, ContentModel.PROP_AUTHOR, getAuthor()); - - // set properties of the ml container - nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor()); - nodeService.setProperty(mlContainer, ContentModel.PROP_LOCALE, getLanguage()); - - return outcome; - } - - /* (non-Javadoc) - * @see org.alfresco.web.bean.dialog.BaseDialogBean#doPostCommitProcessing(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - // reset the document held by the browse bean as it's just been updated - this.browseBean.getDocument().reset(); - - // go to the set add translation dialog if asked - // to otherwise just return - if (this.addTranslationAfter) - { - if(addingMode.equalsIgnoreCase(OPT_ADD_WITHOUT_CONTENT)) - { - return "dialog:addTranslationWithoutContent"; - } - else - { - AddTranslationlDialog dialog = (AddTranslationlDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddTranslationDialog"); - dialog.start(null); - return "addTranslation"; - } - } - // close the dialog - return outcome; - } - - @Override - public boolean getFinishButtonDisabled() - { - return !(author != null && author.length() > 0 && language != null); - } + // the node to edit + protected Node editableNode; - // ------------------------------------------------------------------------------ - // Bean getters and setters + @Override + public void init(Map parameters) + { + super.init(parameters); - /** - * Returns the node being edited - * - * @return The node being edited - */ - public Node getEditableNode() - { - return this.editableNode; - } + // setup the editable node + this.editableNode = initEditableNode(); - /** - * @return the author of the new created MLContainer - */ - public String getAuthor() - { - return author; - } + NodeRef nodeRef = this.editableNode.getNodeRef(); - /** - * @param author the author of new created MLContainer - */ - public void setAuthor(String author) - { - this.author = author; - } + // propose the author and the language of the content for the properties of the MLContainer + if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true + && this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null) + { + setAuthor((String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR)); + } + else + { + setAuthor(""); + } - /** - * @return if a new translation must be added after this dialog closes - */ - public boolean isAddTranslationAfter() - { - return addTranslationAfter; - } + if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true + && this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE) != null) + { + setLanguage(((Locale) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString()); + } + else + { + setLanguage(null); + } - /** - * @param addTranslationAfter set to true, a new translation will be added after this dialog closes - */ - public void setAddTranslationAfter(boolean addTranslationAfter) - { - this.addTranslationAfter = addTranslationAfter; - } + addTranslationAfter = false; + addingMode = OPT_ADD_WITH_CONTENT; + } + + /** + * Init the editable Node + */ + protected Node initEditableNode() + { + return new Node(this.browseBean.getDocument().getNodeRef()); + } + + /* (non-Javadoc) + * @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 + { + Locale loc = I18NUtil.parseLocale(getLanguage()); + + NodeRef nodeRef = this.editableNode.getNodeRef(); + + // make this node multilingual + NodeRef mlContainer = multilingualContentService.makeTranslation(nodeRef, loc); + + // set the local of the current node. + nodeService.setProperty(nodeRef, ContentModel.PROP_LOCALE, getLanguage()); + + // if the author of the node is not set, set it with the default author name of + // the new ML Container + String nodeAuthor = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR); + if (nodeAuthor == null || nodeAuthor.length() < 1) + nodeService.setProperty(nodeRef, ContentModel.PROP_AUTHOR, getAuthor()); + + // set properties of the ml container + nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor()); + nodeService.setProperty(mlContainer, ContentModel.PROP_LOCALE, getLanguage()); + + return outcome; + } + + /* (non-Javadoc) + * @see org.alfresco.web.bean.dialog.BaseDialogBean#doPostCommitProcessing(javax.faces.context.FacesContext, java.lang.String) + */ + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // reset the document held by the browse bean as it's just been updated + this.browseBean.getDocument().reset(); + + // go to the set add translation dialog if asked + // to otherwise just return + if (this.addTranslationAfter) + { + if(addingMode.equalsIgnoreCase(OPT_ADD_WITHOUT_CONTENT)) + { + return "dialog:addTranslationWithoutContent"; + } + else + { + AddTranslationlDialog dialog = (AddTranslationlDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddTranslationDialog"); + dialog.start(null); + return "addTranslation"; + } + } + + // close the dialog + return outcome; + } + + @Override + public boolean getFinishButtonDisabled() + { + return !(author != null && author.length() > 0 && language != null); + } - /** - * @return the language of the translation - */ - public String getLanguage() - { - return language; - } + // ------------------------------------------------------------------------------ + // Bean getters and setters - /** - * @param language the language of the translation - */ - public void setLanguage(String language) - { - this.language = language; - } + /** + * Returns the node being edited + * + * @return The node being edited + */ + public Node getEditableNode() + { + return this.editableNode; + } - /** - * @param editableNode the node will become a multilingual - */ - public void setEditableNode(Node editableNode) - { - this.editableNode = editableNode; - } + /** + * @return the author of the new created MLContainer + */ + public String getAuthor() + { + return author; + } + + /** + * @param author the author of new created MLContainer + */ + public void setAuthor(String author) + { + this.author = author; + } + + /** + * @return if a new translation must be added after this dialog closes + */ + public boolean isAddTranslationAfter() + { + return addTranslationAfter; + } + + /** + * @param addTranslationAfter set to true, a new translation will be added after this dialog closes + */ + public void setAddTranslationAfter(boolean addTranslationAfter) + { + this.addTranslationAfter = addTranslationAfter; + } + + + /** + * @return the language of the translation + */ + public String getLanguage() + { + return language; + } + + /** + * @param language the language of the translation + */ + public void setLanguage(String language) + { + this.language = language; + } + + /** + * @param editableNode the node will become a multilingual + */ + public void setEditableNode(Node editableNode) + { + this.editableNode = editableNode; + } /** * @return if the new translation must be added at the end of this dialog, * this mode defines if the translation will be an empty document or not */ - public String getAddingMode() { + public String getAddingMode() + { return addingMode; } @@ -260,7 +262,8 @@ public class MakeMultilingualDialog extends BaseDialogBean * @param addingMode if the new translation must be added at the end of this dialog, * this mode defines if the translation will be an empty document or not */ - public void setAddingMode(String addingMode) { + public void setAddingMode(String addingMode) + { this.addingMode = addingMode; } @@ -273,16 +276,13 @@ public class MakeMultilingualDialog extends BaseDialogBean } public void setMultilingualContentService( - MultilingualContentService multilingualContentService) - { - this.multilingualContentService = multilingualContentService; - } + MultilingualContentService multilingualContentService) + { + this.multilingualContentService = multilingualContentService; + } public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) { this.userPreferencesBean = userPreferencesBean; } - - - } diff --git a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesDialog.java b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesDialog.java index 13c4ccdcc6..86d2aa001b 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesDialog.java @@ -29,44 +29,37 @@ import javax.faces.context.FacesContext; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; - public class CreateMultilingualPropertiesDialog extends CreateMultilingualPropertiesWizard { - // ------------------------------------------------------------------------------ - // Wizard implementation + // ------------------------------------------------------------------------------ + // Wizard implementation - @Override - public String getFinishButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space"); - } + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space"); + } - @Override - protected String getDefaultCancelOutcome() - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; + @Override + protected String getDefaultCancelOutcome() + { + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; -// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - @Override - protected String getDefaultFinishOutcome() - { -// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; - - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - - - - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - // do nothing by default, subclasses can override if necessary - - return outcome; - } +// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + @Override + protected String getDefaultFinishOutcome() + { +// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // do nothing by default, subclasses can override if necessary + return outcome; + } } diff --git a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesWizard.java index 475ea8a787..079502870d 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualPropertiesWizard.java @@ -41,62 +41,58 @@ import org.alfresco.web.bean.UserPreferencesBean; public class CreateMultilingualPropertiesWizard extends CreateSpaceWizard { - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + MLText title, description; + + // bind to the bean + CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); + UserPreferencesBean userPreferencesBean = (UserPreferencesBean) FacesHelper.getManagedBean(context, "UserPreferencesBean"); + + if (this.createFrom.equals("scratch")) { - MLText title, description; + // create the space (just create a folder for now) + NodeRef nodeRef = this.browseBean.getDocument().getNodeRef(); + // Add aspect (PropertyMap is a extension of HashMap with key LOCALE) + PropertyMap properties = new PropertyMap(); - // bind to the bean - CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); - UserPreferencesBean userPreferencesBean = (UserPreferencesBean) FacesHelper.getManagedBean(context, "UserPreferencesBean"); + // Modification du casting de l objet r�cup�r� des getters de MLText en Text + MLPropertyInterceptor.setMLAware(true); - if (this.createFrom.equals("scratch")) - { - // create the space (just create a folder for now) - NodeRef nodeRef = this.browseBean.getDocument().getNodeRef(); - // Add aspect (PropertyMap is a extension of HashMap with key LOCALE) - PropertyMap properties = new PropertyMap(); + // MLText is a HashMap composed by key and description The Function addValue is the same that the function put() but the key is the Locale value + Serializable oTitle = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE); + Serializable oDescription = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); - // Modification du casting de l objet r�cup�r� des getters de MLText en Text - MLPropertyInterceptor.setMLAware(true); + if(oTitle instanceof MLText) + { + title = (MLText) oTitle; + } + else + { + title = new MLText(); + title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oTitle.toString()); + } - // MLText is a HashMap composed by key and description The Function addValue is the same that the function put() but the key is the Locale value - Serializable oTitle = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE); - Serializable oDescription = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); + if(oDescription instanceof MLText) + { + description = (MLText) oDescription; + } + else + { + description = new MLText(); + title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oDescription.toString()); + } + title.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getTitle()); + description.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getDescription()); - if(oTitle instanceof MLText) - { - title = (MLText) oTitle; - } - else - { - title = new MLText(); - title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oTitle.toString()); - } + properties.put(ContentModel.PROP_TITLE, title); + properties.put(ContentModel.PROP_DESCRIPTION, description); - - - if(oDescription instanceof MLText) - { - description = (MLText) oDescription; - } - else - { - description = new MLText(); - title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oDescription.toString()); - } - - title.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getTitle()); - description.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getDescription()); - - properties.put(ContentModel.PROP_TITLE, title); - properties.put(ContentModel.PROP_DESCRIPTION, description); - - - // Ajout de l'aspect multilingue sur le titre - this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, properties); -/* + // Ajout de l'aspect multilingue sur le titre + this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, properties); + /* MLText descriptionss = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); List sel = new ArrayList(); @@ -108,53 +104,51 @@ public class CreateMultilingualPropertiesWizard extends CreateSpaceWizard SelectItem[] items = new SelectItem[sel.size()]; sel.toArray(items); -*/ - // Modification du casting de l objet r�cup�r� des getters de MLText en Text - MLPropertyInterceptor.setMLAware(false); - } - else if (this.createFrom.equals("existing")) - { - } - else if (this.createFrom.equals("template")) - { - } - - - if (createMultilingualPropertiesBean.isAdd_new_properties()) - { - createMultilingualPropertiesBean.setTitle(""); - createMultilingualPropertiesBean.setDescription(""); - createMultilingualPropertiesBean.setAdd_new_properties(false); - - return "dialog:createMultilingualProperties"; - } - else - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; - } + */ + // Modification du casting de l objet r�cup�r� des getters de MLText en Text + MLPropertyInterceptor.setMLAware(false); } - - - /** - * @param preferences The UserPreferencesBean to set - */ - public void setUserPreferencesBean(UserPreferencesBean preferences) + else if (this.createFrom.equals("existing")) { - this.preferences = preferences; } - - /** - * - * @return the preferences of the user - */ - public UserPreferencesBean getUserPreferencesBean() + else if (this.createFrom.equals("template")) { - return preferences; } + if (createMultilingualPropertiesBean.isAdd_new_properties()) + { + createMultilingualPropertiesBean.setTitle(""); + createMultilingualPropertiesBean.setDescription(""); + createMultilingualPropertiesBean.setAdd_new_properties(false); - /** The user preferences bean reference */ - protected UserPreferencesBean preferences; - protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; + return "dialog:createMultilingualProperties"; + } + else + { + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; + } + } + + /** + * @param preferences The UserPreferencesBean to set + */ + public void setUserPreferencesBean(UserPreferencesBean preferences) + { + this.preferences = preferences; + } + + /** + * + * @return the preferences of the user + */ + public UserPreferencesBean getUserPreferencesBean() + { + return preferences; + } + + + /** The user preferences bean reference */ + protected UserPreferencesBean preferences; + protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; } diff --git a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceDialog.java b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceDialog.java index 9f1b4a942d..d683ef95b9 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceDialog.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceDialog.java @@ -32,64 +32,58 @@ import org.alfresco.web.bean.CreateMultilingualPropertiesBean; public class CreateMultilingualSpaceDialog extends CreateMultilingualSpaceWizard { - // ------------------------------------------------------------------------------ - // Wizard implementation + // ------------------------------------------------------------------------------ + // Wizard implementation - @Override - public String getFinishButtonLabel() + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space"); + } + + @Override + protected String getDefaultCancelOutcome() + { + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + + @Override + protected String getDefaultFinishOutcome() + { + return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + } + + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // do nothing by default, subclasses can override if necessary + if(isEdit()) { - return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space"); + return "dialog:createMultilingualProperties"; } - - @Override - protected String getDefaultCancelOutcome() + else { return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; } + } - @Override - protected String getDefaultFinishOutcome() - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } + public void setCreateMultilingualPropertiesBean(CreateMultilingualPropertiesBean x) + { + this.createMultilingualPropertiesBean = x; + } + public boolean isEdit() + { + return this.edit; + } + public void setEdit(boolean x) + { + this.edit=x; + } - protected String doPostCommitProcessing(FacesContext context, String outcome) - { - // do nothing by default, subclasses can override if necessary - if(isEdit()) - { - return "dialog:createMultilingualProperties"; - } - else - { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; - } - } + private boolean edit; + public CreateMultilingualPropertiesBean getCreateMultilingualPropertiesBean(){return this.createMultilingualPropertiesBean;} - public void setCreateMultilingualPropertiesBean(CreateMultilingualPropertiesBean x) - { - this.createMultilingualPropertiesBean = x; - } - - public boolean isEdit() - { - return this.edit; - } - - public void setEdit(boolean x) - { - this.edit=x; - } - - - private boolean edit; - - public CreateMultilingualPropertiesBean getCreateMultilingualPropertiesBean(){return this.createMultilingualPropertiesBean;} - - protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; - -} - + protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; +} \ No newline at end of file diff --git a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceWizard.java index 50642e0311..3429494b8a 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateMultilingualSpaceWizard.java @@ -48,177 +48,167 @@ import org.alfresco.web.bean.UserPreferencesBean; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; - public class CreateMultilingualSpaceWizard extends CreateSpaceWizard { + protected boolean showOtherProperties = true; - protected boolean showOtherProperties = true; + /** + * @return Determines whether the edit properties dialog should be + * shown when this one ends + */ + public boolean isShowOtherProperties() + { + return this.showOtherProperties; + } + /** + * @param showOthers Sets whether the edit properties dialog is shown + */ + public void setShowOtherProperties(boolean showOthers) + { + this.showOtherProperties = showOthers; + } - /** - * @return Determines whether the edit properties dialog should be - * shown when this one ends - */ - public boolean isShowOtherProperties() + @Override + protected String finishImpl(FacesContext context, String outcome) throws Exception + { + String newSpaceId = null; + CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); + + if (this.createFrom.equals("scratch")) { - return this.showOtherProperties; + // create the space (just create a folder for now) + NodeRef parentNodeRef; + + String nodeId = this.navigator.getCurrentNodeId(); + + if (nodeId == null) + { + parentNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); + } + else + { + parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId); + } + + FileInfo fileInfo = fileFolderService.create(parentNodeRef, this.name, Repository.resolveToQName(this.spaceType)); + NodeRef nodeRef = fileInfo.getNodeRef(); + newSpaceId = nodeRef.getId(); + + // apply the uifacets aspect - icon, title and description props + Map uiFacetsProps = new HashMap(2, 1.0f); + + uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon); + // uiFacetsProps.put(ContentModel.PROP_TITLE, this.title); + // uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); + + // Ajout de l icone + this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); + + Locale language = I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()); + + this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, new MLText(language, this.title)); + this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, new MLText(language, this.description)); + + // remember the created node + this.createdNode = nodeRef; + // Passer le noeud en parametre afin de le recuperer dans un autre dialogue + this.browseBean.setDocument(new Node(this.createdNode)); + + setTitle(""); + setDescription(""); + setName(""); + } + else if (this.createFrom.equals("existing")) + { + // copy the selected space and update the name, description and icon + NodeRef sourceNode = this.existingSpaceId; + NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); + + // copy from existing + NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); + + Locale usrLocale = I18NUtil.parseLocale(getUserPreferencesBean().getContentFilterLanguage()); + + // also need to set the new title, description and icon properties + + this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, new MLText(usrLocale, this.title)); + this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, new MLText(usrLocale, this.description)); + this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); + + newSpaceId = copiedNode.getId(); + + // remember the created node + this.createdNode = copiedNode; + } + else if (this.createFrom.equals("template")) + { + // copy the selected space and update the name, description and icon + NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); + NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); + + // copy from the template + NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); + // also need to set the new title, description and icon properties + this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); + this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); + this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); + + newSpaceId = copiedNode.getId(); + + // remember the created node + this.createdNode = copiedNode; } - /** - * @param showOthers Sets whether the edit properties dialog is shown - */ - public void setShowOtherProperties(boolean showOthers) + // if the user selected to save the space as a template space copy the new + // space to the templates folder + if (this.saveAsTemplate) { - this.showOtherProperties = showOthers; + // get hold of the Templates node + DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null); + namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI); + + String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" + + Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" + + Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance()); + + NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); + List templateNodeList = this.searchService.selectNodes( + rootNodeRef, + xpath, null, namespacePrefixResolver, false); + if (templateNodeList.size() == 1) + { + // get the first item in the list as we from test above there is only one! + NodeRef templateNode = templateNodeList.get(0); + NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), newSpaceId); + // copy this to the template location + fileFolderService.copy(sourceNode, templateNode, this.templateName); + } } + return outcome; + } - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - String newSpaceId = null; - CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); + /** + * @param preferences The UserPreferencesBean to set + */ + public void setUserPreferencesBean(UserPreferencesBean preferences) + { + this.preferences = preferences; + } + + /** + * + * @return the preferences of the user + */ + public UserPreferencesBean getUserPreferencesBean() + { + return preferences; + } - if (this.createFrom.equals("scratch")) - { - // create the space (just create a folder for now) - NodeRef parentNodeRef; - - String nodeId = this.navigator.getCurrentNodeId(); - - if (nodeId == null) - { - parentNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - } - else - { - parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId); - } - - - FileInfo fileInfo = fileFolderService.create(parentNodeRef, this.name, Repository.resolveToQName(this.spaceType)); - NodeRef nodeRef = fileInfo.getNodeRef(); - newSpaceId = nodeRef.getId(); - - // apply the uifacets aspect - icon, title and description props - Map uiFacetsProps = new HashMap(5); - - uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon); - // uiFacetsProps.put(ContentModel.PROP_TITLE, this.title); - // uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description); - - - // Ajout de l icone - this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps); - - Locale language = I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()); - - this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, new MLText(language, this.title)); - this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, new MLText(language, this.description)); - - - // remember the created node - this.createdNode = nodeRef; - // Passer le noeud en parametre afin de le recuperer dans un autre dialogue - this.browseBean.setDocument(new Node(this.createdNode)); - - setTitle(""); setDescription(""); setName(""); - } - else if (this.createFrom.equals("existing")) - { - // copy the selected space and update the name, description and icon - NodeRef sourceNode = this.existingSpaceId; - NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); - - // copy from existing - NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); - - Locale usrLocale = I18NUtil.parseLocale(getUserPreferencesBean().getContentFilterLanguage()); - - // also need to set the new title, description and icon properties - - this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, new MLText(usrLocale, this.title)); - this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, new MLText(usrLocale, this.description)); - this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); - - newSpaceId = copiedNode.getId(); - - // remember the created node - this.createdNode = copiedNode; - } - else if (this.createFrom.equals("template")) - { - // copy the selected space and update the name, description and icon - NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); - NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId()); - - // copy from the template - NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef(); - // also need to set the new title, description and icon properties - this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title); - this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description); - this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon); - - newSpaceId = copiedNode.getId(); - - - // remember the created node - this.createdNode = copiedNode; - } - - // if the user selected to save the space as a template space copy the new - // space to the templates folder - if (this.saveAsTemplate) - { - // get hold of the Templates node - DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null); - namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI); - - String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" + - Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" + - Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance()); - - NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef()); - List templateNodeList = this.searchService.selectNodes( - rootNodeRef, - xpath, null, namespacePrefixResolver, false); - if (templateNodeList.size() == 1) - { - // get the first item in the list as we from test above there is only one! - NodeRef templateNode = templateNodeList.get(0); - NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), newSpaceId); - // copy this to the template location - fileFolderService.copy(sourceNode, templateNode, this.templateName); - } - } - - - return outcome; - } - - - /** - * @param preferences The UserPreferencesBean to set - */ - public void setUserPreferencesBean(UserPreferencesBean preferences) - { - this.preferences = preferences; - } - - /** - * - * @return the preferences of the user - */ - public UserPreferencesBean getUserPreferencesBean() - { - return preferences; - } - - - - /** The user preferences bean reference */ - protected UserPreferencesBean preferences; - protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; + /** The user preferences bean reference */ + protected UserPreferencesBean preferences; + protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; } diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index 75d2516bef..465d680683 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -249,7 +249,8 @@ public class CreateSpaceWizard extends BaseWizardBean } } - setTitle(""); setDescription(""); + setTitle(""); + setDescription(""); return outcome; } diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index 8dab8f9005..78707af2ac 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -1,6 +1,6 @@ <%-- * Copyright (C) 2005-2007 Alfresco Software Limited. - + * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -15,11 +15,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" --%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> @@ -39,44 +39,44 @@ <% FacesContext fc = FacesContext.getCurrentInstance(); - + // set locale for JSF framework usage fc.getViewRoot().setLocale(Application.getLanguage(fc)); %> - + <%-- 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 --%>
- + <%-- Status and Actions inner contents table --%> <%-- Generally this consists of an icon, textual summary and actions for the current object --%> @@ -101,7 +101,7 @@
- + <%-- Navigation --%> - + <%-- separator row with gradient shadow --%> - + <%-- Error Messages --%> - + <%-- Details --%> @@ -169,9 +169,9 @@
@@ -117,24 +117,24 @@
- <%-- messages tag to show messages not handled by other specific message tags --%> + <%-- messages tag to show messages not handled by other specific message tags --%>
- +
- + @@ -200,9 +200,9 @@
- +
- + @@ -235,13 +235,13 @@
<%-- properties for the doc --%> - - @@ -272,7 +272,7 @@
- @@ -281,97 +281,93 @@ - +
- - <%-- Multlingual properties --%> - + + <%-- Multlingual properties --%> + - - - <%-- Panel if the node has the multinlingual aspect--%> - + + <%-- Panel if the node has the multinlingual aspect--%> + - - <%-- properties for Ml container --%> -
- -
- - +
+ +
+ + - - -
- - + + - -
- <%-- list of translations --%> - - - <%-- Icon details view mode --%> - - - - - - - - <%-- Name columns --%> - - - - - - - - <%-- Language columns --%> - - - - - - - - <%-- view actions --%> - - - - - - - - - -
+ +
+ <%-- list of translations --%> + + + <%-- Name and icon columns --%> + + + + + + + + + + + <%-- Language columns --%> + + + + + + + + <%-- view actions --%> + + + + + + + + + +
<%-- Actions add translation --%>
- + - +
-
- <%-- Panel if the node has not the multinlingual aspect--%> - + + <%-- Panel if the node has not the multinlingual aspect--%> + <%-- Actions add translation --%> @@ -383,13 +379,13 @@ - +
- @@ -398,11 +394,11 @@ - + - +
- + @@ -414,33 +410,33 @@ - - - - +
- + - - - + <%-- Primary column for details view mode --%> @@ -448,7 +444,7 @@ - + <%-- Version notes columns --%> @@ -456,7 +452,7 @@ - + <%-- Description columns --%> @@ -464,7 +460,7 @@ - + <%-- Created Date column for details view mode --%> @@ -474,7 +470,7 @@
- + <%-- view the contents of the specific version --%> @@ -482,7 +478,7 @@ - + @@ -493,14 +489,14 @@ - + - + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %> @@ -510,9 +506,9 @@
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %> - +
- + <%-- Document Actions --%> @@ -524,21 +520,21 @@ - + <%-- separator row with bottom panel graphics --%> - + - +
- +
\ No newline at end of file diff --git a/source/web/jsp/ml/ml-container-details.jsp b/source/web/jsp/ml/ml-container-details.jsp index 6a482fec32..6a5cdfcef6 100644 --- a/source/web/jsp/ml/ml-container-details.jsp +++ b/source/web/jsp/ml/ml-container-details.jsp @@ -166,10 +166,10 @@ - + - <%-- Name Columns --%> + <%-- Name Columns --%> diff --git a/source/web/jsp/spaces/ml/create-multilingual-properties-dialog.jsp b/source/web/jsp/spaces/ml/create-multilingual-properties-dialog.jsp index 12ec1e1726..5c002dda16 100644 --- a/source/web/jsp/spaces/ml/create-multilingual-properties-dialog.jsp +++ b/source/web/jsp/spaces/ml/create-multilingual-properties-dialog.jsp @@ -63,14 +63,14 @@ function validate() - - @@ -84,13 +84,13 @@ function validate() - @@ -107,41 +107,27 @@ function validate() - -
-
+
+ - + + <%-- existing properties --%> - +
- + <%-- existing properties --%> - +
- -
- - - - + + + - - - - - - - +
- - - + \ No newline at end of file diff --git a/source/web/jsp/spaces/ml/create-multilingual-space-dialog.jsp b/source/web/jsp/spaces/ml/create-multilingual-space-dialog.jsp index bad6dae316..7140344c29 100644 --- a/source/web/jsp/spaces/ml/create-multilingual-space-dialog.jsp +++ b/source/web/jsp/spaces/ml/create-multilingual-space-dialog.jsp @@ -32,47 +32,45 @@ @@ -136,38 +134,30 @@ onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState() - - - - + - - - - - -
- - - - - + + + + +
+ + + + + +
- - +
+ + - -
+ - - - - - - + \ No newline at end of file