Index: IFramePortlet.java
===================================================================
RCS file: /home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/IFramePortlet.java,v
retrieving revision 1.6
diff -u -r1.6 IFramePortlet.java
--- IFramePortlet.java 23 Jul 2003 19:50:17 -0000 1.6
+++ IFramePortlet.java 5 Aug 2003 23:30:53 -0000
@@ -111,525 +111,922 @@
*
align - top | bottom | middle | left | right - How to align the IFRAME in relation to surrounding content.
* marginwidth - size of the top and bottom margin inside the iframe.
* marginheight - size of the left and right margin inside the iframe.
+ * Parameter 1 - The first parameter to be passed to the IFrame (or nothing).
+ * Parameter 2 - The second parameter to be passed to the IFrame (or nothing).
+ * Parameter 3 - The third parameter to be passed to the IFrame (or nothing).
+ * Parameter 4 - The fourth parameter to be passed to the IFrame (or nothing).
+ * Parameter 5 - The fifth parameter to be passed to the IFrame (or nothing).
+ * Parameter 6 - The sixth parameter to be passed to the IFrame (or nothing).
+ * Value 1 - The first value or special variable to be passed to the IFrame.
+ * Value 2 - The second value or special variable to be passed to the IFrame.
+ * Value 3 - The third value or special variable to be passed to the IFrame.
+ * Value 4 - The fourth value or special variable to be passed to the IFrame.
+ * Value 5 - The fifth value or special variable to be passed to the IFrame.
+ * Value 6 - The sixth value or special variable to be passed to the IFrame.
*
*
+ * The following special variables are accepted:
+ *
+ * - $username - the username of the user who logged in.
+ *
- $password - the jetspeed password of the user who logged in (may be encrypted).
+ *
- $clearpassword - the cleartext password of the user who logged in.
+ *
- $firstname - the first name (if available) of the user who logged in.
+ *
- $lastname - the last name (if available) of the user who logged in.
+ *
- $name - the name (if available) of the user who logged in.
+ *
- $email - the email address (if available) of the user who logged in.
+ * *
+ *
* @created February 23, 2002
* @author Bill Barnhill
* @author Mark Orciuch
+ * @author Dan Elder
* @version $Id: IFramePortlet.java,v 1.6 2003/07/23 19:50:17 morciuch Exp $
* @see AbstractPortlet
*/
public class IFramePortlet extends AbstractInstancePortlet
{
- /**
- * Static initialization of the logger for this class
- */
- private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(IFramePortlet.class.getName());
+ /**
+ * Static initialization of the logger for this class
+ */
+ private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(IFramePortlet.class.getName());
- static final String DEFAULT_NOTSUPP_MSG =
- "[Your user agent does not support inline frames or is currently"
- + " configured not to display frames]";
-
- static final String NO_SOURCE_MSG = "Please customize source for this IFrame";
-
- static final String DEFAULT_SOURCE = "http://127.0.0.1";
- static final String DEFAULT_WIDTH = null;
- static final String DEFAULT_HEIGHT = null;
- static final String DEFAULT_SCROLLING = "auto";
- static final String DEFAULT_FRAMEBORDER = "1";
-
- static final String PARAM_SOURCE = "source";
- static final String PARAM_WIDTH = "width";
- static final String PARAM_HEIGHT = "height";
- static final String PARAM_SCROLLING = "scrolling";
- static final String PARAM_FRAMEBORDER = "frameborder";
- static final String PARAM_NAME = "name";
- static final String PARAM_STYLE = "style";
- static final String PARAM_MARGINWIDTH = "marginwidth";
- static final String PARAM_MARGINHEIGHT = "marginheight";
- static final String PARAM_REFRESH = "refresh";
- static final String PARAM_ALIGN = "align";
- static final String WEBAPPROOT = "${" + TurbineConstants.WEBAPP_ROOT + "}";
-
- private String iSource = DEFAULT_SOURCE;
- private String iWidth = DEFAULT_WIDTH;
- private String iHeight = DEFAULT_HEIGHT;
- private String iScrolling = DEFAULT_SCROLLING;
- private String iFrameBorder = DEFAULT_FRAMEBORDER;
- private String iMarginWidth = null;
- private String iMarginHeight = null;
- private String iStyle = null;
- private String iName = null;
- private String iRefresh = null;
- private String iAlign = null;
-
- /**
- * Sets the source attribute of the IFramePortlet object
- *
- * @param source The new source value
- * @since
- */
- public void setSource(String source)
- {
- if (source != null)
- {
- // Handle replacement variables
- Hashtable parms = new Hashtable();
- if (source.indexOf("${") >= 0)
- {
- // Add all portlet parms
- parms.putAll(this.getPortletConfig().getInitParameters());
-
- // Add web app root variable replacement
- try
- {
- ServerData sd = new ServerData(TurbineServlet.getServerName(),
- Integer.parseInt(TurbineServlet.getServerPort()),
- TurbineServlet.getServerScheme(),
- TurbineServlet.getContextPath(),
- TurbineServlet.getContextPath());
- DynamicURI uri = new DynamicURI(sd);
- parms.put(TurbineConstants.WEBAPP_ROOT, uri.toString() + "/");
- }
- catch (Exception e)
- {
- logger.error("Exception", e);
- }
- // Add portlet name variable replacement
- parms.put("portlet", this.getName());
- }
-
- this.iSource = org.apache.jetspeed.util.StringUtils.replaceVars(source, parms);
- }
-
- }
-
- /**
- * Sets the scrolling attribute of the IFramePortlet object
- *
- * @param scrolling The new scrolling value
- * @since
- */
- public void setScrolling(String scrolling)
- {
- iScrolling = scrolling;
- }
-
-
- /**
- * Sets the width attribute of the IFramePortlet object
- *
- * @param width The new width value
- * @since
- */
- public void setWidth(String width)
- {
- iWidth = width;
- }
-
-
- /**
- * Sets the height attribute of the IFramePortlet object
- *
- * @param height The new height value
- * @since
- */
- public void setHeight(String height)
- {
- iHeight = height;
- }
-
-
- /**
- * Sets the frameBorder attribute of the IFramePortlet object
- *
- * @param frameBorder The new frameBorder value
- * @since
- */
- public void setFrameBorder(String frameBorder)
- {
- iFrameBorder = frameBorder;
- }
-
- /**
- * Sets the width attribute of the IFramePortlet object
- *
- * @param width The new width value
- */
- public void setMarginWidth(String width)
- {
-
- iMarginWidth = width;
- }
-
- /**
- * Sets the marginheight attribute of the IFramePortlet object
- *
- * @param height The new height value
- */
- public void setMarginHeight(String height)
- {
-
- iMarginHeight = height;
- }
-
- /**
- * Sets the marginheight attribute of the IFramePortlet object
- *
- * @param height The new height value
- */
- public void setAlign(String value)
- {
-
- iAlign = value;
- }
-
- /**
- * Sets the refresh meta tag
- *
- * @param value in seconds
- */
- public void setRefresh(String value)
- {
-
- iRefresh = value;
- }
-
-
- /**
- * Sets the style of iframe. Some useful style effects:
- *
- * - border:5px dashed purple
- *
- border:5px dotted red
- *
- border:5px double red
- *
- border:5px inset red
- *
- *
- * @param value
- */
- public void setStyle(String value)
- {
-
- iStyle = value;
- }
-
- /**
- * Sets the name of iframe. This is useful when referencing
- * the iframe as a target from another link.
- *
- * @param value
- */
- public void setFrameName(String value)
- {
-
- iName = value;
- }
-
- /**
- * This methods outputs the content of the portlet for a given request.
- *
- * @param runData the RunData object for the request
- * @return the content to be displayed to the user-agent
- */
- public ConcreteElement getContent(RunData runData)
- {
-
- // Reinitialize if user customized the portlet (this will be useful
- // when portlet preferences include user name and password for authentication or
- // when other exposed iframe attributes are changed)
- if (org.apache.jetspeed.util.PortletSessionState.getPortletConfigChanged(this, runData))
- {
- try {
- this.init();
- }
- catch (PortletException pe)
- {
- logger.error("Exception", pe);
- }
- }
-
- StringBuffer text = new StringBuffer();
-
- if (getSource() == null || getSource().trim().length() == 0)
- {
- text.append(NO_SOURCE_MSG);
- return (new StringElement(text.toString()));
- }
-
- text.append("");
- return (new StringElement(text.toString()));
- }
-
-
- /**
- * Gets the source attribute of the IFramePortlet object
- *
- * @return The source value
- */
- public String getSource()
- {
- return iSource;
- }
-
-
- /**
- * Gets the scrolling attribute of the IFramePortlet object
- *
- * @return The scrolling value
- */
- public String getScrolling()
- {
- return iScrolling;
- }
-
-
- /**
- * Gets the width attribute of the IFramePortlet object
- *
- * @return The width value
- */
- public String getWidth()
- {
- return iWidth;
- }
-
-
- /**
- * Gets the height attribute of the IFramePortlet object
- *
- * @return The height value
- */
- public String getHeight()
- {
- return iHeight;
- }
-
-
- /**
- * Gets whether to display a border around the IFRAME. "1" == yes.
- *
- * @return The frameBorder value
- */
- public String getFrameBorder()
- {
- String trueValues = "1,yes,true";
- if (iFrameBorder != null && trueValues.indexOf(iFrameBorder) >= 0)
- {
- return "1";
- }
- return "0";
- }
-
-
- /**
- * Gets the message displayed when IFRAME is not supported
- * This includes when Frames are turned off.
- *
- * @todo This should be localized
- * @return The notSupportedMsg value
- */
- public String getNotSupportedMsg()
- {
- return DEFAULT_NOTSUPP_MSG;
- }
-
- /**
- * Gets the aling attribute of the IFramePortlet object
- *
- * @return The marginheight value
- */
- public String getAlign()
- {
-
- return iAlign;
- }
-
- /**
- * Gets iframe style
- *
- * @return The style value
- */
- public String getStyle()
- {
-
- return iStyle;
- }
-
- /**
- * Gets iframe name
- *
- * @return The name value
- */
- public String getFrameName()
- {
-
- return iName;
- }
-
- /**
- * Gets iframe refresh
- *
- * @return The refresh value
- */
- public String getRefresh()
- {
-
- return iRefresh;
- }
-
- /**
- * Gets the marginheight attribute of the IFramePortlet object
- *
- * @return The marginheight value
- */
- public String getMarginHeight()
- {
-
- return iMarginHeight;
- }
-
- /**
- * Gets the marginwidth attribute of the IFramePortlet object
- *
- * @return The marginwidth value
- */
- public String getMarginWidth()
- {
-
- return iMarginWidth;
- }
-
- /**
- * Initialize this portlet by setting inst. vars from InitParamaters.
- *
- * @throws PortletException Initialization failed
- */
- public void init() throws PortletException
- {
- // first make sure we propagate init
- super.init();
-
- try
- {
- PortletConfig config = this.getPortletConfig();
- String param = null;
-
- param = config.getInitParameter(PARAM_SOURCE);
- if (param != null)
- {
- setSource(param);
- }
-
- param = config.getInitParameter(PARAM_WIDTH);
- if (param != null)
- {
- setWidth(param);
- }
-
- param = config.getInitParameter(PARAM_HEIGHT);
- if (param != null)
- {
- setHeight(param);
- }
-
- param = config.getInitParameter(PARAM_SCROLLING);
- if (param != null)
- {
- setScrolling(param);
- }
-
- param = config.getInitParameter(PARAM_FRAMEBORDER);
- if (param != null)
- {
- setFrameBorder(param);
- }
-
- param = config.getInitParameter(PARAM_STYLE);
- if (param != null)
- {
- setStyle(param);
- }
-
- param = config.getInitParameter(PARAM_NAME);
- if (param != null)
- {
- setFrameName(param);
- }
-
- param = config.getInitParameter(PARAM_REFRESH);
- if (param != null)
- {
- setRefresh(param);
- }
-
- param = config.getInitParameter(PARAM_MARGINWIDTH);
- if (param != null)
- {
- setMarginWidth(param);
- }
-
- param = config.getInitParameter(PARAM_MARGINHEIGHT);
- if (param != null)
- {
- setMarginHeight(param);
- }
-
- param = config.getInitParameter(PARAM_ALIGN);
- if (param != null)
- {
- setAlign(param);
- }
-
- }
- catch (Exception e)
- {
- logger.error("Exception in init()", e);
- throw new PortletException(e.getMessage());
- }
- }
-}
-
-
+ static final String DEFAULT_NOTSUPP_MSG =
+ "[Your user agent does not support inline frames or is currently"
+ + " configured not to display frames]";
+
+ static final String NO_SOURCE_MSG = "Please customize source for this IFrame";
+
+ static final String DEFAULT_SOURCE = "http://127.0.0.1";
+ static final String DEFAULT_WIDTH = null;
+ static final String DEFAULT_HEIGHT = null;
+ static final String DEFAULT_SCROLLING = "auto";
+ static final String DEFAULT_FRAMEBORDER = "1";
+
+ static final String PARAM_SOURCE = "source";
+ static final String PARAM_WIDTH = "width";
+ static final String PARAM_HEIGHT = "height";
+ static final String PARAM_SCROLLING = "scrolling";
+ static final String PARAM_FRAMEBORDER = "frameborder";
+ static final String PARAM_NAME = "name";
+ static final String PARAM_STYLE = "style";
+ static final String PARAM_MARGINWIDTH = "marginwidth";
+ static final String PARAM_MARGINHEIGHT = "marginheight";
+ static final String PARAM_REFRESH = "refresh";
+ static final String PARAM_ALIGN = "align";
+ static final String WEBAPPROOT = "${" + TurbineConstants.WEBAPP_ROOT + "}";
+
+ private final String PARAMETER_1 = "parameter1";
+ private final String PARAMETER_2 = "parameter2";
+ private final String PARAMETER_3 = "parameter3";
+ private final String PARAMETER_4 = "parameter4";
+ private final String PARAMETER_5 = "parameter5";
+ private final String PARAMETER_6 = "parameter6";
+
+ private final String VALUE_1 = "value1";
+ private final String VALUE_2 = "value2";
+ private final String VALUE_3 = "value3";
+ private final String VALUE_4 = "value4";
+ private final String VALUE_5 = "value5";
+ private final String VALUE_6 = "value6";
+
+ private String iSource = DEFAULT_SOURCE;
+ private String iWidth = DEFAULT_WIDTH;
+ private String iHeight = DEFAULT_HEIGHT;
+ private String iScrolling = DEFAULT_SCROLLING;
+ private String iFrameBorder = DEFAULT_FRAMEBORDER;
+ private String iMarginWidth = null;
+ private String iMarginHeight = null;
+ private String iStyle = null;
+ private String iName = null;
+ private String iRefresh = null;
+ private String iAlign = null;
+
+ private String param1 = "";
+ private String value1 = "";
+ private String param2 = "";
+ private String value2 = "";
+ private String param3 = "";
+ private String value3 = "";
+ private String param4 = "";
+ private String value4 = "";
+ private String param5 = "";
+ private String value5 = "";
+ private String param6 = "";
+ private String value6 = "";
+
+ /**
+ * Sets the source attribute of the IFramePortlet object
+ *
+ * @param source The new source value
+ * @since
+ */
+ public void setSource(String source)
+ {
+ if (source != null)
+ {
+ // Handle replacement variables
+ Hashtable parms = new Hashtable();
+ if (source.indexOf("${") >= 0)
+ {
+ // Add all portlet parms
+ parms.putAll(this.getPortletConfig().getInitParameters());
+
+ // Add web app root variable replacement
+ try
+ {
+ ServerData sd = new ServerData(TurbineServlet.getServerName(),
+ Integer.parseInt(TurbineServlet.getServerPort()),
+ TurbineServlet.getServerScheme(),
+ TurbineServlet.getContextPath(),
+ TurbineServlet.getContextPath());
+ DynamicURI uri = new DynamicURI(sd);
+ parms.put(TurbineConstants.WEBAPP_ROOT, uri.toString() + "/");
+ }
+ catch (Exception e)
+ {
+ logger.error("Exception", e);
+ }
+ // Add portlet name variable replacement
+ parms.put("portlet", this.getName());
+ }
+
+ this.iSource = org.apache.jetspeed.util.StringUtils.replaceVars(source, parms);
+ }
+
+ }
+
+ /**
+ * Sets the scrolling attribute of the IFramePortlet object
+ *
+ * @param scrolling The new scrolling value
+ * @since
+ */
+ public void setScrolling(String scrolling)
+ {
+ iScrolling = scrolling;
+ }
+
+
+ /**
+ * Sets the width attribute of the IFramePortlet object
+ *
+ * @param width The new width value
+ * @since
+ */
+ public void setWidth(String width)
+ {
+ iWidth = width;
+ }
+
+
+ /**
+ * Sets the height attribute of the IFramePortlet object
+ *
+ * @param height The new height value
+ * @since
+ */
+ public void setHeight(String height)
+ {
+ iHeight = height;
+ }
+
+
+ /**
+ * Sets the frameBorder attribute of the IFramePortlet object
+ *
+ * @param frameBorder The new frameBorder value
+ * @since
+ */
+ public void setFrameBorder(String frameBorder)
+ {
+ iFrameBorder = frameBorder;
+ }
+
+ /**
+ * Sets the width attribute of the IFramePortlet object
+ *
+ * @param width The new width value
+ */
+ public void setMarginWidth(String width)
+ {
+
+ iMarginWidth = width;
+ }
+
+ /**
+ * Sets the marginheight attribute of the IFramePortlet object
+ *
+ * @param height The new height value
+ */
+ public void setMarginHeight(String height)
+ {
+
+ iMarginHeight = height;
+ }
+
+ /**
+ * Sets the marginheight attribute of the IFramePortlet object
+ *
+ * @param height The new height value
+ */
+ public void setAlign(String value)
+ {
+
+ iAlign = value;
+ }
+
+ /**
+ * Sets the refresh meta tag
+ *
+ * @param value in seconds
+ */
+ public void setRefresh(String value)
+ {
+
+ iRefresh = value;
+ }
+
+
+ /**
+ * Sets the style of iframe. Some useful style effects:
+ *
+ * - border:5px dashed purple
+ *
- border:5px dotted red
+ *
- border:5px double red
+ *
- border:5px inset red
+ *
+ *
+ * @param value
+ */
+ public void setStyle(String value)
+ {
+
+ iStyle = value;
+ }
+
+ /**
+ * Sets the name of iframe. This is useful when referencing
+ * the iframe as a target from another link.
+ *
+ * @param value
+ */
+ public void setFrameName(String value)
+ {
+
+ iName = value;
+ }
+
+ /**
+ * This methods outputs the content of the portlet for a given request.
+ *
+ * @param runData the RunData object for the request
+ * @return the content to be displayed to the user-agent
+ */
+ public ConcreteElement getContent(RunData runData)
+ {
+
+ // Reinitialize if user customized the portlet (this will be useful
+ // when portlet preferences include user name and password for authentication or
+ // when other exposed iframe attributes are changed)
+ if (org.apache.jetspeed.util.PortletSessionState.getPortletConfigChanged(this, runData))
+ {
+ try {
+ this.init();
+ }
+ catch (PortletException pe)
+ {
+ logger.error("Exception", pe);
+ }
+ }
+
+ StringBuffer text = new StringBuffer();
+
+ if (getSource() == null || getSource().trim().length() == 0)
+ {
+ text.append(NO_SOURCE_MSG);
+ return (new StringElement(text.toString()));
+ }
+
+ text.append("");
+ return (new StringElement(text.toString()));
+ }
+
+
+ /**
+ * Gets the source attribute of the IFramePortlet object
+ *
+ * @return The source value
+ */
+ public String getSource()
+ {
+ return iSource;
+ }
+
+
+ /**
+ * Gets the scrolling attribute of the IFramePortlet object
+ *
+ * @return The scrolling value
+ */
+ public String getScrolling()
+ {
+ return iScrolling;
+ }
+
+
+ /**
+ * Gets the width attribute of the IFramePortlet object
+ *
+ * @return The width value
+ */
+ public String getWidth()
+ {
+ return iWidth;
+ }
+
+
+ /**
+ * Gets the height attribute of the IFramePortlet object
+ *
+ * @return The height value
+ */
+ public String getHeight()
+ {
+ return iHeight;
+ }
+
+
+ /**
+ * Gets whether to display a border around the IFRAME. "1" == yes.
+ *
+ * @return The frameBorder value
+ */
+ public String getFrameBorder()
+ {
+ String trueValues = "1,yes,true";
+ if (iFrameBorder != null && trueValues.indexOf(iFrameBorder) >= 0)
+ {
+ return "1";
+ }
+ return "0";
+ }
+
+
+ /**
+ * Gets the message displayed when IFRAME is not supported
+ * This includes when Frames are turned off.
+ *
+ * @todo This should be localized
+ * @return The notSupportedMsg value
+ */
+ public String getNotSupportedMsg()
+ {
+ return DEFAULT_NOTSUPP_MSG;
+ }
+
+ /**
+ * Gets the aling attribute of the IFramePortlet object
+ *
+ * @return The marginheight value
+ */
+ public String getAlign()
+ {
+
+ return iAlign;
+ }
+
+ /**
+ * Gets iframe style
+ *
+ * @return The style value
+ */
+ public String getStyle()
+ {
+
+ return iStyle;
+ }
+
+ /**
+ * Gets iframe name
+ *
+ * @return The name value
+ */
+ public String getFrameName()
+ {
+
+ return iName;
+ }
+
+ /**
+ * Gets iframe refresh
+ *
+ * @return The refresh value
+ */
+ public String getRefresh()
+ {
+
+ return iRefresh;
+ }
+
+ /**
+ * Gets the marginheight attribute of the IFramePortlet object
+ *
+ * @return The marginheight value
+ */
+ public String getMarginHeight()
+ {
+
+ return iMarginHeight;
+ }
+
+ /**
+ * Gets the marginwidth attribute of the IFramePortlet object
+ *
+ * @return The marginwidth value
+ */
+ public String getMarginWidth()
+ {
+
+ return iMarginWidth;
+ }
+
+ /**
+ * Gets the 1st parameter name to be passed
+ * @return the 1st parameter
+ */
+ public String getParam1()
+ {
+ return param1;
+ }
+
+ /**
+ * Gets the 2nd parameter name to be passed
+ * @return the 2nd parameter
+ */
+ public String getParam2()
+ {
+ return param2;
+ }
+
+ /**
+ * Gets the 3rd parameter name to be passed
+ * @return the 3rd parameter
+ */
+ public String getParam3()
+ {
+ return param3;
+ }
+
+ /**
+ * Gets the 4th parameter name to be passed
+ * @return the 4th parameter
+ */
+ public String getParam4()
+ {
+ return param4;
+ }
+
+ /**
+ * Gets the 5th parameter name to be passed
+ * @return the 5th parameter
+ */
+ public String getParam5()
+ {
+ return param5;
+ }
+
+ /**
+ * Gets the 6th parameter name to be passed
+ * @return the 6th parameter
+ */
+ public String getParam6()
+ {
+ return param6;
+ }
+
+ /**
+ * Gets the user defined 1st value (static or dynamic)
+ * @return 1st value
+ */
+ public String getValue1()
+ {
+ return value1;
+ }
+
+ /**
+ * Gets the user defined 2nd value (static or dynamic)
+ * @return 2nd value
+ */
+ public String getValue2()
+ {
+ return value2;
+ }
+
+ /**
+ * Gets the user defined 3rd value (static or dynamic)
+ * @return 3rd value
+ */
+ public String getValue3()
+ {
+ return value3;
+ }
+
+ /**
+ * Gets the user defined 4th value (static or dynamic)
+ * @return 4th value
+ */
+ public String getValue4()
+ {
+ return value4;
+ }
+
+ /**
+ * Gets the user defined 5th value (static or dynamic)
+ * @return 5th value
+ */
+ public String getValue5()
+ {
+ return value5;
+ }
+
+ /**
+ * Gets the user defined 6th value (static or dynamic)
+ * @return 6th value
+ */
+ public String getValue6()
+ {
+ return value6;
+ }
+
+ /**
+ * Sets the 1st parameter name
+ * @param string
+ */
+ public void setParam1(String string)
+ {
+ param1 = string;
+ }
+
+ /**
+ * Sets the 2nd parameter name
+ * @param string
+ */
+ public void setParam2(String string)
+ {
+ param2 = string;
+ }
+
+ /**
+ * Sets the 3rd parameter name
+ * @param string
+ */
+ public void setParam3(String string)
+ {
+ param3 = string;
+ }
+
+ /**
+ * Sets the 4th parameter name
+ * @param string
+ */
+ public void setParam4(String string)
+ {
+ param4 = string;
+ }
+
+ /**
+ * Sets the 5th parameter name
+ * @param string
+ */
+ public void setParam5(String string)
+ {
+ param5 = string;
+ }
+
+ /**
+ * Sets the 6th parameter name
+ * @param string
+ */
+ public void setParam6(String string)
+ {
+ param6 = string;
+ }
+
+ /**
+ * Sets the 1st value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue1(String string)
+ {
+ value1 = string;
+ }
+
+ /**
+ * Sets the 2nd value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue2(String string)
+ {
+ value2 = string;
+ }
+
+ /**
+ * Sets the 3rd value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue3(String string)
+ {
+ value3 = string;
+ }
+
+ /**
+ * Sets the 4th value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue4(String string)
+ {
+ value4 = string;
+ }
+
+ /**
+ * Sets the 5th value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue5(String string)
+ {
+ value5 = string;
+ }
+
+ /**
+ * Sets the 6th value to a static value or dynamic one
+ * @param string
+ */
+ public void setValue6(String string)
+ {
+ value6 = string;
+ }
+
+
+ /**
+ * If the parameter is known (username,password,etc...), return it's value
+ *
+ * @params s The Parameter to check
+ * @return The value of the parameter if it is known, nothing otherwise
+ */
+ private String getValue(String s, RunData runData)
+ {
+ if (s.equalsIgnoreCase("$username"))
+ return runData.getUser().getUserName();
+ else if (s.equalsIgnoreCase("$password"))
+ return runData.getUser().getPassword();
+ else if (s.equalsIgnoreCase("$clearpassword"))
+ return (String)runData.getUser().getTemp("sessionPassword");
+ else if (s.equalsIgnoreCase("$email"))
+ return runData.getUser().getEmail();
+ else if (s.equalsIgnoreCase("$firstname"))
+ return runData.getUser().getFirstName();
+ else if (s.equalsIgnoreCase("$lastname"))
+ return runData.getUser().getLastName();
+ else if (s.equalsIgnoreCase("$name"))
+ return runData.getUser().getName();
+
+ return s;
+ }
+
+ /**
+ * Initialize this portlet by setting inst. vars from InitParamaters.
+ *
+ * @throws PortletException Initialization failed
+ */
+ public void init() throws PortletException
+ {
+ // first make sure we propagate init
+ super.init();
+
+ try
+ {
+ PortletConfig config = this.getPortletConfig();
+ String param = null;
+
+ param = config.getInitParameter(PARAM_SOURCE);
+ if (param != null)
+ {
+ setSource(param);
+ }
+
+ param = config.getInitParameter(PARAM_WIDTH);
+ if (param != null)
+ {
+ setWidth(param);
+ }
+
+ param = config.getInitParameter(PARAM_HEIGHT);
+ if (param != null)
+ {
+ setHeight(param);
+ }
+
+ param = config.getInitParameter(PARAM_SCROLLING);
+ if (param != null)
+ {
+ setScrolling(param);
+ }
+
+ param = config.getInitParameter(PARAM_FRAMEBORDER);
+ if (param != null)
+ {
+ setFrameBorder(param);
+ }
+
+ param = config.getInitParameter(PARAM_STYLE);
+ if (param != null)
+ {
+ setStyle(param);
+ }
+
+ param = config.getInitParameter(PARAM_NAME);
+ if (param != null)
+ {
+ setFrameName(param);
+ }
+
+ param = config.getInitParameter(PARAM_REFRESH);
+ if (param != null)
+ {
+ setRefresh(param);
+ }
+
+ param = config.getInitParameter(PARAM_MARGINWIDTH);
+ if (param != null)
+ {
+ setMarginWidth(param);
+ }
+
+ param = config.getInitParameter(PARAM_MARGINHEIGHT);
+ if (param != null)
+ {
+ setMarginHeight(param);
+ }
+
+ param = config.getInitParameter(PARAM_ALIGN);
+ if (param != null)
+ {
+ setAlign(param);
+ }
+ param = config.getInitParameter(PARAMETER_1);
+ if (param != null)
+ {
+
+ setParam1(param);
+ }
+
+ param = config.getInitParameter(VALUE_1);
+ if (param != null)
+ {
+ setValue1(param);
+ }
+
+ param = config.getInitParameter(PARAMETER_2);
+ if (param != null)
+ {
+ setParam2(param);
+ }
+
+ param = config.getInitParameter(VALUE_2);
+ if (param != null)
+ {
+ setValue2(param);
+ }
+
+ param = config.getInitParameter(PARAMETER_3);
+ if (param != null)
+ {
+ setParam3(param);
+ }
+
+ param = config.getInitParameter(VALUE_3);
+ if (param != null)
+ {
+ setValue3(param);
+ }
+
+ param = config.getInitParameter(PARAMETER_4);
+ if (param != null)
+ {
+ setParam4(param);
+ }
+
+ param = config.getInitParameter(VALUE_4);
+ if (param != null)
+ {
+ setValue4(param);
+ }
+
+ param = config.getInitParameter(PARAMETER_5);
+ if (param != null)
+ {
+ setParam5(param);
+ }
+
+ param = config.getInitParameter(VALUE_5);
+ if (param != null)
+ {
+ setValue5(param);
+ }
+
+ param = config.getInitParameter(PARAMETER_6);
+ if (param != null)
+ {
+ setParam6(param);
+ }
+
+ param = config.getInitParameter(VALUE_6);
+ if (param != null)
+ {
+ setValue6(param);
+ }
+ }
+ catch (Exception e)
+ {
+ logger.error("Exception in init()", e);
+ throw new PortletException(e.getMessage());
+ }
+ }
+}
\ No newline at end of file