mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALFCOM-2306
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12692 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,7 +38,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
import javax.faces.context.ResponseWriter;
|
|
||||||
import javax.faces.event.ActionEvent;
|
import javax.faces.event.ActionEvent;
|
||||||
import javax.transaction.UserTransaction;
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
@@ -1728,7 +1727,7 @@ public class BrowseBean implements IContextListener, Serializable
|
|||||||
Node node = getActionSpace();
|
Node node = getActionSpace();
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc));
|
NodeRef companyRootRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc));
|
||||||
if (node.getNodeRef().equals(companyRootRef))
|
if (node.getNodeRef().equals(companyRootRef))
|
||||||
{
|
{
|
||||||
@@ -1767,13 +1766,13 @@ public class BrowseBean implements IContextListener, Serializable
|
|||||||
|
|
||||||
// remember the bean from wich the action comes
|
// remember the bean from wich the action comes
|
||||||
DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsDialog");
|
DocumentDetailsDialog docDetails = (DocumentDetailsDialog)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsDialog");
|
||||||
docDetails.setTranslationDocument(new Node(translation));
|
docDetails.setTranslationDocument(new MapNode(translation));
|
||||||
|
|
||||||
// set the ml container as the current document
|
// set the ml container as the current document
|
||||||
NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(translation);
|
NodeRef mlContainer = getMultilingualContentService().getTranslationContainer(translation);
|
||||||
|
|
||||||
setupContentAction(mlContainer.getId(), true);
|
setupContentAction(mlContainer.getId(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public helper to setup action pages with content context
|
* Public helper to setup action pages with content context
|
||||||
|
@@ -57,280 +57,278 @@ import org.alfresco.web.ui.common.component.UIPanel.ExpandedEvent;
|
|||||||
|
|
||||||
public class MultilingualManageDialog extends BaseDialogBean
|
public class MultilingualManageDialog extends BaseDialogBean
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 4168804472130450812L;
|
private static final long serialVersionUID = 4168804472130450812L;
|
||||||
|
|
||||||
private final String MSG_MANAGE_DETAILS_FOR="manage_multilingual_details_for";
|
private final String MSG_MANAGE_DETAILS_FOR="manage_multilingual_details_for";
|
||||||
private static final String MSG_CURRENT = "current";
|
private static final String MSG_CURRENT = "current";
|
||||||
private static final String ML_VERSION_PANEL_ID = "ml-versions-panel";
|
private static final String ML_VERSION_PANEL_ID = "ml-versions-panel";
|
||||||
private static final String MSG_CLOSE = "close";
|
private static final String MSG_CLOSE = "close";
|
||||||
|
|
||||||
protected Map<String, Boolean> panels = new HashMap<String, Boolean>(4, 1.0f);
|
protected Map<String, Boolean> panels = new HashMap<String, Boolean>(4, 1.0f);
|
||||||
|
|
||||||
transient private MultilingualContentService multilingualContentService;
|
transient private MultilingualContentService multilingualContentService;
|
||||||
transient private ContentFilterLanguagesService contentFilterLanguagesService;
|
transient private ContentFilterLanguagesService contentFilterLanguagesService;
|
||||||
transient private EditionService editionService;
|
transient private EditionService editionService;
|
||||||
transient private VersionService versionService;
|
transient private VersionService versionService;
|
||||||
|
|
||||||
private Node translationDocument;
|
private Node translationDocument;
|
||||||
|
|
||||||
/** For the client side iteration on the edition hitories list, it represents the index of the list */
|
/** For the client side iteration on the edition hitories list, it represents the index of the list */
|
||||||
private int currentEditionCursorPosition;
|
private int currentEditionCursorPosition;
|
||||||
|
|
||||||
/** List of client light weight edition histories */
|
/** List of client light weight edition histories */
|
||||||
private List<SingleEditionBean> editionHistory = null;
|
private List<SingleEditionBean> editionHistory = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the document this bean is currently representing
|
* Returns the document this bean is currently representing
|
||||||
*
|
*
|
||||||
* @return The document Node
|
* @return The document Node
|
||||||
*/
|
*/
|
||||||
public Node getDocument()
|
public Node getDocument()
|
||||||
{
|
{
|
||||||
return this.getNode();
|
return this.getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Node this bean is currently representing
|
* Returns the Node this bean is currently representing
|
||||||
*
|
*
|
||||||
* @return The Node
|
* @return The Node
|
||||||
*/
|
*/
|
||||||
public Node getNode()
|
public Node getNode()
|
||||||
{
|
{
|
||||||
return this.browseBean.getDocument();
|
return this.browseBean.getDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param multilingualContentService the multilingual ContentService to set
|
* @param multilingualContentService the multilingual ContentService to set
|
||||||
*/
|
*/
|
||||||
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
|
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
|
||||||
{
|
{
|
||||||
this.multilingualContentService = multilingualContentService;
|
this.multilingualContentService = multilingualContentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return multilingualContentService
|
* @return multilingualContentService
|
||||||
*/
|
*/
|
||||||
protected MultilingualContentService getMultilingualContentService()
|
protected MultilingualContentService getMultilingualContentService()
|
||||||
{
|
{
|
||||||
//check for null for cluster environment
|
//check for null for cluster environment
|
||||||
if (multilingualContentService == null)
|
if (multilingualContentService == null)
|
||||||
{
|
{
|
||||||
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
|
multilingualContentService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getMultilingualContentService();
|
||||||
}
|
}
|
||||||
return multilingualContentService;
|
return multilingualContentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param contentFilterLanguagesService The Content Filter Languages Service to set.
|
* @param contentFilterLanguagesService The Content Filter Languages Service to set.
|
||||||
*/
|
*/
|
||||||
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
|
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
|
||||||
{
|
{
|
||||||
this.contentFilterLanguagesService = contentFilterLanguagesService;
|
this.contentFilterLanguagesService = contentFilterLanguagesService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return contentFilterLanguagesService
|
* @return contentFilterLanguagesService
|
||||||
*/
|
*/
|
||||||
protected ContentFilterLanguagesService getContentFilterLanguagesService()
|
protected ContentFilterLanguagesService getContentFilterLanguagesService()
|
||||||
{
|
{
|
||||||
//check for null for cluster environment
|
//check for null for cluster environment
|
||||||
if (contentFilterLanguagesService == null)
|
if (contentFilterLanguagesService == null)
|
||||||
{
|
{
|
||||||
contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService();
|
contentFilterLanguagesService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getContentFilterLanguagesService();
|
||||||
}
|
}
|
||||||
return contentFilterLanguagesService;
|
return contentFilterLanguagesService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EditionService The Edition Service to set.
|
* @param EditionService The Edition Service to set.
|
||||||
*/
|
*/
|
||||||
public void setEditionService(EditionService editionService)
|
public void setEditionService(EditionService editionService)
|
||||||
{
|
{
|
||||||
this.editionService = editionService;
|
this.editionService = editionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return editionService
|
* @return editionService
|
||||||
*/
|
*/
|
||||||
protected EditionService getEditionService()
|
protected EditionService getEditionService()
|
||||||
{
|
{
|
||||||
//check for null for cluster environment
|
//check for null for cluster environment
|
||||||
if (editionService == null)
|
if (editionService == null)
|
||||||
{
|
{
|
||||||
editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService();
|
editionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getEditionService();
|
||||||
}
|
}
|
||||||
return editionService;
|
return editionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the version service instance the bean should use
|
* Sets the version service instance the bean should use
|
||||||
*
|
*
|
||||||
* @param versionService The VersionService
|
* @param versionService The VersionService
|
||||||
*/
|
*/
|
||||||
public void setVersionService(VersionService versionService)
|
public void setVersionService(VersionService versionService)
|
||||||
{
|
{
|
||||||
this.versionService = versionService;
|
this.versionService = versionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return versionService
|
* @return versionService
|
||||||
*/
|
*/
|
||||||
protected VersionService getVersionService()
|
protected VersionService getVersionService()
|
||||||
{
|
{
|
||||||
//check for null for cluster environment
|
//check for null for cluster environment
|
||||||
if (versionService == null)
|
if (versionService == null)
|
||||||
{
|
{
|
||||||
versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
|
versionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getVersionService();
|
||||||
}
|
}
|
||||||
return versionService;
|
return versionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before opening the ml container details, remeber the translation
|
* Before opening the ml container details, remeber the translation
|
||||||
* from which the action comes.
|
* from which the action comes.
|
||||||
*
|
*
|
||||||
* @param node
|
* @param node
|
||||||
*/
|
*/
|
||||||
public void setTranslationDocument(Node node)
|
public void setTranslationDocument(Node node)
|
||||||
{
|
{
|
||||||
this.translationDocument = node;
|
this.translationDocument = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the panels expanded state map.
|
* @return Returns the panels expanded state map.
|
||||||
*/
|
*/
|
||||||
public Map<String, Boolean> getPanels()
|
public Map<String, Boolean> getPanels()
|
||||||
{
|
{
|
||||||
return this.panels;
|
return this.panels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getContainerTitle()
|
public String getContainerTitle()
|
||||||
{
|
{
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MANAGE_DETAILS_FOR) + " '" + getDocument().getName() + "'";
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MANAGE_DETAILS_FOR) + " '" + getDocument().getName() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCancelButtonLabel()
|
|
||||||
{
|
|
||||||
|
|
||||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCancelButtonLabel()
|
||||||
|
{
|
||||||
|
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of objects representing the translations of the current document
|
* Returns a list of objects representing the translations of the current document
|
||||||
*
|
*
|
||||||
* @return List of translations
|
* @return List of translations
|
||||||
*/
|
*/
|
||||||
public List getTranslations()
|
public List getTranslations()
|
||||||
{
|
{
|
||||||
List<MapNode> translations = new ArrayList<MapNode>();
|
List<MapNode> translations = new ArrayList<MapNode>();
|
||||||
|
|
||||||
Node document = getDocument();
|
Node document = getDocument();
|
||||||
|
|
||||||
boolean canNewEdtion = MultilingualUtils.canStartNewEditon(document, FacesContext.getCurrentInstance());
|
boolean canNewEdtion = MultilingualUtils.canStartNewEditon(document, FacesContext.getCurrentInstance());
|
||||||
|
|
||||||
if (document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) || ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(document.getType()))
|
if (document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) || ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(document.getType()))
|
||||||
{
|
{
|
||||||
Map<Locale, NodeRef> translationsMap = getMultilingualContentService().getTranslations(getDocument().getNodeRef());
|
Map<Locale, NodeRef> translationsMap = getMultilingualContentService().getTranslations(getDocument().getNodeRef());
|
||||||
|
|
||||||
if (translationsMap != null && translationsMap.size() > 0)
|
if (translationsMap != null && translationsMap.size() > 0)
|
||||||
{
|
{
|
||||||
for (Map.Entry entry : translationsMap.entrySet())
|
for (Map.Entry entry : translationsMap.entrySet())
|
||||||
{
|
|
||||||
NodeRef nodeRef = (NodeRef) entry.getValue();
|
|
||||||
|
|
||||||
// create a map node representation of the translation
|
|
||||||
MapNode mapNode = new MapNode(nodeRef);
|
|
||||||
|
|
||||||
Locale locale = (Locale) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE);
|
|
||||||
|
|
||||||
String lgge = (locale != null) ?
|
|
||||||
// convert the locale into new ISO codes
|
|
||||||
getContentFilterLanguagesService().convertToNewISOCode(locale.getLanguage()).toUpperCase()
|
|
||||||
: null;
|
|
||||||
|
|
||||||
mapNode.put("name", getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME));
|
|
||||||
mapNode.put("language", lgge);
|
|
||||||
mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName()));
|
|
||||||
|
|
||||||
boolean isEmpty = new Boolean(getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION));
|
|
||||||
|
|
||||||
mapNode.put("notEmpty", !isEmpty);
|
|
||||||
mapNode.put("userHasRight", new Boolean(canNewEdtion && !isEmpty));
|
|
||||||
// add the client side version to the list
|
|
||||||
translations.add(mapNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return translations;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init the mlContainer histories and returns an empty list to fill a rich list value without content.
|
|
||||||
*
|
|
||||||
* @return an empty list
|
|
||||||
*/
|
|
||||||
public List getEmptyListAndInitEditions()
|
|
||||||
{
|
|
||||||
// this call ensures that the edition of the mlContainer must be
|
|
||||||
// re-initialized.
|
|
||||||
|
|
||||||
// remove each old mlContainer's translations of the panel list
|
|
||||||
List<String> panelsToRemove = new ArrayList<String>();
|
|
||||||
for(Map.Entry<String, Boolean> panel : panels.entrySet())
|
|
||||||
{
|
|
||||||
if(panel.getKey().startsWith(ML_VERSION_PANEL_ID))
|
|
||||||
{
|
{
|
||||||
//panels.remove(panel.getKey());
|
NodeRef nodeRef = (NodeRef) entry.getValue();
|
||||||
panelsToRemove.add(panel.getKey());
|
|
||||||
|
// create a map node representation of the translation
|
||||||
|
MapNode mapNode = new MapNode(nodeRef);
|
||||||
|
|
||||||
|
Locale locale = (Locale) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE);
|
||||||
|
|
||||||
|
String lgge = (locale != null) ?
|
||||||
|
// convert the locale into new ISO codes
|
||||||
|
getContentFilterLanguagesService().convertToNewISOCode(locale.getLanguage()).toUpperCase()
|
||||||
|
: null;
|
||||||
|
|
||||||
|
mapNode.put("name", getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME));
|
||||||
|
mapNode.put("language", lgge);
|
||||||
|
mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName()));
|
||||||
|
|
||||||
|
boolean isEmpty = new Boolean(getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION));
|
||||||
|
|
||||||
|
mapNode.put("notEmpty", !isEmpty);
|
||||||
|
mapNode.put("userHasRight", new Boolean(canNewEdtion && !isEmpty));
|
||||||
|
// add the client side version to the list
|
||||||
|
translations.add(mapNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(String panelId : panelsToRemove)
|
return translations;
|
||||||
{
|
}
|
||||||
panels.remove(panelId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// init the Edition histories
|
/**
|
||||||
initEditionHistory();
|
* Init the mlContainer histories and returns an empty list to fill a rich list value without content.
|
||||||
currentEditionCursorPosition = -1;
|
*
|
||||||
|
* @return an empty list
|
||||||
|
*/
|
||||||
|
public List getEmptyListAndInitEditions()
|
||||||
|
{
|
||||||
|
// this call ensures that the edition of the mlContainer must be
|
||||||
|
// re-initialized.
|
||||||
|
|
||||||
return new ArrayList(0);
|
// remove each old mlContainer's translations of the panel list
|
||||||
}
|
List<String> panelsToRemove = new ArrayList<String>();
|
||||||
|
for(Map.Entry<String, Boolean> panel : panels.entrySet())
|
||||||
|
{
|
||||||
|
if(panel.getKey().startsWith(ML_VERSION_PANEL_ID))
|
||||||
|
{
|
||||||
|
//panels.remove(panel.getKey());
|
||||||
|
panelsToRemove.add(panel.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
for(String panelId : panelsToRemove)
|
||||||
* For the client side iteration on the edition hitories list, returns the number of editions.
|
{
|
||||||
*
|
panels.remove(panelId);
|
||||||
* @return the number of edition of the current mlContainer
|
}
|
||||||
*/
|
|
||||||
public int getEditionSize()
|
|
||||||
{
|
|
||||||
// return the size of the list
|
|
||||||
return editionHistory.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// init the Edition histories
|
||||||
* For the client side iteration on the edition hitories list,
|
initEditionHistory();
|
||||||
* return the next edition history.
|
currentEditionCursorPosition = -1;
|
||||||
*
|
|
||||||
* @return a light weight representation of an edition history
|
|
||||||
*/
|
|
||||||
public SingleEditionBean getNextSingleEditionBean()
|
|
||||||
{
|
|
||||||
currentEditionCursorPosition++;
|
|
||||||
|
|
||||||
return getCurrentSingleEditionBean();
|
return new ArrayList(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the client side iteration on the edition hitories list, returns the number of editions.
|
||||||
|
*
|
||||||
|
* @return the number of edition of the current mlContainer
|
||||||
|
*/
|
||||||
|
public int getEditionSize()
|
||||||
|
{
|
||||||
|
// return the size of the list
|
||||||
|
return editionHistory.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the client side iteration on the edition hitories list,
|
||||||
|
* return the next edition history.
|
||||||
|
*
|
||||||
|
* @return a light weight representation of an edition history
|
||||||
|
*/
|
||||||
|
public SingleEditionBean getNextSingleEditionBean()
|
||||||
|
{
|
||||||
|
currentEditionCursorPosition++;
|
||||||
|
|
||||||
|
return getCurrentSingleEditionBean();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the client side iteration on the edition hitories list,
|
* For the client side iteration on the edition hitories list,
|
||||||
@@ -338,202 +336,201 @@ public class MultilingualManageDialog extends BaseDialogBean
|
|||||||
*
|
*
|
||||||
* @return a light weight representation of an edition history
|
* @return a light weight representation of an edition history
|
||||||
*/
|
*/
|
||||||
public SingleEditionBean getCurrentSingleEditionBean()
|
public SingleEditionBean getCurrentSingleEditionBean()
|
||||||
{
|
{
|
||||||
if (currentEditionCursorPosition < getEditionSize())
|
if (currentEditionCursorPosition < getEditionSize())
|
||||||
{
|
{
|
||||||
return editionHistory.get(currentEditionCursorPosition);
|
return editionHistory.get(currentEditionCursorPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the translationf from which the ml container
|
* Restore the translationf from which the ml container
|
||||||
* details dialog comes.
|
* details dialog comes.
|
||||||
*/
|
*/
|
||||||
public void resetMLDocument(ActionEvent event)
|
public void resetMLDocument(ActionEvent event)
|
||||||
{
|
{
|
||||||
this.browseBean.setupCommonBindingProperties(this.translationDocument);
|
this.browseBean.setupCommonBindingProperties(this.translationDocument);
|
||||||
this.browseBean.setDocument(this.translationDocument);
|
this.browseBean.setDocument(this.translationDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action handler to remove a custom view template from the current node
|
* Action handler to remove a custom view template from the current node
|
||||||
*/
|
*/
|
||||||
public void removeTemplate(ActionEvent event)
|
public void removeTemplate(ActionEvent event)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// clear template property
|
// clear template property
|
||||||
this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null);
|
this.getNodeService().setProperty(getNode().getNodeRef(), ContentModel.PROP_TEMPLATE, null);
|
||||||
this.getNodeService().removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE);
|
this.getNodeService().removeAspect(getNode().getNodeRef(), ContentModel.ASPECT_TEMPLATABLE);
|
||||||
|
|
||||||
// reset node details for next refresh of details page
|
// reset node details for next refresh of details page
|
||||||
getNode().reset();
|
getNode().reset();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), e.getMessage()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the state of the panel that was expanded/collapsed
|
* Save the state of the panel that was expanded/collapsed
|
||||||
*/
|
*/
|
||||||
public void expandPanel(ActionEvent event)
|
public void expandPanel(ActionEvent event)
|
||||||
{
|
{
|
||||||
if (event instanceof ExpandedEvent)
|
if (event instanceof ExpandedEvent)
|
||||||
{
|
{
|
||||||
String id = event.getComponent().getId();
|
String id = event.getComponent().getId();
|
||||||
// we prefix some panels with "no-" which we remove to give consistent behaviour in the UI
|
// we prefix some panels with "no-" which we remove to give consistent behaviour in the UI
|
||||||
if (id.startsWith("no-") == true)
|
if (id.startsWith("no-") == true)
|
||||||
{
|
{
|
||||||
id = id.substring(3);
|
id = id.substring(3);
|
||||||
}
|
}
|
||||||
this.panels.put(id, ((ExpandedEvent)event).State);
|
this.panels.put(id, ((ExpandedEvent)event).State);
|
||||||
}
|
}
|
||||||
|
|
||||||
String id = event.getComponent().getId();
|
String id = event.getComponent().getId();
|
||||||
|
|
||||||
if(id.startsWith(ML_VERSION_PANEL_ID))
|
if(id.startsWith(ML_VERSION_PANEL_ID))
|
||||||
{
|
{
|
||||||
this.currentEditionCursorPosition = Integer.parseInt(id.substring("ml-versions-panel".length())) - 1;
|
this.currentEditionCursorPosition = Integer.parseInt(id.substring("ml-versions-panel".length())) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ml container of the document this bean is currently representing
|
* Returns the ml container of the document this bean is currently representing
|
||||||
*
|
*
|
||||||
* @return The document multilingual container NodeRef
|
* @return The document multilingual container NodeRef
|
||||||
*/
|
*/
|
||||||
public Node getDocumentMlContainer()
|
public Node getDocumentMlContainer()
|
||||||
{
|
{
|
||||||
Node currentNode = getNode();
|
Node currentNode = getNode();
|
||||||
|
|
||||||
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(currentNode.getType()))
|
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(currentNode.getType()))
|
||||||
{
|
{
|
||||||
return currentNode;
|
return currentNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = getNode().getNodeRef();
|
NodeRef nodeRef = getNode().getNodeRef();
|
||||||
|
|
||||||
return new Node(getMultilingualContentService().getTranslationContainer(nodeRef));
|
return new Node(getMultilingualContentService().getTranslationContainer(nodeRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a list of objects representing the editions of the
|
* Constructs a list of objects representing the editions of the
|
||||||
* logical document
|
* logical document
|
||||||
*
|
*
|
||||||
* @return List of editions
|
* @return List of editions
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private List<SingleEditionBean> initEditionHistory()
|
private List<SingleEditionBean> initEditionHistory()
|
||||||
{
|
{
|
||||||
// get the mlContainer
|
// get the mlContainer
|
||||||
NodeRef mlContainer = getDocumentMlContainer().getNodeRef();
|
NodeRef mlContainer = getDocumentMlContainer().getNodeRef();
|
||||||
|
|
||||||
// get all editions and sort them ascending according their version label
|
// get all editions and sort them ascending according their version label
|
||||||
List<Version> orderedEditionList = new ArrayList<Version>(getEditionService().getEditions(mlContainer).getAllVersions());
|
List<Version> orderedEditionList = new ArrayList<Version>(getEditionService().getEditions(mlContainer).getAllVersions());
|
||||||
Collections.sort(orderedEditionList, new VersionLabelComparator());
|
Collections.sort(orderedEditionList, new VersionLabelComparator());
|
||||||
|
|
||||||
// the list of Single Edition Bean to return
|
// the list of Single Edition Bean to return
|
||||||
editionHistory = new ArrayList<SingleEditionBean>(orderedEditionList.size());
|
editionHistory = new ArrayList<SingleEditionBean>(orderedEditionList.size());
|
||||||
|
|
||||||
boolean firstEdition = true;
|
boolean firstEdition = true;
|
||||||
|
|
||||||
// for each edition, init a SingleEditionBean
|
// for each edition, init a SingleEditionBean
|
||||||
for (Version edition : orderedEditionList)
|
for (Version edition : orderedEditionList)
|
||||||
{
|
{
|
||||||
SingleEditionBean editionBean = new SingleEditionBean();
|
SingleEditionBean editionBean = new SingleEditionBean();
|
||||||
|
|
||||||
MapNode clientEdition = new MapNode(edition.getFrozenStateNodeRef());
|
MapNode clientEdition = new MapNode(edition.getFrozenStateNodeRef());
|
||||||
|
|
||||||
String editionLabel = edition.getVersionLabel();
|
String editionLabel = edition.getVersionLabel();
|
||||||
if (firstEdition)
|
if (firstEdition)
|
||||||
|
{
|
||||||
|
editionLabel += " (" + Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
clientEdition.put("editionLabel", editionLabel);
|
||||||
|
clientEdition.put("editionNotes", edition.getDescription());
|
||||||
|
clientEdition.put("editionAuthor", edition.getCreator());
|
||||||
|
clientEdition.put("editionDate", edition.getCreatedDate());
|
||||||
|
|
||||||
|
// Set the edition of the edition bean
|
||||||
|
editionBean.setEdition(clientEdition);
|
||||||
|
|
||||||
|
// get translations
|
||||||
|
List<VersionHistory> translationHistories = null;
|
||||||
|
|
||||||
|
if (firstEdition)
|
||||||
|
{
|
||||||
|
// Get the translations because the current edition doesn't content link with its
|
||||||
|
// translation in the version store.
|
||||||
|
Map<Locale, NodeRef> translations = getMultilingualContentService().getTranslations(mlContainer);
|
||||||
|
translationHistories = new ArrayList<VersionHistory>(translations.size());
|
||||||
|
for (NodeRef translation : translations.values())
|
||||||
{
|
{
|
||||||
editionLabel += " (" + Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT) + ")";
|
translationHistories.add(getVersionService().getVersionHistory(translation));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
translationHistories = getEditionService().getVersionedTranslations(edition);
|
||||||
|
}
|
||||||
|
|
||||||
clientEdition.put("editionLabel", editionLabel);
|
// add each translation in the SingleEditionBean
|
||||||
clientEdition.put("editionNotes", edition.getDescription());
|
for (VersionHistory versionHistory : translationHistories)
|
||||||
clientEdition.put("editionAuthor", edition.getCreator());
|
{
|
||||||
clientEdition.put("editionDate", edition.getCreatedDate());
|
// get the list of versions and sort them ascending according their version label
|
||||||
|
List<Version> orderedVersions = new ArrayList<Version>(versionHistory.getAllVersions());
|
||||||
|
Collections.sort(orderedVersions, new VersionLabelComparator());
|
||||||
|
|
||||||
// Set the edition of the edition bean
|
// the last version is the first version of the list
|
||||||
editionBean.setEdition(clientEdition);
|
Version lastVersion = orderedVersions.get(0);
|
||||||
|
|
||||||
// get translations
|
// get the properties of the lastVersion
|
||||||
List<VersionHistory> translationHistories = null;
|
Map<QName, Serializable> lastVersionProperties = getEditionService().getVersionedMetadatas(lastVersion);
|
||||||
|
Locale language = (Locale) lastVersionProperties.get(ContentModel.PROP_LOCALE);
|
||||||
|
|
||||||
if (firstEdition)
|
// create a map node representation of the last version
|
||||||
|
MapNode clientLastVersion = new MapNode(lastVersion.getFrozenStateNodeRef());
|
||||||
|
|
||||||
|
clientLastVersion.put("versionName", lastVersionProperties.get(ContentModel.PROP_NAME));
|
||||||
|
// use the node service for the description to ensure that the returned value is a text and not a MLText
|
||||||
|
clientLastVersion.put("versionDescription", getNodeService().getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION));
|
||||||
|
clientLastVersion.put("versionAuthor", lastVersionProperties.get(ContentModel.PROP_AUTHOR));
|
||||||
|
clientLastVersion.put("versionCreatedDate", lastVersionProperties.get(ContentModel.PROP_CREATED));
|
||||||
|
clientLastVersion.put("versionModifiedDate", lastVersionProperties.get(ContentModel.PROP_MODIFIED));
|
||||||
|
clientLastVersion.put("versionLanguage", getContentFilterLanguagesService().convertToNewISOCode(language.getLanguage()).toUpperCase());
|
||||||
|
|
||||||
|
if(getNodeService().hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||||
{
|
{
|
||||||
// Get the translations because the current edition doesn't content link with its
|
clientLastVersion.put("versionUrl", null);
|
||||||
// translation in the version store.
|
|
||||||
Map<Locale, NodeRef> translations = getMultilingualContentService().getTranslations(mlContainer);
|
|
||||||
translationHistories = new ArrayList<VersionHistory>(translations.size());
|
|
||||||
for (NodeRef translation : translations.values())
|
|
||||||
{
|
|
||||||
translationHistories.add(getVersionService().getVersionHistory(translation));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
translationHistories = getEditionService().getVersionedTranslations(edition);
|
clientLastVersion.put("versionUrl", DownloadContentServlet.generateBrowserURL(lastVersion.getFrozenStateNodeRef(), clientLastVersion.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add each translation in the SingleEditionBean
|
// add a translation of the editionBean
|
||||||
for (VersionHistory versionHistory : translationHistories)
|
editionBean.addTranslations(clientLastVersion);
|
||||||
{
|
}
|
||||||
// get the list of versions and sort them ascending according their version label
|
editionHistory.add(editionBean);
|
||||||
List<Version> orderedVersions = new ArrayList<Version>(versionHistory.getAllVersions());
|
firstEdition = false;
|
||||||
Collections.sort(orderedVersions, new VersionLabelComparator());
|
}
|
||||||
|
|
||||||
// the last version is the first version of the list
|
return editionHistory;
|
||||||
Version lastVersion = orderedVersions.get(0);
|
}
|
||||||
|
@Override
|
||||||
// get the properties of the lastVersion
|
|
||||||
Map<QName, Serializable> lastVersionProperties = getEditionService().getVersionedMetadatas(lastVersion);
|
|
||||||
Locale language = (Locale) lastVersionProperties.get(ContentModel.PROP_LOCALE);
|
|
||||||
|
|
||||||
// create a map node representation of the last version
|
|
||||||
MapNode clientLastVersion = new MapNode(lastVersion.getFrozenStateNodeRef());
|
|
||||||
|
|
||||||
clientLastVersion.put("versionName", lastVersionProperties.get(ContentModel.PROP_NAME));
|
|
||||||
// use the node service for the description to ensure that the returned value is a text and not a MLText
|
|
||||||
clientLastVersion.put("versionDescription", getNodeService().getProperty(lastVersion.getFrozenStateNodeRef(), ContentModel.PROP_DESCRIPTION));
|
|
||||||
clientLastVersion.put("versionAuthor", lastVersionProperties.get(ContentModel.PROP_AUTHOR));
|
|
||||||
clientLastVersion.put("versionCreatedDate", lastVersionProperties.get(ContentModel.PROP_CREATED));
|
|
||||||
clientLastVersion.put("versionModifiedDate", lastVersionProperties.get(ContentModel.PROP_MODIFIED));
|
|
||||||
clientLastVersion.put("versionLanguage", getContentFilterLanguagesService().convertToNewISOCode(language.getLanguage()).toUpperCase());
|
|
||||||
|
|
||||||
if(getNodeService().hasAspect(lastVersion.getFrozenStateNodeRef(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
|
||||||
{
|
|
||||||
clientLastVersion.put("versionUrl", null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clientLastVersion.put("versionUrl", DownloadContentServlet.generateBrowserURL(lastVersion.getFrozenStateNodeRef(), clientLastVersion.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a translation of the editionBean
|
|
||||||
editionBean.addTranslations(clientLastVersion);
|
|
||||||
}
|
|
||||||
editionHistory.add(editionBean);
|
|
||||||
firstEdition = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return editionHistory;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected String getDefaultCancelOutcome()
|
protected String getDefaultCancelOutcome()
|
||||||
{
|
{
|
||||||
resetMLDocument(null);
|
resetMLDocument(null);
|
||||||
return "dialog:close";
|
return "dialog:close";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>
|
<description>
|
||||||
The bean for the Delete Category screen.
|
The bean for the Manage Multilingual dialog.
|
||||||
</description>
|
</description>
|
||||||
<managed-bean-name>MultilingualManageDialog</managed-bean-name>
|
<managed-bean-name>MultilingualManageDialog</managed-bean-name>
|
||||||
<managed-bean-class>
|
<managed-bean-class>
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
<value>#{DocumentDetailsDialog.translationDocument}</value>
|
<value>#{DocumentDetailsDialog.translationDocument}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>
|
<description>
|
||||||
The bean for the Manage Permissions.
|
The bean for the Manage Permissions.
|
||||||
@@ -52,7 +53,6 @@
|
|||||||
org.alfresco.web.bean.wcm.ManagePermissionsDialog
|
org.alfresco.web.bean.wcm.ManagePermissionsDialog
|
||||||
</managed-bean-class>
|
</managed-bean-class>
|
||||||
<managed-bean-scope>session</managed-bean-scope>
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>personService</property-name>
|
<property-name>personService</property-name>
|
||||||
<value>#{PersonService}</value>
|
<value>#{PersonService}</value>
|
||||||
@@ -61,7 +61,6 @@
|
|||||||
<property-name>avmBrowseBean</property-name>
|
<property-name>avmBrowseBean</property-name>
|
||||||
<value>#{AVMBrowseBean}</value>
|
<value>#{AVMBrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
|
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
|
Reference in New Issue
Block a user