You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@esme.apache.org by rh...@apache.org on 2010/07/02 09:21:07 UTC
svn commit: r959881 -
/incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js
Author: rhirsch
Date: Fri Jul 2 07:21:07 2010
New Revision: 959881
URL: http://svn.apache.org/viewvc?rev=959881&view=rev
Log:
[ESME-234] Reply doesn't work when message contains chars that must be encoded
Modified:
incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js
Modified: incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js?rev=959881&r1=959880&r2=959881&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js (original)
+++ incubator/esme/trunk/server/src/main/webapp/scripts/display_messages_top.js Fri Jul 2 07:21:07 2010
@@ -27,6 +27,29 @@ function msgDateCompare(msg1, msg2)
return parseInt(msg1.message.when) - parseInt(msg2.message.when);
}
+// Replaces all instances of the given substring.
+String.prototype.replaceAll = function(
+ strTarget, // The substring you want to replace
+ strSubString // The string you want to replace in.
+ ){
+ var strText = this;
+ var intIndexOfMatch = strText.indexOf( strTarget );
+
+ // Keep looping while an instance of the target string
+ // still exists in the string.
+ while (intIndexOfMatch != -1){
+ // Relace out the current instance.
+ strText = strText.replace( strTarget, strSubString )
+
+ // Get the index of any next matching substring.
+ intIndexOfMatch = strText.indexOf( strTarget );
+ }
+
+ // Return the updated string with ALL the target strings
+ // replaced out with the new substring.
+ return( strText );
+}
+
function displayMessages(msgArray, elementId)
{
@@ -126,10 +149,13 @@ function displayMessages(msgArray, eleme
attr('onclick', 'javascript:resend_msg(' + id + ');' +
'clearResend("resend_' + id + '")');
}
+
+ var tempStr = msgBody.replaceAll ("'", ".");
-
+ var myReplyMsg = tempStr.replaceAll (".", "\'")
+
newMsg.find('#reply').attr('href',
- "javascript:setReplyTo(" + id + ", '"+ escape(msgBody) + "'," + msgPoolId + ", '" + msgAuthor.nickname + "')");
+ "javascript:setReplyTo(" + id + ", '"+ myReplyMsg + "'," + msgPoolId + ", '" + msgAuthor.nickname + "')");
var conversation = newMsg.find('#conversation');
if (msgConversation != 0) {
conversation.attr('href',
@@ -153,4 +179,12 @@ function displayMessages(msgArray, eleme
}
}
}
+// ]]>mplate
+ newMsg.find('*[id=tag]').remove();
+
+ // Insert the updated copy of the message into the page
+ newMsg.prependTo(msgInsertPt).show();
+ }
+ }
+}
// ]]>
\ No newline at end of file