Wiki source code of Download Version

Last modified by Eduard Moraru on 2018/06/21

Show last authors
1 {{velocity}}
2 ##
3 ## Determine the data page to include.
4 ## Note: Using a separate velocity block and at the top so that we may use the include wiki macro.
5 ##
6 #set ($projectVersion = $request.get('projectVersion'))
7 #if ("$!projectVersion" != '')
8 #set ($versionPart = $stringtool.substringBefore($projectVersion, '-'))
9 #set ($version = $stringtool.split($versionPart, '.'))
10 #set ($majorVersion = $numbertool.toNumber($version[0]))
11 #set ($minorVersion = $numbertool.toNumber($version[1]))
12 #if ($version.size() == 3)
13 #set ($bugfixVersion = $numbertool.toNumber($version[2]))
14 #end
15 ## Read the version's artefacts and file names from the dedicated page.
16 #set ($versionDataPage = '.Latest.WebHome')
17 ## Dedicated pages exist for older versions with different contents and file names.
18 #if ($majorVersion < 9 || ($majorVersion == 9 && $minorVersion < 5))
19 ## < 9.5
20 #set ($versionDataPage = '.Before9\.5.WebHome')
21 #elseif (($majorVersion == 9 && ($minorVersion < 11 || ($minorVersion == 11 && $bugfixVersion < 6))) || ($majorVersion == 10 && $minorVersion < 5))
22 ## > 9.5 and < 10.5, but > 9.11.6+ (i.e. except 9.11.x starting from 9.11.6)
23 #set ($versionDataPage = '.Before10\.5.WebHome')
24 #end
25 {{include reference="$versionDataPage" /}}
26 #end
27 {{/velocity}}{{velocity}}
28 ## ################################################################
29 ## Generate the URL to XWiki files that will be used by the Download.DownloadForm page
30 ## ################################################################
31 #macro(downloadurl $link $version)
32 #set ($downloadLinkData = $downloadLinks.get($link))
33 #if ($downloadLinkData)
34 #if ($downloadLinkData.containsKey($version))
35 ## The artifact to be downloaded depends on the version.
36 ## This happens for instance when we rename an artifact.
37 #set ($downloadLinkData = $downloadLinkData.get($version))
38 #end
39 #set ($downloadLinkPath = "#getDownloadLinkPath($downloadLinkData, $version)")
40 #set ($version = $escapetool.xml($version))
41 ## Last $downloadLinkData element always contains the link button class.
42 #set ($linkBtnClass = "${downloadLinkData.get($mathtool.sub($downloadLinkData.size(), 1))}")
43 [[Download>>Download.DownloadForm||queryString="downloadURL=${downloadLinkBase}${downloadLinkPath}&projectVersion=${version}" class="btn btn-xs btn-$linkBtnClass"]]
44 #end
45 #end
46 ## ################################################################
47 ## $categories = Name (0) - Distributions (1) - Color (2) - Description (3)
48 ## ################################################################
49 #set ($categories = [
50 ['Demo Installation', $demoDistibutions, 'green',
51 "These Demo packages are not supposed to be used in production, since the embedded database does not support large wikis efficiently and is not tuned for a production usage."],
52 ['Production Installation', $productionDistibutions, 'blue',
53 "Once you're more familiar with XWiki you might want to set it up on your own database or in your own container, in which case you'll then be able to download the WAR file and set up your instance."]
54 ])
55 ## ################################################################
56 ## Request Handler
57 ## ################################################################
58 #set ($projectVersion = $request.get('projectVersion'))
59 #if ("$!projectVersion" != '')
60 $xwiki.ssx.use("Download.WebHome")
61 {{html wiki='true' clean='false'}}
62 <div class='download-options download-installation'>
63 #foreach($category in $categories)
64 <div class='col-xs-12 download-container download-option border-$category.get(2)'>
65 <h3>$category.get(0)</h3>
66 <div class='list-group'>
67 #foreach($distibution in ${category.get(1)})
68 <div class='list-group-item'>
69 <span class='badge fill-gray'>$distibution.get(2)</span>
70 <h4 class='list-group-item-heading'>$distibution.get(1)</h4>
71 <p class='list-group-item-text noitems'>$distibution.get(3)</p>
72 <div class='buttons'>
73 #downloadurl($distibution.get(0), $projectVersion)
74 #if ($stringtool.isNotBlank($distibution.get(4)))
75 (% class='btn btn-xs btn-link' %)[[Installation Notes>>$distibution.get(4)]](%%)
76 #end
77 </div>
78 </div>
79 #end
80 </div>
81 <p class='noitems'>$category.get(3)</p>
82 </div>
83 #end
84 </div>
85 {{/html}}
86 #else
87 $response.sendRedirect($xwiki.getURL('Download.WebHome'))
88 #end
89 {{/velocity}}

Get Connected