]> git.agnieray.net Git - galette.git/blob - galette/templates/default/gestion_mailings.tpl
Add CSRF Middleware
[galette.git] / galette / templates / default / gestion_mailings.tpl
1 {extends file="page.tpl"}
2
3 {block name="content"}
4 <form action="{path_for name="mailings_filter"}" method="post" id="filtre">
5 <div id="listfilter">
6 <label for="start_date_filter">{_T string="since"}</label>&nbsp;
7 <input type="text" name="start_date_filter" id="start_date_filter" maxlength="10" size="10" value="{$history->filters->start_date_filter}"/>
8 <label for="end_date_filter">{_T string="until"}</label>&nbsp;
9 <input type="text" name="end_date_filter" id="end_date_filter" maxlength="10" size="10" value="{$history->filters->end_date_filter}"/>
10
11 {assign var="senders" value=$history->getSendersList()}
12 {if $senders|@count gt 0}
13 <label for="sender_filter">{_T string="Sender"}</label>&nbsp;
14 <select name="sender_filter" id="sender_filter">
15 <option value="0"{if $history->filters->sender_filter eq 0} selected="selected"{/if}>{_T string="Select a sender"}</option>
16 {foreach from=$senders item=$sender key=$key}
17 <option value="{$key}"{if $history->filters->sender_filter == $key} selected="selected"{/if}>{$sender}</option>
18 {/foreach}
19 </select>
20 {/if}
21
22 <input type="submit" class="inline" value="{_T string="Filter"}"/>
23 <input type="submit" name="clear_filter" class="inline" value="{_T string="Clear filter"}"/>
24
25 <div>
26 <label for="subject_filter">{_T string="Subject"}</label>
27 <input type="text" name="subject_filter" id="subject_filter" value="{$history->filters->subject_filter}"/>
28 {_T string="Sent mailings:"}
29 <input type="radio" name="sent_filter" id="filter_dc_sent" value="{Galette\Core\MailingHistory::FILTER_DC_SENT}"{if $history->filters->sent_filter eq constant('Galette\Core\MailingHistory::FILTER_DC_SENT')} checked="checked"{/if}>
30 <label for="filter_dc_sent" >{_T string="Don't care"}</label>
31 <input type="radio" name="sent_filter" id="filter_sent" value="{Galette\Core\MailingHistory::FILTER_SENT}"{if $history->filters->sent_filter eq constant('Galette\Core\MailingHistory::FILTER_SENT')} checked="checked"{/if}>
32 <label for="filter_sent" >{_T string="Yes"}</label>
33 <input type="radio" name="sent_filter" id="filter_not_sent" value="{Galette\Core\MailingHistory::FILTER_NOT_SENT}"{if $history->filters->sent_filter eq constant('Galette\Core\MailingHistory::FILTER_NOT_SENT')} checked="checked"{/if}>
34 <label for="filter_not_sent" >{_T string="No"}</label>
35 </div>
36 </div>
37 <table class="infoline">
38 <tr>
39 <td class="left nowrap">
40 {_T string="%count entry" plural="%count entries" count=$history->getCount() pattern="/%count/" replace=$history->getCount()}
41 </td>
42 <td class="right">
43 <label for="nbshow">{_T string="Records per page:"}</label>
44 <select name="nbshow" id="nbshow">
45 {html_options options=$nbshow_options selected=$numrows}
46 </select>
47 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
48 {include file="forms_types/csrf.tpl"}
49 </td>
50 </tr>
51 </table>
52 </form>
53
54
55 <table class="listing">
56 <thead>
57 <tr>
58 <th class="small_head">#</th>
59 <th class="left date_row">
60 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_DATE"|constant]}">
61 {_T string="Date"}
62 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_DATE')}
63 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
64 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
65 {else}
66 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
67 {/if}
68 {/if}
69 </a>
70 </th>
71 <th class="left username_row">
72 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SENDER"|constant]}">
73 {_T string="Sender"}
74 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SENDER')}
75 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
76 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
77 {else}
78 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
79 {/if}
80 {/if}
81 </a>
82 </th>
83 <th class="left small_head">
84 {_T string="Recipients"}
85 </th>
86 <th class="left">
87 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SUBJECT"|constant]}">
88 {_T string="Subject"}
89 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SUBJECT')}
90 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
91 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
92 {else}
93 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
94 {/if}
95 {/if}
96 </a>
97 </th>
98 <th title="{_T string="Attachments"}" class="small_head">
99 {_T string="Att."}
100 </th>
101 <th class="left right small_head">
102 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SENT"|constant]}">
103 {_T string="Sent"}
104 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SENT')}
105 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
106 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
107 {else}
108 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
109 {/if}
110 {/if}
111 </a>
112 </th>
113 <th class="small_head"></th>
114 </tr>
115 </thead>
116 <tbody>
117 {foreach from=$logs item=log name=eachlog}
118 <tr class="{if $smarty.foreach.eachlog.iteration % 2 eq 0}even{else}odd{/if}">
119 <td data-scope="row">
120 {if $preferences->pref_show_id}
121 {$log.mailing_id}
122 {else}
123 {$smarty.foreach.eachlog.iteration}
124 {/if}
125 <span class="row-title">
126 {_T string="Mailing entry %id" pattern="/%id/" replace=$log.mailing_id}
127 </span>
128 </td>
129 <td class="nowrap" data-title="{_T string="Date"}">{$log.mailing_date|date_format:{_T string="Y-m-d H:i:s"}}</td>
130 <td data-title="{_T string="Sender"}">{if $log.mailing_sender eq 0}{_T string="Superadmin"}{else}{$log.mailing_sender_name}{/if}</td>
131 <td data-title="{_T string="Recipients"}">{$log.mailing_recipients|unserialize|@count}</td>
132 <td data-title="{_T string="Subject"}">{$log.mailing_subject}</td>
133 <td class="center" data-title="{_T string="Attachments"}">{$log.attachments}</td>
134 <td class="center{if $log.mailing_sent == 1} use{/if}" data-title="{_T string="Sent"}">
135 {if $log.mailing_sent == 1}
136 <i class="fas fa-thumbs-up"></i>
137 {else}
138 <i class="fas fa-thumbs-down"></i>
139 {/if}
140 </td>
141 <td class="center nowrap actions_row">
142 <a
143 href="{path_for name="mailingPreview" data=["id" => $log.mailing_id]}"
144 class="showdetails tooltip"
145 >
146 <i class="fas fa-eye"></i>
147 <span class="sr-only">{_T string="Display mailing '%subject' details in preview window" pattern="/%subject/" replace=$log.mailing_subject}</span>
148 </a>
149 <a
150 href="{path_for name="mailing"}?from={$log.mailing_id}"
151 class="tooltip"
152 >
153 <i class="fas fa-clone"></i>
154 <span class="sr-only">{_T string="Use mailing '%subject' as a template for a new one" pattern="/%subject/" replace=$log.mailing_subject}</span>
155 </a>
156 <a
157 href="{path_for name="removeMailing" data=["id" => $log.mailing_id]}"
158 class="delete tooltip"
159 >
160 <i class="fas fa-trash"></i>
161 <span class="sr-only">{_T string="Delete mailing '%subject'" pattern="/%subject/" replace=$log.mailing_subject}</span>
162 </a>
163 </td>
164 </tr>
165 {foreachelse}
166 <tr><td colspan="8" class="emptylist">{_T string="No sent mailing has been stored in the database yet."}</td></tr>
167 {/foreach}
168 </tbody>
169 </table>
170 <div class="center cright">
171 {_T string="Pages:"}<br/>
172 <ul class="pages">{$pagination}</ul>
173 </div>
174 <div class="center">
175 <a
176 class="button use"
177 href="{path_for name="mailing"}?mailing_new=true"
178 >
179 <i class="fas fa-plus-square"></i>
180 {_T string="Create new mailing"}
181 </a>
182 </div>
183 {/block}
184
185 {block name="javascripts"}
186 <script type="text/javascript">
187 {include file="js_removal.tpl"}
188
189 $('#start_date_filter, #end_date_filter').datepicker({
190 changeMonth: true,
191 changeYear: true,
192 showOn: 'button',
193 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
194 });
195
196 {* Preview popup *}
197 $('.showdetails').click(function(){
198 $.ajax({
199 url: $(this).attr('href'),
200 type: "POST",
201 data: {
202 ajax: true,
203 },
204 {include file="js_loader.tpl"},
205 success: function(res){
206 _preview_dialog(res);
207 },
208 error: function() {
209 alert("{_T string="An error occurred displaying preview :(" escape="js"}");
210 }
211 });
212 return false;
213 });
214
215 var _preview_dialog = function(res){
216 var _el = $('<div id="ajax_preview" title="{_T string="Mailing preview" escape="js"}"> </div>');
217 _el.appendTo('body').dialog({
218 modal: true,
219 hide: 'fold',
220 width: '80%',
221 height: 500,
222 close: function(event, ui){
223 _el.remove();
224 }
225 });
226 $('#ajax_preview').append( res );
227 }
228
229 </script>
230 {/block}