Änderungen von Dokument Confluence bridge for Attachments

Zuletzt geändert von xwikiadmin am 2025/01/07 12:27

Von Version 1.1
bearbeitet von xwikiadmin
am 2024/06/24 15:04
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-confluence-bridges-ui/1.19.4]
Auf Version 2.1
bearbeitet von xwikiadmin
am 2025/01/07 12:27
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-confluence-bridges-ui/1.25.4]

Zusammenfassung

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -32,14 +32,8 @@
32 32   if ($(e.target).prop('id').startsWith('confluenceAttachments')) {
33 33   // Select the livedata above the upload form.
34 34   const uploadForm = $(e.target).closest('form');
35 - // The 'xwiki-livedata' CSS class is present only before XWiki version 14.4.
36 - let associatedLivedata = uploadForm.prevAll('.liveData, .xwiki-livedata').first();
37 - // We do not have access to a liveData object before XWiki 14.4.
38 - if (associatedLivedata.data('liveData') === undefined) {
39 - location.reload();
40 - } else {
41 - associatedLivedata.data('liveData').updateEntries();
42 - }
35 + let associatedLivedata = uploadForm.prevAll('.liveData').first();
36 + associatedLivedata.data('liveData').updateEntries();
43 43   }
44 44   });
45 45  
... ... @@ -54,8 +54,7 @@
54 54   */
55 55   $(document).on('click', '.confluenceAttachmentsMacro .attachmentActions .actiondelete', function(e) {
56 56   e.preventDefault();
57 - // The 'xwiki-livedata' CSS class is present only before XWiki version 14.4.
58 - let liveData = $(e.currentTarget).closest('.liveData, .xwiki-livedata');
51 + let liveData = $(e.currentTarget).closest('.liveData');
59 59   var modal = liveData.nextAll('.deleteConfluenceAttachment');
60 60   modal.data('relatedTarget', e.currentTarget);
61 61   modal.modal('show');
... ... @@ -68,8 +68,7 @@
68 68   e.preventDefault();
69 69   var modal = $(e.currentTarget).closest('.deleteConfluenceAttachment');
70 70   var button = $(modal.data('relatedTarget'));
71 - // The 'xwiki-livedata' CSS class is present only before XWiki version 14.4.
72 - let liveData = button.closest('.liveData, .xwiki-livedata');
64 + let liveData = button.closest('.liveData');
73 73   var notification;
74 74  
75 75   $.ajax({
... ... @@ -78,13 +78,8 @@
78 78   notification = new XWiki.widgets.Notification(l10n['inProgress'], 'inprogress');
79 79   },
80 80   success : function() {
81 - // We do not have access to a liveData object before XWiki 14.4.
82 - if (liveData.data('liveData') !== undefined) {
83 - liveData.data('liveData').updateEntries();
84 - notification.replace(new XWiki.widgets.Notification(l10n['done'], 'done'));
85 - } else {
86 - location.reload();
87 - }
73 + liveData.data('liveData').updateEntries();
74 + notification.replace(new XWiki.widgets.Notification(l10n['done'], 'done'));
88 88   },
89 89   error: function() {
90 90   notification.replace(new XWiki.widgets.Notification(l10n['failed'], 'error'));
XWiki.StyleSheetExtension[0]
Code
... ... @@ -1,15 +1,3 @@
1 1  .confluenceAttachmentsMacro legend {
2 2   font-size: 1em;
3 3  }
4 - /* These should be deleted after upgrading to a XWiki parent >= 14.6. */
5 -.attachmentMimeType {
6 - color: $theme.textSecondaryColor;
7 - font-size: 32px;
8 - height: 32px;
9 - line-height: 32px;
10 - text-align: center;
11 -}
12 -.attachmentMimeType img {
13 - max-height: 32px;
14 - max-width: 48px;
15 -}
XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -100,14 +100,6 @@
100 100   #end
101 101  #end
102 102  
103 -#macro (supportsAttachJSON $supportsAttachJSON)
104 - ## The attachments.json code uses macros from attachment_macro.vm, so the existence of the attachments livedata macro
105 - ## is an indicator that the template exists and is adapted for livedata.
106 - #template('attachment_macros.vm')
107 - #set ($macroResult = "#showAttachmentsLiveData($doc 'id')")
108 - #set ($supportsAttachJSON = $macroResult.startsWith('{{liveData'))
109 -#end
110 -
111 111  ## Display a liveData with attachments from the specified document.
112 112  #macro (showConfluenceAttachmentsLiveData $attachmentsDoc $liveDataId)
113 113   #set ($liveDataConfig = {
... ... @@ -147,14 +147,8 @@
147 147   'className': 'XWiki.AllAttachments',
148 148   "\$doc": "$attachmentsDoc"
149 149   })
150 - ## Since the correct attachmentsjson.vm was added in XWiki 14.8, we use a copy of its code for backwards compatibility.
151 - #supportsAttachJSON($supportsAttachJSON)
152 - #if ($supportsAttachJSON)
153 - #set ($discard = $sourceParams.put('template', 'xpart.vm'))
154 - #set ($discard = $sourceParams.put('vm', 'attachmentsjson.vm'))
155 - #else
156 - #set ($discard = $sourceParams.put('resultPage', 'Confluence.Macros.AttachmentsJSON'))
157 - #end
142 + #set ($discard = $sourceParams.put('template', 'xpart.vm'))
143 + #set ($discard = $sourceParams.put('vm', 'attachmentsjson.vm'))
158 158   #getLiveDataSort($liveDataSort)
159 159   #if ($invalidSortBy)
160 160   {{warning}}