Wiki source code of WikiStreamDescriptorForm

Last modified by Stefan Taferner on 2014/04/21 22:47

Show last authors
1 {{velocity output="false"}}
2 #macro(wikistreamDescriptorForm $descriptor $id)
3 <dl#if ($id) id="$id"#end>
4 #foreach($descriptor in $descriptor.properties)
5 #if ($id)
6 #set($descriptorId = "${id}_descriptor_${descriptor.id}")
7 #else
8 #set($descriptorId = "descriptor_${descriptor.id}")
9 #end
10 <dt>
11 <label for="$descriptorId">$descriptor.name</label>
12 <span class="xHint">$descriptor.description</span>
13 <span class="xHint"><tt>$descriptor.type.getName()</tt></span>
14 #if ($descriptor.type.getName() == 'org.xwiki.wikistream.output.OutputTarget')
15 <span class="xHint"><tt>Supported format is <strong>file:&lt;path in server&gt;</strong> (e.g. <strong>file:/home/myuser/target.xml</strong>). When empty it send a file named <strong>target</strong> to the browser.</tt></span>
16 #elseif ($descriptor.type.getName() == 'org.xwiki.wikistream.input.InputSource')
17 <span class="xHint"><tt>Supported formats are <strong>file:&lt;path in server&gt;</strong> (e.g. <strong>file:/home/myuser/target.ext</strong>) and <strong>url:&lt;url&gt;</strong> (e.g. <strong>url:http://myserver/some/file/to/parse.ext</strong>). When empty it read the request input stream.</tt></span>
18 #end
19 </dt>
20 <dd>
21 ## TODO: design a real framework to generate form by type
22 #if (($descriptor.defaultValue || "$!descriptor.defaultValue" != '') && ($descriptor.type.getName() == 'boolean' || $descriptor.type.getName() == 'int' || $descriptor.type.getName() == 'java.lang.String'))
23 <input type="text" id="$descriptorId" name="$descriptorId" value="#if($request.get($descriptorId))$request.get($descriptorId)#else$descriptor.defaultValue#end"/>
24 #else
25 <input type="text" id="$descriptorId" name="$descriptorId"#if($request.get($descriptorId))value="$request.get($descriptorId)"#end/>
26 #end
27 </dd>
28 #end
29 </dl>
30 #end
31 {{/velocity}}
32
33 {{velocity wiki=false}}
34 #if ($xcontext.action == 'get' && $request.type)
35 #if ($request.input == 'true')
36 #wikistreamDescriptorForm($services.wikistream.getInputWikiStreamDescriptor($request.type), $request.id)
37 #else
38 #wikistreamDescriptorForm($services.wikistream.getOutputWikiStreamDescriptor($request.type), $request.id)
39 #end
40 #end
41 {{/velocity}}