Wiki source code of Download Version

Last modified by Eduard Moraru on 2018/06/21

Hide last authors
Eduard Moraru 4.16 1 {{velocity}}
Eduard Moraru 4.14 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 ##
Eduard Moraru 4.8 6 #set ($projectVersion = $request.get('projectVersion'))
7 #if ("$!projectVersion" != '')
Vincent Massol 5.1 8 #set ($versionPart = $stringtool.substringBefore($projectVersion, '-'))
9 #set ($version = $stringtool.split($versionPart, '.'))
Eduard Moraru 4.8 10 #set ($majorVersion = $numbertool.toNumber($version[0]))
Vincent Massol 5.1 11 #set ($minorVersion = $numbertool.toNumber($version[1]))
Eduard Moraru 5.14 12 #if ($version.size() == 3)
13 #set ($bugfixVersion = $numbertool.toNumber($version[2]))
14 #end
Eduard Moraru 5.2 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.
Eduard Moraru 5.8 18 #if ($majorVersion < 9 || ($majorVersion == 9 && $minorVersion < 5))
Eduard Moraru 5.10 19 ## < 9.5
Eduard Moraru 4.8 20 #set ($versionDataPage = '.Before9\.5.WebHome')
Eduard Moraru 5.11 21 #elseif (($majorVersion == 9 && ($minorVersion < 11 || ($minorVersion == 11 && $bugfixVersion < 6))) || ($majorVersion == 10 && $minorVersion < 5))
Eduard Moraru 5.10 22 ## > 9.5 and < 10.5, but > 9.11.6+ (i.e. except 9.11.x starting from 9.11.6)
Eduard Moraru 5.2 23 #set ($versionDataPage = '.Before10\.5.WebHome')
Eduard Moraru 4.8 24 #end
25 {{include reference="$versionDataPage" /}}
26 #end
Eduard Moraru 4.18 27 {{/velocity}}{{velocity}}
Ecaterina Moraru (Valica) 1.1 28 ## ################################################################
Eduard Moraru 5.2 29 ## Generate the URL to XWiki files that will be used by the Download.DownloadForm page
Ecaterina Moraru (Valica) 1.1 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
Eduard Moraru 5.2 39 #set ($downloadLinkPath = "#getDownloadLinkPath($downloadLinkData, $version)")
Ecaterina Moraru (Valica) 1.1 40 #set ($version = $escapetool.xml($version))
Eduard Moraru 5.2 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"]]
Ecaterina Moraru (Valica) 1.1 44 #end
45 #end
46 ## ################################################################
47 ## $categories = Name (0) - Distributions (1) - Color (2) - Description (3)
48 ## ################################################################
Eduard Moraru 4.8 49 #set ($categories = [
Eduard Moraru 4.4 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."]
Eduard Moraru 4.8 54 ])
Eduard Moraru 4.4 55 ## ################################################################
56 ## Request Handler
57 ## ################################################################
Ecaterina Moraru (Valica) 1.1 58 #set ($projectVersion = $request.get('projectVersion'))
59 #if ("$!projectVersion" != '')
Eduard Moraru 4.4 60 $xwiki.ssx.use("Download.WebHome")
Eduard Moraru 4.14 61 {{html wiki='true' clean='false'}}
Ecaterina Moraru (Valica) 1.1 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'>
Ecaterina Moraru (Valica) 2.1 69 <span class='badge fill-gray'>$distibution.get(2)</span>
Ecaterina Moraru (Valica) 1.1 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'>
Eduard Moraru 5.15 73 #downloadurl($distibution.get(0), $projectVersion)
Eduard Moraru 4.20 74 #if ($stringtool.isNotBlank($distibution.get(4)))
Eduard Moraru 4.19 75 (% class='btn btn-xs btn-link' %)[[Installation Notes>>$distibution.get(4)]](%%)
76 #end
Ecaterina Moraru (Valica) 1.1 77 </div>
78 </div>
79 #end
80 </div>
81 <p class='noitems'>$category.get(3)</p>
82 </div>
83 #end
84 </div>
Eduard Moraru 4.14 85 {{/html}}
Ecaterina Moraru (Valica) 1.1 86 #else
87 $response.sendRedirect($xwiki.getURL('Download.WebHome'))
88 #end
89 {{/velocity}}
Eduard Moraru 4.4 90

Get Connected