|
|
1 |
{{velocity}} |
|
|
2 |
### |
|
|
3 |
### Perform actions (if asked) |
|
|
4 |
### |
|
|
5 |
#if ($hasAdmin && $xcontext.isMainWiki()) |
|
|
6 |
#set ($currentAction = "$!{request.action}") |
|
|
7 |
#if ($currentAction == 'stop' && $services.csrf.isTokenValid("$!request.form_token")) |
|
|
8 |
#if(!$services.officemanager.stopServer()) |
|
|
9 |
{{error}}$services.officemanager.lastErrorMessage{{/error}} |
|
|
10 |
|
|
|
11 |
#end |
|
|
12 |
#elseif ($currentAction == 'start' && $services.csrf.isTokenValid("$!request.form_token")) |
|
|
13 |
#if (!$services.officemanager.startServer()) |
|
|
14 |
{{error}}$services.officemanager.lastErrorMessage{{/error}} |
|
|
15 |
|
|
|
16 |
#end |
|
|
17 |
#elseif ($currentAction == 'restart' && $services.csrf.isTokenValid("$!request.form_token")) |
|
|
18 |
#if (!$services.officemanager.stopServer()) |
|
|
19 |
{{error}}$services.officemanager.lastErrorMessage{{/error}} |
|
|
20 |
|
|
|
21 |
#elseif (!$services.officemanager.startServer()) |
|
|
22 |
{{error}}$services.officemanager.lastErrorMessage{{/error}} |
|
|
23 |
|
|
|
24 |
#end |
|
|
25 |
#end |
|
|
26 |
#end |
|
|
27 |
### |
|
|
28 |
### Compute the correct actions name depending on the configuration. |
|
|
29 |
### ex: use 'connect' if the office server is an external instance or 'start' if it's an internally managed instance |
|
|
30 |
### |
|
|
31 |
#set ($actionStart = $services.localization.render('xe.officeimporter.openoffice.actions.connect')) |
|
|
32 |
#set ($actionStop = $services.localization.render('xe.officeimporter.openoffice.actions.disconnect')) |
|
|
33 |
#set ($autoStart = $services.localization.render('xe.officeimporter.openoffice.autoconnect')) |
|
|
34 |
#if ($services.officemanager.config.serverType == 0) |
|
|
35 |
#set ($serverType = $services.localization.render('xe.officeimporter.openoffice.servertype.internal')) |
|
|
36 |
#set ($actionStart = $services.localization.render('xe.officeimporter.openoffice.actions.start')) |
|
|
37 |
#set ($actionStop = $services.localization.render('xe.officeimporter.openoffice.actions.stop')) |
|
|
38 |
#set ($actionRestart = $services.localization.render('xe.officeimporter.openoffice.actions.restart')) |
|
|
39 |
#set ($autoStart = $services.localization.render('xe.officeimporter.openoffice.autostart')) |
|
|
40 |
#elseif ($services.officemanager.config.serverType == 1) |
|
|
41 |
#set ($serverType = $services.localization.render('xe.officeimporter.openoffice.servertype.external')) |
|
|
42 |
#elseif ($services.officemanager.config.serverType == 2) |
|
|
43 |
#set ($serverType = $services.localization.render('xe.officeimporter.openoffice.servertype.remote')) |
|
|
44 |
#end |
|
|
45 |
### |
|
|
46 |
### Display the configuration and the actions form |
|
|
47 |
### |
|
|
48 |
{{html}} |
|
|
49 |
<form action="$xwiki.relativeRequestURL" method="post" class="xform"> |
|
|
50 |
<fieldset> |
|
|
51 |
<legend>$escapetool.html($services.localization.render('admin.ooserver.options'))</legend> |
|
|
52 |
### |
|
|
53 |
### Info about the place to modify the configuration |
|
|
54 |
### |
|
|
55 |
<p> |
|
|
56 |
<span class="box infomessage"> |
|
|
57 |
## TODO: we do not escape this string because we inject some HTML code. We should improve it. |
|
|
58 |
$services.localization.render('admin.ooserver.options.source', ['<span class="monospace">xwiki.properties</span>']) |
|
|
59 |
</span> |
|
|
60 |
</p> |
|
|
61 |
<dl> |
|
|
62 |
### |
|
|
63 |
### Server Type |
|
|
64 |
### |
|
|
65 |
<dt> |
|
|
66 |
<label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.servertype'))</label> |
|
|
67 |
<span class="xHint"> |
|
|
68 |
$escapetool.xml($services.localization.render('office.config.serverType.hint')) |
|
|
69 |
</span> |
|
|
70 |
</dt> |
|
|
71 |
<dd>$escapetool.html($serverType)</dd> |
|
|
72 |
### |
|
|
73 |
### Server Port |
|
|
74 |
### |
|
|
75 |
<dt> |
|
|
76 |
<label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverport'))</label> |
|
|
77 |
<span class="xHint"> |
|
|
78 |
$escapetool.xml($services.localization.render('office.config.serverPort.hint')) |
|
|
79 |
</span> |
|
|
80 |
</dt> |
|
|
81 |
<dd>$escapetool.html($stringtool.join($services.officemanager.config.serverPorts, ","))</dd> |
|
|
82 |
### |
|
|
83 |
### Auto Start |
|
|
84 |
### |
|
|
85 |
<dt> |
|
|
86 |
<label>$escapetool.html($autoStart)</label> |
|
|
87 |
<span class="xHint"> |
|
|
88 |
$escapetool.xml($services.localization.render('office.config.autoStart.hint')) |
|
|
89 |
</span> |
|
|
90 |
</dt> |
|
|
91 |
<dd> |
|
|
92 |
#if($services.officemanager.config.autoStart) |
|
|
93 |
$escapetool.html($services.localization.render('xe.officeimporter.openoffice.yes')) |
|
|
94 |
#else |
|
|
95 |
$escapetool.html($services.localization.render('xe.officeimporter.openoffice.no')) |
|
|
96 |
#end |
|
|
97 |
</dd> |
|
|
98 |
### |
|
|
99 |
### If the server is an internally managed office server instance. |
|
|
100 |
### |
|
|
101 |
#if($services.officemanager.config.serverType == 0) |
|
|
102 |
### |
|
|
103 |
### Server Path |
|
|
104 |
### |
|
|
105 |
<dt> |
|
|
106 |
<label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverpath'))</label> |
|
|
107 |
<span class="xHint"> |
|
|
108 |
$escapetool.xml($services.localization.render('office.config.serverPath.hint')) |
|
|
109 |
</span> |
|
|
110 |
</dt> |
|
|
111 |
<dd>#set ($homePath = $services.officemanager.config.homePath) |
|
|
112 |
#if ("$!homePath" != '') |
|
|
113 |
$escapetool.html($homePath) |
|
|
114 |
#else |
|
|
115 |
<div class="box errormessage">$escapetool.html($services.localization.render('office.configuration.serverpath.error.notSetNotAutodetected'))</div> |
|
|
116 |
#end |
|
|
117 |
</dd> |
|
|
118 |
### |
|
|
119 |
### Server Profile |
|
|
120 |
### |
|
|
121 |
<dt><label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverprofile'))</label></dt> |
|
|
122 |
<dd> |
|
|
123 |
#if("$!services.officemanager.config.profilePath" == '' && $services.officemanager.config.profilePath != '') |
|
|
124 |
$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverprofile.default')) |
|
|
125 |
#else |
|
|
126 |
$escapetool.html($services.officemanager.config.profilePath) |
|
|
127 |
#end |
|
|
128 |
</dd> |
|
|
129 |
#end |
|
|
130 |
### |
|
|
131 |
### Server State |
|
|
132 |
### |
|
|
133 |
<dt><label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverstate'))</label></dt> |
|
|
134 |
<dd>$escapetool.html($services.officemanager.displayServerState())</dd> |
|
|
135 |
</dl> |
|
|
136 |
</fieldset> |
|
|
137 |
### |
|
|
138 |
### Actions |
|
|
139 |
### |
|
|
140 |
#if($hasAdmin && $xcontext.isMainWiki()) |
|
|
141 |
<fieldset> |
|
|
142 |
<legend>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.actions'))</legend> |
|
|
143 |
### |
|
|
144 |
### Start server |
|
|
145 |
### |
|
|
146 |
<p><label for="action1"><input id="action1" name="action" type="radio" value="start" checked="checked"/> $escapetool.html($actionStart)</label></p> |
|
|
147 |
### |
|
|
148 |
### Stop Server |
|
|
149 |
### |
|
|
150 |
<p><label for="action2"><input id="action2" name="action" type="radio" value="stop"/> $escapetool.html($actionStop)</label></p> |
|
|
151 |
### |
|
|
152 |
### Restart Server |
|
|
153 |
### |
|
|
154 |
#if($actionRestart) |
|
|
155 |
<p><label for="action3"><input id="action3" name="action" type="radio" value="restart"/> $escapetool.html($actionRestart)</label></p> |
|
|
156 |
#end |
|
|
157 |
</fieldset> |
|
|
158 |
### |
|
|
159 |
### Button to perform the action |
|
|
160 |
### |
|
|
161 |
<div class="buttons"> |
|
|
162 |
<input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> |
|
|
163 |
<span class="buttonwrapper"><input type="submit" value="$escapetool.html($services.localization.render('xe.officeimporter.openoffice.update'))" class="button"/></span> |
|
|
164 |
</div> |
|
|
165 |
#end |
|
|
166 |
</form> |
|
|
167 |
{{/html}} |
|
|
168 |
|
|
|
169 |
### |
|
|
170 |
### Display a warning message if the wiki is not the main one |
|
|
171 |
### |
|
|
172 |
#if($hasAdmin && !$xcontext.isMainWiki()) |
|
|
173 |
{{info}}$services.localization.render('xe.officeimporter.openoffice.limitedcontrol'){{/info}} |
|
|
174 |
#end |
|
|
175 |
{{/velocity}} |