#if ($request.previousUIId && $request.previousUIVersion && $wiki == $request.wiki)
## We shouldn't get here unless JavaScript is disabled (the form is submitted with AJAX normally).
-
+ "$!escapetool.xml($request.extensionVersion)"]))
## DEBUG START: Check if there is any job status associated with the specified extension.
#getExtensionJobStatus($request.extensionId, $request.extensionVersion $jobStatus)
#if ($jobStatus)
## Normally we shouldn't get here.
-
We found an extension job associated with the missing extension:
+ #error("We found an extension job associated with the missing extension:")
#displayExtensionJobStatus($jobStatus)
#end
## DEBUG STOP
@@ -1290,7 +1290,7 @@ $namespace##
## Send error back.
$response.sendError(400, $errorMessage)
#else
-
+{{/html}}#end
+
+## We want to use the XWiki macro here because we need its parameters
+{{error cssClass='deleteWarningXClass' title='$escapetool.xml($services.localization.render("job.question.XClassBreakingQuestion.${job.type}.forbiddenTitle"))'}}
+ $errorMessageContent
+{{/error}}
#else
-
+ #error($services.localization.render('core.rename.status.notFound'))
#end
From 6def82e9c67b961eb3c1b83cd6a5ed04ad32b1b0 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Fri, 11 Oct 2024 15:20:04 +0200
Subject: [PATCH 17/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part H - fix
---
.../src/main/resources/XWiki/ColorThemePropertyDisplayer.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ColorThemePropertyDisplayer.xml b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ColorThemePropertyDisplayer.xml
index 20ca5c413324..c0d66c2af6cc 100644
--- a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ColorThemePropertyDisplayer.xml
+++ b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-ui/src/main/resources/XWiki/ColorThemePropertyDisplayer.xml
@@ -129,7 +129,7 @@
<div class="XWikiColorThemeDisplayer">
#set ($colorThemeExists = $xwiki.exists($services.model.resolveDocument($value)))
#if ("$!value" != '' && !$colorThemeExists)
- #error("<p>$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()))
From a5f8f97e733afc87ca0b1e08537c3697ec194459 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Fri, 11 Oct 2024 15:23:41 +0200
Subject: [PATCH 18/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part F - fix
---
.../src/main/resources/AppWithinMinutes/ClassEditSheet.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml
index caf9bf4db2be..aba665d1fbfe 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml
@@ -228,7 +228,7 @@ xcontext.put('propertyCustomDisplayer', new PropertyCustomDisplayer(xcontext))
["#pageLink($sheetReference)"])
</span>
#else
- #warning($services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning'))
+ #inlineWarning($services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning'))
#end
</dd>
<dt>
From 1c7764b9ace41e9bf77d1df2d1b593e2fc39e4ff Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Fri, 11 Oct 2024 15:43:23 +0200
Subject: [PATCH 19/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part C - fix
---
.../main/resources/XWiki/Extension/Security/Code/Admin.xml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-ui/src/main/resources/XWiki/Extension/Security/Code/Admin.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-ui/src/main/resources/XWiki/Extension/Security/Code/Admin.xml
index def47ae2ebb7..ade2012d31b8 100644
--- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-ui/src/main/resources/XWiki/Extension/Security/Code/Admin.xml
+++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-security/xwiki-platform-extension-security-ui/src/main/resources/XWiki/Extension/Security/Code/Admin.xml
@@ -91,7 +91,7 @@
#if ($indexJobStatus)
## 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.
- #info("
+ #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'))
@@ -100,13 +100,14 @@
'outputSyntax': 'plain',
'jobId': $indexJobStatus.request.id
})))
- <div class=""xcontent job-status"" data-url=""$escapetool.xml($jobStatusURL)"">
+ <div class="xcontent job-status" data-url="$escapetool.xml($jobStatusURL)">
#displayJobProgressBar($indexJobStatus, true)
</div>
#else
$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
From 016dc7afaca12bb94ea43f42124aaac5f0330676 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Fri, 11 Oct 2024 15:57:39 +0200
Subject: [PATCH 20/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part B - fix
---
.../src/main/resources/XWiki/Extensions.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-ui/src/main/resources/XWiki/Extensions.xml b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-ui/src/main/resources/XWiki/Extensions.xml
index 83b22b63ded5..5e358dfe79a7 100644
--- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-ui/src/main/resources/XWiki/Extensions.xml
+++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-ui/src/main/resources/XWiki/Extensions.xml
@@ -166,7 +166,7 @@
#end
#if ($indexed)
- #macro (formContent)
+ #define ($formContent)
<form action="${xwiki.relativeRequestURL}">
#if ($request.section)
<input type="hidden" name="section" value="${escapetool.xml($request.section)}" />
@@ -201,10 +201,10 @@
#end
#end
#info("$infoFooterContent
- #formContent()")
+ $formContent")
#else
#warning("$escapetool.xml($services.localization.render('extensions.search.indexed.nojob'))
- #formContent()")
+ $formContent")
#end
#end
#end
From 422b1c4f761d1b168ac35418dca22858b6d54d84 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Fri, 11 Oct 2024 16:21:38 +0200
Subject: [PATCH 21/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part F - fix
---
.../src/main/resources/flamingo/editobject.vm | 26 +++++++++++++++----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
index 4e17a0c23218..e1c8bfbfe878 100644
--- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
+++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
@@ -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)
+
#end
From 6fbafbdfc90b4bdf2b027aa2906e81c0db27ae0d Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Tue, 15 Oct 2024 15:32:58 +0200
Subject: [PATCH 27/39] Revert "XWIKI-22433: Provide consistency in info /
warning / error class usages in templates"
This reverts commit fd3109fd71cbaad9510e93b6a3f2daf3ba651fd3.
---
.../pom.xml | 5 ---
.../AttachmentGalleryPickerMacro.java | 39 ++++++------------
.../AttachmentGalleryPickerMacroTest.java | 40 +++++++------------
3 files changed, 28 insertions(+), 56 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/pom.xml b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/pom.xml
index a074eabb0ee6..a8e998389914 100644
--- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/pom.xml
+++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/pom.xml
@@ -54,11 +54,6 @@
xwiki-rendering-transformation-macro${rendering.version}
-
- org.xwiki.rendering
- xwiki-rendering-macro-message
- ${rendering.version}
- org.xwiki.platformxwiki-platform-skin-api
diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/main/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacro.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/main/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacro.java
index 81d795145b87..bcf7036ed667 100644
--- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/main/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacro.java
+++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/main/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacro.java
@@ -33,10 +33,7 @@
import org.xwiki.localization.ContextualLocalizationManager;
import org.xwiki.rendering.block.Block;
import org.xwiki.rendering.block.GroupBlock;
-import org.xwiki.rendering.internal.macro.message.WarningMessageMacro;
import org.xwiki.rendering.macro.AbstractMacro;
-import org.xwiki.rendering.macro.MacroExecutionException;
-import org.xwiki.rendering.macro.box.BoxMacroParameters;
import org.xwiki.rendering.transformation.MacroTransformationContext;
import org.xwiki.skinx.SkinExtension;
@@ -81,10 +78,6 @@ public class AttachmentGalleryPickerMacro extends AbstractMacro execute(AttachmentGalleryPickerMacroParameters parameters, St
if (parameters.getTarget() != null) {
attachmentPickerParameters.put("data-xwiki-attachment-picker-target", parameters.getTarget());
}
- BoxMacroParameters warningParams1 = new BoxMacroParameters();
- warningParams1.setCssClass("attachmentPickerNoResults hidden");
- BoxMacroParameters warningParams2 = new BoxMacroParameters();
- warningParams2.setCssClass("attachmentPickerGlobalSelection hidden");
- try {
- return List.of(new GroupBlock(List.of(
- // Search block.
- new GroupBlock(List.of(), Map.of(BLOCK_PARAM_CLASS, "attachmentPickerSearch")),
- // Results block.
- new GroupBlock(Map.of(BLOCK_PARAM_CLASS, "attachmentPickerResults")),
- // No results block.
- new GroupBlock(warningMacro.execute(warningParams1,
- this.l10n.getTranslationPlain("attachment.picker.macro.notResult.message"), context)),
- new GroupBlock(warningMacro.execute(warningParams2,
- this.l10n.getTranslationPlain("attachment.picker.macro.globalSelection.message"), context))
- ), attachmentPickerParameters));
- } catch (MacroExecutionException e) {
- throw new RuntimeException(e);
- }
+
+ return List.of(new GroupBlock(List.of(
+ // Search block.
+ new GroupBlock(List.of(), Map.of(BLOCK_PARAM_CLASS, "attachmentPickerSearch")),
+ // Results block.
+ new GroupBlock(Map.of(BLOCK_PARAM_CLASS, "attachmentPickerResults")),
+ // No results block.
+ new GroupBlock(List.of(this.l10n.getTranslation("attachment.picker.macro.notResult.message").render()),
+ Map.of(BLOCK_PARAM_CLASS, "attachmentPickerNoResults hidden box warningmessage")),
+ new GroupBlock(
+ List.of(this.l10n.getTranslation("attachment.picker.macro.globalSelection.message").render()),
+ Map.of(BLOCK_PARAM_CLASS, "attachmentPickerGlobalSelection hidden box warningmessage"))
+ ), attachmentPickerParameters));
}
}
diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/test/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacroTest.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/test/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacroTest.java
index 901306ba6d82..c947188dc37a 100644
--- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/test/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacroTest.java
+++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-picker/xwiki-platform-attachment-picker-macro/src/test/java/org/xwiki/attachment/picker/internal/AttachmentGalleryPickerMacroTest.java
@@ -29,11 +29,9 @@
import org.mockito.Mock;
import org.xwiki.attachment.picker.AttachmentGalleryPickerMacroParameters;
import org.xwiki.localization.ContextualLocalizationManager;
+import org.xwiki.localization.Translation;
import org.xwiki.rendering.block.Block;
import org.xwiki.rendering.block.GroupBlock;
-import org.xwiki.rendering.internal.macro.message.WarningMessageMacro;
-import org.xwiki.rendering.macro.MacroExecutionException;
-import org.xwiki.rendering.macro.box.BoxMacroParameters;
import org.xwiki.rendering.transformation.MacroTransformationContext;
import org.xwiki.skinx.SkinExtension;
import org.xwiki.test.junit5.mockito.ComponentTest;
@@ -42,8 +40,7 @@
import static java.util.Map.entry;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -72,10 +69,6 @@ class AttachmentGalleryPickerMacroTest
@Mock
private MacroTransformationContext macroTransformationContext;
-
- @MockComponent
- @Named("warning")
- private WarningMessageMacro warningMacro;
@Mock
private Block translationRenderBlockNoResult;
@@ -86,20 +79,13 @@ class AttachmentGalleryPickerMacroTest
@BeforeEach
void setUp()
{
- String translationRenderNoResult = "noresult";
- String translationRenderGlobalSelection = "globalselection";
- when(this.l10n.getTranslationPlain("attachment.picker.macro.notResult.message"))
- .thenReturn(translationRenderNoResult);
- when(this.l10n.getTranslationPlain("attachment.picker.macro.globalSelection.message"))
- .thenReturn(translationRenderGlobalSelection);
- try {
- when(warningMacro.execute(any(BoxMacroParameters.class), eq(translationRenderNoResult), any(MacroTransformationContext.class)))
- .thenReturn(List.of(this.translationRenderBlockNoResult));
- when(warningMacro.execute(any(BoxMacroParameters.class), eq(translationRenderGlobalSelection), any(MacroTransformationContext.class)))
- .thenReturn(List.of(this.translationRenderBlockGlobalSelection));
- } catch (MacroExecutionException e) {
- throw new RuntimeException(e);
- }
+ Translation translationNoResult = mock(Translation.class);
+ Translation translationGlobalSelection = mock(Translation.class);
+ when(this.l10n.getTranslation("attachment.picker.macro.notResult.message")).thenReturn(translationNoResult);
+ when(this.l10n.getTranslation("attachment.picker.macro.globalSelection.message"))
+ .thenReturn(translationGlobalSelection);
+ when(translationNoResult.render()).thenReturn(this.translationRenderBlockNoResult);
+ when(translationGlobalSelection.render()).thenReturn(this.translationRenderBlockGlobalSelection);
}
@Test
@@ -111,8 +97,12 @@ void execute()
assertEquals(List.of(new GroupBlock(List.of(
new GroupBlock(List.of(), Map.of("class", "attachmentPickerSearch")),
new GroupBlock(Map.of("class", "attachmentPickerResults")),
- new GroupBlock(List.of(this.translationRenderBlockNoResult)),
- new GroupBlock(List.of(this.translationRenderBlockGlobalSelection))
+ new GroupBlock(List.of(this.translationRenderBlockNoResult),
+ Map.of("class", "attachmentPickerNoResults hidden box warningmessage")),
+ new GroupBlock(
+ List.of(this.translationRenderBlockGlobalSelection),
+ Map.of("class", "attachmentPickerGlobalSelection hidden box warningmessage"))
+
), Map.ofEntries(
entry("id", "my-id"),
entry("class", "attachmentGalleryPicker"),
From 07dfee67da038bb31ebb8cb925348c11a3db0418 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Tue, 15 Oct 2024 15:35:12 +0200
Subject: [PATCH 28/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part E - reverted java changes
---
.../pom.xml | 6 ----
.../display/XObjectDisplayerProvider.java | 28 +++++--------------
2 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml
index 69bf926c4c1c..6c60a6806f02 100644
--- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml
+++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/pom.xml
@@ -76,11 +76,5 @@
${commons.version}test
-
- org.xwiki.rendering
- xwiki-rendering-macro-message
- ${rendering.version}
- compile
-
diff --git a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/src/main/java/org/xwiki/platform/security/requiredrights/internal/display/XObjectDisplayerProvider.java b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/src/main/java/org/xwiki/platform/security/requiredrights/internal/display/XObjectDisplayerProvider.java
index ae3638c708b1..e6f7cc520c90 100644
--- a/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/src/main/java/org/xwiki/platform/security/requiredrights/internal/display/XObjectDisplayerProvider.java
+++ b/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-requiredrights/xwiki-platform-security-requiredrights-default/src/main/java/org/xwiki/platform/security/requiredrights/internal/display/XObjectDisplayerProvider.java
@@ -21,21 +21,21 @@
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import org.xwiki.component.annotation.Component;
import org.xwiki.localization.ContextualLocalizationManager;
+import org.xwiki.localization.Translation;
import org.xwiki.rendering.block.Block;
import org.xwiki.rendering.block.CompositeBlock;
import org.xwiki.rendering.block.FormatBlock;
import org.xwiki.rendering.block.GroupBlock;
-import org.xwiki.rendering.internal.macro.message.WarningMessageMacro;
import org.xwiki.rendering.listener.Format;
import com.xpn.xwiki.XWikiContext;
@@ -43,9 +43,6 @@
import com.xpn.xwiki.objects.classes.BaseClass;
import com.xpn.xwiki.objects.classes.PropertyClass;
import com.xpn.xwiki.objects.classes.TextAreaClass;
-import org.xwiki.rendering.macro.MacroExecutionException;
-import org.xwiki.rendering.macro.box.BoxMacroParameters;
-import org.xwiki.rendering.transformation.MacroTransformationContext;
/**
* Provider for a displayer for an XObject.
@@ -62,10 +59,6 @@ public class XObjectDisplayerProvider extends AbstractBlockSupplierProvider get(BaseObject object, Object... parameters)
@@ -92,8 +85,8 @@ public Supplier get(BaseObject object, Object... parameters)
.map(p -> new PropertyDisplay(p.getName(), null, p.getValue().toString(), false))
.collect(Collectors.toList());
- String removedPropertiesMessage =
- this.contextualLocalizationManager.getTranslationPlain("core.editors.object.removeDeprecatedProperties.info",xClass.getPrettyName());
+ Translation removedPropertiesMessage =
+ this.contextualLocalizationManager.getTranslation("core.editors.object.removeDeprecatedProperties.info");
return () -> {
// Display the properties
Block propertiesBlock = renderProperties(propertyNamesHintsValues);
@@ -101,18 +94,11 @@ public Supplier get(BaseObject object, Object... parameters)
// Display deprecated properties
if (!deprecatedPropertyNamesValues.isEmpty()) {
- BoxMacroParameters warningParams = new BoxMacroParameters();
- warningParams.setCssClass("deprecatedProperties");
- Block deprecatedPropertiesBlock = null;
- try {
- deprecatedPropertiesBlock = new GroupBlock(warningMacro.execute(warningParams,
- removedPropertiesMessage, new MacroTransformationContext()));
- } catch (MacroExecutionException e) {
- throw new RuntimeException(e);
- }
+ Block deprecatedPropertiesBlock =
+ new GroupBlock(Map.of(CLASS_ATTRIBUTE, "box warningmessage deprecatedProperties"));
if (removedPropertiesMessage != null) {
deprecatedPropertiesBlock.addChild(
- new FormatBlock(List.of(), Format.BOLD));
+ new FormatBlock(List.of(removedPropertiesMessage.render(xClass.getPrettyName())), Format.BOLD));
}
deprecatedPropertiesBlock.addChild(renderProperties(deprecatedPropertyNamesValues));
result.addChild(deprecatedPropertiesBlock);
From 6b9cce1fbefb87c115ba6647c3ef851314cccf94 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 2 Dec 2024 17:36:33 +0100
Subject: [PATCH 29/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Updated the velociMacros ** Added comments
on the message boxes macros. ** Set the genericMessage as an internal macro.
---
.../src/main/resources/templates/macros.vm | 28 +++++++++++++------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
index d72abd2d6c37..407b5391b13a 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
@@ -953,7 +953,9 @@ $html
### message
###
-#macro(genericMessage $text $classAffix $iconName $prettyNameKey $isInline)
+### This velocity macro aims at providing an element similar to a XWiki Macro-Message in places where this XWikiMacro
+### cannot be used.
+#macro(_genericMessage $text $classAffix $iconName $prettyNameKey $isInline)
<#if($isInline)span#{else}div#end class="box ${classAffix}message">
$services.icon.renderHTML($iconName)$services.localization.render($prettyNameKey)
@@ -961,36 +963,44 @@ $html
#if($isInline)span#{else}div#end>
#end
+## Display a block warning message with the content $text.
#macro(warning $text)
-#genericMessage($text 'warning' 'warning' 'warning')
+#_genericMessage($text 'warning' 'warning' 'warning')
#end
+## Display an inline warning message with the content $text.
#macro(inlineWarning $text)
-#genericMessage($text 'warning' 'warning' 'warning' true)
+#_genericMessage($text 'warning' 'warning' 'warning' true)
#end
+## Display a block error message with the content $text.
#macro(error $text)
-#genericMessage($text 'error' 'exclamation' 'error')
+#_genericMessage($text 'error' 'exclamation' 'error')
#end
+## Display an inline error message with the content $text.
#macro(inlineError $text)
- #genericMessage($text 'error' 'exclamation' 'error' true)
+ #_genericMessage($text 'error' 'exclamation' 'error' true)
#end
+## Display a block info message with the content $text.
#macro(info $text)
-#genericMessage($text 'info' 'info' 'info')
+#_genericMessage($text 'info' 'info' 'info')
#end
+## Display an inline info message with the content $text.
#macro(inlineInfo $text)
- #genericMessage($text 'info' 'info' 'info' true)
+ #_genericMessage($text 'info' 'info' 'info' true)
#end
+## Display a block success message with the content $text.
#macro(success $text)
-#genericMessage($text 'success' 'check' 'success')
+#_genericMessage($text 'success' 'check' 'success')
#end
+## Display an inline success message with the content $text.
#macro(inlineSuccess $text)
- #genericMessage($text 'success' 'check' 'success' true)
+ #_genericMessage($text 'success' 'check' 'success' true)
#end
#macro(message $text)
From 87fe4a4a9033dff7331aaa62f22753f75cdf524f Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Tue, 3 Dec 2024 11:33:40 +0100
Subject: [PATCH 30/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Added a reference to the newly created
issue for translations
---
.../src/main/resources/Filter/FilterStreamJobJSON.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xwiki-platform-core/xwiki-platform-filter/xwiki-platform-filter-ui/src/main/resources/Filter/FilterStreamJobJSON.xml b/xwiki-platform-core/xwiki-platform-filter/xwiki-platform-filter-ui/src/main/resources/Filter/FilterStreamJobJSON.xml
index 0c65a3c14996..9e09cd5ab1a0 100644
--- a/xwiki-platform-core/xwiki-platform-filter/xwiki-platform-filter-ui/src/main/resources/Filter/FilterStreamJobJSON.xml
+++ b/xwiki-platform-core/xwiki-platform-filter/xwiki-platform-filter-ui/src/main/resources/Filter/FilterStreamJobJSON.xml
@@ -43,6 +43,8 @@
#set($finished = $jobStatus.state.name() == 'FINISHED')
#if ($finished)
#if (!$jobStatus.logTail.hasLogLevel('ERROR'))
+ ## Remove when the following issue is resolved:
+ ## TODO XWIKI-22710: Add translations for FilterStreamJobJSON
#success('Done.')
#else
#error('Error has been found during the conversion !')
From f75a44cf02b6545d672d8ceab0751fe0656d96bf Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Tue, 3 Dec 2024 11:40:58 +0100
Subject: [PATCH 31/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Set the warningWithExtraClass velocimacro
as internal.
---
.../src/main/resources/flamingo/editobject.vm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
index e1c8bfbfe878..943af8cf8977 100644
--- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
+++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editobject.vm
@@ -38,7 +38,7 @@
* 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)
+#macro (_warningWithExtraClass $text $extraClass)
$services.icon.renderHTML('warning')$services.localization.render('warning')
From 4b60a9234c155ecc698d5c50025779dfef58cc9d Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 9 Dec 2024 13:56:48 +0100
Subject: [PATCH 32/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part C * Removed the TODO and implemented
the solution described by Michael
---
.../src/main/resources/XWiki/OfficeImporterAdmin.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-office/xwiki-platform-office-ui/src/main/resources/XWiki/OfficeImporterAdmin.xml b/xwiki-platform-core/xwiki-platform-office/xwiki-platform-office-ui/src/main/resources/XWiki/OfficeImporterAdmin.xml
index f4c2cfcf93e8..427af336cdd6 100644
--- a/xwiki-platform-core/xwiki-platform-office/xwiki-platform-office-ui/src/main/resources/XWiki/OfficeImporterAdmin.xml
+++ b/xwiki-platform-core/xwiki-platform-office/xwiki-platform-office-ui/src/main/resources/XWiki/OfficeImporterAdmin.xml
@@ -91,8 +91,7 @@
### Info about the place to modify the configuration
###
<p>
- ## TODO: we do not escape this string because we inject some HTML code. We should improve it.
- #info($services.localization.render('admin.ooserver.options.source', ['<span class="monospace">xwiki.properties</span>']))
+ #info($escapetool.html($services.localization.render('admin.ooserver.options.source', ['__VALUE__'])).replaceFirst('__VALUE__', '<span class="monospace">xwiki.properties</span>'))
</p>
<dl>
###
From 3e3ddb89322f2f1aa38f1f662c58bfde9fce772f Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 9 Dec 2024 14:05:48 +0100
Subject: [PATCH 33/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Fixed an inconsistency in the velocimacro
compared to the XWiki macro.
---
.../src/main/resources/templates/macros.vm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
index 407b5391b13a..82a697cefc67 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
@@ -959,7 +959,7 @@ $html
<#if($isInline)span#{else}div#end class="box ${classAffix}message">
$services.icon.renderHTML($iconName)$services.localization.render($prettyNameKey)
- $text
+
$text
#if($isInline)span#{else}div#end>
#end
From 8d2d174d8103556518f62867e909d8c9fe99852b Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 9 Dec 2024 15:12:16 +0100
Subject: [PATCH 34/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part F * Escaped the errorMessage * removed
the useless HTML macro.
---
.../main/resources/AppWithinMinutes/LiveTableEditSheet.xml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
index 5c1487fb0e16..90e176a4264e 100644
--- a/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
+++ b/xwiki-platform-core/xwiki-platform-appwithinminutes/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/LiveTableEditSheet.xml
@@ -337,9 +337,7 @@
#updateAndSaveIcon()
#if ($action == 'save')
#if ($errorMessage)
-
- {{error}}{{html clean="false"}}$errorMessage{{/html}}{/error}}
-
+ {{error}}$!escapetool.xml($errorMessage){/error}}
#else
## Redirect to view mode.
$response.sendRedirect($doc.getURL())
From 161d3d09292aaf65d9cd0db0882cbf49f897bfbb Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 9 Dec 2024 16:06:30 +0100
Subject: [PATCH 35/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part D * Updated the internal velocimacro
to also take into account equivalents to rarely used XWikiMacro parameters.
---
.../job/question/ExtensionBreakingQuestion.form.vm | 14 ++------------
.../src/main/resources/templates/macros.vm | 6 ++++--
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
index 1e9685702e76..8c2087ca21da 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
@@ -17,16 +17,11 @@
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
## ---------------------------------------------------------------------------
-##!source.syntax=xwiki/2.1
-{{velocity}}
#template('job/question/macros.vm')
-{{html clean=false}}
#questionHeader()
-{{/html}}
#set ($jobStatus = $job.status)
#set ($question = $jobStatus.question)
#define ($warningMessageContent)
-{{html clean=false}}
#questionButtons($jobStatus)
-{{/html}}#end
+#end
## We want to use the XWiki macro here because we need its parameters
-{{warning cssClass='deleteWarningExtensions' title='$escapetool.xml($services.localization.render("job.question.ExtensionBreakingQuestion.${job.type}.title"))'}}
-$warningMessageContent
-{{/warning}}
+#_genericMessage("$warningMessageContent", 'warning', 'warning', 'warning', false, 'deleteWarningExtensions', $escapetool.xml($services.localization.render("job.question.ExtensionBreakingQuestion.${job.type}.title")))
-{{html clean=false}}
#questionFooter()
-{{/html}}
-{{/velocity}}
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
index 82a697cefc67..7e757e7abb66 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/macros.vm
@@ -955,11 +955,13 @@ $html
### This velocity macro aims at providing an element similar to a XWiki Macro-Message in places where this XWikiMacro
### cannot be used.
-#macro(_genericMessage $text $classAffix $iconName $prettyNameKey $isInline)
- <#if($isInline)span#{else}div#end class="box ${classAffix}message">
+#macro(_genericMessage $text $classAffix $iconName $prettyNameKey $isInline $extraClass $title)
+ <#if($isInline)span#{else}div#end class="box ${classAffix}message $!{extraClass}">
$services.icon.renderHTML($iconName)$services.localization.render($prettyNameKey)
+ #if("$!title" != "")
$!title
#end
$text
+ #if("$!title" != "")
#end
#if($isInline)span#{else}div#end>
#end
From 20b86efed16cab5a8fe3fc1f7df64aace070a8e4 Mon Sep 17 00:00:00 2001
From: Sereza7
Date: Mon, 9 Dec 2024 16:19:41 +0100
Subject: [PATCH 36/39] XWIKI-22433: Provide consistency in info / warning /
error class usages in templates * Part D * Reverted the change of syntax for
XClassBreakingQuestion.form.vm
---
.../ExtensionBreakingQuestion.form.vm | 1 -
.../question/XClassBreakingQuestion.form.vm | 26 +++----------------
2 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
index 8c2087ca21da..5a1cf83354e7 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/ExtensionBreakingQuestion.form.vm
@@ -40,7 +40,6 @@
#questionButtons($jobStatus)
#end
-## We want to use the XWiki macro here because we need its parameters
#_genericMessage("$warningMessageContent", 'warning', 'warning', 'warning', false, 'deleteWarningExtensions', $escapetool.xml($services.localization.render("job.question.ExtensionBreakingQuestion.${job.type}.title")))
#questionFooter()
diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/XClassBreakingQuestion.form.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/XClassBreakingQuestion.form.vm
index fae5cae8fec8..7f1ea4e42071 100644
--- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/XClassBreakingQuestion.form.vm
+++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/job/question/XClassBreakingQuestion.form.vm
@@ -17,19 +17,14 @@
## Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
## ---------------------------------------------------------------------------
-##!source.syntax=xwiki/2.1
-{{velocity}}
#template('job/question/macros.vm')
#set ($jobStatus = $job.status)
#set ($question = $jobStatus.question)
-{{html clean=false}}
#questionHeader()
-{{/html}}
#if ($question.isRefactoringForbidden())
#define ($errorMessageContent)
-{{html clean=false}}
-{{/html}}#end
-
-## We want to use the XWiki macro here because we need its parameters
-{{error cssClass='deleteWarningXClass' title='$escapetool.xml($services.localization.render("job.question.XClassBreakingQuestion.${job.type}.forbiddenTitle"))'}}
- $errorMessageContent
-{{/error}}
+#end
+#_genericMessage("$errorMessageContent", 'error', 'exclamation', 'error', false, 'deleteWarningXClass', $escapetool.xml($services.localization.render("job.question.XClassBreakingQuestion.${job.type}.forbiddenTitle")))
#else
#define ($warningMessageContent)
-{{html clean=false}}