Änderungen von Dokument Licensed Extensions
Zuletzt geändert von xwikiadmin am 2025/07/14 15:59
Von Version 1.1
bearbeitet von xwikiadmin
am 2022/04/27 15:47
am 2022/04/27 15:47
Änderungskommentar:
Copied from templateostfalia:Licenses.WebHome
Auf Version 4.1
bearbeitet von xwikiadmin
am 2025/07/14 15:59
am 2025/07/14 15:59
Änderungskommentar:
Install extension [com.xwiki.licensing:application-licensing-licensor-ui/1.29]
Zusammenfassung
-
Seiteneigenschaften (1 geändert, 0 hinzugefügt, 0 gelöscht)
-
Objekte (3 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- Seiteneigenschaften
-
- Inhalt
-
... ... @@ -6,11 +6,14 @@ 6 6 <fieldset class="header"> 7 7 <legend>$services.localization.render('licensor.licenseManager.heading')</legend> 8 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 9 9 </fieldset> 10 10 {{/html}} 11 11 #set ($columns = ['name', 'version', 'status', 'support', 'userLimit', 'wiki', 'actions']) 12 12 #set ($columnsProperties = { 13 - 'name': {'filterable': false, 'sortable': false, 'link': 'auto'}, 16 + 'name': {'filterable': false, 'sortable': false, 'link': 'auto', 'html': true}, 14 14 'version': {'filterable': false, 'sortable': false}, 15 15 'status': {'filterable': false, 'sortable': false, 'html': true}, 16 16 'support': {'filterable': false, 'sortable': false}, ... ... @@ -21,7 +21,7 @@ 21 21 #set ($options = { 22 22 'resultPage':'Licenses.Code.LicenseJSON', 23 23 'translationPrefix' : 'licensor.', 24 - 'extraParams': "&show AllPaidExtensions=$!escapetool.url($request.showAllPaidExtensions)"27 + 'extraParams': "&showTopLevelExtensions=$!escapetool.url($request.showTopLevelExtensions)" 25 25 }) 26 26 #livetable('licenseManager' $columns $columnsProperties $options) 27 27 {{html clean="false"}} ... ... @@ -70,5 +70,7 @@ 70 70 #displayOwnerDetailsForm 71 71 #displayLicensesLiveTable 72 72 #displayAddLicenseForm 76 + #feedbackForm 77 + #installedAsDependency 73 73 #end 74 74 {{/velocity}}
- XWiki.ConfigurableClass[0]
-
- Anzeigen in Sektion
-
... ... @@ -1,0 +1,1 @@ 1 +Licenses - Code zum Ausführen
-
... ... @@ -1,0 +1,1 @@ 1 +{{include reference="Licenses.WebHome" /}} - Bereich (Scope)
-
... ... @@ -1,0 +1,1 @@ 1 +WIKI - Anzeigen in der Kategorie
-
... ... @@ -1,0 +1,1 @@ 1 +extensionmanager - Reihenfolge der Sektionen
-
... ... @@ -1,0 +1,1 @@ 1 +600
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,4 +1,11 @@ 1 -define('licensor', ['jquery', 'xwiki-meta'], function($, xwikiMeta) { 1 +define('auto-update-button', { 2 + prefix: 'licensor.moreActions.autoUpgrade.', 3 + keys: [ 4 + 'allow', 5 + 'prevent' 6 + ] 7 +}); 8 +define('licensor', ['jquery', 'xwiki-meta', 'xwiki-l10n!auto-update-button'], function($, xwikiMeta, l10n) { 2 2 return { 3 3 addLicense: function(data) { 4 4 return $.post( ... ... @@ -58,7 +58,7 @@ 58 58 }; 59 59 }); 60 60 61 -require(['jquery', 'licensor', 'xwiki-meta', 'xwiki-events-bridge', 'bootstrap'], function ($, licensor, xwikiMeta) { 68 +require(['jquery', 'licensor', 'xwiki-meta', 'xwiki-l10n!auto-update-button', 'xwiki-events-bridge', 'bootstrap'], function ($, licensor, xwikiMeta, l10n) { 62 62 // 63 63 // Owner Details Form 64 64 // ... ... @@ -124,7 +124,7 @@ 124 124 // Remove "Extend Trial" buttons from livetable, if the trial licenses limits were reached. 125 125 var updateLivetableButtons = function() { 126 126 var instanceId = $('#instanceId').val(); 127 - $('.licenseActions . btn-primary').each(function() {134 + $('.licenseActions .licenseButton-extendTrial').each(function() { 128 128 // Compute the key to check in the localStorage. 129 129 var buttonData = JSON.parse($(this).attr('data-button')); 130 130 var featureId = buttonData.featureId; ... ... @@ -139,13 +139,13 @@ 139 139 140 140 // An extensionId could have multiple rows in the livetable if is installed on multiple subwikis, but the allowlist 141 141 // is applied to all namespaces. 142 - var updateExtensionOfOtherWikis = function(extensionId, is Checked) {149 + var updateExtensionOfOtherWikis = function(extensionId, isAutoUpgrade) { 143 143 var similarExtensions = $("input[name='extensionId'][value='" + extensionId + "']"); 144 144 similarExtensions.each(function() { 145 - var checkbox= $(this).siblings("input[type='checkbox']");146 - if (checkbox.prop('checked')!=isChecked){147 - checkbox.prop('checked',isChecked);148 - }152 + var autoUpgradeButton = $(this).siblings('.licenseButton-autoUpgrade'); 153 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', isAutoUpgrade); 154 + var translationKey = isAutoUpgrade ? 'prevent' : 'allow'; 155 + autoUpgradeButton.prop('title', l10n.get(translationKey)); 149 149 }); 150 150 }; 151 151 ... ... @@ -152,7 +152,7 @@ 152 152 // xwiki:livetable:displayComplete might be triggered before the code from this jsx is executed. In this case, the 153 153 // livetable is also loaded before, because it is using Prototype.js which is loading before the page loads. 154 154 // Make sure that the livetable is loaded by checking for a row with some data. 155 - if ($('#licenseManager-display td.type'). size()> 0) {162 + if ($('#licenseManager-display td.type').length > 0) { 156 156 updateLivetableButtons(); 157 157 } 158 158 $(document).on('xwiki:livetable:displayComplete', updateLivetableButtons); ... ... @@ -201,18 +201,10 @@ 201 201 }); 202 202 }; 203 203 204 - // Manages the license buttons from the licenses livetable. If a trial is requested, it is automatically generated 205 - // and installed, else the user is redirected to a page to buy a license. 206 - $('#licenseManager').on('click', '.licenseButton', function() { 211 + // Trigger Get Trial / Extend trial or Buy license actions. 212 + var triggerLicenseAction = function(buttonData) { 207 207 var ownerDetailsForm = $('#ownerDetails'); 208 - if (!validateOwnerDetails(ownerDetailsForm)) { 209 - return; 210 - } 211 - // Update the owner details. 212 - var ownerDetails = ownerDetailsForm.serializeArray(); 213 - licensor.updateOwnerDetails(ownerDetails); 214 - // Get the data from the license button. 215 - var buttonData = JSON.parse($(this).attr('data-button')); 214 + let ownerDetails = ownerDetailsForm.serializeArray(); 216 216 if (buttonData.licenseType === 'TRIAL') { 217 217 ownerDetails.push.apply(ownerDetails, $.map(buttonData, function(value, name) { 218 218 return {name: name, value: value}; ... ... @@ -225,6 +225,35 @@ 225 225 ownerDetailsForm.append(extraFields).submit(); 226 226 extraFields.remove(); 227 227 }; 227 + }; 228 + 229 + // Manages the license buttons from the licenses livetable. If a trial is requested, it is automatically generated 230 + // and installed, else the user is redirected to a page to buy a license. 231 + $('#licenseManager').on('click', '.licenseButton', function(e) { 232 + e.preventDefault(); 233 + var ownerDetailsForm = $('#ownerDetails'); 234 + if (!validateOwnerDetails(ownerDetailsForm)) { 235 + return; 236 + } 237 + // Update the owner details. 238 + var ownerDetails = ownerDetailsForm.serializeArray(); 239 + licensor.updateOwnerDetails(ownerDetails); 240 + // Get data from the license button. 241 + var buttonData = JSON.parse($(this).attr('data-button')); 242 + // If this extension was installed as dependency, ask for a confirmation before continuing this action, since it 243 + // would be better for the user to get a license for the top level licensed extension. 244 + const requiredByInfo = $($($(this).parents('td.actions')[0]).siblings('td.name')[0]).find('.required-by-info'); 245 + if (requiredByInfo.size() > 0) { 246 + const parentExtensionNode = $('#installed-as-dependency').find('.parent-extensions'); 247 + parentExtensionNode.empty(); 248 + requiredByInfo.data('parent-extensions').split(',').forEach((extension) => { 249 + parentExtensionNode.append("<li>"+ extension.trim() + "</li>"); 250 + }); 251 + $('#installed-as-dependency').data('buttonData', buttonData); 252 + $('#installed-as-dependency').modal('show'); 253 + } else { 254 + triggerLicenseAction(buttonData); 255 + } 228 228 }); 229 229 230 230 // Show a popover on the "Check for Updates" button to let the user know what to do after he pays for the license. ... ... @@ -245,7 +245,7 @@ 245 245 updateLicensesButton.focus().popover('show'); 246 246 }); 247 247 248 - $('#updateLicenses').click (function() {276 + $('#updateLicenses').on('click', function() { 249 249 var updateButton = $(this); 250 250 updateButton.prop('disabled', true); 251 251 // Show a notification message. ... ... @@ -258,13 +258,18 @@ 258 258 }); 259 259 }); 260 260 261 - $(document).on('click', 'input[name=autoUpgrade]', function() { 262 - var autoUpgradeForm = $(this).parent('form').serializeArray(); 289 + $(document).on('click', '.licenseButton-autoUpgrade', function(e) { 290 + e.preventDefault(); 291 + var autoUpgradeButton = $(this); 292 + var autoUpgradeForm = autoUpgradeButton.closest('form').serializeArray(); 263 263 licensor.modifyAutoUpgradesAllowList(autoUpgradeForm).success(function(data) { 294 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', data.isAutoUpgrade); 264 264 if(data.isAutoUpgrade) { 296 + autoUpgradeButton.prop('title', l10n.get('prevent')); 265 265 new XWiki.widgets.Notification( 266 266 $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.added')), 'done'); 267 267 } else { 300 + autoUpgradeButton.prop('title', l10n.get('allow')); 268 268 new XWiki.widgets.Notification( 269 269 $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.removed')), 'done'); 270 270 } ... ... @@ -272,8 +272,51 @@ 272 272 }); 273 273 }); 274 274 308 + $(document).on('click', '.licenseButton-feedback', function(e) { 309 + // Get the data needed in the form. 310 + const buttonData = JSON.parse($(this).attr('data-button')); 311 + const ownerDetails = {}; 312 + $('#ownerDetails').serializeArray().map(x => ownerDetails[x.name] = x.value); 313 + if (typeof MauticSDK !== 'undefined') { 314 + // Make sure no messages or errors remained from the previous submit. 315 + const formName = $('#feedbackFormModal').find('.webmecanikForm form').attr('data-mautic-form'); 316 + MauticSDK.getValidator(formName).clearErrors(); 317 + MauticSDK.getValidator(formName).setMessage('', 'message'); 318 + // Prefill values. 319 + const fieldPrefix = '#mauticform_input_' + formName + '_'; 320 + $(fieldPrefix + 'email').val(ownerDetails['email']); 321 + const instanceId = $(fieldPrefix + 'instance_id'); 322 + instanceId.val(ownerDetails['instanceId']); 323 + const featureId = $(fieldPrefix + 'name_of_the_app'); 324 + featureId.val(buttonData['featureId']); 325 + 326 + // Show the feedback form modal. 327 + $('#feedbackFormModal').modal('show'); 328 + } else { 329 + const params = $.param({ 330 + 'email': ownerDetails['email'], 331 + 'instanceId': ownerDetails['instanceId'], 332 + 'featureId': buttonData['featureId'] 333 + }); 334 + 335 + const feedbackURL = buttonData['storeFeedbackURL'] + '?' + params; 336 + window.open(feedbackURL, '_blank').focus(); 337 + } 338 + }); 339 + 340 + // Continue license action after user confirmation. 341 + $(document).on('click', '#installed-as-dependency .btn-primary', function(e) { 342 + e.preventDefault(); 343 + triggerLicenseAction($('#installed-as-dependency').data('buttonData')); 344 + }); 345 + 346 + $(document).on('hide.bs.modal', '#installed-as-dependency', function() { 347 + $('#installed-as-dependency').removeData('buttonData'); 348 + $('#installed-as-dependency').find('.parent-extensions').empty(); 349 + }); 350 + 275 275 // Set the documentation links to open in new tab. 276 276 $('#licenseManager-display td.name a').each(function() { 277 - $(this).attr('target', '_blank') 353 + $(this).attr('target', '_blank'); 278 278 }); 279 279 });
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -6,17 +6,31 @@ 6 6 margin-top: .7em; 7 7 } 8 8 9 -/* Duplicate some rules from style.css for input[type='email']. 10 - Should be removed when https://jira.xwiki.org/browse/XWIKI-13803 is implemented.*/ 11 -.xform input[type="email"] { 12 - width: 100%; 13 - padding: 6px 12px; 14 - border: 1px solid #ccc; 15 - border-radius: 4px; 16 -} 17 - 18 18 /* .dropleft to be used after moving to Bootstrap 4 */ 19 19 .dropdown-left { 20 20 right: 0; 21 21 left: auto; 22 22 } 14 + 15 +#licenseManager-display .required-by-info:hover { 16 + color: @gray; 17 +} 18 + 19 +.required-by-hint { 20 + padding-top: 2%; 21 +} 22 + 23 +#installed-as-dependency .parent-extensions li { 24 + padding-top: 1%; 25 + font-weight: bold; 26 +} 27 + 28 +.licenseButton-paid .action-icon, .licenseButton-extendPaid .action-icon, .isAutoUpgrade { 29 + color: @brand-success; 30 +} 31 +.licenseButton-trial .action-icon, .licenseButton-extendTrial .action-icon { 32 + color: @link-color; 33 +} 34 +.webmecanikForm input[type=text], .webmecanikForm input[type=email] { 35 + width: 100%; 36 +} - Inhalt parsen
-
... ... @@ -1,1 +1,1 @@ 1 - Nein1 +Ja - Content Type
-
... ... @@ -1,1 +1,1 @@ 1 - CSS1 +LESS