Generel aktivitet
Log på
Wiki: xwiki ▼: Oversigt
»
Område: Main ▼: Oversigt
»
Side: RecentChanges
Søg
en
Sideaktiviteter:
Eksportér ▼: Eksportér som PDF Eksportér som RTF-fil Eksporter som HTML
Flere aktiviteter ▼: Udskriftsvisning Vis kode
Vores Viden » Nyt » Seneste ændringer

# Wiki-kode for Seneste ændringer

Senest ændret af Administrator den 2010/03/02 20:29
Kommentar (0) · Bilag (2) · Historik · Information
Skjul linienumre 1: {{velocity}} 2: ## 3: ## Recent changes. 4: ## 5: ## Optional parameters : 6: ## 7: ## Parameters which can be set in velocity before including this page or can be passed as HTTP parameters. 8: ## Note that HTTP parameters supercede velocity set variables. 9: ## 10: ## - rcShowMinor (String set to "true" or "false"): show minor edits. 11: ## - rcShowDiff (String set to "true" or "false"): show diff in items. 12: ## - rcShowRss (String set to "true" or "false"): show RSS at the bottom of the list. 13: ## - rcChangesNb (String set to a numerical value): number of recent changes to display. 14: ## - rcSpace (List of string[s]): restrict recent changes retrieval to pages within the given space. 15: ## - rcTag (List of string[s]): restrict recent changes retrieval to pages with the given tag. 16: ## - rcAuthor (List of string[s]): restrict recent changes retrieval to pages with the given author. 17: ## 18: ## Parameters which can be set before including this page only. 19: ## 20: ## - rcDocumentNames (Collection): The list of recentlyChanged documents, to reuse a previous search query. 21: ## 22: $xwiki.jsx.use("Main.RecentChanges")## 23: $xwiki.ssx.use("Main.RecentChanges")## 24: #set($action = "$!request.getParameter('action')") 25: ## 26: ## Start execution timer 27: ## 28: #set($execStart = $util.getDate()) 29: ## 30: ## Go to diff URL service. 31: ## 32: #if($action == "goToDiffURL") 33: #set($page = "$!request.getParameter('page')") 34: #set($author = "$!request.getParameter('author')") 35: #set($date = "$!request.getParameter('date')") 36: #set($period = $xwiki.criteriaService.getPeriodFactory().createDayPeriod($date)) 37: #set($criterion = $xwiki.criteriaService.getRevisionCriteriaFactory().createRevisionCriteria($author, $period)) 38: #if("$!request.getParameter('rcShowMinor')" == "true") 39: #set($discard = $criterion.setIncludeMinorVersions(true)) 40: #end 41: #set($diffDoc = $xwiki.getDocument($page)) 42: #set($revisions = $diffDoc.getRevisions($criterion)) 43: #set($rev1 = $listtool.get($revisions, 0)) 44: #set($revMax = $revisions.size() - 1) 45: #set($rev2 = $listtool.get($revisions, $revMax)) 46: #if($rev2 != "1.1") 47: #set($rev2 = $xwiki.getDocument($diffDoc, $rev2).getPreviousVersion()) 48: #end 49: $response.sendRedirect($diffDoc.getURL("view", "viewer=changes&rev1=${rev1}&rev2=${rev2}")) 50: #end 51: ## We have to use the HTML macro to avoid prints of multiple &nbsp on macro calls. 52: {{html}} 53: ## Manage minor edits. 54: #setVariableFromRequest($rcShowMinor "rcShowMinor" false) 55: ## Manage show diff in items. 56: #setVariableFromRequest($rcShowDiff "rcShowDiff" true) 57: ## Manage show RSS links. 58: #setVariableFromRequest($rcShowRss "rcShowRss" true) 59: ## Manage number of changes to display. 60: #setVariableFromRequest($rcChangesNb "rcChangesNb" 30) 61: ## Manage tag criterion 62: #setVariableFromRequest($rcTag "rcTag" []) 63: ## Manage space criterion 64: #setVariableFromRequest($rcSpace "rcSpace" []) 65: ## Manage author criterion 66: #setVariableFromRequest($rcAuthor "rcAuthor" []) 67: {{/html}} 68: ## 69: ## Create a string containing one or more ? given the number of values in the passed list. 70: ## 71: #macro(createQueryParameters $values $parameters) 72: #foreach($value in $values) 73: #if($parameters == "") 74: #set($parameters = "?") 75: #else 76: #set($parameters = "${parameters}, ?") 77: #end 78: #end 79: #end 80: ## 81: ## Retrieve recently changed documents. 82: ## 83: #set($criteria = $util.getHashMap()) 84: #if("$!rcDocumentNames" == "") 85: #if(!$xwiki.hasMinorEdit() || $rcShowMinor) 86: #set ($hqlQuery = "where 1=1 order by doc.date desc") 87: #else 88: #set ($hqlQuery = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and ni.id.version2=1 #if(!$isAdvancedUser)and doc.author != 'superadmin'#end group by doc.space, doc.name order by max(ni.date) desc") 89: #end 90: ## Create space criterion. 91: #if($rcSpace.size() > 0) 92: #set($spaceParameters = "") 93: #createQueryParameters($rcSpace $spaceParameters) 94: #set($discard = $criteria.put("doc.space in (${spaceParameters})", $rcSpace)) 95: #end 96: ## Create tag criterion. 97: #if("$!xwiki.getPlugin('tag')" != "" && $rcTag.size() > 0) 98: #set($docsWithTag = $util.getArrayList()) 99: #foreach($item in $rcTag) 100: #set($discard = $docsWithTag.addAll($xwiki.tag.getDocumentsWithTag($item))) 101: #end 102: #set($docsWithTagParameters = "") 103: #createQueryParameters($docsWithTag $docsWithTagParameters) 104: #set($discard = $criteria.put("doc.fullName in (${docsWithTagParameters})", $docsWithTag)) 105: #end 106: #if($rcAuthor.size() > 0) 107: #set($authorParameters = "") 108: #createQueryParameters($rcAuthor $authorParameters) 109: #set($discard = $criteria.put("doc.author in (${authorParameters})", $rcAuthor)) 110: #end 111: ## Exclude blacklisted spaces if displaying changes for a whole wiki 112: #if($rcSpace.size() == 0) 113: #set($blacklistedSpacesParameters = "") 114: #createQueryParameters($blacklistedSpaces $blacklistedSpacesParameters) 115: #set($discard = $criteria.put("doc.space not in (${blacklistedSpacesParameters})", $blacklistedSpaces)) 116: #end 117: #if($criteria.size() > 0) 118: ## If any, loop over criterias to add them to the query, then perform the query. 119: #set($values = $util.getArrayList()) 120: #foreach($criterion in $criteria.keySet()) 121: #if($criteria.get($criterion).size() > 0) 122: #set($hqlQuery = $hqlQuery.replaceAll("where", "where ${criterion} and")) 123: #set($discard = $values.addAll($criteria.get($criterion))) 124: #end 125: #end 126: #set($rcDocumentNames = $xwiki.searchDocuments($hqlQuery, $rcChangesNb, 0, $values)) 127: #else 128: ## No query criterion, perform the query as is. 129: #set($rcDocumentNames = $xwiki.searchDocuments($hqlQuery, $rcChangesNb, 0)) 130: #end 131: #end 132: ## 133: ## Prepare comments handling 134: #set($commentsOrder = false) 135: #if($xwiki.getWebPreferenceAsInt("commentsorder",1) == 0) 136: #set($commentsOrder = true) 137: #end 138: ## 139: ## Comment handling macro. 140: ## Retreive page's last comment if any and 141: ## overwrite variables if this comment is the last modification on the page. 142: ## 143: #macro(handleComment $rcDoc $rcType $rcDt $commentsOrder) 144: ## Retrieve comments from last to first. 145: #set($rcComments = $rcDoc.getComments($commentsOrder)) 146: #if($rcComments.size() > 0) 147: ## Retrieve last comment. 148: #set($lastComment = $listtool.get($rcComments, 0)) 149: #set($lastCommentDate = $lastComment.getProperty("date").getValue()) 150: ## If the last modification on the page is the comment, overwrite values. 151: ## We don't test compareTo() == 0 since the comment date and the save date may vary a little bit. 152: #if($lastCommentDate.compareTo($rcDt.toDate()) > -1 && $lastCommentDate.compareTo($rcDt.toDate()) <= 1) 153: #set($rcType = "comment") 154: #end 155: #end 156: #end 157: ## 158: ## Attachments handling macro. 159: ## Retrieve page's attachments and put those which upload matches the modification entry (author and timeframe) 160: ## in the $rcAttachments List. 161: ## 162: #macro(handleAttachments $rcDoc $rcAuthor $rcDt) 163: #set($attachments = $rcDoc.getAttachmentList()) 164: #foreach($attachment in $attachments) 165: #set($attachmentDt = $xwiki.jodatime.getDateTime($attachment.getDate().getTime())) 166: #if($rcAuthor == $attachment.getAuthor() && $rcDt.getYear() == $attachmentDt.getYear() && $rcDt.getDayOfYear() == $attachmentDt.getDayOfYear()) 167: #set($discard = $rcAttachments.add($attachment)) 168: #end 169: #end 170: #end 171: ## 172: ## 173: ## 174: #macro(displayRcAuthor $author) 175: #useravatar($author) 176: <br/><span class="recentChangesAuthor"> 177: #if($author == "XWikiGuest") 178: Guest 179: #else 180: #set($userName = $xwiki.getUserName($author)) 181: #if($userName == "") 182: ## userName can be empty when the page has been saved without specifying the author. 183: ## We're printing a non-breaking space to ensure xhtml validity (ie: avoid empty paragraph). 184: &nbsp; 185: #else 186: $userName 187: #end 188: #end 189: </span> 190: #end 191: #macro(displayRcVersion $version) 192: #if($version == "1.1") 193: <span class="rcVersion">(<span class="newVersion">$msg.get("xe.recentchanges.entry.new")</span>)</span> 194: #end 195: #end 196: ## 197: ## Display the recent changes list. 198: ## 199: #set($previousDt = $xwiki.jodatime.getDateTime(0)) 200: #set($discard = $previousDate.setTime(0)) 201: #set($previousAuthor = "") 202: ## Get this very doc, useful when it is included from another one. 203: #set($recentChangesDoc = $xwiki.getDocument("Main.RecentChanges")) 204: {{html clean="false"}} 205: <table class="recentChanges" summary="$msg.get('xe.recentchanges.summary')"> 206: <tr class="recentChangesHeader"><th scope="col">$msg.get("xe.recentchanges.column.authoranddate")</th><th scope="col">$msg.get("xe.recentchanges.column.changes")</th></tr> 207: #foreach ($rcDocName in $rcDocumentNames) 208: #set($row = "") 209: #set($rcAttachments = $util.arrayList) 210: ## Verify user access level on the document 211: #if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${rcDocName}")) 212: #set($rcDoc = $xwiki.getDocument($rcDocName)) 213: #set($rcType = "page") 214: #set($rcAuthor = $rcDoc.getAuthor()) ## TODO : check comments 215: #set($rcDt = $xwiki.jodatime.getDateTime($rcDoc.getDate().getTime())) 216: ## The handleComment macro overwrites rcType variable if the last modification is a comment. 217: #handleComment($rcDoc $rcType $rcDt $commentsOrder) 218: ## The handleAttachments macro put a list of attachments uploaded during the day by the author in $rcAttachments. 219: #handleAttachments($rcDoc $rcAuthor $rcDt) 220: #if($rcAuthor == $previousAuthor && $rcDt.getYear() == $previousDt.getYear() && $rcDt.getDayOfYear() == $previousDt.getDayOfYear()) 221: ## Same day and author, continue in the same row. 222: #else 223: ## Different day or author, end previous row and start a new one. 224: #if($velocityCount > 1)</ul></td></tr>#end ## close previous row if needed 225: <tr><td class="recentChangesLeft">#displayRcAuthor($rcAuthor)<br/> 226: <span class="recentChangesDate">$xwiki.formatDate($rcDt.toDate(), "MMMM d")</span></td> 227: <td class="recentChangesRight"><ul class="xlist"> ## open next cell 228: #end 229: ## Compute a GUID for this modification with page name, modification date and author. 230: #set($modGUID = "${rcDoc.fullName}_${xwiki.formatDate($rcDt.toDate(), 'yyyyMMdd')}_${rcAuthor}") 231: ## Build the URL used to retreive the diff viewer URL 232: #set($goToDiffURL = $recentChangesDoc.getURL("view", "xpage=plain&amp;action=goToDiffURL&amp;page=${rcDoc.getFullName()}&amp;author=${rcAuthor}&amp;date=${xwiki.formatDate($rcDt.toDate(), 'yyyyMMdd')}&amp;rcShowMinor=${rcShowMinor}")) 233: <li class="xitem xunderline xhighlight ${rcType}"> 234: <div class="xitemcontainer"> 235: #if($rcType == "comment") 236: <div class="modifiedPage"><a href="$rcDoc.getURL()" title="$msg.get("xe.recentchanges.entry.comment.tooltip", [$xwiki.formatDate($rcDt.toDate(), "HH:mm")]) ">$xwiki.getXMLEncoded($rcDoc.getDisplayTitle())</a></div> 237: #if($rcShowDiff) 238: <div class="xshowonhover modifiedPageActions"><a class="ajax" href="$rcDoc.getURL("vire", "viewer=comments")" onclick="toggleClass(document.getElementById('$modGUID'), 'hidden'); toggleClass(document.getElementById('${modGUID}_comShow'), 'hidden'); toggleClass(document.getElementById('${modGUID}_comHide'), 'hidden'); return false;"><span id="${modGUID}_comShow">&#91;+&#93; $msg.get("xe.recentchanges.entry.comment.show")</span><span id="${modGUID}_comHide" class="hidden">&#91;-&#93; $msg.get("xe.recentchanges.entry.comment.hide")</span> $msg.get("xe.recentchanges.entry.comment")</a></div> 239: <div class="commentContainer hidden" id="$modGUID"> 240: <div class="commentQuote lQuo">&nbsp;</div> 241: <div class="commentQuote rQuo">&nbsp;</div> 242: <div class="comment"> 243: {{/html}} 244: $lastComment.get("comment") 245: {{html clean="false"}} 246: </div> 247: ## Display discussion link, this link point to the comments anchor. 248: <div class="commentAdd"><img src="$xwiki.getSkinFile("icons/silk/comment.gif")" alt="Reply icon" /> <a href="${rcDoc.getURL("view")}#Comments">$msg.get("xe.recentchanges.entry.comment.seediscussion")</a></div> 249: </div> 250: #end 251: #else 252: <div class="modifiedPage"><a href="$rcDoc.getURL()" title="$msg.get("xe.recentchanges.entry.page.tooltip", [$rcDoc.getVersion(), $xwiki.formatDate($rcDt.toDate())])">$xwiki.getXMLEncoded($rcDoc.getDisplayTitle())</a> #displayRcVersion($rcDoc.getVersion())</div> 253: #if($rcShowDiff) 254: <div class="xshowonhover modifiedPageActions"><a href="$goToDiffURL" title="$msg.get('xe.recentchanges.entry.page.seemodifications.title', [$rcDoc.fullName])">$msg.get("xe.recentchanges.entry.page.seemodifications")</a></div> 255: ## If the author has uploaded attachments during the day in this page, display them. 256: #if($rcAttachments.size() > 0) 257: <div class="attachmentContainer" id="$modGUID"> 258: <ul> 259: #foreach($rcAttachment in $rcAttachments) 260: <li class="attachment"><a href="$rcDoc.getAttachmentURL($rcAttachment.filename)">$rcAttachment.filename</a> #displayRcVersion($rcAttachment.getVersion())</li> 261: #end 262: </ul> 263: </div> 264: #end 265: #end 266: #end 267: <div class="xspacer">&nbsp;</div> 268: </div> 269: </li> 270: #end 271: #set($previousAuthor = $rcAuthor) 272: #set($previousDt = $rcDt) 273: #end 274: ## Close last row if any. 275: #if($rcDocumentNames.size() > 1)</ul></td></tr>#end 276: </table> 277: {{/html}} 278: ## 279: ## Rebuild URL query string 280: ## Workaround until we fix $request.getQueryString() 281: ## 282: #set($queryString = "") 283: #set($paramMap = $request.getParameterMap()) 284: #foreach($key in $paramMap.keySet()) 285: #foreach($value in $paramMap.get($key)) 286: #set($queryString = "${queryString}&amp;${key}=${value}") 287: #end 288: #end 289: ## 290: ## Provide links to display minor edits and RSS feed. 291: ## 292: #if($xwiki.hasMinorEdit()) 293: {{html}} 294: <p class="recentChangesMoreActions"> 295: #if($rcShowMinor) 296: <a href="$xwiki.getURL($tdoc.getFullName(), "view", $queryString.replaceAll('rcShowMinor=true', ''))"><img src="$xwiki.getSkinFile("icons/silk/zoom_out.gif")" alt="Hide minor icon"/>$msg.get("xe.recentchanges.hideminor")</a> 297: #else 298: <a href="$xwiki.getURL($tdoc.getFullName(), "view", "${queryString}&amp;rcShowMinor=true")"><img src="$xwiki.getSkinFile("icons/silk/zoom_in.gif")" alt="Show minor icon"/>$msg.get("xe.recentchanges.showminor")</a> 299: #end 300: #if($rcShowRss) 301: #set($rssURL = "") 302: #set($parameters = 'xpage=plain&amp;outputSyntax=plain') 303: #if($rcTag.size() > 0) 304: #set($parameters = "${parameters}&amp;tag=$listtool.get($rcTag, 0)") 305: #end 306: #if($rcSpace.size() > 0) 307: #set($parameters = "${parameters}&amp;space=$listtool.get($rcSpace, 0)") 308: #end 309: #set($rssURL = $xwiki.getURL('Main.WebRss', 'view', $parameters)) 310: <a href="${rssURL}"><img src="$xwiki.getSkinFile("icons/silk/feed.gif")" alt="RSS icon"/>$msg.get("xe.recentchanges.rssfeed")</a> 311: #end 312: </p> 313: {{/html}} 314: #end 315: {{/velocity}}

# Mine seneste ændringer

replaceAll('([|]|\

# Navigering

# Main

- Activity
- ApplicationResources_da
- Dashboard
- Dashboard
- Filarkiv
- Filarkiv
- Generelle informationer
- Kafka ELK
- MessageSenderMacro
- Prisliste for Print
- RecentChanges
- RecentMembers
- RssFeeds
- Spaces
- Syntaks
- Tags
- WebHome
- WebHome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- Welcome
- WhatsNew

# Samfundet

- Dokumentation
- WebHome

Vicky er et privat, ophavsbeskyttet område. Kopiering uden skriftlig tilladelse er forbudt.
Drevet af XWiki Enterprise 5.0.1 - Xwiki Dokumentation