incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r804817 - in /incubator/esme/trunk/server/src/main/scala/org/apache/esme: lib/StreamMgr.scala model/Message.scala
Date Sun, 16 Aug 2009 23:35:02 GMT
Author: vdichev
Date: Sun Aug 16 23:35:02 2009
New Revision: 804817

URL: http://svn.apache.org/viewvc?rev=804817&view=rev
Log:
Show XHTML instead of plain text as message body.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/StreamMgr.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/StreamMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/StreamMgr.scala?rev=804817&r1=804816&r2=804817&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/StreamMgr.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/lib/StreamMgr.scala Sun Aug
16 23:35:02 2009
@@ -98,7 +98,7 @@
                         "item" -> 
                         (lst => xs.flatMap(i => bind("item", lst,
                                                      "author" -> i.author.obj.map(_.nickname.is).openOr(""),
-                                                     "text" -> i.getText,
+                                                     "text" -> i.digestedXHTML,
                                                      "date" -> new java.util.Date(i.when.toLong).toString
                 ))))
       }

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala?rev=804817&r1=804816&r2=804817&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala Sun Aug
16 23:35:02 2009
@@ -198,7 +198,16 @@
 
   object viaGroup extends MappedLongForeignKey(this, Group)
 
-  private[model] object text extends MappedText(this)
+  private[model] object text extends MappedText(this){
+    import scala.xml.transform.{RuleTransformer, RewriteRule}
+    override def asJsExp =
+      JE.Str(XML.loadString(is).map(new RuleTransformer(new RewriteRule {
+        override def transform(n: Node) = n match {
+          case e: Elem if "body" == e.label => <body>{digestedXHTML}</body>
+          case _ => n
+        }
+      })).mkString)
+  }
 
   object when extends MappedLong(this) {
     override def defaultValue = millis



Mime
View raw message