]>
Commit | Line | Data |
---|---|---|
f07b75b0 TL |
1 | $$ = Dom7; |
2 | app = new Framework7({ | |
43f0b189 DC |
3 | root: '#app', |
4 | init: false, | |
5 | name: 'Proxmox Mail Gateway', | |
6 | routes: [ | |
7 | { | |
8 | path: '/:path/:subpath?', | |
9 | async: function(routeTo, routeFrom, resolve, reject) { | |
10 | if (routeTo.params.path === 'mail') { | |
11 | let mail = new MailView(); | |
12 | resolve({ | |
c87d46fb TL |
13 | template: mail.getTpl(), |
14 | }, { | |
43f0b189 | 15 | context: { |
c87d46fb TL |
16 | mailid: routeTo.params.subpath, |
17 | }, | |
43f0b189 DC |
18 | }); |
19 | } else { | |
20 | reject(); | |
21 | } | |
c87d46fb | 22 | }, |
43f0b189 DC |
23 | }, |
24 | { | |
25 | path: '/mail/:mailid/:action', | |
26 | async: function(routeTo, routeFrom, resolve, reject) { | |
27 | let action = routeTo.params.action; | |
28 | let mailid = routeTo.params.mailid; | |
43f0b189 DC |
29 | app.dialog.confirm( |
30 | `${action}: ${mailid}`, | |
31 | gettext('Confirm'), | |
32 | () => { | |
33 | let loader = app.dialog.preloader(); | |
34 | app.request({ | |
35 | method: 'POST', | |
36 | url: '/api2/json/quarantine/content/', | |
37 | data: { | |
38 | action: action, | |
c87d46fb | 39 | id: mailid, |
43f0b189 DC |
40 | }, |
41 | headers: { | |
c87d46fb | 42 | CSRFPreventionToken: Proxmox.CSRFPreventionToken, |
43f0b189 DC |
43 | }, |
44 | success: (data, status, xhr) => { | |
45 | loader.close(); | |
46 | app.dialog.alert( | |
47 | `Action '${action}' successful`, | |
48 | gettext("Info"), | |
49 | () => { | |
50 | if (action === 'delete' || | |
c87d46fb | 51 | action === 'deliver') { |
43f0b189 DC |
52 | // refresh the main list when a mail |
53 | // got deleted or delivered | |
54 | app.ptr.refresh(); | |
55 | } | |
c87d46fb | 56 | }, |
43f0b189 DC |
57 | ); |
58 | reject(); | |
59 | }, | |
60 | error: xhr => { | |
61 | loader.close(); | |
62 | PMG.Utils.showError(xhr); | |
63 | reject(); | |
c87d46fb TL |
64 | }, |
65 | }); | |
43f0b189 DC |
66 | }, |
67 | () => { | |
68 | reject(); | |
c87d46fb | 69 | }, |
43f0b189 | 70 | ); |
c87d46fb TL |
71 | }, |
72 | }, | |
73 | ], | |
43f0b189 DC |
74 | }); |
75 | ||
f07b75b0 | 76 | let _quarantine_view = new QuarantineView(); |
43f0b189 DC |
77 | |
78 | app.init(); |