Show last authors
1 {{warning}}WikiStream is still young and experimental and while exporting should be safe enough, importing can be more risky for the current instance.{{/warning}}
2
3 {{velocity output="false"}}
4 ## TODO: Move what is needed is a place common to wikistream and extensions
5 ## NOTE: We don't use #template because it currently registers the Velocity macros in a different namespace which makes
6 ## them unavailable in the current wiki page or the current template. We also tried #parse but it "randomly" fails to
7 ## register the Velocity macros from the parsed template. The only solution we found is to use #evaluate with #include
8 ## but unfortunately this doesn't allow the template to be overridden from the skin.
9 #evaluate("#include('extension.vm')")
10 #set ($discard = $xwiki.ssfx.use('uicomponents/extension/extension.css', true))
11 #set ($discard = $xwiki.jsfx.use('uicomponents/extension/extension.js', true))
12 {{/velocity}}
13
14 {{include reference="WikiStreamDescriptorForm"/}}
15
16 {{velocity output="true"}}
17 #set($input = $request.input)
18 #set($output = $request.output)
19
20 #set($inputProperties = {})
21 #foreach($parameterName in $request.parameterNames)
22 #if ($parameterName.startsWith('wikistream_input_properties_descriptor_'))
23 #set($propertyName = $parameterName.substring(39))
24 #if ($request.getParameter($parameterName) && $request.getParameter($parameterName) != '')
25 #set($void = $inputProperties.put($propertyName, $request.getParameter($parameterName)))
26 #end
27 #end
28 #end
29 ## Set response output by default
30 #if (!$inputProperties.source && $services.wikistream.getInputWikiStreamDescriptor($request.input).getPropertyDescriptor('source'))
31 #set($sourceStandardInput = true)
32 #set($void = $inputProperties.put('source', $request.inputStream))
33 #end
34
35 #set($outputProperties = {})
36 #foreach($parameterName in $request.parameterNames)
37 #if ($parameterName.startsWith('wikistream_output_properties_descriptor_'))
38 #set($propertyName = $parameterName.substring(40))
39 #if ($request.getParameter($parameterName) && $request.getParameter($parameterName) != '')
40 #set($void = $outputProperties.put($propertyName, $request.getParameter($parameterName)))
41 #end
42 #end
43 #end
44 ## Set response output by default
45 #if (!$outputProperties.target && $services.wikistream.getOutputWikiStreamDescriptor($request.output).getPropertyDescriptor('target'))
46 #set($targetStandardOutput = true)
47 #set($void = $outputProperties.put('target', $services.wikistream.createOutputStreamOutputTarget($response.outputStream, true)))
48 #end
49 {{/velocity}}
50
51 {{velocity}}
52 #if ($request.convert)
53 #if ($targetStandardOutput)
54 $response.setContentType('application/octet-stream')
55 $response.setHeader('Content-Disposition', 'attachment; filename=target');
56 $services.wikistream.startConvert($input, $inputProperties, $output, $outputProperties).join()
57 $xcontext.setFinished(true)
58 #else
59 #if ($services.wikistream.startConvert($input, $inputProperties, $output, $outputProperties))
60 {{success}}Conversion started.{{/success}}
61 #else
62 #set ($lastError = $services.wikistream.lastError)
63 #if ($lastError)
64 {{error}}
65 Failed to start conversion
66
67 {{html}}
68 <pre>
69 #printThrowable($lastError)
70 </pre>
71 {{/html}}
72 {{/error}}
73 #end
74 #end
75 #end
76 #end
77 {{/velocity}}
78
79 {{include reference="WikiStreamJob"/}}
80
81 {{velocity}}
82 {{html}}
83 <form class="xform" method="post">
84 <div id="wikistream_form">
85 <dl>
86 <dt><label for="wikistream_input_select">Input type</label></dt>
87 <dd>
88 <select name="input" id="wikistream_input_type">
89 #foreach($type in $services.wikistream.availableInputModules)
90 <option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $input)selected="selected"#end>$services.wikistream.getInputWikiStreamDescriptor($type).name ($type)</option>
91 #if (!$input)
92 #set($input = $type.serialize())
93 #end
94 #end
95 </select>
96 </dd>
97 #if ($input)
98 <dt><label>Input configuration</label></dt>
99 <dd>
100 #wikistreamDescriptorForm($services.wikistream.getInputWikiStreamDescriptor($input), 'wikistream_input_properties')
101 </dd>
102 #end
103
104 <dt><label for="wikistream_output_select">Output type</label></dt>
105 <dd>
106 <select name="output" id="wikistream_output_type">
107 #foreach($type in $services.wikistream.availableOutputModules)
108 <option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $output)selected="selected"#end>$services.wikistream.getOutputWikiStreamDescriptor($type).name ($type)</option>
109 #if (!$output)
110 #set($output = $type.serialize())
111 #end
112 #end
113 </select>
114 </dd>
115 #if ($output)
116 <dt><label>Output configuration</label></dt>
117 <dd>
118 #wikistreamDescriptorForm($services.wikistream.getOutputWikiStreamDescriptor($output), 'wikistream_output_properties')
119 </dd>
120 #end
121 </dl>
122
123 <p>
124 <input class="button" type="submit" name="convert" value="Convert"/>
125 </p>
126 </div>
127 </form>
128 {{/html}}
129 {{/velocity}}