You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@esme.apache.org by vd...@apache.org on 2011/02/27 23:12:34 UTC

svn commit: r1075159 - in /esme/trunk/server/src/main: scala/org/apache/esme/comet/Timeline.scala webapp/scripts/display_messages_top.js

Author: vdichev
Date: Sun Feb 27 22:12:33 2011
New Revision: 1075159

URL: http://svn.apache.org/viewvc?rev=1075159&view=rev
Log:
ESME-327 Send context root to JavaScript for proper user page/avatar construction

Modified:
    esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
    esme/trunk/server/src/main/webapp/scripts/display_messages_top.js

Modified: esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala
URL: http://svn.apache.org/viewvc/esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala?rev=1075159&r1=1075158&r2=1075159&view=diff
==============================================================================
--- esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala (original)
+++ esme/trunk/server/src/main/scala/org/apache/esme/comet/Timeline.scala Sun Feb 27 22:12:33 2011
@@ -66,11 +66,12 @@ trait Timeline extends CometActor {
 
     OnLoad(
       clearFunc &
+      JsCrVar ("root", Message.root) &
       JsCrVar(jsId, JsArray(
         filter(toDisplay).map{case (msg, reason, resent) =>
                   JsObj(("message",msg.asJs),("reason",reason.asJs), ("resent",resent))
                   } :_*)) &
-      JsFunc("displayMessages", JsVar(jsId), jsId).cmd
+      JsFunc("displayMessages", JsVar(jsId), jsId, JsVar("root")).cmd
     )
   }                                              
   

Modified: esme/trunk/server/src/main/webapp/scripts/display_messages_top.js
URL: http://svn.apache.org/viewvc/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js?rev=1075159&r1=1075158&r2=1075159&view=diff
==============================================================================
--- esme/trunk/server/src/main/webapp/scripts/display_messages_top.js (original)
+++ esme/trunk/server/src/main/webapp/scripts/display_messages_top.js Sun Feb 27 22:12:33 2011
@@ -137,7 +137,7 @@ function parseXml(xml) {
 }
 
 
-function displayMessages(msgArray, elementId)
+function displayMessages(msgArray, elementId, root)
 {
 	
 
@@ -217,20 +217,13 @@ function displayMessages(msgArray, eleme
       
       newMsg.find('.author').text(msgAuthor.nickname);
       
-      // Dealing with tomcat
-      if (top.location.pathName == "/") 
-      	  newMsg.find('.author').attr('href',"/user/" + msgAuthor.nickname );
-     else
-      	 newMsg.find('.author').attr('href', window.location.pathname + "user/" + msgAuthor.nickname );    
+      newMsg.find('.author').attr('href', root + "/user/" + msgAuthor.nickname );
      
      
            // Dealing with users with no avatars
       if (!msgAuthor.imageUrl) {
-      	if (top.location.pathName == "/") 
-      	 msgAuthor.imageUrl= "images/avatar.jpg"
-      	else
-      	msgAuthor.imageUrl= "../images/avatar.jpg" 
-     }
+        msgAuthor.imageUrl= root + "/images/avatar.jpg"
+      }
      
      	
      if (!msgPool)
@@ -268,7 +261,7 @@ function displayMessages(msgArray, eleme
       var conversation = newMsg.find('.conversation');
       if (msgConversation != 0) {
         conversation.attr('href', 
-          '/conversation/' + msgConversation);
+          root + '/conversation/' + msgConversation);
       } else {
         conversation.css("display", "none");
       }