Wiki zdrojový kód pre Licensed Extensions
Naposledy upravil Admin-metais MetaIS 2025/05/28 21:41
Show last authors
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 | <div class="required-by-hint"> | ||
10 | $services.icon.renderHTML('warning') : $services.localization.render('licensor.licenseManager.installedAsDependency.hint') | ||
11 | </div | ||
12 | </fieldset> | ||
13 | {{/html}} | ||
14 | #set ($columns = ['name', 'version', 'status', 'support', 'userLimit', 'wiki', 'actions']) | ||
15 | #set ($columnsProperties = { | ||
16 | 'name': {'filterable': false, 'sortable': false, 'link': 'auto', 'html': true}, | ||
17 | 'version': {'filterable': false, 'sortable': false}, | ||
18 | 'status': {'filterable': false, 'sortable': false, 'html': true}, | ||
19 | 'support': {'filterable': false, 'sortable': false}, | ||
20 | 'userLimit': {'filterable': false, 'sortable': false, 'html': true}, | ||
21 | 'wiki': {'filterable': false, 'sortable': false}, | ||
22 | 'actions': {'filterable': false, 'sortable': false, 'html': true} | ||
23 | }) | ||
24 | #set ($options = { | ||
25 | 'resultPage':'Licenses.Code.LicenseJSON', | ||
26 | 'translationPrefix' : 'licensor.', | ||
27 | 'extraParams': "&showTopLevelExtensions=$!escapetool.url($request.showTopLevelExtensions)" | ||
28 | }) | ||
29 | #livetable('licenseManager' $columns $columnsProperties $options) | ||
30 | {{html clean="false"}} | ||
31 | <p> | ||
32 | <button id="updateLicenses" class="btn btn-default" data-toggle="popover" | ||
33 | title="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint'))" | ||
34 | data-title="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint.title'))" | ||
35 | data-content="$escapetool.xml($services.localization.render('licensor.updateLicenses.hint.content'))"> | ||
36 | $escapetool.xml($services.localization.render('licensor.updateLicenses.label')) | ||
37 | </button> | ||
38 | </p> | ||
39 | {{/html}} | ||
40 | #end | ||
41 | |||
42 | #macro (displayAddLicenseForm) | ||
43 | {{html clean=false}} | ||
44 | <form id="addLicense" class="xform half" action="$xwiki.getURL('Licenses.Code.AddLicense', 'get', | ||
45 | 'outputSyntax=plain')" method="post"> | ||
46 | <fieldset class="header"> | ||
47 | <legend>$services.localization.render('licensor.addLicense.heading')</legend> | ||
48 | <p>$services.localization.render('licensor.addLicense.hint')</p> | ||
49 | <textarea name="license" id="license" rows="5"></textarea> | ||
50 | <input type="hidden" name="form_token" value="$!escapetool.xml($services.csrf.token)" /> | ||
51 | <input class="btn btn-default" type="submit" value="$services.localization.render('licensor.addLicense.submit')"> | ||
52 | </fieldset> | ||
53 | </form> | ||
54 | {{/html}} | ||
55 | #end | ||
56 | {{/velocity}} | ||
57 | |||
58 | {{velocity}} | ||
59 | ## The licensor UI is a dependency of the licensor API which needs to be installed on farm. The licensor UI should be | ||
60 | ## accessible only from the main wiki but we can't limit its installation to the main wiki so we need to check here if | ||
61 | ## we are on the main wiki. | ||
62 | #if (!$xcontext.isMainWiki()) | ||
63 | {{info}} | ||
64 | $services.localization.render('licensor.unavailableOnSubWiki', ['[[', ">>path:#getLicensesAdminSectionURL]]"]) | ||
65 | {{/info}} | ||
66 | #elseif (!$hasAdmin || !$hasProgramming) | ||
67 | {{error}} | ||
68 | $services.localization.render('licensor.accessDenied') | ||
69 | {{/error}} | ||
70 | #else | ||
71 | #set ($discard = $xwiki.ssx.use('Licenses.WebHome')) | ||
72 | #set ($discard = $xwiki.jsx.use('Licenses.WebHome')) | ||
73 | #displayOwnerDetailsForm | ||
74 | #displayLicensesLiveTable | ||
75 | #displayAddLicenseForm | ||
76 | #feedbackForm | ||
77 | #installedAsDependency | ||
78 | #end | ||
79 | {{/velocity}} |