Changes for page KanbanBoardMacro

Last modified by XWiki Demo Admin on 2026/06/09 11:38

From version 2.1
edited by XWiki Demo Admin
on 2026/06/09 11:38
Change comment: Install extension [com.xwiki.task:application-task-ui/3.11.0]
To version 1.1
edited by XWiki Demo Admin
on 2026/05/28 16:13
Change comment: Install extension [org.xwiki.contrib:application-task-ui/2.5.1]

Summary

Details

Page properties
Content
... ... @@ -5,9 +5,6 @@
5 5  * ##user## [optional, default=$xcontext.userReference] define the user for who tasks are assigned
6 6  * ##space## [optional, default=TaskManager] define the space to look for tasks
7 7  * ##project## [optional, default=] define the project to look for tasks
8 -* ##colors## [optional, default=green,blue,orange] define the colors of the Kanban columns
9 -* ##columns## [optional, default=ToDo,InProgress,Done] define the statuses to display as Kanban columns
10 -* ##columnWidth## [optional, default=32%] define the width of all Kanban column
11 11  
12 12  Example:
13 13  
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,1 +1,0 @@
1 -long
Code
... ... @@ -1,49 +1,0 @@
1 -require(['jquery'], function ($) {
2 -
3 - /**
4 - * Handles the fetching of the modal and the lazy loading of the css/js.
5 - */
6 - $(document).on('click', '.space-picker-kanban-parameter', function () {
7 - let URL = new XWiki.Document('SpacePicker', 'TaskManager').getURL('get');
8 - $.get(URL)
9 - .done(function (data) {
10 - $('body').append(`<div class='spacePickerKnbModal'> ${data} </div>`);
11 - $('.kanbanSpacePicker').modal('show');
12 - // Initialize UI elements that are lazy loaded.
13 - $(document).trigger('xwiki:dom:updated', { 'elements': $('.spacePickerKnbModal').toArray()});
14 - })
15 - .fail(function(){
16 - console.error('Failed to retrieve the space picker modal');
17 - });
18 - })
19 -
20 - $(document).on('show.bs.modal', '.kanbanSpacePicker', function () {
21 - $('.modal.macro-editor-modal.in').hide();
22 - })
23 -
24 - $(document).on('hidden.bs.modal', '.kanbanSpacePicker', function () {
25 - $('.modal.macro-editor-modal.in').show();
26 - // We remove the modal from the page
27 - $('.spacePickerKnbModal').remove();
28 - })
29 - /**
30 - * Handles the select button of the modal. If a space is selected it will return it's reference otherwise it will
31 - * return an empty string.
32 - */
33 - $(document).on('click', '.kanbanSpaceSelector', function () {
34 - // We remove the modal again
35 - selectedSpace = $('.xtree .jstree-clicked:last').attr('id');
36 - //Root element and we need to replace with an empty string so we can select all the tasks.
37 - if (selectedSpace === 'wiki:xwiki_anchor' || selectedSpace === 'document:xwiki:Main.WebHome_anchor') {
38 - selectedSpace = "";
39 - }
40 - else {
41 - selectedSpace = selectedSpace.replace('space:xwiki:', "").replace("_anchor", "");
42 -
43 - }
44 - $('.space-picker-kanban-parameter').val(selectedSpace);
45 - $('.kanbanSpacePicker').modal('hide');
46 - $('.modal.macro-editor-modal.in').show();
47 - })
48 -});
49 -
XWiki.WikiMacroClass[1]
Macro code
... ... @@ -1,20 +1,9 @@
1 1  {{velocity}}
2 -#set($discard = $xwiki.ssx.use('TaskManager.KanbanBoardMacro'))
3 3  ## The xwql variable is used by the awmkanban macro called from this one.
4 4  #set ($xwql = '')
5 5  #set($user = "$!{xcontext.macro.params.user}")
6 -#set ($columnWidth = "$!{xcontext.macro.params.columnWidth}")
7 -#set ($colors = "$!{xcontext.macro.params.colors}")
8 8  #if($user != '')
9 - #set ($users = $user.split(','))
10 - #foreach ($user in $users)
11 - #if ($xwql.length() > 0)
12 - #set ($xwql = "$xwql OR")
13 - #end
14 - ## The task contains at least one of the specified users.
15 - #set ($xwql = "$xwql obj.assignee LIKE '%$escapetool.sql($user),%' OR obj.assignee LIKE '%$escapetool.sql($user)'")
16 - #end
17 - #set ($xwql = "($xwql)")
6 + #set($xwql = "obj.assignee = '$escapetool.sql($user)'")
18 18  #end
19 19  #set($space = "$!{xcontext.macro.params.space}")
20 20  #if($space != '')
... ... @@ -21,36 +21,15 @@
21 21   #if ($xwql.length() > 0)
22 22   #set ($xwql = "$xwql and")
23 23   #end
24 - #set($xwql = "${xwql} (doc.space like '$escapetool.sql($space).%' or doc.space = '$escapetool.sql($space)')")
13 + #set($xwql = "${xwql} doc.space = '$escapetool.sql($space)'")
25 25  #end
26 26  #set($project = "$!{xcontext.macro.params.project}")
27 27  #if($project != '')
28 - #set ($xwqlProjects = '')
29 - #set ($projects = $project.split(','))
30 - #foreach ($project in $projects)
31 - #if ($xwqlProjects.length() > 0)
32 - #set ($xwqlProjects = "$xwqlProjects OR")
33 - #end
34 - #set ($xwqlProjects = "$xwqlProjects obj.project = '$escapetool.sql($project)'")
35 - #end
36 36   #if ($xwql.length() > 0)
37 37   #set ($xwql = "$xwql and")
38 38   #end
39 - #set ($xwql = "$xwql ($xwqlProjects)")
20 + #set($xwql = "$xwql obj.project = '$escapetool.sql($project)'")
40 40  #end
41 -#set ($columns = "$!{xcontext.macro.params.columns}")
42 -#set ($order = "$!{xcontext.macro.params.order}")
43 -#set ($limit = "$!{xcontext.macro.params.limit}")
44 -{{awmkanban
45 - className="TaskManager.TaskManagerClass"
46 - category="status"
47 - displayedCategoryColumns="$!escapetool.xml($columns)"
48 - title="name"
49 - columns="assignee,progress,duedate"
50 - width="$!escapetool.xml($columnWidth)"
51 - colors="$!escapetool.xml($colors)"
52 - order="$!escapetool.xml($order)"
53 - limit="$!escapetool.xml($limit)"
54 -/}}
55 55  {{/velocity}}
56 56  
24 +{{awmkanban className="TaskManager.TaskManagerClass" category="status" title="name" columns="assignee,progress,duedate" width="32%"/}}
Default categories
... ... @@ -1,1 +1,0 @@
1 -Content
XWiki.WikiMacroParameterClass[2]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.task.UserReferenceList
XWiki.WikiMacroParameterClass[3]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.pickers.SuggestSpaceReference
XWiki.WikiMacroParameterClass[4]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -java.util.List<com.xwiki.task.ProjectReference>
XWiki.WikiMacroParameterClass[5]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -java.util.List<com.xwiki.task.TaskStatus>
XWiki.WikiMacroParameterClass[6]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -green,blue,orange
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -colors
XWiki.WikiMacroParameterClass[7]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -32%
Parameter description
... ... @@ -1,1 +1,0 @@
1 -The width of each Kanban column, specified in any css units (example: 32%, 500px, 30em, etc..).
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -columnWidth
XWiki.WikiMacroParameterClass[8]
Parameter name
... ... @@ -1,1 +1,0 @@
1 -order
XWiki.WikiMacroParameterClass[9]
Parameter default value
... ... @@ -1,1 +1,0 @@
1 -20
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -limit
Parameter type
... ... @@ -1,1 +1,0 @@
1 -com.xpn.xwiki.objects.classes.NumberClass