Code source wiki de Licensed Extensions
Modifié par superadmin le 2022/05/16 17:25
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | {{include reference="Licenses.Code.VelocityMacros" /}} | ||
2 | |||
3 | {{velocity output="false"}} | ||
4 | #macro (displayLicensesLiveTable) | ||
5 | {{html clean="false"}} | ||
6 | <fieldset class="header"> | ||
7 | <legend>$services.localization.render('licensor.licenseManager.heading')</legend> | ||
8 | $services.localization.render('licensor.licenseManager.hint') | ||
9 | </fieldset> | ||
10 | {{/html}} | ||
11 | #set ($columns = ['name', 'version', 'status', 'support', 'userLimit', 'wiki', 'actions']) | ||
12 | #set ($columnsProperties = { | ||
13 | 'name': {'filterable': false, 'sortable': false, 'link': 'auto'}, | ||
14 | 'version': {'filterable': false, 'sortable': false}, | ||
15 | 'status': {'filterable': false, 'sortable': false, 'html': true}, | ||
16 | 'support': {'filterable': false, 'sortable': false}, | ||
17 | 'userLimit': {'filterable': false, 'sortable': false, 'html': true}, | ||
18 | 'wiki': {'filterable': false, 'sortable': false}, | ||
19 | 'actions': {'filterable': false, 'sortable': false, 'html': true} | ||
20 | }) | ||
21 | #set ($options = { | ||
22 | 'resultPage':'Licenses.Code.LicenseJSON', | ||
23 | 'translationPrefix' : 'licensor.', | ||
24 | 'extraParams': "&showAllPaidExtensions=$!escapetool.url($request.showAllPaidExtensions)" | ||
25 | }) | ||
26 | #livetable('licenseManager' $columns $columnsProperties $options) | ||
27 | {{html clean="false"}} | ||
28 | <p> | ||
29 | <button id="updateLicenses" class="btn btn-default" data-toggle="popover" | ||
30 | title="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint'))" | ||
31 | data-title="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint.title'))" | ||
32 | data-content="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint.content'))"> | ||
33 | $escapetool.xml($services.localization.render('licensor.updateLicenses.label')) | ||
34 | </button> | ||
35 | </p> | ||
36 | {{/html}} | ||
37 | #end | ||
38 | |||
39 | #macro (displayAddLicenseForm) | ||
40 | {{html clean=false}} | ||
41 | <form id="addLicense" class="xform half" action="$xwiki.getURL('Licenses.Code.AddLicense', 'get', | ||
42 | 'outputSyntax=plain')" method="post"> | ||
43 | <fieldset class="header"> | ||
44 | <legend>$services.localization.render('licensor.addLicense.heading')</legend> | ||
45 | <p>$services.localization.render('licensor.addLicense.hint')</p> | ||
46 | <textarea name="license" id="license" rows="5"></textarea> | ||
47 | <input type="hidden" name="form_token" value="$!escapetool.xml($services.csrf.token)" /> | ||
48 | <input class="btn btn-default" type="submit" value="$services.localization.render('licensor.addLicense.submit')"> | ||
49 | </fieldset> | ||
50 | </form> | ||
51 | {{/html}} | ||
52 | #end | ||
53 | {{/velocity}} | ||
54 | |||
55 | {{velocity}} | ||
56 | ## The licensor UI is a dependency of the licensor API which needs to be installed on farm. The licensor UI should be | ||
57 | ## accessible only from the main wiki but we can't limit its installation to the main wiki so we need to check here if | ||
58 | ## we are on the main wiki. | ||
59 | #if (!$xcontext.isMainWiki()) | ||
60 | {{info}} | ||
61 | $services.localization.render('licensor.unavailableOnSubWiki', ['[[', ">>path:#getLicensesAdminSectionURL]]"]) | ||
62 | {{/info}} | ||
63 | #elseif (!$hasAdmin || !$hasProgramming) | ||
64 | {{error}} | ||
65 | $services.localization.render('licensor.accessDenied') | ||
66 | {{/error}} | ||
67 | #else | ||
68 | #set ($discard = $xwiki.ssx.use('Licenses.WebHome')) | ||
69 | #set ($discard = $xwiki.jsx.use('Licenses.WebHome')) | ||
70 | #displayOwnerDetailsForm | ||
71 | #displayLicensesLiveTable | ||
72 | #displayAddLicenseForm | ||
73 | #end | ||
74 | {{/velocity}} |