Author: jvdrean Date: 2007-10-23 16:11:24 +0200 (Tue, 23 Oct 2007) New Revision: 5462
Added: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watch.vm xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlist.vm xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlistrss.vm Modified: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/menuview.vm Log: XWIKXWIKI-1824 : Add watchlist features in the view menu XWIKI-268 : Notification by email when documents are updated Modified: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/menuview.vm =================================================================== --- xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/menuview.vm 2007-10-23 14:11:04 UTC (rev 5461) +++ xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/menuview.vm 2007-10-23 14:11:24 UTC (rev 5462) @@ -3,6 +3,7 @@ <h3 id="xwikimenutitle" class="hidden">$msg.get("menu")</h3> <div class="rightmenu"><a id="tmDoc" href='http://www.xwiki.org/xwiki/bin/view/Main/Documentation' onclick="openURL('http://www.xwiki.org/xwiki/bin/view/Main/Documentation', '_blank'); return false;"><strong>$msg.get("core.menu.documentation")</strong></a></div> <div class="leftmenu"> + ## ## Edit mode ## @@ -32,64 +33,107 @@ ## #if($isAdvancedUser) #xwikitopmenuentrystart($doc.getURL($editaction, $languageparams) $msg.get("core.menu.edit") "tmEdit") +<a style="display:none;" href="$doc.getURL($editaction, $languageparams)" accesskey="e">edit</a> #submenuitem($doc.getURL("edit", "${languageparams}&editor=wiki") $msg.get("core.menu.edit.wiki")) #submenuitem($doc.getURL("edit", "$languageparams&editor=wysiwyg") $msg.get("core.menu.edit.visual")) #submenuitem($doc.getURL("inline", "$languageparams") $msg.get("core.menu.edit.form")) +#submenuseparator() +#submenuitem($doc.getURL("edit", "editor=rights") $msg.get("core.menu.rights")) +#submenuseparator() #submenuitem($doc.getURL("edit", "editor=object") $msg.get("core.menu.edit.object")) #if($hasadmin) #submenuitem($doc.getURL("edit", "editor=class") $msg.get("core.menu.edit.class")) -#submenuitem($doc.getURL("edit", "editor=rights") $msg.get("core.menu.edit.rights")) #end #xwikitopmenuentryend() #else ## !isAdvanced #xwikitopmenuentry($doc.getURL($editaction, $languageparams) $msg.get("core.menu.edit") "tmEdit") #end -#end +#end + ## ## Show menu ## #if(!$doc.isNew()) #xwikitopmenuentrystart($doc.getURL("view", "viewer=code&$docvariant") $msg.get("core.menu.view") "tmShow") +#submenuitem($doc.getURL("view", "viewer=comments&$docvariant") $msg.get("core.menu.view.comments")) +#submenuitem($doc.getURL("view", "viewer=attachments&$docvariant") $msg.get("core.menu.view.attachments")) +#submenuitem($doc.getURL("view", "viewer=history&$docvariant") $msg.get("core.menu.view.history")) #if($isAdvancedUser) #submenuitem($doc.getURL("view", "viewer=code&$docvariant") $msg.get("core.menu.view.code")) -## #submenuitem($doc.getURL("view", "xpage=xml&$docvariant") $msg.get("core.menu.view.xml")) -## #submenuitem($doc.getURL("view", "viewer=attributes&$docvariant") $msg.get("core.menu.view.attributes")) #end -#submenuitem($doc.getURL("view", "viewer=comments&$docvariant") $msg.get("core.menu.view.comments")) -#submenuitem($doc.getURL("view", "viewer=attachments&$docvariant") $msg.get("core.menu.view.attachments")) -#submenuitem($doc.getURL("view", "viewer=history&$docvariant") $msg.get("core.menu.view.history")) #xwikitopmenuentryend() -#end ## isNew +#end ## isNew + ## ## Print menu ## -#if(!$doc.isNew()) -#xwikitopmenuentrystart($doc.getURL("view", "xpage=print&$docvariant") $msg.get("print") "tmPrint") -#submenuitem($doc.getURL("view", "xpage=print&$docvariant") $msg.get("preview")) -#submenuitem($doc.getURL("export", "format=pdf&$docvariant") $msg.get("pdf")) -#submenuitem($doc.getURL("export", "format=rtf&$docvariant") $msg.get("rtf")) -#xwikitopmenuentryend() -#end ## isNew +#xwikitopmenuentrystart("javascript:window.print()" $msg.get("core.menu.print") "tmPrint") +#submenuitem("javascript:window.print()" $msg.get("core.menu.print")) +#submenuitem($doc.getURL("view", "xpage=print&$docvariant") $msg.get("core.menu.preview")) +#submenuseparator() +#submenuitem($doc.getURL("export", "format=pdf&$docvariant") $msg.get("core.menu.export.pdf")) +#submenuitem($doc.getURL("export", "format=rtf&$docvariant") $msg.get("core.menu.export.rtf")) +#xwikitopmenuentryend() + ## -## Watch menu +## Actions menu ## -## TODO: Write me! +#xwikitopmenuentrystart("" $msg.get("core.menu.actions") "tmFile") +#submenuitem($doc.getURL("delete", $languageparams) $msg.get("core.menu.delete")) +#submenuitem($doc.getURL("view", "xpage=rename&step=1") $msg.get("core.menu.rename")) +#xwikitopmenuentryend() + ## -## #if($context.user != "XWiki.XWikiGuest") -## #xwikitopmenuentry($doc.getURL("watch", "xredirect=${request.getRequestURL()}") $msg.get("core.menu.watch") "tmWatch") -## #end +## Watch menu ## -## Delete menu -## -#if((!$doc.isNew()) && $xwiki.checkAccess($doc.fullName, "delete")) -#xwikitopmenuentry($doc.getURL("delete", $languageparams) $msg.get("core.menu.delete") "tmDelete") +#if ($xwiki.watchlist && $context.user != "XWiki.XWikiGuest" && !$doc.isNew()) +<script type="text/javascript"> +function reloadActionMenu() +{ + var id = 'menuview'; + var surl = '$doc.getURL("view", "xpage=xpart&vm=menuview.vm")'; + var myAjax = new Ajax.Updater( + id, + surl, + { + method: 'get', + evalScripts: true, + onComplete: function() {} + }); +} +function watchlist(action) +{ + var surl = '$doc.getURL("view", "xpage=watch&do=")' + action; + var myAjax = new Ajax.Request( + surl, + { + method: 'get', + onComplete: reloadActionMenu() + }); +} +</script> +#set ($isWatchedDoc = $xwiki.watchlist.isWatchedDocument()) +#set ($isWatchedSpace = $xwiki.watchlist.isWatchedSpace()) +#if ($isWatchedDoc || $isWatchedSpace) + #xwikitopmenuentrystart("javascript:watchlist('removedocument')" $msg.get("core.menu.watch") "tmWatched") +#else + #xwikitopmenuentrystart("javascript:watchlist('adddocument')" $msg.get("core.menu.watch") "tmWatch") #end -## -## Rename menu -## -#if((!$doc.isNew()) && $hasedit) -#xwikitopmenuentry($doc.getURL("view", "xpage=rename&step=1") $msg.get("core.menu.rename") "tmRename") +#if (!$isWatchedDoc) + #submenuitem("javascript:watchlist('adddocument')" $msg.get("core.menu.watchlist.add.page")) +#else + #submenuitem("javascript:watchlist('removedocument')" $msg.get("core.menu.watchlist.remove.page")) +#end +#submenuseparator() +#if (!$isWatchedSpace) + #submenuitem("javascript:watchlist('addspace')" $msg.get("core.menu.watchlist.add.space")) +#else + #submenuitem("javascript:watchlist('removespace')" $msg.get("core.menu.watchlist.remove.space")) #end +#submenuseparator() +#submenuitem($docuser.getURL("view", "xpage=watchlist") $msg.get("core.menu.watchlist.management")) +#xwikitopmenuentryend() +#end </div> </div> #end \ No newline at end of file Added: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watch.vm =================================================================== --- xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watch.vm (rev 0) +++ xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watch.vm 2007-10-23 14:11:24 UTC (rev 5462) @@ -0,0 +1,10 @@ +#set ($do=$request.do) +#if ($do == "adddocument") + $xwiki.watchlist.addDocument($doc.fullName) +#elseif ($do == "removedocument") + $xwiki.watchlist.removeDocument($doc.fullName) +#elseif ($do == "addspace") + $xwiki.watchlist.addSpace($doc.web) +#elseif ($do == "removespace") + $xwiki.watchlist.removeSpace($doc.web) +#end Added: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlist.vm =================================================================== --- xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlist.vm (rev 0) +++ xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlist.vm 2007-10-23 14:11:24 UTC (rev 5462) @@ -0,0 +1,137 @@ +### +### User's watchlist +### +### +#template("startpage.vm") +<div class="minwidthb"></div> +<div class="main layoutsubsection"> +<h5 class="heading-1">$msg.get("watchlist.title", [$xwiki.getUserName($doc.fullName, false)])</h5> +#if($doc.getObject("XWikiUsers", 0)) +#set($i = $context.user.indexOf(":")+1) +#set($isMyProfile = $context.user.substring($i) == $doc.fullName) +#if ($isMyProfile || $hasadmin) +#if ($request.removedocument || $request.removespace) + #set ($el = "") + #if ($isMyProfile) + #if ($request.removedocument) + #set ($el = $request.removedocument) + #set ($ret = $xwiki.watchlist.removeDocument($request.removedocument)) + #else + #set ($el = $request.removespace) + #set ($ret = $xwiki.watchlist.removeSpace($request.removespace)) + #end + #else + #if ($request.removedocument) + #set ($el = $request.removedocument) + #set ($ret = $xwiki.watchlist.removeDocumentForUser($doc.fullName, $request.removedocument)) + #else + #set ($el = $request.removespace) + #set ($ret = $xwiki.watchlist.removeSpaceForUser($doc.fullName, $request.removespace)) + #end + #end + #if ($ret == true) + #info($msg.get("watchlist.delete.ok", "$el")) + #else + #error($msg.get("watchlist.delete.ko", "$el")) + #end +#elseif ($request.removespace) +#end + ## + ## Info + ## + <h2 class="heading-1-1">$msg.get("watchlist.staytuned")</h2> + ## + ## Notifications + ## + <div class="padded"> + <div style="width:48%;float:left;"> + <h5 class="heading-1-1-1">$msg.get("watchlist.staytuned.email")</h5> + $msg.get("watchlist.staytuned.email.info")<br/> + <br/> + <form action="$doc.getURL("save")" method="post"> + $msg.get("watchlist.staytuned.email.frequency") : + #set ($iVal = $doc.display("interval", "view")) + #set ($sel = "selected=\"selected\"") + <select size="1" name="XWiki.WatchListClass_0_interval" id="XWiki.WatchListClass_0_interval"> + <option label="never" value="0" #if ($iVal == "never") $sel #end>never</option> + <option label="hourly" value="1" #if ($iVal == "hourly") $sel #end>hourly</option> + <option label="daily" value="2" #if ($iVal == "daily") $sel #end>daily</option> + <option label="weekly" value="3" #if ($iVal == "weekly") $sel #end>weekly</option> + <option label="monthly" value="4" #if ($iVal == "monthly") $sel #end>monthly</option> + </select> + <input type="hidden" name="xredirect" id="xredirect" value="$doc.getURL("view", "xpage=watchlist")"> + <input type="submit" value="$msg.get("watchlist.staytuned.email.frequency.save")" class="button"/> + </div> + </form> + <div style="width:48%;float:right;"> + <h5 class="heading-1-1-1">$msg.get("watchlist.staytuned.rss")</h5> + <a target="_blank" href="$doc.getURL("view", "xpage=watchlistrss")" style="padding-left:16px;background:url($xwiki.getSkinFile("icons/black-rss-mini2.png")) left no-repeat;font-weight:bold;">$msg.get("watchlist.staytuned.rss.info")</a><br/> + <br/> + </div> + <div style="clear:both;"></div> + </div> + ## + ## Watched elements + ## + <div class="padded"> + ## + ## Pages + ## + <h5 class="heading-1-1">$msg.get("watchlist.elements")</h5> + <h5 class="heading-1-1-1">$msg.get("watchlist.pages")</h5> + <table id="searchTable" class="grid sortable filterable doOddEven"> + <tr class="sortHeader"> + <th>$msg.get("watchlist.page")</th> + <th style="width:140px" class="selectFilter">$msg.get("watchlist.space")</th> + <th style="width:180px" class="unsortable noFilter">$msg.get("watchlist.actions")</th> + </tr> + #set ($wlist = $xwiki.watchlist.getWatchedDocuments()) + #foreach($item in $wlist) + #if ($item != "") + <tr> + #set ($idoc = $xwiki.getDocument($item)) + #if (!$idoc.isNew()) + <td><a href="$idoc.getURL()">$idoc.getDisplayTitle()</a></td> + <td>$idoc.web</td> + <td><a href="$doc.getURL("view", "xpage=watchlist&removedocument=${item}")" title="$msg.get("watchlist.delete.tooltip")">$msg.get("watchlist.delete")</a></td> + #else + #if ($isMyProfile) + #set ($ret = $xwiki.watchlist.removeDocument($item)) + #else + #set ($ret = $xwiki.watchlist.removeDocumentForUser($doc.fullName, $item)) + #end + #end + </tr> + #end + #end + </table> + ## + ## Spaces + ## + <h5 class="heading-1-1-1">$msg.get("watchlist.spaces")</h5> + <table id="searchTable" class="grid sortable doOddEven"> + <tr class=""> + <th>$msg.get("watchlist.space")</th> + <th style="width:180px">$msg.get("watchlist.actions")</th> + </tr> + #set ($wlist = $xwiki.watchlist.getWatchedSpaces()) + #foreach($item in $wlist) + #if ($item != "") + <tr> + <td>$item</td> + <td><a href="$doc.getURL("view", "xpage=watchlist&removespace=${item}")" title="$msg.get("watchlist.delete.tooltip")">$msg.get("watchlist.delete")</a></td> + </tr> + #end + #end + </table> + </div> +#else +#xwikimessageboxstart($msg.get("error") $msg.get("notallowed")) +#xwikimessageboxend() +#end +#else +#xwikimessageboxstart($msg.get("watchlist") $msg.get("notauser")) +#xwikimessageboxend() +#end +</div> +#template("endpage.vm") \ No newline at end of file Added: xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlistrss.vm =================================================================== --- xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlistrss.vm (rev 0) +++ xwiki-platform/web/trunk/standard/src/main/webapp/skins/albatross/watchlistrss.vm 2007-10-23 14:11:24 UTC (rev 5462) @@ -0,0 +1,7 @@ +#set ($baseurl = "$xwiki.getLocalUserName($doc.fullName, false)'s WatchList on http://${request.serverName}") +#set ($description = "RSS feed for $xwiki.getLocalUserName($doc.fullName, false)'s WatchList") +#set($t1 = $xwiki.date.time) +#set ($list = $xwiki.watchlist.getWatchListWhatsNew($doc.fullName)) +#set($t2 = $xwiki.date.time) +<!-- generation time : $xwiki.add("${t2}", "-${t1}")ms --> +$xwiki.includeForm("XWiki.WebRssCode", false) _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications