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> <param name="id">#{actionContext.id}</param>
</params> </params>
</action> </action>
<!-- Edit document action to open using normal HTTP access or inline Edit if set --> <!-- Edit document action to open using normal HTTP access or inline Edit if set -->
<action id="edit_doc_http"> <action id="edit_doc_http">
<permissions> <permissions>

View File

@@ -14,7 +14,7 @@
icon="/images/icons/make_ml_large.gif" title-id="make_multilingual" icon="/images/icons/make_ml_large.gif" title-id="make_multilingual"
description-id="make_multilingual_description" error-message-id="error_make_multilingual_dialog" /> 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" <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" 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" /> description-id="add_translation_wc_description" error-message-id="error_add_translation_wc_dialog" />
@@ -29,7 +29,7 @@
<!-- Content and Space Dialogs --> <!-- Content and Space Dialogs -->
<!-- Definition of the create space dialog --> <!-- 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" icon="/images/icons/create_space_large.gif" title-id="create_space"
description-id="create_space_description" error-message-id="error_create_space_dialog" /> 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" 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" /> 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" <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" 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" /> 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" title-id="create_web_content_title" description-id="create_web_content_desc"
icon="/images/icons/new_content_large.gif"> icon="/images/icons/new_content_large.gif">
<step name="details" <step name="details"
title-id="create_web_content_details_title" title-id="create_web_content_details_title"
description-id="create_content_step1_desc"> description-id="create_content_step1_desc">
<page path="/jsp/wcm/create-web-content-wizard/details.jsp" <page path="/jsp/wcm/create-web-content-wizard/details.jsp"
title-id="create_web_content_details_step_title" title-id="create_web_content_details_step_title"
description-id="create_content_step1_desc" description-id="create_content_step1_desc"
instruction-id="default_instruction" /> instruction-id="default_instruction" />
</step> </step>
<step name="content" <step name="content"
title-id="create_web_content_enter_content_title" title-id="create_web_content_enter_content_title"
description-id="create_content_step2_desc"> description-id="create_content_step2_desc">
<condition if="#{CreateWebContentWizard.mimeType == 'text/html'}"> <condition if="#{CreateWebContentWizard.mimeType == 'text/html'}">
<page path="/jsp/wcm/create-web-content-wizard/create-html.jsp" <page path="/jsp/wcm/create-web-content-wizard/create-html.jsp"
title-id="create_web_content_enter_content_step_title" title-id="create_web_content_enter_content_step_title"
@@ -338,11 +338,11 @@
</step> </step>
<step name="summary" title-id="summary" description-id="summary_step_description"> <step name="summary" title-id="summary" description-id="summary_step_description">
<condition if="#{CreateWebContentWizard.mimeType == 'text/xml'}"> <condition if="#{CreateWebContentWizard.mimeType == 'text/xml'}">
<page path="/jsp/wcm/create-web-content-wizard/summary.jsp" <page path="/jsp/wcm/create-web-content-wizard/summary.jsp"
title-id="summary" title-id="summary"
description-id="create_web_content_summary_desc" description-id="create_web_content_summary_desc"
instruction-id="content_finish_instruction" /> instruction-id="content_finish_instruction" />
</condition> </condition>
<page path="/jsp/wizard/summary.jsp" <page path="/jsp/wizard/summary.jsp"
title-id="summary" title-id="summary"
description-id="summary_desc" description-id="summary_desc"
@@ -473,4 +473,3 @@
</config> </config>
</alfresco-config> </alfresco-config>

View File

@@ -42,183 +42,189 @@ import org.alfresco.web.app.servlet.FacesHelper;
public class CreateMultilingualPropertiesBean public class CreateMultilingualPropertiesBean
{ {
/** binding with edit of Other Options */ /** binding with edit of Other Options */
private String language = null; private String language = null;
private String newlanguage = null; private String newlanguage = null;
private String title = null; private String title = null;
private String description = null; private String description = null;
protected boolean add_new_properties = false; protected boolean add_new_properties = false;
/** The NodeService to be used by the bean */ /** The NodeService to be used by the bean */
protected NodeService nodeService; protected NodeService nodeService;
/** The user preferences bean reference */ /** The user preferences bean reference */
protected UserPreferencesBean preferences; protected UserPreferencesBean preferences;
/** /**
* @param nodeService The NodeService to set. * @param nodeService The NodeService to set.
*/ */
public void setNodeService(NodeService nodeService) 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)
{ {
List<SelectItem> sel = new ArrayList<SelectItem>(); this.nodeService = nodeService;
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
public String getLanguage()
{ {
SelectItem[] elements = { new SelectItem("")}; return elements; return this.language;
} }
}
// Display the list of all multilingual properties public void setLanguage(String x)
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>(); this.language = x;
Application.setLanguage(FacesContext.getCurrentInstance(), this.language);
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
public void setNewlanguage(String x)
{ {
SelectItem[] elements = { new SelectItem("","")}; return elements; this.newlanguage = x;
} }
}
public SelectItem[] getContentFilterLanguages() public String getNewlanguage()
{ {
return preferences.getContentFilterLanguages(false); return this.newlanguage;
} }
public boolean isAdd_new_properties() {return this.add_new_properties;}
public void setAdd_new_properties(boolean x){this.add_new_properties = x;} 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)) 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) if (translationsMap != null && translationsMap.size() > 0)
{ {
@@ -282,7 +281,7 @@ public class DocumentDetailsBean extends BaseDetailsBean
String lgge = (locale != null) ? String lgge = (locale != null) ?
// convert the locale into new ISO codes // convert the locale into new ISO codes
contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase() contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase()
: null ; : null;
mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
mapNode.put("language", lgge); mapNode.put("language", lgge);
@@ -789,7 +788,6 @@ public class DocumentDetailsBean extends BaseDetailsBean
return new Node(multilingualContentService.getTranslationContainer(nodeRef)); return new Node(multilingualContentService.getTranslationContainer(nodeRef));
} }
/** /**
* Sets the lock service instance the bean should use * Sets the lock service instance the bean should use
* *
@@ -824,9 +822,9 @@ public class DocumentDetailsBean extends BaseDetailsBean
* @param multilingualContentService the multilingualContentService to set * @param multilingualContentService the multilingualContentService to set
*/ */
public void setMultilingualContentService( 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) 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 class AddTranslationWithoutContentDialog extends BaseDialogBean
{ {
public static String LOCALE_REGEX = "%locale%"; public static String LOCALE_REGEX = "%locale%";
public static String EMPTY_DOCUMENT_EXTENSION = "." + LOCALE_REGEX + "_properties"; public static String EMPTY_DOCUMENT_EXTENSION = "." + LOCALE_REGEX + "_properties";
@@ -65,7 +64,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean
private String language; private String language;
@Override @Override
public void init(Map<String, String> parameters) public void init(Map<String, String> parameters)
{ {
@@ -76,7 +74,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean
description = null; description = null;
author = null; author = null;
language = null; language = null;
} }
@Override @Override
@@ -133,7 +130,6 @@ public class AddTranslationWithoutContentDialog extends BaseDialogBean
this.multilingualContentService = multilingualContentService; this.multilingualContentService = multilingualContentService;
} }
/** /**
* @return the author * @return the author
*/ */

View File

@@ -45,7 +45,6 @@ import org.alfresco.web.bean.repository.Node;
*/ */
public class AddTranslationlDialog extends AddContentDialog public class AddTranslationlDialog extends AddContentDialog
{ {
private MultilingualContentService multilingualContentService; private MultilingualContentService multilingualContentService;
private UserPreferencesBean userPreferencesBean; private UserPreferencesBean userPreferencesBean;
@@ -58,6 +57,7 @@ public class AddTranslationlDialog extends AddContentDialog
// languages available in the ML container yet // languages available in the ML container yet
private SelectItem[] unusedLanguages; private SelectItem[] unusedLanguages;
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.web.bean.content.AddContentDialog#init(java.util.Map) * @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()); setMlContainer(this.browseBean.getDocument().getNodeRef());
setFileName(null); setFileName(null);
unusedLanguages = null; unusedLanguages = null;
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -79,7 +78,6 @@ public class AddTranslationlDialog extends AddContentDialog
@Override @Override
protected String finishImpl(FacesContext context, String outcome) throws Exception protected String finishImpl(FacesContext context, String outcome) throws Exception
{ {
// add the new file to the repository // add the new file to the repository
outcome = super.finishImpl(context, outcome); outcome = super.finishImpl(context, outcome);
@@ -94,7 +92,6 @@ public class AddTranslationlDialog extends AddContentDialog
@Override @Override
protected String getDefaultFinishOutcome() protected String getDefaultFinishOutcome()
{ {
return "showDocDetails"; return "showDocDetails";
} }
@@ -139,7 +136,7 @@ public class AddTranslationlDialog extends AddContentDialog
* Set the Multilingual container where the translation will be associated. * Set the Multilingual container where the translation will be associated.
* *
* @param mlContainer mlContainer is a MLDocument, the the MLContainer will * @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) public void setMlContainer(NodeRef mlContainer)
{ {
@@ -149,15 +146,17 @@ public class AddTranslationlDialog extends AddContentDialog
{ {
type = nodeService.getType(mlContainer); type = nodeService.getType(mlContainer);
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type)){ if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type))
{
this.mlContainer = mlContainer; this.mlContainer = mlContainer;
} }
else if(ContentModel.TYPE_CONTENT.equals(type) else if (ContentModel.TYPE_CONTENT.equals(type)
&& nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)){ && nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer); this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer);
} }
else{ else
{
this.mlContainer = null; this.mlContainer = null;
} }
} }
@@ -179,7 +178,6 @@ public class AddTranslationlDialog extends AddContentDialog
public SelectItem[] getUnusedLanguages() public SelectItem[] getUnusedLanguages()
{ {
if(unusedLanguages == null) if(unusedLanguages == null)
{ {
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false); unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false);
@@ -189,15 +187,15 @@ public class AddTranslationlDialog extends AddContentDialog
} }
public MultilingualContentService getMultilingualContentService() public MultilingualContentService getMultilingualContentService()
{ {
return multilingualContentService; return multilingualContentService;
} }
public void setMultilingualContentService( public void setMultilingualContentService(
MultilingualContentService multilingualContentService) MultilingualContentService multilingualContentService)
{ {
this.multilingualContentService = multilingualContentService; this.multilingualContentService = multilingualContentService;
} }
public UserPreferencesBean getUserPreferencesBean() public UserPreferencesBean getUserPreferencesBean()
{ {

View File

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

View File

@@ -46,213 +46,215 @@ import org.alfresco.web.bean.repository.Node;
*/ */
public class MakeMultilingualDialog extends BaseDialogBean 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 */ // The author is a mandatory properties
public static final String OPT_ADD_WITH_CONTENT = "ADD_WITH_CONTENT"; private String author;
/** 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 // The langage of the node to make multilingual
private String author; private String language;
// The langage of the node to make multilingual // set to true, a new translation will be added at the end of this dialog
private String language; private boolean addTranslationAfter = true;
// set to true, a new translation will be added at the end of this dialog // set if the new translation to add will be an empty document or not
private boolean addTranslationAfter = true; private String addingMode = OPT_ADD_WITH_CONTENT;
// set if the new translation to add will be an empty document or not // the node to edit
private String addingMode = OPT_ADD_WITH_CONTENT; protected Node editableNode;
// 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);
}
// ------------------------------------------------------------------------------ @Override
// Bean getters and setters public void init(Map<String, String> parameters)
{
super.init(parameters);
/** // setup the editable node
* Returns the node being edited this.editableNode = initEditableNode();
*
* @return The node being edited
*/
public Node getEditableNode()
{
return this.editableNode;
}
/** NodeRef nodeRef = this.editableNode.getNodeRef();
* @return the author of the new created MLContainer
*/
public String getAuthor()
{
return author;
}
/** // propose the author and the language of the content for the properties of the MLContainer
* @param author the author of new created MLContainer if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true
*/ && this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null)
public void setAuthor(String author) {
{ setAuthor((String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR));
this.author = author; }
} else
{
setAuthor("");
}
/** if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true
* @return if a new translation must be added after this dialog closes && this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE) != null)
*/ {
public boolean isAddTranslationAfter() setLanguage(((Locale) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString());
{ }
return addTranslationAfter; else
} {
setLanguage(null);
}
/** addTranslationAfter = false;
* @param addTranslationAfter set to true, a new translation will be added after this dialog closes addingMode = OPT_ADD_WITH_CONTENT;
*/ }
public void setAddTranslationAfter(boolean addTranslationAfter)
{ /**
this.addTranslationAfter = addTranslationAfter; * 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 // Bean getters and setters
*/
public String getLanguage()
{
return language;
}
/** /**
* @param language the language of the translation * Returns the node being edited
*/ *
public void setLanguage(String language) * @return The node being edited
{ */
this.language = language; public Node getEditableNode()
} {
return this.editableNode;
}
/** /**
* @param editableNode the node will become a multilingual * @return the author of the new created MLContainer
*/ */
public void setEditableNode(Node editableNode) public String getAuthor()
{ {
this.editableNode = editableNode; 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, * @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 * this mode defines if the translation will be an empty document or not
*/ */
public String getAddingMode() { public String getAddingMode()
{
return addingMode; 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, * @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 * 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; this.addingMode = addingMode;
} }
@@ -273,16 +276,13 @@ public class MakeMultilingualDialog extends BaseDialogBean
} }
public void setMultilingualContentService( public void setMultilingualContentService(
MultilingualContentService multilingualContentService) MultilingualContentService multilingualContentService)
{ {
this.multilingualContentService = multilingualContentService; this.multilingualContentService = multilingualContentService;
} }
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean) public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{ {
this.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.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
public class CreateMultilingualPropertiesDialog extends CreateMultilingualPropertiesWizard public class CreateMultilingualPropertiesDialog extends CreateMultilingualPropertiesWizard
{ {
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Wizard implementation // Wizard implementation
@Override @Override
public String getFinishButtonLabel() public String getFinishButtonLabel()
{ {
return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space"); return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space");
} }
@Override @Override
protected String getDefaultCancelOutcome() protected String getDefaultCancelOutcome()
{ {
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse"; return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
// return AlfrescoNavigationHandler.CLOSE_DIALOG_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;
}
@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 public class CreateMultilingualPropertiesWizard extends CreateSpaceWizard
{ {
@Override @Override
protected String finishImpl(FacesContext context, String outcome) throws Exception 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 // Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text
CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); MLPropertyInterceptor.setMLAware(true);
UserPreferencesBean userPreferencesBean = (UserPreferencesBean) FacesHelper.getManagedBean(context, "UserPreferencesBean");
if (this.createFrom.equals("scratch")) // 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);
// create the space (just create a folder for now) Serializable oDescription = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
// Add aspect (PropertyMap is a extension of HashMap with key LOCALE)
PropertyMap properties = new PropertyMap();
// Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text if(oTitle instanceof MLText)
MLPropertyInterceptor.setMLAware(true); {
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 if(oDescription instanceof MLText)
Serializable oTitle = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE); {
Serializable oDescription = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); 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) properties.put(ContentModel.PROP_TITLE, title);
{ properties.put(ContentModel.PROP_DESCRIPTION, description);
title = (MLText) oTitle;
}
else
{
title = new MLText();
title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oTitle.toString());
}
// Ajout de l'aspect multilingue sur le titre
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, properties);
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);
/*
MLText descriptionss = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION); MLText descriptionss = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
List<SelectItem> sel = new ArrayList(); List<SelectItem> sel = new ArrayList();
@@ -108,53 +104,51 @@ public class CreateMultilingualPropertiesWizard extends CreateSpaceWizard
SelectItem[] items = new SelectItem[sel.size()]; SelectItem[] items = new SelectItem[sel.size()];
sel.toArray(items); sel.toArray(items);
*/ */
// Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text // Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text
MLPropertyInterceptor.setMLAware(false); 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";
}
} }
else if (this.createFrom.equals("existing"))
/**
* @param preferences The UserPreferencesBean to set
*/
public void setUserPreferencesBean(UserPreferencesBean preferences)
{ {
this.preferences = preferences;
} }
else if (this.createFrom.equals("template"))
/**
*
* @return the preferences of the user
*/
public UserPreferencesBean getUserPreferencesBean()
{ {
return preferences;
} }
if (createMultilingualPropertiesBean.isAdd_new_properties())
{
createMultilingualPropertiesBean.setTitle("");
createMultilingualPropertiesBean.setDescription("");
createMultilingualPropertiesBean.setAdd_new_properties(false);
/** The user preferences bean reference */ return "dialog:createMultilingualProperties";
protected UserPreferencesBean preferences; }
protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean; 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 public class CreateMultilingualSpaceDialog extends CreateMultilingualSpaceWizard
{ {
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Wizard implementation // Wizard implementation
@Override @Override
public String getFinishButtonLabel() 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";
} }
else
@Override
protected String getDefaultCancelOutcome()
{ {
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
} }
}
@Override public void setCreateMultilingualPropertiesBean(CreateMultilingualPropertiesBean x)
protected String getDefaultFinishOutcome() {
{ this.createMultilingualPropertiesBean = x;
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; }
}
public boolean isEdit()
{
return this.edit;
}
public void setEdit(boolean x)
{
this.edit=x;
}
protected String doPostCommitProcessing(FacesContext context, String outcome) private boolean edit;
{
// do nothing by default, subclasses can override if necessary
if(isEdit())
{
return "dialog:createMultilingualProperties";
}
else
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}
public CreateMultilingualPropertiesBean getCreateMultilingualPropertiesBean(){return this.createMultilingualPropertiesBean;}
public void setCreateMultilingualPropertiesBean(CreateMultilingualPropertiesBean x) protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean;
{
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;
} }

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.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
public class CreateMultilingualSpaceWizard extends CreateSpaceWizard 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;
}
/** @Override
* @return Determines whether the edit properties dialog should be protected String finishImpl(FacesContext context, String outcome) throws Exception
* shown when this one ends {
*/ String newSpaceId = null;
public boolean isShowOtherProperties() 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;
} }
/** // if the user selected to save the space as a template space copy the new
* @param showOthers Sets whether the edit properties dialog is shown // space to the templates folder
*/ if (this.saveAsTemplate)
public void setShowOtherProperties(boolean showOthers)
{ {
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 * @param preferences The UserPreferencesBean to set
{ */
String newSpaceId = null; public void setUserPreferencesBean(UserPreferencesBean preferences)
CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean"); {
this.preferences = preferences;
}
/**
*
* @return the preferences of the user
*/
public UserPreferencesBean getUserPreferencesBean()
{
return preferences;
}
if (this.createFrom.equals("scratch")) /** The user preferences bean reference */
{ protected UserPreferencesBean preferences;
// create the space (just create a folder for now) protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean;
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;
} }

View File

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

View File

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

View File

@@ -166,10 +166,10 @@
<f:facet name="header"> <f:facet name="header">
<h:outputText value=""/> <h:outputText value=""/>
</f:facet> </f:facet>
<h:graphicImage url="/images/icons/space_small.gif" /> <h:graphicImage url="/images/filetypes/_default.gif" />
</a:column> </a:column>
<%-- Name Columns --%> <%-- Name Columns --%>
<a:column id="col21" width="300" style="text-align:left"> <a:column id="col21" width="300" style="text-align:left">
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="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%"> <table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr> <tr>
<td colspan="3" class="wizardSectionHeading"> <td colspan="4" class="wizardSectionHeading">
</f:verbatim> </f:verbatim>
<h:outputText value="#{msg.properties}" /> <h:outputText value="#{msg.properties}" />
<f:verbatim> <f:verbatim>
</td> </td>
</tr> </tr>
<tr> <tr>
<td > <td>
</f:verbatim> </f:verbatim>
<f:verbatim> <f:verbatim>
</td> </td>
@@ -84,13 +84,13 @@ function validate()
<h:inputText id="title" value="#{CreateMultilingualPropertiesBean.title}" size="35" maxlength="1024" onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" /> <h:inputText id="title" value="#{CreateMultilingualPropertiesBean.title}" size="35" maxlength="1024" onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim> <f:verbatim>
</td> </td>
<td> <td width=100%>
<f:verbatim> </f:verbatim>
<%-- existing properties --%> <%-- existing properties --%>
<h:selectOneMenu id="existingpropertiestitle" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" > <h:selectOneMenu id="existingpropertiestitle" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllTitlesProperties}" /> <f:selectItems value="#{CreateMultilingualPropertiesBean.listAllTitlesProperties}" />
</h:selectOneMenu> </h:selectOneMenu>
</f:verbatim> <f:verbatim>
</td> </td>
</tr> </tr>
@@ -107,41 +107,27 @@ function validate()
<f:verbatim> <f:verbatim>
</td> </td>
<td> <td>
<f:verbatim> </f:verbatim>
<%-- existing properties --%> <%-- existing properties --%>
<h:selectOneMenu id="existingproperties" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" > <h:selectOneMenu id="existingproperties" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllDescriptionsProperties}" /> <f:selectItems value="#{CreateMultilingualPropertiesBean.listAllDescriptionsProperties}" />
</h:selectOneMenu> </h:selectOneMenu>
</f:verbatim> <f:verbatim>
</td> </td>
</br>
</tr> </tr>
</table> </table>
</f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%"> <table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr> <tr>
<td colspan="3" style="padding-left:22px"> <td>
</f:verbatim>
<h:outputText value="#{msg.properties_close}:" />
<td style="padding-left" >
<h:selectBooleanCheckbox value="#{CreateMultilingualPropertiesBean.add_new_properties}" id="editnewproperties" /> <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" > <h:selectOneMenu id="newlanguage" immediate="true" value="#{CreateMultilingualPropertiesBean.newlanguage}" style="width:80px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" /> <f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" />
</h:selectOneMenu> </h:selectOneMenu>
<f:verbatim>
<h:outputText value=" " />
<h:outputText value="#{msg.properties_close}" />
</td> </td>
</tr> </tr>
</table> </table>
</f:verbatim>

View File

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