diff --git a/source/java/org/alfresco/web/scripts/WebScriptRuntime.java b/source/java/org/alfresco/web/scripts/WebScriptRuntime.java
index d256338aca..52d8884316 100644
--- a/source/java/org/alfresco/web/scripts/WebScriptRuntime.java
+++ b/source/java/org/alfresco/web/scripts/WebScriptRuntime.java
@@ -303,7 +303,10 @@ public abstract class WebScriptRuntime
* @param scriptRes Web Script Response
* @return true => execute script, false => do not execute script
*/
- protected abstract boolean preExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes);
+ protected boolean preExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes)
+ {
+ return true;
+ }
/**
* Post-execution hook
@@ -313,6 +316,7 @@ public abstract class WebScriptRuntime
* @param scriptReq Web Script Request
* @param scriptRes Web Script Response
*/
- protected abstract void postExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes);
-
+ protected void postExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes)
+ {
+ }
}
diff --git a/source/java/org/alfresco/web/scripts/WebScriptServletRuntime.java b/source/java/org/alfresco/web/scripts/WebScriptServletRuntime.java
index c491978cfd..c9640286f9 100644
--- a/source/java/org/alfresco/web/scripts/WebScriptServletRuntime.java
+++ b/source/java/org/alfresco/web/scripts/WebScriptServletRuntime.java
@@ -107,22 +107,4 @@ public class WebScriptServletRuntime extends WebScriptRuntime
authenticator.authenticate(required, isGuest, req, res);
}
}
-
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptRuntime#preExecute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
- */
- @Override
- protected boolean preExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes)
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptRuntime#postExecute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
- */
- @Override
- protected void postExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes)
- {
- }
-
}
diff --git a/source/java/org/alfresco/web/scripts/jsf/UIWebScript.java b/source/java/org/alfresco/web/scripts/jsf/UIWebScript.java
new file mode 100644
index 0000000000..8a377ef730
--- /dev/null
+++ b/source/java/org/alfresco/web/scripts/jsf/UIWebScript.java
@@ -0,0 +1,280 @@
+/*
+ * 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.scripts.jsf;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesEvent;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.service.transaction.TransactionService;
+import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
+import org.alfresco.web.scripts.WebScriptMatch;
+import org.alfresco.web.scripts.WebScriptRegistry;
+import org.alfresco.web.scripts.WebScriptRequest;
+import org.alfresco.web.scripts.WebScriptResponse;
+import org.alfresco.web.scripts.WebScriptRuntime;
+import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
+import org.alfresco.web.scripts.portlet.WebScriptPortletRequest;
+import org.alfresco.web.ui.common.component.SelfRenderingComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.jsf.FacesContextUtils;
+
+/**
+ * JSF Component implementation for the WebScript component.
+ *
+ * Responsible for generating a JSF Component specific WebScriptRuntime instance and
+ * executing the specified WebScript against the runtime.
+ *
+ * @author Kevin Roast
+ */
+public class UIWebScript extends SelfRenderingComponent
+{
+ private static Log logger = LogFactory.getLog(UIWebScript.class);
+
+ /** WebScript URL to execute */
+ private String scriptUrl = null;
+ private boolean scriptUrlModified = false;
+
+ private WebScriptRegistry registry;
+ private TransactionService txnService;
+
+ /**
+ * Default constructor
+ */
+ public UIWebScript()
+ {
+ WebApplicationContext ctx = FacesContextUtils.getRequiredWebApplicationContext(
+ FacesContext.getCurrentInstance());
+ this.registry = (DeclarativeWebScriptRegistry)ctx.getBean("webscripts.registry");
+ this.txnService = (TransactionService)ctx.getBean("transactionComponent");
+ }
+
+ /**
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily()
+ {
+ return "org.alfresco.faces.Controls";
+ }
+
+ /**
+ * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
+ */
+ 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.scriptUrl = (String)values[1];
+ this.scriptUrlModified = (Boolean)values[2];
+ }
+
+ /**
+ * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context)
+ {
+ Object values[] = new Object[] {
+ super.saveState(context), this.scriptUrl, this.scriptUrlModified};
+ return values;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
+ */
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException
+ {
+ if (event instanceof WebScriptEvent)
+ {
+ this.scriptUrlModified = true;
+ this.scriptUrl = ((WebScriptEvent)event).Url;
+ }
+ else
+ {
+ super.broadcast(event);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
+ */
+ @Override
+ public void decode(FacesContext context)
+ {
+ Map requestMap = context.getExternalContext().getRequestParameterMap();
+ String fieldId = this.getClientId(context);
+ String value = (String)requestMap.get(fieldId);
+ if (value != null && value.length() != 0)
+ {
+ // found web-script URL for this component
+ try
+ {
+ String url = URLDecoder.decode(value, "UTF-8");
+ queueEvent(new WebScriptEvent(this, url));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new AlfrescoRuntimeException("Unable to decode utf-8 script url.");
+ }
+ }
+ }
+
+ /**
+ * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
+ */
+ @Override
+ public void encodeBegin(FacesContext context) throws IOException
+ {
+ // execute WebScript
+ if (logger.isDebugEnabled())
+ logger.debug("Processing UIWebScript encodeBegin(): " + getScriptUrl());
+
+ WebScriptRuntime runtime = new WebScriptJSFRuntime(context, getScriptUrl());
+ runtime.executeScript();
+ }
+
+ /**
+ * Set the scriptUrl
+ *
+ * @param scriptUrl the scriptUrl
+ */
+ public void setScriptUrl(String scriptUrl)
+ {
+ this.scriptUrl = scriptUrl;
+ }
+
+ /**
+ * @return the scriptUrl
+ */
+ public String getScriptUrl()
+ {
+ if (this.scriptUrlModified == false)
+ {
+ ValueBinding vb = getValueBinding("scriptUrl");
+ if (vb != null)
+ {
+ this.scriptUrl = (String)vb.getValue(getFacesContext());
+ }
+ }
+ return this.scriptUrl;
+ }
+
+
+ // ------------------------------------------------------------------------------
+ // Inner classes
+
+ /**
+ * Class representing the clicking of a webscript url action.
+ */
+ public static class WebScriptEvent extends ActionEvent
+ {
+ public WebScriptEvent(UIComponent component, String url)
+ {
+ super(component);
+ Url = url;
+ }
+
+ public String Url = null;
+ }
+
+ /**
+ * Implementation of a WebScriptRuntime for the JSF environment
+ *
+ * @author Kevin Roast
+ */
+ private class WebScriptJSFRuntime extends WebScriptRuntime
+ {
+ private FacesContext fc;
+ private String scriptUrl;
+ private String script;
+
+ WebScriptJSFRuntime(FacesContext fc, String scriptUrl)
+ {
+ super(registry, txnService);
+ this.fc = fc;
+ this.scriptUrl = scriptUrl;
+ this.script = WebScriptPortletRequest.getScriptUrlParts(scriptUrl)[2];
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRuntime#authenticate(org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication, boolean)
+ */
+ @Override
+ protected void authenticate(RequiredAuthentication required, boolean isGuest)
+ {
+ // JSF component already in an authenticated environment as the
+ // /faces servlet filter (or JSF portlet wrapper) is called first
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRuntime#createRequest(org.alfresco.web.scripts.WebScriptMatch)
+ */
+ @Override
+ protected WebScriptRequest createRequest(WebScriptMatch match)
+ {
+ return new WebScriptJSFRequest(fc, match, this.scriptUrl);
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRuntime#createResponse()
+ */
+ @Override
+ protected WebScriptResponse createResponse()
+ {
+ return new WebScriptJSFResponse(fc, UIWebScript.this);
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRuntime#getScriptMethod()
+ */
+ @Override
+ protected String getScriptMethod()
+ {
+ return "GET";
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRuntime#getScriptUrl()
+ */
+ @Override
+ protected String getScriptUrl()
+ {
+ return this.script;
+ }
+ }
+}
diff --git a/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFRequest.java b/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFRequest.java
new file mode 100644
index 0000000000..3ada0cc15d
--- /dev/null
+++ b/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFRequest.java
@@ -0,0 +1,225 @@
+/*
+ * 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.scripts.jsf;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.web.scripts.WebScriptMatch;
+import org.alfresco.web.scripts.WebScriptRequest;
+import org.alfresco.web.scripts.portlet.WebScriptPortletRequest;
+
+/**
+ * Implementation of a WebScript Request for the JSF environment.
+ *
+ * @author Kevin Roast
+ */
+public class WebScriptJSFRequest implements WebScriptRequest
+{
+ private WebScriptMatch match;
+ private FacesContext fc;
+ private String[] scriptUrlParts;
+ private Map args = new HashMap(4, 1.0f);
+
+ /**
+ * Constructor
+ *
+ * @param fc FacesContext
+ * @param match WebScriptMatch that matched this webscript
+ * @param scriptUrl The script URL this request is for
+ */
+ WebScriptJSFRequest(FacesContext fc, WebScriptMatch match, String scriptUrl)
+ {
+ this.fc = fc;
+ this.match = match;
+ this.scriptUrlParts = WebScriptPortletRequest.getScriptUrlParts(scriptUrl);
+ if (this.scriptUrlParts[3] != null)
+ {
+ String[] parts = this.scriptUrlParts[3].split("&");
+ for (String argument : parts)
+ {
+ int sepIndex = argument.indexOf('=');
+ if (sepIndex != -1)
+ {
+ String value = "";
+ if (argument.length() > sepIndex + 1)
+ {
+ value = argument.substring(sepIndex + 1);
+ }
+ this.args.put(argument.substring(0, sepIndex), value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets the matching API Service for this request
+ *
+ * @return the service match
+ */
+ public WebScriptMatch getServiceMatch()
+ {
+ return this.match;
+ }
+
+ /**
+ * Get server portion of the request
+ *
+ * e.g. scheme://host:port
+ *
+ * @return server path
+ */
+ public String getServerPath()
+ {
+ // NOTE: not accessable from JSF context - cannot create absolute external urls...
+ return "";
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRequest#getContextPath()
+ */
+ public String getContextPath()
+ {
+ return fc.getExternalContext().getRequestContextPath();
+ }
+
+ /**
+ * Gets the Alfresco Web Script Context Path
+ *
+ * @return service url e.g. /alfresco/service
+ */
+ public String getServiceContextPath()
+ {
+ return fc.getExternalContext().getRequestContextPath() + scriptUrlParts[1];
+ }
+
+ /**
+ * Gets the Alfresco Service Path
+ *
+ * @return service url e.g. /alfresco/service/search/keyword
+ */
+ public String getServicePath()
+ {
+ return getServiceContextPath() + scriptUrlParts[2];
+ }
+
+ /**
+ * Gets the full request URL
+ *
+ * @return request url e.g. /alfresco/service/search/keyword?q=term
+ */
+ public String getURL()
+ {
+ return getServicePath() + (scriptUrlParts[3] != null ? "?" + scriptUrlParts[3] : "");
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRequest#getQueryString()
+ */
+ public String getQueryString()
+ {
+ return scriptUrlParts[3];
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRequest#getParameterNames()
+ */
+ public String[] getParameterNames()
+ {
+ Set keys = this.args.keySet();
+ String[] names = new String[keys.size()];
+ keys.toArray(names);
+ return names;
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptRequest#getParameter(java.lang.String)
+ */
+ public String getParameter(String name)
+ {
+ return this.args.get(name);
+ }
+
+ /**
+ * Gets the path extension beyond the path registered for this service
+ *
+ * e.g.
+ * a) service registered path = /search/engine
+ * b) request path = /search/engine/external
+ *
+ * => /external
+ *
+ * @return extension path
+ */
+ public String getExtensionPath()
+ {
+ String servicePath = this.scriptUrlParts[2];
+ if (servicePath.indexOf('/') != -1)
+ {
+ return servicePath.substring(servicePath.indexOf('/'));
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Determine if Guest User?
+ *
+ * @return true => guest user
+ */
+ public boolean isGuest()
+ {
+ return Boolean.valueOf(getParameter("guest"));
+ }
+
+ /**
+ * Get Requested Format
+ *
+ * @return content type requested
+ */
+ public String getFormat()
+ {
+ String format = getParameter("format");
+ return (format == null || format.length() == 0) ? "" : format;
+ }
+
+ /**
+ * Get User Agent
+ *
+ * TODO: Expand on known agents
+ *
+ * @return MSIE / Firefox
+ */
+ public String getAgent()
+ {
+ // NOTE: unknown in the JSF environment
+ return null;
+ }
+}
diff --git a/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFResponse.java b/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFResponse.java
new file mode 100644
index 0000000000..10180fb793
--- /dev/null
+++ b/source/java/org/alfresco/web/scripts/jsf/WebScriptJSFResponse.java
@@ -0,0 +1,131 @@
+/*
+ * 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.scripts.jsf;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLEncoder;
+
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.web.scripts.WebScriptResponse;
+import org.alfresco.web.ui.common.Utils;
+import org.apache.myfaces.shared_impl.renderkit.html.HtmlFormRendererBase;
+
+/**
+ * Implementation of a WebScript Response for the JSF environment.
+ *
+ * @author Kevin Roast
+ */
+public class WebScriptJSFResponse implements WebScriptResponse
+{
+ private FacesContext fc;
+ private UIWebScript component;
+
+ WebScriptJSFResponse(FacesContext fc, UIWebScript component)
+ {
+ this.fc = fc;
+ this.component = component;
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptResponse#encodeScriptUrl(java.lang.String)
+ */
+ public String encodeScriptUrl(String url)
+ {
+ UIForm form = Utils.getParentForm(fc, component);
+ if (form == null)
+ {
+ throw new IllegalStateException("Must nest components inside UIForm to generate form submit!");
+ }
+
+ String fieldId = component.getClientId(fc);
+ String formClientId = form.getClientId(fc);
+
+ StringBuilder buf = new StringBuilder(200);
+ // dirty - but can't see any other way to convert to a JSF action click...
+ buf.append("#\" onclick=\"");
+ buf.append("document.forms[");
+ buf.append("'");
+ buf.append(formClientId);
+ buf.append("'");
+ buf.append("]['");
+ buf.append(fieldId);
+ buf.append("'].value=");
+ buf.append("'");
+ // encode the URL to the webscript
+ try
+ {
+ buf.append(URLEncoder.encode(url, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new AlfrescoRuntimeException("Unable to utf-8 encode script url.");
+ }
+ buf.append("'");
+ buf.append(";");
+
+ buf.append("document.forms[");
+ buf.append("'");
+ buf.append(formClientId);
+ buf.append("'");
+ buf.append("].submit();");
+
+ buf.append("return false;");
+
+ // weak, but this seems to be the way Sun RI/MyFaces do it...
+ HtmlFormRendererBase.addHiddenCommandParameter(fc, form, fieldId);
+
+ return buf.toString();
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptResponse#getOutputStream()
+ */
+ public OutputStream getOutputStream() throws IOException
+ {
+ return fc.getResponseStream();
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptResponse#getWriter()
+ */
+ public Writer getWriter() throws IOException
+ {
+ return fc.getResponseWriter();
+ }
+
+ /**
+ * @see org.alfresco.web.scripts.WebScriptResponse#setContentType(java.lang.String)
+ */
+ public void setContentType(String contentType)
+ {
+ // Alfresco JSF framework only supports the default of text-html
+ }
+}
diff --git a/source/java/org/alfresco/web/scripts/jsf/WebScriptTag.java b/source/java/org/alfresco/web/scripts/jsf/WebScriptTag.java
new file mode 100644
index 0000000000..8e5ae65410
--- /dev/null
+++ b/source/java/org/alfresco/web/scripts/jsf/WebScriptTag.java
@@ -0,0 +1,88 @@
+/*
+ * 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.scripts.jsf;
+
+import javax.faces.component.UIComponent;
+
+import org.alfresco.web.ui.common.tag.BaseComponentTag;
+
+/**
+ * JSF tag class for the UIWebScript component.
+ *
+ * @author Kevin Roast
+ */
+public class WebScriptTag extends BaseComponentTag
+{
+ /**
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ @Override
+ public String getComponentType()
+ {
+ return "org.alfresco.faces.WebScript";
+ }
+
+ /**
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ @Override
+ public String getRendererType()
+ {
+ // the component is self renderering
+ return null;
+ }
+
+ /**
+ * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "scriptUrl", this.scriptUrl);
+ }
+
+ /**
+ * @see javax.servlet.jsp.tagext.Tag#release()
+ */
+ public void release()
+ {
+ super.release();
+ this.scriptUrl = null;
+ }
+
+ /**
+ * Set the scriptUrl
+ *
+ * @param scriptUrl the scriptUrl
+ */
+ public void setScriptUrl(String scriptUrl)
+ {
+ this.scriptUrl = scriptUrl;
+ }
+
+
+ /** the scriptUrl */
+ private String scriptUrl;
+}
diff --git a/source/java/org/alfresco/web/scripts/portlet/WebScriptPortlet.java b/source/java/org/alfresco/web/scripts/portlet/WebScriptPortlet.java
index 6184cddf5c..07a9acdf0a 100644
--- a/source/java/org/alfresco/web/scripts/portlet/WebScriptPortlet.java
+++ b/source/java/org/alfresco/web/scripts/portlet/WebScriptPortlet.java
@@ -273,15 +273,5 @@ public class WebScriptPortlet implements Portlet
// Note: Do not render script if portlet window is minimized
return !WindowState.MINIMIZED.equals(req.getWindowState());
}
-
- /* (non-Javadoc)
- * @see org.alfresco.web.scripts.WebScriptRuntime#postExecute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
- */
- @Override
- protected void postExecute(WebScriptRequest scriptReq, WebScriptResponse scriptRes)
- {
- }
-
}
-
}
diff --git a/source/web/WEB-INF/faces-config-repo.xml b/source/web/WEB-INF/faces-config-repo.xml
index 564defef2a..538467bef2 100644
--- a/source/web/WEB-INF/faces-config-repo.xml
+++ b/source/web/WEB-INF/faces-config-repo.xml
@@ -57,11 +57,11 @@
org.alfresco.faces.ContentSelector
org.alfresco.web.ui.repo.component.UIContentSelector
-
-
-
- org.alfresco.faces.WebProjectFolderSelector
- org.alfresco.web.ui.repo.component.UIWebProjectFolderSelector
+
+
+
+ org.alfresco.faces.WebProjectFolderSelector
+ org.alfresco.web.ui.repo.component.UIWebProjectFolderSelector
@@ -142,11 +142,11 @@
org.alfresco.faces.NodeInfo
org.alfresco.web.ui.repo.component.UINodeInfo
-
-
-
- org.alfresco.faces.OpenSearch
- org.alfresco.web.ui.repo.component.UIOpenSearch
+
+
+
+ org.alfresco.faces.OpenSearch
+ org.alfresco.web.ui.repo.component.UIOpenSearch
@@ -183,6 +183,11 @@
org.alfresco.faces.Navigator
org.alfresco.web.ui.repo.component.UINavigator
+
+
+ org.alfresco.faces.WebScript
+ org.alfresco.web.scripts.jsf.UIWebScript
+
diff --git a/source/web/WEB-INF/repo.tld b/source/web/WEB-INF/repo.tld
index a6aeb75bc3..a143058a1c 100644
--- a/source/web/WEB-INF/repo.tld
+++ b/source/web/WEB-INF/repo.tld
@@ -1973,4 +1973,32 @@
+
+ webScript
+ org.alfresco.web.scripts.jsf.WebScriptTag
+ JSP
+
+
+ Executes a webscript within the context of a JSF component.
+
+
+
+ id
+ false
+ true
+
+
+
+ rendered
+ false
+ true
+
+
+
+ scriptUrl
+ true
+ true
+
+
+
diff --git a/source/web/jsp/dashboards/dashlets/calculator.png b/source/web/jsp/dashboards/dashlets/calculator.png
deleted file mode 100644
index 4cc80aeba9..0000000000
Binary files a/source/web/jsp/dashboards/dashlets/calculator.png and /dev/null differ
diff --git a/source/web/jsp/dashboards/dashlets/calendar.png b/source/web/jsp/dashboards/dashlets/calendar.png
deleted file mode 100644
index 7ce352135e..0000000000
Binary files a/source/web/jsp/dashboards/dashlets/calendar.png and /dev/null differ
diff --git a/source/web/jsp/dashboards/dashlets/content-checkedout.jsp b/source/web/jsp/dashboards/dashlets/content-checkedout.jsp
deleted file mode 100644
index 9e20901037..0000000000
--- a/source/web/jsp/dashboards/dashlets/content-checkedout.jsp
+++ /dev/null
@@ -1,30 +0,0 @@
-<%--
- * 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" %>
-
-
diff --git a/source/web/jsp/dashboards/dashlets/content-checkedout.png b/source/web/jsp/dashboards/dashlets/content-checkedout.png
deleted file mode 100644
index 8063f8b4a5..0000000000
Binary files a/source/web/jsp/dashboards/dashlets/content-checkedout.png and /dev/null differ
diff --git a/source/web/jsp/dashboards/dashlets/calendar.jsp b/source/web/jsp/dashboards/dashlets/doclist-webscript.jsp
similarity index 83%
rename from source/web/jsp/dashboards/dashlets/calendar.jsp
rename to source/web/jsp/dashboards/dashlets/doclist-webscript.jsp
index 40862929f2..6979e47c18 100644
--- a/source/web/jsp/dashboards/dashlets/calendar.jsp
+++ b/source/web/jsp/dashboards/dashlets/doclist-webscript.jsp
@@ -22,9 +22,6 @@
* 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" %>
-
+
\ No newline at end of file
diff --git a/source/web/jsp/dashboards/dashlets/my-completed-tasks.png b/source/web/jsp/dashboards/dashlets/my-completed-tasks.png
deleted file mode 100644
index f53c1bbd04..0000000000
Binary files a/source/web/jsp/dashboards/dashlets/my-completed-tasks.png and /dev/null differ
diff --git a/source/web/jsp/dashboards/dashlets/my-tasks-todo.png b/source/web/jsp/dashboards/dashlets/my-tasks-todo.png
deleted file mode 100644
index e34ceee2aa..0000000000
Binary files a/source/web/jsp/dashboards/dashlets/my-tasks-todo.png and /dev/null differ
diff --git a/source/web/jsp/dashboards/dashlets/calculator.jsp b/source/web/jsp/dashboards/dashlets/mytasks-webscript.jsp
similarity index 83%
rename from source/web/jsp/dashboards/dashlets/calculator.jsp
rename to source/web/jsp/dashboards/dashlets/mytasks-webscript.jsp
index 78a7b6f0ee..79bde44876 100644
--- a/source/web/jsp/dashboards/dashlets/calculator.jsp
+++ b/source/web/jsp/dashboards/dashlets/mytasks-webscript.jsp
@@ -22,9 +22,6 @@
* 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" %>
-
+
\ No newline at end of file
diff --git a/source/web/jsp/dashboards/dashlets/tasklist-todo.jsp b/source/web/jsp/dashboards/dashlets/mywebforms-webscript.jsp
similarity index 83%
rename from source/web/jsp/dashboards/dashlets/tasklist-todo.jsp
rename to source/web/jsp/dashboards/dashlets/mywebforms-webscript.jsp
index 57682ca749..caa6e12af3 100644
--- a/source/web/jsp/dashboards/dashlets/tasklist-todo.jsp
+++ b/source/web/jsp/dashboards/dashlets/mywebforms-webscript.jsp
@@ -22,9 +22,6 @@
* 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" %>
-
+
\ No newline at end of file
diff --git a/source/web/jsp/dashboards/dashlets/tasklist-completed.jsp b/source/web/jsp/dashboards/dashlets/tasklist-completed.jsp
deleted file mode 100644
index 7267f126ab..0000000000
--- a/source/web/jsp/dashboards/dashlets/tasklist-completed.jsp
+++ /dev/null
@@ -1,30 +0,0 @@
-<%--
- * 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" %>
-
-