]> git.agnieray.net Git - galette.git/blob - galette/templates/default/gestion_mailings.tpl
Fix some notices
[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 </td>
49 </tr>
50 </table>
51 </form>
52
53
54 <table class="listing">
55 <thead>
56 <tr>
57 <th class="small_head">#</th>
58 <th class="left date_row">
59 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_DATE"|constant]}">
60 {_T string="Date"}
61 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_DATE')}
62 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
63 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
64 {else}
65 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
66 {/if}
67 {/if}
68 </a>
69 </th>
70 <th class="left username_row">
71 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SENDER"|constant]}">
72 {_T string="Sender"}
73 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SENDER')}
74 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
75 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
76 {else}
77 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
78 {/if}
79 {/if}
80 </a>
81 </th>
82 <th class="left small_head">
83 {_T string="Recipients"}
84 </th>
85 <th class="left">
86 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SUBJECT"|constant]}">
87 {_T string="Subject"}
88 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SUBJECT')}
89 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
90 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
91 {else}
92 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
93 {/if}
94 {/if}
95 </a>
96 </th>
97 <th title="{_T string="Attachments"}" class="small_head">
98 {_T string="Att."}
99 </th>
100 <th class="left right small_head">
101 <a href="{path_for name="mailings" data=["option" => "order", "value" => "Galette\Filters\MailingsList::ORDERBY_SENT"|constant]}">
102 {_T string="Sent"}
103 {if $history->filters->orderby eq constant('Galette\Filters\MailingsList::ORDERBY_SENT')}
104 {if $history->filters->ordered eq constant('Galette\Filters\MailingsList::ORDER_ASC')}
105 <img src="{base_url}/{$template_subdir}images/down.png" width="10" height="6" alt="{_T string="Ascendent"}"/>
106 {else}
107 <img src="{base_url}/{$template_subdir}images/up.png" width="10" height="6" alt="{_T string="Descendant"}"/>
108 {/if}
109 {/if}
110 </a>
111 </th>
112 <th class="small_head"></th>
113 </tr>
114 </thead>
115 <tbody>
116 {foreach from=$logs item=log name=eachlog}
117 <tr class="{if $smarty.foreach.eachlog.iteration % 2 eq 0}even{else}odd{/if}">
118 <td data-scope="row">
119 {if $preferences->pref_show_id}
120 {$log.mailing_id}
121 {else}
122 {$smarty.foreach.eachlog.iteration}
123 {/if}
124 <span class="row-title">
125 {_T string="Mailing entry %id" pattern="/%id/" replace=$log.mailing_id}
126 </span>
127 </td>
128 <td class="nowrap" data-title="{_T string="Date"}">{$log.mailing_date|date_format:"%a %d/%m/%Y - %R"}</td>
129 <td data-title="{_T string="Sender"}">{if $log.mailing_sender eq 0}{_T string="Superadmin"}{else}{$log.mailing_sender_name}{/if}</td>
130 <td data-title="{_T string="Recipients"}">{$log.mailing_recipients|unserialize|@count}</td>
131 <td data-title="{_T string="Subject"}">{$log.mailing_subject}</td>
132 <td class="center" data-title="{_T string="Attachments"}">{$log.attachments}</td>
133 <td class="center {if $log.mailing_sent == 1}use{else}delete{/if}" data-title="{_T string="Sent"}">
134 {if $log.mailing_sent == 1}
135 <i class="fas fa-thumbs-up"></i>
136 {else}
137 <i class="fas fa-thumbs-down"></i>
138 {/if}
139 </td>
140 <td class="center nowrap actions_row">
141 <a
142 href="{path_for name="mailingPreview" data=["id" => $log.mailing_id]}"
143 class="showdetails tooltip"
144 >
145 <i class="fas fa-eye"></i>
146 <span class="sr-only">{_T string="Display mailing '%subject' details in preview window" pattern="/%subject/" replace=$log.mailing_subject}</span>
147 </a>
148 <a
149 href="{path_for name="mailing"}?from={$log.mailing_id}"
150 class="tooltip"
151 >
152 <i class="fas fa-clone"></i>
153 <span class="sr-only">{_T string="Use mailing '%subject' as a template for a new one" pattern="/%subject/" replace=$log.mailing_subject}</span>
154 </a>
155 <a
156 href="{path_for name="removeMailing" data=["id" => $log.mailing_id]}"
157 class="delete tooltip"
158 >
159 <i class="fas fa-trash"></i>
160 <span class="sr-only">{_T string="Delete mailing '%subject'" pattern="/%subject/" replace=$log.mailing_subject}</span>
161 </a>
162 </td>
163 </tr>
164 {foreachelse}
165 <tr><td colspan="8" class="emptylist">{_T string="No sent mailing has been stored in the database yet."}</td></tr>
166 {/foreach}
167 </tbody>
168 </table>
169 <div class="center cright">
170 {_T string="Pages:"}<br/>
171 <ul class="pages">{$pagination}</ul>
172 </div>
173 <div class="center">
174 <a
175 class="button use"
176 href="{path_for name="mailing"}?mailing_new=true"
177 >
178 <i class="fas fa-plus-square"></i>
179 {_T string="Create new mailing"}
180 </a>
181 </div>
182 {/block}
183
184 {block name="javascripts"}
185 <script type="text/javascript">
186 $('#nbshow').change(function() {
187 this.form.submit();
188 });
189
190 {include file="js_removal.tpl"}
191
192 $('#start_date_filter, #end_date_filter').datepicker({
193 changeMonth: true,
194 changeYear: true,
195 showOn: 'button',
196 buttonText: '<i class="far fa-calendar-alt"></i> <span class="sr-only">{_T string="Select a date" escape="js"}</span>'
197 });
198
199 {* Preview popup *}
200 $('.showdetails').click(function(){
201 $.ajax({
202 url: $(this).attr('href'),
203 type: "POST",
204 data: {
205 ajax: true,
206 },
207 {include file="js_loader.tpl"},
208 success: function(res){
209 _preview_dialog(res);
210 },
211 error: function() {
212 alert("{_T string="An error occurred displaying preview :(" escape="js"}");
213 }
214 });
215 return false;
216 });
217
218 var _preview_dialog = function(res){
219 var _el = $('<div id="ajax_preview" title="{_T string="Mailing preview" escape="js"}"> </div>');
220 _el.appendTo('body').dialog({
221 modal: true,
222 hide: 'fold',
223 width: '80%',
224 height: 500,
225 close: function(event, ui){
226 _el.remove();
227 }
228 });
229 $('#ajax_preview').append( res );
230 }
231
232 </script>
233 {/block}