Изменения документа Licensed Extensions
Редактировал(а) Dmitriy Rybakov 20.06.2025, 16:46
От версии 3.1
отредактировано Andrey Burlaka
на 04.10.2024, 00:09
на 04.10.2024, 00:09
Изменить комментарий:
Migrated property [scope] from class [XWiki.ConfigurableClass]
К версии 4.1
отредактировано Dmitriy Rybakov
на 04.10.2024, 00:20
на 04.10.2024, 00:20
Изменить комментарий:
Install extension [com.xwiki.licensing:application-licensing-licensor-ui/1.25]
Сводка
-
Свойства страницы (1 изменено, 0 добавлено, 0 удалено)
-
Объекты (3 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Автор документа
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. burlakaas1 +XWiki.rybakovds
- XWiki.ConfigurableClass[0]
-
- Область видимости
-
... ... @@ -1,0 +1,1 @@ 1 +WIKI
- XWiki.JavaScriptExtension[0]
-
- Код
-
... ... @@ -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( ... ... @@ -48,11 +48,17 @@ 48 48 new XWiki.Document('UpdateOwnerDetails', 'Licenses.Code').getURL('get', 'outputSyntax=plain'), 49 49 data 50 50 ); 58 + }, 59 + modifyAutoUpgradesAllowList: function(data) { 60 + return $.post( 61 + new XWiki.Document('UpdateAutomaticUpgradesAllowList', 'Licenses.Code').getURL('get', 'outputSyntax=plain'), 62 + data 63 + ); 51 51 } 52 52 }; 53 53 }); 54 54 55 -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) { 56 56 // 57 57 // Owner Details Form 58 58 // ... ... @@ -118,7 +118,7 @@ 118 118 // Remove "Extend Trial" buttons from livetable, if the trial licenses limits were reached. 119 119 var updateLivetableButtons = function() { 120 120 var instanceId = $('#instanceId').val(); 121 - $('.licenseActions . btn-primary').each(function() {134 + $('.licenseActions .licenseButton-extendTrial').each(function() { 122 122 // Compute the key to check in the localStorage. 123 123 var buttonData = JSON.parse($(this).attr('data-button')); 124 124 var featureId = buttonData.featureId; ... ... @@ -131,6 +131,18 @@ 131 131 }); 132 132 }; 133 133 147 + // An extensionId could have multiple rows in the livetable if is installed on multiple subwikis, but the allowlist 148 + // is applied to all namespaces. 149 + var updateExtensionOfOtherWikis = function(extensionId, isAutoUpgrade) { 150 + var similarExtensions = $("input[name='extensionId'][value='" + extensionId + "']"); 151 + similarExtensions.each(function() { 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)); 156 + }); 157 + }; 158 + 134 134 // xwiki:livetable:displayComplete might be triggered before the code from this jsx is executed. In this case, the 135 135 // livetable is also loaded before, because it is using Prototype.js which is loading before the page loads. 136 136 // Make sure that the livetable is loaded by checking for a row with some data. ... ... @@ -185,7 +185,8 @@ 185 185 186 186 // Manages the license buttons from the licenses livetable. If a trial is requested, it is automatically generated 187 187 // and installed, else the user is redirected to a page to buy a license. 188 - $('#licenseManager').on('click', '.licenseButton', function() { 213 + $('#licenseManager').on('click', '.licenseButton', function(e) { 214 + e.preventDefault(); 189 189 var ownerDetailsForm = $('#ownerDetails'); 190 190 if (!validateOwnerDetails(ownerDetailsForm)) { 191 191 return; ... ... @@ -227,7 +227,7 @@ 227 227 updateLicensesButton.focus().popover('show'); 228 228 }); 229 229 230 - $('#updateLicenses').click (function() {256 + $('#updateLicenses').on('click', function() { 231 231 var updateButton = $(this); 232 232 updateButton.prop('disabled', true); 233 233 // Show a notification message. ... ... @@ -240,6 +240,25 @@ 240 240 }); 241 241 }); 242 242 269 + $(document).on('click', '.licenseButton-autoUpgrade', function(e) { 270 + e.preventDefault(); 271 + var autoUpgradeButton = $(this); 272 + var autoUpgradeForm = autoUpgradeButton.closest('form').serializeArray(); 273 + licensor.modifyAutoUpgradesAllowList(autoUpgradeForm).success(function(data) { 274 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', data.isAutoUpgrade); 275 + if(data.isAutoUpgrade) { 276 + autoUpgradeButton.prop('title', l10n.get('prevent')); 277 + new XWiki.widgets.Notification( 278 + $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.added')), 'done'); 279 + } else { 280 + autoUpgradeButton.prop('title', l10n.get('allow')); 281 + new XWiki.widgets.Notification( 282 + $jsontool.serialize($services.localization.render('licensor.moreActions.autoUpgrade.removed')), 'done'); 283 + } 284 + updateExtensionOfOtherWikis(data.extensionId, data.isAutoUpgrade); 285 + }); 286 + }); 287 + 243 243 // Set the documentation links to open in new tab. 244 244 $('#licenseManager-display td.name a').each(function() { 245 245 $(this).attr('target', '_blank')
- XWiki.StyleSheetExtension[0]
-
- Код
-
... ... @@ -6,11 +6,15 @@ 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; 9 +/* .dropleft to be used after moving to Bootstrap 4 */ 10 +.dropdown-left { 11 + right: 0; 12 + left: auto; 16 16 } 14 + 15 +.licenseButton-paid .action-icon, .licenseButton-extendPaid .action-icon, .isAutoUpgrade { 16 + color: @brand-success; 17 +} 18 +.licenseButton-trial .action-icon, .licenseButton-extendTrial .action-icon { 19 + color: @link-color; 20 +} - Content Type
-
... ... @@ -1,1 +1,1 @@ 1 - CSS1 +LESS - Разбор содержимого
-
... ... @@ -1,1 +1,1 @@ 1 - Нет1 +Да