Author: jvdrean
Date: 2008-02-26 18:51:11 +0100 (Tue, 26 Feb 2008)
New Revision: 7971
Modified:
xwiki-platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListMessage
Log:
XPWATCHLIST-8 : Send diffs as part of the email in addition to sending modified
pages
Modified:
xwiki-platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListMessage
===================================================================
---
xwiki-platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListMessage
2008-02-26 17:36:16 UTC (rev 7970)
+++
xwiki-platform/xwiki-applications/trunk/watchlist/src/main/resources/XWiki/WatchListMessage
2008-02-26 17:51:11 UTC (rev 7971)
@@ -8,13 +8,13 @@
<translation>0</translation>
<parent></parent>
<creator></creator>
-<author></author>
+<author>XWiki.Admin</author>
<customClass></customClass>
-<contentAuthor></contentAuthor>
-<creationDate>1197307330000</creationDate>
-<date>1197307330000</date>
-<contentUpdateDate>1197307330000</contentUpdateDate>
-<version>1.1</version>
+<contentAuthor>XWiki.Admin</contentAuthor>
+<creationDate>1203938786000</creationDate>
+<date>1204021914000</date>
+<contentUpdateDate>1204021914000</contentUpdateDate>
+<version>2.1</version>
<title></title>
<template></template>
<defaultTemplate></defaultTemplate>
@@ -70,29 +70,223 @@
<number>0</number>
<className>XWiki.Mail</className>
<property>
-<html><b>Hello $pseudo,</b><br/>
+<html><body style="background-color:#F7F7F7;">
+<b>Hello $pseudo,</b><br/>
<i>This message is sent by XWiki. Here are the documents in your
watchlist that have been created or updated since the last notification
:</i><br/>
<br/>
-<table width="100%">
-<tr style="background-color:#EFEFEF;font-weight:bold;">
-<td>Name</td><td>Space</td><td>Modified
by</td><td>Comment</td><td>Modified on</td>
+<table width="100%" style="font-family:arial;font-size:14px;"
cellpadding="4" cellspacing="0">
+<tr style="background-color:$DEDEDE;font-weight:bold;">
+<td>Page</td><td>Informations</td>
</tr>
+<tr><td colspan="2"></td></tr>
+## ------------------------------------------
+## Loop over the modified documents
+## ------------------------------------------
#foreach ($udocname in $documents)
+#set ($identifiedModification = false)
#set ($udoc = $xwiki.getDocument($udocname))
#if ($velocityCount % 2 == 0)
- #set ($color = "#E5F0FE")
+ #set ($color = "#FFF")
#else
#set ($color = "#FFF")
#end
+## ------------------------------------------
+## 1st line : doc name, last author, etc
+## ------------------------------------------
<tr style="background-color:${color};">
-<td><a
href="${udoc.getExternalURL()}">$udoc.getDisplayTitle()</a></td>
-<td>$udoc.web</td>
-<td>$xwiki.getLocalUserName($udoc.author, true)</td>
-<td>$udoc.getComment()</td>
-<td>$xwiki.formatDate($udoc.date)</td>
+<td style="border-top:1px solid #999999;border-left:1px solid
#999999;border-bottom:1px solid #999999;font-weight:bold;"><a
href="${udoc.getExternalURL()}">$udoc.getDisplayTitle()</a><br/><span
style="font-size:10px;">${udoc.fullName}</span></td>
+<td style="border-top:1px solid #999999;border-right:1px solid #999999;">
+modified by $xwiki.getLocalUserName($udoc.author, false) on
$xwiki.formatDate($udoc.date) #if (!$udoc.getComment().equals("")), comment :
$udoc.getComment() #end
+</td>
</tr>
+#set ($rev1 = "")
+#foreach ($rev in $udoc.getRecentRevisions(2))
+ #set ($rev1 = $rev)
#end
-</table></html>
+#set ($rev2 = $udoc.getVersion())
+#set($origdoc = $xwiki.getDocument($udoc, $rev1))
+#set($newdoc = $udoc)
+## ------------------------------------------
+## 2nd line : differences
+## ------------------------------------------
+<tr style="background-color:${color};">
+<td style="background-color:#F7F7F7;"></td>
+<td style="border-bottom:1px solid #999999;border-right:1px solid
#999999;border-left:1px solid #999999;">
+## ------------------------------------------
+## Content
+## ------------------------------------------
+##
+#macro(displayhtmldiff $html)
+##set ($html = $html.replaceAll('\<span
class="diffremoveword"\>(.*)\</span\>', '\<span
style="font-style:bold;color:red;"\>\<strike\>$1\</strike\>\</span\>'))
+#set ($html = $html.replaceAll('class="diffremoveword"',
'style="text-decoration: line-through;color:red;"'))
+#set ($html = $html.replaceAll('class="diffaddword"',
'style="font-weight:bold;color:green;"'))
+$html
+#end
+#if($origdoc.get("XWiki.ArticleClass"))
+ ##
+ ## blog article
+ ##
+ #set($ok = $origdoc.use("XWiki.ArticleClass"))
+ #set($origcontent = $!origdoc.getValue("content").trim())
+ #if(!$origcontent)
+ #set($text1 = "")
+ #else
+ #set($text1 = $origcontent)
+ #end
+ #set($ok = $newdoc.use("XWiki.ArticleClass"))
+ #set($newcontent = $!newdoc.getValue("content").trim())
+ #if(!$newcontent)
+ #set($text2 = "")
+ #else
+ #set($text2 = $newcontent)
+ #end
+ #set ($htmlDiff = $xwiki.diff.getDifferencesAsHTML($text1, $text2 ,false))
+ ## !$text1.equals($text2) was failing
+ #if(!$htmlDiff.replaceAll('\<div class="diff"\>\</div\>',
"").trim().equals(""))
+ #set ($identifiedModification = true)
+ <table class="changes-table" width="100%"
style="border-color:#CDCDCD;font-family:arial;font-size:12px;text-align:left;">
+ <tr class="changes-table-title">
+ <th style="border-bottom:1px solid #000000;">Content</th>
+ </tr>
+ <tr>
+ <td>
+ $htmlDiff
+ </td>
+ </tr>
+ </table>
+ #end
+#else
+ ##
+ ## Wiki page
+ ##
+ #set($origcontent = $!origdoc.content.trim())
+ #if(!$origcontent)
+ #set($text1 = "")
+ #else
+ #set($text1 = $origcontent)
+ #end
+ #set($newcontent = $!newdoc.content.trim())
+ #if(!$newcontent)
+ #set($text2 = "")
+ #else
+ #set($text2 = $newcontent)
+ #end
+ #set ($htmlDiff = $xwiki.diff.getDifferencesAsHTML($text1, $text2
,false).replaceAll('\<div class="diff"\>\</div\>', "").trim())
+ ## !$text1.equals($text2) was failing
+ #if(!$htmlDiff.equals(""))
+ #set ($identifiedModification = true)
+ <table class="changes-table" width="100%"
style="border-color:#CDCDCD;font-family:arial;font-size:12px;text-align:left;">
+ <tr class="changes-table-title">
+ <th style="border-bottom:1px solid #000000;">Content</th>
+ </tr>
+ <tr>
+ <td>
+ #displayhtmldiff($htmlDiff)
+ </td>
+ </tr>
+ </table>
+ #end
+#end
+## ------------------------------------------
+## Comments
+## ------------------------------------------
+#set($commentchanges = 0)
+#foreach($objdiffs in $newdoc.getObjectDiff($origdoc, $newdoc))
+ #set($commentchangetitledone = 0)
+ #foreach($objdiff in $objdiffs)
+ #if($objdiff.getClassName().equals("XWiki.XWikiComments"))
+ #if($commentchangetitledone==0)
+ #set($commentchanges = 1 + $commentchanges)
+ #set($commentchangetitledone = 1)
+ #end
+ #end
+ #end
+#end
+#if($commentchanges>0)
+#set ($identifiedModification = true)
+<table class="changes-table" width="100%"
style="border-color:#CDCDCD;font-family:arial;font-size:12px;text-align:left;">
+<tr class="changes-table-title" style="border-bottom:1px solid #000000;">
+<th style="border-bottom:1px solid #000000;">Comment</th>
+</tr>
+#foreach($objdiffs in $newdoc.getObjectDiff($origdoc, $newdoc))
+ #set ($wascomment = false)
+ #set ($author = "")
+ #set ($date = "")
+ #set ($comment = "")
+ #foreach($objdiff in $objdiffs)
+ #if($objdiff.getClassName().equals("XWiki.XWikiComments"))
+ #set ($wascomment = true)
+ #set($propname = $objdiff.getPropName())
+ #if($propname=="author")
+ #set($author = $objdiff.getNewValue().toString())
+ #if($author!="")
+ #set ($author =
$xwiki.renderText($xwiki.getLocalUserName($author),$newdoc))
+ #end
+ #elseif ($propname=="date")
+ #set($date = $objdiff.getNewValue().toString())
+ #elseif ($propname=="comment")
+ #set($comment = $objdiff.getNewValue().toString())
+ #end
+ #else
+ #set($wascomment = false)
+ #end
+ #end
+ #if ($comment!="")
+ <tr>
+ <td>
+ Added by $author on $date : <br/>
+ <br/>
+ $comment
+ </td>
+ </tr>
+ #end
+#end
+</table>
+#end
+## ------------------------------------------
+## Attachments
+## ------------------------------------------
+#set($attachChanges = $newdoc.getAttachmentDiff($origdoc, $newdoc))
+#if ($attachChanges && $attachChanges.size() > 0)
+#set ($identifiedModification = true)
+ <table class="changes-table" width="100%"
style="border-color:#CDCDCD;font-family:arial;font-size:12px;text-align:left;">
+ <tr class="changes-table-title">
+ <th style="border-bottom:1px solid #000000;">Attachment</th>
+ </tr>
+ #foreach($attachChange in $attachChanges)
+ <tr>
+ <td>
+ #if(!$attachChange.origVersion)
+ Attachment added : <a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.newVersion)">$attachChange.fileName</a>
+ #elseif(!$attachChange.newVersion)
+ Attachment deleted : $attachChange.fileName
+ #else
+ Attachment updated from version <a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.origVersion)">$attachChange.origVersion</a>
+ to version <a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.newVersion)">$attachChange.newVersion</a>
+ #end
+ </td>
+ </tr>
+ #end
+ </table>
+#end
+##
+## / Differences
+##
+#if (!$identifiedModification)
+Modifications on page objects or class
+#end
+</td>
+</tr>
+##
+## Spacer
+##
+<tr>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+</tr>
+#end
+</table>
+</body></html>
</property>
<property>
<language>en</language>
@@ -109,5 +303,38 @@
#end</text>
</property>
</object>
+<object>
+<class>
+<name>XWiki.TagClass</name>
+<customClass></customClass>
+<customMapping></customMapping>
+<defaultViewSheet></defaultViewSheet>
+<defaultEditSheet></defaultEditSheet>
+<defaultWeb></defaultWeb>
+<nameField></nameField>
+<validationScript></validationScript>
+<tags>
+<cache>0</cache>
+<displayType>input</displayType>
+<multiSelect>1</multiSelect>
+<name>tags</name>
+<number>1</number>
+<prettyName>Tags</prettyName>
+<relationalStorage>1</relationalStorage>
+<separator> </separator>
+<separators> ,|</separators>
+<size>30</size>
+<unmodifiable>0</unmodifiable>
+<values></values>
+<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
+</tags>
+</class>
+<name>XWiki.WatchListMessage</name>
+<number>0</number>
+<className>XWiki.TagClass</className>
+<property>
+<tags/>
+</property>
+</object>
<content>
</content></xwikidoc>
\ No newline at end of file
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications