Show last authors
1 {{velocity output="false"}}
2 $xwiki.ssx.use('ExtensionManagerMacros')
3 $xwiki.jsx.use('ExtensionManagerMacros')
4 #set ($extensionManager = $services.extension)
5 #if ($request.extensionwiki && $request.extensionwiki.trim() != '')
6 #set($extensionwiki = $request.extensionwiki)
7 #set($extensionnamespace = "wiki:${extensionwiki}")
8 #end
9
10 #macro (displayExtensionSearchBar)
11 (% class="extHeader" %)(((
12 (% class="extHeaderLeft" %)(((
13 {{html}}
14 <form class="xform half" action="$doc.getURL($xcontext.action, $request.getQueryString().replaceAll('(^|&)actionshowdetails=[^&]++&?', '$1').replaceAll('(^|&)(extension(id|version)=[^&]++&?+)+', '$1').replaceAll('(^|&)section=[^&]++', '$1section=XWiki.AddExtensions').replaceAll('(^|&)searchextension=[^&]++&?', '$1'))" method="post">
15 <div class="globalsearch extHeaderLeftSearch">
16 <label class="label" for="extensionsearchinput">$msg.get('extensions.search.title')</label><input type="text" class="globalsearchinput#if ("$!request.searchextension" == '') withTip#end extHeaderLeftInput" id="extensionsearchinput" name="searchextension" value="#if ("$!request.searchextension" != '')${request.searchextension}#{else}$msg.get('extensions.search.tip')#{end}" size="60"><input type="image" class="button" value="$msg.get('panels.search.submit')" alt="$msg.get('panels.search.submit')" src="$xwiki.getSkinFile('icons/xwiki/search.png')">
17 </div>
18 </form>
19 {{/html}}
20 )))
21 (% class="extHeaderRight" %)(((
22 ## Advanced search form
23 {{html clean="false"}}
24 <form action="$escapetool.xml($doc.getURL($xcontext.action, $request.getQueryString()))" method="post" class="xform">
25 <fieldset id="advancedextensionsearch">
26 <div id="advancedextensionsearch-body"></div>
27 <legend><a href="#advancedextensionsearch-body">$msg.get('extensions.advancedSearch.title')</a></legend>
28 <div class="plainmessage advancedsearchpopup hidden">
29 <input type="hidden" name="xback" value="$escapetool.xml($doc.getURL($xcontext.action, $request.queryString))" />
30 <dl>
31 <dt><label for="advancedextensionsearch-id">$msg.get('extensions.advancedSearch.id.label')</label></dt>
32 <dd><input type="text" name="extensionid" id="advancedextensionsearch-id" value="" /></dd>
33 <dt><label for="advancedextensionsearch-version">$msg.get('extensions.advancedSearch.version.label')</label></dt>
34 <dd><input type="text" name="extensionversion" id="advancedextensionsearch-version" value="" /></dd>
35 </dl>
36 <p><span class="buttonwrapper"><input type="submit" name="actioninstall" value="$msg.get('extensions.advancedSearch.actions.submit')" class="button" /></span>
37 <span class="buttonwrapper"><a href="#searchextension" class="actioncancel secondary button">$msg.get('extensions.advancedSearch.actions.cancel')</a></span></p>
38 </div>
39 </fieldset>
40 </form>
41 {{/html}}
42 )))
43 (% class="clearfloats" %)((()))
44 )))
45 #end
46
47 #macro (displayExtensionName $extension $actions)
48 #set ($name = "$!{extension.name}")
49 #if ($name == '')
50 #set ($name = "$!{extension.id.id}")
51 #if ($name.indexOf(':') >= 0)
52 #set ($name = $name.substring($mathtool.add($name.indexOf(':'), 1)))
53 #end
54 #end
55 $name##
56 #end
57
58 #macro (displayExtension $extension)
59 #determineExtensionStatus($extension.id, $extensionnamespace, $extensionStatus)
60 #set ($actions = [])
61 #computeXBack()
62 #if ($extensionStatus == 'core')
63 #getCoreExtensionButtons($actions)
64 #elseif ($extensionStatus == 'installed')
65 #getInstalledExtensionButtons($actions)
66 #elseif ($extensionStatus == 'remote')
67 #getRemoteExtensionButtons($actions)
68 #end
69 (% class="extension-item# extension-item-${extensionStatus}" %)(((
70 (% class="extension-header" %)(((
71 (% class="extension-name" %)
72 ==#displayExtensionName($extension) (% class="extension-version %)$extension.id.version==
73
74 {{html}}
75 #if ($doc.name == 'XWikiPreferences')
76 #set ($action = 'admin')
77 #else
78 #set ($action = 'view')
79 #end
80 <form method="post" action="$doc.getURL($action, $request.getQueryString().replaceAll('(^|&)actionshowdetails=[^&]++', ''))">
81 <div class="extension-actions">
82 <input type="hidden" name="extensionid" value="$extension.id.id" />
83 <input type="hidden" name="extensionversion" value="$extension.id.version" />
84 #foreach ($action in $actions)
85 ${action}##
86 #end
87 </div>
88 </form>
89 {{/html}}
90
91 #if ($extension.authors.size() > 0)
92 (% class="extension-authors" %)(((
93 $msg.get('extensions.info.authors') ##
94 #foreach ($author in $extension.authors)
95 #if ($author.name == 'devs')
96 [[$msg.get('extensions.info.authors.xwikiorg')>>http://www.xwiki.org/]]##
97 #elseif ("$!author.url" != '' && "$!author.name" != '')
98 [[${author.name}>>${author.url}]]##
99 #else
100 ${author.name}##
101 #end
102 #if ($foreach.hasNext), ##
103 #else )))
104
105 #end
106 #end
107 #end
108 #if ("$!{extension.summary}" != '')
109 (% class="extension-description" %)
110 {{{
111 $extension.summary.replaceAll('\s+', ' ')
112 }}}
113
114 #end
115 (% class="clearfloats" %)((()))
116 )))
117 #if ($request.actionshowdetails)
118 #set ($backwardDependencies = $extensionManager.getBackwardDependencies($extension.id.id, $extension.id.version))
119 #if (!$backwardDependencies)
120 #set ($backwardDependencies = {})
121 #end
122 (% class="extension-body" %)(((
123 (% class="innerMenu" %)
124 * [[$msg.get('extensions.info.category.description')>>||anchor="extension-body-description-${extension.id.id}-${extension.id.version}"]]
125 #if ("$!{extension.releaseNotes}" != '')
126 * [[$msg.get('extensions.info.category.releaseNotes')>>||anchor="extension-body-relnotes-${extension.id.id}-${extension.id.version}"]]
127 #end
128 #if ($extension.dependencies.size() > 0 || $backwardDependencies.size() > 0)
129 * [[$msg.get('extensions.info.category.dependencies')>>||anchor="extension-body-dependencies-${extension.id.id}-${extension.id.version}"]]
130 #end
131
132 {{id name="extension-body-description-${extension.id.id}-${extension.id.version}" /}}
133 (% class="extension-body-description extension-body-section" %)(((
134 (% class="extension-metadata" %)
135 * $msg.get('extensions.info.license', [$extension.licenses.size()]) ##
136 #foreach ($license in $extension.licenses)
137 ${license.name}##
138 #if ($foreach.hasNext), #end
139 #end
140
141 #if ($extension.repository.id.URI && $extension.repository.id.URI.scheme != 'file')
142 * $msg.get('extensions.info.repository') [[$extension.repository.id.id>>$extension.repository.id.URI]]
143 #end
144 #if ($extension.dependency)
145 * $msg.get('extensions.info.dependency')
146 #end
147 #if ("$!{extension.webSite}" != '')
148 * $msg.get('extensions.info.website') [[$extension.webSite.replaceAll('^[^/]++//([^/]++)/?.*+$', '$1')>>$extension.webSite]]
149 #end
150 #if ($extension.features.size() > 0)
151 * $msg.get('extensions.info.features') $extension.features
152 #end
153 #if ($xwiki.virtualMode)
154 #if (!$extension.namespaces || $extension.namespaces.size() == 0)
155 * $msg.get('extensions.info.namespaces.global')
156 #else
157 * $msg.get('extensions.info.namespaces.list') #foreach ($namespace in $extension.namespaces)$namespace#if($foreach.hasNext), #end#end
158
159 #end
160 #end
161
162 ## TODO: need a decision on what exactly is the description and how it should be safely displayed (wiki syntax, server side generated HTML, etc)
163 ## $!extension.description
164 )))
165
166 #if ("$!{extension.releaseNotes}" != '')
167 {{id name="extension-body-relnotes-${extension.id.id}-${extension.id.version}"/}}
168 (% class="extension-body-relnotes extension-body-section" %)(((
169 $!{extension.releaseNotes}
170 )))
171 #end
172
173 {{id name="extension-body-dependencies-${extension.id.id}-${extension.id.version}" /}}
174 #computeXBack()
175 (% class="extension-body-dependencies extension-body-section" %)(((
176 $msg.get('extensions.info.dependencies.directDependencies', [$extension.dependencies.size()])
177 #foreach ($dependency in $extension.dependencies)
178 #set ($dependencyExtension = $extensionManager.resolve($dependency))
179 #set ($dependencyClass = "$!{dependencyExtension.class}")
180 #if ($dependencyExtension)
181 * [[#displayExtensionName($dependencyExtension)>>##
182 #if ($dependencyClass.endsWith('CoreExtension'))
183 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id}&extensionversion=${dependency.versionConstraint}&section=XWiki.CoreExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-core"]]
184 #elseif ($dependencyClass.endsWith('LocalExtension'))
185 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id}&extensionversion=${dependency.versionConstraint}&section=XWiki.InstalledExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-installed"]]
186 #else
187 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id}&extensionversion=${dependency.versionConstraint}&section=XWiki.AddExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-remote"]]
188 #end
189 #else
190 * (% class="dependency-type-unknown" %)${dependency.id}
191 #end
192 #if (!$foreach.hasNext)
193
194 #end
195 #end
196 $msg.get('extensions.info.dependencies.backwardDependencies', [$backwardDependencies.size()])
197 #foreach ($namespace in $backwardDependencies.entrySet())
198 #foreach ($dependency in $namespace.value)
199 #set ($dependencyClass = "${dependency.class}")
200 * [[#displayExtensionName($dependency)>>##
201 #if ($dependencyClass.endsWith('CoreExtension'))
202 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id.id}&extensionversion=${dependency.id.version}&section=XWiki.CoreExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-core"]]##
203 #elseif ($dependencyClass.endsWith('LocalExtension'))
204 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id.id}&extensionversion=${dependency.id.version}&section=XWiki.InstalledExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-installed"]]##
205 #else
206 path:$doc.getURL($xcontext.action, "actionshowdetails=true&extensionid=${dependency.id.id}&extensionversion=${dependency.id.version}&section=XWiki.AddExtensions&xback=${escapetool.url($xback)}")||class="dependency-type-remote"]]##
207 #end
208 #if ("$!{namespace.key}" != '')
209 $msg.get('extensions.info.dependency.wiki', [$namespace.key])
210 #else
211
212 #end
213 #end
214 #end
215 )))
216 )))
217 #end
218 )))
219 #end
220
221 #macro (handleInstallExtensionRequest)
222 (% class="full column" %)(((
223 #displayExtensionSearchBar()
224 = $msg.get('extensions.install.title', ["//#displayExtensionName($extensionManager.resolve($request.extensionid, $request.extensionversion))//"]) =
225
226 #if (!$request.extensionid || !$request.extensionversion)
227 {{error}}$msg.get('extensions.install.error.missingIdOrVersion'){{/error}}
228 #elseif ($request.confirm)
229 #set($installJob = $extensionManager.install($request.extensionid, $request.extensionversion, $extensionwiki))
230 #set($lasterror = $extensionManager.lastError)
231 #if ($lasterror)
232 #if($extensionwiki)
233 {{error}}$msg.get('extensions.install.error.installFailure.onWiki', [$request.extensionid, $request.extensionversion, $extensionwiki]) ##
234 #else
235 {{error}}$msg.get('extensions.install.error.installFailure', [$request.extensionid, $request.extensionversion]) ##
236 #end
237 #printThrowable($lasterror){{/error}}
238 #else
239 {{box}}#printJobLog($installJob){{/box}}
240 #end
241 #else
242 #set($installPlan = $extensionManager.createInstallPlan($request.extensionid, $request.extensionversion, $extensionnamespace))
243 #if (!$installPlan)
244 {{error}}$msg.get('extensions.install.error.prepareFailure', [$request.extensionid, $request.extensionversion, $lasterror.message]){{/error}}
245 #else
246 #set($hasError = false)
247 #foreach($log in $installPlan.log)
248 #if ($log.level.name() == 'ERROR')
249 #set($hasError = true)
250 #end
251 #end
252 ##
253 #if ($hasError)
254 {{box}}#printStatusLog($installPlan){{/box}}
255 #else
256 #set($extensionsToInstall = [])
257 #set($extensionsToUpgrade = [])
258 ##
259 #foreach($planAction in $installPlan.actions)
260 #if ($planAction.action.name() == "INSTALL")
261 #set($void = $extensionsToInstall.add($planAction))
262 #elseif ($planAction.action.name() == "UPGRADE")
263 #set($void = $extensionsToUpgrade.add($planAction))
264 #end
265 #end
266 ##
267 #if ($extensionsToInstall.isEmpty() && $extensionsToUpgrade.isEmpty())
268 {{info}}$msg.get('extensions.install.error.alreadyInstalled'){{/info}}
269 #else
270 #if (!$extensionsToInstall.isEmpty())
271 $msg.get('extensions.install.list.new')
272 #foreach ($planAction in $extensionsToInstall)
273 * $planAction.extension.id.id ($planAction.extension.id.version)
274 #end
275
276 #end
277 #if (!$extensionsToUpgrade.isEmpty())
278 $msg.get('extensions.install.list.upgrade')
279 #foreach ($planAction in $extensionsToUpgrade)
280 * $planAction.extension.id.id ($planAction.extension.id.version)
281 #end
282
283 #end
284 {{html}}
285 <form action="$xwiki.requestURL" enctype="multipart/form-data" method="post" class="xform">
286 <div>
287 <input name="extensionid" value="${escapetool.xml($request.extensionid)}" type="hidden" />
288 <input name="extensionversion" value="${escapetool.xml($request.extensionversion)}" type="hidden" />
289 #if ($extensionwiki)
290 <input name="extensionwiki" value="$extensionwiki" type="hidden" />
291 #end
292 <input name="actioninstall" type="hidden" />
293 <p>
294 <span class="buttonwrapper"><input type="submit" value="$msg.get('extensions.install.actions.submit')" name="confirm" class="button"/></span>
295 #if ("$!{request.xback}" != '')
296 <span class="buttonwrapper"><a href="${request.xback}" class="secondary button">$msg.get('extensions.install.actions.cancel')</a></span>
297 #end
298 </p>
299 </div>
300 </form>
301 {{/html}}
302 #end
303 #end
304 #end
305 #end
306 )))
307 #end
308
309 #macro (handleUninstallExtensionRequest)
310 (% class="full column" %)(((
311 = $msg.get('extensions.uninstall.title', ["//#displayExtensionName($extensionManager.resolve($request.extensionid, $request.extensionversion))//"]) =
312
313 #if (!$request.extensionid || !$request.extensionversion)
314 {{error}}$msg.get('extensions.uninstall.error.missingIdOrVersion'){{/error}}
315 #elseif ($request.confirm)
316 #set($uninstallJob = $extensionManager.uninstall($request.extensionid, null))
317 #set($lasterror = $extensionManager.lastError)
318 #if ($lasterror)
319 {{error}}
320 $msg.get('extensions.uninstall.error.uninstallFailure', [$request.extensionid, $request.extensionversion]) ##
321 #printThrowable($lasterror)
322 {{/error}}
323 #else
324 {{box}}
325 #printJobLog($uninstallJob)
326 {{/box}}
327 #end
328 #else
329 #set($uninstallPlan = $extensionManager.createUninstallPlan($request.extensionid, $extensionnamespace))
330 #if (!$uninstallPlan)
331 {{error}}$msg.get('extensions.uninstall.error.prepareFailure', [$request.extensionid, $request.extensionversion, $lasterror.message]){{/error}}
332 #else
333 #set($hasError = false)
334 #foreach($log in $uninstallPlan.log)
335 #if ($log.level.name() == 'ERROR')
336 #set($hasError = true)
337 #end
338 #end
339 ##
340 #if ($hasError)
341 {{box}}#printStatusLog($installPlan){{/box}}
342 #else
343 #set($extensionsToUninstall = [])
344 ##
345 #foreach($planAction in $uninstallPlan.actions)
346 #if ($planAction.action.name() == "UNINSTALL")
347 #set($void = $extensionsToUninstall.add($planAction))
348 #end
349 #end
350 ##
351 #if ($extensionsToUninstall.isEmpty())
352 {{info}}$msg.get('extensions.uninstall.error.notInstalled'){{/info}}
353 #else
354 The following extensions will be removed:
355 #foreach ($planAction in $extensionsToUninstall)
356 * $planAction.extension.id.id ($planAction.extension.id.version)
357 #end
358
359 {{html}}
360 <form action="$xwiki.requestURL" enctype="multipart/form-data" method="post" class="xform">
361 <div>
362 <input name="extensionid" value="${escapetool.xml($request.extensionid)}" type="hidden" />
363 <input name="extensionversion" value="${escapetool.xml($request.extensionversion)}" type="hidden" />
364 <input name="actionuninstall" type="hidden" />
365 <p>
366 <span class="buttonwrapper"><input type="submit" value="$msg.get('extensions.uninstall.actions.submit')" name="confirm" class="button"/></span>
367 #if ("$!{request.xback}" != '')
368 <span class="buttonwrapper"><a href="${request.xback}" class="secondary button">$msg.get('extensions.uninstall.actions.cancel')</a></span>
369 #end
370 </p>
371 </div>
372 </form>
373 {{/html}}
374 #end
375 #end
376 #end
377 #end
378 )))
379 #end
380
381 #macro (printThrowable $throwable)
382 $throwable.class: #if(!$throwable.message)null#else$throwable.message#end
383
384 #foreach($stackTraceElement in $throwable.stackTrace)
385 ~ at $stackTraceElement
386 #end
387 #if ($throwable.cause)
388 Caused by: #printThrowable($throwable.cause)
389 #end
390 #end
391
392 #macro (printJobLog $job)
393 #printStatusLog($job.status)
394 #end
395
396 #macro (printStatusLog $status)
397 #foreach ($log in $status.log)
398 #set ($logLevel = $log.level.toString().toLowerCase())
399 #if ($logLevel == 'warn')
400 #set ($logLevel = 'warning')
401 #end
402 {{$logLevel}}
403 $log.formattedMessage
404 #if ($log.throwable)
405 #printThrowable($log.throwable)
406 #end
407 {{/$logLevel}}
408 #end
409 #end
410
411 #macro (computeXBack)
412 #set ($xback = "$!{request.xback}")
413 #if ($xback == '')
414 #set ($params = '')
415 #foreach ($parameterName in $request.parameterNames)
416 #if (!$parameterName.startsWith('action') && !$parameterName.startsWith('extension'))
417 #foreach ($value in $request.getParameterValues($parameterName))
418 #set ($params = "${params}&${parameterName}=${value}")
419 #end
420 #end
421 #end
422 #if ($params.length() > 0)
423 #set ($params = $params.substring(1))
424 #end
425 #set ($xback = $doc.getURL($xcontext.action, $params))
426 #end
427 #end
428
429 #macro (getCoreExtensionButtons $actions)
430 #if ($request.extensionid && $request.extensionversion && $request.ajax)
431 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""showdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button visibilityAction"" /></span>"))
432 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""hidedetails"" value=""$msg.get('extensions.actions.hideDetails')"" class=""button visibilityAction"" /></span>"))
433 #elseif ($request.actionshowdetails)
434 #set ($discard = $actions.add("<span class=""buttonwrapper""><a href=""${xback}"" class=""button"">$msg.get('extensions.actions.back')</a></span>"))
435 #else
436 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""actionshowdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button""/></span><input type=""hidden"" name=""xback"" value=""${xback}"" />"))
437 #end
438 #end
439
440 #macro (getInstalledExtensionButtons $actions)
441 #if ($request.extensionid && $request.extensionversion && $request.ajax)
442 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""showdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button visibilityAction""/></span>"))
443 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""hidedetails"" value=""$msg.get('extensions.actions.hideDetails')"" class=""button visibilityAction""/></span>"))
444 #elseif ($request.actionshowdetails)
445 #set ($discard = $actions.add("<span class=""buttonwrapper""><a href=""${xback}"" class=""button"">$msg.get('extensions.actions.back')</a></span>"))
446 #else
447 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""actionshowdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button""/></span><input type=""hidden"" name=""xback"" value=""${xback}"" />"))
448 #end
449 #if ($hasProgramming)
450 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""actionuninstall"" value=""$msg.get('extensions.actions.uninstall')"" class=""button secondary""/></span>"))
451 #end
452 #end
453
454 #macro (getRemoteExtensionButtons $actions)
455 #if ($request.extensionid && $request.extensionversion && $request.ajax)
456 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""showdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button visibilityAction"" /></span>"))
457 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""hidedetails"" value=""$msg.get('extensions.actions.hideDetails')"" class=""button visibilityAction"" /></span>"))
458 #elseif ($request.actionshowdetails)
459 #set ($discard = $actions.add("<span class=""buttonwrapper""><a href=""${xback}"" class=""button"">$msg.get('extensions.actions.back')</a></span>"))
460 #else
461 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""actionshowdetails"" value=""$msg.get('extensions.actions.showDetails')"" class=""button""/></span><input type=""hidden"" name=""xback"" value=""${xback}"" />"))
462 #end
463 #if ($hasProgramming)
464 #set ($discard = $actions.add("<span class=""buttonwrapper""><input type=""submit"" name=""actioninstall"" value=""$msg.get('extensions.actions.install')"" class=""button""/></span>"))
465 #end
466 #end
467
468 #macro (determineExtensionStatus $extensionId $namespace $extensionStatus)
469 #if ($extensionManager.getInstalledExtension($extensionId.id, $namespace))
470 #set ($result = 'installed')
471 #elseif ($extensionManager.getCoreExtension($extensionId.id))
472 #set ($result = 'core')
473 #else
474 #set ($result = 'remote')
475 #end
476 #set ($extensionStatus = $NULL)
477 #setVariable ("$extensionStatus" $result)
478 #end
479 {{/velocity}}

Get Connected