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
This commit is contained in:
Kevin Roast
2007-05-23 16:45:42 +00:00
parent 4e53d4b44d
commit e9e3fecbb9
18 changed files with 922 additions and 985 deletions

View File

@@ -103,6 +103,7 @@
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Edit document action to open using normal HTTP access or inline Edit if set -->
<action id="edit_doc_http">
<permissions>

View File

@@ -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" />
<!-- Definition of the add translation dialog dialog -->
<!-- Definition of the add translation dialog dialog -->
<dialog name="addTranslationWithoutContent" page="/jsp/ml/add-translation-without-content.jsp" managed-bean="AddTranslationWithoutContentDialog"
icon="/images/icons/add_tranlsation_wc_large.gif" title-id="add_translation_wc"
description-id="add_translation_wc_description" error-message-id="error_add_translation_wc_dialog" />
@@ -29,7 +29,7 @@
<!-- Content and Space Dialogs -->
<!-- Definition of the create space dialog -->
<dialog name="createSpace" page="/jsp/spaces/create-space-dialog.jsp" managed-bean="CreateMultilingualSpaceDialog"
<dialog name="createSpace" page="/jsp/spaces/create-space-dialog.jsp" managed-bean="CreateSpaceDialog"
icon="/images/icons/create_space_large.gif" title-id="create_space"
description-id="create_space_description" error-message-id="error_create_space_dialog" />
@@ -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" />
<!-- Definition of the create multilingual properties dialog -->
<!-- Definition of the create multilingual properties dialog -->
<dialog name="createMultilingualProperties" page="/jsp/spaces/ml/create-multilingual-properties-dialog.jsp" managed-bean="CreateMultilingualPropertiesDialog"
icon="/images/icons/create_space_large.gif" title-id="create_multilingual_space"
description-id="create_multilingual_space_description" error-message-id="error_create_multilingual_space_dialog" />

View File

@@ -308,16 +308,16 @@
title-id="create_web_content_title" description-id="create_web_content_desc"
icon="/images/icons/new_content_large.gif">
<step name="details"
title-id="create_web_content_details_title"
description-id="create_content_step1_desc">
title-id="create_web_content_details_title"
description-id="create_content_step1_desc">
<page path="/jsp/wcm/create-web-content-wizard/details.jsp"
title-id="create_web_content_details_step_title"
description-id="create_content_step1_desc"
instruction-id="default_instruction" />
</step>
<step name="content"
title-id="create_web_content_enter_content_title"
description-id="create_content_step2_desc">
title-id="create_web_content_enter_content_title"
description-id="create_content_step2_desc">
<condition if="#{CreateWebContentWizard.mimeType == 'text/html'}">
<page path="/jsp/wcm/create-web-content-wizard/create-html.jsp"
title-id="create_web_content_enter_content_step_title"
@@ -338,11 +338,11 @@
</step>
<step name="summary" title-id="summary" description-id="summary_step_description">
<condition if="#{CreateWebContentWizard.mimeType == 'text/xml'}">
<page path="/jsp/wcm/create-web-content-wizard/summary.jsp"
title-id="summary"
description-id="create_web_content_summary_desc"
instruction-id="content_finish_instruction" />
</condition>
<page path="/jsp/wcm/create-web-content-wizard/summary.jsp"
title-id="summary"
description-id="create_web_content_summary_desc"
instruction-id="content_finish_instruction" />
</condition>
<page path="/jsp/wizard/summary.jsp"
title-id="summary"
description-id="summary_desc"
@@ -473,4 +473,3 @@
</config>
</alfresco-config>

View File

@@ -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<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
for(Map.Entry<Locale, String> 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<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
for(Map.Entry<Locale, String> 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<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
for(Map.Entry<Locale, String> 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<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
for(Map.Entry<Locale, String> 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;
}
}

View File

@@ -265,8 +265,7 @@ public class DocumentDetailsBean extends BaseDetailsBean
if (getDocument().hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
Map<Locale, NodeRef> translationsMap = this.multilingualContentService.getTranslations(getDocument().getNodeRef());
Map<Locale, NodeRef> translationsMap = this.multilingualContentService.getTranslations(getDocument().getNodeRef());
if (translationsMap != null && translationsMap.size() > 0)
{
@@ -282,7 +281,7 @@ public class DocumentDetailsBean extends BaseDetailsBean
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);
@@ -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,9 +822,9 @@ public class DocumentDetailsBean extends BaseDetailsBean
* @param multilingualContentService the multilingualContentService to set
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
this.multilingualContentService = multilingualContentService;
}
/**
@@ -834,6 +832,6 @@ public class DocumentDetailsBean extends BaseDetailsBean
*/
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
}

View File

@@ -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<String, String> 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
*/

View File

@@ -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()
{

View File

@@ -43,7 +43,6 @@ import org.alfresco.web.bean.repository.Node;
*/
public class EditMLContainerDialog extends BaseDialogBean
{
MultilingualContentService multilingualContentService;
private Node editableNode;
@@ -54,7 +53,6 @@ public class EditMLContainerDialog extends BaseDialogBean
super.init(parameters);
this.editableNode = initEditableNode();
}
@Override
@@ -63,8 +61,6 @@ public class EditMLContainerDialog extends BaseDialogBean
return false;
}
@Override
public String getFinishButtonLabel()
{
@@ -88,7 +84,7 @@ public class EditMLContainerDialog extends BaseDialogBean
nodeService.setProperty(container, qname, (Serializable) entry.getValue());
}
return outcome;
return outcome;
}
/**
@@ -99,13 +95,14 @@ 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;
}
@@ -135,6 +132,4 @@ public class EditMLContainerDialog extends BaseDialogBean
MultilingualContentService multilingualContentService) {
this.multilingualContentService = multilingualContentService;
}
}

View File

@@ -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<String, String> 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<String, String> 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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<75>r<EFBFBD> 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<75>r<EFBFBD> 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<SelectItem> 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<75>r<EFBFBD> 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<75>r<EFBFBD> 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;
}

View File

@@ -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;
}

View File

@@ -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<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(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<NodeRef> 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<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(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<NodeRef> 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;
}

View File

@@ -249,7 +249,8 @@ public class CreateSpaceWizard extends BaseWizardBean
}
}
setTitle(""); setDescription("");
setTitle("");
setDescription("");
return outcome;
}

View File

@@ -285,93 +285,89 @@
<div style="padding:4px"></div>
<%-- Multlingual properties --%>
<h:panelGroup id="ml-props-panel-facets">
<h:panelGroup id="ml-props-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
<a:actionLink id="titleLinkMl" value="#{msg.modify}" showLink="false" image="/images/icons/edit_properties.gif"
action="dialog:editMlContainer" />
</r:permissionEvaluator>
</f:facet>
</h:panelGroup>
</h:panelGroup>
<%-- Panel if the node has the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" facetsId="ml-props-panel-facets" id="ml-info-panel" progressive="true"
<%-- Panel if the node has the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" facetsId="ml-props-panel-facets" id="ml-info-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" rendered="#{DocumentDetailsBean.multilingual}"
expanded='#{DocumentDetailsBean.panels["ml-info-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<%-- properties for Ml container --%>
<div style="padding:4px"></div>
<h:outputText value="#{msg.properties}" styleClass="nodeWorkflowInfoTitle" style="padding:20px;"/>
<div style="padding:4px"></div>
<%-- properties for Ml container --%>
<div style="padding:4px"></div>
<h:outputText value="#{msg.properties}" styleClass="nodeWorkflowInfoTitle" style="padding:20px;"/>
<div style="padding:4px"></div>
<r:propertySheetGrid id="ml-container-props-sheet" value="#{DocumentDetailsBean.documentMlContainer}"
<r:propertySheetGrid id="ml-container-props-sheet" value="#{DocumentDetailsBean.documentMlContainer}"
var="mlContainerProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" mode="view"/>
<div style="padding:8px"></div>
<div style="padding:8px"></div>
<a:panel label="#{msg.related_translations}" id="related-translation-panel" progressive="true"
<a:panel label="#{msg.related_translations}" id="related-translation-panel" progressive="true"
expanded='#{DocumentDetailsBean.panels["related-translation-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}" styleClass="nodeWorkflowInfoTitle">
<div style="padding:4px"></div>
<%-- list of translations --%>
<a:richList id="TranslationList" viewMode="details" value="#{DocumentDetailsBean.translations}"
var="r" styleClass="recordSet" headerStyleClass="recordSetHeader"
rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
pageSize="10" initialSortColumn="Name" initialSortDescending="false">
<div style="padding:4px"></div>
<%-- list of translations --%>
<a:richList id="TranslationList" viewMode="details" value="#{DocumentDetailsBean.translations}"
var="r" styleClass="recordSet" headerStyleClass="recordSetHeader"
rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
pageSize="10" initialSortColumn="Name" initialSortDescending="false">
<%-- Icon details view mode --%>
<a:column id="col20" primary="true" width="20" style="padding:2px;">
<f:facet name="header">
<h:outputText value=""/>
</f:facet>
<h:graphicImage url="/images/icons/space_small.gif" />
</a:column>
<%-- Name and icon columns --%>
<a:column id="col21" primary="true" width="300" style="text-align:left">
<f:facet name="small-icon">
<h:graphicImage url="/images/filetypes/_default.gif" width="16" height="16"/>
</f:facet>
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-name" value="#{r.name}" href="#{r.url}" target="new" />
</a:column>
<%-- Name columns --%>
<a:column id="col21" width="300" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-name" value="#{r.name}" href="#{r.url}" target="new" />
</a:column>
<%-- Language columns --%>
<a:column id="col22" width="50" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.language}" value="language" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-language" value="#{r.language}" href="#{r.url}" target="new" />
</a:column>
<%-- Language columns --%>
<a:column id="col22" width="50" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.language}" value="language" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-language" value="#{r.language}" href="#{r.url}" target="new" />
</a:column>
<%-- view actions --%>
<a:column id="col25" style="text-align: left">
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" />
</a:column>
<%-- view actions --%>
<a:column id="col25" style="text-align: left">
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" />
</a:column>
<a:dataPager styleClass="pager" />
</a:richList>
</a:panel>
<a:dataPager styleClass="pager" />
</a:richList>
</a:panel>
<%-- Actions add translation --%>
<table width="100%" cellspacing="2" cellpadding="15" border="0" align="center">
<tr>
<td>
<a:actionLink id="act-add-trans-with-c" value="#{msg.add_translation}" action="addTranslation" actionListener="#{AddTranslationDialog.start}" showLink="true" image="/images/icons/add_tranlsation.gif" />
<a:actionLink id="act-add-trans-with-c" value="#{msg.add_translation}" action="addTranslation" actionListener="#{AddTranslationDialog.start}" showLink="true" image="/images/icons/add_tranlsation.gif" />
</td>
<td>
<a:actionLink id="act-add-trans-without-c" value="#{msg.add_translation_wc}" action="dialog:addTranslationWithoutContent" showLink="true" image="/images/icons/add_tranlsation_wc.gif" />
<a:actionLink id="act-add-trans-without-c" value="#{msg.add_translation_wc}" action="dialog:addTranslationWithoutContent" showLink="true" image="/images/icons/add_tranlsation_wc.gif" />
</td>
</tr>
</table>
</a:panel>
<%-- Panel if the node has not the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" id="no-ml-info-panel" progressive="true"
</a:panel>
<%-- Panel if the node has not the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" id="no-ml-info-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white"
rendered="#{DetailsBean.multilingual == false}"
rendered="#{DocumentDetailsBean.multilingual == false}"
expanded='#{DocumentDetailsBean.panels["ml-info-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<h:outputText id="no-ml-msg" value="#{msg.not_multilingual}<br/><br/>" escape="false" />
<%-- Actions add translation --%>

View File

@@ -166,10 +166,10 @@
<f:facet name="header">
<h:outputText value=""/>
</f:facet>
<h:graphicImage url="/images/icons/space_small.gif" />
<h:graphicImage url="/images/filetypes/_default.gif" />
</a:column>
<%-- Name Columns --%>
<%-- Name Columns --%>
<a:column id="col21" width="300" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="header"/>

View File

@@ -63,14 +63,14 @@ function validate()
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" class="wizardSectionHeading">
<td colspan="4" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.properties}" />
<f:verbatim>
</td>
</tr>
<tr>
<td >
<td>
</f:verbatim>
<f:verbatim>
</td>
@@ -84,13 +84,13 @@ function validate()
<h:inputText id="title" value="#{CreateMultilingualPropertiesBean.title}" size="35" maxlength="1024" onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
<td>
<f:verbatim>
<td width=100%>
</f:verbatim>
<%-- existing properties --%>
<h:selectOneMenu id="existingpropertiestitle" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllTitlesProperties}" />
</h:selectOneMenu>
</f:verbatim>
<f:verbatim>
</td>
</tr>
@@ -107,41 +107,27 @@ function validate()
<f:verbatim>
</td>
<td>
<f:verbatim>
</f:verbatim>
<%-- existing properties --%>
<h:selectOneMenu id="existingproperties" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllDescriptionsProperties}" />
</h:selectOneMenu>
</f:verbatim>
<f:verbatim>
</td>
</br>
</tr>
</table>
</f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" style="padding-left:22px">
<td style="padding-left" >
<td>
</f:verbatim>
<h:outputText value="#{msg.properties_close}:" />
<h:selectBooleanCheckbox value="#{CreateMultilingualPropertiesBean.add_new_properties}" id="editnewproperties" />
<span style="vertical-align:20%"></span>
<h:outputText value=" " />
<h:selectOneMenu id="newlanguage" immediate="true" value="#{CreateMultilingualPropertiesBean.newlanguage}" style="width:80px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" />
</h:selectOneMenu>
<h:outputText value=" " />
<h:outputText value="#{msg.properties_close}" />
<f:verbatim>
</td>
</tr>
</table>
</f:verbatim>

View File

@@ -32,47 +32,45 @@
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
var retour = "";
var val = document.getElementById("dialog:dialog-body:name");
for(i=0;i < val.length;i++) if(val.charAt(i) != " ") {retour += val.charAt(i)}
return validateName(retour,
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
true);
}
else
{
return true;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
var retour = "";
var val = document.getElementById("dialog:dialog-body:name");
for(i=0;i < val.length;i++) if(val.charAt(i) != " ") {retour += val.charAt(i)}
return validateName(retour,
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>', true);
}
else
{
return true;
}
}
</script>
@@ -136,38 +134,30 @@ onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState()
<f:verbatim>
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
</f:verbatim>
<a:imagePickerRadioPanel id="space-icon" columns="6" spacing="4" value="#{DialogManager.bean.icon}"
panelBorder="greyround" panelBgcolor="#F5F5F5">
<a:listItems value="#{DialogManager.bean.icons}" />
</a:imagePickerRadioPanel>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
</f:verbatim>
<a:imagePickerRadioPanel id="space-icon" columns="6" spacing="4" value="#{DialogManager.bean.icon}"
panelBorder="greyround" panelBgcolor="#F5F5F5">
<a:listItems value="#{DialogManager.bean.icons}" />
</a:imagePickerRadioPanel>
<f:verbatim>
</td>
</tr>
</table>
</td>
</tr>
<td style="padding-left">
<h:outputText value="#{msg.properties_close}:" />
<h:outputText value=" " />
<tr>
<td></td><td colspan=2>
</f:verbatim>
<h:outputText value="#{msg.properties_close}:" style="padding-right:8px" />
<h:selectBooleanCheckbox value="#{CreateMultilingualSpaceDialog.edit}" id="Nedit" />
</td>
<td>
<h:selectOneMenu id="newlanguage" immediate="true" value="#{CreateMultilingualPropertiesBean.newlanguage}" style="width:80px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" />
</h:selectOneMenu>
</td>
</table>
<f:verbatim>
</td>
</tr>
</table>
</f:verbatim>