|
|
1 |
{{include reference="FilterStreamDescriptorForm"/}} |
|
|
2 |
|
|
|
3 |
{{velocity output="true"}} |
|
|
4 |
#set($input = $request.input) |
|
|
5 |
#set($output = $request.output) |
|
|
6 |
|
|
|
7 |
#set($inputProperties = {}) |
|
|
8 |
#foreach($parameterName in $request.parameterNames) |
|
|
9 |
#if ($parameterName.startsWith('filter_input_properties_descriptor_')) |
|
|
10 |
#set($propertyName = $parameterName.substring(35)) |
|
|
11 |
#if ($request.getParameter($parameterName) && $request.getParameter($parameterName) != '') |
|
|
12 |
#set($void = $inputProperties.put($propertyName, $request.getParameter($parameterName))) |
|
|
13 |
#end |
|
|
14 |
#end |
|
|
15 |
#end |
|
|
16 |
## Set request input by default |
|
|
17 |
#if (!$inputProperties.source && $services.filter.getInputFilterStreamDescriptor($request.input).getPropertyDescriptor('source')) |
|
|
18 |
#set($sourceStandardInput = true) |
|
|
19 |
#set($void = $inputProperties.put('source', $request.inputStream)) |
|
|
20 |
#end |
|
|
21 |
|
|
|
22 |
#set($outputProperties = {}) |
|
|
23 |
#foreach($parameterName in $request.parameterNames) |
|
|
24 |
#if ($parameterName.startsWith('filter_output_properties_descriptor_')) |
|
|
25 |
#set($propertyName = $parameterName.substring(36)) |
|
|
26 |
#if ($request.getParameter($parameterName) && $request.getParameter($parameterName) != '') |
|
|
27 |
#set($void = $outputProperties.put($propertyName, $request.getParameter($parameterName))) |
|
|
28 |
#end |
|
|
29 |
#end |
|
|
30 |
#end |
|
|
31 |
## Set response output by default |
|
|
32 |
#if (!$outputProperties.target && $services.filter.getOutputFilterStreamDescriptor($request.output).getPropertyDescriptor('target')) |
|
|
33 |
#set($targetStandardOutput = true) |
|
|
34 |
#set($void = $outputProperties.put('target', $services.filter.createOutputStreamOutputTarget($response.outputStream, true))) |
|
|
35 |
#end |
|
|
36 |
{{/velocity}} |
|
|
37 |
|
|
|
38 |
{{velocity}} |
|
|
39 |
#if ($request.convert) |
|
|
40 |
#if ($services.security.authorization.hasAccess('programming', $xcontext.userReference, $doc.documentReference)) |
|
|
41 |
#if ($targetStandardOutput) |
|
|
42 |
$response.setContentType('application/octet-stream') |
|
|
43 |
$response.setHeader('Content-Disposition', 'attachment; filename=target'); |
|
|
44 |
$services.filter.convert($input, $inputProperties, $output, $outputProperties) |
|
|
45 |
$xcontext.setFinished(true) |
|
|
46 |
#else |
|
|
47 |
#if ($sourceStandardInput) |
|
|
48 |
#set($job = $services.filter.convert($input, $inputProperties, $output, $outputProperties)) |
|
|
49 |
#else |
|
|
50 |
#set($job = $services.filter.startConvert($input, $inputProperties, $output, $outputProperties)) |
|
|
51 |
#end |
|
|
52 |
#if ($job) |
|
|
53 |
#if (!$sourceStandardInput) |
|
|
54 |
{{success}}Conversion started.{{/success}} |
|
|
55 |
#end |
|
|
56 |
#else |
|
|
57 |
#set ($lastError = $services.filter.lastError) |
|
|
58 |
#if ($lastError) |
|
|
59 |
{{error}} |
|
|
60 |
Failed to start conversion |
|
|
61 |
|
|
|
62 |
{{html}} |
|
|
63 |
<pre> |
|
|
64 |
#printThrowable($lastError) |
|
|
65 |
</pre> |
|
|
66 |
{{/html}} |
|
|
67 |
{{/error}} |
|
|
68 |
#end |
|
|
69 |
#end |
|
|
70 |
#end |
|
|
71 |
#else |
|
|
72 |
{{error}}You are not allowed to start a conversion.{{/error}} |
|
|
73 |
#end |
|
|
74 |
#end |
|
|
75 |
{{/velocity}} |
|
|
76 |
|
|
|
77 |
== Current conversion |
|
|
78 |
|
|
|
79 |
{{include reference="FilterStreamJob"/}} |
|
|
80 |
|
|
|
81 |
== Configuration == |
|
|
82 |
|
|
|
83 |
{{velocity}} |
|
|
84 |
{{html}} |
|
|
85 |
<form class="xform" method="post"> |
|
|
86 |
<div id="filter_form"> |
|
|
87 |
<fieldset> |
|
|
88 |
<legend>Input</legend> |
|
|
89 |
<dl> |
|
|
90 |
<dt><label for="filter_input_select">Input type</label></dt> |
|
|
91 |
<dd> |
|
|
92 |
<select name="input" id="filter_input_type"> |
|
|
93 |
#foreach($type in $services.filter.availableInputStreams) |
|
|
94 |
<option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $input)selected="selected"#end>$services.filter.getInputFilterStreamDescriptor($type).name ($type)</option> |
|
|
95 |
#if (!$input) |
|
|
96 |
#set($input = $type.serialize()) |
|
|
97 |
#end |
|
|
98 |
#end |
|
|
99 |
</select> |
|
|
100 |
</dd> |
|
|
101 |
#if ($input) |
|
|
102 |
<dt><label>Input configuration</label></dt> |
|
|
103 |
<dd> |
|
|
104 |
#filterDescriptorForm($services.filter.getInputFilterStreamDescriptor($input), 'filter_input_properties') |
|
|
105 |
</dd> |
|
|
106 |
#end |
|
|
107 |
</dl> |
|
|
108 |
</fieldset> |
|
|
109 |
|
|
|
110 |
<fieldset> |
|
|
111 |
<legend>Output</legend> |
|
|
112 |
<dl> |
|
|
113 |
<dt><label for="filter_output_select">Output type</label></dt> |
|
|
114 |
<dd> |
|
|
115 |
<select name="output" id="filter_output_type"> |
|
|
116 |
#foreach($type in $services.filter.availableOutputStreams) |
|
|
117 |
<option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $output)selected="selected"#end>$services.filter.getOutputFilterStreamDescriptor($type).name ($type)</option> |
|
|
118 |
#if (!$output) |
|
|
119 |
#set($output = $type.serialize()) |
|
|
120 |
#end |
|
|
121 |
#end |
|
|
122 |
</select> |
|
|
123 |
</dd> |
|
|
124 |
#if ($output) |
|
|
125 |
<dt><label>Output configuration</label></dt> |
|
|
126 |
<dd> |
|
|
127 |
#filterDescriptorForm($services.filter.getOutputFilterStreamDescriptor($output), 'filter_output_properties') |
|
|
128 |
</dd> |
|
|
129 |
#end |
|
|
130 |
</dl> |
|
|
131 |
</fieldset> |
|
|
132 |
|
|
|
133 |
<p> |
|
|
134 |
#if ($services.security.authorization.hasAccess('programming', $xcontext.userReference, $doc.documentReference)) |
|
|
135 |
<input class="button" type="submit" name="convert" value="Convert"/> |
|
|
136 |
#else |
|
|
137 |
<input class="button" type="submit" name="convert" value="Convert" disabled title="You are not allowed to start a conversion."/> |
|
|
138 |
#end |
|
|
139 |
</p> |
|
|
140 |
</div> |
|
|
141 |
</form> |
|
|
142 |
{{/html}} |
|
|
143 |
{{/velocity}} |