Merge from HEAD into WCM-DEV2. Also fixes build breakage in

jndi-client and catalina-virtual that I introduced earlier. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3393 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-07-24 18:27:41 +00:00
parent ca9496d090
commit f6355ea108
171 changed files with 11880 additions and 3450 deletions

View File

@@ -3,12 +3,17 @@ package org.alfresco.web.bean.content;
import java.io.File;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.ConfigService;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentReader;
@@ -26,6 +31,7 @@ import org.alfresco.web.bean.repository.Repository;
*/
public class AddContentDialog extends BaseContentWizard
{
protected List<String> inlineEditableMimeTypes;
protected File file;
// ------------------------------------------------------------------------------
@@ -53,7 +59,16 @@ public class AddContentDialog extends BaseContentWizard
{
this.title = this.fileName;
}
// determine whether inline editing should be enabled by default.
// if the mime type of the added file is in the list of mime types
// configured in "Content Wizards" then enable inline editing
List<String> mimeTypes = getInlineEditableMimeTypes();
if (mimeTypes.contains(this.mimeType))
{
this.inlineEdit = true;
}
saveContent(this.file, null);
// return default outcome
@@ -71,6 +86,8 @@ public class AddContentDialog extends BaseContentWizard
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
clearUpload();
// as we were successful, go to the set properties dialog if asked
// to otherwise just return
if (this.showOtherProperties)
@@ -214,4 +231,30 @@ public class AddContentDialog extends BaseContentWizard
FacesContext ctx = FacesContext.getCurrentInstance();
ctx.getExternalContext().getSessionMap().remove(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
}
protected List<String> getInlineEditableMimeTypes()
{
if (this.inlineEditableMimeTypes == null)
{
this.inlineEditableMimeTypes = new ArrayList<String>(8);
// get the create mime types list from the config
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Content Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
{
String currentMimeType = child.getAttribute("name");
this.inlineEditableMimeTypes.add(currentMimeType);
}
}
}
}
return this.inlineEditableMimeTypes;
}
}

View File

@@ -0,0 +1,87 @@
package org.alfresco.web.bean.content;
import java.text.MessageFormat;
import javax.faces.context.FacesContext;
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 "Delete Content" dialog
*
* @author gavinc
*/
public class DeleteContentDialog extends BaseDialogBean
{
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
protected String finishImpl(FacesContext context, String outcome)
throws Exception
{
// get the content to delete
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());
}
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()
{
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_file_confirm");
return MessageFormat.format(fileConfirmMsg,
new Object[] {this.browseBean.getDocument().getName()});
}
}