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(")");
+ out.write(") | ");
// Direct actions for a sandbox...
- Map params = new HashMap(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(" | ");
// 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 dialogParams = new HashMap(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 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(" | ");
+
// 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(" | ");
// 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(" | ");
- // 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(" | ");
+ // clear current menu actions then add relevant ones
+ menu.getChildren().clear();
+
+ // Check Links action
+ Map params = new HashMap(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 dialogParams = new HashMap(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("
| ");
// modified items panel
out.write(" | ");
@@ -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 params)
+ String icon, String actionListener, String outcome, String url, Map 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)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");
diff --git a/source/web/css/main.css b/source/web/css/main.css
index d8f9c32424..76c6699c90 100644
--- a/source/web/css/main.css
+++ b/source/web/css/main.css
@@ -766,6 +766,16 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
width: 200px;
}
+.deployNoConfigServers
+{
+ margin: 26px 5px 16px 3px;
+}
+
+.deployNoConfigServers img
+{
+ vertical-align: -6px;
+}
+
.deployServersInfo
{
margin: 10px 5px 16px 5px;
@@ -782,6 +792,12 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
padding-left: 6px;
padding-right: 16px;
}
+
+.deployPanelNoControl
+{
+ padding-left: 21px;
+ padding-right: 21px;
+}
.deployPanelStatusIcon
{
@@ -794,6 +810,15 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
padding-left: 12px;
padding-right: 12px;
}
+
+.deployPanelServerStatus
+{
+}
+
+.deployPanelServerMsg
+{
+ margin-top: 3px;
+}
.deployPanelServerName
{
diff --git a/source/web/jsp/wcm/manage-review-task-dialog.jsp b/source/web/jsp/wcm/manage-review-task-dialog.jsp
index 60d7f64028..a6a38ecb4b 100644
--- a/source/web/jsp/wcm/manage-review-task-dialog.jsp
+++ b/source/web/jsp/wcm/manage-review-task-dialog.jsp
@@ -65,6 +65,11 @@
+
+
+
+
-
-
-
+
-
+
+
+
+
+
diff --git a/source/web/scripts/ajax/deployment.js b/source/web/scripts/ajax/deployment.js
index 534bf31b89..7c6918a884 100644
--- a/source/web/scripts/ajax/deployment.js
+++ b/source/web/scripts/ajax/deployment.js
@@ -1,3 +1,158 @@
+Alfresco.DeploymentMonitor = function(ids, pollingFreq, failedMsg, successMsg)
+{
+ this.ids = ids;
+ this.url = getContextPath() + "/ajax/invoke/DeploymentProgressBean.getStatus?ids=" + this.ids;
+ this.pollingFreq = pollingFreq;
+ this.failedMsg = failedMsg;
+ this.successMsg = successMsg;
+}
+
+Alfresco.DeploymentMonitor.prototype =
+{
+ ids: null,
+ url: null,
+ pollingFreq: 5,
+ failedMsg: null,
+ successMsg: null,
+
+ retrieveDeploymentStatus: function()
+ {
+ YAHOO.util.Connect.asyncRequest('GET', this.url,
+ {
+ success: this.processResults,
+ failure: this.handleError,
+ scope: this
+ },
+ null);
+ },
+
+ processResults: function(ajaxResponse)
+ {
+ var xml = ajaxResponse.responseXML.documentElement;
+ var statuses = xml.getElementsByTagName('target-server');
+ var noInProgress = statuses.length;
+ if (noInProgress > 0)
+ {
+ for (var x = 0; x < noInProgress; x++)
+ {
+ var target = statuses[x];
+ var id = target.getAttribute('id');
+ var finished = target.getAttribute('finished');
+ var url = target.getAttribute('url');
+ var reason = target.getAttribute('reason');
+ if (finished == 'true')
+ {
+ var successful = target.getAttribute('successful');
+ var icon = document.getElementById(id + '_icon');
+ if (icon != null)
+ {
+ var image = (successful == 'true') ? 'successful' : 'failed';
+ icon.src = '/alfresco/images/icons/deploy_' + image + '.gif';
+ }
+
+ var statusElem = document.getElementById(id + '_status');
+ if (statusElem != null)
+ {
+ var msg = (successful == 'true') ? this.successMsg : this.failedMsg;
+ statusElem.innerHTML = msg;
+ }
+
+ var msgElem = document.getElementById(id + '_msg');
+ if (msgElem != null)
+ {
+ if (successful == 'true')
+ {
+ if (url != null && url.length > 0)
+ {
+ msgElem.innerHTML = "" + url + "";
+ }
+ }
+ else
+ {
+ if (reason != null && reason.length > 0)
+ {
+ msgElem.innerHTML = "" + reason + "";
+ }
+ }
+ }
+ }
+ }
+
+ // there are still outstanding deployments, refresh in a few seconds
+ setTimeout('Alfresco.monitor.retrieveDeploymentStatus()', this.pollingFreq);
+ }
+ },
+
+ handleError: function(ajaxResponse)
+ {
+ handleErrorYahoo(ajaxResponse.status + ' ' + ajaxResponse.statusText);
+ }
+}
+
+var deployActionButtonPressed = false;
+
+Alfresco.checkDeployConfigPage = function()
+{
+ // make sure the relevant fields are visible for current deploy type
+ Alfresco.deployServerTypeChanged();
+
+ // make sure add/edit button is disabled if no host has been supplied
+ Alfresco.checkDeployConfigButtonState();
+
+ var button = document.getElementById('wizard:wizard-body:deployActionButton');
+ if (button != null)
+ {
+ document.getElementById("wizard").onsubmit = Alfresco.validateDeployConfig;
+ button.onclick = function() {deployActionButtonPressed = true; clear_wizard();}
+ document.getElementById('wizard:wizard-body:deployServerHost').focus();
+ }
+}
+
+Alfresco.checkDeployConfigButtonState = function()
+{
+ var host = document.getElementById('wizard:wizard-body:deployServerHost');
+ var button = document.getElementById('wizard:wizard-body:deployActionButton');
+
+ if (button != null)
+ {
+ if (host != null && host.value.length == 0)
+ {
+ button.disabled = true;
+ }
+ else
+ {
+ button.disabled = false;
+ }
+ }
+}
+
+Alfresco.validateDeployConfig = function()
+{
+ if (deployActionButtonPressed)
+ {
+ deployActionButtonPressed = false;
+
+ var valid = true;
+ var port = document.getElementById('wizard:wizard-body:deployServerPort');
+
+ if (port != null && port.value.length > 0)
+ {
+ if (isNaN(port.value))
+ {
+ alert(MSG_PORT_MUST_BE_NUMBER);
+ port.focus();
+ valid = false;
+ }
+ }
+
+ return valid;
+ }
+ else
+ {
+ return true;
+ }
+}
+
Alfresco.deployServerTypeChanged = function()
{
var typeDropDown = document.getElementById('wizard:wizard-body:deployServerType');
@@ -33,4 +188,29 @@ Alfresco.deployServerTypeChanged = function()
}
}
}
-}
\ No newline at end of file
+}
+
+Alfresco.toggleDeploymentDetails = function(icon, server)
+{
+ var currentState = icon.className;
+ var detailsDiv = document.getElementById(server + '-deployment-details');
+ if (currentState == 'collapsed')
+ {
+ icon.src = getContextPath() + '/images/icons/expanded.gif';
+ icon.className = 'expanded';
+ if (detailsDiv != null)
+ {
+ detailsDiv.style.display = 'block';
+ }
+ }
+ else
+ {
+ icon.src = getContextPath() + '/images/icons/collapsed.gif';
+ icon.className = 'collapsed';
+ if (detailsDiv != null)
+ {
+ detailsDiv.style.display = 'none';
+ }
+ }
+}
+
|