mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ML Authentication Issues:
- Everyone, including guest, gets explicit full rights to each new cm:mlContainer instance. - The MultilingualContentService better permission checks against the content nodes that go in and out of it. - Changed some of the API return values to be more explicit about whether the cm:mlContainer or cm:mlDocument is required. - Added explicit tests to ensure that even guest is able to manipulate the cm:mlContainer. ML Languages List: - The default value is now punted to the top of the list. Various neatening. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5816 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,10 +30,8 @@ import javax.faces.context.FacesContext;
|
|||||||
import javax.faces.model.SelectItem;
|
import javax.faces.model.SelectItem;
|
||||||
|
|
||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.web.bean.UserPreferencesBean;
|
import org.alfresco.web.bean.UserPreferencesBean;
|
||||||
import org.alfresco.web.bean.content.AddContentDialog;
|
import org.alfresco.web.bean.content.AddContentDialog;
|
||||||
import org.alfresco.web.bean.repository.Node;
|
import org.alfresco.web.bean.repository.Node;
|
||||||
@@ -49,7 +47,7 @@ public class AddTranslationlDialog extends AddContentDialog
|
|||||||
private UserPreferencesBean userPreferencesBean;
|
private UserPreferencesBean userPreferencesBean;
|
||||||
|
|
||||||
// the multilingual container where to add this translation
|
// the multilingual container where to add this translation
|
||||||
protected NodeRef mlContainer;
|
protected NodeRef mlTranslation;
|
||||||
|
|
||||||
// Locale of the new translation
|
// Locale of the new translation
|
||||||
private String language;
|
private String language;
|
||||||
@@ -67,7 +65,7 @@ public class AddTranslationlDialog extends AddContentDialog
|
|||||||
super.init(parameters);
|
super.init(parameters);
|
||||||
|
|
||||||
this.language = null;
|
this.language = null;
|
||||||
setMlContainer(this.browseBean.getDocument().getNodeRef());
|
this.mlTranslation = this.browseBean.getDocument().getNodeRef();
|
||||||
setFileName(null);
|
setFileName(null);
|
||||||
unusedLanguages = null;
|
unusedLanguages = null;
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,7 @@ public class AddTranslationlDialog extends AddContentDialog
|
|||||||
outcome = super.finishImpl(context, outcome);
|
outcome = super.finishImpl(context, outcome);
|
||||||
|
|
||||||
// add a new translation
|
// add a new translation
|
||||||
multilingualContentService.addTranslation(this.createdNode, this.mlContainer, I18NUtil.parseLocale(this.language));
|
multilingualContentService.addTranslation(this.createdNode, this.mlTranslation, I18NUtil.parseLocale(this.language));
|
||||||
|
|
||||||
this.browseBean.setDocument(new Node(this.createdNode));
|
this.browseBean.setDocument(new Node(this.createdNode));
|
||||||
|
|
||||||
@@ -124,44 +122,6 @@ public class AddTranslationlDialog extends AddContentDialog
|
|||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the Multilingual container where the translation will be associated
|
|
||||||
*/
|
|
||||||
public NodeRef getMlContainer()
|
|
||||||
{
|
|
||||||
return mlContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public void setMlContainer(NodeRef mlContainer)
|
|
||||||
{
|
|
||||||
QName type = null;
|
|
||||||
|
|
||||||
if(mlContainer != null)
|
|
||||||
{
|
|
||||||
type = nodeService.getType(mlContainer);
|
|
||||||
|
|
||||||
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type))
|
|
||||||
{
|
|
||||||
this.mlContainer = mlContainer;
|
|
||||||
}
|
|
||||||
else if (ContentModel.TYPE_CONTENT.equals(type)
|
|
||||||
&& nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
|
||||||
{
|
|
||||||
this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.mlContainer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param unusedLanguages
|
* @param unusedLanguages
|
||||||
*/
|
*/
|
||||||
@@ -180,7 +140,7 @@ public class AddTranslationlDialog extends AddContentDialog
|
|||||||
{
|
{
|
||||||
if(unusedLanguages == null)
|
if(unusedLanguages == null)
|
||||||
{
|
{
|
||||||
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false);
|
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(this.mlTranslation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return unusedLanguages;
|
return unusedLanguages;
|
||||||
|
@@ -120,15 +120,13 @@ public class MakeMultilingualDialog extends BaseDialogBean
|
|||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
Locale loc = I18NUtil.parseLocale(getLanguage());
|
Locale locale = I18NUtil.parseLocale(getLanguage());
|
||||||
|
|
||||||
NodeRef nodeRef = this.editableNode.getNodeRef();
|
NodeRef nodeRef = this.editableNode.getNodeRef();
|
||||||
|
|
||||||
// make this node multilingual
|
// make this node multilingual
|
||||||
NodeRef mlContainer = multilingualContentService.makeTranslation(nodeRef, loc);
|
multilingualContentService.makeTranslation(nodeRef, locale);
|
||||||
|
NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef);
|
||||||
// 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
|
// if the author of the node is not set, set it with the default author name of
|
||||||
// the new ML Container
|
// the new ML Container
|
||||||
@@ -138,7 +136,6 @@ public class MakeMultilingualDialog extends BaseDialogBean
|
|||||||
|
|
||||||
// set properties of the ml container
|
// set properties of the ml container
|
||||||
nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor());
|
nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor());
|
||||||
nodeService.setProperty(mlContainer, ContentModel.PROP_LOCALE, getLanguage());
|
|
||||||
|
|
||||||
return outcome;
|
return outcome;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user