Changes for page Extensions Wiki

Last modified by Vincent Massol on 2017/03/01 17:23

<
From version < 53.1 >
edited by Marius Dumitru Florea
on 2013/03/22 14:56
To version < 54.1 >
edited by Denis Gervalle
on 2014/07/25 21:08
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.mflorea
1 +xwiki:XWiki.dgervalle
Content
... ... @@ -1,20 +1,50 @@
1 1  {{velocity}}
2 -## This pages serves 2 purposes:
3 -## - Used by the Extension Manager UI to display the documentation link for an extension based on the Maven <url> element which are set to http://xwiki.org/documentation?id=${groupId}:${artifactId}&path=...
4 -## See http://markmail.org/thread/s5lszhwxa5e7yl5u for details
5 -## - It's displays the list of extensions (when there's no "id" request parameter)
2 +## This pages serves 3 purposes:
3 +## - Used by the Extension Manager UI to display the extension page for an extension based on the Maven <url> element which are set to http://extension.xwiki.org/?id=${groupId}:${artifactId}:::...
4 +## - Used by the Javadoc to display external link, which based on the Maven <url> are set to http://extension.xwiki.org/?id=${groupId}:${artifactId}:::?id=groupid:artifactid:version:::.../apidocs/....html?is-external=true. Also support old Javadoc (pre-6.2) to display external link, which does not have version in URL.
5 +## - Displays the list of extensions (when there's no "id" request parameter) using Extension.WebHome
6 6  ##
7 7  #if ("$!request.id" != "")
8 8   ## Remove the part after ":::" (see top level pom.xml source for explanation as to why)
9 - #set ($id = $stringtool.substringBefore($request.id, ":::"))
9 + #set ($mid = $stringtool.substringBefore($request.id, ":::"))
10 + ## Find out if we receive a link to javadoc
11 + #set ($jdoc = $stringtool.substringAfter($request.id, "/apidocs/"))
12 + ## Parse module id
13 + #set ($pmid = $stringtool.split($mid,":",3))
14 + #set ($gid = $pmid[0])
15 + #set ($artid = $pmid[1])
16 + ## Determine the version
17 + #if ($pmid.size() > 2)
18 + #set ($version = $pmid[2])
19 + #else
20 + ## Version is not in the URL and we are targetting Javadoc, so try to get it from the referer
21 + #if ($jdoc)
22 + #set ($referer = $request.getHeader("Referer"))
23 + #if ($referer)
24 + #set ($jmod = $stringtool.split($stringtool.substringAfterLast($stringtool.substringBefore($referer, "-javadoc"),"/"),"."))
25 + #set ($version = "${stringtool.substringAfterLast($jmod[0],'-')}.${jmod[1]}")
26 + #end
27 + #end
28 + ## No version has been found, use the version of this wiki as a default
29 + #if (!$version)
30 + #set ($version = $xwiki.version)
31 + #end
32 + #end
33 + ## If we are targetting Javadoc, redirect to it through our nexus, else determine the id of the module
34 + #if ($jdoc)
35 + #set ($gid = $stringtool.replace($gid, ".", "/"))
36 + $response.sendRedirect("http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/${gid}/${artid}/${version}/${artid}-${version}-javadoc.jar/!/${jdoc}")
37 + #else
38 + #set($id = "${gid}:${artid}")
39 + #end
10 10   ## Locate the extension by its id
11 11   ## Special case, if the id is the one of the top level POM, then redirect to the main wiki
12 12   #if ($id == "org.xwiki.commons:xwiki-commons")
13 - $response.sendRedirect($xwiki.getURL("xwiki:Main.WebHome"))
43 + $response.sendRedirect($xwiki.getURL("xwiki:Main.WebHome"))
14 14   #else
15 - #set ($xwql = "where doc.object(ExtensionCode.ExtensionClass).id = '$id'")
16 - #set ($result = $services.query.xwql($xwql).execute())
17 - #if ($result.size() > 0)
45 + #set ($xwql = "where doc.object(ExtensionCode.ExtensionClass).id = '$id'")
46 + #set ($result = $services.query.xwql($xwql).execute())
47 + #if ($result.size() > 0)
18 18   $response.sendRedirect($xwiki.getURL($result.get(0)))
19 19   #else
20 20   ## Unknown ID, list all extensions
... ... @@ -25,3 +25,4 @@
25 25   {{include document="Extension.WebHome"/}}
26 26  #end
27 27  {{/velocity}}
58 +

Get Connected