Merged V2.1 to HEAD

6436: Support for virtualized cookie paths, aggressive cleanup of sockets when virt server is down.
   6439: Fix for WCM-619 & WCM-571
   6440: Encoding of text/html files created inline using the web-client now has sensible default. AWC-1324.
   6442: Fix for WCM-621 (reviewer can not view or run links report)
   6443: Fix for AWC-1488. Dashboard
   6444: Fix for WCM-693 issue with submitting a deleted directory if no workflow associated with web project.
   6445: Icons for use in fix for WCM-522
   6446: Office Add-Ins: Fix for AWC-1481 - Login dialog can appear recursively


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6733 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 22:07:27 +00:00
parent a8023d20a2
commit 97b5b391c8
18 changed files with 271 additions and 364 deletions

View File

@@ -54,6 +54,7 @@ import org.alfresco.web.bean.wizard.BaseWizardBean;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.repo.component.UICharsetSelector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -167,6 +168,27 @@ public abstract class BaseContentWizard extends BaseWizardBean
*/
public String getEncoding()
{
if (encoding == null)
{
ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
Config config = configSvc.getConfig("Content Wizards");
if (config != null)
{
ConfigElement defaultEncCfg = config.getConfigElement("default-encoding");
if (defaultEncCfg != null)
{
String value = defaultEncCfg.getValue();
if (value != null)
{
encoding = value.trim();
}
}
}
if (encoding == null || encoding.length() == 0)
{
encoding = Charset.defaultCharset().name();
}
}
return encoding;
}
@@ -270,14 +292,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
public List<SelectItem> getEncodings()
{
Map<String, Charset> availableCharsets = Charset.availableCharsets();
List<SelectItem> items = new ArrayList<SelectItem>(availableCharsets.size());
for (Charset charset : availableCharsets.values())
{
SelectItem item = new SelectItem(charset.name(), charset.displayName());
items.add(item);
}
return items;
return UICharsetSelector.getCharsetEncodingList();
}
/**
@@ -437,7 +452,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
ContentWriter writer = contentService.getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
// set the mimetype and encoding
writer.setMimetype(this.mimeType);
writer.setEncoding(this.encoding);
writer.setEncoding(getEncoding());
if (fileContent != null)
{
writer.putContent(fileContent);

View File

@@ -1075,7 +1075,7 @@ public final class AVMUtil
}
// Component Separator.
private static final String STORE_SEPARATOR = "--";
/*package*/ static final String STORE_SEPARATOR = "--";
// names of the stores representing the layers for an AVM website
//XXXarielb this should be private

View File

@@ -25,6 +25,7 @@
package org.alfresco.web.bean.wcm;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -70,6 +71,7 @@ public class LinkValidationDialog extends BaseDialogBean
private String webapp;
private String webappPath;
private String initialTab;
private String title;
private NodeRef webappPathRef;
private boolean runningReport = false;
private boolean update = false;
@@ -118,6 +120,28 @@ public class LinkValidationDialog extends BaseDialogBean
this.compareToStaging = true;
}
// work out title for dialog by examining store type
FacesContext context = FacesContext.getCurrentInstance();
if (this.avmService.getStoreProperty(this.store,
SandboxConstants.PROP_SANDBOX_AUTHOR_MAIN) != null)
{
String pattern = Application.getMessage(context, "link_validaton_dialog_title_user");
String user = this.store.substring(
this.store.indexOf(AVMUtil.STORE_SEPARATOR)+AVMUtil.STORE_SEPARATOR.length());
this.title = MessageFormat.format(pattern,
new Object[] {user});
}
else if (this.avmService.getStoreProperty(this.store,
SandboxConstants.PROP_SANDBOX_STAGING_MAIN) != null)
{
this.title = Application.getMessage(context, "link_validaton_dialog_title_staging");
}
else if (this.avmService.getStoreProperty(this.store,
SandboxConstants.PROP_SANDBOX_WORKFLOW_MAIN) != null)
{
this.title = Application.getMessage(context, "link_validaton_dialog_title_workflow");
}
if (logger.isDebugEnabled())
{
if (this.runningReport)
@@ -155,6 +179,12 @@ public class LinkValidationDialog extends BaseDialogBean
return null;
}
@Override
public String getContainerTitle()
{
return this.title;
}
@Override
public boolean getFinishButtonDisabled()
{

View File

@@ -1,145 +1,145 @@
/*
* 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.bean.wcm;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.linkvalidation.LinkValidationReport;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.sandbox.SandboxConstants;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.workflow.ManageTaskDialog;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Manage Task" dialog when dealing
* with the "WCM Review" task specifically.
*
* @author gavinc
*/
public class ManageVerifyBrokenLinksTaskDialog extends ManageTaskDialog
{
protected String store;
protected String webapp;
protected AVMBrowseBean avmBrowseBean;
private static final Log logger = LogFactory.getLog(ManageVerifyBrokenLinksTaskDialog.class);
// ------------------------------------------------------------------------------
// Implementation
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
// reset any previous link validation state
this.avmBrowseBean.setLinkValidationState(null);
this.avmBrowseBean.setLinkValidationMonitor(null);
// try and retrieve the deployment report from the workflow
// store, if present setup the validation state on AVMBrowseBean
String storeName = this.workflowPackage.getStoreRef().getIdentifier();
if (logger.isDebugEnabled())
logger.debug("Retrieving link validation report from store '" + storeName + "'");
PropertyValue val = this.avmService.getStoreProperty(storeName,
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
if (val != null)
{
LinkValidationReport report = (LinkValidationReport)val.getSerializableValue();
if (report != null)
{
this.store = report.getStore();
this.webapp = report.getWebapp();
if (logger.isDebugEnabled())
logger.debug("Found link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
LinkValidationState state = new LinkValidationState(report);
this.avmBrowseBean.setLinkValidationState(state);
if (logger.isDebugEnabled())
logger.debug("Stored link validation state: " + state);
}
}
// commit the changes
tx.commit();
}
catch (Throwable e)
{
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e), e);
}
}
// ------------------------------------------------------------------------------
// Event handlers
public String viewLinkReport()
{
if (logger.isDebugEnabled())
logger.debug("Viewing link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
Map<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
params.put("webapp", this.webapp);
params.put("compareToStaging", "true");
Application.getDialogManager().setupParameters(params);
return "dialog:linkValidation";
}
// ------------------------------------------------------------------------------
// Getters and Setters
/**
* @param avmBrowseBean AVMBrowseBean instance
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
}
/*
* 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.bean.wcm;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.linkvalidation.LinkValidationReport;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.sandbox.SandboxConstants;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.workflow.ManageTaskDialog;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bean implementation for the "Manage Task" dialog when dealing
* with link validation related WCM tasks.
*
* @author gavinc
*/
public class ManageLinkValidationTaskDialog extends ManageTaskDialog
{
protected String store;
protected String webapp;
protected AVMBrowseBean avmBrowseBean;
private static final Log logger = LogFactory.getLog(ManageLinkValidationTaskDialog.class);
// ------------------------------------------------------------------------------
// Implementation
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
// reset any previous link validation state
this.avmBrowseBean.setLinkValidationState(null);
this.avmBrowseBean.setLinkValidationMonitor(null);
// try and retrieve the deployment report from the workflow
// store, if present setup the validation state on AVMBrowseBean
String storeName = this.workflowPackage.getStoreRef().getIdentifier();
if (logger.isDebugEnabled())
logger.debug("Retrieving link validation report from store '" + storeName + "'");
PropertyValue val = this.avmService.getStoreProperty(storeName,
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
if (val != null)
{
LinkValidationReport report = (LinkValidationReport)val.getSerializableValue();
if (report != null)
{
this.store = report.getStore();
this.webapp = report.getWebapp();
if (logger.isDebugEnabled())
logger.debug("Found link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
LinkValidationState state = new LinkValidationState(report);
this.avmBrowseBean.setLinkValidationState(state);
if (logger.isDebugEnabled())
logger.debug("Stored link validation state: " + state);
}
}
// commit the changes
tx.commit();
}
catch (Throwable e)
{
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(formatErrorMessage(e), e);
}
}
// ------------------------------------------------------------------------------
// Event handlers
public String viewLinkReport()
{
if (logger.isDebugEnabled())
logger.debug("Viewing link validation report for webapp '" +
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
Map<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
params.put("webapp", this.webapp);
params.put("compareToStaging", "true");
Application.getDialogManager().setupParameters(params);
return "dialog:linkValidation";
}
// ------------------------------------------------------------------------------
// Getters and Setters
/**
* @param avmBrowseBean AVMBrowseBean instance
*/
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
{
this.avmBrowseBean = avmBrowseBean;
}
}

View File

@@ -643,7 +643,18 @@ public class SubmitDialog extends BaseDialogBean
}
else
{
Map<String, AVMNodeDescriptor> list = avmService.getDirectoryListing(version, path, true);
if (desc.isDeletedDirectory())
{
// lookup the previous child and get its contents
final List<AVMNodeDescriptor> history = avmService.getHistory(desc, 2);
if (history.size() == 1)
{
return;
}
desc = history.get(1);
}
Map<String, AVMNodeDescriptor> list = avmService.getDirectoryListing(desc, true);
for (AVMNodeDescriptor child : list.values())
{
recursivelyRemoveLocks(webProject, version, child.getPath());

View File

@@ -46,6 +46,8 @@ public class UICharsetSelector extends UISelectOne
public static final String COMPONENT_TYPE = "org.alfresco.faces.CharsetSelector";
public static final String COMPONENT_FAMILY = "javax.faces.SelectOne";
private static List<SelectItem> charsetEncodings = null;
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
@@ -75,13 +77,25 @@ public class UICharsetSelector extends UISelectOne
*/
protected List<SelectItem> createList()
{
Map<String, Charset> availableCharsets = Charset.availableCharsets();
List<SelectItem> items = new ArrayList<SelectItem>(availableCharsets.size());
for (Charset charset : availableCharsets.values())
return getCharsetEncodingList();
}
/**
* @return the List of available system character set encodings as a List of SelectItem objects
*/
public static List<SelectItem> getCharsetEncodingList()
{
if (charsetEncodings == null)
{
SelectItem item = new SelectItem(charset.name(), charset.displayName());
items.add(item);
Map<String, Charset> availableCharsets = Charset.availableCharsets();
List<SelectItem> items = new ArrayList<SelectItem>(availableCharsets.size());
for (Charset charset : availableCharsets.values())
{
SelectItem item = new SelectItem(charset.name(), charset.displayName());
items.add(item);
}
charsetEncodings = items;
}
return items;
return charsetEncodings;
}
}

View File

@@ -776,7 +776,7 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
protected String getIcon(String fileName)
{
// work out what icon to use
String icon = "/images/filetypes32/html.gif";
String icon = "/images/filetypes32/_default.gif";
String ext = "";
int idx = fileName.indexOf(".");
if (idx != -1)
@@ -784,7 +784,11 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen
ext = fileName.substring(idx);
}
if (ext.equals(".xml"))
if (ext.equals(".html") || ext.equals(".htm"))
{
icon = "/images/filetypes32/html.gif";
}
else if (ext.equals(".xml"))
{
icon = "/images/icons/webform_large.gif";
}