mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added ability for the dialog and wizard framework to use a 'lightweight' container i.e. with none of the usual web client stuff. Useful for showing dialogs and wizards in popup windows from the new webscripts portlets.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5711 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
<#assign formcount=formcount+1>
|
||||
<div class="formsRow">
|
||||
<img src="${url.context}/images/icons/webform_large.gif" width=32 height=32 border=0>
|
||||
<a class="webformLink" href="${url.context}/command/ui/createwebcontent?sandbox=${sandbox}&webproject=${wp.id}&form=${form.properties["wca:formname"]}" target="new">${form.properties.title}</a>
|
||||
<a class="webformLink" href="${url.context}/command/ui/createwebcontent?sandbox=${sandbox}&webproject=${wp.id}&form=${form.properties["wca:formname"]}&container=plain" target="new">${form.properties.title}</a>
|
||||
<#--<span>${form.properties.description}</span>-->
|
||||
</div>
|
||||
</#list>
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
<config>
|
||||
<dialog-container>/jsp/dialog/container.jsp</dialog-container>
|
||||
<plain-dialog-container>/jsp/dialog/plain-container.jsp</plain-dialog-container>
|
||||
|
||||
<dialogs>
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
<config>
|
||||
<wizard-container>/jsp/wizard/container.jsp</wizard-container>
|
||||
<plain-wizard-container>/jsp/wizard/plain-container.jsp</plain-wizard-container>
|
||||
|
||||
<wizards>
|
||||
|
||||
|
@@ -60,9 +60,12 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
public final static String WIZARD_PREFIX = "wizard" + OUTCOME_SEPARATOR;
|
||||
public final static String CLOSE_DIALOG_OUTCOME = DIALOG_PREFIX + "close";
|
||||
public final static String CLOSE_WIZARD_OUTCOME = WIZARD_PREFIX + "close";
|
||||
public final static String EXTERNAL_CONTAINER_REQUEST = "externalContainerRequest";
|
||||
|
||||
protected String dialogContainer = null;
|
||||
protected String wizardContainer = null;
|
||||
protected String plainDialogContainer = null;
|
||||
protected String plainWizardContainer = null;
|
||||
|
||||
private final static Log logger = LogFactory.getLog(AlfrescoNavigationHandler.class);
|
||||
private final static String VIEW_STACK = "_alfViewStack";
|
||||
@@ -364,6 +367,29 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
* @return The container page
|
||||
*/
|
||||
protected String getDialogContainer(FacesContext context)
|
||||
{
|
||||
String container;
|
||||
|
||||
// determine which kind of container we need to return, if the
|
||||
// external request flag is set then use the plain container
|
||||
Object obj = context.getExternalContext().getRequestMap().get(EXTERNAL_CONTAINER_REQUEST);
|
||||
|
||||
if (obj != null && obj instanceof Boolean && ((Boolean)obj).booleanValue())
|
||||
{
|
||||
if (this.plainDialogContainer == null)
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
{
|
||||
this.plainDialogContainer = globalConfig.getConfigElement("plain-dialog-container").getValue();
|
||||
}
|
||||
}
|
||||
|
||||
container = this.plainDialogContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.dialogContainer == null)
|
||||
{
|
||||
@@ -376,7 +402,13 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
}
|
||||
}
|
||||
|
||||
return this.dialogContainer;
|
||||
container = this.dialogContainer;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Using dialog container: " + container);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,6 +418,29 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
* @return The container page
|
||||
*/
|
||||
protected String getWizardContainer(FacesContext context)
|
||||
{
|
||||
String container;
|
||||
|
||||
// determine which kind of container we need to return, if the
|
||||
// external request flag is set then use the plain container
|
||||
Object obj = context.getExternalContext().getRequestMap().get(EXTERNAL_CONTAINER_REQUEST);
|
||||
|
||||
if (obj != null && obj instanceof Boolean && ((Boolean)obj).booleanValue())
|
||||
{
|
||||
if (this.plainWizardContainer == null)
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
{
|
||||
this.plainWizardContainer = globalConfig.getConfigElement("plain-wizard-container").getValue();
|
||||
}
|
||||
}
|
||||
|
||||
container = this.plainWizardContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.wizardContainer == null)
|
||||
{
|
||||
@@ -398,7 +453,13 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
}
|
||||
}
|
||||
|
||||
return this.wizardContainer;
|
||||
container = this.wizardContainer;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Using wizard container: " + container);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,6 +40,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.NavigationBean;
|
||||
@@ -261,6 +262,11 @@ public class ExternalAccessServlet extends BaseServlet
|
||||
NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
navigator.setCurrentNodeId(args[1]);
|
||||
}
|
||||
|
||||
// set the external container request flag so that a plain container gets used
|
||||
fc.getExternalContext().getRequestMap().put(
|
||||
AlfrescoNavigationHandler.EXTERNAL_CONTAINER_REQUEST, Boolean.TRUE);
|
||||
|
||||
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
|
||||
navigationHandler.handleNavigation(fc, null, outcome + ':' + args[0]);
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
|
||||
/**
|
||||
@@ -52,6 +53,8 @@ import org.alfresco.web.app.servlet.FacesHelper;
|
||||
*/
|
||||
public class UIActionCommandProcessor implements ExtCommandProcessor
|
||||
{
|
||||
public static final String PARAM_CONTAINER = "container";
|
||||
|
||||
private ServletContext sc = null;
|
||||
private String command = null;
|
||||
private Map<String, String> args = null;
|
||||
@@ -91,6 +94,16 @@ public class UIActionCommandProcessor implements ExtCommandProcessor
|
||||
properties.put(BaseUIActionCommand.PROP_SERVLETCONTEXT, this.sc);
|
||||
properties.put(BaseUIActionCommand.PROP_REQUEST, request);
|
||||
properties.put(BaseUIActionCommand.PROP_RESPONSE, response);
|
||||
|
||||
// if the container parameter is present and equal to "plain" add the
|
||||
// external container object to the request
|
||||
String container = request.getParameter(PARAM_CONTAINER);
|
||||
if (container != null && container.equalsIgnoreCase("plain"))
|
||||
{
|
||||
request.setAttribute(
|
||||
AlfrescoNavigationHandler.EXTERNAL_CONTAINER_REQUEST, Boolean.TRUE);
|
||||
}
|
||||
|
||||
Command cmd = CommandFactory.getInstance().createCommand(command);
|
||||
if (cmd == null)
|
||||
{
|
||||
|
68
source/web/jsp/dialog/plain-container.jsp
Normal file
68
source/web/jsp/dialog/plain-container.jsp
Normal file
@@ -0,0 +1,68 @@
|
||||
<%--
|
||||
* 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"
|
||||
--%>
|
||||
<%@ 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/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
|
||||
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<%@ page import="org.alfresco.web.app.Application" %>
|
||||
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
|
||||
|
||||
<r:page title="<%=Application.getDialogManager().getTitle() %>">
|
||||
|
||||
<f:view>
|
||||
|
||||
<%-- load a bundle of properties with I18N strings --%>
|
||||
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
|
||||
|
||||
<h:form acceptcharset="UTF-8" id="dialog">
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%" valign="top">
|
||||
|
||||
<a:errors message="#{DialogManager.errorMessage}" styleClass="errorMessage" />
|
||||
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
<f:subview id="dialog-body">
|
||||
<jsp:include page="<%=Application.getDialogManager().getPage() %>" />
|
||||
</f:subview>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
||||
<td valign="top">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
|
||||
<r:dialogButtons id="dialog-buttons" styleClass="wizardButton" />
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</h:form>
|
||||
|
||||
</f:view>
|
||||
|
||||
</r:page>
|
Reference in New Issue
Block a user