mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Phase one of merge of EC multilingual work
These files are their changes plus adjustments for formatting and immediate clashes I anticipate that this will break the build, but there are too many changes coming to risk it. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.UserPreferencesBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Evaluates whether the Add Translation (with or without content) action should be visible.
|
||||
*
|
||||
* If the node is not already Multilingual, locked, or if a translation exists for each available
|
||||
* filter language, don't allow the action.
|
||||
*
|
||||
* @author yanipig
|
||||
*/
|
||||
public class AddTranslationEvaluator implements ActionEvaluator
|
||||
{
|
||||
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
|
||||
MultilingualContentService mlservice =
|
||||
(MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService");
|
||||
|
||||
UserPreferencesBean userprefs =
|
||||
(UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean");
|
||||
|
||||
// the number of translation of this document
|
||||
int availableTranslationCount = mlservice.getTranslations(node.getNodeRef()).size();
|
||||
// the total number of available languages for the translation
|
||||
int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length;
|
||||
|
||||
return (
|
||||
node.isLocked() == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == true &&
|
||||
availableTranslationCount < contentFilterLanguagesCount
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -51,6 +51,7 @@ public class CheckoutDocEvaluator implements ActionEvaluator
|
||||
return dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT) &&
|
||||
((node.hasPermission(PermissionService.CHECK_OUT) && node.hasPermission(PermissionService.CREATE_CHILDREN) &&
|
||||
(node.isLocked() == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)));
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false) &&
|
||||
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Evaluates whether the Cut Node action should be visible.
|
||||
*
|
||||
* Among all available operations over non-multilingual documents (i.e. copy,
|
||||
* delete, start discussion, etc), there is a missing one: <b>Move</b>.
|
||||
* Translations cannot be moved due to the exiting link it has with the logical
|
||||
* document. Despite it is technically achievable, it could be functionally
|
||||
* troublesome. Spreading translations of the same semantic message among several
|
||||
* spaces could lead to confusion and problems.
|
||||
*
|
||||
* @author yanipig
|
||||
*/
|
||||
public class CutNodeEvaluator extends DiscussionCutCopyEvaluator
|
||||
{
|
||||
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
boolean eval = super.evaluate(node);
|
||||
|
||||
if(eval == true)
|
||||
{
|
||||
eval = !node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
|
||||
}
|
||||
|
||||
return eval;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -24,8 +24,12 @@
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.ml.MultilingualContentService;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
@@ -40,7 +44,33 @@ public class DeleteDocEvaluator implements ActionEvaluator
|
||||
*/
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
return (node.isLocked() == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false);
|
||||
boolean isPivot = false;
|
||||
|
||||
// special case for multilingual documents
|
||||
if(node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
|
||||
MultilingualContentService mlservice =
|
||||
(MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService");
|
||||
|
||||
// if the translation is the last translation, user can delete it
|
||||
if(mlservice.getTranslations(node.getNodeRef()).size() == 1)
|
||||
{
|
||||
isPivot = false;
|
||||
}
|
||||
// Else if the node is the pivot language, user can't delete it
|
||||
else if( mlservice.getPivotTranslation(node.getNodeRef()).getId()
|
||||
.equalsIgnoreCase(node.getNodeRef().getId()))
|
||||
{
|
||||
isPivot = true;
|
||||
}
|
||||
// finally, the node is not the pivot translation, user can delete it
|
||||
}
|
||||
|
||||
return (node.isLocked() == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
|
||||
isPivot == false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -26,6 +26,7 @@ package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.ForumModel;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -64,6 +65,12 @@ public class DiscussionCutCopyEvaluator implements ActionEvaluator
|
||||
result = (assocType.equals(ForumModel.ASSOC_DISCUSSION) == false);
|
||||
}
|
||||
|
||||
// impossible to copy a translation without content.
|
||||
if(result && node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -52,9 +52,15 @@ public class EditDocHttpEvaluator implements ActionEvaluator
|
||||
|
||||
boolean result = false;
|
||||
|
||||
// Since the reader returned of an empty translation is the reader of it's pivot translation, it makes
|
||||
// no sens to edit it on-line.
|
||||
if(node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
|
||||
{
|
||||
//result = false
|
||||
}
|
||||
// if the node is inline editable, the default http behaviour should
|
||||
// always be used otherwise the configured approach is used
|
||||
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT))
|
||||
else if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT))
|
||||
{
|
||||
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) == true ||
|
||||
"http".equals(Application.getClientConfig(fc).getEditLinkType()))
|
||||
|
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.UserPreferencesBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Evaluates whether the Make Multilingual action should be visible.
|
||||
*
|
||||
* If the node is already Multilingual don't allow the action.
|
||||
*
|
||||
* @author yanipig
|
||||
*/
|
||||
public class MakeMultilingualEvaluator implements ActionEvaluator
|
||||
{
|
||||
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
|
||||
UserPreferencesBean userprefs =
|
||||
(UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean");
|
||||
|
||||
// the total number of available languages for the translation have to be greather that 0
|
||||
int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length;
|
||||
|
||||
return (node.isLocked() == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
|
||||
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == false &&
|
||||
contentFilterLanguagesCount > 0
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
|
||||
/**
|
||||
* Evaluates whether the Manage Multinlingual Details action should be visible.
|
||||
*
|
||||
* The action is available only if the node is a translation.
|
||||
*
|
||||
* @author yanipig
|
||||
*/
|
||||
public class MultilingualDetailsEvaluator implements ActionEvaluator
|
||||
{
|
||||
|
||||
public boolean evaluate(Node node)
|
||||
{
|
||||
return (
|
||||
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == true
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -26,6 +26,7 @@ package org.alfresco.web.action.evaluator;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
@@ -45,6 +46,10 @@ public class StartWorkflowEvaluator implements ActionEvaluator
|
||||
{
|
||||
NavigationBean nav =
|
||||
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME);
|
||||
return (nav.getIsGuest() == false);
|
||||
|
||||
return (
|
||||
nav.getIsGuest() == false
|
||||
&& node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user