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(contextPath);
- out.write("/images/icons/deploy_server_large.gif)
");
+ 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 161afa71a1..7d582617a4 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(context.getExternalContext().getRequestContextPath());
- out.write("/images/icons/deploy_server_large.gif) | ");
+ out.write("/images/icons/deploy_server_");
+ out.write(deployType);
+ out.write(".gif' /> | ");
out.write(" ");
- out.write(server);
+ out.write(serverName);
out.write(" ;
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/deploy_");
diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java
new file mode 100644
index 0000000000..8be733998b
--- /dev/null
+++ b/source/java/org/alfresco/web/ui/wcm/component/UIDeploymentServers.java
@@ -0,0 +1,839 @@
+/*
+ * 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) 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(contextPath);
+ out.write("/images/icons/info_icon.gif) ");
+ 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(contextPath);
+ out.write("/images/icons/deploy_server_");
+ out.write(server.getDeployType());
+ out.write(".gif");
+ 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(" | ");
+
+ if (WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType()))
+ {
+ 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(" | ");
+ }
+
+ if (WCMAppModel.CONSTRAINT_LIVESERVER.equals(
+ server.getProperties().get(DeploymentServerConfig.PROP_TYPE)))
+ {
+ 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(" | ");
+ }
+
+ 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(contextPath);
+ out.write("/images/icons/deploy_server_");
+ if (server != null)
+ {
+ out.write(server.getDeployType());
+ }
+ else
+ {
+ out.write(getAddType());
+ }
+ out.write(".gif) | ");
+ out.write("");
+
+ // create the server type drop down
+ 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(" | ");
+
+ // create the server name field
+ 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(" | ");
+
+ // create the server host field
+ 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(" | ");
+
+ // create the server port field
+ 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(" | ");
+
+ // create the server username field
+ 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(" | ");
+
+ // create the server password field
+ 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(" | ");
+
+ // create the server url field
+ 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(" | ");
+
+ // create the source path field
+ 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(" | ");
+
+ if ((edit == false && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(getAddType())) ||
+ (edit && WCMAppModel.CONSTRAINT_FILEDEPLOY.equals(server.getDeployType())))
+ {
+ // create the target field
+ 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(" | ");
+ }
+
+ // create the auto deploy checkbox
+ 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(" | ");
+
+ if (edit)
+ {
+ // create the done button
+ 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(" | ");
+ }
+ else
+ {
+ // create the add button
+ 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(" | ");
+ }
+
+ // finish off tables and div
+ 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 0000000000..034f73f30d
--- /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 f385d9be5f..1f6034f1df 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 6e873af69e..0fbd82ae0a 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 2c456a1fd3..007e2df162 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 0000000000..015be97a08
Binary files /dev/null and b/source/web/images/icons/deploy_server_alfresco.gif differ
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 0000000000..c8648475c4
Binary files /dev/null and b/source/web/images/icons/deploy_server_file.gif differ
diff --git a/source/web/jsp/wcm/create-website-wizard/deployment.jsp b/source/web/jsp/wcm/create-website-wizard/deployment.jsp
new file mode 100644
index 0000000000..24be252d9e
--- /dev/null
+++ b/source/web/jsp/wcm/create-website-wizard/deployment.jsp
@@ -0,0 +1,47 @@
+<%--
+ * Copyright (C) 2005-2007 Alfresco Software Limited.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ * As a special exception to the terms and conditions of version 2.0 of
+ * the GPL, you may redistribute this Program in connection with Free/Libre
+ * and Open Source Software ("FLOSS") applications as described in Alfresco's
+ * FLOSS exception. You should have recieved a copy of the text describing
+ * the FLOSS exception, and it is also available here:
+ * http://www.alfresco.com/legal/licensing"
+--%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="/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 0000000000..534bf31b89
--- /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
| |