Révision 813372ab
Ajouté par Frédéric Péters il y a plus de 4 ans
auquotidien/modules/admin.py | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class PanelDirectory(Directory): |
25 | 25 |
_q_exports = ['', 'update', 'announces', 'permissions', |
26 |
'announce_themes', 'strongbox', 'clicrdv', 'domino']
|
|
26 |
'announce_themes', 'strongbox', 'domino'] |
|
27 | 27 |
label = N_('Control Panel') |
28 | 28 |
|
29 | 29 |
domino = AbeliumDominoDirectory() |
... | ... | |
160 | 160 |
cfg_submit(form, 'misc', ('aq-strongbox',)) |
161 | 161 |
return redirect('..') |
162 | 162 |
|
163 |
def clicrdv(self): |
|
164 |
if not get_publisher().has_site_option('clicrdv'): |
|
165 |
raise errors.TraversalError() |
|
166 |
misc_cfg = get_cfg('misc', {}) |
|
167 |
form = Form(enctype='multipart/form-data') |
|
168 |
form.add(SingleSelectWidget, 'aq-clicrdv-server', title=_('ClicRDV Server'), |
|
169 |
value=misc_cfg.get('aq-clicrdv-server', 'sandbox.clicrdv.com'), required=True, |
|
170 |
options=[(str('www.clicrdv.com'), _('Production Server')), |
|
171 |
(str('sandbox.clicrdv.com'), _('Sandbox Server'))]) |
|
172 |
form.add(StringWidget, 'aq-clicrdv-api-key', title=_('API Key'), |
|
173 |
value=misc_cfg.get('aq-clicrdv-api-key'), required=False, |
|
174 |
size=40, hint=_('Empty to disable ClicRDV support')) |
|
175 |
form.add(StringWidget, 'aq-clicrdv-api-username', title=_('Username'), |
|
176 |
value=misc_cfg.get('aq-clicrdv-api-username'), required=False) |
|
177 |
form.add(StringWidget, 'aq-clicrdv-api-password', title=_('Password'), |
|
178 |
value=misc_cfg.get('aq-clicrdv-api-password'), required=False) |
|
179 |
|
|
180 |
form.add_submit('submit', _('Submit')) |
|
181 |
form.add_submit('cancel', _('Cancel')) |
|
182 |
|
|
183 |
if form.get_widget('cancel').parse(): |
|
184 |
return redirect('..') |
|
185 |
|
|
186 |
if not form.is_submitted() or form.has_errors(): |
|
187 |
get_response().breadcrumb.append(('aq/clicrdv', _('ClicRDV Integration'))) |
|
188 |
html_top('settings', _('ClicRDV Integration')) |
|
189 |
r = TemplateIO(html=True) |
|
190 |
r += htmltext('<h2>%s</h2>') % _('ClicRDV Integration') |
|
191 |
r += form.render() |
|
192 |
r += htmltext('<p>%s</p>') % _('Available Interventions: ') |
|
193 |
try: |
|
194 |
from clicrdv import get_all_intervention_sets |
|
195 |
intervention_sets = get_all_intervention_sets() |
|
196 |
r += htmltext('<ul>') |
|
197 |
for s in intervention_sets: |
|
198 |
r += htmltext('<li><strong>clicrdv_get_interventions_in_set(%s)</strong> - %s') % ( |
|
199 |
s['id'], s['name']) |
|
200 |
r += htmltext('<ul>') |
|
201 |
for n, intervention in s['interventions']: |
|
202 |
r += htmltext('<li>%s (id: %s)</li>') % (intervention, n) |
|
203 |
r += htmltext('</ul></li>') |
|
204 |
r += htmltext('</ul>') |
|
205 |
except Exception, e: |
|
206 |
r += htmltext('<p>%s (%s)</p>') % ( |
|
207 |
_('Cannot access to ClicRDV service'), str(e)) |
|
208 |
return r.getvalue() |
|
209 |
else: |
|
210 |
from wcs.admin.settings import cfg_submit |
|
211 |
cfg_submit(form, 'misc', ('aq-clicrdv-server', |
|
212 |
'aq-clicrdv-api-key', |
|
213 |
'aq-clicrdv-api-username', |
|
214 |
'aq-clicrdv-api-password')) |
|
215 |
return redirect('..') |
|
216 |
|
|
217 | 163 |
|
218 | 164 |
class SettingsDirectory(wcs.admin.settings.SettingsDirectory): |
219 | 165 |
def _q_index(self): |
... | ... | |
234 | 180 |
r += htmltext('<li><a href="aq/announce_themes">%s</a></li>') % _('Announce Themes') |
235 | 181 |
if get_publisher().has_site_option('strongbox'): |
236 | 182 |
r += htmltext('<li><a href="aq/strongbox">%s</a></li>') % _('Strongbox Support') |
237 |
if get_publisher().has_site_option('clicrdv'): |
|
238 |
r += htmltext('<li><a href="aq/clicrdv">%s</a></li>') % _('ClicRDV Integration') |
|
239 | 183 |
if get_publisher().has_site_option('domino'): |
240 | 184 |
r += htmltext('<li><a href="aq/domino">%s</a></li>') % _('Abelium Domino Integration') |
241 | 185 |
r += htmltext('</ul>') |
Formats disponibles : Unified diff
remove support for clicrdv (#5484)