]> git.agnieray.net Git - galette.git/blob - galette/includes/routes/management.routes.php
Move texts routes to a controller; closes #1354
[galette.git] / galette / includes / routes / management.routes.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Management routes
7 *
8 * PHP version 5
9 *
10 * Copyright © 2014 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Routes
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2014 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since 0.8.2dev 2014-11-11
35 */
36
37 use Galette\Controllers\GaletteController;
38 use Galette\Controllers\PluginsController;
39 use Galette\Controllers\HistoryController;
40 use Galette\Controllers\DynamicTranslationsController;
41 use Galette\Controllers\Crud;
42 use Galette\Controllers\PdfController;
43 use Galette\Controllers\CsvController;
44 use Galette\Controllers\AdminToolsController;
45 use Galette\Controllers\TextController;
46
47 use Galette\DynamicFields\DynamicField;
48 use Galette\Repository\Members;
49 use Galette\IO\News;
50 use \Analog\Analog;
51 use Galette\IO\Csv;
52 use Galette\IO\CsvOut;
53 use Galette\IO\CsvIn;
54 use Galette\Entity\Title;
55 use Galette\Repository\Titles;
56 use Galette\Entity\Texts;
57 use Galette\Core\Install;
58 use Galette\Entity\Status;
59
60 //galette's dashboard
61 $app->get(
62 '/dashboard',
63 GaletteController::class . ':dashboard'
64 )->setName('dashboard')->add($authenticate);
65
66 //preferences page
67 $app->get(
68 '/preferences',
69 GaletteController::class . ':preferences'
70 )->setName('preferences')->add($authenticate);
71
72 //preferences procedure
73 $app->post(
74 '/preferences',
75 GaletteController::class . ':storePreferences'
76 )->setName('store-preferences')->add($authenticate);
77
78 $app->get(
79 '/test/email',
80 GaletteController::class . ':testEmail'
81 )->setName('testEmail')->add($authenticate);
82
83 //charts
84 $app->get(
85 '/charts',
86 GaletteController::class . ':charts'
87 )->setName('charts')->add($authenticate);
88
89 //plugins
90 $app->get(
91 '/plugins',
92 PluginsController::class . ':showPlugins'
93 )->setName('plugins')->add($authenticate);
94
95 //plugins (de)activation
96 $app->get(
97 '/plugins/{action:activate|deactivate}/{module_id}',
98 PluginsController::class . ':togglePlugin'
99 )->setName('pluginsActivation')->add($authenticate);
100
101 $app->map(
102 ['GET', 'POST'],
103 '/plugins/initialize-database/{id}',
104 PluginsController::class . ':initPluginDb'
105 )->setName('pluginInitDb')->add($authenticate);
106
107 //galette logs
108 $app->get(
109 '/logs[/{option:page|order}/{value}]',
110 HistoryController::class . ':history'
111 )->setName('history')->add($authenticate);
112
113 $app->post(
114 '/logs/filter',
115 HistoryController::class . ':historyFilter'
116 )->setName(
117 'history_filter'
118 )->add($authenticate);
119
120 $app->get(
121 '/logs/flush',
122 HistoryController::class . ':confirmHistoryFlush'
123 )->setName('flushHistory')->add($authenticate);
124
125 $app->post(
126 '/logs/flush',
127 HistoryController::class . ':flushHistory'
128 )->setName('doFlushHistory')->add($authenticate);
129
130 //mailings management
131 $app->get(
132 '/mailings[/{option:page|order|reset}/{value}]',
133 Crud\MailingsController::class . ':list'
134 )->setName('mailings')->add($authenticate);
135
136 $app->post(
137 '/mailings/filter',
138 Crud\MailingsController::class . ':filter'
139 )->setName('mailings_filter')->add($authenticate);
140
141 $app->get(
142 '/mailings/remove' . '/{id:\d+}',
143 Crud\MailingsController::class . ':confirmDelete'
144 )->setName('removeMailing')->add($authenticate);
145
146 $app->post(
147 '/mailings/remove/{id:\d+}',
148 Crud\MailingsController::class . ':delete'
149 )->setName('doRemoveMailing')->add($authenticate);
150
151 //galette exports
152 $app->get(
153 '/export',
154 CsvController::class . ':export'
155 )->setName('export')->add($authenticate);
156
157 $app->get(
158 '/{type:export|import}/remove/{file}',
159 CsvController::class . ':confirmRemoveFile'
160 )->setName('removeCsv')->add($authenticate);
161
162 $app->post(
163 '/{type:export|import}/remove/{file}',
164 CsvController::class . ':removeFile'
165 )->setName('doRemoveCsv')->add($authenticate);
166
167 $app->post(
168 '/export',
169 CsvController::class . ':doExport'
170 )->setName('doExport')->add($authenticate);
171
172 $app->get(
173 '/{type:export|import}/get/{file}',
174 CsvController::class . ':getFile'
175 )->setName('getCsv')->add($authenticate);
176
177 $app->get(
178 '/import',
179 CsvController::class . ':import'
180 )->setName('import')->add($authenticate);
181
182 $app->post(
183 '/import',
184 CsvController::class . ':doImports'
185 )->setName('doImport')->add($authenticate);
186
187 $app->post(
188 '/import/upload',
189 CsvController::class . ':uploadImportFile'
190 )->setname('uploadImportFile')->add($authenticate);
191
192 $app->get(
193 '/import/model',
194 CsvController::class . ':importModel'
195 )->setName('importModel')->add($authenticate);
196
197 $app->get(
198 '/import/model/get',
199 CsvController::class . ':getImportModel'
200 )->setName('getImportModel')->add($authenticate);
201
202 $app->post(
203 '/import/model/store',
204 CsvController::class . ':storeModel'
205 )->setName('storeImportModel')->add($authenticate);
206
207 $app->get(
208 '/models/pdf[/{id:\d+}]',
209 PdfController::class . ':models'
210 )->setName('pdfModels')->add($authenticate);
211
212 $app->post(
213 '/models/pdf',
214 PdfController::class . ':storeModels'
215 )->setName('pdfModels')->add($authenticate);
216
217 $app->get(
218 '/titles',
219 Crud\TitlesController::class . ':list'
220 )->setName('titles')->add($authenticate);
221
222 $app->post(
223 '/titles',
224 Crud\TitlesController::class . ':doAdd'
225 )->setName('titles')->add($authenticate);
226
227 $app->get(
228 '/titles/remove/{id:\d+}',
229 Crud\TitlesController::class . ':confirmDelete'
230 )->setName('removeTitle')->add($authenticate);
231
232 $app->post(
233 '/titles/remove/{id:\d+}',
234 Crud\TitlesController::class . ':delete'
235 )->setName('doRemoveTitle')->add($authenticate);
236
237 $app->get(
238 '/titles/edit/{id:\d+}',
239 Crud\TitlesController::class . ':edit'
240 )->setname('editTitle')->add($authenticate);
241
242 $app->post(
243 '/titles/edit/{id:\d+}',
244 Crud\TitlesController::class . ':doEdit'
245 )->setname('editTitle')->add($authenticate);
246
247 $app->get(
248 '/texts[/{lang}/{ref}]',
249 TextController::class . ':list'
250 )->setName('texts')->add($authenticate);
251
252 $app->post(
253 '/texts/change',
254 TextController::class . ':change'
255 )->setName('changeText')->add($authenticate);
256
257 $app->post(
258 '/texts',
259 TextController::class . ':edit'
260 )->setName('texts')->add($authenticate);
261
262 $app->get(
263 '/{class:contributions-types|status}',
264 Crud\EntitledsController::class . ':list'
265 )->setName('entitleds')->add($authenticate);
266
267 $app->get(
268 '/{class:contributions-types|status}/{action:edit|add}[/{id:\d+}]',
269 Crud\EntitledsController::class . ':edit'
270 )->setName('editEntitled')->add($authenticate);
271
272 $app->post(
273 '/{class:contributions-types|status}/{action:edit|add}[/{id:\d+}]',
274 Crud\EntitledsController::class . ':doEdit'
275 )->setName('doEditEntitled')->add($authenticate);
276
277 $app->get(
278 '/{class:contributions-types|status}/remove/{id:\d+}',
279 Crud\EntitledsController::class . ':confirmDelete'
280 )->setName('removeEntitled')->add($authenticate);
281
282 $app->post(
283 '/{class:contributions-types|status}/remove/{id:\d+}',
284 Crud\EntitledsController::class . ':delete'
285 )->setName('doRemoveEntitled')->add($authenticate);
286
287 $app->get(
288 '/dynamic-translations[/{text_orig}]',
289 DynamicTranslationsController::class . ':dynamicTranslations'
290 )->setName('dynamicTranslations')->add($authenticate);
291
292 $app->post(
293 '/dynamic-translations',
294 DynamicTranslationsController::class . ':doDynamicTranslations'
295 )->setName('editDynamicTranslation')->add($authenticate);
296
297 $app->get(
298 '/lists/{table}/configure',
299 GaletteController::class . ':configureListFields'
300 )->setName('configureListFields')->add($authenticate);
301
302 $app->post(
303 '/lists/{table}/configure',
304 GaletteController::class . ':storeListFields'
305 )->setName('storeListFields')->add($authenticate);
306
307 $app->get(
308 '/fields/core/configure',
309 GaletteController::class . ':configureCoreFields'
310 )->setName('configureCoreFields')->add($authenticate);
311
312 $app->post(
313 '/fields/core/configure',
314 GaletteController::class . ':storeCoreFieldsConfig'
315 )->setName('storeCoreFieldsConfig')->add($authenticate);
316
317 $app->get(
318 '/fields/dynamic/configure[/{form:adh|contrib|trans}]',
319 Crud\DynamicFieldsController::class . ':list'
320 )->setName('configureDynamicFields')->add($authenticate);
321
322 $app->get(
323 '/fields/dynamic/move/{form:adh|contrib|trans}' .
324 '/{direction:up|down}/{id:\d+}',
325 Crud\DynamicFieldsController::class . ':move'
326 )->setName('moveDynamicField')->add($authenticate);
327
328 $app->get(
329 '/fields/dynamic/remove/{form:adh|contrib|trans}/{id:\d+}',
330 Crud\DynamicFieldsController::class . ':confirmDelete'
331 )->setName('removeDynamicField')->add($authenticate);
332
333 $app->post(
334 '/fields/dynamic/remove/{form:adh|contrib|trans}/{id:\d+}',
335 Crud\DynamicFieldsController::class . ':delete'
336 )->setName('doRemoveDynamicField')->add($authenticate);
337
338 $app->get(
339 '/fields/dynamic/add/{form:adh|contrib|trans}',
340 Crud\DynamicFieldsController::class . ':add'
341 )->setName('addDynamicField')->add($authenticate);
342
343 $app->get(
344 '/fields/dynamic/edit/{form:adh|contrib|trans}/{id:\d+}',
345 Crud\DynamicFieldsController::class . ':edit'
346 )->setName('editDynamicField')->add($authenticate);
347
348 $app->post(
349 '/fields/dynamic/add/{form:adh|contrib|trans}',
350 Crud\DynamicFieldsController::class . ':doAdd'
351 )->setName('doAddDynamicField')->add($authenticate);
352
353 $app->post(
354 '/fields/dynamic/edit/{form:adh|contrib|trans}/{id:\d+}',
355 Crud\DynamicFieldsController::class . ':doEdit'
356 )->setName('doEditDynamicField')->add($authenticate);
357
358 if (GALETTE_MODE != 'DEMO') {
359 $app->get(
360 '/generate-data',
361 GaletteController::class . ':fakeData'
362 )->setName('fakeData')->add($authenticate);
363
364 $app->post(
365 '/generate-data',
366 GaletteController::class . ':doFakeData'
367 )->setName('doFakeData')->add($authenticate);
368 }
369
370 $app->get(
371 '/admin-tools',
372 AdminToolsController::class . ':adminTools'
373 )->setName('adminTools')->add($authenticate);
374
375 $app->post(
376 '/admin-tools',
377 AdminToolsController::class . ':process'
378 )->setName('doAdminTools')->add($authenticate);
379
380 $app->get(
381 '/payment-types',
382 Crud\PaymentTypeController::class . ':list'
383 )->setName('paymentTypes')->add($authenticate);
384
385 $app->post(
386 '/payment-types',
387 Crud\PaymentTypeController::class . ':doAdd'
388 )->setName('paymentTypes')->add($authenticate);
389
390 $app->get(
391 '/payment-type/remove/{id:\d+}',
392 Crud\PaymentTypeController::class . ':confirmDelete'
393 )->setName('removePaymentType')->add($authenticate);
394
395 $app->post(
396 '/payment-type/remove/{id:\d+}',
397 Crud\PaymentTypeController::class . ':delete'
398 )->setName('doRemovePaymentType')->add($authenticate);
399
400 $app->get(
401 '/payment-type/edit/{id:\d+}',
402 Crud\PaymentTypeController::class . ':edit'
403 )->setname('editPaymentType')->add($authenticate);
404
405 $app->post(
406 '/payment-type/edit/{id:\d+}',
407 Crud\PaymentTypeController::class . ':doEdit'
408 )->setname('editPaymentType')->add($authenticate);