[jboss-svn-commits] JBL Code SVN: r9164 - in labs/jbossforums/branches/forums26/forums/src: resources/portal-forums-war/WEB-INF and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jan 30 15:52:15 EST 2007


Author: unibrew
Date: 2007-01-30 15:52:15 -0500 (Tue, 30 Jan 2007)
New Revision: 9164

Modified:
   labs/jbossforums/branches/forums26/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
   labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
   labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml
   labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
Log:
[JBFORUMS-162] Another bunch of fixes. Forums seems to work with Alpha1.

Modified: labs/jbossforums/branches/forums26/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/branches/forums26/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2007-01-30 19:54:48 UTC (rev 9163)
+++ labs/jbossforums/branches/forums26/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java	2007-01-30 20:52:15 UTC (rev 9164)
@@ -48,6 +48,7 @@
 
 //portal
 import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 import javax.portlet.PortletPreferences;
 import javax.portlet.PortletURL;
@@ -59,6 +60,7 @@
 
 import org.jboss.portal.core.modules.ModuleConstants;
 import org.jboss.portal.identity.ProfileMap;
+import org.jboss.portal.identity.UserProfileModule;
 import org.jboss.portal.identity.UserModule;
 import org.jboss.portal.identity.User;
 import org.jboss.portal.format.render.bbcodehtml.ToHTMLConfig;
@@ -93,13 +95,6 @@
                 return null;
             }
 
-            public boolean getEnabled() {
-                return false;
-            }
-
-            public void setEnabled(boolean b) {
-            }
-
             public void updatePassword(String string) {
             }
 
@@ -107,81 +102,23 @@
                 return false;
             }
 
-            public ProfileMap getProfile() {
-                return null;
-            }
-
             public String getUserName() {
                 return null;
             }
-
-            public String getGivenName() {
-                return null;
-            }
-
-            public void setGivenName(String string) {
-            }
-
-            public String getFamilyName() {
-                return null;
-            }
-
-            public void setFamilyName(String string) {
-            }
-
-            public String getRealEmail() {
-                return null;
-            }
-
-            public void setRealEmail(String string) {
-            }
-
-            public String getFakeEmail() {
-                return null;
-            }
-
-            public void setFakeEmail(String string) {
-            }
-
-            public Date getRegistrationDate() {
-                return null;
-            }
-
-            public boolean getViewRealEmail() {
-                return false;
-            }
-
-            public void setViewRealEmail(boolean b) {
-            }
-
-            public Locale getPreferredLocale() {
-                return null;
-            }
-
-            public void setPreferredLocale(Locale locale) {
-            }
-
-            public String getSignature() {
-                return null;
-            }
-
-            public void setSignature(String string) {
-            }
-
-            public Date getLastVisitDate() {
-                return null;
-            }
-
-            public void setLastVisitDate(Date date) {
-            }
-
-            public String getTheme() {
-                return null;
-            }
-
-            public void setTheme(String string) {
-            }
         };
+        
+     private final static UserProfileModule upm;
+     
+     static {
+         UserProfileModule temporary = null;
+         try {
+             temporary = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
+         } catch (NamingException e) {
+             JSFUtil.handleException(e);
+         } finally {
+             upm = temporary;
+         }
+     }
 
      
         /**
@@ -465,7 +402,7 @@
      * @return
      * @throws Exception
      */
-    public static String userProperty(Map properties, String propertyName)
+    public static String userProperty(User user, String propertyName)
         throws Exception
     {
         String property = null;
@@ -473,7 +410,7 @@
         try
         {
             property = user.getClass().getField(propertyName).get(user).toString();
-            Object value = properties.get(property);
+            Object value = upm.getProperty(user,property);
             if (value != null)
             {
                 valueStr = value.toString();

Modified: labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
===================================================================
--- labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml	2007-01-30 19:54:48 UTC (rev 9163)
+++ labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml	2007-01-30 20:52:15 UTC (rev 9164)
@@ -27,7 +27,7 @@
 	<function>
   		<function-name>userProperty</function-name>
   		<function-class>org.jboss.portlet.forums.ui.PortalUtil</function-class>
-  		<function-signature>java.lang.String userProperty(java.util.Map,java.lang.String)</function-signature>
+  		<function-signature>java.lang.String userProperty(org.jboss.portal.identity.User,java.lang.String)</function-signature>
 	</function>
 	<!-- 
 		 function to get constant declarations

Modified: labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml	2007-01-30 19:54:48 UTC (rev 9163)
+++ labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml	2007-01-30 20:52:15 UTC (rev 9164)
@@ -70,7 +70,7 @@
                      <span class="gen">${resource.L_JOINED}:&#160;</span>
                   </td>
                   <td width="100%">
-                     <b><span class="gen">${profile.poster.user.registrationDate}</span></b>
+                     <b><span class="gen">${forums:userProperty(profile.poster.user,'INFO_USER_REGISTRATION_DATE')}</span></b>
                   </td>
                </tr>
                <tr>
@@ -90,7 +90,7 @@
                      <span class="gen">${resource.L_LOCATION}:&#160;</span>
                   </td>
                   <td>
-                     <b><span class="gen">#{forums:userProperty(profile.poster.user.profile,"INFO_USER_LOCATION")}</span></b>
+                     <b><span class="gen">#{forums:userProperty(profile.poster.user,'INFO_USER_LOCATION')}</span></b>
                   </td>
                </tr>
                <tr>
@@ -99,9 +99,9 @@
                   </td>
                   <td>
                      <span class="gen">
-                        <c:if test="#{forums:userProperty(profile.poster.user.profile,'INFO_USER_HOMEPAGE')!=null}" >
+                        <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_HOMEPAGE')!=null}" >
                         <b>
-                            <a href="${forums:userProperty(profile.poster.user.profile,'INFO_USER_HOMEPAGE')}" style="text-decoration: none;">
+                            <a href="${forums:userProperty(profile.poster.user,'INFO_USER_HOMEPAGE')}" style="text-decoration: none;">
                                  <img border="0"
                                       src="#{forums:themeURL('resourceIconWWWURL')}"
                                       alt="${resource.Visit_website}"/>
@@ -116,7 +116,7 @@
                      <span class="gen">${resource.L_OCCUPATION}:&#160;</span>
                   </td>
                   <td>
-                     <b><span class="gen">#{forums:userProperty(profile.poster.user.profile,"INFO_USER_OCCUPATION")}</span></b>
+                     <b><span class="gen">#{forums:userProperty(profile.poster.user,'INFO_USER_OCCUPATION')}</span></b>
                   </td>
                </tr>
                <tr>
@@ -124,7 +124,7 @@
                      <span class="gen">${resource.L_INTERESTS}:</span>
                   </td>
                   <td>
-                     <b><span class="gen">#{forums:userProperty(profile.poster.user.profile,"INFO_USER_INTERESTS")}</span></b>
+                     <b><span class="gen">#{forums:userProperty(profile.poster.user,'INFO_USER_INTERESTS')}</span></b>
                   </td>
                </tr>
             </table>
@@ -135,7 +135,7 @@
             <b>
                 <span class="gen">
                     ${resource.L_CONTACT}:
-                    ${profile.poster.user.givenName}
+                    ${forums:userProperty(profile.poster.user,'INFO_USER_NAME_GIVEN')}
                 </span>
             </b>
          </td>
@@ -150,8 +150,8 @@
                   <td class="row1" valign="middle" width="100%">
                      <b>
                         <span class="gen">
-                            <c:if test="#{profile.poster.user.fakeEmail!=null}" >
-                               <a href="mailto:${profile.poster.user.fakeEmail}" style="text-decoration: none;">
+                            <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_EMAIL_FAKE')!=null}" >
+                               <a href="mailto:${forums:userProperty(profile.poster.user,'INFO_USER_EMAIL_FAKE')}" style="text-decoration: none;">
                                     <img border="0"
                                          src="#{forums:themeURL('resourceIconEmailURL')}"
                                          alt="${resource.Send_email}"/>
@@ -167,8 +167,8 @@
                   </td>
                   <td class="row1" valign="middle">
                      <span class="gen">
-                        <c:if test="#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_SKYPE')!=null}" >
-                           <a href="skype:#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_SKYPE')}?add" style="text-decoration: none;">
+                        <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_IM_SKYPE')!=null}" >
+                           <a href="skype:#{forums:userProperty(profile.poster.user,'INFO_USER_IM_SKYPE')}?add" style="text-decoration: none;">
                                 <img border="0"
                                      src="#{forums:themeURL('resourceIconSkypeURL')}"
                                      alt="${resource.L_SKYPE}"/>
@@ -183,7 +183,7 @@
                   </td>
                   <td class="row1" valign="middle">
                      <span class="gen">
-                        #{forums:userProperty(profile.poster.user.profile,"INFO_USER_IM_MSNM")}
+                        #{forums:userProperty(profile.poster.user,'INFO_USER_IM_MSNM')}
                      </span>
                   </td>
                </tr>
@@ -193,8 +193,8 @@
                   </td>
                   <td class="row1" valign="middle">
                      <span class="gen">
-                        <c:if test="#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_YIM')!=null}" >
-                            <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_YIM')}&amp;.src=pg" style="text-decoration: none;">
+                        <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_IM_YIM')!=null}" >
+                            <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(profile.poster.user,'INFO_USER_IM_YIM')}&amp;.src=pg" style="text-decoration: none;">
                                 <img border="0"
                                      src="#{forums:themeURL('resourceIconYIMURL')}"
                                      alt="${resource.YIM}"/>
@@ -209,8 +209,8 @@
                   </td>
                   <td class="row1" valign="middle">
                      <span class="gen">
-                        <c:if test="#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_AIM')!=null}" >
-                            <a href="aim:goim?screenname=#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?" style="text-decoration: none;">
+                        <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_IM_AIM')!=null}" >
+                            <a href="aim:goim?screenname=#{forums:userProperty(profile.poster.user,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?" style="text-decoration: none;">
                                 <img border="0"
                                      src="#{forums:themeURL('resourceIconAIMURL')}"
                                      alt="${resource.AIM}"/>
@@ -224,7 +224,7 @@
                      <span class="gen">${resource.L_ICQ_NUMBER}:</span>
                   </td>
                   <td class="row1">
-                     <c:if test="#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_ICQ')!=null}" >
+                     <c:if test="#{forums:userProperty(profile.poster.user,'INFO_USER_IM_ICQ')!=null}" >
                      <script language="JavaScript" type="text/javascript"><!--
 
 		if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
@@ -233,7 +233,7 @@
 			document.write('<table cellspacing="0" cellpadding="0" border="0"><tr><td nowrap="nowrap"><div style="position:relative;height:18px"><div style="position:absolute">${n:out("ICQ_IMG")}</div><div style="position:absolute;left:3px;top:-1px">${n:out("ICQ_STATUS_IMG")}</div></div></td></tr></table>');
 		  
 		  //--></script>
-                        <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(profile.poster.user.profile,'INFO_USER_IM_ICQ')}" style="text-decoration: none;">
+                        <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(profile.poster.user,'INFO_USER_IM_ICQ')}" style="text-decoration: none;">
                             <img border="0"
                                  src="#{forums:themeURL('resourceIconICQURL')}"
                                  alt="${resource.ICQ}"/>

Modified: labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml
===================================================================
--- labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml	2007-01-30 19:54:48 UTC (rev 9163)
+++ labs/jbossforums/branches/forums26/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml	2007-01-30 20:52:15 UTC (rev 9164)
@@ -345,7 +345,7 @@
                               <span class="postbody">
                                     #{forums:formatMessage(postrow.message.text,false)}
                                     <br /><br />
-                                    ${postrow.poster.user.signature}
+                                    ${forums:userProperty(postrow.poster.user,'INFO_USER_SIGNATURE')}
                               </span>
                               
                               <!-- show the attachments of this post here -->
@@ -415,15 +415,15 @@
                                  </f:verbatim>
                               </h:outputLink> -->
                               
-                              <c:if test="${postrow.poster.user.fakeEmail ne null}">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_EMAIL_FAKE') ne null}">
                                  <a href="mailto:${postrow.poster.user.fakeEmail}" style="text-decoration: none;">
                                         <img border="0"
                                              src="#{forums:themeURL('resourceIconEmailURL')}"
                                              alt="${resource.Send_email}"/>
                                  </a>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_HOMEPAGE') ne null}">
-                                 <h:outputLink value="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_HOMEPAGE')}" style="text-decoration: none;">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE') ne null}">
+                                 <h:outputLink value="${forums:userProperty(postrow.poster.user,'INFO_USER_HOMEPAGE')}" style="text-decoration: none;">
                                     <f:verbatim>
                                         <img border="0"
                                              src="#{forums:themeURL('resourceIconWWWURL')}"
@@ -431,29 +431,29 @@
                                     </f:verbatim>
                                  </h:outputLink>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_AIM') ne null}">
-                                 <a href="aim:goim?screenname=#{forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?" style="text-decoration: none;">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM') ne null}">
+                                 <a href="aim:goim?screenname=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_AIM')}&amp;message=Hello+Are+you+there?" style="text-decoration: none;">
                                      <img border="0"
                                           src="#{forums:themeURL('resourceIconAIMURL')}"
                                           alt="${resource.AIM}"/>
                                  </a>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_YIM') ne null}">
-                                 <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_YIM')}&amp;.src=pg" style="text-decoration: none;">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM') ne null}">
+                                 <a href="http://edit.yahoo.com/config/send_webmesg?.target=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_YIM')}&amp;.src=pg" style="text-decoration: none;">
                                      <img border="0"
                                           src="#{forums:themeURL('resourceIconYIMURL')}"
                                           alt="${resource.YIM}"/>
                                  </a>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_SKYPE') ne null}">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE') ne null}">
                                 <!-- TODO: some more functionality may be added. Like automatic skype instalation and status checker.-->
-                                 <a href="skype:#{forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_SKYPE')}?add" style="text-decoration: none;">
+                                 <a href="skype:#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_SKYPE')}?add" style="text-decoration: none;">
                                      <img border="0"
                                           src="#{forums:themeURL('resourceIconSkypeURL')}"
                                           alt="${resource.L_SKYPE}"/>
                                  </a>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_MSNM') ne null}">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_MSNM') ne null}">
                                  <h:outputLink value="#{forums:outputLink(shared.links['profile'],true)}" style="text-decoration: none;">
                                      <f:param name="uid"
                                               value="#{postrow.poster.user.id}"/>
@@ -464,8 +464,8 @@
                                      </f:verbatim>
                                   </h:outputLink>
                               </c:if>
-                              <c:if test="${forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_ICQ') ne null}">
-                                 <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(postrow.poster.user.profile,'INFO_USER_IM_ICQ')}" style="text-decoration: none;">
+                              <c:if test="${forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ') ne null}">
+                                 <a href="http://www.icq.com/scripts/search.dll?to=#{forums:userProperty(postrow.poster.user,'INFO_USER_IM_ICQ')}" style="text-decoration: none;">
                                      <img border="0"
                                           src="#{forums:themeURL('resourceIconICQURL')}"
                                           alt="${resource.ICQ}"/>




More information about the jboss-svn-commits mailing list