Show last authors
1 {{velocity}}
2 #if (!$services.security.authorization.hasAccess('admin', $xcontext.userReference, $doc.documentReference.wikiReference))
3 {{error}}
4 You don't have the right to use this tool on this wiki. You need to be administrator.
5 {{/error}}
6 #else
7 ## Both job.css and extension.css are needed because the ui-progress classes that we need to display
8 ## a progress bar are in one of these 2 files depending on the XWiki version
9 #set ($discard = $xwiki.ssfx.use('uicomponents/job/job.css', true))
10 #set ($discard = $xwiki.ssfx.use('uicomponents/extension/extension.css', true))
11 #set ($discard = $xwiki.ssfx.use('uicomponents/logging/logging.css', true))
12 {{html clean="false"}}
13 <!------------------------------------------
14 Migration Action Template
15 ------------------------------------------->
16 <script id="MigrationActionTemplate" type="text/html">
17 <li data-bind="visible: !targetDocument.equals(sourceDocument) || getNumberOfChildren() > 0 || getNumberOfPreferences() > 0 || getNumberOfRights()> 0">
18 <input type="checkbox" data-bind="checked: enabled" />
19 <a href="#" data-bind="visible: !enabled() && (getNumberOfChildren() > 0 || getNumberOfPreferences() > 0 || getNumberOfRights()> 0), click: enableWithChildren" >(all)</a>
20 <strong class="documentName" data-bind="text: getTargetName(), click: toggleDisplayChildren, css: { 'bg-danger': isTooLong() }" />
21 [<span data-bind="text: serializedTargetDocument()" class="monospace" />]
22 <em data-bind="visible: targetDocument.equals(sourceDocument)">(unchanged)</em>
23 <strong data-bind="visible: deletePrevious">(duplicated document will be deleted)</strong>
24 <button class="btn btn-default btn-xs" data-bind="click: ${escapetool.d}root.excludePage, disable: targetDocument.equals(sourceDocument)">exclude page</button>
25 <button class="btn btn-default btn-xs" data-bind="click: ${escapetool.d}root.excludeSpace">exclude space</button>
26 <button class="btn btn-default btn-xs" data-bind="click: ${escapetool.d}root.setParent">set parent</button>
27 (<span data-bind="text: getNumberOfChildren()" /> children, <span data-bind="text: getNumberOfPreferences()" /> preferences, <span data-bind="text: getNumberOfRights()" /> rights)
28 from <a target="_blank" class="monospace" data-bind="text: serializedSourceDocument(), attr: {href: getSourceLink()}" />
29 <!-- ko if: displayChildren() -->
30 <!-- ko if: preferences.length > 0 -->
31 <ul data-bind="foreach: preferences">
32 <li class="text-warning"><input type="checkbox" data-bind="checked: enabled"/> <strong>[Preferences] <span data-bind="text: property" /> : <span data-bind="text: value" /></strong> (coming from <a target="_blank" class="monospace" data-bind="text: getSerializedOrigin(), attr: {href: getOriginLink()}" />)</li>
33 </ul>
34 <!-- /ko -->
35 <!-- ko if: rights.length > 0 -->
36 <ul data-bind="foreach: rights">
37 <li class="text-danger"><input type="checkbox" data-bind="checked: enabled"/> <strong>[Right] <span data-bind="text: toString()" /></strong> (coming from <a target="_blank" class="monospace" data-bind="text: getSerializedOrigin(), attr: {href: getOriginLink()}" />)</li>
38 </ul>
39 <!-- /ko -->
40 <ul data-bind="template: { name: 'MigrationActionTemplate', foreach: children }" />
41 <!-- /ko -->
42 </li>
43 </script>
44 <!------------------------------------------
45 Display Logs
46 ------------------------------------------->
47 <script id="DisplayLogs" type="text/html">
48 <h2 class="log-title">Logs: </h2>
49 <ul class="log" data-bind="if: logs().length > 0">
50 <!-- ko foreach: logs -->
51 <li class="log-item" data-bind="css: getClass()">
52 <div data-bind="text: message" />
53 <!-- ko if: stackTrace -->
54 <pre data-bind="text: stackTrace"/>
55 <!-- /ko -->
56 </li>
57 <!-- /ko -->
58 </ul>
59 </script>
60 <!------------------------------------------
61 Display plan
62 ------------------------------------------->
63 <script id="DisplayPlan" type="text/html">
64 <h2>Plan</h2>
65 <div class="migration-plan box">
66 <div data-bind="if: isComputing()" id="planComputing">
67 <p>The plan is being computed and it could take some time. Please wait...</p>
68 <div class="ui-progress-background">
69 <div class="ui-progress-bar green" data-bind="style: {width: progress() + '%'}" />
70 </div>
71 </div>
72 <div class="box warningmessage" data-bind="visible: duplicates().length > 0">
73 <p>The migration have detected some duplicated documents, that are probably the consequences of a failed attempt to run the migrator.<br />
74 <p>If it's the first time you run the migrator, you might have a problem.</p>
75 <p>Theses documents are:</p>
76 <ul data-bind="foreach: {data: duplicates(), as: 'doc'}">
77 <li data-bind="text: doc"></li>
78 </ul>
79 <p>If you are ok with it, just run the migrator and these documents will be overwritten.</p>
80 </div>
81 <div class="box errormessage" data-bind="visible: tooLongs().length > 0">
82 <p>We have detected some pages that will have too long path after the migration (limit is 255). You should rename them (or rename one of their parents) before computing a new plan.</p>
83 <p>Theses pages are:</p>
84 <ul data-bind="foreach: {data: tooLongs(), as: 'action'}">
85 <li class="monospace"><a data-bind="attr: {href: action.getSourceLink()}" target="_blank"><span data-bind="text: action.serializedSourceDocument()" /></a> -&gt; <span data-bind="text: action.serializedTargetDocument()"/></li>
86 </ul>
87 </div>
88 <ul data-bind="if: actions() && !isComputing() && !isPlanEmpty()" id="planTree">
89 <!-- ko template: {name: 'MigrationActionTemplate', foreach: actions } -->
90 <!-- /ko -->
91 </ul>
92 <!-- ko if: !isComputing() && isPlanEmpty() -->
93 <div class="box infomessage">
94 <p>There is nothing to do!</p>
95 </div>
96 <!-- /ko -->
97 <!-- ko template: {name: 'DisplayLogs', data: ${escapetool.d}root} -->
98 <!-- /ko -->
99 </div>
100 </Script>
101 <!------------------------------------------
102 Display configuration
103 ------------------------------------------->
104 <h2>Configuration</h2>
105 <form class="xform">
106 <div class="row">
107 <div class="col-xs-12 col-md-6">
108 <dl>
109 <!-- Exclude hidden pages -->
110 <dt><input type="checkbox" id="excludeHiddenPages" data-bind="checked: configuration.excludeHiddenPages"> <label for="excludeHiddenPages">Exclude hidden pages</label></dt>
111 <dd><span class="xHint">Most of the hidden pages are techinal content. Moving them can break applications.</span></dd>
112 <!-- Exclude class pages -->
113 <dt><input type="checkbox" id="excludeClassPages" data-bind="checked: configuration.excludeClassPages"> <label for="excludeClassPages">Exclude pages having a class</label></dt>
114 <dd><span class="xHint">The pages are technical and moving them can break applications.</span></dd>
115 <!-- Don't move children -->
116 <dt><input type="checkbox" id="dontMoveChildren" data-bind="checked: configuration.dontMoveChildren"> <label for="dontMoveChildren">Do not move children</label></dt>
117 <dd><span class="xHint">Only convert terminal pages to nested pages, without moving them under their parent.</span></dd>
118 <!-- Add redirection -->
119 <dt><input type="checkbox" id="addRedirection" data-bind="checked: configuration.addRedirection"> <label for="addRedirection">Add redirection</label></dt>
120 <dd><span class="xHint">Add a redirection in the old location.</span></dd>
121 <!-- Convert preferences -->
122 <dt><input type="checkbox" id="convertPreferences" data-bind="checked: configuration.convertPreferences"> <label for="convertPreferences">Convert preferences</label></dt>
123 <dd><span class="xHint">Make sure that the preferences applied on the page remain the same after the move, by dupplicating the preferences on the target document.</span></dd>
124 <!-- Convert rights -->
125 <dt><input type="checkbox" id="convertRights" data-bind="checked: configuration.convertRights"> <label for="convertRights">Convert rights (experimental)</label></dt>
126 <dd><span class="xHint">Make sure that the rights applied on the page remain the same after the move <span class="text-danger">(Currently bugged)</span>.</span></dd>
127 </dl>
128 </div>
129 <div class="col-xs-12 col-md-6">
130 <dl>
131 <!-- Excluded Object Classes -->
132 <dt><label for="excludedObjectClasses" data-bind="click: toggleXClassList">Exclude classes</label></dt>
133 <dd>
134 <p class="xHint" data-bind="click: toggleXClassList">Exclude pages holding an object of one of the specified classes (separated by a coma ',').</p>
135 <p><textarea id="excludedObjectClasses" data-bind="textInput: configuration.excludedObjectClasses, click: showXClassList" data-xclasses="#foreach($class in $xwiki.classList)#if($velocityCount>1),#end${class}#end"></textarea></p>
136 <div data-bind="visible: xclassListVisible">
137 <a data-bind="click: hideXClassList" href="#">$services.icon.renderHTML('remove') Hide</a>
138 <ul data-bind="foreach: {data: xclasses, as: 'xclass'}" style="list-style-type: none; padding: 0;">
139 <li><label><input type="checkbox" data-bind="checked: xclass.selected"/> <span data-bind="text: xclass.name" /></label></li>
140 </ul>
141 </div>
142 </dd>
143 </dl>
144 <dl>
145 <!-- Excluded pages -->
146 <dt><label for="excludedPages">Excluded pages</label></dt>
147 <dd>
148 <p class="xHint">Page references separated by commas (',')</p>
149 <p><input type="text" id="excludedPages" data-bind="value: configuration.excludedPages"></p>
150 </dd>
151 <!-- Excluded spaces -->
152 <dt><label for="excludedSpaces">Excluded spaces</label></dt>
153 <dd>
154 <p class="xHint">Space references separated by commas (',')</p>
155 <p><input type="text" id="excludedSpaces" data-bind="value: configuration.excludedSpaces"> </p>
156 </dd>
157 <!-- Included spaces -->
158 <dt><label for="includedSpaces">Included spaces</label></dt>
159 <dd>
160 <p class="xHint">Space references separated by commas (',')</p>
161 <p><input type="text" id="includedSpaces" data-bind="value: configuration.includedSpaces"> </p>
162 </dd>
163 </dl>
164 </div>
165 </div>
166 <div class="clearfix">
167 <h2>Actions</h2>
168 <button class="btn btn-primary" data-bind="click: computePlan, disable: isComputing() || isPlanExecuting()">Compute plan</button>
169 <button class="btn btn-primary" data-bind="disable: actions().length == 0 || isPlanExecuting() || tooLongs().length > 0, click: executePlan">Execute plan</button>
170 <button class="btn btn-default" data-bind="disable: actions().length == 0 || isPlanExecuting(), click: cleanPlan">Clean plan (to free the memory)</button>
171 </div>
172 </form>
173 <!------------------------------------------
174 Display plan
175 ------------------------------------------->
176 <div data-bind="if: isPlanRequested() && !isPlanExecuting()">
177 ## We escape the dollar of the knockout variable '$root' because $root also exists in velocity
178 <!-- ko template: {name: 'DisplayPlan', data: ${escapetool.d}root} -->
179 <!-- /ko -->
180 </div>
181 <!------------------------------------------
182 Execute Plan
183 ------------------------------------------->
184 <!-- ko if: isPlanExecuting() && !success()-->
185 <div class="box" id="planExecuting">
186 <p>The plan is being executed and it could take some time. Please wait...</p>
187 <div class="ui-progress-background">
188 <div class="ui-progress-bar green" data-bind="style: {width: progress() + '%'}"></div>
189 </div>
190 <!-- ko template: {name: 'DisplayLogs', data: ${escapetool.d}root} -->
191 <!-- /ko -->
192 </div>
193 <!-- /ko -->
194 <!------------------------------------------
195 End message
196 ------------------------------------------->
197 <!-- ko if: success() -->
198 <div class="box successmessage" id="planExecuted">
199 The plan have been executed!
200 </div>
201 <!-- ko template: {name: 'DisplayLogs', data: ${escapetool.d}root} -->
202 <!-- /ko -->
203 <!-- /ko -->
204 {{/html}}
205 #end
206 {{/velocity}}

Need help?

If you need help with XWiki you can contact: