Merged V2.1 to HEAD

6383: ML contributions
   6400: AR-1625 Empty translations track pivot translation


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-08-02 23:57:38 +00:00
parent 7c4ddd4fdd
commit 4ffc28f0bf
28 changed files with 2461 additions and 848 deletions

View File

@@ -15,11 +15,11 @@
* 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:
* 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.bean.content;
@@ -28,6 +28,8 @@ import java.text.MessageFormat;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
@@ -37,16 +39,20 @@ import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Delete Content" dialog
*
*
* @author gavinc
*/
public class DeleteContentDialog extends BaseDialogBean
{
protected MultilingualContentService multilingualContentService;
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
protected String finishImpl(FacesContext context, String outcome)
throws Exception
@@ -55,31 +61,43 @@ public class DeleteContentDialog extends BaseDialogBean
Node node = this.browseBean.getDocument();
if (node != null)
{
if (logger.isDebugEnabled())
logger.debug("Trying to delete content node: " + node.getId());
// delete the node
this.nodeService.deleteNode(node.getNodeRef());
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(node.getType()))
{
if (logger.isDebugEnabled())
logger.debug("Trying to delete multilingual container: " + node.getId() + " and its translations" );
// delete the mlContainer and its translations
multilingualContentService.deleteTranslationContainer(node.getNodeRef());
}
else
{
if (logger.isDebugEnabled())
logger.debug("Trying to delete content node: " + node.getId());
// delete the node
this.nodeService.deleteNode(node.getNodeRef());
}
}
else
{
logger.warn("WARNING: delete called without a current Document!");
}
return outcome;
}
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
// clear action context
this.browseBean.setDocument(null);
// setting the outcome will show the browse view again
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
}
@Override
protected String getErrorMessageId()
{
@@ -91,21 +109,51 @@ public class DeleteContentDialog extends BaseDialogBean
{
return false;
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns the confirmation to display to the user before deleting the content.
*
*
* @return The formatted message to display
*/
public String getConfirmMessage()
{
String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"delete_file_confirm");
return MessageFormat.format(fileConfirmMsg,
new Object[] {this.browseBean.getDocument().getName()});
String fileConfirmMsg = null;
Node document = this.browseBean.getDocument();
if(document.getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
{
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"delete_ml_container_confirm");
}
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"delete_empty_translation_confirm");
}
else if(document.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"delete_translation_confirm");
}
else
{
fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"delete_file_confirm");
}
return MessageFormat.format(fileConfirmMsg,
new Object[] {document.getName()});
}
/**
* @param multilingualContentService the Multilingual Content Service to set
*/
public void setMultilingualContentService(MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
}