Changes for page Extensions Wiki
Last modified by Vincent Massol on 2017/03/01 17:23
From version 54.1
edited by Denis Gervalle
on 2014/07/25 21:08
on 2014/07/25 21:08
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. dgervalle1 +xwiki:XWiki.mflorea - Content
-
... ... @@ -1,50 +1,20 @@ 1 1 {{velocity}} 2 -## This pages serves 3purposes:3 -## - Used by the Extension Manager UI to display the e xtensionpagefor an extension based on the Maven <url> element which are set to http://extension.xwiki.org/?id=${groupId}:${artifactId}:::...4 -## -Usedby theJavadoc to displayexternallink, which based onthe Maven <url> are setto http://extension.xwiki.org/?id=${groupId}:${artifactId}:::?id=groupid:artifactid:version:::.../apidocs/....html?is-external=true. Also supportold Javadoc (pre-6.2)todisplayexternal link, which doesnot have version in URL.5 -## - Displays the list of extensions (when there's no "id" request parameter)using Extension.WebHome2 +## 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) 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 ($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 9 + #set ($id = $stringtool.substringBefore($request.id, ":::")) 40 40 ## Locate the extension by its id 41 41 ## Special case, if the id is the one of the top level POM, then redirect to the main wiki 42 42 #if ($id == "org.xwiki.commons:xwiki-commons") 43 - 13 + $response.sendRedirect($xwiki.getURL("xwiki:Main.WebHome")) 44 44 #else 45 - 46 - 47 - #if ($result.size() > 0) 15 + #set ($xwql = "where doc.object(ExtensionCode.ExtensionClass).id = '$id'") 16 + #set ($result = $services.query.xwql($xwql).execute()) 17 + #if ($result.size() > 0) 48 48 $response.sendRedirect($xwiki.getURL($result.get(0))) 49 49 #else 50 50 ## Unknown ID, list all extensions ... ... @@ -55,4 +55,3 @@ 55 55 {{include document="Extension.WebHome"/}} 56 56 #end 57 57 {{/velocity}} 58 -