Wiki source code of ScriptDocPanel
Last modified by Alex Moruz on 2021/03/12 10:02
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{velocity}} | ||
2 | #if ($xcontext.action == 'get') | ||
3 | #if ($request.get == 'kinds') | ||
4 | #set ($defaultKinds = ['velocity','script','service','plugin']) | ||
5 | #set ($availableKinds = $services.scriptdoc.getAvailableBindingKinds()) | ||
6 | #set ($additionalKinds = []) | ||
7 | #foreach ($bindingKind in $availableKinds) | ||
8 | #set($kind = $bindingKind.toString()) | ||
9 | #if (!$defaultKinds.contains($kind) && !$kind.startsWith('internal')) | ||
10 | #set ($discard = $additionalKinds.add($kind)) | ||
11 | #end | ||
12 | #end | ||
13 | #macro (jsonKind $kind $count) | ||
14 | #if ($count != 1), | ||
15 | #end | ||
16 | #set ($prettyname = $!services.localization.render("scriptdoc.kinds.$kind")) | ||
17 | { "kind" : "$kind", "name" : "#if($prettyname)$prettyname#else$kind#end" }## | ||
18 | #end | ||
19 | [ | ||
20 | #foreach ($kind in $defaultKinds) | ||
21 | #jsonKind($kind $foreach.count) | ||
22 | #end | ||
23 | #foreach ($kind in $additionalKinds) | ||
24 | #jsonKind($kind 0) | ||
25 | #end | ||
26 | |||
27 | ] | ||
28 | #elseif ($request.get == 'bindings') | ||
29 | [ | ||
30 | #foreach($binding in $services.scriptdoc.getBindingsFinder().find()) | ||
31 | #set($klass = $binding.type.getName()) | ||
32 | #set($ki = $klass.lastIndexOf('.') + 1) | ||
33 | #if ($foreach.count != 1), | ||
34 | #end | ||
35 | {## | ||
36 | "kind" : "$escapetool.json($binding.kind)", ## | ||
37 | "name" : "$escapetool.json($binding.fullName)", ## | ||
38 | "fullname" : "$$escapetool.json($binding.fullName)", ## | ||
39 | "internal" : $binding.isInternal(), ## | ||
40 | "deprecated" : $binding.isDeprecated(), ## | ||
41 | "legacy" : $binding.isLegacy(), ## | ||
42 | "type" : "${escapetool.json($klass.substring($ki))}"## | ||
43 | #if($binding.docLink) | ||
44 | , ## | ||
45 | "doclink" : "$escapetool.json($binding.docLink)"## | ||
46 | #end | ||
47 | #if($binding.resource) | ||
48 | , ## | ||
49 | "resource" : {## | ||
50 | "id" : "$escapetool.json($binding.resource.id)"## | ||
51 | #if($binding.resource.doclink) | ||
52 | , ## | ||
53 | "doclink" : "$escapetool.json($binding.resource.doclink)"## | ||
54 | #end | ||
55 | } | ||
56 | #end | ||
57 | #if($binding.description) | ||
58 | , ## | ||
59 | "description" : "$escapetool.json($services.localization.render($binding.description))"## | ||
60 | #end | ||
61 | }## | ||
62 | #end | ||
63 | |||
64 | ] | ||
65 | #end | ||
66 | #end | ||
67 | {{/velocity}} |