Toggle navigation
Log-in
Languages
English
Wiki Index
Page Index
User Index
Home
Timeline
Wiki source code of
Timeline
Last modified by
Ricardo Rodríguez Fernández
on 2015/09/03 09:22
Export
Print preview
View Source
Siblings
Content
Comments (7)
Attachments
History
Information
×
Export
Export as PDF
Export as HTML
Cancel
Hide line numbers
1: {{velocity}} 2: #set($void = $xwiki.ssx.use('Home.WebHome', {'sourceAction' : $xcontext.action})) 3: {{/velocity}} 4: 5: {{groovy}} 6: xcontext.put("sTimezone", java.util.TimeZone.getTimeZone("GMT")) 7: {{/groovy}} 8: 9: {{velocity}} 10: #set($sLocale = $datetool.getLocale()) 11: #set($changesNb="200") 12: #if("$!request.changesNb" != "") 13: #set($changesNb=$request.changesNb) 14: #end 15: #if("$!request.action" == "xml") 16: $response.setContentType('text/xml') 17: <?xml version="1.0" encoding="$xwiki.encoding"?> 18: <data> 19: #set($hqlQuery = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and ni.author <> 'XWiki.Admin' and ni.author <> 'superadmin' group by doc.space, doc.name order by max(ni.date) desc") 20: #set($recentlyChangedDocuments = $services.query.hql($hqlQuery).setLimit($changesNb).execute()) 21: #set($openLi = $escapetool.xml("<li>")) 22: #set($closeLi = $escapetool.xml("</li>")) 23: #foreach($rcName in $recentlyChangedDocuments) 24: #set($rcDoc = $xwiki.getDocument($rcName)) 25: #if("$!rcDoc" != "") 26: #set($rcUrl = $rcDoc.getURL('view')) 27: #set($date = $datetool.format('d MMM yyyy hh:mm:ss z', $rcDoc.date, $sLocale, $xcontext.sTimezone)) 28: <event start="$date" end="$date" isDuration="false" title="$escapetool.xml($rcDoc.getDisplayTitle())"> 29: $escapetool.xml("<ul>") 30: ${openLi}Last modification: $xwiki.formatDate($rcDoc.date, "MMMM dd, hh:mm")${closeLi} 31: ${openLi}Author: $xwiki.getLocalUserName($rcDoc.author, false)${closeLi} 32: ${openLi}Goto $escapetool.xml("<a href='$rcUrl'>$rcDoc.getDisplayTitle()</a>")${closeLi} 33: $escapetool.xml("</ul>") 34: </event> 35: #end 36: #end 37: </data> 38: #else 39: {{html}} 40: <div id="wiki-timeline" style="height: 500px; border: 1px solid #aaa"></div> 41: <script type="text/javascript"> 42: var tl; 43: function onLoad() { 44: var today = new Date(); 45: var eventSource = new Timeline.DefaultEventSource(); 46: var bandInfos = [ 47: Timeline.createBandInfo({ 48: timeZone: -2, 49: eventSource: eventSource, 50: date: today.toUTCString(), 51: width: "75%", 52: intervalUnit: Timeline.DateTime.DAY, 53: intervalPixels: 100 54: }), 55: Timeline.createBandInfo({ 56: timeZone: -2, 57: eventSource: eventSource, 58: showEventText: false, 59: trackHeight: 0.5, 60: trackGap: 0.2, 61: date: today.toUTCString(), 62: width: "25%", 63: intervalUnit: Timeline.DateTime.MONTH, 64: intervalPixels: 200 65: }) 66: ]; 67: bandInfos[1].syncWith = 0; 68: bandInfos[1].highlight = true; 69: bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout()); 70: 71: tl = Timeline.create(document.getElementById("wiki-timeline"), bandInfos); 72: Timeline.loadXML("$doc.getURL("view", "action=xml&xpage=plain&outputSyntax=plain&changesNb=${changesNb}")", function(xml, url) { eventSource.loadXML(xml, url); }); 73: } 74: 75: var resizeTimerID = null; 76: function onResize() { 77: if (resizeTimerID == null) { 78: resizeTimerID = window.setTimeout(function() { 79: resizeTimerID = null; 80: tl.layout(); 81: }, 500); 82: } 83: } 84: Event.observe(window, "load", onLoad); 85: Event.observe($('wiki-timeline'), "resize", onResize); 86: </script> 87: {{/html}} 88: #end 89: {{/velocity}}
Applications
Blog
Dashboard
User Index
More applications
Quick Links
Sandbox