Changes for page LiveTable View Sheet

Last modified by Martin Výlet on 19.03.2025 21:26

From version 6.1
edited by Martin Výlet
on 19.03.2025 21:26
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/17.1.0]
To version 2.1
edited by superadmin
on 06.01.2023 13:11
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/14.10.2]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.vyl0022
1 +XWiki.superadmin
Content
... ... @@ -11,8 +11,16 @@
11 11   ## Display the live table only if it was generated.
12 12   #if ($doc.content.length() > 0)
13 13   = $services.localization.render('platform.appwithinminutes.appLiveTableHeading') =
14 -
15 - {{include reference="" author="target"/}}
14 + ## We don't use the Include macro (with empty reference) because we want the content to be executed with the rights
15 + ## of the current document rather than the rights of the sheet. This is important because the user can modify the
16 + ## content of the application home page which means we could execute untrusted content with the rights of the sheet.
17 + ## Ideally we should use the Display macro with a parameter to disable the sheet, but we don't have this parameter.
18 + ## We don't clean the HTML content because getRenderedContent() should produce clean HTML, unless the user has
19 + ## disabled the HTML cleaning, in which case he will get what he asked for. Note that one good reason to disable
20 + ## HTML cleaning is to preserve the whitespaces in the attribute values.
21 + ## Escape {{ in the rendered content to be sure that the HTML macro is not closed unintentionally.
22 + {{html clean="false"}}$doc.getRenderedContent($doc.content,
23 + $doc.syntax.toIdString()).replace('{{', '{{'){{/html}}
16 16   #end
17 17  #end
18 18  
... ... @@ -51,7 +51,7 @@
51 51   (((
52 52   = $services.localization.render('platform.appwithinminutes.appHomePageActionsHeading') =
53 53   #if ($hasCreateData)
54 - * [[{{displayIcon name="add"/}} $services.localization.render('platform.appwithinminutes.appHomePageAddEntryHint')>>||anchor="AddNewEntry" class="action add"]]##
62 + * [[$services.localization.render('platform.appwithinminutes.appHomePageAddEntryHint')>>||anchor="AddNewEntry" class="action add"]]##
55 55   #if ("$!templateProvider.getValue('terminal')" == '1')
56 56   #set ($entryReference = $services.model.createDocumentReference('__entryName__', $dataSpaceRef))
57 57   #else
... ... @@ -60,7 +60,6 @@
60 60   #end
61 61   ## We need to set the title if we want to be able to sort or filter the doc.title live table column.
62 62   #set ($params = {
63 - 'form_token': $services.csrf.token,
64 64   'template': "${className}Template",
65 65   'title': '__entryName__',
66 66   'parent': $services.model.serialize($doc.documentReference, 'local')
... ... @@ -84,10 +84,10 @@
84 84   'appName': $doc.space,
85 85   'resolve': true
86 86   }))
87 - * [[{{displayIcon name="edit"/}} $services.localization.render('platform.appwithinminutes.appHomePageEditAppLabel')>>AppWithinMinutes.CreateApplication||queryString="$queryString" class="action edit"]]
94 + * [[$services.localization.render('platform.appwithinminutes.appHomePageEditAppLabel')>>AppWithinMinutes.CreateApplication||queryString="$queryString" class="action edit"]]
88 88   #end
89 89   #if ($hasEditTranslations)
90 - * [[{{displayIcon name="translate"/}} $services.localization.render('platform.appwithinminutes.appHomePageTranslateAppLabel')>>path:${xwiki.getURL($translationsRef, 'edit', 'editor=wiki')}||class="action translate"]]
97 + * [[$services.localization.render('platform.appwithinminutes.appHomePageTranslateAppLabel')>>path:${xwiki.getURL($translationsRef, 'edit', 'editor=wiki')}||class="action translate"]]
91 91   #end
92 92   #if ($hasDeleteData)
93 93   #set ($deleteDataURL = $xwiki.getURL('AppWithinMinutes.DeleteApplication', 'view', $escapetool.url({
... ... @@ -96,7 +96,7 @@
96 96   'scope': 'entries',
97 97   'xredirect': $doc.getURL()
98 98   })))
99 - * [[{{displayIcon name="cross"/}} $services.localization.render('platform.appwithinminutes.appHomePageDeleteEntriesLabel')>>path:${deleteDataURL}||class="action deleteData"]]
106 + * [[$services.localization.render('platform.appwithinminutes.appHomePageDeleteEntriesLabel')>>path:${deleteDataURL}||class="action deleteData"]]
100 100   #end
101 101   #if ($hasDeleteApplication)
102 102   #set ($deleteAppURL = $xwiki.getURL('AppWithinMinutes.DeleteApplication', 'view', $escapetool.url({
... ... @@ -104,7 +104,7 @@
104 104   'resolve': true,
105 105   'xredirect': $doc.getURL()
106 106   })))
107 - * [[{{displayIcon name="trash"/}} $services.localization.render('platform.appwithinminutes.appHomePageDeleteAppLabel')>>path:${deleteAppURL}||class="action delete"]]
114 + * [[$services.localization.render('platform.appwithinminutes.appHomePageDeleteAppLabel')>>path:${deleteAppURL}||class="action delete"]]
108 108   #end
109 109   )))
110 110   #end
... ... @@ -204,7 +204,7 @@
204 204   #set ($classFullName = $doc.getValue('class'))
205 205   #if ("$!classFullName" == '' || !$xwiki.exists($classFullName))
206 206   {{warning}}
207 - {{translation key="platform.appwithinminutes.appHomePageMovedWarning"/}}
214 + $services.icon.render('warning') {{translation key="platform.appwithinminutes.appHomePageMovedWarning"/}}
208 208   {{/warning}}
209 209  
210 210   #end
locate.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Admin
Size
... ... @@ -1,0 +1,1 @@
1 +746 bytes
Content
XWiki.JavaScriptExtension[0]
Code
... ... @@ -59,8 +59,7 @@
59 59   * Rename Application
60 60   */
61 61  require(['jquery', 'bootstrap', 'xwiki-form-validation-async'], function($) {
62 - ## Note: if not currentApp request param is not passed, we default to the wiki home page reference to avoid a NPE
63 - #set ($currentDocReference = $xwiki.getDocument("$!request.currentApp").getDocumentReference())
62 + #set ($currentDocReference = $xwiki.getDocument($request.currentApp).getDocumentReference())
64 64   // if we cannot find any extension related to this page app, it's not part of an extension.
65 65   var isNotAnExtension = $services.extension.xar.getInstalledExtensions($currentDocReference).isEmpty();
66 66  
XWiki.StyleSheetExtension[0]
Code
... ... @@ -16,10 +16,30 @@
16 16   background: none no-repeat scroll 0 center transparent;
17 17   display: block;
18 18   font-size: .8em;
19 - padding: .3em .3em .3em .3em;
19 + padding: .3em .3em .3em 20px;
20 20   text-transform: uppercase;
21 21  }
22 22  
23 +#actionBox .action.edit {
24 + background-image: url("$xwiki.getSkinFile('icons/silk/application_edit.png')");
25 +}
26 +
27 +#actionBox .action.translate {
28 + background-image: url("$doc.getAttachmentURL('locate.png')");
29 +}
30 +
31 +#actionBox .action.delete {
32 + background-image: url("$xwiki.getSkinFile('icons/silk/application_delete.png')");
33 +}
34 +
35 +#actionBox .action.deleteData {
36 + background-image: url("$xwiki.getSkinFile('icons/silk/application_form_delete.png')");
37 +}
38 +
39 +#actionBox .action.add {
40 + background-image: url("$xwiki.getSkinFile('icons/silk/add.png')");
41 +}
42 +
23 23  #entryNamePopup {
24 24   margin-right: 20px;
25 25  }