mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7422: Deployment UI changes 7424: Deployment UI changes 7426: Created 'More Actions' menu for user sandboxes and moved various actions into it 7428: Server config UI 7433: Added ability to deploy a workflow sandbox to a test server 7434: Fixed confusing comment 7442: Enabled users with contributor and reviewer roles to reserve a test server and deploy to it 7443: Preparation for auto deployment git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8362 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -58,7 +58,7 @@ public class ChildAssociationGenerator extends BaseComponentGenerator
|
||||
// check disables the ok button if necessary, as the user
|
||||
// adds or removes items from the multi value list the
|
||||
// page will be refreshed and therefore re-check the status.
|
||||
// Only so this however id the component is not read-only
|
||||
// But only do this if the component is not read-only
|
||||
|
||||
if (item.isReadOnly() == false)
|
||||
{
|
||||
|
@@ -50,6 +50,8 @@ import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.actions.AVMRevertStoreAction;
|
||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
@@ -113,8 +115,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AVMBrowseBean.class);
|
||||
|
||||
private static final String REQUEST_BEEN_DEPLOYED_KEY = "_alfBeenDeployedEvaluated";
|
||||
private static final String REQUEST_BEEN_DEPLOYED_RESULT = "_alfBeenDeployedResult";
|
||||
public static final String REQUEST_BEEN_DEPLOYED_RESULT = "_alfBeenDeployedResult";
|
||||
|
||||
private static final String MSG_REVERT_SUCCESS = "revert_success";
|
||||
private static final String MSG_REVERT_SANDBOX = "revert_sandbox_success";
|
||||
@@ -909,28 +910,28 @@ public class AVMBrowseBean implements IContextListener
|
||||
// expression in a 'rendered' attribute, we therefore cache the result
|
||||
// on a per request basis
|
||||
|
||||
List<NodeRef> deployAttempts = null;
|
||||
Boolean result = null;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
Map request = context.getExternalContext().getRequestMap();
|
||||
if (request.get(REQUEST_BEEN_DEPLOYED_KEY) == null)
|
||||
if (request.get(REQUEST_BEEN_DEPLOYED_RESULT) == null)
|
||||
{
|
||||
// see if there are any deployment attempts for the staging area
|
||||
NodeRef webProjectRef = this.getWebsite().getNodeRef();
|
||||
String store = (String)nodeService.getProperty(webProjectRef,
|
||||
WCMAppModel.PROP_AVMSTORE);
|
||||
deployAttempts = DeploymentUtil.findDeploymentAttempts(store);
|
||||
List<NodeRef> deployAttempts = DeploymentUtil.findDeploymentAttempts(store);
|
||||
|
||||
// add a placeholder object in the request so we don't evaluate this again for this request
|
||||
request.put(REQUEST_BEEN_DEPLOYED_KEY, Boolean.TRUE);
|
||||
request.put(REQUEST_BEEN_DEPLOYED_RESULT, deployAttempts);
|
||||
result = new Boolean(deployAttempts != null && deployAttempts.size() > 0);
|
||||
request.put(REQUEST_BEEN_DEPLOYED_RESULT, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
deployAttempts = (List<NodeRef>)request.get(REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
result = (Boolean)request.get(REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
}
|
||||
|
||||
return (deployAttempts != null && deployAttempts.size() > 0);
|
||||
return result.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1421,6 +1422,125 @@ public class AVMBrowseBean implements IContextListener
|
||||
AVMUtil.updateVServerWebapp(webappPath, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the test server allocated to the store
|
||||
*/
|
||||
public void releaseTestServer(ActionEvent event)
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
String store = params.get("store");
|
||||
|
||||
if (store != null)
|
||||
{
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
tx = Repository.getUserTransaction(context, false);
|
||||
tx.begin();
|
||||
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(store);
|
||||
if (testServer != null)
|
||||
{
|
||||
getNodeService().setProperty(testServer,
|
||||
WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, null);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Released test server '" + testServer + "' from store: " + store);
|
||||
}
|
||||
|
||||
tx.commit();
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all deploymentreport nodes associated with the web project
|
||||
*/
|
||||
public String resetDeploymentHistory()
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
RetryingTransactionHelper txnHelper = Repository.getRetryingTransactionHelper(context);
|
||||
RetryingTransactionCallback<String> callback = new RetryingTransactionCallback<String>()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public String execute() throws Throwable
|
||||
{
|
||||
// just in case there are any left, iterate through any old deploymentreport
|
||||
// associations from the current web project and delete them.
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
|
||||
getWebsite().getNodeRef(), WCMAppModel.ASSOC_DEPLOYMENTREPORT,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
int count = deployReportRefs.size();
|
||||
for (ChildAssociationRef ref : deployReportRefs)
|
||||
{
|
||||
NodeRef report = ref.getChildRef();
|
||||
if (report != null)
|
||||
{
|
||||
// remove the node
|
||||
nodeService.deleteNode(report);
|
||||
}
|
||||
}
|
||||
|
||||
// iterate through all deploymentattempt associations from the current
|
||||
// web project and delete them.
|
||||
List<ChildAssociationRef> deployAttemptRefs = nodeService.getChildAssocs(
|
||||
getWebsite().getNodeRef(), WCMAppModel.ASSOC_DEPLOYMENTATTEMPT,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
count += deployAttemptRefs.size();
|
||||
for (ChildAssociationRef ref : deployAttemptRefs)
|
||||
{
|
||||
NodeRef attempt = ref.getChildRef();
|
||||
if (attempt != null)
|
||||
{
|
||||
// remove the node
|
||||
nodeService.deleteNode(attempt);
|
||||
}
|
||||
}
|
||||
|
||||
// remove the old properties in case they are still present
|
||||
nodeService.removeProperty(getWebsite().getNodeRef(),
|
||||
WCMAppModel.PROP_DEPLOYTO);
|
||||
nodeService.removeProperty(getWebsite().getNodeRef(),
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYTO);
|
||||
nodeService.removeProperty(getWebsite().getNodeRef(),
|
||||
WCMAppModel.PROP_SELECTEDDEPLOYVERSION);
|
||||
|
||||
// remove the hasBeenDeployed object from the session so it gets
|
||||
// re-evaluated (and disappears)
|
||||
Map request = FacesContext.getCurrentInstance().
|
||||
getExternalContext().getRequestMap();
|
||||
request.remove(REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Removed " + count + " previous deployment attempts");
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
// Execute
|
||||
txnHelper.doInTransaction(callback);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC),
|
||||
err.getMessage()), err);
|
||||
}
|
||||
|
||||
return "browseWebsite";
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo changes to a single node
|
||||
*/
|
||||
|
@@ -1186,6 +1186,15 @@ public class CreateWebsiteWizard extends BaseWizardBean
|
||||
return null;
|
||||
}
|
||||
|
||||
public String cancelDeploymentServerConfig()
|
||||
{
|
||||
this.currentDeployServer = null;
|
||||
this.editedDeployServerProps.clear();
|
||||
this.inAddDeployServerMode = false;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Define Web Content Workflows page
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
@@ -44,12 +45,17 @@ import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.jsf.FacesContextUtils;
|
||||
|
||||
/**
|
||||
* Deploys a website to one or more remote servers.
|
||||
@@ -64,6 +70,7 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
protected String[] deployTo;
|
||||
protected String store;
|
||||
protected String deployMode;
|
||||
protected String calledFromTaskDialog;
|
||||
protected NodeRef websiteRef;
|
||||
protected NodeRef webProjectRef;
|
||||
protected boolean updateTestServer;
|
||||
@@ -94,10 +101,22 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
this.versionToDeploy = -1;
|
||||
}
|
||||
|
||||
// get the store
|
||||
this.store = parameters.get("store");
|
||||
String storeRoot = AVMUtil.buildSandboxRootPath(this.store);
|
||||
this.websiteRef = AVMNodeConverter.ToNodeRef(this.versionToDeploy, storeRoot);
|
||||
|
||||
// get the web project noderef
|
||||
String webProject = parameters.get("webproject");
|
||||
if (webProject == null)
|
||||
{
|
||||
this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.webProjectRef = new NodeRef(webProject);
|
||||
}
|
||||
|
||||
this.deployMode = (this.versionToDeploy == -1) ?
|
||||
WCMAppModel.CONSTRAINT_TESTSERVER : WCMAppModel.CONSTRAINT_LIVESERVER;
|
||||
|
||||
@@ -108,8 +127,8 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
this.updateTestServer = Boolean.parseBoolean(updateTestServerParam);
|
||||
}
|
||||
|
||||
this.calledFromTaskDialog = parameters.get("calledFromTaskDialog");
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().clear();
|
||||
this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Initialising dialog to deploy: " + this.websiteRef.toString());
|
||||
@@ -124,6 +143,12 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
|
||||
if (this.deployTo != null && this.deployTo.length > 0)
|
||||
{
|
||||
// get the unprotected NodeService and PermissionService for this dialog otherwise
|
||||
// 'AddChildren' permission would be required on the web project node for all users
|
||||
WebApplicationContext wac = FacesContextUtils.getRequiredWebApplicationContext(context);
|
||||
NodeService unprotectedNodeService = (NodeService)wac.getBean("nodeService");
|
||||
PermissionService unprotectedPermissionService = (PermissionService)wac.getBean("permissionService");
|
||||
|
||||
List<String> selectedDeployToNames = new ArrayList<String>();
|
||||
|
||||
// create a deploymentattempt node to represent this deployment
|
||||
@@ -134,21 +159,26 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTSTORE, this.store);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTVERSION, this.versionToDeploy);
|
||||
props.put(WCMAppModel.PROP_DEPLOYATTEMPTTIME, new Date());
|
||||
NodeRef attempt = getNodeService().createNode(this.webProjectRef,
|
||||
NodeRef attempt = unprotectedNodeService.createNode(this.webProjectRef,
|
||||
WCMAppModel.ASSOC_DEPLOYMENTATTEMPT, WCMAppModel.ASSOC_DEPLOYMENTATTEMPT,
|
||||
WCMAppModel.TYPE_DEPLOYMENTATTEMPT, props).getChildRef();
|
||||
|
||||
// allow anyone to add child nodes to the deploymentattempt node
|
||||
unprotectedPermissionService.setPermission(attempt, PermissionService.ALL_AUTHORITIES,
|
||||
PermissionService.ADD_CHILDREN, true);
|
||||
|
||||
// execute a deploy action for each of the selected remote servers asynchronously
|
||||
for (String targetServer : this.deployTo)
|
||||
{
|
||||
if (targetServer.length() > 0)
|
||||
{
|
||||
NodeRef serverRef = new NodeRef(targetServer);
|
||||
if (getNodeService().exists(serverRef))
|
||||
if (unprotectedNodeService.exists(serverRef))
|
||||
{
|
||||
// get all properties of the target server
|
||||
Map<QName, Serializable> serverProps = getNodeService().getProperties(serverRef);
|
||||
Map<QName, Serializable> serverProps = unprotectedNodeService.getProperties(serverRef);
|
||||
|
||||
String url = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURL);
|
||||
String serverUri = AVMDeployWebsiteAction.calculateServerUri(serverProps);
|
||||
String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
@@ -171,7 +201,7 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
}
|
||||
else
|
||||
{
|
||||
getNodeService().setProperty(serverRef, WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO,
|
||||
unprotectedNodeService.setProperty(serverRef, WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO,
|
||||
this.store);
|
||||
}
|
||||
}
|
||||
@@ -185,13 +215,13 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
// create a deployment monitor object, store in the session,
|
||||
// add to avm browse bean and pass to action
|
||||
DeploymentMonitor monitor = new DeploymentMonitor(
|
||||
this.websiteRef, serverRef, versionToDeploy, serverName, attemptId);
|
||||
this.websiteRef, serverRef, versionToDeploy, serverName, attemptId, url);
|
||||
context.getExternalContext().getSessionMap().put(monitor.getId(), monitor);
|
||||
this.avmBrowseBean.getDeploymentMonitorIds().add(monitor.getId());
|
||||
|
||||
// create and execute the action asynchronously
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMDeployWebsiteAction.PARAM_WEBSITE, webProjectRef);
|
||||
args.put(AVMDeployWebsiteAction.PARAM_WEBPROJECT, webProjectRef);
|
||||
args.put(AVMDeployWebsiteAction.PARAM_SERVER, serverRef);
|
||||
args.put(AVMDeployWebsiteAction.PARAM_ATTEMPT, attempt);
|
||||
args.put(AVMDeployWebsiteAction.PARAM_CALLBACK, monitor);
|
||||
@@ -206,7 +236,7 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
}
|
||||
|
||||
// now we know the list of selected servers set the property on the attempt node
|
||||
getNodeService().setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS,
|
||||
unprotectedNodeService.setProperty(attempt, WCMAppModel.PROP_DEPLOYATTEMPTSERVERS,
|
||||
(Serializable)selectedDeployToNames);
|
||||
|
||||
// set the deploymentattempid property on the store this deployment was for
|
||||
@@ -215,6 +245,10 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
new PropertyValue(DataTypeDefinition.TEXT, attemptId));
|
||||
|
||||
// close this dialog and immediately open the monitorDeployment dialog
|
||||
Map<String, String> params = new HashMap<String, String>(2);
|
||||
params.put("webproject", this.webProjectRef.toString());
|
||||
params.put("calledFromTaskDialog", this.calledFromTaskDialog);
|
||||
Application.getDialogManager().setupParameters(params);
|
||||
return "dialog:monitorDeployment";
|
||||
}
|
||||
else
|
||||
@@ -238,10 +272,63 @@ public class DeployWebsiteDialog extends BaseDialogBean
|
||||
return super.getCancelButtonLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerDescription()
|
||||
{
|
||||
String desc = null;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.deployMode))
|
||||
{
|
||||
desc = bundle.getString("deploy_snapshot_desc");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.updateTestServer)
|
||||
{
|
||||
desc = bundle.getString("redeploy_sandbox_desc");
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = bundle.getString("deploy_sandbox_desc");
|
||||
}
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerTitle()
|
||||
{
|
||||
String title = null;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
|
||||
if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.deployMode))
|
||||
{
|
||||
title = bundle.getString("deploy_snapshot_title");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.updateTestServer)
|
||||
{
|
||||
title = bundle.getString("redeploy_sandbox_title");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = bundle.getString("deploy_sandbox_title");
|
||||
}
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean getters and setters
|
||||
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVM BrowseBean to set
|
||||
*/
|
||||
|
@@ -51,6 +51,8 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
private NodeRef targetServer;
|
||||
private String targetServerName;
|
||||
private String deployAttemptId;
|
||||
private String url;
|
||||
private String reason;
|
||||
private int snapshotVersion;
|
||||
private boolean started = false;
|
||||
private boolean finished = false;
|
||||
@@ -63,7 +65,7 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
* Default constructor
|
||||
*/
|
||||
public DeploymentMonitor(NodeRef website, NodeRef server, int snapshotVersion,
|
||||
String serverName, String deployAttemptId)
|
||||
String serverName, String deployAttemptId, String url)
|
||||
{
|
||||
this.id = ID_PREFIX + Long.toString(System.currentTimeMillis()) + this.hashCode();
|
||||
this.website = website;
|
||||
@@ -71,6 +73,7 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
this.snapshotVersion = snapshotVersion;
|
||||
this.targetServerName = serverName;
|
||||
this.deployAttemptId = deployAttemptId;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -104,8 +107,10 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
*/
|
||||
public void errorOccurred(Throwable err)
|
||||
{
|
||||
this.reason = err.getMessage();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(this.targetServerName + ": ERROR: " + err.getMessage());
|
||||
logger.debug(this.targetServerName + ": ERROR: " + this.reason);
|
||||
|
||||
this.successful = false;
|
||||
this.finished = true;
|
||||
@@ -121,6 +126,8 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
buffer.append(" targetServerName=").append(this.targetServerName);
|
||||
buffer.append(" snapshotVersion=").append(this.snapshotVersion);
|
||||
buffer.append(" deployAttemptId=").append(this.deployAttemptId);
|
||||
buffer.append(" url=").append(this.url);
|
||||
buffer.append(" reason=").append(this.reason);
|
||||
buffer.append(" started=").append(this.started);
|
||||
buffer.append(" finished=").append(this.finished);
|
||||
buffer.append(" successful=").append(this.successful).append(")");
|
||||
@@ -140,6 +147,18 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
buffer.append("\" finished=\"");
|
||||
buffer.append(this.finished);
|
||||
buffer.append("\"");
|
||||
if (this.url != null)
|
||||
{
|
||||
buffer.append(" url=\"");
|
||||
buffer.append(this.url);
|
||||
buffer.append("\"");
|
||||
}
|
||||
if (this.reason != null)
|
||||
{
|
||||
buffer.append(" reason=\"");
|
||||
buffer.append(this.reason);
|
||||
buffer.append("\"");
|
||||
}
|
||||
if (this.finished)
|
||||
{
|
||||
buffer.append(" successful=\"");
|
||||
@@ -200,6 +219,22 @@ public class DeploymentMonitor implements DeploymentCallback, Serializable
|
||||
{
|
||||
return this.deployAttemptId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The URL of the server being deployed
|
||||
*/
|
||||
public String getUrl()
|
||||
{
|
||||
return this.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The reason for the error, null if an error has not occurred
|
||||
*/
|
||||
public String getReason()
|
||||
{
|
||||
return this.reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the deployment has started
|
||||
|
@@ -202,16 +202,16 @@ public final class DeploymentUtil
|
||||
* for the given web project.
|
||||
*
|
||||
* @param webProject Web project to get test servers for
|
||||
* @param allocated true only returns those servers already allocated
|
||||
* @param availableOnly if true only returns those servers still available for deployment
|
||||
* @return List of test servers
|
||||
*/
|
||||
public static List<NodeRef> findTestServers(NodeRef webProject, boolean allocated)
|
||||
public static List<NodeRef> findTestServers(NodeRef webProject, boolean availableOnly)
|
||||
{
|
||||
return findServers(webProject, false, allocated);
|
||||
return findServers(webProject, false, availableOnly);
|
||||
}
|
||||
|
||||
|
||||
private static List<NodeRef> findServers(NodeRef webProject, boolean live, boolean allocated)
|
||||
private static List<NodeRef> findServers(NodeRef webProject, boolean live, boolean availableOnly)
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
@@ -242,7 +242,7 @@ public final class DeploymentUtil
|
||||
query.append("\"");
|
||||
|
||||
// if required filter the test servers
|
||||
if (live == false && allocated == false)
|
||||
if (live == false && availableOnly)
|
||||
{
|
||||
query.append(" AND ISNULL:\"");
|
||||
query.append(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO.toString());
|
||||
|
@@ -25,14 +25,17 @@
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.linkvalidation.LinkValidationReport;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.workflow.ManageTaskDialog;
|
||||
@@ -52,6 +55,7 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
|
||||
|
||||
protected String store;
|
||||
protected String webapp;
|
||||
protected NodeRef webProjectRef;
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ManageLinkValidationTaskDialog.class);
|
||||
@@ -76,26 +80,30 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
|
||||
this.avmBrowseBean.setLinkValidationState(null);
|
||||
this.avmBrowseBean.setLinkValidationMonitor(null);
|
||||
|
||||
// try and retrieve the deployment report from the workflow
|
||||
// try and retrieve the link validation report from the workflow
|
||||
// store, if present setup the validation state on AVMBrowseBean
|
||||
String storeName = this.workflowPackage.getStoreRef().getIdentifier();
|
||||
this.store = this.workflowPackage.getStoreRef().getIdentifier();
|
||||
|
||||
// get the web project noderef for the workflow store
|
||||
String stagingStore = AVMUtil.getStoreId(this.store);
|
||||
this.webProjectRef = AVMUtil.getWebProjectNodeFromStore(stagingStore);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Retrieving link validation report from store '" + storeName + "'");
|
||||
logger.debug("Retrieving link validation report from store '" + this.store + "'");
|
||||
|
||||
PropertyValue val = this.getAvmService().getStoreProperty(storeName,
|
||||
PropertyValue val = this.getAvmService().getStoreProperty(this.store,
|
||||
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
|
||||
if (val != null)
|
||||
{
|
||||
LinkValidationReport report = (LinkValidationReport)val.getSerializableValue();
|
||||
if (report != null)
|
||||
{
|
||||
this.store = report.getStore();
|
||||
String reportStore = report.getStore();
|
||||
this.webapp = report.getWebapp();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found link validation report for webapp '" +
|
||||
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
|
||||
AVMUtil.buildStoreWebappPath(reportStore, this.webapp) + "'");
|
||||
|
||||
LinkValidationState state = new LinkValidationState(report);
|
||||
this.avmBrowseBean.setLinkValidationState(state);
|
||||
@@ -125,7 +133,7 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
|
||||
logger.debug("Viewing link validation report for webapp '" +
|
||||
AVMUtil.buildStoreWebappPath(this.store, this.webapp) + "'");
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>(1);
|
||||
Map<String, String> params = new HashMap<String, String>(3);
|
||||
params.put("store", this.store);
|
||||
params.put("webapp", this.webapp);
|
||||
params.put("compareToStaging", "true");
|
||||
@@ -134,6 +142,29 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
|
||||
return "dialog:linkValidation";
|
||||
}
|
||||
|
||||
public String deploy()
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Deploying workflow store: " + this.store);
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>(4);
|
||||
params.put("store", this.store);
|
||||
params.put("webproject", this.webProjectRef.toString());
|
||||
params.put("calledFromTaskDialog", Boolean.TRUE.toString());
|
||||
|
||||
// if a test server has already been allocated inform the dialog
|
||||
// that an update is needed
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(this.store);
|
||||
if (testServer != null)
|
||||
{
|
||||
params.put("updateTestServer", "true");
|
||||
}
|
||||
|
||||
Application.getDialogManager().setupParameters(params);
|
||||
|
||||
return "dialog:deployWebsite";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Getters and Setters
|
||||
|
||||
@@ -144,4 +175,33 @@ public class ManageLinkValidationTaskDialog extends ManageTaskDialog
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Determines if there are any test servers configured for the
|
||||
* web project this task belongs to
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean getTestServersAvailable()
|
||||
{
|
||||
// NOTE: This method is called a lot as it is referenced as a value binding
|
||||
// expression in a 'rendered' attribute, we therefore cache the result
|
||||
// on a per request basis
|
||||
|
||||
Boolean result = null;
|
||||
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
Map request = context.getExternalContext().getRequestMap();
|
||||
if (request.get(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT) == null)
|
||||
{
|
||||
List<NodeRef> testServers = DeploymentUtil.findTestServers(this.webProjectRef, false);
|
||||
result = new Boolean(testServers != null && testServers.size() > 0);
|
||||
request.put(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (Boolean)request.get(AVMBrowseBean.REQUEST_BEEN_DEPLOYED_RESULT);
|
||||
}
|
||||
|
||||
return result.booleanValue();
|
||||
}
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ public class MonitorDeploymentDialog extends BaseDialogBean
|
||||
{
|
||||
private static final long serialVersionUID = -2800892205678915972L;
|
||||
|
||||
protected String outcome;
|
||||
protected NodeRef webProjectRef;
|
||||
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
@@ -58,7 +59,27 @@ public class MonitorDeploymentDialog extends BaseDialogBean
|
||||
super.init(parameters);
|
||||
|
||||
// setup context for dialog
|
||||
this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
String webProject = parameters.get("webproject");
|
||||
if (webProject == null)
|
||||
{
|
||||
this.webProjectRef = this.avmBrowseBean.getWebsite().getNodeRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.webProjectRef = new NodeRef(webProject);
|
||||
}
|
||||
|
||||
// determine outcome required
|
||||
String calledFromTaskDialog = parameters.get("calledFromTaskDialog");
|
||||
if (calledFromTaskDialog != null &&
|
||||
calledFromTaskDialog.equals(Boolean.TRUE.toString()))
|
||||
{
|
||||
outcome = "dialog:close:myalfresco";
|
||||
}
|
||||
else
|
||||
{
|
||||
outcome = "dialog:close:browseWebsite";
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -76,7 +97,7 @@ public class MonitorDeploymentDialog extends BaseDialogBean
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return "dialog:close:browseWebsite";
|
||||
return this.outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -102,6 +102,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
private boolean enteringExpireDate = false;
|
||||
private boolean loadSelectedNodesFromBrowseBean = false;
|
||||
private boolean validateLinks = true;
|
||||
private boolean autoDeploy = false;
|
||||
private Date defaultExpireDate;
|
||||
private Date launchDate;
|
||||
|
||||
@@ -627,6 +628,8 @@ public class SubmitDialog extends BaseDialogBean
|
||||
this.workflowParams.put(WCMWorkflowModel.PROP_LAUNCH_DATE, this.launchDate);
|
||||
this.workflowParams.put(WCMWorkflowModel.PROP_VALIDATE_LINKS,
|
||||
new Boolean(this.validateLinks));
|
||||
this.workflowParams.put(WCMWorkflowModel.PROP_AUTO_DEPLOY,
|
||||
new Boolean(this.autoDeploy));
|
||||
this.workflowParams.put(WCMWorkflowModel.PROP_WEBAPP,
|
||||
this.avmBrowseBean.getWebapp());
|
||||
this.workflowParams.put(WCMWorkflowModel.ASSOC_WEBPROJECT,
|
||||
@@ -847,10 +850,27 @@ public class SubmitDialog extends BaseDialogBean
|
||||
{
|
||||
this.validateLinks = validateLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Flag to indicate whether the changes should be deployed upon approval
|
||||
*/
|
||||
public boolean isAutoDeploy()
|
||||
{
|
||||
return this.autoDeploy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param autoDeploy Flag to indicate whether the changes should be deployed upon approval
|
||||
*/
|
||||
public void setAutoDeploy(boolean autoDeploy)
|
||||
{
|
||||
this.autoDeploy = autoDeploy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of UIListItem object representing the available workflows for the website
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<UIListItem> getWorkflowList()
|
||||
{
|
||||
if (this.workflowItems == null)
|
||||
|
@@ -26,7 +26,6 @@ package org.alfresco.web.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -181,7 +180,7 @@ public class UIDeployWebsite extends UIInput
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Found deployment monitor: " + monitor);
|
||||
|
||||
renderServer(context, out, nodeService, monitor.getTargetServer(), false, true, id, true);
|
||||
renderMonitoredServer(context, out, nodeService, monitor.getTargetServer(), id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,13 +201,13 @@ public class UIDeployWebsite extends UIInput
|
||||
}
|
||||
else
|
||||
{
|
||||
List<NodeRef> servers = DeploymentUtil.findTestServers(webProject, false);
|
||||
List<NodeRef> servers = DeploymentUtil.findTestServers(webProject, true);
|
||||
if (servers.size() > 0)
|
||||
{
|
||||
boolean first = true;
|
||||
for (NodeRef server : servers)
|
||||
{
|
||||
renderServer(context, out, nodeService, server, first, false, null, false);
|
||||
renderTestServer(context, out, nodeService, server, first);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
@@ -217,9 +216,14 @@ public class UIDeployWebsite extends UIInput
|
||||
// show the none available message
|
||||
out.write("<div class='deployServersInfo'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/info_icon.gif' style='vertical-align: -5px;' /> ");
|
||||
out.write("/images/icons/info_icon.gif' /> ");
|
||||
out.write(Application.getMessage(context, "deploy_test_server_not_available"));
|
||||
out.write("</div>");
|
||||
out.write("</div>\n");
|
||||
out.write("<script type='text/javascript'>\n");
|
||||
out.write("disableOKButton = function() { ");
|
||||
out.write("document.getElementById('dialog:finish-button').disabled = true; }\n");
|
||||
out.write("window.onload = disableOKButton;\n");
|
||||
out.write("</script>\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,7 +237,7 @@ public class UIDeployWebsite extends UIInput
|
||||
// TODO: determine if the server has already been successfully deployed to
|
||||
boolean selected = true;
|
||||
|
||||
renderServer(context, out, nodeService, server, selected, false, null, true);
|
||||
renderLiveServer(context, out, nodeService, server, selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,69 +420,20 @@ public class UIDeployWebsite extends UIInput
|
||||
int pollFreq = AVMUtil.getRemoteDeploymentPollingFrequency() * 1000;
|
||||
|
||||
// render the script to handle the progress monitoring
|
||||
out.write("<script type='text/javascript'>\n");
|
||||
out.write("Alfresco.DeploymentMonitor = function(ids) {\n");
|
||||
out.write(" this.ids = ids;\n");
|
||||
out.write(" this.url = '");
|
||||
out.write("<script type='text/javascript' src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/ajax/invoke/DeploymentProgressBean.getStatus?ids=' + this.ids;\n");
|
||||
out.write(" this.failedMsg = '");
|
||||
out.write(Application.getMessage(context, "deploy_failed"));
|
||||
out.write("';\n");
|
||||
out.write(" this.successMsg = '");
|
||||
out.write(Application.getMessage(context, "deploy_successful"));
|
||||
out.write("';\n");
|
||||
out.write("}\n");
|
||||
out.write("Alfresco.DeploymentMonitor.prototype = {\n");
|
||||
out.write(" ids: null,\n");
|
||||
out.write(" url: null,\n");
|
||||
out.write(" failedMsg: null,\n");
|
||||
out.write(" successMsg: null,\n");
|
||||
out.write(" retrieveDeploymentStatus: function() {\n");
|
||||
out.write(" YAHOO.util.Connect.asyncRequest('GET', this.url,\n");
|
||||
out.write(" {\n");
|
||||
out.write(" success: this.processResults,\n");
|
||||
out.write(" failure: this.handleError,\n");
|
||||
out.write(" scope: this\n");
|
||||
out.write(" },\n");
|
||||
out.write(" null);\n");
|
||||
out.write(" },\n");
|
||||
out.write(" processResults: function(ajaxResponse) {\n");
|
||||
out.write(" var xml = ajaxResponse.responseXML.documentElement;\n");
|
||||
out.write(" var statuses = xml.getElementsByTagName('target-server');\n");
|
||||
out.write(" var noInProgress = statuses.length;\n");
|
||||
out.write(" if (noInProgress > 0) {\n");
|
||||
out.write(" for (var x = 0; x < noInProgress; x++) {\n");
|
||||
out.write(" var target = statuses[x];\n");
|
||||
out.write(" var id = target.getAttribute('id');\n");
|
||||
out.write(" var finished = target.getAttribute('finished');\n");
|
||||
out.write(" if (finished == 'true') {\n");
|
||||
out.write(" var successful = target.getAttribute('successful');\n");
|
||||
out.write(" var icon = document.getElementById(id + '_icon');\n");
|
||||
out.write(" if (icon != null) {\n");
|
||||
out.write(" var image = (successful == 'true') ? 'successful' : 'failed';\n");
|
||||
out.write(" icon.src = '/alfresco/images/icons/deploy_' + image + '.gif';\n");
|
||||
out.write(" }\n");
|
||||
out.write(" var text = document.getElementById(id + '_text');\n");
|
||||
out.write(" if (text != null) {\n");
|
||||
out.write(" var msg = (successful == 'true') ? this.successMsg : this.failedMsg;\n");
|
||||
out.write(" text.innerHTML = msg;\n");
|
||||
out.write(" }\n");
|
||||
out.write(" }\n");
|
||||
out.write(" }\n");
|
||||
out.write(" // there are still outstanding deployments, refresh in a few seconds\n");
|
||||
out.write(" setTimeout('Alfresco.monitor.retrieveDeploymentStatus()', ");
|
||||
out.write(Integer.toString(pollFreq));
|
||||
out.write(");\n");
|
||||
out.write(" }\n");
|
||||
out.write(" },\n");
|
||||
out.write(" handleError: function(ajaxResponse) {\n");
|
||||
out.write(" handleErrorYahoo(ajaxResponse.status + ' ' + ajaxResponse.statusText);\n");
|
||||
out.write(" }\n");
|
||||
out.write("}\n");
|
||||
out.write("/scripts/ajax/deployment.js'></script>\n");
|
||||
|
||||
out.write("<script type='text/javascript'>\n");
|
||||
out.write("Alfresco.initDeploymentMonitor = function() {\n");
|
||||
out.write(" Alfresco.monitor = new Alfresco.DeploymentMonitor('");
|
||||
out.write(ids.toString());
|
||||
out.write("', ");
|
||||
out.write(Integer.toString(pollFreq));
|
||||
out.write(", '");
|
||||
out.write(Application.getMessage(context, "deploy_failed"));
|
||||
out.write("', '");
|
||||
out.write(Application.getMessage(context, "deploy_successful"));
|
||||
out.write("');\n");
|
||||
out.write(" Alfresco.monitor.retrieveDeploymentStatus();\n");
|
||||
out.write("}\n");
|
||||
@@ -487,12 +442,139 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write("</script>\n");
|
||||
}
|
||||
|
||||
private void renderServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server, boolean selected, boolean monitoring, String monitorId,
|
||||
boolean liveServer) throws IOException
|
||||
private void renderLiveServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server, boolean selected) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
renderPanelStart(out, contextPath);
|
||||
|
||||
out.write("<div class='deployPanelControl'>");
|
||||
out.write("<input type='checkbox' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server.toString());
|
||||
out.write("'");
|
||||
if (selected)
|
||||
{
|
||||
out.write(" checked='checked'");
|
||||
}
|
||||
out.write(" /></div>");
|
||||
|
||||
renderPanelMiddle(out, contextPath, nodeService, server, true);
|
||||
|
||||
if (selected == false)
|
||||
{
|
||||
out.write("<div class='deployPanelServerStatus'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/info_icon.gif' style='vertical-align: -5px;' /> ");
|
||||
out.write(Application.getMessage(context, "deploy_server_not_selected"));
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
renderPanelEnd(out, contextPath);
|
||||
}
|
||||
|
||||
private void renderTestServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server, boolean selected) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
renderPanelStart(out, contextPath);
|
||||
|
||||
out.write("<div class='deployPanelControl'>");
|
||||
out.write("<input type='radio' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server.toString());
|
||||
out.write("'");
|
||||
if (selected)
|
||||
{
|
||||
out.write(" checked='checked'");
|
||||
}
|
||||
out.write(" /></div>");
|
||||
|
||||
renderPanelMiddle(out, contextPath, nodeService, server, true);
|
||||
renderPanelEnd(out, contextPath);
|
||||
}
|
||||
|
||||
private void renderAllocatedTestServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
renderPanelStart(out, contextPath);
|
||||
|
||||
//out.write("<div class='deployPanelNoControl'></div>");
|
||||
|
||||
renderPanelMiddle(out, contextPath, nodeService, server, false);
|
||||
|
||||
String url = (String)nodeService.getProperty(server, WCMAppModel.PROP_DEPLOYSERVERURL);
|
||||
if (url != null && url.length() > 0)
|
||||
{
|
||||
out.write("<div class='deployServersUrl'><a target='new' href='");
|
||||
out.write(url);
|
||||
out.write("'>");
|
||||
out.write(url);
|
||||
out.write("</a></div>");
|
||||
}
|
||||
|
||||
renderPanelEnd(out, contextPath);
|
||||
|
||||
// render a hidden field with the value of the allocated test server
|
||||
out.write("<input type='hidden' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server.toString());
|
||||
out.write("' />");
|
||||
}
|
||||
|
||||
private void renderMonitoredServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server, String monitorId) throws IOException
|
||||
{
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
|
||||
renderPanelStart(out, contextPath);
|
||||
|
||||
out.write("<div class='deployPanelStatusIcon'>");
|
||||
out.write("<img id='");
|
||||
out.write(monitorId);
|
||||
out.write("_icon' src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/ajax_anim.gif' />");
|
||||
out.write("</div>");
|
||||
|
||||
renderPanelMiddle(out, contextPath, nodeService, server, true);
|
||||
|
||||
out.write("<div class='deployPanelServerStatus' id='");
|
||||
out.write(monitorId);
|
||||
out.write("_status'>");
|
||||
out.write(Application.getMessage(context, "deploying"));
|
||||
out.write("</div>");
|
||||
|
||||
out.write("<div class='deployPanelServerMsg' id='");
|
||||
out.write(monitorId);
|
||||
out.write("_msg'>");
|
||||
out.write("</div>");
|
||||
|
||||
renderPanelEnd(out, contextPath);
|
||||
}
|
||||
|
||||
private void renderPanelStart(ResponseWriter out, String contextPath) throws IOException
|
||||
{
|
||||
// render start of panel
|
||||
out.write("<table cellspacing='0' cellpadding='0' border='0' width='100%'>");
|
||||
out.write("<tr><td width='10'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_start.gif' /></td>");
|
||||
out.write("<td style='background-image: url(");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_bg.gif); background-repeat: repeat-x;'>");
|
||||
}
|
||||
|
||||
private void renderPanelMiddle(ResponseWriter out, String contextPath,
|
||||
NodeService nodeService, NodeRef server, boolean showSeparator) throws IOException
|
||||
{
|
||||
Map<QName, Serializable> props = nodeService.getProperties(server);
|
||||
String deployType = (String)props.get(WCMAppModel.PROP_DEPLOYTYPE);
|
||||
String serverName = (String)props.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
@@ -501,48 +583,13 @@ public class UIDeployWebsite extends UIInput
|
||||
serverName = AVMDeployWebsiteAction.calculateServerUri(props);
|
||||
}
|
||||
|
||||
out.write("<table cellspacing='0' cellpadding='0' border='0' width='100%'>");
|
||||
out.write("<tr><td width='10'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_start.gif' /></td>");
|
||||
out.write("<td style='background-image: url(");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_bg.gif); background-repeat: repeat-x;'>");
|
||||
if (monitoring)
|
||||
out.write("</td>");
|
||||
if (showSeparator)
|
||||
{
|
||||
out.write("<div class='deployPanelStatusIcon'>");
|
||||
out.write("<img id='");
|
||||
out.write(monitorId);
|
||||
out.write("_icon' src='");
|
||||
out.write("<td width='2'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/ajax_anim.gif' />");
|
||||
out.write("/images/parts/deploy_panel_separator.gif' /></td>");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write("<div class='deployPanelControl'>");
|
||||
out.write("<input type='");
|
||||
if (liveServer)
|
||||
{
|
||||
out.write("checkbox");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write("radio");
|
||||
}
|
||||
out.write("' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server.toString());
|
||||
out.write("'");
|
||||
if (selected)
|
||||
{
|
||||
out.write(" checked='checked'");
|
||||
}
|
||||
out.write(" />");
|
||||
}
|
||||
out.write("</div></td><td width='2'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_separator.gif' /></td>");
|
||||
out.write("<td style='background-image: url(");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_bg.gif); background-repeat: repeat-x;'>");
|
||||
@@ -558,22 +605,11 @@ public class UIDeployWebsite extends UIInput
|
||||
out.write("<div class='deployPanelServerName'>");
|
||||
out.write(serverName);
|
||||
out.write("</div>");
|
||||
if (monitoring)
|
||||
{
|
||||
out.write("<div class='deployPanelServerStatus' id='");
|
||||
out.write(monitorId);
|
||||
out.write("_text'>");
|
||||
out.write(Application.getMessage(context, "deploying"));
|
||||
out.write("</div>");
|
||||
}
|
||||
else if (selected == false && liveServer == true)
|
||||
{
|
||||
out.write("<div class='deployPanelServerStatus'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/info_icon.gif' style='vertical-align: -5px;' /> ");
|
||||
out.write(Application.getMessage(context, "deploy_server_not_selected"));
|
||||
out.write("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPanelEnd(ResponseWriter out, String contextPath) throws IOException
|
||||
{
|
||||
// render end of panel
|
||||
out.write("</td><td width='10'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/parts/deploy_panel_end.gif' /></td></tr></table>");
|
||||
@@ -581,45 +617,4 @@ public class UIDeployWebsite extends UIInput
|
||||
// add some padding under each panel
|
||||
out.write("\n<div style='padding-top:8px;'></div>\n");
|
||||
}
|
||||
|
||||
private void renderAllocatedTestServer(FacesContext context, ResponseWriter out, NodeService nodeService,
|
||||
NodeRef server) throws IOException
|
||||
{
|
||||
Map<QName, Serializable> serverProps = nodeService.getProperties(server);
|
||||
String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = AVMDeployWebsiteAction.calculateServerUri(serverProps);
|
||||
}
|
||||
|
||||
String pattern = Application.getMessage(context, "deploy_test_server_allocated");
|
||||
String msg = MessageFormat.format(pattern, serverName);
|
||||
|
||||
out.write("<div class='deployServersInfo'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/info_icon.gif' /> ");
|
||||
out.write(msg);
|
||||
|
||||
String url = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURL);
|
||||
if (url != null && url.length() > 0)
|
||||
{
|
||||
out.write("<div style='margin: 12px 0px 0px 24px;'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/preview_website.gif");
|
||||
out.write("' /><a target='new' href='");
|
||||
out.write(url);
|
||||
out.write("'>");
|
||||
out.write("Preview Deployment");
|
||||
out.write("</a></div>");
|
||||
}
|
||||
|
||||
out.write("</div>");
|
||||
|
||||
// render a hidden field with the value of the allocated test server
|
||||
out.write("<input type='hidden' name='");
|
||||
out.write(this.getClientId(context));
|
||||
out.write("' value='");
|
||||
out.write(server.toString());
|
||||
out.write("' />");
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,9 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
if (attempt != null)
|
||||
{
|
||||
// render the supporting JavaScript
|
||||
renderScript(context, out);
|
||||
out.write("<script type='text/javascript' src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/scripts/ajax/deployment.js'></script>\n");
|
||||
|
||||
// iterate through each deployment report
|
||||
List<ChildAssociationRef> deployReportRefs = nodeService.getChildAssocs(
|
||||
@@ -202,28 +204,6 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
private void renderScript(FacesContext context, ResponseWriter out)
|
||||
throws IOException
|
||||
{
|
||||
out.write("<script type='text/javascript'>\n");
|
||||
out.write("function toggleDeploymentDetails(icon, server) {\n");
|
||||
out.write(" var currentState = icon.className;\n");
|
||||
out.write(" var detailsDiv = document.getElementById(server + '-deployment-details');\n");
|
||||
out.write(" if (currentState == 'collapsed') {\n");
|
||||
out.write(" icon.src = '");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/expanded.gif';\n");
|
||||
out.write(" icon.className = 'expanded';\n");
|
||||
out.write(" if (detailsDiv != null) { detailsDiv.style.display = 'block'; }\n");
|
||||
out.write(" } else {\n");
|
||||
out.write(" icon.src = '");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/collapsed.gif';\n");
|
||||
out.write(" icon.className = 'collapsed';\n");
|
||||
out.write(" if (detailsDiv != null) { detailsDiv.style.display = 'none'; }\n");
|
||||
out.write(" }\n}</script>\n");
|
||||
}
|
||||
|
||||
private void renderReport(FacesContext context, ResponseWriter out, NodeRef deploymentReport,
|
||||
NodeService nodeService, ContentService contentService)
|
||||
throws IOException
|
||||
@@ -236,15 +216,17 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
|
||||
// start the surrounding panel
|
||||
PanelGenerator.generatePanelStart(out,
|
||||
context.getExternalContext().getRequestContextPath(), "innerwhite", "white");
|
||||
context.getExternalContext().getRequestContextPath(), "lightstorm", "#eaeff2");
|
||||
|
||||
// extract the information we need to display
|
||||
Map<QName, Serializable> serverProps = nodeService.getProperties(deploymentReport);
|
||||
String server = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVER);
|
||||
boolean showServerAddress = true;
|
||||
String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAMEUSED);
|
||||
if (serverName == null || serverName.length() == 0)
|
||||
{
|
||||
serverName = server;
|
||||
showServerAddress = false;
|
||||
}
|
||||
|
||||
String deployType = WCMAppModel.CONSTRAINT_ALFDEPLOY;
|
||||
@@ -255,14 +237,14 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
|
||||
String creator = (String)serverProps.get(ContentModel.PROP_CREATOR);
|
||||
Date startTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYSTARTTIME);
|
||||
String started = null;
|
||||
String started = "";
|
||||
if (startTime != null)
|
||||
{
|
||||
started = Utils.getDateTimeFormat(context).format(startTime);
|
||||
}
|
||||
|
||||
Date endTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYENDTIME);
|
||||
String finished = null;
|
||||
String finished = "";
|
||||
if (endTime != null)
|
||||
{
|
||||
finished = Utils.getDateTimeFormat(context).format(endTime);
|
||||
@@ -274,7 +256,12 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
success = Boolean.FALSE;
|
||||
}
|
||||
|
||||
String url = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERURLUSED);
|
||||
String username = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAMEUSED);
|
||||
String source = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATHUSED);
|
||||
String target = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGETUSED);
|
||||
String failReason = (String)serverProps.get(WCMAppModel.PROP_DEPLOYFAILEDREASON);
|
||||
|
||||
String content = "";
|
||||
ContentReader reader = contentService.getReader(deploymentReport, ContentModel.PROP_CONTENT);
|
||||
if (reader != null)
|
||||
@@ -305,7 +292,7 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
out.write(".gif' /></td><td>");
|
||||
out.write("<div class='mainHeading'>");
|
||||
out.write(serverName);
|
||||
out.write("</div><div style='margin-top: 3px;'><img src='");
|
||||
out.write("</div><div style='margin-top: 3px; margin-bottom: 6px;'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/deploy_");
|
||||
if (success.booleanValue())
|
||||
@@ -326,26 +313,7 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
out.write(Application.getMessage(context, "deploy_failed"));
|
||||
}
|
||||
out.write("</div>");
|
||||
out.write("<div style='margin-top: 6px;'>");
|
||||
out.write(Application.getMessage(context, "snapshot"));
|
||||
out.write(": ");
|
||||
out.write(Integer.toString(snapshot));
|
||||
out.write("</div>");
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_started"));
|
||||
out.write(": ");
|
||||
out.write(started);
|
||||
out.write("</div>");
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_finished"));
|
||||
out.write(": ");
|
||||
out.write(finished);
|
||||
out.write("</div>");
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deployed_by"));
|
||||
out.write(": ");
|
||||
out.write(creator);
|
||||
out.write("</div>");
|
||||
|
||||
if (success.booleanValue() == false && failReason != null && failReason.length() > 0)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
@@ -354,11 +322,83 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
out.write(failReason);
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
if (showServerAddress)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_server"));
|
||||
out.write(": ");
|
||||
out.write(server);
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "snapshot"));
|
||||
out.write(": ");
|
||||
out.write(Integer.toString(snapshot));
|
||||
out.write("</div>");
|
||||
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_started"));
|
||||
out.write(": ");
|
||||
out.write(started);
|
||||
out.write("</div>");
|
||||
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_finished"));
|
||||
out.write(": ");
|
||||
out.write(finished);
|
||||
out.write("</div>");
|
||||
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deployed_by"));
|
||||
out.write(": ");
|
||||
out.write(creator);
|
||||
out.write("</div>");
|
||||
|
||||
if (username != null)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_server_username"));
|
||||
out.write(": ");
|
||||
out.write(username);
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
if (source != null)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_server_source_path"));
|
||||
out.write(": ");
|
||||
out.write(source);
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_server_target_name"));
|
||||
out.write(": ");
|
||||
out.write(target);
|
||||
out.write("</div>");
|
||||
}
|
||||
|
||||
if (success.booleanValue() == true && url != null && url.length() > 0)
|
||||
{
|
||||
out.write("<div style='margin-top: 3px;'>");
|
||||
out.write(Application.getMessage(context, "deploy_server_url"));
|
||||
out.write(": <a target='new' href='");
|
||||
out.write(url);
|
||||
out.write("'>");
|
||||
out.write(url);
|
||||
out.write("</a></div>");
|
||||
}
|
||||
|
||||
if (content.length() > 0)
|
||||
{
|
||||
out.write("<div style='margin-top: 6px;'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/collapsed.gif' style='vertical-align: -1px; cursor: pointer;' class='collapsed' onclick=\"toggleDeploymentDetails(this, '");
|
||||
out.write("/images/icons/collapsed.gif' style='vertical-align: -1px; cursor: pointer;' class='collapsed' onclick=\"Alfresco.toggleDeploymentDetails(this, '");
|
||||
out.write(server.replace(':', '_').replace('\\', '_'));
|
||||
out.write("');\" /> ");
|
||||
out.write(Application.getMessage(context, "details"));
|
||||
@@ -374,6 +414,6 @@ public class UIDeploymentReports extends SelfRenderingComponent
|
||||
|
||||
// finish the surrounding panel
|
||||
PanelGenerator.generatePanelEnd(out,
|
||||
context.getExternalContext().getRequestContextPath(), "innerwhite");
|
||||
context.getExternalContext().getRequestContextPath(), "lightstorm");
|
||||
}
|
||||
}
|
||||
|
@@ -63,8 +63,6 @@ import org.alfresco.web.ui.repo.component.UIActions;
|
||||
*/
|
||||
public class UIDeploymentServers extends UIInput
|
||||
{
|
||||
private static final String MSG_ALF_SERVER = "deploy_add_alf_receiver";
|
||||
private static final String MSG_FILE_SYSTEM = "deploy_add_file_receiver";
|
||||
private static final String MSG_LIVE_SERVER = "deploy_server_type_live";
|
||||
private static final String MSG_TEST_SERVER = "deploy_server_type_test";
|
||||
private static final String MSG_TYPE = "deploy_server_type";
|
||||
@@ -149,7 +147,9 @@ public class UIDeploymentServers extends UIInput
|
||||
tx.begin();
|
||||
|
||||
String contextPath = context.getExternalContext().getRequestContextPath();
|
||||
out.write("<script type='text/javascript' src='");
|
||||
out.write("\n<script type='text/javascript'>var MSG_PORT_MUST_BE_NUMBER = '");
|
||||
out.write(Application.getMessage(context, "port_must_be_number"));
|
||||
out.write("';</script>\n<script type='text/javascript' src='");
|
||||
out.write(contextPath);
|
||||
out.write("/scripts/ajax/deployment.js'></script>\n");
|
||||
out.write("<div class='deployConfig'>");
|
||||
@@ -164,7 +164,7 @@ public class UIDeploymentServers extends UIInput
|
||||
{
|
||||
if (servers.size() == 0)
|
||||
{
|
||||
out.write("<div class='deployNoServers'><img src='");
|
||||
out.write("<div class='deployNoConfigServers'><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/info_icon.gif' /> ");
|
||||
out.write(Application.getMessage(context, MSG_NO_DEPLOY_SERVERS));
|
||||
@@ -188,7 +188,7 @@ public class UIDeploymentServers extends UIInput
|
||||
out.write("</div>");
|
||||
|
||||
out.write("\n<script type='text/javascript'>");
|
||||
out.write("window.onload=Alfresco.deployServerTypeChanged();");
|
||||
out.write("window.onload=Alfresco.checkDeployConfigPage();");
|
||||
out.write("</script>");
|
||||
|
||||
tx.commit();
|
||||
@@ -510,6 +510,46 @@ public class UIDeploymentServers extends UIInput
|
||||
Utils.encodeRecursive(context, type);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server host field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_HOST));
|
||||
out.write(":</td><td>");
|
||||
UIComponent host = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, host, "deployServerHost");
|
||||
host.getAttributes().put("styleClass", "inputField");
|
||||
host.getAttributes().put("onkeyup",
|
||||
"javascript:Alfresco.checkDeployConfigButtonState();");
|
||||
host.getAttributes().put("onchange",
|
||||
"javascript:Alfresco.checkDeployConfigButtonState();");
|
||||
ValueBinding vbHost = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_HOST + "}");
|
||||
host.setValueBinding("value", vbHost);
|
||||
this.getChildren().add(host);
|
||||
Utils.encodeRecursive(context, host);
|
||||
out.write("</td><td><img src='");
|
||||
out.write(contextPath);
|
||||
out.write("/images/icons/required_field.gif' title='");
|
||||
out.write(bundle.getString("required_field"));
|
||||
out.write("'/></td></tr>");
|
||||
|
||||
// create the server port field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_PORT));
|
||||
out.write(":</td><td>");
|
||||
UIComponent port = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, port, "deployServerPort");
|
||||
port.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbPort = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_PORT + "}");
|
||||
port.setValueBinding("value", vbPort);
|
||||
this.getChildren().add(port);
|
||||
Utils.encodeRecursive(context, port);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server name field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_NAME));
|
||||
@@ -526,38 +566,6 @@ public class UIDeploymentServers extends UIInput
|
||||
Utils.encodeRecursive(context, name);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server host field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_HOST));
|
||||
out.write(":</td><td>");
|
||||
UIComponent host = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, host, null);
|
||||
host.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbHost = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_HOST + "}");
|
||||
host.setValueBinding("value", vbHost);
|
||||
this.getChildren().add(host);
|
||||
Utils.encodeRecursive(context, host);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server port field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_PORT));
|
||||
out.write(":</td><td>");
|
||||
UIComponent port = context.getApplication().createComponent(
|
||||
UIInput.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, port, null);
|
||||
port.getAttributes().put("styleClass", "inputField");
|
||||
ValueBinding vbPort = context.getApplication().createValueBinding(
|
||||
"#{WizardManager.bean.editedDeployServerProperties." +
|
||||
DeploymentServerConfig.PROP_PORT + "}");
|
||||
port.setValueBinding("value", vbPort);
|
||||
this.getChildren().add(port);
|
||||
Utils.encodeRecursive(context, port);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create the server username field
|
||||
out.write("<tr><td align='right'>");
|
||||
out.write(bundle.getString(MSG_USER));
|
||||
@@ -658,39 +666,50 @@ public class UIDeploymentServers extends UIInput
|
||||
Utils.encodeRecursive(context, auto);
|
||||
out.write("</td></tr>");
|
||||
|
||||
// create and add the cancel button
|
||||
out.write("<tr><td colspan='2' align='right'>");
|
||||
UICommand cancelButton = (UICommand)context.getApplication().createComponent(
|
||||
UICommand.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, cancelButton, null);
|
||||
cancelButton.setValue(bundle.getString("cancel"));
|
||||
MethodBinding cancelBinding = context.getApplication().createMethodBinding(
|
||||
"#{WizardManager.bean.cancelDeploymentServerConfig}", new Class[] {});
|
||||
cancelButton.setAction(cancelBinding);
|
||||
this.getChildren().add(cancelButton);
|
||||
Utils.encodeRecursive(context, cancelButton);
|
||||
out.write(" ");
|
||||
|
||||
if (edit)
|
||||
{
|
||||
// create the done button
|
||||
out.write("<tr><td colspan='2' align='right'>");
|
||||
UICommand saveButton = (UICommand)context.getApplication().createComponent(
|
||||
UICommand.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, saveButton, null);
|
||||
FacesHelper.setupComponentId(context, saveButton, "deployActionButton");
|
||||
saveButton.setValue(bundle.getString("save"));
|
||||
MethodBinding binding = context.getApplication().createMethodBinding(
|
||||
MethodBinding saveBinding = context.getApplication().createMethodBinding(
|
||||
"#{WizardManager.bean.saveDeploymentServerConfig}", new Class[] {});
|
||||
saveButton.setAction(binding);
|
||||
saveButton.setAction(saveBinding);
|
||||
this.getChildren().add(saveButton);
|
||||
Utils.encodeRecursive(context, saveButton);
|
||||
out.write("</td></tr>");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// create the add button
|
||||
out.write("<tr><td colspan='2' align='right'>");
|
||||
UICommand addButton = (UICommand)context.getApplication().createComponent(
|
||||
UICommand.COMPONENT_TYPE);
|
||||
FacesHelper.setupComponentId(context, addButton, null);
|
||||
FacesHelper.setupComponentId(context, addButton, "deployActionButton");
|
||||
addButton.setValue(bundle.getString("add"));
|
||||
MethodBinding binding = context.getApplication().createMethodBinding(
|
||||
MethodBinding addBinding = context.getApplication().createMethodBinding(
|
||||
"#{WizardManager.bean.addDeploymentServerConfig}", new Class[] {});
|
||||
addButton.setAction(binding);
|
||||
addButton.setAction(addBinding);
|
||||
this.getChildren().add(addButton);
|
||||
Utils.encodeRecursive(context, addButton);
|
||||
out.write("</td></tr>");
|
||||
}
|
||||
|
||||
// finish off tables and div
|
||||
out.write("</table></td></tr></table>");
|
||||
out.write("</td></tr></table></td></tr></table>");
|
||||
PanelGenerator.generatePanelEnd(out, contextPath, "lightstorm");
|
||||
out.write("</div>");
|
||||
}
|
||||
|
@@ -230,15 +230,14 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
// determine whether the deploy action should be shown
|
||||
boolean showDeployAction = false;
|
||||
NodeRef webProjectRef = AVMUtil.getWebProjectNodeFromStore(sandbox);
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
List<ChildAssociationRef> deployToServers = nodeService.getChildAssocs(
|
||||
webProjectRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
List<NodeRef> deployToServers = DeploymentUtil.findLiveServers(webProjectRef);
|
||||
if (deployToServers != null && deployToServers.size() > 0)
|
||||
{
|
||||
showDeployAction = true;
|
||||
}
|
||||
|
||||
// determine the deployment status for the website
|
||||
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
|
||||
determineDeploymentStatus(context, webProjectRef, sandbox, nodeService, avmService);
|
||||
|
||||
Map requestMap = context.getExternalContext().getRequestMap();
|
||||
@@ -299,7 +298,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
params.put("version", "#{" + REQUEST_SNAPVERSION + "}");
|
||||
params.put("store", sandbox);
|
||||
action = createAction(context, sandbox, ACT_SNAPSHOT_DEPLOY, "/images/icons/deploy.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:deploySnapshot", null, params);
|
||||
"#{DialogManager.setupParameters}", "dialog:deployWebsite", null, params);
|
||||
}
|
||||
|
||||
Utils.encodeRecursive(context, action);
|
||||
|
@@ -79,6 +79,7 @@ import org.alfresco.web.ui.common.PanelGenerator;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.common.component.UIMenu;
|
||||
import org.alfresco.web.ui.common.converter.ByteSizeConverter;
|
||||
import org.alfresco.web.ui.repo.component.UIActions;
|
||||
import org.alfresco.web.ui.wcm.WebResources;
|
||||
@@ -119,6 +120,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
private static final String ACT_SANDBOX_REFRESH = "sandbox_refresh";
|
||||
private static final String ACT_SANDBOX_DEPLOY = "sandbox_deploy";
|
||||
private static final String ACT_SANDBOX_DEPLOY_REPORT = "deployment_report_action";
|
||||
private static final String ACT_SANDBOX_RELEASE_SERVER = "sandbox_release_test_server";
|
||||
|
||||
private static final String ACTIONS_FILE = "avm_file_modified";
|
||||
private static final String ACTIONS_FOLDER = "avm_folder_modified";
|
||||
@@ -197,6 +199,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
return "org.alfresco.faces.UserSandboxes";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void restoreState(FacesContext context, Object state)
|
||||
{
|
||||
Object values[] = (Object[])state;
|
||||
@@ -244,6 +247,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
/**
|
||||
* @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void decode(FacesContext context)
|
||||
{
|
||||
Map requestMap = context.getExternalContext().getRequestParameterMap();
|
||||
@@ -323,8 +327,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
|
||||
// determine whether the deploy action should be shown
|
||||
boolean deployServersConfigured = false;
|
||||
List<ChildAssociationRef> deployToServers = nodeService.getChildAssocs(
|
||||
websiteRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL);
|
||||
List<NodeRef> deployToServers = DeploymentUtil.findTestServers(websiteRef, false);
|
||||
if (deployToServers != null && deployToServers.size() > 0)
|
||||
{
|
||||
deployServersConfigured = true;
|
||||
@@ -360,6 +363,14 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Building sandbox view for user store: " + mainStore);
|
||||
|
||||
// determine if the sandbox has an allocated test server for deployment
|
||||
NodeRef testServer = DeploymentUtil.findAllocatedTestServer(mainStore);
|
||||
boolean hasAllocatedTestServer = (testServer != null);
|
||||
|
||||
// determine if there are any previous deployment attempts
|
||||
List<NodeRef> deployAttempts = DeploymentUtil.findDeploymentAttempts(mainStore);
|
||||
boolean hasPreviousDeployments = (deployAttempts.size() > 0);
|
||||
|
||||
// for each user sandbox, generate an outer panel table
|
||||
PanelGenerator.generatePanelStart(out,
|
||||
context.getExternalContext().getRequestContextPath(),
|
||||
@@ -391,25 +402,15 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
}
|
||||
out.write(" (");
|
||||
out.write(bundle.getString(userrole));
|
||||
out.write(")</td><td><nobr>");
|
||||
out.write(")</td><td><table cellpadding='4' cellspacing='0'><tr><td><nobr>");
|
||||
|
||||
// Direct actions for a sandbox...
|
||||
Map<String, String> params = new HashMap<String, String>(6);
|
||||
params.put("store", mainStore);
|
||||
params.put("username", username);
|
||||
params.put("webapp", this.getWebapp());
|
||||
params.put("mode", "runReport");
|
||||
params.put("compareToStaging", "true");
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_CHECK_LINKS, "/images/icons/run_link_validation.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:linkValidation", null, params));
|
||||
out.write(" ");
|
||||
|
||||
// Browse Sandbox
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_BROWSE, "/images/icons/space_small.gif",
|
||||
"#{AVMBrowseBean.setupSandboxAction}", "browseSandbox"));
|
||||
out.write(" ");
|
||||
out.write("</nobr></td><td><nobr>");
|
||||
|
||||
// Preview Website
|
||||
String websiteUrl = AVMUtil.buildWebappUrl(mainStore, getWebapp());
|
||||
@@ -419,67 +420,101 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
context, mainStore, username, ACT_SANDBOX_PREVIEW, "/images/icons/preview_website.gif",
|
||||
null, null, "#{" + REQUEST_PREVIEW_REF + "}", null));
|
||||
requestMap.remove(REQUEST_PREVIEW_REF);
|
||||
out.write(" ");
|
||||
|
||||
// Deployment actions
|
||||
if (deployServersConfigured)
|
||||
{
|
||||
// if a deployment has already occurred then the next
|
||||
// deployment will be an update (this informs the dialog
|
||||
// that test server allocation checks are not needed).
|
||||
PropertyValue val = avmService.getStoreProperty(mainStore,
|
||||
SandboxConstants.PROP_LAST_DEPLOYMENT_ID);
|
||||
|
||||
boolean reDeploy = (val != null);
|
||||
|
||||
Map<String, String> dialogParams = new HashMap<String, String>(6);
|
||||
dialogParams.put("store", mainStore);
|
||||
dialogParams.put("username", username);
|
||||
requestMap.put(REQUEST_UPDATE_TEST_SERVER, Boolean.toString(reDeploy));
|
||||
dialogParams.put("updateTestServer", "#{" + REQUEST_UPDATE_TEST_SERVER + "}");
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_DEPLOY, "/images/icons/deploy.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:deploySandbox", null, dialogParams));
|
||||
out.write(" ");
|
||||
}
|
||||
|
||||
// View deployment report (if there are any)
|
||||
List<NodeRef> attempts = DeploymentUtil.findDeploymentAttempts(mainStore);
|
||||
if (attempts != null && attempts.size() > 0)
|
||||
{
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_DEPLOY_REPORT, "/images/icons/deployment_report.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:viewDeploymentReport"));
|
||||
out.write(" ");
|
||||
}
|
||||
|
||||
// Refresh Sandbox
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_REFRESH, "/images/icons/reset.gif",
|
||||
"#{AVMBrowseBean.refreshSandbox}", null));
|
||||
out.write(" ");
|
||||
|
||||
out.write("</nobr></td><td><nobr>");
|
||||
|
||||
// Submit All Items
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_SUBMITALL, "/images/icons/submit_all.gif",
|
||||
"#{AVMBrowseBean.setupAllItemsAction}", "dialog:submitSandboxItems"));
|
||||
out.write(" ");
|
||||
out.write("</nobr></td><td><nobr>");
|
||||
|
||||
// Revert All Items
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_REVERTALL, "/images/icons/revert_all.gif",
|
||||
"#{AVMBrowseBean.setupAllItemsAction}", "dialog:revertAllItems"));
|
||||
out.write(" ");
|
||||
out.write("</nobr></td><td><nobr>");
|
||||
|
||||
// Delete Sandbox
|
||||
if (AVMUtil.ROLE_CONTENT_MANAGER.equals(currentUserRole))
|
||||
// More Actions menu
|
||||
UIMenu menu = findMenu(mainStore);
|
||||
if (menu == null)
|
||||
{
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_REMOVE_SANDBOX, "/images/icons/delete_sandbox.gif",
|
||||
"#{AVMBrowseBean.setupSandboxAction}", "dialog:deleteSandbox"));
|
||||
// create the menu, then the actions
|
||||
menu = createMenu(context, mainStore);
|
||||
|
||||
// add the menu to this component
|
||||
this.getChildren().add(menu);
|
||||
}
|
||||
|
||||
out.write("</nobr></td></tr>");
|
||||
// clear current menu actions then add relevant ones
|
||||
menu.getChildren().clear();
|
||||
|
||||
// Check Links action
|
||||
Map<String, String> params = new HashMap<String, String>(6);
|
||||
params.put("store", mainStore);
|
||||
params.put("username", username);
|
||||
params.put("webapp", this.getWebapp());
|
||||
params.put("mode", "runReport");
|
||||
params.put("compareToStaging", "true");
|
||||
UIActionLink checkLinks = createAction(context, mainStore, username,
|
||||
ACT_SANDBOX_CHECK_LINKS, "/images/icons/run_link_validation.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:linkValidation",
|
||||
null, params, false);
|
||||
menu.getChildren().add(checkLinks);
|
||||
|
||||
// Deploy action
|
||||
if (deployServersConfigured)
|
||||
{
|
||||
Map<String, String> dialogParams = new HashMap<String, String>(6);
|
||||
dialogParams.put("store", mainStore);
|
||||
dialogParams.put("username", username);
|
||||
requestMap.put(REQUEST_UPDATE_TEST_SERVER, Boolean.toString(hasAllocatedTestServer));
|
||||
dialogParams.put("updateTestServer", "#{" + REQUEST_UPDATE_TEST_SERVER + "}");
|
||||
UIActionLink deploy = createAction(context, mainStore, username,
|
||||
ACT_SANDBOX_DEPLOY, "/images/icons/deploy.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:deployWebsite",
|
||||
null, dialogParams, false);
|
||||
menu.getChildren().add(deploy);
|
||||
}
|
||||
|
||||
// View deployment report action
|
||||
if (hasPreviousDeployments)
|
||||
{
|
||||
UIActionLink reports = createAction(context, mainStore, username,
|
||||
ACT_SANDBOX_DEPLOY_REPORT, "/images/icons/deployment_report.gif",
|
||||
"#{DialogManager.setupParameters}", "dialog:viewDeploymentReport",
|
||||
null, null, false);
|
||||
menu.getChildren().add(reports);
|
||||
}
|
||||
|
||||
// Release Test Server action
|
||||
if (hasAllocatedTestServer)
|
||||
{
|
||||
UIActionLink releaseServer = createAction(context, mainStore, username,
|
||||
ACT_SANDBOX_RELEASE_SERVER, "/images/icons/deploy_server.gif",
|
||||
"#{AVMBrowseBean.releaseTestServer}", null, null, null, false);
|
||||
menu.getChildren().add(releaseServer);
|
||||
}
|
||||
|
||||
// Refresh Sandbox action
|
||||
UIActionLink refresh = createAction(context, mainStore, username,
|
||||
ACT_SANDBOX_REFRESH, "/images/icons/reset.gif",
|
||||
"#{AVMBrowseBean.refreshSandbox}", null, null, null, false);
|
||||
menu.getChildren().add(refresh);
|
||||
|
||||
// Delete Sandbox action
|
||||
if (AVMUtil.ROLE_CONTENT_MANAGER.equals(currentUserRole))
|
||||
{
|
||||
UIActionLink delete = createAction(context, mainStore, username,
|
||||
ACT_REMOVE_SANDBOX, "/images/icons/delete_sandbox.gif",
|
||||
"#{AVMBrowseBean.setupSandboxAction}", "dialog:deleteSandbox",
|
||||
null, null, false);
|
||||
menu.getChildren().add(delete);
|
||||
}
|
||||
|
||||
// render the menu
|
||||
Utils.encodeRecursive(context, menu);
|
||||
|
||||
out.write("</nobr></td></tr></table></td></tr>");
|
||||
|
||||
// modified items panel
|
||||
out.write("<tr><td></td><td colspan=2>");
|
||||
@@ -881,11 +916,11 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void renderContentForms(
|
||||
FacesContext fc, ResponseWriter out, NodeRef websiteRef, String username, String storeRoot)
|
||||
throws IOException
|
||||
{
|
||||
NodeService nodeService = getNodeService(fc);
|
||||
Map requestMap = fc.getExternalContext().getRequestMap();
|
||||
String userStorePrefix = AVMUtil.buildUserMainStoreName(storeRoot, username);
|
||||
|
||||
@@ -941,9 +976,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
ACT_CREATE_FORM_CONTENT,
|
||||
"/images/icons/new_content.gif",
|
||||
"#{AVMBrowseBean.createFormContent}",
|
||||
null,
|
||||
null,
|
||||
params);
|
||||
null, null, params, true);
|
||||
}
|
||||
Utils.encodeRecursive(fc, action);
|
||||
|
||||
@@ -965,8 +998,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
"/images/icons/search_icon.gif",
|
||||
"#{AVMBrowseBean.searchFormContent}",
|
||||
"browseSandbox",
|
||||
null,
|
||||
params);
|
||||
null, params, true);
|
||||
}
|
||||
Utils.encodeRecursive(fc, action);
|
||||
|
||||
@@ -1006,6 +1038,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
*
|
||||
* @return UIActions component
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActions aquireUIActions(String id, String store)
|
||||
{
|
||||
UIActions uiActions = null;
|
||||
@@ -1079,7 +1112,8 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
UIActionLink action = findAction(name, store);
|
||||
if (action == null)
|
||||
{
|
||||
action = createAction(fc, store, username, name, icon, actionListener, outcome, url, params);
|
||||
action = createAction(fc, store, username, name, icon, actionListener,
|
||||
outcome, url, params, true);
|
||||
}
|
||||
return action;
|
||||
}
|
||||
@@ -1093,6 +1127,7 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
*
|
||||
* @return UIActionLink component if found, else null if not created yet
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActionLink findAction(String name, String store)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
@@ -1119,16 +1154,19 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
* @param store Root store name for the user sandbox
|
||||
* @param username Username of the user for the action
|
||||
* @param name Action name - will be used for I18N message lookup
|
||||
* @param icon Icon to display for the actio n
|
||||
* @param icon Icon to display for the action
|
||||
* @param actionListener Actionlistener for the action
|
||||
* @param outcome Navigation outcome for the action
|
||||
* @param url HREF URL for the action
|
||||
* @param params Parameters name/values for the action listener args
|
||||
* @param addAsChild true to add the action as a child of this component
|
||||
*
|
||||
* @return UIActionLink child component
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActionLink createAction(FacesContext fc, String store, String username, String name,
|
||||
String icon, String actionListener, String outcome, String url, Map<String, String> params)
|
||||
String icon, String actionListener, String outcome, String url, Map<String, String> params,
|
||||
boolean addAsChild)
|
||||
{
|
||||
javax.faces.application.Application facesApp = fc.getApplication();
|
||||
UIActionLink control = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
@@ -1202,11 +1240,69 @@ public class UIUserSandboxes extends SelfRenderingComponent implements Serializa
|
||||
control.setTarget("new");
|
||||
}
|
||||
|
||||
this.getChildren().add(control);
|
||||
if (addAsChild)
|
||||
{
|
||||
this.getChildren().add(control);
|
||||
}
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate a child UIMenu component by name.
|
||||
*
|
||||
* @param store Store the action component is tied to
|
||||
*
|
||||
* @return UIMenu component if found, else null if not created yet
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIMenu findMenu(String store)
|
||||
{
|
||||
UIMenu menu = null;
|
||||
String menuId = "menu_" + FacesHelper.makeLegalId(store);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Finding action Id: " + menuId);
|
||||
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (menuId.equals(component.getId()))
|
||||
{
|
||||
menu = (UIMenu)component;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("...found action Id: " + menuId);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a menu component to hold the 'more actions' for a sandbox
|
||||
*
|
||||
* @param context FacesContext
|
||||
* @param store The store to create the menu for
|
||||
* @return The UIMenu component (with no children)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIMenu createMenu(FacesContext context, String store)
|
||||
{
|
||||
UIMenu menu = (UIMenu)context.getApplication().createComponent("org.alfresco.faces.Menu");
|
||||
|
||||
String id = "menu_" + FacesHelper.makeLegalId(store);
|
||||
menu.setId(id);
|
||||
menu.setLabel(Application.getMessage(context, "more_actions") + " ");
|
||||
menu.getAttributes().put("itemSpacing", 4);
|
||||
menu.getAttributes().put("image", "/images/icons/menu.gif");
|
||||
menu.getAttributes().put("menuStyleClass", "moreActionsMenu");
|
||||
menu.getAttributes().put("style", "white-space:nowrap; margin-left: 4px;");
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
private AVMService getAVMService(FacesContext fc)
|
||||
{
|
||||
return (AVMService)FacesContextUtils.getRequiredWebApplicationContext(fc).getBean("AVMLockingAwareService");
|
||||
|
Reference in New Issue
Block a user