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:
@@ -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";
|
||||
@@ -365,18 +368,47 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
*/
|
||||
protected String getDialogContainer(FacesContext context)
|
||||
{
|
||||
if (this.dialogContainer == null)
|
||||
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())
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
if (this.plainDialogContainer == null)
|
||||
{
|
||||
this.dialogContainer = globalConfig.getConfigElement("dialog-container").getValue();
|
||||
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)
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
{
|
||||
this.dialogContainer = globalConfig.getConfigElement("dialog-container").getValue();
|
||||
}
|
||||
}
|
||||
|
||||
container = this.dialogContainer;
|
||||
}
|
||||
|
||||
return this.dialogContainer;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Using dialog container: " + container);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,18 +419,47 @@ public class AlfrescoNavigationHandler extends NavigationHandler
|
||||
*/
|
||||
protected String getWizardContainer(FacesContext context)
|
||||
{
|
||||
if (this.wizardContainer == null)
|
||||
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())
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
if (this.plainWizardContainer == null)
|
||||
{
|
||||
this.wizardContainer = globalConfig.getConfigElement("wizard-container").getValue();
|
||||
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)
|
||||
{
|
||||
ConfigService configSvc = Application.getConfigService(context);
|
||||
Config globalConfig = configSvc.getGlobalConfig();
|
||||
|
||||
if (globalConfig != null)
|
||||
{
|
||||
this.wizardContainer = globalConfig.getConfigElement("wizard-container").getValue();
|
||||
}
|
||||
}
|
||||
|
||||
container = this.wizardContainer;
|
||||
}
|
||||
|
||||
return 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user