Changes for page Tour

Last modified by superadmin on 2017/11/28 14:52
From empty
To version 1.1
edited by superadmin
on 2017/11/28 14:52
Change comment: Install extension [org.xwiki.contrib:application-tour-ui/1.1]

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +$services.localization.render('tour.app.name')
Parent
... ... @@ -1,0 +1,1 @@
1 +xwiki:Main.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XWikiGuest
1 +xwiki:XWiki.superadmin
Hidden
... ... @@ -1,1 +1,1 @@
1 -false
1 +true
Content
... ... @@ -1,0 +1,26 @@
1 +{{velocity}}
2 +#set ($columnsProperties = {
3 + 'doc.title': {"type": "text", "size":10,"link":"view"},
4 + 'isActive': {"type": "text", "size":10, "sortable":true, "filterable": false},
5 + 'targetPage': {"type":"text","size":10},
6 + 'targetClass': {"type":"text","size":10},
7 + '_actions': {"sortable":false,"filterable":false,"html":true,"actions":["edit","delete"]}
8 +})
9 +#set ($options = {
10 + 'className': 'TourCode.TourClass',
11 + 'resultPage': 'TourCode.TourLiveTableResults',
12 + 'translationPrefix': 'tour.livetable.',
13 + 'tagCloud': true,
14 + 'rowCount': 15,
15 + 'maxPages': 10,
16 + 'selectedColumn': 'doc.title',
17 + 'defaultOrder': 'asc',
18 + 'queryFilters': 'currentlanguage'
19 +})
20 +#set ($columns = ['doc.title', 'isActive', 'targetPage'])
21 +#if ($isAdvancedUser)
22 + #set ($discard = $columns.add('targetClass'))
23 +#end
24 +#set ($discard = $columns.add('_actions'))
25 +#livetable('tour' $columns $columnsProperties $options)
26 +{{/velocity}}
AppWithinMinutes.LiveTableClass[0]
Class
... ... @@ -1,0 +1,1 @@
1 +TourCode.TourClass
Live Table Columns
... ... @@ -1,0 +1,1 @@
1 +doc.title isActive targetPage _actions
Description
... ... @@ -1,0 +1,1 @@
1 +This application provides the ability to create tours for any page.
XWiki.DocumentSheetBinding[0]
Sheet
... ... @@ -1,0 +1,1 @@
1 +TourCode.WebHomeSheet
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,53 @@
1 +require(['jquery', 'xwiki-events-bridge'], function ($) {
2 + 'use strict';
3 +
4 + /**
5 + * Add a 'launch tour' button into the 'actions' columns.
6 + */
7 + var addLaunchButton = function (row) {
8 + // Do not add the button if the tour is not active or if the target page is not set
9 + if (row.find('.targetPage').text() == '-' || row.find('.isActive').text() != '$escapetool.javascript($services.localization.render("yes"))') {
10 + return;
11 + }
12 + var targetPage = XWiki.Model.resolve(row.find('.targetPage').text(), XWiki.EntityType.DOCUMENT);
13 + var targetPageDocument;
14 + // Two behaviours depending of the handling of the Nested Pages feature.
15 + if (XWiki.Document.initializeFromReference) {
16 + targetPageDocument = new XWiki.Document(targetPage);
17 + } else {
18 + targetPageDocument = new XWiki.Document(targetPage.name,
19 + targetPage.extractReferenceValue(XWiki.EntityType.SPACE));
20 + }
21 +
22 + // Add a launch tour link to the actions column.
23 + if (row.find('.actionLaunch').length == 0) {
24 + $('<a class="action actionLaunch">$services.icon.renderHTML("play") $escapetool.javascript($escapetool.xml($services.localization.render("tour.livetable._actions.launch")))</a>')
25 + .attr('href', targetPageDocument.getURL('view', 'startTour=true'))
26 + .css('padding-left', '1px').appendTo(row.find('.actions'));
27 + }
28 + }
29 +
30 + /**
31 + * Add the launch button into each livetable raw.
32 + */
33 + var initLivetableResults = function () {
34 + $('#tour tr').each( function() {
35 + addLaunchButton($(this));
36 + });
37 + }
38 + $(document).on('xwiki:livetable:ready', initLivetableResults);
39 + $(document).ready(initLivetableResults);
40 +
41 + /**
42 + * Add the launch button into each new livetable raw.
43 + */
44 + $(document).on('xwiki:livetable:newrow', function (event, data) {
45 + // It only concerns the 'tour' livetable
46 + if (data.tableId != 'tour') {
47 + // This is to be extra sure, but there should not be other livetables in that page...
48 + return;
49 + }
50 + addLaunchButton($(data.row));
51 + });
52 +
53 +});
Name
... ... @@ -1,0 +1,1 @@
1 +Add Tour specific code
Parse content
... ... @@ -1,0 +1,1 @@
1 +Yes
Use this extension
... ... @@ -1,0 +1,1 @@
1 +currentPage
XWiki.UIExtensionClass[0]
Extension Point ID
... ... @@ -1,0 +1,1 @@
1 +org.xwiki.platform.panels.Applications
Extension ID
... ... @@ -1,0 +1,1 @@
1 +platform.panels.TourApplication
Extension Parameters
... ... @@ -1,0 +1,3 @@
1 +label=$services.localization.render('tour.app.name')
2 +target=Tour.WebHome
3 +icon=icon:information
Extension Scope
... ... @@ -1,0 +1,1 @@
1 +wiki

Tips

You can click on the arrows next to the breadcrumb elements to quickly navigate to sibling and children pages.

Need help?

If you need help with XWiki you can contact: