Changes for page Licensed Extensions

Last modified by Jean Franco on 2022/10/27 21:09

From version 1.1 >
edited by Jean Franco
on 2022/07/30 13:08
To version < 2.1
edited by Jean Franco
on 2022/10/27 21:09
Change comment: Install extension [com.xwiki.licensing:application-licensing-licensor-ui/1.23]

Summary

Details

XWiki.ConfigurableClass[0]
configureGlobally
... ... @@ -1,0 +1,1 @@
1 +1
XWiki.JavaScriptExtension[0]
Code
... ... @@ -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() {
127 + $('.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, isChecked) {
142 + 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 - }
145 + var autoUpgradeButton = $(this).siblings('.licenseButton-autoUpgrade');
146 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', isAutoUpgrade);
147 + var translationKey = isAutoUpgrade ? 'data-prevent-label' : 'data-allow-label';
148 + autoUpgradeButton.prop('title', autoUpgradeButton.attr(translationKey));
149 149   });
150 150   };
151 151  
... ... @@ -203,7 +203,8 @@
203 203  
204 204   // Manages the license buttons from the licenses livetable. If a trial is requested, it is automatically generated
205 205   // and installed, else the user is redirected to a page to buy a license.
206 - $('#licenseManager').on('click', '.licenseButton', function() {
206 + $('#licenseManager').on('click', '.licenseButton', function(e) {
207 + e.preventDefault();
207 207   var ownerDetailsForm = $('#ownerDetails');
208 208   if (!validateOwnerDetails(ownerDetailsForm)) {
209 209   return;
... ... @@ -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();
262 + $(document).on('click', '.licenseButton-autoUpgrade', function(e) {
263 + e.preventDefault();
264 + var autoUpgradeButton = $(this);
265 + var autoUpgradeForm = autoUpgradeButton.closest('form').serializeArray();
263 263   licensor.modifyAutoUpgradesAllowList(autoUpgradeForm).success(function(data) {
267 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', data.isAutoUpgrade);
264 264   if(data.isAutoUpgrade) {
269 + autoUpgradeButton.prop('title', autoUpgradeButton.attr('data-prevent-label'));
265 265   new XWiki.widgets.Notification(
266 266   $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.added')), 'done');
267 267   } else {
273 + autoUpgradeButton.prop('title', autoUpgradeButton.attr('data-allow-label'));
268 268   new XWiki.widgets.Notification(
269 269   $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.removed')), 'done');
270 270   }
XWiki.StyleSheetExtension[0]
Code
... ... @@ -20,3 +20,10 @@
20 20   right: 0;
21 21   left: auto;
22 22  }
23 +
24 +.licenseButton-paid .action-icon, .licenseButton-extendPaid .action-icon, .isAutoUpgrade {
25 + color: @brand-success;
26 +}
27 +.licenseButton-trial .action-icon, .licenseButton-extendTrial .action-icon {
28 + color: @link-color;
29 +}
Content Type
... ... @@ -1,1 +1,1 @@
1 -CSS
1 +LESS
Parse content
... ... @@ -1,1 +1,1 @@
1 -No
1 +Yes
Maila Networks