Files
alfresco-community-repo/source/java/org/alfresco/web/bean/wcm/DeleteFolderDialog.java
Kevin Roast 9fe7ccf523 . WCM UI
- Added Edit and Delete actions for AVM files and Delete action for AVM folders
   - Available on the Modified Items list for a user and also in the website sandbox browse screens
   - Edit is working using the inline editors for plain text and HTML files - XML form content editing to be integrated shortly!
   - Edit for non-inline editable files is working (i.e. download file), but no "Update" action available at present for saving updates
   - Delete will delete files/folders structures from the current sandbox, deleted files in a layer are shown in My Modified Files (see below)
 - User sandbox My Modified Files now shows deleted files as differences (as ghosted out rows)
 - Refactoring of the modified Create Content Wizard into a new wizard Create Web Content Wizard
   - responsible for creating content in the AVM store rather than usual SpacesStore
   - removed XML specific handling from Create Content Wizard (now only present in Create Web Content Wizard)
 - Create Content action added to sandbox view - NOTE: does not yet create content in the AVM world!
 - Added "jsp" filetype as plain text format mimetype (to allow inline-edit for JSP files as website content)
 - Open/closed state of My Modified Files panel is remembered between screen refreshes

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3864 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-09-20 14:33:42 +00:00

111 lines
2.9 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.alfresco.web.bean.repository.Node;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the AVM "Delete Folder" dialog
*
* @author kevinr
*/
public class DeleteFolderDialog extends BaseDialogBean
{
private static final Log logger = LogFactory.getLog(DeleteFolderDialog.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.getAvmNode();
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)
{
// clear action context
this.avmBrowseBean.setAvmNode(null);
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
@Override
protected String getErrorMessageId()
{
return "error_delete_folder";
}
@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_folder_confirm");
return MessageFormat.format(fileConfirmMsg,
new Object[] {this.avmBrowseBean.getAvmNode().getName()});
}
}