SLNG-764: Add warning to JSF client when browsing into Share managed folders.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11076 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2008-09-29 16:25:27 +00:00
parent e5e448fc9b
commit c9afa4a3c8
3 changed files with 86 additions and 1 deletions

View File

@@ -1996,3 +1996,5 @@ SiteManager=Site Manager
SiteConsumer=Site Consumer SiteConsumer=Site Consumer
SiteCollaborator=Site Collaborator SiteCollaborator=Site Collaborator
SiteContributor=Site Contributor SiteContributor=Site Contributor
sites_space_warning=This space is managed by Alfresco Share. Please use the Alfresco Share application to work with content within this space and any sub-spaces.

View File

@@ -24,7 +24,9 @@
*/ */
package org.alfresco.web.bean; package org.alfresco.web.bean;
import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.io.StringWriter;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@@ -37,6 +39,7 @@ import java.util.Set;
import javax.faces.application.NavigationHandler; import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionEvent; import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
@@ -46,6 +49,7 @@ import org.alfresco.config.ConfigService;
import org.alfresco.model.ApplicationModel; import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.search.SearcherException; import org.alfresco.repo.search.SearcherException;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.web.scripts.FileTypeImageUtils; import org.alfresco.repo.web.scripts.FileTypeImageUtils;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.dictionary.TypeDefinition;
@@ -81,6 +85,7 @@ import org.alfresco.web.bean.spaces.CreateSpaceWizard;
import org.alfresco.web.bean.users.UserPreferencesBean; import org.alfresco.web.bean.users.UserPreferencesBean;
import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.config.ViewsConfigElement; import org.alfresco.web.config.ViewsConfigElement;
import org.alfresco.web.ui.common.PanelGenerator;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.Utils.URLMode;
import org.alfresco.web.ui.common.component.IBreadcrumbHandler; import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
@@ -648,6 +653,79 @@ public class BrowseBean implements IContextListener, Serializable
return result; return result;
} }
/**
* Determines whether the current space is a 'Sites' space
*
* @return true if the current space is a 'Sites' space
*/
public boolean isSitesSpace()
{
boolean siteSpace = false;
Node currentNode = this.navigator.getCurrentNode();
if (currentNode != null)
{
// check the type of the node to see if it is a 'site' related space
QName currentNodeType = currentNode.getType();
if (SiteModel.TYPE_SITES.isMatch(currentNodeType) ||
SiteModel.TYPE_SITE.isMatch(currentNodeType))
{
siteSpace = true;
}
}
return siteSpace;
}
/**
* Returns the HTML to display if a space is a 'Sites' space
*
* @return The HTML to display
*/
public String getSitesSpaceWarningHTML()
{
FacesContext context = FacesContext.getCurrentInstance();
String contextPath = context.getExternalContext().getRequestContextPath();
StringBuilder html = new StringBuilder();
try
{
html.append("<tr valign='top'>");
html.append("<td style='background-image: url(");
html.append(contextPath);
html.append("/images/parts/whitepanel_4.gif)' ");
html.append("width='4'></td><td style='padding:4px'>");
StringWriter writer = new StringWriter();
PanelGenerator.generatePanelStart(writer, contextPath, "yellowInner", "#ffffcc");
html.append(writer.toString());
html.append("<table cellpadding='0' cellspacing='0' border='0' width='100%'>");
html.append("<tr><td valign='top' style='padding-top: 2px' width='20'>");
html.append("<img src='");
html.append(contextPath);
html.append("/images/icons/warning.gif' width='16' height='16' /></td>");
html.append("<td class='mainSubText'>");
html.append(Application.getMessage(context, "sites_space_warning"));
html.append("</td></tr></table>");
writer = new StringWriter();
PanelGenerator.generatePanelEnd(writer, contextPath, "yellowInner");
html.append(writer.toString());
html.append("</td><td style='background-image: url(");
html.append(contextPath);
html.append("/images/parts/whitepanel_6.gif)'");
html.append("width='4'></td></tr>");
}
catch (IOException ioe)
{
logger.error(ioe);
}
return html.toString();
}
/** /**
* Setup the common properties required at data-binding time. * Setup the common properties required at data-binding time.

View File

@@ -26,6 +26,8 @@
<%@ page import="org.alfresco.web.app.Application" %> <%@ page import="org.alfresco.web.app.Application" %>
<%@ page import="javax.faces.context.FacesContext" %> <%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
@@ -206,6 +208,9 @@
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width=4 height=9></td> <td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width=4 height=9></td>
</tr> </tr>
<%-- warning message for 'Sites' space --%>
<h:outputText id="sites-space-warning" rendered="#{BrowseBean.sitesSpace}" value="#{BrowseBean.sitesSpaceWarningHTML}" escape="false" />
<%-- Custom Template View --%> <%-- Custom Template View --%>
<a:panel id="custom-wrapper-panel" rendered="#{NavigationBean.hasCustomView && NavigationBean.searchContext == null}"> <a:panel id="custom-wrapper-panel" rendered="#{NavigationBean.hasCustomView && NavigationBean.searchContext == null}">
<tr valign=top> <tr valign=top>