Wiki-Quellcode von WebHome
Zuletzt geändert von Daniel Herrmann am 2025/06/22 18:48
Verstecke letzte Bearbeiter
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{include reference="Licenses.Code.VelocityMacros"/}} |
| 2 | |||
| 3 | {{velocity output="false"}} | ||
| 4 | #macro (getLicenseStep) | ||
| 5 | #stepStart('getLicense') | ||
| 6 | <div class="modal-body"> | ||
| 7 | <p>$services.localization.render('licensor.ownerDetails.hint')</p> | ||
| 8 | <form id="ownerDetails" target="_blank" class="xform" action="${storeBuyURL}" method="post"> | ||
| 9 | <div class="hidden"> | ||
| 10 | <input type="hidden" name="form_token" value="$!escapetool.xml($services.csrf.token)" /> | ||
| 11 | </div> | ||
| 12 | <dl> | ||
| 13 | #getOwnerFormFields | ||
| 14 | #getInstanceIdInput(true) | ||
| 15 | </dl> | ||
| 16 | </form> | ||
| 17 | </div> | ||
| 18 | <div class="modal-footer" id="licenseManager"> | ||
| 19 | #set ($updateLicensesButton = '<button id="updateLicenses" class="btn btn-success">' + | ||
| 20 | $escapetool.xml($services.localization.render('xwiki.pro.wizard.getLicense.update')) + '</button>') | ||
| 21 | #set ($actions = [$updateLicensesButton]) | ||
| 22 | #getLicenseActions($license $xwikiProUI $actions) | ||
| 23 | #set ($registerLicenseButton = '<button class="btn btn-default registerLicense">' + | ||
| 24 | $escapetool.xml($services.localization.render("xwiki.pro.wizard.getLicense.register")) + '</button>') | ||
| 25 | #set ($discard = $actions.add($registerLicenseButton)) | ||
| 26 | $stringtool.join($actions, '') | ||
| 27 | </div> | ||
| 28 | #stepEnd | ||
| 29 | #end | ||
| 30 | |||
| 31 | #macro (registerLicenseStep) | ||
| 32 | #stepStart('registerLicense') | ||
| 33 | <form id="addLicense" class="xform" action="" method="post"> | ||
| 34 | <div class="modal-body"> | ||
| 35 | <p>$services.localization.render('licensor.addLicense.hint')</p> | ||
| 36 | <textarea name="license" id="license" rows="5"></textarea> | ||
| 37 | <input type="hidden" name="form_token" value="$!escapetool.xml($services.csrf.token)" /> | ||
| 38 | </div> | ||
| 39 | <div class="modal-footer"> | ||
| 40 | <button type="submit" class="btn btn-success"> | ||
| 41 | $services.localization.render('xwiki.pro.wizard.registerLicense.register') | ||
| 42 | </button> | ||
| 43 | <button type="button" class="btn btn-default" id="newLicenseButton"> | ||
| 44 | $services.localization.render('xwiki.pro.wizard.registerLicense.newLicense') | ||
| 45 | </button> | ||
| 46 | </div> | ||
| 47 | </form> | ||
| 48 | #stepEnd | ||
| 49 | #end | ||
| 50 | |||
| 51 | #macro (chooseExtensionsStep) | ||
| 52 | #stepStart('chooseExtensions') | ||
| 53 | <form id="installExtensions" class="xform" action="" method="post"> | ||
| 54 | <div class="modal-body"> | ||
| 55 | #set ($xwikiproAdminURL = $xwiki.getURL('XWiki.XWikiPreferences', 'admin', | ||
| 56 | 'editor=globaladmin§ion=XWiki.Pro.Configuration')) | ||
| 57 | <p> | ||
| 58 | $services.localization.render('xwiki.pro.wizard.chooseExtensions.hint', | ||
| 59 | ["<a href='$xwikiproAdminURL'>", '</a>']) | ||
| 60 | </p> | ||
| 61 | </div> | ||
| 62 | <div class="modal-footer"> | ||
| 63 | <button type="button" class="btn btn-default" data-dismiss="modal"> | ||
| 64 | $services.localization.render('xwiki.pro.wizard.chooseExtensions.close') | ||
| 65 | </button> | ||
| 66 | </div> | ||
| 67 | </form> | ||
| 68 | #stepEnd | ||
| 69 | #end | ||
| 70 | |||
| 71 | #macro (stepStart $stepId) | ||
| 72 | <div id="$stepId" class="modal" role="dialog"> | ||
| 73 | <div class="modal-dialog"> | ||
| 74 | <div class="modal-content"> | ||
| 75 | <div class="modal-header"> | ||
| 76 | <button type="button" class="close" data-dismiss="modal">×</button> | ||
| 77 | <h4 class="modal-title">$services.localization.render("xwiki.pro.wizard.${stepId}.title")</h4> | ||
| 78 | </div> | ||
| 79 | #end | ||
| 80 | #macro (stepEnd) | ||
| 81 | </div> | ||
| 82 | </div> | ||
| 83 | </div> | ||
| 84 | #end | ||
| 85 | |||
| 86 | #macro (displayInPage) | ||
| 87 | #set ($displayInPage = true) | ||
| 88 | ## Do not display the popup in the pages that already provide the onwer's details form | ||
| 89 | #if ($doc.fullName.equals('Licenses.WebHome') || ($doc.fullName.equals('XWiki.XWikiPreferences') | ||
| 90 | && $xcontext.action.equals('admin') && $request.section.equals('Licenses'))) | ||
| 91 | #set ($displayInPage = false) | ||
| 92 | #end | ||
| 93 | #end | ||
| 94 | {{/velocity}} | ||
| 95 | |||
| 96 | {{velocity}} | ||
| 97 | #set ($extensionManager = $services.extension) | ||
| 98 | #set ($xwikiProUIId = 'com.xwiki.pro:xwiki-pro-ui') | ||
| 99 | #set ($namespace = "wiki:$xcontext.database") | ||
| 100 | #set ($xwikiProUI = $extensionManager.installed.getInstalledExtension($xwikiProUIId, $namespace)) | ||
| 101 | #set ($license = $services.licensing.licensor.getLicenseForExtension($xwikiProUI.id)) | ||
| 102 | ## Check if the modal popup should be displayed in the current page | ||
| 103 | #displayInPage | ||
| 104 | #if ((!$license || $license.expirationDate == 0) && $displayInPage) | ||
| 105 | #set ($discard = $xwiki.ssx.use('Licenses.WebHome')) | ||
| 106 | #set ($discard = $xwiki.jsx.use('Licenses.WebHome')) | ||
| 107 | #set ($discard = $xwiki.jsx.use('XWiki.Pro.WebHome')) | ||
| 108 | {{html clean=false}} | ||
| 109 | #getLicenseStep | ||
| 110 | #registerLicenseStep | ||
| 111 | #chooseExtensionsStep | ||
| 112 | {{/html}} | ||
| 113 | #end | ||
| 114 | {{/velocity}} |