Files
alfresco-community-repo/source/java/org/alfresco/web/bean/wcm/DeleteFileDialog.java
Kevin Roast 1ee6e16326 . Refactored client AVM Node class to extend existing Node class - allows the use of existing PermissionEvaluators etc. for a node action
. Permission evaluators added to AVM browse screen top-level actions and file/folder actions
. Permission evaluators added to Edit Details action in File/Folder Details screens
. Each user sandbox is now only visible to the assigned user and all Content Managers
. Import Website Content action hidden unless user has appropriate Write permissions to the main staging area (Content Managers only)
. Added Titled aspect to shtml content created through the XML Templating Service.
. Remove Create Content action from sandbox screen - makes no sense here until we can create via workflow or destination folder
. Fix nasty bug in Create Form Wizard where no default extension would be specified
  - this led to the XForms generating files such as "myfile.xml" and "myfile." - the generated HTML did not have a file extension...

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4048 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-10-06 12:53:22 +00:00

107 lines
2.8 KiB
Java

package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the AVM "Delete File" dialog
*
* @author kevinr
*/
public class DeleteFileDialog extends BaseDialogBean
{
private static final Log logger = LogFactory.getLog(DeleteFileDialog.class);
protected AVMService avmService;
protected AVMBrowseBean avmBrowseBean;
/**
* @param avmBrowseBean The avmBrowseBean to set.
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
/**
* @param avmService The avmService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
protected String finishImpl(FacesContext context, String outcome)
throws Exception
{
// get the content to delete
AVMNode node = this.avmBrowseBean.getAvmActionNode();
if (node != null)
{
if (logger.isDebugEnabled())
logger.debug("Trying to delete AVM node: " + node.getPath());
// delete the node
this.avmService.removeNode(
node.getPath().substring(0, node.getPath().lastIndexOf('/')),
node.getPath().substring(node.getPath().lastIndexOf('/') + 1));
}
else
{
logger.warn("WARNING: delete called without a current AVM Node!");
}
return outcome;
}
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
@Override
protected String getErrorMessageId()
{
return "error_delete_file";
}
@Override
public boolean getFinishButtonDisabled()
{
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_avm_file_confirm");
return MessageFormat.format(fileConfirmMsg,
new Object[] {this.avmBrowseBean.getAvmActionNode().getName()});
}
}