From 338914016ba4474b562d9b2ec5e580b4dc23a445 Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Thu, 21 Feb 2008 14:35:30 +0000 Subject: [PATCH] Merged V2.2 to HEAD 7386: JSF component to view, add, edit and remove deployment server configuration Added new step to create/edit website wizard to collect and edit deployment server configuration Enabled the copying of deployment server config when creating one web project from another Added new icons to tell apart Alfresco Server vs. File System deployments Updated UI to use 'friendly' server name when possible git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8351 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 43 +- config/alfresco/web-client-config-wizards.xml | 42 +- .../web/bean/wcm/CreateWebsiteWizard.java | 228 ++++- .../web/bean/wcm/DeploymentServerConfig.java | 248 ++++++ .../web/bean/wcm/EditWebsiteWizard.java | 14 +- .../web/ui/wcm/component/UIDeployWebsite.java | 5 +- .../ui/wcm/component/UIDeploymentReports.java | 36 +- .../ui/wcm/component/UIDeploymentServers.java | 839 ++++++++++++++++++ .../web/ui/wcm/tag/DeploymentServersTag.java | 115 +++ source/web/WEB-INF/faces-config-wcm.xml | 5 + source/web/WEB-INF/wcm.tld | 50 ++ source/web/css/main.css | 77 ++ .../images/icons/deploy_server_alfresco.gif | Bin 0 -> 1382 bytes .../web/images/icons/deploy_server_file.gif | Bin 0 -> 1408 bytes .../wcm/create-website-wizard/deployment.jsp | 47 + source/web/scripts/ajax/deployment.js | 36 + 16 files changed, 1732 insertions(+), 53 deletions(-) create mode 100644 source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java create mode 100644 source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java create mode 100644 source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java create mode 100644 source/web/images/icons/deploy_server_alfresco.gif create mode 100644 source/web/images/icons/deploy_server_file.gif create mode 100644 source/web/jsp/wcm/create-website-wizard/deployment.jsp create mode 100644 source/web/scripts/ajax/deployment.js diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 67a5e0145..06189df85 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -988,7 +988,6 @@ website_details=Web Project Details create_website_step1_title=Step One - Web Project Details create_website_step1_desc=Enter the information about the web project. website_dnsname=DNS name -website_deployto=Deploy To validation_invalid_dns_name=Invalid website DNS name: only alpha-numeric and non-initial/final hyphen characters are allowed (max length < 64). website_webapp=Default Webapp website_createfrom=Create From Existing Web Project @@ -1018,22 +1017,25 @@ form_template_templates=Configure Templates form_template_templates_desc=Setup the Templates you want to use for the Web Form {0} in Web Project {1}. form_template_workflow=Configure Workflow form_template_workflow_desc=Configure the workflow defaults for this Web Project -create_website_step3_title=Step Three - Configure Web Content Forms -create_website_step3_desc=Select and configure web forms for generating site content. +create_website_step3_title=Step Three - Configure Deployment Servers +create_website_step3_desc=Configure deployment servers for the web project. +website_deployment=Configure Deployment Servers +create_website_step4_title=Step Four - Configure Web Content Forms +create_website_step4_desc=Select and configure web forms for generating site content. website_select_form=Select Web Forms website_select_templates=Select Templates website_selected_templates=Selected Templates website_settings=Configure Workflow -create_website_step4_title=Step Four - Configure Workflow -create_website_step4_desc=Select and configure workflow for non-form generated assets. +create_website_step5_title=Step Five - Configure Workflow +create_website_step5_desc=Select and configure workflow for non-form generated assets. website_select_workflows=Select Workflows website_selected_workflows=Selected Workflows website_invite=Add Users -create_website_step5_title=Step Five - Add Users -create_website_step5_desc=Select users and their roles. +create_website_step6_title=Step Six - Add Users +create_website_step6_desc=Select users and their roles. website_notify=Email Users -create_website_step6_title=Step Six - Email Users -create_website_step6_desc=Notify the website users. +create_website_step7_title=Step Seven - Email Users +create_website_step7_desc=Notify the website users. create_website_finish_instruction=To close this wizard and create your web project space click Finish. To review or change your selections click Back. create_website_summary_users=Users and Roles edit_website_title=Edit Web Project Wizard @@ -1045,6 +1047,12 @@ workflow_not_configured=Workflow not configured error_filename_pattern=Error with workflow filename pattern: {0} workflow_not_set=no workflow rendering_engines_selected=Templates Selected +edit_website_step2_title=Step Two - Configure Deployment Servers +edit_website_step2_desc=Configure deployment servers for the web project. +edit_website_step3_title=Step Three - Configure Web Content Forms +edit_website_step3_desc=Select and configure web forms for generating site content. +edit_website_step4_title=Step Four - Configure Workflow +edit_website_step4_desc=Select and configure workflow for non-form generated assets. # Invite web users wizard messages invite_website_users=Invite Web Project Users @@ -1211,6 +1219,23 @@ deploy_status_in_progress=IN PROGRESS deploy_status_live=LIVE deploy_status_failed=FAILED deploy_status_partial=PARTIAL FAILURE +deploy_add_alf_receiver=Add Alfresco Server Receiver (ASR) +deploy_add_file_receiver=Add File System Receiver (FSR) +deploy_server_type_live=Live Server +deploy_server_type_test=Test Server +deploy_server_type=Type +deploy_server_name=Name +deploy_server_host=Host +deploy_server_port=Port +deploy_server_username=Username +deploy_server_password=Password +deploy_server_url=URL +deploy_server_source_path=Source Path +deploy_server_target_name=Target Name +deploy_automatically=Auto Deploy +edit_deploy_server=Edit Deployment Server Details +delete_deploy_server=Delete Deployment Server +no_deploy_servers=No deployment servers have been configured. reason=Reason snapshot=Snapshot content_launch=Content Launch diff --git a/config/alfresco/web-client-config-wizards.xml b/config/alfresco/web-client-config-wizards.xml index ddc865618..29751f589 100644 --- a/config/alfresco/web-client-config-wizards.xml +++ b/config/alfresco/web-client-config-wizards.xml @@ -22,30 +22,36 @@ description-id="create_website_step2_desc" instruction-id="default_instruction" /> - - + - - + - - + - - + + + + - - + - + + + + diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java index a32002ccc..9276db519 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebsiteWizard.java @@ -71,6 +71,7 @@ import org.alfresco.web.forms.FormNotFoundException; import org.alfresco.web.forms.FormsService; import org.alfresco.web.forms.RenderingEngineTemplate; import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIListItem; import org.alfresco.web.ui.common.component.UISelectList; import org.alfresco.web.ui.wcm.WebResources; @@ -94,6 +95,7 @@ public class CreateWebsiteWizard extends BaseWizardBean // wizard step names (that are referenced) private static final String STEP_DETAILS = "details"; private static final String STEP_FORMS = "forms"; + private static final String STEP_DEPLOYMENT = "deployment"; private static final String MATCH_DEFAULT = ".*"; @@ -143,19 +145,25 @@ public class CreateWebsiteWizard extends BaseWizardBean /** datamodel for table of selected workflows */ transient private DataModel workflowsDataModel = null; - /** transient list of workflow UIListItem objects */ - transient private List workflowsList = null; - /** list of workflow wrapper objects */ protected List workflows = null; /** Current workflow for dialog context */ protected WorkflowConfiguration actionWorkflow = null; + /** Map and list of deployment servers */ + protected Map deployServersMap = null; + protected List deployServersList = null; + + /** Current state of deploy server editing */ + protected DeploymentServerConfig currentDeployServer = null; + protected Map editedDeployServerProps = null; + protected boolean inAddDeployServerMode = false; + protected String addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; + /** Data for virtualization server notification */ private SandboxInfo sandboxInfo; - // ------------------------------------------------------------------------------ // Wizard implementation @@ -171,7 +179,7 @@ public class CreateWebsiteWizard extends BaseWizardBean this.title = null; this.description = null; this.isSource = false; - clearFormsWorkflowsAndUsers(); + clearFormsWorkflowsDeploymentAndUsers(); this.createFrom = CREATE_EMPTY; // requry existing web projects list every 10 seconds this.webProjectsList = new ExpiringValueCache>(1000L*10L); @@ -180,13 +188,21 @@ public class CreateWebsiteWizard extends BaseWizardBean this.showAllSourceProjects = false; } - private void clearFormsWorkflowsAndUsers() + private void clearFormsWorkflowsDeploymentAndUsers() { this.formsDataModel = null; this.forms = new ArrayList(8); this.workflowsDataModel = null; this.workflows = new ArrayList(4); + // reset all deployment data + this.deployServersMap = new HashMap(4, 1.0f); + this.deployServersList = new ArrayList(4); + this.currentDeployServer = null; + this.editedDeployServerProps = new HashMap(12, 1.0f); + this.inAddDeployServerMode = false; + this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; + // init the dependant bean we are using for the invite users pages InviteWebsiteUsersWizard wiz = getInviteUsersWizard(); wiz.init(null); @@ -266,7 +282,8 @@ public class CreateWebsiteWizard extends BaseWizardBean // set the property on the node to reference the root AVM store getNodeService().setProperty(nodeRef, WCMAppModel.PROP_AVMSTORE, avmStore); - // persist the forms, templates, workflows and workflow defaults to the model for this web project + // persist the forms, templates, workflows, workflow defaults and deployment + // config to the model for this web project saveWebProjectModel(nodeRef); // navigate to the Websites folder so we can see the newly created folder @@ -311,7 +328,8 @@ public class CreateWebsiteWizard extends BaseWizardBean } /** - * Persist the forms, templates, workflows and workflow defaults to the model for this web project + * Persist the forms, templates, workflows, workflow defaults and deployment config + * to the model for this web project * * @param nodeRef NodeRef to the web project */ @@ -385,7 +403,7 @@ public class CreateWebsiteWizard extends BaseWizardBean } } - // finally walk each web project workflow definition and save defaults for each + // walk each web project workflow definition and save defaults for each for (WorkflowWrapper workflow : this.workflows) { props.clear(); @@ -410,11 +428,24 @@ public class CreateWebsiteWizard extends BaseWizardBean getNodeService().addAspect(workflowRef, WCMAppModel.ASPECT_FILENAMEPATTERN, props); } } + + // finally walk through the deployment config and save + for (DeploymentServerConfig server : this.deployServersList) + { + Map repoProps = server.getRepoProps(); + + getNodeService().createNode(nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, + WCMAppModel.ASSOC_DEPLOYMENTSERVER, WCMAppModel.TYPE_DEPLOYMENTSERVER, + repoProps); + + if (logger.isDebugEnabled()) + logger.debug("Saved deploymentserver node using repo props: " + repoProps); + } } /** - * Restore the forms, templates and workflows from the model for a web project. Can also - * optional restore the basic node propetries and user details. + * Restore the forms, templates, workflows and deployment config from the model for a web project. + * Can also optionally restore the basic node propetries and user details. * * @param nodeRef NodeRef to the web project to load model from * @param loadProperties Load the basic properties such as name, title, DNS. @@ -541,6 +572,22 @@ public class CreateWebsiteWizard extends BaseWizardBean this.workflows.add(wfWrapper); } } + + // load the deployment server config objects + List serverRefs = getNodeService().getChildAssocs( + nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef sChildRef : serverRefs) + { + NodeRef serverRef = sChildRef.getChildRef(); + DeploymentServerConfig server = new DeploymentServerConfig( + serverRef, getNodeService().getProperties(serverRef)); + + this.deployServersList.add(server); + this.deployServersMap.put(server.getId(), server); + + if (logger.isDebugEnabled()) + logger.debug("Loaded deploy server config: " + server); + } } @@ -895,9 +942,9 @@ public class CreateWebsiteWizard extends BaseWizardBean public String next() { String stepName = Application.getWizardManager().getCurrentStepName(); - if (STEP_FORMS.equals(stepName)) + if (STEP_DEPLOYMENT.equals(stepName)) { - // if we have just entered the Forms page and the Create From page data has changed + // if we have just entered the deployment page and the Create From page data has changed // then we need to pre-populate the Forms etc. from the template web project updateModelOnCreateFromChange(); } @@ -915,13 +962,13 @@ public class CreateWebsiteWizard extends BaseWizardBean { if (this.sourceWebProject != null && this.sourceWebProject.length != 0) { - clearFormsWorkflowsAndUsers(); + clearFormsWorkflowsDeploymentAndUsers(); loadWebProjectModel(new NodeRef(this.sourceWebProject[0]), false, true); } } else { - clearFormsWorkflowsAndUsers(); + clearFormsWorkflowsDeploymentAndUsers(); } this.createFromValueChanged = false; @@ -989,6 +1036,155 @@ public class CreateWebsiteWizard extends BaseWizardBean return result; } + // ------------------------------------------------------------------------------ + // Deployment server configuration + + /** + * @return Determines whether a deployment server is being added + */ + public boolean isInAddDeployServerMode() + { + return this.inAddDeployServerMode; + } + + /** + * @return The type of server receiver to add, either 'alfresco' or 'file' + */ + public String getAddDeployServerType() + { + return this.addDeployServerType; + } + + /** + * @return The deploy server currently being added or edited + */ + public DeploymentServerConfig getCurrentDeployServer() + { + return this.currentDeployServer; + } + + /** + * @return The properties of the deploy server currently being added or edited + */ + public Map getEditedDeployServerProperties() + { + return this.editedDeployServerProps; + } + + /** + * @return Map of the deployment servers currently configured for the web project + */ + public List getDeployServers() + { + return this.deployServersList; + } + + /** + * Sets up the wizard for adding a new Alfresco Server Receiver + * + * @return null outcome to stay on same page + */ + public String addAlfrescoServerReceiver() + { + this.addDeployServerType = WCMAppModel.CONSTRAINT_ALFDEPLOY; + this.inAddDeployServerMode = true; + + // create an empty server config + this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType); + this.editedDeployServerProps.clear(); + + // refresh the current page + return null; + } + + /** + * Sets up the wizard for adding a new File System Receiver + * + * @return null outcome to stay on same page + */ + public String addFileSystemReceiver() + { + this.addDeployServerType = WCMAppModel.CONSTRAINT_FILEDEPLOY; + this.inAddDeployServerMode = true; + + // create an empty server config + this.currentDeployServer = new DeploymentServerConfig(this.addDeployServerType); + this.editedDeployServerProps.clear(); + + // refresh the current page + return null; + } + + public void editDeploymentServerConfig(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + String id = params.get("id"); + if (id != null && id.length() != 0) + { + this.inAddDeployServerMode = false; + + // setup the config object to edit + this.currentDeployServer = this.deployServersMap.get(id); + this.editedDeployServerProps.clear(); + this.editedDeployServerProps.putAll(this.currentDeployServer.getProperties()); + + if (logger.isDebugEnabled()) + logger.debug("Set current deploy server to: " + this.currentDeployServer); + } + } + + public void deleteDeploymentServerConfig(ActionEvent event) + { + UIActionLink link = (UIActionLink)event.getComponent(); + Map params = link.getParameterMap(); + String id = params.get("id"); + if (id != null && id.length() != 0) + { + this.currentDeployServer = null; + this.editedDeployServerProps.clear(); + this.inAddDeployServerMode = false; + + // remove the config object from the list and map + DeploymentServerConfig dsc = this.deployServersMap.get(id); + if (dsc != null) + { + this.deployServersList.remove(dsc); + this.deployServersMap.remove(dsc.getId()); + + if (logger.isDebugEnabled()) + logger.debug("Removed deploy server config with id: " + id); + } + } + } + + public String addDeploymentServerConfig() + { + // add the new config to the list and map + this.deployServersList.add(this.currentDeployServer); + this.deployServersMap.put(this.currentDeployServer.getId(), + this.currentDeployServer); + + // save the changes + return saveDeploymentServerConfig(); + } + + public String saveDeploymentServerConfig() + { + // set the edited properties + this.currentDeployServer.setProperties(this.editedDeployServerProps); + + if (logger.isDebugEnabled()) + logger.debug("Updated deploy server config: " + this.currentDeployServer); + + // reset state + this.currentDeployServer = null; + this.editedDeployServerProps.clear(); + this.inAddDeployServerMode = false; + + // refresh the current page + return null; + } // ------------------------------------------------------------------------------ // Define Web Content Workflows page @@ -1181,7 +1377,7 @@ public class CreateWebsiteWizard extends BaseWizardBean item.setImage(WebResources.IMAGE_WORKFLOW_32); items.add(item); } - this.workflowsList = items; + return items; } diff --git a/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java b/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java new file mode 100644 index 000000000..cf9f8db2d --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/DeploymentServerConfig.java @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.WCMAppModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Object holding the configuration for a deployment server. + * + * @author Gavin Cornwell + */ +public final class DeploymentServerConfig implements Serializable +{ + public static final String PROP_TYPE = "type"; + public static final String PROP_NAME = "name"; + public static final String PROP_HOST = "host"; + public static final String PROP_PORT = "port"; + public static final String PROP_USER = "username"; + public static final String PROP_PASSWORD = "password"; + public static final String PROP_URL = "url"; + public static final String PROP_SOURCE_PATH = "sourcePath"; + public static final String PROP_TARGET_NAME = "targetName"; + public static final String PROP_ALLOCATED_TO = "allocatedTo"; + public static final String PROP_ON_APPROVAL = "onApproval"; + + protected String id; + protected NodeRef serverRef; + protected String deployType; + protected Map props; + + private static final long serialVersionUID = -8894113751463815194L; + + public DeploymentServerConfig(String deployType) + { + this.id = GUID.generate(); + this.deployType = deployType; + this.props = new HashMap(12, 1.0f); + } + + public DeploymentServerConfig(NodeRef serverRef, Map repoProps) + { + this.id = GUID.generate(); + this.serverRef = serverRef; + this.deployType = (String)repoProps.get(WCMAppModel.PROP_DEPLOYTYPE); + + populateFromRepoProps(repoProps); + } + + public String toString() + { + StringBuilder buffer = new StringBuilder(super.toString()); + buffer.append(" (id=").append(this.id); + buffer.append(" serverRef=").append(this.serverRef); + buffer.append(" deployType=").append(this.deployType); + buffer.append(" props=").append(this.props).append(")"); + return buffer.toString(); + } + + public String getId() + { + return this.id; + } + + public NodeRef getServerRef() + { + return this.serverRef; + } + + public String getDeployType() + { + return this.deployType; + } + + public Map getProperties() + { + return this.props; + } + + public void setProperties(Map props) + { + this.props = new HashMap(props.size()); + this.props.putAll(props); + } + + public Map getRepoProps() + { + Map repoProps = new HashMap(8); + + repoProps.put(WCMAppModel.PROP_DEPLOYTYPE, this.deployType); + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTYPE, (Serializable)this.props.get(PROP_TYPE)); + + if (this.props.get(PROP_HOST) != null && ((String)this.props.get(PROP_HOST)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERHOST, (Serializable)this.props.get(PROP_HOST)); + } + + if (this.props.get(PROP_PORT) != null && ((String)this.props.get(PROP_PORT)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPORT, new Integer((String)this.props.get(PROP_PORT))); + } + + if (this.props.get(PROP_NAME) != null && ((String)this.props.get(PROP_NAME)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERNAME, (Serializable)this.props.get(PROP_NAME)); + } + + if (this.props.get(PROP_USER) != null && ((String)this.props.get(PROP_USER)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERUSERNAME, (Serializable)this.props.get(PROP_USER)); + } + + if (this.props.get(PROP_PASSWORD) != null && ((String)this.props.get(PROP_PASSWORD)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERPASSWORD, (Serializable)this.props.get(PROP_PASSWORD)); + } + + if (this.props.get(PROP_URL) != null && ((String)this.props.get(PROP_URL)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERURL, (Serializable)this.props.get(PROP_URL)); + } + + if (this.props.get(PROP_SOURCE_PATH) != null && ((String)this.props.get(PROP_SOURCE_PATH)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSOURCEPATH, (Serializable)this.props.get(PROP_SOURCE_PATH)); + } + + if (this.props.get(PROP_ALLOCATED_TO) != null && ((String)this.props.get(PROP_ALLOCATED_TO)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO, (Serializable)this.props.get(PROP_ALLOCATED_TO)); + } + + // only save the target if it's an FSR (File System Receiver) + if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType)) + { + if (this.props.get(PROP_TARGET_NAME) != null && ((String)this.props.get(PROP_TARGET_NAME)).length() > 0) + { + repoProps.put(WCMAppModel.PROP_DEPLOYSERVERTARGET, (Serializable)this.props.get(PROP_TARGET_NAME)); + } + } + + // only save the approval flag if the server type is a 'live' server + if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE))) + { + if (this.props.get(PROP_ON_APPROVAL) != null) + { + repoProps.put(WCMAppModel.PROP_DEPLOYONAPPROVAL, (Serializable)this.props.get(PROP_ON_APPROVAL)); + } + } + + return repoProps; + } + + protected void populateFromRepoProps(Map repoProps) + { + this.props = new HashMap(repoProps.size()); + + this.props.put(PROP_TYPE, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTYPE)); + this.props.put(PROP_HOST, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERHOST)); + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME) != null) + { + this.props.put(PROP_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERNAME)); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT) != null) + { + Integer port = (Integer)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPORT); + this.props.put(PROP_PORT, port.toString()); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME) != null) + { + this.props.put(PROP_USER, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERUSERNAME)); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD) != null) + { + this.props.put(PROP_PASSWORD, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERPASSWORD)); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL) != null) + { + this.props.put(PROP_URL, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERURL)); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH) != null) + { + this.props.put(PROP_SOURCE_PATH, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSOURCEPATH)); + } + + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO) != null) + { + this.props.put(PROP_ALLOCATED_TO, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERALLOCATEDTO)); + } + + if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(this.deployType)) + { + if (repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET) != null) + { + this.props.put(PROP_TARGET_NAME, (String)repoProps.get(WCMAppModel.PROP_DEPLOYSERVERTARGET)); + } + } + + if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(this.props.get(PROP_TYPE))) + { + Boolean onApproval = null; + if (repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL) != null) + { + onApproval = (Boolean)repoProps.get(WCMAppModel.PROP_DEPLOYONAPPROVAL); + } + else + { + onApproval = Boolean.FALSE; + } + + this.props.put(PROP_ON_APPROVAL, onApproval); + } + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java index a46df47f8..ad43ed28d 100644 --- a/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/EditWebsiteWizard.java @@ -88,8 +88,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard getNodeService().setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, this.description); getNodeService().setProperty(nodeRef, WCMAppModel.PROP_ISSOURCE, this.isSource); - // clear the existing settings for forms, template and workflows - then the existing methods - // can be used to apply the modified and previous settings from scratch + // clear the existing settings for forms, template, workflows and deployment - then + // the existing methods can be used to apply the modified and previous settings from scratch clearWebProjectModel(nodeRef); // change/create the root webapp name for the website @@ -106,7 +106,8 @@ public class EditWebsiteWizard extends CreateWebsiteWizard // TODO: allow change of dns name - via store rename functionality - // persist the forms, templates, workflows and workflow defaults to the model for this web project + // persist the forms, templates, workflows, workflow defaults and deployment config + // to the model for this web project saveWebProjectModel(nodeRef); return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME; @@ -133,5 +134,12 @@ public class EditWebsiteWizard extends CreateWebsiteWizard { getNodeService().removeChild(nodeRef, ref.getChildRef()); } + + List serverRefs = getNodeService().getChildAssocs( + nodeRef, WCMAppModel.ASSOC_DEPLOYMENTSERVER, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef ref : serverRefs) + { + getNodeService().removeChild(nodeRef, ref.getChildRef()); + } } } diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java index f87b79da8..88d6a166c 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIDeployWebsite.java @@ -436,6 +436,7 @@ public class UIDeployWebsite extends UIInput String contextPath = context.getExternalContext().getRequestContextPath(); Map props = nodeService.getProperties(server); + String deployType = (String)props.get(WCMAppModel.PROP_DEPLOYTYPE); String serverName = (String)props.get(WCMAppModel.PROP_DEPLOYSERVERNAME); if (serverName == null || serverName.length() == 0) { @@ -481,7 +482,9 @@ public class UIDeployWebsite extends UIInput out.write("
"); out.write("
"); + out.write("/images/icons/deploy_server_"); + out.write(deployType); + out.write(".gif' />"); out.write(""); diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java index 161afa71a..7d582617a 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentReports.java @@ -28,6 +28,7 @@ import java.io.IOException; import java.io.Serializable; import java.util.Date; import java.util.List; +import java.util.Map; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; @@ -36,6 +37,7 @@ import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; import org.alfresco.model.WCMAppModel; +import org.alfresco.repo.avm.actions.AVMDeploySnapshotAction; import org.alfresco.repo.domain.PropertyValue; import org.alfresco.sandbox.SandboxConstants; import org.alfresco.service.cmr.avm.AVMService; @@ -44,6 +46,7 @@ import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; @@ -237,29 +240,42 @@ public class UIDeploymentReports extends SelfRenderingComponent context.getExternalContext().getRequestContextPath(), "innerwhite", "white"); // extract the information we need to display - String server = (String)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSERVER); - String creator = (String)nodeService.getProperty(deploymentReport, ContentModel.PROP_CREATOR); - Date startTime = (Date)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSTARTTIME); + Map serverProps = nodeService.getProperties(deploymentReport); + String server = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVER); + String serverName = (String)serverProps.get(WCMAppModel.PROP_DEPLOYSERVERNAMEUSED); + if (serverName == null || serverName.length() == 0) + { + serverName = server; + } + + String deployType = WCMAppModel.CONSTRAINT_ALFDEPLOY; + if (server.startsWith(AVMDeploySnapshotAction.FILE_SERVER_PREFIX)) + { + deployType = WCMAppModel.CONSTRAINT_FILEDEPLOY; + } + + String creator = (String)serverProps.get(ContentModel.PROP_CREATOR); + Date startTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYSTARTTIME); String started = null; if (startTime != null) { started = Utils.getDateTimeFormat(context).format(startTime); } - Date endTime = (Date)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYENDTIME); + Date endTime = (Date)serverProps.get(WCMAppModel.PROP_DEPLOYENDTIME); String finished = null; if (endTime != null) { finished = Utils.getDateTimeFormat(context).format(endTime); } - Boolean success = (Boolean)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYSUCCESSFUL); + Boolean success = (Boolean)serverProps.get(WCMAppModel.PROP_DEPLOYSUCCESSFUL); if (success == null) { success = Boolean.FALSE; } - String failReason = (String)nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYFAILEDREASON); + String failReason = (String)serverProps.get(WCMAppModel.PROP_DEPLOYFAILEDREASON); String content = ""; ContentReader reader = contentService.getReader(deploymentReport, ContentModel.PROP_CONTENT); if (reader != null) @@ -276,7 +292,7 @@ public class UIDeploymentReports extends SelfRenderingComponent } int snapshot = -1; - Serializable snapshotObj = nodeService.getProperty(deploymentReport, WCMAppModel.PROP_DEPLOYVERSION); + Serializable snapshotObj = serverProps.get(WCMAppModel.PROP_DEPLOYVERSION); if (snapshotObj != null && snapshotObj instanceof Integer) { snapshot = (Integer)snapshotObj; @@ -285,9 +301,11 @@ public class UIDeploymentReports extends SelfRenderingComponent out.write(""); out.write("
"); + out.write("/images/icons/deploy_server_"); + out.write(deployType); + out.write(".gif' />"); out.write("
"); - out.write(server); + out.write(serverName); out.write("
servers; + private DeploymentServerConfig currentServer; + private Boolean inAddMode; + private String addType; + + // ------------------------------------------------------------------------------ + // Component implementation + + /** + * Default constructor + */ + public UIDeploymentServers() + { + setRendererType(null); + } + + @Override + public String getFamily() + { + return "org.alfresco.faces.DeploymentServers"; + } + + @SuppressWarnings("unchecked") + @Override + public void restoreState(FacesContext context, Object state) + { + Object values[] = (Object[])state; + // standard component attributes are restored by the super class + super.restoreState(context, values[0]); + this.servers = (List)values[1]; + this.inAddMode = (Boolean)values[2]; + this.addType = (String)values[3]; + this.currentServer = (DeploymentServerConfig)values[4]; + } + + @Override + public Object saveState(FacesContext context) + { + Object values[] = new Object[5]; + // standard component attributes are saved by the super class + values[0] = super.saveState(context); + values[1] = this.servers; + values[2] = this.inAddMode; + values[3] = this.addType; + values[4] = this.currentServer; + return values; + } + + @SuppressWarnings("unchecked") + @Override + public void encodeBegin(FacesContext context) throws IOException + { + if (isRendered() == false) + { + return; + } + + // clear previously generated children + this.getChildren().clear(); + + ResponseWriter out = context.getResponseWriter(); + UserTransaction tx = null; + try + { + tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); + tx.begin(); + + String contextPath = context.getExternalContext().getRequestContextPath(); + out.write("\n"); + out.write("
"); + + List servers = getValue(); + DeploymentServerConfig currentServer = getCurrentServer(); + for (DeploymentServerConfig server: servers) + { + if (currentServer != null && currentServer.getId().equals(server.getId())) + { + renderServerForm(context, out, server, true); + } + else + { + renderServer(context, out, server); + } + } + + if (getInAddMode()) + { + renderServerForm(context, out, null, false); + } + else + { + if (servers.size() == 0) + { + out.write("
 "); + out.write(Application.getMessage(context, MSG_NO_DEPLOY_SERVERS)); + out.write("
"); + } + } + + out.write("
"); + + out.write("\n"); + + tx.commit(); + } + catch (Throwable err) + { + try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} + throw new RuntimeException(err); + } + } + + // ------------------------------------------------------------------------------ + // Strongly typed component property accessors + + /** + * @return List of deployment servers to show + */ + @SuppressWarnings("unchecked") + public List getValue() + { + ValueBinding vb = getValueBinding("value"); + if (vb != null) + { + this.servers = (List)vb.getValue(getFacesContext()); + } + + return this.servers; + } + + /** + * @param value The list of deployment servers to show + */ + public void setValue(List value) + { + this.servers = value; + } + + /** + * @param server The current deployment server being added or edited + */ + public void setCurrentServer(DeploymentServerConfig server) + { + this.currentServer = server; + } + + /** + * @return Deployment server currently being edited or added + */ + @SuppressWarnings("unchecked") + public DeploymentServerConfig getCurrentServer() + { + ValueBinding vb = getValueBinding("currentServer"); + if (vb != null) + { + this.currentServer = (DeploymentServerConfig)vb.getValue(getFacesContext()); + } + + return this.currentServer; + } + + /** + * @return true if the component should show a form to add a new server + */ + public boolean getInAddMode() + { + ValueBinding vb = getValueBinding("inAddMode"); + if (vb != null) + { + this.inAddMode = (Boolean)vb.getValue(getFacesContext()); + } + + if (this.inAddMode == null) + { + this.inAddMode = Boolean.FALSE; + } + + return this.inAddMode.booleanValue(); + } + + /** + * @param inAddMode Determines whether a new server should be added + */ + public void setInAddMode(boolean inAddMode) + { + this.inAddMode = new Boolean(inAddMode); + } + + /** + * @return The type of reciever server to add + */ + public String getAddType() + { + ValueBinding vb = getValueBinding("addType"); + if (vb != null) + { + this.addType = (String)vb.getValue(getFacesContext()); + } + + if (this.addType == null) + { + this.addType = WCMAppModel.CONSTRAINT_FILEDEPLOY; + } + + return this.addType; + } + + /** + * @param value The type of server receiver to add + */ + public void setAddType(String value) + { + this.addType = value; + } + + // ------------------------------------------------------------------------------ + // Helpers + + protected void renderAddControls(FacesContext context, ResponseWriter out) + throws IOException + { + out.write(""); + + UICommand addAlfAction = aquireAddAlfReceiverAction(context); + Utils.encodeRecursive(context, addAlfAction); + + UICommand addFileAction = aquireAddFileReceiverAction(context); + Utils.encodeRecursive(context, addFileAction); + + out.write("
"); + } + + protected void renderServer(FacesContext context, ResponseWriter out, + DeploymentServerConfig server) throws IOException + { + String contextPath = context.getExternalContext().getRequestContextPath(); + ResourceBundle bundle = Application.getBundle(context); + + String serverName = (String)server.getProperties().get(DeploymentServerConfig.PROP_NAME); + if (serverName == null || serverName.length() == 0) + { + serverName = AVMDeploySnapshotAction.calculateServerUri(server.getRepoProps()); + } + + out.write("
"); + out.write("
"); + out.write(""); + + if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())) + { + out.write(""); + } + + if (WCMAppModel.CONSTRAINT_LIVESERVER.equals( + server.getProperties().get(DeploymentServerConfig.PROP_TYPE))) + { + out.write(""); + } + + out.write("
"); + out.write(serverName); + out.write(""); + Utils.encodeRecursive(context, aquireEditServerAction(context, server.getId())); + Utils.encodeRecursive(context, aquireDeleteServerAction(context, server.getId())); + out.write("
"); + out.write(bundle.getString(MSG_HOST)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_HOST) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_HOST)); + } + + out.write(" "); + out.write(bundle.getString(MSG_PORT)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_PORT) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_PORT)); + } + + out.write("
"); + out.write(bundle.getString(MSG_TYPE)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_TYPE) != null) + { + String type = (String)server.getProperties().get(DeploymentServerConfig.PROP_TYPE); + if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(type)) + { + out.write(Application.getMessage(context, MSG_LIVE_SERVER)); + } + else if (WCMAppModel.CONSTRAINT_TESTSERVER.equals(type)) + { + out.write(Application.getMessage(context, MSG_TEST_SERVER)); + } + } + out.write(" "); + out.write(bundle.getString(MSG_URL)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_URL) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_URL)); + } + out.write("
"); + out.write(bundle.getString(MSG_USER)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_USER) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_USER)); + } + out.write(" "); + out.write(bundle.getString(MSG_SOURCE)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_SOURCE_PATH)); + } + out.write("
"); + out.write(bundle.getString(MSG_TARGET)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME) != null) + { + out.write((String)server.getProperties().get(DeploymentServerConfig.PROP_TARGET_NAME)); + } + out.write("
"); + out.write(bundle.getString(MSG_AUTO_DEPLOY)); + out.write(":"); + if (server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL) != null) + { + Object obj = server.getProperties().get(DeploymentServerConfig.PROP_ON_APPROVAL); + if (obj instanceof Boolean && ((Boolean)obj).booleanValue()) + { + out.write(bundle.getString("yes")); + } + else + { + out.write(bundle.getString("no")); + } + } + out.write("
"); + } + + @SuppressWarnings("unchecked") + protected void renderServerForm(FacesContext context, ResponseWriter out, + DeploymentServerConfig server, boolean edit) throws IOException + { + String contextPath = context.getExternalContext().getRequestContextPath(); + ResourceBundle bundle = Application.getBundle(context); + + out.write("
"); + out.write(""); + out.write("
"); + + // create the server type drop down + out.write(""); + + // create the server name field + out.write(""); + + // create the server host field + out.write(""); + + // create the server port field + out.write(""); + + // create the server username field + out.write(""); + + // create the server password field + out.write(""); + + // create the server url field + out.write(""); + + // create the source path field + out.write(""); + + if ((edit == false && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType())) || + (edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))) + { + // create the target field + out.write(""); + } + + // create the auto deploy checkbox + out.write(""); + + if (edit) + { + // create the done button + out.write(""); + } + else + { + // create the add button + out.write(""); + } + + // finish off tables and div + out.write("
"); + out.write(bundle.getString(MSG_TYPE)); + out.write(":"); + UIComponent type = context.getApplication().createComponent( + UISelectOne.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, type, "deployServerType"); + type.getAttributes().put("styleClass", "inputField"); + type.getAttributes().put("onchange", + "javascript:Alfresco.deployServerTypeChanged();"); + ValueBinding vbType = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_TYPE + "}"); + type.setValueBinding("value", vbType); + UISelectItems itemsComponent = (UISelectItems)context.getApplication(). + createComponent(UISelectItems.COMPONENT_TYPE); + List items = new ArrayList(2); + + items.add(new SelectItem(WCMAppModel.CONSTRAINT_LIVESERVER, + Application.getMessage(context, MSG_LIVE_SERVER))); + items.add(new SelectItem(WCMAppModel.CONSTRAINT_TESTSERVER, + Application.getMessage(context, MSG_TEST_SERVER))); + + itemsComponent.setValue(items); + type.getChildren().add(itemsComponent); + this.getChildren().add(type); + Utils.encodeRecursive(context, type); + out.write("
"); + out.write(bundle.getString(MSG_NAME)); + out.write(":"); + UIComponent name = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, name, null); + name.getAttributes().put("styleClass", "inputField"); + ValueBinding vbName = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_NAME + "}"); + name.setValueBinding("value", vbName); + this.getChildren().add(name); + Utils.encodeRecursive(context, name); + out.write("
"); + out.write(bundle.getString(MSG_HOST)); + out.write(":"); + 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("
"); + out.write(bundle.getString(MSG_PORT)); + out.write(":"); + 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("
"); + out.write(bundle.getString(MSG_USER)); + out.write(":"); + UIComponent username = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, username, null); + username.getAttributes().put("styleClass", "inputField"); + ValueBinding vbUser = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_USER + "}"); + username.setValueBinding("value", vbUser); + this.getChildren().add(username); + Utils.encodeRecursive(context, username); + out.write("
"); + out.write(bundle.getString(MSG_PWD)); + out.write(":"); + UIComponent pwd = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, pwd, null); + pwd.setRendererType("javax.faces.Secret"); + pwd.getAttributes().put("styleClass", "inputField"); + ValueBinding vbPwd = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_PASSWORD + "}"); + pwd.setValueBinding("value", vbPwd); + this.getChildren().add(pwd); + Utils.encodeRecursive(context, pwd); + out.write("
"); + out.write(bundle.getString(MSG_URL)); + out.write(":"); + UIComponent url = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, url, null); + url.getAttributes().put("styleClass", "inputField"); + ValueBinding vbUrl = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_URL + "}"); + url.setValueBinding("value", vbUrl); + this.getChildren().add(url); + Utils.encodeRecursive(context, url); + out.write("
"); + out.write(bundle.getString(MSG_SOURCE)); + out.write(":"); + UIComponent source = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, source, null); + source.getAttributes().put("styleClass", "inputField"); + ValueBinding vbSource = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_SOURCE_PATH + "}"); + source.setValueBinding("value", vbSource); + this.getChildren().add(source); + Utils.encodeRecursive(context, source); + out.write("
"); + out.write(bundle.getString(MSG_TARGET)); + out.write(":"); + UIComponent target = context.getApplication().createComponent( + UIInput.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, target, null); + target.getAttributes().put("styleClass", "inputField"); + ValueBinding vbTarget = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_TARGET_NAME + "}"); + target.setValueBinding("value", vbTarget); + this.getChildren().add(target); + Utils.encodeRecursive(context, target); + out.write("
"); + out.write(bundle.getString(MSG_AUTO_DEPLOY)); + out.write(":"); + UIComponent auto = context.getApplication().createComponent( + UISelectBoolean.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, auto, "autoDeployCheckbox"); + ValueBinding vbAuto = context.getApplication().createValueBinding( + "#{WizardManager.bean.editedDeployServerProperties." + + DeploymentServerConfig.PROP_ON_APPROVAL + "}"); + auto.setValueBinding("value", vbAuto); + this.getChildren().add(auto); + Utils.encodeRecursive(context, auto); + out.write("
"); + UICommand saveButton = (UICommand)context.getApplication().createComponent( + UICommand.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, saveButton, null); + saveButton.setValue(bundle.getString("save")); + MethodBinding binding = context.getApplication().createMethodBinding( + "#{WizardManager.bean.saveDeploymentServerConfig}", new Class[] {}); + saveButton.setAction(binding); + this.getChildren().add(saveButton); + Utils.encodeRecursive(context, saveButton); + out.write("
"); + UICommand addButton = (UICommand)context.getApplication().createComponent( + UICommand.COMPONENT_TYPE); + FacesHelper.setupComponentId(context, addButton, null); + addButton.setValue(bundle.getString("add")); + MethodBinding binding = context.getApplication().createMethodBinding( + "#{WizardManager.bean.addDeploymentServerConfig}", new Class[] {}); + addButton.setAction(binding); + this.getChildren().add(addButton); + Utils.encodeRecursive(context, addButton); + out.write("
"); + } + + @SuppressWarnings("unchecked") + protected UIActionLink aquireAddAlfReceiverAction(FacesContext context) + { + UIActionLink action = null; + String actionId = "add_alf_receiver"; + + // try find the action as a child of this component + for (UIComponent component : (List)getChildren()) + { + if (actionId.equals(component.getId())) + { + action = (UIActionLink)component; + break; + } + } + + if (action == null) + { + // create the action and add as a child component + javax.faces.application.Application facesApp = context.getApplication(); + action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); + action.setId(actionId); + action.setValue(Application.getMessage(context, MSG_ALF_SERVER)); + action.setImage("/images/icons/plus.gif"); + MethodBinding binding = facesApp.createMethodBinding( + "#{WizardManager.bean.addAlfrescoServerReceiver}", new Class[] {}); + action.setAction(binding); + this.getChildren().add(action); + } + + return action; + } + + @SuppressWarnings("unchecked") + protected UIActionLink aquireAddFileReceiverAction(FacesContext context) + { + UIActionLink action = null; + String actionId = "add_file_receiver"; + + // try find the action as a child of this component + for (UIComponent component : (List)getChildren()) + { + if (actionId.equals(component.getId())) + { + action = (UIActionLink)component; + break; + } + } + + if (action == null) + { + // create the action and add as a child component + javax.faces.application.Application facesApp = context.getApplication(); + action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); + action.setId(actionId); + action.setValue(Application.getMessage(context, MSG_FILE_SYSTEM)); + action.setImage("/images/icons/plus.gif"); + MethodBinding binding = facesApp.createMethodBinding( + "#{WizardManager.bean.addFileSystemReceiver}", new Class[] {}); + action.setAction(binding); + this.getChildren().add(action); + } + + return action; + } + + @SuppressWarnings("unchecked") + protected UIActionLink aquireEditServerAction(FacesContext context, String serverId) + { + UIActionLink action = null; + String actionId = "edit_" + serverId; + + // try find the action as a child of this component + for (UIComponent component : (List)getChildren()) + { + if (actionId.equals(component.getId())) + { + action = (UIActionLink)component; + break; + } + } + + if (action == null) + { + // create the action and add as a child component + javax.faces.application.Application facesApp = context.getApplication(); + action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); + action.setId(actionId); + action.setValue(Application.getMessage(context, MSG_EDIT)); + action.setImage("/images/icons/edit_icon.gif"); + action.setShowLink(false); + action.setActionListener(facesApp.createMethodBinding( + "#{WizardManager.bean.editDeploymentServerConfig}", + UIActions.ACTION_CLASS_ARGS)); + + // add server id param + UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); + param.setId(actionId + "_1"); + param.setName("id"); + param.setValue(serverId); + action.getChildren().add(param); + + this.getChildren().add(action); + } + + return action; + } + + @SuppressWarnings("unchecked") + protected UIActionLink aquireDeleteServerAction(FacesContext context, String serverId) + { + UIActionLink action = null; + String actionId = "delete_" + serverId; + + // try find the action as a child of this component + for (UIComponent component : (List)getChildren()) + { + if (actionId.equals(component.getId())) + { + action = (UIActionLink)component; + break; + } + } + + if (action == null) + { + // create the action and add as a child component + javax.faces.application.Application facesApp = context.getApplication(); + action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK); + action.setId(actionId); + action.setValue(Application.getMessage(context, MSG_DELETE)); + action.setImage("/images/icons/delete.gif"); + action.setShowLink(false); + action.setActionListener(facesApp.createMethodBinding( + "#{WizardManager.bean.deleteDeploymentServerConfig}", + UIActions.ACTION_CLASS_ARGS)); + + // add server id param + UIParameter param = (UIParameter)facesApp.createComponent(ComponentConstants.JAVAX_FACES_PARAMETER); + param.setId(actionId + "_1"); + param.setName("id"); + param.setValue(serverId); + action.getChildren().add(param); + + this.getChildren().add(action); + } + + return action; + } + + /** + * @return Options for the type of deployment server i.e. test or live + */ + public List getDeployServerTypes() + { + List items = new ArrayList(2); + + UIListItem live = new UIListItem(); + live.setValue(WCMAppModel.CONSTRAINT_LIVESERVER); + live.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_LIVE_SERVER)); + + UIListItem test = new UIListItem(); + test.setValue(WCMAppModel.CONSTRAINT_TESTSERVER); + test.setLabel(Application.getMessage(FacesContext.getCurrentInstance(), MSG_TEST_SERVER)); + + items.add(live); + items.add(test); + + return items; + } +} diff --git a/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java b/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java new file mode 100644 index 000000000..034f73f30 --- /dev/null +++ b/source/java/org/alfresco/web/ui/wcm/tag/DeploymentServersTag.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing + */ +package org.alfresco.web.ui.wcm.tag; + +import javax.faces.component.UIComponent; + +import org.alfresco.web.ui.common.tag.BaseComponentTag; + +/** + * Tag class that allows the DeploymentServers component to be used on a JSP page. + * + * @author gavinc + */ +public class DeploymentServersTag extends BaseComponentTag +{ + private String value; + private String currentServer; + private String inAddMode; + private String addType; + + /** + * @see javax.faces.webapp.UIComponentTag#getComponentType() + */ + public String getComponentType() + { + return "org.alfresco.faces.DeploymentServers"; + } + + /** + * @see javax.faces.webapp.UIComponentTag#getRendererType() + */ + public String getRendererType() + { + return null; + } + + /** + * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) + */ + protected void setProperties(UIComponent component) + { + super.setProperties(component); + + setStringProperty(component, "value", this.value); + setStringProperty(component, "currentServer", this.currentServer); + setStringProperty(component, "addType", this.addType); + setBooleanProperty(component, "inAddMode", this.inAddMode); + } + + /** + * @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release() + */ + public void release() + { + super.release(); + this.value = null; + this.currentServer = null; + this.addType = null; + this.inAddMode = null; + } + + /** + * @param value the value (the list of servers to show) + */ + public void setValue(String value) + { + this.value = value; + } + + /** + * @param currentServer The server being edited or added + */ + public void setCurrentServer(String currentServer) + { + this.currentServer = currentServer; + } + + /** + * @param inAddMode Flag to determine whether a new server should be added + */ + public void setInAddMode(String inAddMode) + { + this.inAddMode = inAddMode; + } + + /** + * @param addType The type of server receiver to add + */ + public void setAddType(String addType) + { + this.addType = addType; + } +} diff --git a/source/web/WEB-INF/faces-config-wcm.xml b/source/web/WEB-INF/faces-config-wcm.xml index f385d9be5..1f6034f1d 100644 --- a/source/web/WEB-INF/faces-config-wcm.xml +++ b/source/web/WEB-INF/faces-config-wcm.xml @@ -34,6 +34,11 @@ org.alfresco.web.ui.wcm.component.UIDeployWebsite + + org.alfresco.faces.DeploymentServers + org.alfresco.web.ui.wcm.component.UIDeploymentServers + + org.alfresco.faces.PendingSubmissions org.alfresco.web.ui.wcm.component.UIPendingSubmissions diff --git a/source/web/WEB-INF/wcm.tld b/source/web/WEB-INF/wcm.tld index 6e873af69..0fbd82ae0 100644 --- a/source/web/WEB-INF/wcm.tld +++ b/source/web/WEB-INF/wcm.tld @@ -210,6 +210,56 @@ + + deploymentServers + org.alfresco.web.ui.wcm.tag.DeploymentServersTag + JSP + Deployment Servers + + Renders a list of deployment servers and allows new ones to be + added and existing servers to be edited and removed + + + + id + false + true + The component identifier for this component + + + + value + true + true + The list of deployment servers to show + + + + rendered + false + true + + + + currentServer + false + true + The deployment server currently being added or edited + + + + inAddMode + false + true + + + + addType + false + true + + + deployWebsite org.alfresco.web.ui.wcm.tag.DeployWebsiteTag diff --git a/source/web/css/main.css b/source/web/css/main.css index 2c456a1fd..007e2df16 100644 --- a/source/web/css/main.css +++ b/source/web/css/main.css @@ -701,6 +701,83 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited font-weight: normal; font-size:12px; } + +.deployAddServerConfig +{ + margin: 4px; +} + +.deployAddServerConfig a +{ + margin-right: 30px; +} + +.deployAddServerConfig img +{ + border: none; + vertical-align: -4px; + margin-right: 2px; +} + +.deployConfig +{ + padding: 4px; +} + +.deployNoServers +{ + margin-top: 26px; + margin-bottom: 10px; +} + +.deployNoServers img +{ + vertical-align: -6px; +} + +.deployConfigServer +{ + margin-top: 14px; + border: 1px solid #555; + background-color: #f9f9f9; + -moz-border-radius: 8px; +} + +.deployConfigServerIcon +{ + margin: 8px 0px 0px 8px; +} + +.deployConfigServer td +{ + padding: 5px; +} + +.deployConfigServerDetails +{ + padding-left: 10px; +} + +.deployConfigServerDetails td +{ + padding: 2px; +} + +.deployConfigServerDetails img +{ + border: none; + margin-left: 3px; +} + +.deployConfigServerForm +{ + padding-left: 15px; +} + +.deployConfigServerForm .inputField +{ + width: 200px; +} .deployPanelCheckbox { diff --git a/source/web/images/icons/deploy_server_alfresco.gif b/source/web/images/icons/deploy_server_alfresco.gif new file mode 100644 index 0000000000000000000000000000000000000000..015be97a083ae7e8f39414e05b9c36932b8d3f53 GIT binary patch literal 1382 zcmb7@{XY|U0LOQ7dB{s1N=iB^OU|Y1QQdW~lg>lUwUhG@y*yPfWwboClckM{5|TXL zWe*68*n~XgarR&}Bo7OlHpa|m8?$WtUhY4*&+GO1{PcPM_W8Jbx;dW+wSm|`l#q1+ z09I9ND@qlyqE@C*7UL^ne*;W2Xz8HNiDk1QDU1MMI1umxASocZ6=2!{rVU(+Ns736 z8xfy;1BH#gg(227zh#d0vOm#>CUc94#e}LtTtz|23qr*!{EHe~dG(ZFVUjQMDh1IE z0NDVrZ$S|gAQJ9I#wSN5B;QO-LH>okfx;vtr`0r5JNifa1}B~t6LX3PPYUswdCyrR zJm&D!AcxN$n=UD@9+{dQo)DB))pDlin%aAKvtq%#gg>{~-NzJ3-1tv>ZM=OR9GQ6*i~sLpqVhSOuCSV_0o_fYKn zm=Bqlq0C1k`On626}-Ai9+@I&X%%+2348h$SX5CzTQWQ#`4~XGewiK{%}T<4$jn$T zm*jD9C6g7n$;v7oxn9sh6)~4qWhcoVuCL+en*7IQ6CBy3U}e^)B{-}Dkx0Yl3>1*Y zYPfu^Epoe4Iy8oa__NGStQ4Us$R(8oKbD=u2uY-cJRL%#>m%d)d~VVFP&EG}dPwF# zT-o>&6wU7rBe;z7FuC9V{`;U7LD8g=R>_TfK5+qEcLH5|s%;*Nesvtr_2MiyRSIA) zXT3->UQP3e_61as`K z1j`9p^=F`!fkhaQ`TM+4QP5{ zn!fYuHkgKn&@hl-Bum{4)3m}t?-dOdp`ju*gX!ud=iu zw=|f&iNAr)nY4V{Gqh3&l~2dOb>TvG=iT!gc46;Wo^?rQ6N5QXGGj}#Ic^B>BMy5>NE!mrojQK7enz7jAY@SNy##(MP zuFtsOUUTeC?1B3gR8Kyo?C|f+)q9j)fenaHK|y0bm^{ojFmntT?|Em{5JAti3!Dkl zl|SACwE?wf=w`JM3_@krF_w-&YyLDd%V}Z|@0l0o68N3h_$C|aW4zmrEaxuwU8vDe z58D)voRY-%&f%(80ZmVg!UA^;Xqob@K_J$k)d^srtM1 zc1EjtdVBL|-mIg2qcNDxQd_cZ#vv-t%?hFDOtZru4A1z!MM%IJOIiDZ(UFc}2GD0d zU7HRxu6A`9Pr1}}>sI>{((EEo1HIb<`DXo2Tj75|jm`J&wuWB1ob9qLuvX`s(^fA0 zssEc(-CusmH-|yO z{p^Z&DZKEKO?P;0)J@+{Ov4)PFD)Qrw_G`k=`^H4Nsi+$wf<1OK{}3FN1L0ckn{jQ{`u literal 0 HcmV?d00001 diff --git a/source/web/images/icons/deploy_server_file.gif b/source/web/images/icons/deploy_server_file.gif new file mode 100644 index 0000000000000000000000000000000000000000..c8648475c472504035199d1ecdce3b8e521d7d68 GIT binary patch literal 1408 zcmc&z{ZkSK07XtGmKvFBxoTo=&WdKKyK1#N$~2p9b*nRTDY?2!(>60RH8aI1Q%7Zr zq848c`4Ryw6*UnJKahg*D@+0v0Rcf|d??Ct|HR(idq2H*_kMWq_=$)E2NNLx2*3hZ zgTvvl+Lp~08=k}t-f47Q#~VG+noe0?L1#GtX-D2**-#*6xf z=gk~mQ(HH?mCI`BV!n9U_`FkRFtu~}YMoK3F{EY|B&X*lUAvW%k(ZH+Br-T%g7H_P z4+HO{1ks4^MRw}cFL~r_=#;&8Xh!kcsr@N_*%V=(I zXySZSXj3!uQ*PY3mQ(m=Rzc>SA_j;5QZUYYE$J4%=MIhcy`6kgLoBN%JjUQr=x2k& zQsJ0fF!E9KehN!!sG~AlU-rtCx>=23Mm^utC(!5@=jM$ICW~RwtT+B+wl0}IaoL`f zekSuE;QAlJT*NS{cnn=SR#_pzq9<@z zDH$iFQ043b(!J)jIImOH!`BFYU`K{MKNZy)D=|(^7^Moc@=QDYcW!DvQ%-hK z)aN|!D`%>rF~J)=OZ`x`Q*BKiTQ_HA^hb-L$~SC=o{JSqfX!n}_@T)_MUP7?={uEl z`_)lsTub_qTbqTHF9Ln{auFlz3a=~0S4P;#sI#HT!=*~=Bd3_1vE<+)#~ZN6*q-xk znKocd?FG8U@GIR44U@R^^a>xBGWe*^COf1*0QR9B=pmZ2m7!(Thci+d)jr|$=to#57 zk{9iD;;Wm(Vvs+cYdspu3q9zL>Q`+k38-?Oa`nwQj5xkMV~7>`EwdIF<}CKUNZQv2 zA(oaebnnM*tL5$}*+q>6djw|%JQ)feQjKrfM@*~h#nBf(c=`4N1iPu1ILSW2&604hI$iuFo@>Z3^`|c{L*gPD zLhizj(Sg}VdR^VU1%Rg+Z*fqM^W^|-M530dZQj$?%k#W&SQ8HR*UEG)vYh2Yu*5Tw g(FU)pVUV;yd3UOd8lvwojncxx470S;Fu +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> + + + + + + + + \ No newline at end of file diff --git a/source/web/scripts/ajax/deployment.js b/source/web/scripts/ajax/deployment.js new file mode 100644 index 000000000..534bf31b8 --- /dev/null +++ b/source/web/scripts/ajax/deployment.js @@ -0,0 +1,36 @@ +Alfresco.deployServerTypeChanged = function() +{ + var typeDropDown = document.getElementById('wizard:wizard-body:deployServerType'); + if (typeDropDown != null) + { + var selectedType = typeDropDown.options[typeDropDown.selectedIndex].value; + + // show or hide the label + var autoDeployLabel = document.getElementById('autoDeployLabel'); + if (autoDeployLabel != null) + { + if (selectedType == "test") + { + autoDeployLabel.style.display = "none"; + } + else + { + autoDeployLabel.style.display = "block"; + } + } + + // show or hide the checkbox + var autoDeployCheckbox = document.getElementById('wizard:wizard-body:autoDeployCheckbox'); + if (autoDeployCheckbox != null) + { + if (selectedType == "test") + { + autoDeployCheckbox.style.display = "none"; + } + else + { + autoDeployCheckbox.style.display = "block"; + } + } + } +} \ No newline at end of file