0 Votes

Wiki source code of Office Server

Last modified by Ryan C on 2025/04/30 08:04

Show last authors
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 #info($escapetool.html($services.localization.render('admin.ooserver.options.source', ['__VALUE__'])).replaceFirst('__VALUE__', '<span class="monospace">xwiki.properties</span>'))
57 </p>
58 <dl>
59 ###
60 ### Server Type
61 ###
62 <dt>
63 <label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.servertype'))</label>
64 <span class="xHint">
65 $escapetool.xml($services.localization.render('office.config.serverType.hint'))
66 </span>
67 </dt>
68 <dd>$escapetool.html($serverType)</dd>
69 ###
70 ### Server Port
71 ###
72 <dt>
73 <label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverport'))</label>
74 <span class="xHint">
75 $escapetool.xml($services.localization.render('office.config.serverPort.hint'))
76 </span>
77 </dt>
78 <dd>$escapetool.html($stringtool.join($services.officemanager.config.serverPorts, ","))</dd>
79 ###
80 ### Auto Start
81 ###
82 <dt>
83 <label>$escapetool.html($autoStart)</label>
84 <span class="xHint">
85 $escapetool.xml($services.localization.render('office.config.autoStart.hint'))
86 </span>
87 </dt>
88 <dd>
89 #if($services.officemanager.config.autoStart)
90 $escapetool.html($services.localization.render('xe.officeimporter.openoffice.yes'))
91 #else
92 $escapetool.html($services.localization.render('xe.officeimporter.openoffice.no'))
93 #end
94 </dd>
95 ###
96 ### If the server is an internally managed office server instance.
97 ###
98 #if($services.officemanager.config.serverType == 0)
99 ###
100 ### Server Path
101 ###
102 <dt>
103 <label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverpath'))</label>
104 <span class="xHint">
105 $escapetool.xml($services.localization.render('office.config.serverPath.hint'))
106 </span>
107 </dt>
108 <dd>#set ($homePath = $services.officemanager.config.homePath)
109 #if ("$!homePath" != '')
110 $escapetool.html($homePath)
111 #else
112 #error($escapetool.html($services.localization.render('office.configuration.serverpath.error.notSetNotAutodetected')))
113 #end
114 </dd>
115 ###
116 ### Server Profile
117 ###
118 <dt><label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverprofile'))</label></dt>
119 <dd>
120 #if("$!services.officemanager.config.profilePath" == '' && $services.officemanager.config.profilePath != '')
121 $escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverprofile.default'))
122 #else
123 $escapetool.html($services.officemanager.config.profilePath)
124 #end
125 </dd>
126 #end
127 ###
128 ### Server State
129 ###
130 <dt><label>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.serverstate'))</label></dt>
131 <dd>$escapetool.html($services.officemanager.displayServerState())</dd>
132 </dl>
133 </fieldset>
134 ###
135 ### Actions
136 ###
137 #if($hasAdmin && $xcontext.isMainWiki())
138 <fieldset>
139 <legend>$escapetool.html($services.localization.render('xe.officeimporter.openoffice.actions'))</legend>
140 ###
141 ### Start server
142 ###
143 <p><label for="action1"><input id="action1" name="action" type="radio" value="start" checked="checked"/> $escapetool.html($actionStart)</label></p>
144 ###
145 ### Stop Server
146 ###
147 <p><label for="action2"><input id="action2" name="action" type="radio" value="stop"/> $escapetool.html($actionStop)</label></p>
148 ###
149 ### Restart Server
150 ###
151 #if($actionRestart)
152 <p><label for="action3"><input id="action3" name="action" type="radio" value="restart"/> $escapetool.html($actionRestart)</label></p>
153 #end
154 </fieldset>
155 ###
156 ### Button to perform the action
157 ###
158 <div class="buttons">
159 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
160 <span class="buttonwrapper"><input type="submit" value="$escapetool.html($services.localization.render('xe.officeimporter.openoffice.update'))" class="button"/></span>
161 </div>
162 #end
163 </form>
164 {{/html}}
165
166 ###
167 ### Display a warning message if the wiki is not the main one
168 ###
169 #if($hasAdmin && !$xcontext.isMainWiki())
170 {{info}}$services.localization.render('xe.officeimporter.openoffice.limitedcontrol'){{/info}}
171 #end
172 {{/velocity}}