Author: billyxie
Date: 2010-01-25 11:41:25 +0100 (Mon, 25 Jan 2010)
New Revision: 40714

Added:
   
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/taglib/RegisterTag.java
Modified:
   CMSContainer/trunk/CMSContainer_Modules/community/src/tld/community.tld
Log:
CMSC-1624 - SSO - create tag for register page

Added: 
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/taglib/RegisterTag.java
===================================================================
--- 
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/taglib/RegisterTag.java
                              (rev 0)
+++ 
CMSContainer/trunk/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/taglib/RegisterTag.java
      2010-01-25 10:41:25 UTC (rev 40714)
@@ -0,0 +1,44 @@
+package com.finalist.cmsc.community.taglib;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.PageContext;
+
+public class RegisterTag extends AbstractSSOTag  {
+
+   private static final String CAS_REGISTOR_LOCALE = "cas_registor_locale";
+//   private String referurl;    
+   private String locale;
+   
+//   public void setReferurl(String referurl) {
+//      this.referurl = referurl;
+//   }
+   
+   public void setLocale(String locale) {
+      this.locale = locale;
+   }
+   
+   @Override
+   protected String getValue() {
+      PageContext ctx = (PageContext) getJspContext();
+      HttpServletRequest req = (HttpServletRequest) ctx.getRequest();
+
+      String link = "";
+//      StringBuffer backUrl = new StringBuffer();
+//      if (referurl != null) {
+//         backUrl = backUrl.append(ctx.getAttribute(referurl));
+//      }
+//      else {
+//         backUrl.append(HttpUtil.getWebappUri(req));
+//         backUrl.append(getPath());
+//      }
+      String defaultRegisterUrl = "casServerRegisterUrl";
+      if (locale != null) {
+         defaultRegisterUrl += "_" + locale;
+      }
+//      link = getParameter(defaultRegisterUrl) + "?service=" + backUrl;
+      link = getParameter(defaultRegisterUrl);
+      req.getSession().setAttribute(CAS_REGISTOR_LOCALE, locale);
+      return link;
+   }
+
+}

Modified: 
CMSContainer/trunk/CMSContainer_Modules/community/src/tld/community.tld
===================================================================
--- CMSContainer/trunk/CMSContainer_Modules/community/src/tld/community.tld     
2010-01-25 10:40:21 UTC (rev 40713)
+++ CMSContainer/trunk/CMSContainer_Modules/community/src/tld/community.tld     
2010-01-25 10:41:25 UTC (rev 40714)
@@ -130,6 +130,24 @@
       </attribute>
    </tag>
    <tag>
+      <name>register</name>
+      <tag-class>com.finalist.cmsc.community.taglib.RegisterTag</tag-class>
+      <body-content>scriptless</body-content>
+      <description>Link to resister page</description>
+      <attribute>
+         <name>var</name>
+         <description>JSP variable name to value of the path of register 
page.</description>
+         <required>false</required>
+         <rtexprvalue>false</rtexprvalue>
+      </attribute>
+      <attribute>
+         <name>locale</name>
+         <description>JSP variable name to value of locale.</description>
+         <required>false</required>
+         <rtexprvalue>false</rtexprvalue>
+      </attribute>
+   </tag>
+   <tag>
       <name>remoteUser</name>
       <tag-class>com.finalist.cmsc.community.taglib.RemoteUserTag</tag-class>
       <body-content>scriptless</body-content>

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to