Änderungen von Dokument Licensed Extensions

Zuletzt geändert von xwikiadmin am 2025/01/07 11:38

Von Version 1.1
bearbeitet von xwikiadmin
am 2022/04/27 15:47
Änderungskommentar: Copied from templateostfalia:Licenses.WebHome
Auf Version 3.1
bearbeitet von xwikiadmin
am 2025/01/07 11:38
Änderungskommentar: Install extension [com.xwiki.licensing:application-licensing-licensor-ui/1.26]

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -70,5 +70,6 @@
70 70   #displayOwnerDetailsForm
71 71   #displayLicensesLiveTable
72 72   #displayAddLicenseForm
73 + #feedbackForm
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, isChecked) {
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);
... ... @@ -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() {
213 + $('#licenseManager').on('click', '.licenseButton', function(e) {
214 + e.preventDefault();
207 207   var ownerDetailsForm = $('#ownerDetails');
208 208   if (!validateOwnerDetails(ownerDetailsForm)) {
209 209   return;
... ... @@ -245,7 +245,7 @@
245 245   updateLicensesButton.focus().popover('show');
246 246   });
247 247  
248 - $('#updateLicenses').click(function() {
256 + $('#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();
269 + $(document).on('click', '.licenseButton-autoUpgrade', function(e) {
270 + e.preventDefault();
271 + var autoUpgradeButton = $(this);
272 + var autoUpgradeForm = autoUpgradeButton.closest('form').serializeArray();
263 263   licensor.modifyAutoUpgradesAllowList(autoUpgradeForm).success(function(data) {
274 + autoUpgradeButton.find('.action-icon').toggleClass('isAutoUpgrade', data.isAutoUpgrade);
264 264   if(data.isAutoUpgrade) {
276 + 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 {
280 + 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,6 +272,38 @@
272 272   });
273 273   });
274 274  
288 + $(document).on('click', '.licenseButton-feedback', function(e) {
289 + // Get the data needed in the form.
290 + const buttonData = JSON.parse($(this).attr('data-button'));
291 + const ownerDetails = {};
292 + $('#ownerDetails').serializeArray().map(x => ownerDetails[x.name] = x.value);
293 + if (typeof MauticSDK !== 'undefined') {
294 + // Make sure no messages or errors remained from the previous submit.
295 + const formName = $('#feedbackFormModal').find('.webmecanikForm form').attr('data-mautic-form');
296 + MauticSDK.getValidator(formName).clearErrors();
297 + MauticSDK.getValidator(formName).setMessage('', 'message');
298 + // Prefill values.
299 + const fieldPrefix = '#mauticform_input_' + formName + '_';
300 + $(fieldPrefix + 'email').val(ownerDetails['email']);
301 + const instanceId = $(fieldPrefix + 'instance_id');
302 + instanceId.val(ownerDetails['instanceId']);
303 + const featureId = $(fieldPrefix + 'name_of_the_app');
304 + featureId.val(buttonData['featureId']);
305 +
306 + // Show the feedback form modal.
307 + $('#feedbackFormModal').modal('show');
308 + } else {
309 + const params = $.param({
310 + 'email': ownerDetails['email'],
311 + 'instanceId': ownerDetails['instanceId'],
312 + 'featureId': buttonData['featureId']
313 + });
314 +
315 + const feedbackURL = buttonData['storeFeedbackURL'] + '?' + params;
316 + window.open(feedbackURL, '_blank').focus();
317 + }
318 + });
319 +
275 275   // Set the documentation links to open in new tab.
276 276   $('#licenseManager-display td.name a').each(function() {
277 277   $(this).attr('target', '_blank')
XWiki.StyleSheetExtension[0]
Code
... ... @@ -6,17 +6,18 @@
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 +.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 +}
21 +.webmecanikForm input[type=text], .webmecanikForm input[type=email] {
22 + width: 100%;
23 +}
Inhalt parsen
... ... @@ -1,1 +1,1 @@
1 -Nein
1 +Ja
Content Type
... ... @@ -1,1 +1,1 @@
1 -CSS
1 +LESS