From d0c17e063ce8b1a04687986cb91b07e09e582c47 Mon Sep 17 00:00:00 2001 From: LucasC Date: Tue, 22 Apr 2025 17:38:48 +0200 Subject: [PATCH 1/6] XWIKI-23129: Add an `end of DOM` UIXP * Added the UIXP * Used the UIXP for one of the blocking modals for XWIKI-22669 TODO: handle the #exportModal and #exportTreeModal in a similar way. Note that they are currently defined in a .vm so the exact implementation will probably not be the same. --- .../Code/NotificationsWatchUIX.xml | 210 +++++++++++++++--- .../main/resources/templates/htmlfooter.vm | 7 + 2 files changed, 187 insertions(+), 30 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-ui/src/main/resources/XWiki/Notifications/Code/NotificationsWatchUIX.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-ui/src/main/resources/XWiki/Notifications/Code/NotificationsWatchUIX.xml index 4a52915b2315..6e2fae9014e7 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-ui/src/main/resources/XWiki/Notifications/Code/NotificationsWatchUIX.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-ui/src/main/resources/XWiki/Notifications/Code/NotificationsWatchUIX.xml @@ -502,17 +502,6 @@ #set($discard = $xwiki.ssx.use('XWiki.Notifications.Code.NotificationsWatchUIX')) #set($discard = $xwiki.jsx.use('XWiki.Notifications.Code.NotificationsWatchUIX')) #set ($watchedStatus = $services.notification.watch.getLocationWatchedStatus($doc)) -## If the watched status informs that the filter is about children it means it's a filter for the space, -## so we should look for ancestor of the space. -#set ($refForAncestorFirstFilter = $doc.getDocumentReference()) -#if ($watchedStatus == 'WATCHED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS' || $watchedStatus == 'BLOCKED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS') - #set ($refForAncestorFirstFilter = $doc.getDocumentReference().parent) -#end -#set ($ancestorFirstFilter = $services.notification.watch.getFirstFilteredAncestor($refForAncestorFirstFilter)) -#if ($ancestorFirstFilter) - #set ($ancestorRef = $ancestorFirstFilter.left) - #set ($ancestorWatchStatus = $ancestorFirstFilter.right) -#end ## FIXME: the different icons should use the icon service #set ($iconWhenWatched = 'fa-bell') #set ($iconWhenNotSet = 'fa-bell-o') @@ -531,21 +520,172 @@ #set ($watchIcon = $iconWhenCustom) #set ($watchText = $services.localization.render('notifications.watch.button.status.custom', 'html/5.0', [])) #end -## TODO: better way for that? -#set ($isTerminal = ($doc.getDocumentReference().name != 'WebHome')) +#set ($buttonTitle = $services.localization.render('notifications.watch.button.title', [$watchText])) +{{html clean='false'}} +<div class="btn-group" id="watchButton"> + <a href="#" role="button" title="$escapetool.xml($buttonTitle)" class="btn btn-default" data-toggle="modal" data-target="#watchModal"> + <span class="fa $watchIcon"></span> $watchText + </a> +</div> +{{/html}} +#end +{{/velocity}} + + + + org.xwiki.plaftorm.menu.content + + + org.xwiki.platform.notification.watch + + + order=39000 + + + wiki + + + + XWiki.Notifications.Code.NotificationsWatchUIX + 1 + XWiki.UIExtensionClass + ad3c491c-2532-48c7-8559-286a36a90cfb + + XWiki.UIExtensionClass + + + + + + + + + 0 + 0 + select + + async_cached + 3 + Cached + 0 + com.xpn.xwiki.objects.classes.BooleanClass + + + 0 + 0 + select + forbidden + 0 + 1 + async_context + 4 + Context elements + 0 + , + |, + 5 + 0 + action=Action|doc.reference=Document|doc.revision|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.headers|request.parameters=Request parameters|request.remoteAddr|request.session|request.url=Request URL|request.wiki=Request wiki|sheet|user=User|wiki=Wiki + com.xpn.xwiki.objects.classes.StaticListClass + + + 0 + 0 + select + + async_enabled + 2 + Asynchronous rendering + 0 + com.xpn.xwiki.objects.classes.BooleanClass + + + 0 + Text + content + 1 + Executed Content + 0 + 25 + 120 + 0 + com.xpn.xwiki.objects.classes.TextAreaClass + + + 0 + extensionPointId + 5 + Extension Point ID + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + 0 + name + 6 + Extension ID + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + PureText + 0 + PureText + parameters + 7 + Extension Parameters + 0 + 10 + 40 + 0 + com.xpn.xwiki.objects.classes.TextAreaClass + + + 0 + 0 + select + forbidden + 0 + 0 + scope + 8 + Extension Scope + 0 + + |, + 1 + 0 + wiki=Current Wiki|user=Current User|global=Global + com.xpn.xwiki.objects.classes.StaticListClass + + + + 0 + + + + + + 0 + + + {{velocity}} +#if (!$isGuest) #macro (_displayOption $attributeName $optionValue $translationSuffix $iconName $panelClass) <div class="panel panel-default $panelClass"> <div class="panel-radio"> <input type="radio" name="watch-option" id="option-$attributeName" value="$optionValue" /> </div> <div class="panel-heading" role="tab" id="heading-$attributeName"> - <div class="panel-title" id="title-$attributeName"> - $services.icon.renderHTML("$iconName") - <label for="option-$attributeName">$services.localization.render("notifications.watch.modal.option.${translationSuffix}.title", 'html/5.0', [])</label> - <a role="button" data-toggle="collapse" data-parent="#watch-options-accordion" href="#xhint-$attributeName" aria-controls="xhint-$attributeName"> - <span class="help-icon">$services.icon.renderHTML('question')</span> - </a> - </div> + <div class="panel-title" id="title-$attributeName"> + $services.icon.renderHTML("$iconName") + <label for="option-$attributeName">$services.localization.render("notifications.watch.modal.option.${translationSuffix}.title", 'html/5.0', [])</label> + <a role="button" data-toggle="collapse" data-parent="#watch-options-accordion" href="#xhint-$attributeName" aria-controls="xhint-$attributeName"> + <span class="help-icon">$services.icon.renderHTML('question')</span> + </a> + </div> </div><!-- end panel heading --> <div id="xhint-$attributeName" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-$attributeName"> <div class="panel-body xHint"> @@ -554,6 +694,23 @@ </div><!-- end collapsed xhint --> </div><!-- end panel --> #end + +#set ($watchedStatus = $services.notification.watch.getLocationWatchedStatus($doc)) +## If the watched status informs that the filter is about children it means it's a filter for the space, +## so we should look for ancestor of the space. +#set ($refForAncestorFirstFilter = $doc.getDocumentReference()) +#if ($watchedStatus == 'WATCHED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS' || $watchedStatus == 'BLOCKED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS') + #set ($refForAncestorFirstFilter = $doc.getDocumentReference().parent) +#end +#set ($ancestorFirstFilter = $services.notification.watch.getFirstFilteredAncestor($refForAncestorFirstFilter)) +#if ($ancestorFirstFilter) + #set ($ancestorRef = $ancestorFirstFilter.left) + #set ($ancestorWatchStatus = $ancestorFirstFilter.right) +#end + +## TODO: better way for that? +#set ($isTerminal = ($doc.getDocumentReference().name != 'WebHome')) + #set ($watchPageOption = "#_displayOption('watch-page','watchPage','watchpage','page','')") #set ($watchSpaceOption = "#_displayOption('watch-space','watchSpace','watchspace','chart-organisation','')") #set ($unwatchPageAndWatchSpaceOption = "#_displayOption('unwatch-page-watch-space','unwatchPageWatchSpace','watchspace','chart-organisation','')") @@ -567,14 +724,7 @@ #set ($unblockPageOption = "#_displayOption('unblock-page','unblockPage','unblockpage','page','')") #set ($unblockSpaceOption = "#_displayOption('unblock-space','unblockSpace','unblockspace','chart-organisation','')") #set ($unblockWikiOption = "#_displayOption('unblock-wiki','unblockWiki','unblockwiki','world','wiki-option')") - -#set ($buttonTitle = $services.localization.render('notifications.watch.button.title', [$watchText])) {{html clean='false'}} -<div class="btn-group" id="watchButton"> - <a href="#" role="button" title="$escapetool.xml($buttonTitle)" class="btn btn-default" data-toggle="modal" data-target="#watchModal"> - <span class="fa $watchIcon"></span> $watchText - </a> -</div> <div class="modal fade" tabindex="-1" role="dialog" id="watchModal"> <div class="modal-dialog" role="document"> <div class="modal-content"> @@ -688,13 +838,13 @@ {{/velocity}} - org.xwiki.plaftorm.menu.content + org.xwiki.platform.template.body.end - org.xwiki.platform.notification.watch + org.xwiki.platform.notification.watchModal - order=39000 + wiki diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm index fe99dc2d34cc..2c56a270cf1a 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm @@ -23,6 +23,13 @@ #if ($services.debug.isEnabled()) #template('debug.vm') #end + #else ## Portlet Mode From 9d63d7b917000ddc8cb19e04558eb609d2350fa5 Mon Sep 17 00:00:00 2001 From: LucasC Date: Wed, 23 Apr 2025 14:30:11 +0200 Subject: [PATCH 2/6] XWIKI-23129: Add an `end of DOM` UIXP * Handled the #exportModal and #exportTreeModal move --- .../src/main/resources/flamingo/export_modal.vm | 8 ++++---- .../src/main/resources/flamingo/menus_content.vm | 4 ---- .../src/main/resources/templates/htmlfooter.vm | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/export_modal.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/export_modal.vm index 7b6de7960f21..8d99bcaee91d 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/export_modal.vm +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/export_modal.vm @@ -23,7 +23,7 @@ *# #macro(exportModal) #set ($discard = $xwiki.jsfx.use('uicomponents/exporter/exporter.js', {'forceSkinAction': true})) - - + #if ($doc.documentReference.name == 'WebHome' && $xwiki.exists('XWiki.ExportDocumentTree')) #exportTreeModal() #end @@ -203,7 +203,7 @@ #end ## #macro(exportTreeModal) - - + #end diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/menus_content.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/menus_content.vm index d7bb939866f3..80e3a3e09732 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/menus_content.vm +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/menus_content.vm @@ -107,10 +107,6 @@ ## Note: Both the admin actions and the more actions menus are now merged into one. #if ($displayAdminMenu || $displayMoreActionsMenu) #displayOptionsMenu() - #if ($canView) - #template("export_modal.vm") - #exportModal() - #end #end #end #set ($discard = $topStaticExtensions.add( { 'content': "$!actionsMenu", 'order': 40000})) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm index 2c56a270cf1a..7cd5af896a49 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/htmlfooter.vm @@ -24,6 +24,10 @@ #template('debug.vm') #end