Skip to content

XWIKI-22433: Provide consistency in info / warning / error class usages in templates #3555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
07f39f0
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 2, 2024
d686447
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 2, 2024
358f386
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 3, 2024
66d842d
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 3, 2024
049209d
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 3, 2024
82afaa7
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 4, 2024
66b5761
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 4, 2024
93a4ccf
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Sep 4, 2024
8757b5d
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Sep 5, 2024
fd3109f
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 6, 2024
98a16a1
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Sep 16, 2024
c96ff86
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 16, 2024
72bbd40
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 16, 2024
47b7d7c
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 17, 2024
3a0b6bc
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 18, 2024
3e07ab8
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Sep 19, 2024
49c9494
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 9, 2024
dae36ae
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 9, 2024
3884bde
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
d9f7855
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Oct 11, 2024
6def82e
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
a5f8f97
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
1c7764b
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
016dc7a
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
422b1c4
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
734ab84
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
a0e4fdc
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 11, 2024
6452b5c
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 15, 2024
950cbdb
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 15, 2024
35814cc
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 15, 2024
6fbafbd
Revert "XWIKI-22433: Provide consistency in info / warning / error cl…
Sereza7 Oct 15, 2024
07dfee6
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Oct 15, 2024
2fc20cf
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Dec 2, 2024
6b9cce1
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 2, 2024
87fe4a4
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 3, 2024
f75a44c
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 3, 2024
92fab0b
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Dec 9, 2024
4b60a92
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
3e3ddb8
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
8d2d174
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
161d3d0
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
20b86ef
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
c131356
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
7a3e02c
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Dec 9, 2024
b5394a3
Merge branch 'master' into XWIKI-22433
Sereza7 Jan 28, 2025
b9b5395
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Feb 5, 2025
f676d11
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 5, 2025
77a3aab
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 5, 2025
1a1a7bd
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Feb 6, 2025
87e33d5
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 6, 2025
158fb6c
Merge branch 'master' into XWIKI-22433
Sereza7 Feb 19, 2025
5894057
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 24, 2025
397f9ee
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
5400575
Merge branch 'xwiki:master' into XWIKI-22433
Sereza7 Feb 25, 2025
3ee6cb7
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
42ee86b
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
66bc66e
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
2aff1cb
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
12534be
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
d2ff384
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
1591912
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
d985cc1
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
0939fda
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Feb 25, 2025
4854870
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Mar 18, 2025
693fdc6
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Mar 18, 2025
6575331
Open XWIKI-22433: Provide consistency in info / warning / error class…
Sereza7 Mar 18, 2025
f3f63de
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Mar 18, 2025
9b30dec
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Mar 18, 2025
cd384ea
Merge branch 'master' into XWIKI-22433
Sereza7 Apr 14, 2025
3c04908
XWIKI-22433: Provide consistency in info / warning / error class usag…
Sereza7 Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@
#macro (maybeShowDeleteUserWarning $userReference $right)
#countPagesLastModifiedBy($userReference)
#if ($pageCount > 0)
<div class="box errormessage xform">
{{/html}}

{{error cssClass="xform"}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this xform here? for style only? My understanding is that the goal of the ticket was to simplify the usages of errormessage, so it feels a bit too complex than it should here?

Copy link
Contributor Author

@Sereza7 Sereza7 Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this xform here? for style only?

Yup, I want to minimize the changes in the actual content produced in order to minimize breaking customization and other features. I forgot the exact context here, but I don't want to break the form (style and functionality) just because I removed a class. Having this class is supported by the XWiki macro, so I figured it was okay to refactore things like that.

My understanding is that the goal of the ticket was to simplify the usages of errormessage

The goal of the PR is to factorize their code. This way, next time we update the message boxes, there won't be inconsistencies popping up everywhere (and this also fixes inconsistencies that popped up since we added icons with XWIKI-21452 :) ).
In order to do so, in all of the scripts here, I either use the new velocimacro, or the XWiki macro if possible.
$${\color{orange}ONGOING}$$

{{html clean="false"}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm and why do we need the clean false here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right before starting the velocity macro, we closed the "current" html macro.
The only use of #maybeShowDeleteUserWarning is a few lines above, in #deleteUserModalContent. In this macro, we can see that the opening HTML block has the parameter clean="false". Since I do not want to break anything, the safest bet is to avoid cleaning the HTML in the content of the error XWiki macro too (It was already in a noncleaned HTML macro before).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the safest bet is to avoid cleaning the HTML in the content of the error XWiki macro too

that's a safest bet to avoid regression without performing a check, but I'm not sure it's a good solution or a good reflex to have: IMO using clean=false attribute in html macro should only be used for specific identified cases. It's quite possible I'm wrong, but I don't really see what we couldn't use clean true here. IMO it worth using clean true by default, and then checking manually the behaviour. Longer to test, for sure, but better for long term maintenance.

Copy link
Member

@tmortagne tmortagne Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that another potential reason to use clean="false" is performance, since the cleanup can be expensive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I didn't thought about that. Now I guess better be safe than fast in this specific condition? wdyt?

Copy link
Member

@tmortagne tmortagne Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't have a strong opinion on either side. I guess it depends on how complex the content is and how often it's used.

Copy link
Contributor Author

@Sereza7 Sereza7 Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File using clean="false" or clean=false position Modified Reason Step 1
AdminUsersSheet.xml inside macro content Yes (no reason found)
$${\color{green}DONE}$$
--
AdminUsersSheet.xml after macro content No backward compatibility of the maybeShowDeleteUserWarning velocimacro.
LiveTableEditSheet.xml inside macro content Yes, remove the HTML macro.
$${\color{green}DONE}$$
This is not even HTML syntax (with standard values of translations)
CreateWiki.xml before macro content ( x2 ) No We don't create HTML that is correct inside this macro alone (elements are opened but closed only in another HTML macro).
CreateWiki.xml after macro content ( x2 ) No We don't create HTML that is correct inside this macro alone (elements are not opened but closed only here).
InvitationCommon.xml inside macro content Yes, remove the HTML block
$${\color{lightgreen}Done}$$
This is not even HTML syntax (with standard values of translations)
InvitationCommon.xml after macro content Yes, but just add wiki=false
$${\color{lightgreen}Done}$$
We want to set the same HTML macro context as before the macro (see L133). In order to do so, we should have both wiki=false and clean=false
ExtensionBreakingQuestion.form.vm before macro content $${\color{lightgreen}Done}$$ We don't create HTML that is correct inside this macro alone (elements are opened but closed only in another HTML macro).
ExtensionBreakingQuestion.form.vm after macro content $${\color{lightgreen}Done}$$ We don't create HTML that is correct inside this macro alone (elements are not opened but closed only here)
ExtensionBreakingQuestion.form.vm inside macro content $${\color{lightgreen}Done}$$ --
XClassBreakingQuestion.form.vm before macro content $${\color{lightgreen}Done}$$ We don't create HTML that is correct inside this macro alone (elements are opened but closed only in another HTML macro).
XClassBreakingQuestion.form.vm after macro content $${\color{lightgreen}Done}$$ We don't create HTML that is correct inside this macro alone (elements are not opened but closed only here)
XClassBreakingQuestion.form.vm inside macro content $${\color{lightgreen}Done}$$ --

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surli I reviewed all the places where I deactivated the HTML cleaning. I updated most of them but left a few as they were, see the table above. Sometimes the update was to remove the HTML macro entirely because its whole content is jsut one translation, which is not supposed to contain any HTML...

#set ($pageIndexReference = $services.model.createDocumentReference(
$userReference.wikiReference.name, 'Main', 'AllDocs'))
#set ($pageIndexURL = $xwiki.getURL($pageIndexReference) + '#|t=alldocs&doc.author=' +
Expand Down Expand Up @@ -273,7 +276,10 @@
[$rightTranslation]))</span>
</dd>
</dl>
</div>
{{/html}}
{{/error}}

{{html clean="false"}}
#end
#end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<div class="XWikiColorThemeDisplayer">
#set ($colorThemeExists = $xwiki.exists($services.model.resolveDocument($value)))
#if ("$!value" != '' && !$colorThemeExists)
<p class="errormessage">$services.localization.render('admin.colorthemes.invalidtheme', $escapetool.xml($value))</p>
#error(<p>$services.localization.render('admin.colorthemes.invalidtheme', $escapetool.xml($value))</p>)
#end

#if ($isSubWiki && (!$flamingoThemesFromMainWiki.isEmpty() || !$colibriThemesFromMainWiki.isEmpty()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ $xwiki.jsfx.use('js/xwiki/actionbuttons/actionButtons.js', true)
$escapetool.xml($sectionDisplayName)
</span>
#if(!$hasAccess)
<br/><span class="errormessage">$services.localization.render('xe.admin.configurable.sectionIconNoAccess')</span>
<br/>#inlineError($services.localization.render('xe.admin.configurable.sectionIconNoAccess'))
#end
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
#displayAnnotationBoxButtons('edit')
</form>
#else
<div class="box infomessage">$services.localization.render('annotations.action.edit.error.notfound')</div>
#info($services.localization.render('annotations.action.edit.error.notfound'))
#end
</div>
#end
Expand Down Expand Up @@ -152,7 +152,7 @@
##<div class="clearfloats"></div>
#displayAnnotationFromReference($ann $mode $docRef)
#else
<div class="box infomessage">$services.localization.render('annotations.action.view.error.notfound')</div>
#info($services.localization.render('annotations.action.view.error.notfound'))
#end
</div>
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@
</div>
<div class="clearfloats" />
#else
<div class="box infomessage">$services.localization.render('annotations.settings.error.wrongsyntax')</div>
#info($services.localization.render('annotations.settings.error.wrongsyntax'))
#end
#else
<div class="box infomessage">$services.localization.render('annotations.settings.error.notarget')</div>
#info($services.localization.render('annotations.settings.error.notarget'))
#end
</div>
{{/html}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ xcontext.put('propertyCustomDisplayer', new PropertyCustomDisplayer(xcontext))
["#pageLink($sheetReference)"])
</span>
#else
<span class="warningmessage">
$services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning')
</span>
#inlineWarning($services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning'))
#end
</dd>
<dt>
Expand Down Expand Up @@ -705,7 +703,7 @@ xcontext.put('propertyCustomDisplayer', new PropertyCustomDisplayer(xcontext))
#updateAndSaveTranslations
#if ($action == 'save')
#if ($errorMessage)
<div class="box errormessage">$errorMessage</div>
#error($errorMessage)
#elseif ("$!request.wizard" == 'true')
## Redirect to next wizard step.
#set ($className = $stringtool.removeEnd($doc.fullName, 'Class'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,10 @@
</dl>
#set ($appHomeRef = $services.model.resolveDocument('', 'default', $appReference))
#if ($appDescriptor || $xwiki.exists($appHomeRef) || $xwiki.exists($appClassRef))
<div class="box warningmessage">
$services.localization.render('platform.appwithinminutes.appNameIsUsedWarning')
</div>
#warning($services.localization.render('platform.appwithinminutes.appNameIsUsedWarning'))
#end
#if (!$services.security.authorization.hasAccess('script', $xcontext.userReference, $appHomeRef))
<div class="box errormessage">
$escapetool.xml($services.localization.render('platform.appwithinminutes.appHomePageNoScriptRight'))
</div>
#error($escapetool.xml($services.localization.render('platform.appwithinminutes.appHomePageNoScriptRight')))
#end
#end
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@
#updateAndSaveIcon()
#if ($action == 'save')
#if ($errorMessage)
{{html clean="false"}}
<div class="box errormessage">$errorMessage</div>
{{/html}}

{{error}}{{html clean="false"}}$errorMessage{{/html}}{/error}}

#else
## Redirect to view mode.
$response.sendRedirect($doc.getURL())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,8 @@
#end

#macro (renameAppModalBody)
<div class="box infomessage">
$services.icon.renderHTML('info')
$services.localization.render('appWithinMinutes.renameApp.changeAppTitleInfo')
</div>
<div class="box warningmessage">
$services.icon.renderHTML('warning')
$services.localization.render('appWithinMinutes.renameApp.regenerateAppCodeWarning')
</div>
#info($services.localization.render('appWithinMinutes.renameApp.changeAppTitleInfo'))
#warning($services.localization.render('appWithinMinutes.renameApp.regenerateAppCodeWarning'))
<div class="hidden">
<input type="hidden" name="form_token" value="$!escapetool.xml($services.csrf.token)" />
<input type="hidden" name="oldAppReference" value="$escapetool.xml(
Expand Down Expand Up @@ -242,7 +236,7 @@
#set ($classFullName = $doc.getValue('class'))
#if ("$!classFullName" == '' || !$xwiki.exists($classFullName))
{{warning}}
$services.icon.render('warning') {{translation key="platform.appwithinminutes.appHomePageMovedWarning"/}}
{{translation key="platform.appwithinminutes.appHomePageMovedWarning"/}}
{{/warning}}

#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,5 @@
#end
#else
$response.setStatus(404)
<div class="box errormessage">
$escapetool.xml($services.localization.render('attachment.move.status.notFound'))
</div>
#error($escapetool.xml($services.localization.render('attachment.move.status.notFound')))
#end
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@

#set ($indexJobStatus = $services.job.getJobStatus(['extension_security']))
#if ($indexJobStatus)
&lt;div class="box infomessage"&gt;
## We use the velocity macro here instead of the XWiki macro, in order to keep HTML in the content
## With the XWiki macro, the progress bar is not properly rendered.
#define ($infoMessageContent)
#if ($indexJobStatus.state != 'FINISHED')
$escapetool.xml($services.localization.render('extension.security.indexed.started', [$xwiki.formatDate($indexJobStatus.startDate)]))
#set ($discard = $xwiki.jsfx.use('uicomponents/job/job.js'))
Expand All @@ -101,13 +103,14 @@
&lt;div class="xcontent job-status" data-url="$escapetool.xml($jobStatusURL)"&gt;
#displayJobProgressBar($indexJobStatus, true)
&lt;/div&gt;
#else
$escapetool.xml($services.localization.render('extension.security.indexed.on', [$xwiki.formatDate($indexJobStatus.startDate)]))
#end
&lt;/div&gt;
#else
&lt;div class="box warningmessage"&gt;$escapetool.xml($services.localization.render('extension.security.indexed.nojob'))&lt;/div&gt;
$escapetool.xml($services.localization.render('extension.security.indexed.on', [$xwiki.formatDate($indexJobStatus.startDate)]))
#end
#end
#info($infoMessageContent)
#else
{{warning}}$escapetool.xml($services.localization.render('extension.security.indexed.nojob')){{/warning}}
#end
{{/html}}
#end
{{/velocity}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@
#set ($parameters = [$count, $htmlLink])
{{html wiki='false' clean='false'}}
&lt;li&gt;
&lt;div class='box errormessage'&gt;
$services.localization.render('extension.security.notification.message', $parameters)
&lt;/div&gt;
#error($services.localization.render('extension.security.notification.message', $parameters))
&lt;/li&gt;
{{/html}}
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@

#if ($recommended)
#if (!$extensions.iterator().hasNext())
&lt;div class="box warningmessage"&gt;$services.localization.render('extensions.search.recommended.fallback', ["&lt;em&gt;$!escapetool.xml($request.search)&lt;/em&gt;"])&lt;/div&gt;
#warning($services.localization.render('extensions.search.recommended.fallback', ["&lt;em&gt;$!escapetool.xml($request.search)&lt;/em&gt;"]))
## Search again with the recommended filter
#set ($extensions = $repository.search("$!request.search", $paginationParams.firstItem, $paginationParams.itemsPerPage))
#set ($totalHits = $extensions.totalHits)
#set ($recommended = false)
#elseif (!$customExtensionFilter)
&lt;div class="box infomessage"&gt;
#define ($infoHeaderContent)
#if ($compatible)
$services.localization.render('extensions.search.compatiblerecommended.disclaimer')
#else
Expand All @@ -142,12 +142,13 @@
&lt;input type="submit" value="${escapetool.xml($services.localization.render('extensions.search.all.label'))}" class="btn btn-default"/&gt;
#end
&lt;/form&gt;
&lt;/div&gt;
#end
#info("$infoHeaderContent")
#end
#end

#if (!$extensions.iterator().hasNext())
&lt;div class="box infomessage"&gt;$services.localization.render($noResultsMessageKey, ["&lt;em&gt;$!escapetool.xml($request.search)&lt;/em&gt;"])&lt;/div&gt;
#info($services.localization.render($noResultsMessageKey, ["&lt;em&gt;$!escapetool.xml($request.search)&lt;/em&gt;"]))
#else
#if ($totalHits &amp;&amp; $totalHits &gt; $paginationParams.itemsPerPage)
#set ($hasPagination = true)
Expand All @@ -165,39 +166,46 @@
#end

#if ($indexed)
#define ($formContent)
&lt;form action="${xwiki.relativeRequestURL}"&gt;
#if ($request.section)
&lt;input type="hidden" name="section" value="${escapetool.xml($request.section)}" /&gt;
#end
&lt;input type="hidden" name="search" value="$!{escapetool.xml($request.search)}" /&gt;
&lt;input type="hidden" name="recommended" value="$recommended" /&gt;
&lt;input type="hidden" name="indexed" value="$indexed" /&gt;
&lt;input type="hidden" name="compatible" value="$compatible" /&gt;
#if ($indexJobStatus.state != 'RUNNING')
&lt;input type="submit" value="${escapetool.xml($services.localization.render('extensions.search.indexed.reindex'))}" name="index_start" class="btn btn-default"/&gt;
#end
&lt;/form&gt;
#end
#set ($indexJobStatus = $repository.getStatus("wiki:${xcontext.database}"))
#if ($indexJobStatus)
&lt;div class="box infomessage"&gt;
#if ($indexJobStatus.state != 'FINISHED')
$escapetool.xml($services.localization.render('extensions.search.indexed.started', [$xwiki.formatDate($indexJobStatus.startDate)]))
#set ($discard = $xwiki.jsfx.use('uicomponents/job/job.js'))
#set ($jobStatusURL = $doc.getURL('get', $escapetool.url({
'xpage': 'job_status_json',
'outputSyntax': 'plain',
'jobId': $indexJobStatus.request.id
})))
&lt;div class="xcontent job-status" data-url="$escapetool.xml($jobStatusURL)"&gt;
#displayJobProgressBar($indexJobStatus, true)
&lt;/div&gt;
#define ($infoFooterContent)
$escapetool.xml($services.localization.render('extensions.search.indexed.started', [$xwiki.formatDate($indexJobStatus.startDate)]))
&lt;div class="xcontent job-status" data-url="$escapetool.xml($jobStatusURL)"&gt;
#displayJobProgressBar($indexJobStatus, true)
&lt;/div&gt;
#end
#else
$escapetool.xml($services.localization.render('extensions.search.indexed.on', [$xwiki.formatDate($indexJobStatus.startDate)]))
#define ($infoFooterContent)
$escapetool.xml($services.localization.render('extensions.search.indexed.on', [$xwiki.formatDate($indexJobStatus.startDate)]))
#end
#end
#info("$infoFooterContent
$formContent")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm you should really add a comment if the carriage return is on purpose here

Copy link
Contributor Author

@Sereza7 Sereza7 Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked it again and it doesn't seem to me like this is needed. I just figured out it wouldn't hurt since it's HTML syntax, and it makes it a bit more readable.
$${\color{orange}ONGOING}$$

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes it a bit more readable

you mean the produced HTML is more readable? Because for the script a space would be more readable IMO. Now I won't block merging for this if you feel it's better.

#else
&lt;div class="box warningmessage"&gt;$escapetool.xml($services.localization.render('extensions.search.indexed.nojob'))
#warning("$escapetool.xml($services.localization.render('extensions.search.indexed.nojob'))
$formContent")
#end
&lt;form action="${xwiki.relativeRequestURL}"&gt;
#if ($request.section)
&lt;input type="hidden" name="section" value="${escapetool.xml($request.section)}" /&gt;
#end
&lt;input type="hidden" name="search" value="$!{escapetool.xml($request.search)}" /&gt;
&lt;input type="hidden" name="recommended" value="$recommended" /&gt;
&lt;input type="hidden" name="indexed" value="$indexed" /&gt;
&lt;input type="hidden" name="compatible" value="$compatible" /&gt;
#if ($indexJobStatus.state != 'RUNNING')
&lt;input type="submit" value="${escapetool.xml($services.localization.render('extensions.search.indexed.reindex'))}" name="index_start" class="btn btn-default"/&gt;
#end
&lt;/form&gt;
&lt;/div&gt;
#end
#end
&lt;/div&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@
#set($finished = $jobStatus.state.name() == 'FINISHED')
#if ($finished)
#if (!$jobStatus.logTail.hasLogLevel('ERROR'))
&lt;div class="box successmessage"&gt;
Done.
&lt;/div&gt;
#success('Done.')
#else
&lt;div class="box errormessage"&gt;
Error has been found during the conversion !
&lt;/div&gt;
#error('Error has been found during the conversion !')
#end
#end
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@
#end
#else
$response.setStatus(404)
<div class="box errormessage">
$services.localization.render('core.copy.status.notFound')
</div>
#error($services.localization.render('core.copy.status.notFound'))
#end
#end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
* Displays a class name without its space prefix. XML-escapes the output.
*#
#macro(cleanClassname $classname)$!{escapetool.xml($classname.substring($classname.indexOf('.')).substring(1))}#end

#*
* Displays a warning box, with an extra class. Note that the implementation of this macro should be very close to the
* one of the #warning macro defined in the web templates macros.
* This is the only place where we use this extraClass feature, so the implementation is contained here.
* Note that the exact context this content is rendered in is not fixed, using the XWiki macro
* would have ended up in unstable behaviour.
*#
#macro (warningWithExtraClass $text $extraClass)
<div class="box warningmessage ${extraClass}">
<span class="icon-block">$services.icon.renderHTML('warning')</span>
<span class="sr-only">$services.localization.render('warning')</span>
$text
</div>
#end
##
#*
* Display an object
Expand Down Expand Up @@ -79,7 +94,7 @@
</dl>
#set ($deprecatedProperties = $class.getDeprecatedObjectProperties($obj))
#if ($deprecatedProperties.size() > 0)
<div class="box warningmessage deprecatedProperties">
#define ($warningMessageContent)
<strong>$services.localization.render('core.editors.object.removeDeprecatedProperties.info', [${escapetool.xml($class.name)}])</strong>
<dl>
#foreach ($prop in $deprecatedProperties)
Expand All @@ -94,7 +109,8 @@
$services.localization.render('core.editors.object.removeDeprecatedProperties.link')
</a>
</div>
</div>
#end
#warningWithExtraClass($warningMessageContent 'deprecatedProperties')
#end
</div>
#end
Expand Down Expand Up @@ -245,10 +261,11 @@
#if ($mustSync) #break #end
#end
#if ($mustSync)
<div class="box warningmessage deprecatedProperties">
#define ($warningMessageContent)
$services.localization.render('core.editors.object.removeDeprecatedProperties.all.info')
<div><a class="syncProperties syncAllProperties" href="$doc.getURL('objectsync')" title="$services.localization.render('core.editors.object.removeDeprecatedProperties.all.link.tooltip')">$services.localization.render('core.editors.object.removeDeprecatedProperties.all.link')</a></div>
</div>
#end
#warningWithExtraClass($warningMessageContent 'deprecatedProperties')
#end
#end ## checkPropertyDeprecation
##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
#livetable_filters($collist $colprops $classname)
<tr class="xwiki-livetable-initial-message">
<td colspan="${columnCount}">
<div class="warningmessage">$services.localization.render('platform.livetable.environmentCannotLoadTableMessage')</div>
#warning($services.localization.render('platform.livetable.environmentCannotLoadTableMessage'))
</td>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,5 @@
#end
#else
$response.setStatus(404)
<div class="box errormessage">
$services.localization.render('core.rename.status.notFound')
</div>
#error($services.localization.render('core.rename.status.notFound'))
#end
Loading