Author: ludovic
Date: 2007-09-05 03:08:57 +0200 (Wed, 05 Sep 2007)
New Revision: 4721
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/templates/changesdoc.vm
xwiki-platform/web/trunk/standard/src/main/webapp/templates/importinline.vm
Log:
XWIKI-110 Improvements of Differences. Styles.
XWIKI-1708 Add option to include version history when importing documents
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/templates/changesdoc.vm
===================================================================
--- xwiki-platform/web/trunk/standard/src/main/webapp/templates/changesdoc.vm
2007-09-05 01:08:16 UTC (rev 4720)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/templates/changesdoc.vm
2007-09-05 01:08:57 UTC (rev 4721)
@@ -1,73 +1,279 @@
-#if($xwiki.diff)
-#if(($request.xpage!="changes")&&($request.viewer!="changes"))
-<style type="text/css">
-.diffmodifiedline {
- border-left: 8px solid #888888;
- padding-left: 10px;
-}
-.diffunmodifiedline {
- border-left: 8px solid #dddddd;
- padding-left: 10px;
-}
-.diffremoveword {
- background-color: red;
- text-decoration: line-through;
-}
-.diffaddword {
- background-color: lightgreen;
-}
-</style>
+<div id="changes-title">
+<h1>$msg.get("changes.changesofpage") $doc.name $msg.get("changes.in")
$msg.get("changes.space") $doc.web</h1>
+</div>
+<div id="changes-info">
+<div id="changes-info-boxes">
+<div id="changes-info-boxes-inside">
+<div id="changes-info-box-from" class="changes-info-box">
+<div class="changes-info-title">$msg.get("changes.from")
$msg.get("changes.version") $request.rev1</div>
+<div class="changes-info-content">
+#if($origdoc)
+$msg.get("changes.editedby")
$xwiki.renderText($xwiki.getLocalUserName($newdoc.author),$doc)
+<br />
+$msg.get("changes.on") $xwiki.formatDate($origdoc.date)
#end
-<div style="width: 100%; background-color: #DDDDDD">
-<h3>$msg.get("from") $msg.get("version") $origdoc.version $msg.get("to")
$newdoc.version
-#if(($origdoc=="")||($newdoc==""))
-#if($newdoc!="")
-$msg.get("editedby")
$xwiki.renderText($xwiki.getLocalUserName($newdoc.author),$doc) $msg.get("on")
$xwiki.formatDate($newdoc.date)
+</div>
+</div>
+<div id="changes-info-box-to" class="changes-info-box">
+<div class="changes-info-title">$msg.get("changes.to")
$msg.get("changes.version") $request.rev2</div>
+<div class="changes-info-content">
+#if($newdoc)
+$msg.get("changes.editedby")
$xwiki.renderText($xwiki.getLocalUserName($newdoc.author),$doc)
+<br />
+$msg.get("changes.on") $xwiki.formatDate($newdoc.date)
#end
- ($msg.get("cannotreaddocumentversion") $newdoc.version)</h3>
</div>
-#else
-$msg.get("editedby")
$xwiki.renderText($xwiki.getLocalUserName($newdoc.author), $doc) $msg.get("on")
$xwiki.formatDate($newdoc.date)
-</h3>
</div>
-#end
+<div class="clearfloats"></div>
+</div>
+</div>
+<div class="clearfloats"></div>
+<div id="changes-info-comment">
+$msg.get("changes.comment"): #if($newdoc.comment=="")
$msg.get("changes.nocomment") #else $newdoc.comment #end
+</div>
+</div>
+<div class="clearfloats"></div>
-<ul>
+<div id="changes-metadata">
+<table class="changes-table">
+<tr class="changes-table-title">
+<th colspan="3">$msg.get("changes.metadatachanges")</th>
+</tr>
+<tr class="changes-table-title">
+<th>$msg.get("changes.property")</th><th>$msg.get("changes.version")
$request.rev1</th><th>$msg.get("changes.version") $request.rev2</th>
+</tr>
+#set($hasmetadatachanges = 0)
#foreach($item in $doc.getMetaDataDiff($origdoc, $newdoc))
+#set($hasmetadatachanges = 1)
+<tr>
#if($item.field=="author")
-<li>author: $xwiki.getLocalUserName($item.getPrevvalue()) >
$xwiki.getLocalUserName($item.getNewvalue())</li>
+<td>$msg.get("changes.metadata.author")</td><td>$xwiki.getLocalUserName($item.getPrevValue())</td><td>$xwiki.getLocalUserName($item.getNewValue())</td>
#else
-<li>
-$item.getField():
$xwiki.diff.getDifferencesAsHTML($item.getPrevValue().toString(),$item.getNewValue().toString(),
false)
-</li>
+#set($propname = $item.getField())
+<td>$msg.get("changes.metadata.${propname}")</td><td> $!item.getPrevValue()
</td><td> $!item.getNewValue() </td>
#end
+</tr>
#end
-</ul>
+#foreach($objdiffs in $doc.getObjectDiff($origdoc, $newdoc))
+#foreach($objdiff in $objdiffs)
+#if($objdiff.getClassName().equals("XWiki.ArticleClass"))
+#set($hasmetadatachanges = 1)
+#set($propname = $objdiff.getPropName())
+#if($propname!="content")
+<tr>
+<td>$msg.get("changes.blog.${propname}")</td>
+<td>
+#set($value = $objdiff.getPrevValue().toString())
+$value
+</td>
+<td>
+#set($value = $objdiff.getNewValue().toString())
+$value
+</td>
+</tr>
+#end
+#end ## end ArticleClass
+#if($objdiff.getClassName().equals("XWiki.TagClass"))
+#set($hasmetadatachanges = 1)
+#set($propname = $objdiff.getPropName())
+<tr>
+<td>$msg.get("changes.tag.${propname}")</td>
+<td>
+#set($value = $objdiff.getPrevValue().toString())
+$value
+</td>
+<td>
+#set($value = $objdiff.getNewValue().toString())
+$value
+</td>
+</tr>
+#end ## end TagClass
-<br /><br />
-#set($text1 = $origdoc.content)
-#set($text2 = $newdoc.content)
-$xwiki.diff.getDifferencesAsHTML($text1,$text2,false)
+#end
+#end
+#if($hasmetadatachanges==0)
+<tr><td colspan="3">$msg.get("changes.nometadatachanges")</td></tr>
+#end
+</table>
+</div>
-<ul>
-#foreach($item1 in $doc.getClassDiff($origdoc, $newdoc))
-#foreach($item in $$item1)
-<li>
-$item.getClassName() - $item.getPropName():
$xwiki.diff.getDifferencesAsHTML($item.getPrevValue().toString(),$item.getNewValue().toString(),false)
-</li>
+<div id="changes-content">
+#if($origdoc.get("XWiki.ArticleClass"))
+#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
-</ul>
+<table class="changes-table">
+<tr class="changes-table-title">
+<th>$msg.get("changes.contentchanges")</th>
+</tr>
+<tr>
+<td>
+#if($text1.equals($text2))
+$msg.get("changes.nocontentchanges")
+#else
+$xwiki.diff.getDifferencesAsHTML($text1, $text2 ,false)
+#end
+</td>
+</tr>
+</table>
+#else
+#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
+<table class="changes-table">
+<tr class="changes-table-title">
+<th>$msg.get("changes.contentchanges")</th>
+</tr>
+<tr>
+<td>
+#if($text1.equals($text2))
+$msg.get("changes.nocontentchanges")
+#else
+$xwiki.diff.getDifferencesAsHTML($text1, $text2 ,false)
+#end
+</td>
+</tr>
+</table>
+#end
+</div>
-<ul>
-#foreach($item1 in $doc.getObjectDiff($origdoc, $newdoc))
-#foreach($item in $$item1)
-<li>
-$item.getClassName() - $item.getPropName():
$xwiki.diff.getDifferencesAsHTML($item.getPrevValue().toString(),$item.getNewValue().toString(),false)
-</li>
+<div id="changes-attachments">
+<table class="changes-table">
+<tr class="changes-table-title">
+<th colspan="3">$msg.get("changes.attachmentchanges")</th>
+</tr>
+<tr class="changes-table-title">
+<th>$msg.get("changes.filename")</th><th>$msg.get("changes.action")</th>
+</tr>
+#set($hasattachmentchanges = 0)
+#foreach($attachChange in $doc.getAttachmentDiff($origdoc, $newdoc))
+#set($hasattachmentchanges = 1)
+<tr>
+<td>
+$attachChange.fileName
+</td>
+<td>
+#if(!$attachChange.origVersion)
+<a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.newVersion)">$msg.get("changes.attachmentadded")</a>
+#elseif(!$attachChange.newVersion)
+$msg.get("changes.attachmentdeleted")
+#else
+$msg.get("changes.attachmentupdatedfromversion") <a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.origVersion)">$attachChange.origVersion</a>
+$msg.get("changes.toversion") <a
href="$newdoc.getAttachmentRevisionURL($attachChange.fileName,$attachChange.newVersion)">$attachChange.newVersion</a>
#end
+</td>
+</tr>
#end
-</ul>
+#if($hasattachmentchanges==0)
+<tr><td colspan="3">$msg.get("changes.noattachmentchanges")</td></tr>
+#end
+</table>
+</div>
+
+<div id="changes-comments">
+<table class="changes-table">
+<tr class="changes-table-title">
+<th colspan="3">$msg.get("changes.commentchanges")</th>
+</tr>
+#set($commentchanges = 0)
+#foreach($objdiffs in $doc.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)
+<tr class="changes-table-title changes-table-comment-subtitle">
+<th>$msg.get("changes.comment.property")</th>
+<th>$msg.get("changes.comment.previousvalue")</th>
+<th>$msg.get("changes.comment.newvalue")</th>
+</tr>
+#end
+#set($propname = $objdiff.getPropName())
+<tr>
+<td>$msg.get("changes.comment.${propname}")</td>
+<td>
+#if($propname=="author")
+#set($author = $objdiff.getPrevValue().toString())
+#if($author!="")
+$xwiki.renderText($xwiki.getLocalUserName($author),$doc)
+#end
#else
-#template("changesdocold.vm")
-#end
\ No newline at end of file
+$objdiff.getPrevValue().toString()
+#end
+</td>
+<td>
+#if($propname=="author")
+#set($author = $objdiff.getNewValue().toString())
+#if($author!="")
+$xwiki.renderText($xwiki.getLocalUserName($author),$doc)
+#end
+#else
+$objdiff.getNewValue().toString()
+#end
+</td>
+</tr>
+#end
+#end
+#end
+#if($commentchanges==0)
+<tr><td colspan="3">$msg.get("changes.nocommentchanges")</td></tr>
+#end
+</table>
+</div>
+
+<div id="changes-objects">
+<table class="changes-table">
+<tr class="changes-table-title">
+<th colspan="3">$msg.get("changes.objectchanges")</th>
+</tr>
+<tr class="changes-table-title">
+<th>$msg.get("changes.property")</th><th>$msg.get("changes.version")
$request.rev1</th><th>$msg.get("changes.version") $request.rev2</th>
+</tr>
+#set($hasobjectchanges = 0)
+#foreach($objdiffs in $doc.getObjectDiff($origdoc, $newdoc))
+#foreach($objdiff in $objdiffs)
+#if((!$objdiff.getClassName().equals("XWiki.ArticleClass"))&&(!$objdiff.getClassName().equals("XWiki.TagClass"))&&(!$objdiff.getClassName().equals("XWiki.XWikiComments")))
+#set($hasobjectchanges = 1)
+#set($propname = $objdiff.getPropName())
+#if($propname!="content")
+<tr>
+<td>$propname $msg.get("changes.ofclass") $objdiff.getClassName()</td>
+<td>
+#set($value = $objdiff.getPrevValue().toString())
+$value
+</td>
+<td>
+#set($value = $objdiff.getNewValue().toString())
+$value
+</td>
+</tr>
+#end
+#end
+#end
+#end
+#if($hasobjectchanges==0)
+<tr><td colspan="3">$msg.get("changes.noobjectchanges")</td></tr>
+#end
+</table>
+</div>
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/templates/importinline.vm
===================================================================
--- xwiki-platform/web/trunk/standard/src/main/webapp/templates/importinline.vm
2007-09-05 01:08:16 UTC (rev 4720)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/templates/importinline.vm
2007-09-05 01:08:57 UTC (rev 4721)
@@ -13,14 +13,14 @@
##---------------------------------------------------------------------------
#if($request.action && $request.action=="import")
- <h3 class="heading-1-1">$msg.get("import")</h3>
+ <h3 class="heading-1-1">$msg.get("import")
#if($request.withversions=="1")$msg.get("export_addhistory")#end</h3>
#macro(showfilelist $list $text)
#if($list.size()>0)
<h4 class="heading-1-1-1">$msg.get("import_listof${text}files")</h4>
<ul>
#foreach($item in $list)
- <li>$item</li>
+ <li><a href="$xwiki.getURL($item)">$item</a></li>
#end
</ul>
#end
@@ -109,6 +109,7 @@
<span id="importDocName"></span>
<span id="importDocs" style="display: none;">
+ <div><br /><label><input type="checkbox" name="withversions"
id="withversions" value="1"/><i>$msg.get("export_addhistory")</i></label></div>
<input type="submit" value="$msg.get("import")" />
</span>
</div>
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications