Changes for page WatchListMacro
Last modified by superadmin on 2017/11/28 14:52
From empty
To version 1.1
edited by superadmin
on 2017/11/28 14:52
on 2017/11/28 14:52
Change comment: Install extension [org.xwiki.platform:xwiki-platform-watchlist-ui/9.9]
Summary
-
Page properties (5 modified, 0 added, 0 removed)
-
Objects (0 modified, 2 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +WatchListMacro - Parent
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.WatchListClass - Author
-
... ... @@ -1,1 +1,1 @@ 1 - XWiki.XWikiGuest1 +xwiki:XWiki.superadmin - Hidden
-
... ... @@ -1,1 +1,1 @@ 1 - false1 +true - Content
-
... ... @@ -1,0 +1,1 @@ 1 +{{watchlist /}}
- XWiki.StyleSheetExtension[0]
-
- Caching policy
-
... ... @@ -1,0 +1,1 @@ 1 +long - Code
-
... ... @@ -1,0 +1,21 @@ 1 +.watchlistContainer { 2 + overflow-x: auto; 3 +} 4 + 5 +span.wikiWatchlistType, span.spaceWatchlistType, span.documentWatchlistType { 6 + width: 16px; 7 + height: 16px; 8 + display: block; 9 +} 10 + 11 +span.wikiWatchlistType { 12 + background: url("$xwiki.getSkinFile('icons/silk/world.png')") no-repeat; 13 +} 14 + 15 +span.spaceWatchlistType { 16 + background: url("$xwiki.getSkinFile('icons/silk/sitemap.png')") no-repeat; 17 +} 18 + 19 +span.documentWatchlistType { 20 + background: url("$xwiki.getSkinFile('icons/silk/page_white_text.png')") no-repeat; 21 +} - Content Type
-
... ... @@ -1,0 +1,1 @@ 1 +CSS - Name
-
... ... @@ -1,0 +1,1 @@ 1 +watch list styles - Parse content
-
... ... @@ -1,0 +1,1 @@ 1 +Yes - Use this extension
-
... ... @@ -1,0 +1,1 @@ 1 +onDemand
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,0 +1,73 @@ 1 +{{velocity html="true"}} 2 +#if (!$isGuest) 3 +$xwiki.ssx.use("XWiki.WatchListMacro") 4 +{{html wiki="true"}} 5 +<div class="watchlistContainer"> 6 + #set($collist = ['type', 'location', 'scope', 'actions']) 7 + #set($colprops = { 8 + "type": { "sortable":false }, 9 + "location": { "sortable":false }, 10 + "scope": { "sortable":false }, 11 + "actions": { "sortable":false } 12 + }) 13 + #set($options = { "resultPage" : "XWiki.XWikiUserWatchListLiveTableResults", 14 + "rowCount": 10, 15 + "description": "This table lists all watched elements.", 16 + "translationPrefix": "watchlist.table.", 17 + "callback": "function (row, i, table) { 18 + var tr = new Element('tr'); 19 + var typeIcon = ''; 20 + var scope = ''; 21 + if (row.type == 'document') { 22 + typeIcon = '$escapetool.javascript($services.icon.renderHTML('page'))'; 23 + scope = '$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.scope.pageonly')))'; 24 + } else if (row.type == 'space') { 25 + typeIcon = '$escapetool.javascript($services.icon.renderHTML('chart-organisation'))'; 26 + scope = '$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.scope.pageandchildren')))'; 27 + } else if (row.type == 'wiki') { 28 + typeIcon = '$escapetool.javascript($services.icon.renderHTML('wiki'))'; 29 + scope = '$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.scope.wiki')))'; 30 + } 31 + tr.insert(new Element('td', {'data-title':'$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.type')))'}).update(typeIcon)); 32 + tr.insert(new Element('td', {'data-title':'$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.location')))'}).update(row.location)); 33 + tr.insert(new Element('td', {'data-title':'$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.scope')))'}).update(scope)); 34 + var deleteLink = new Element('a', { 35 + href : row.deleteUrl, 36 + title : '$escapetool.javascript($services.localization.render('platform.core.profile.watchlist.unwatch'))' 37 + }); 38 + deleteLink.insert(new Element('img', { 39 + 'src' : '${xwiki.getSkinFile('icons/silk/cross.png')}' 40 + })); 41 + deleteLink.observe('click', function(event) { 42 + Event.stop(event); 43 + if (row.deleteUrl.indexOf('/') == 0) { 44 + // DeleteURL is from the same domain 45 + var surl = row.deleteUrl; 46 + var myAjax = new Ajax.Request( 47 + surl, 48 + { 49 + method: 'get', 50 + onComplete: function(transport) { 51 + this.clearCache(); 52 + this.showRows(this.currentOffset, this.limit); 53 + }.bind(this) 54 + } 55 + ); 56 + } else { 57 + // DeleteURL is from another domain, which prevents an AJAX request to be used here. We make a browser request and use xredirect to come back to the current page. 58 + var separator = (row.deleteUrl.indexOf('?') == -1) ? '?' : '&'; 59 + window.location = row.deleteUrl + separator + 'xredirect=' + window.location; 60 + } 61 + }.bind(this)); 62 + tr.insert(new Element('td', {'data-title':'$escapetool.javascript($escapetool.xml($services.localization.render('watchlist.table.actions')))'}).insert(deleteLink)); 63 + return tr; 64 + }" }) 65 + 66 + #set($watchlistCtr = $request.getAttribute('XWiki.WatchListMacro:counter')) 67 + #if(!$watchlistCtr) #set($watchlistCtr = 0) #else #set($watchlistCtr = $watchlistCtr + 1) #end 68 + #set($discard = $request.setAttribute('XWiki.WatchListMacro:counter', $watchlistCtr)) 69 + #livetable("mywatchlist-$watchlistCtr" $collist $colprops $options) 70 +</div> 71 +{{/html}} 72 +#end 73 +{{/velocity}} - Macro content type
-
... ... @@ -1,0 +1,1 @@ 1 +No content - Default category
-
... ... @@ -1,0 +1,1 @@ 1 +Content - Macro description
-
... ... @@ -1,0 +1,1 @@ 1 +Show the content of your current watchlist. - Macro id
-
... ... @@ -1,0 +1,1 @@ 1 +watchlist - Macro name
-
... ... @@ -1,0 +1,1 @@ 1 +Watchlist - Supports inline mode
-
... ... @@ -1,0 +1,1 @@ 1 +No - Macro visibility
-
... ... @@ -1,0 +1,1 @@ 1 +Current Wiki