diff options
Diffstat (limited to 'autoemail.php')
| -rw-r--r-- | autoemail.php | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/autoemail.php b/autoemail.php new file mode 100644 index 0000000..cac5647 --- /dev/null +++ b/autoemail.php @@ -0,0 +1,80 @@ +<?php +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +?> +<? + +(function () use ($id, $email_sql, $payload_sql, $independent_payload_sql, $payload_sql_order, $independent_payload_sql_order, $nocount, $post_sql, $exactmatch) { + if (!isset($nocount)) $nocount = false; + if (!isset($payload_sql)) $payload_sql = ""; + if (!isset($payload_sql_order)) $payload_sql_order = ""; + if (!isset($independent_payload_sql)) $independent_payload_sql = ""; + if (!isset($independent_payload_sql_order)) $independent_payload_sql_order = ""; + if (!isset($exactmatch)) $exactmatch = 0; +?> + +<div style="display: none;"> + <form id="doemail_<?=$id?>" action="/db/main/email.php" method="post"> + <input id="doemail_ids_<?=$id?>" name="ids" type="hidden" value=""> + <input id="doemail_sql_<?=$id?>" name="sql" type="hidden" value="<?=$email_sql?>"> + <input id="doemail_postsql_<?=$id?>" name="postsql" type="hidden" value="<?=$post_sql?>"> + <input id="doemail_payload_sql_<?=$id?>" name="payload_sql" type="hidden" value="<?=$payload_sql?>"> + <input id="doemail_payload_sql_order_<?=$id?>" name="payload_sql_order" type="hidden" value="<?=$payload_sql_order?>"> + <input id="doemail_independent_payload_sql_<?=$id?>" name="independent_payload_sql" type="hidden" value="<?=$independent_payload_sql?>"> + <input id="doemail_independent_payload_sql_order_<?=$id?>" name="independent_payload_sql_order" type="hidden" value="<?=$independent_payload_sql_order?>"> + <input id="doemail_nocount_<?=$id?>" name="nocount" type="hidden" value="<?=$nocount?>"> + <input id="doemail_exactmatch<?=$id?>" name="exactmatch" type="hidden" value="<?=$exactmatch?>"> + </form> +</div> + +<script> +<?php minStart(); ?> + +function doEmail_<?=$id?>(ids) { + if (typeof ids === 'undefined') { + if (typeof autotables === 'undefined') { + ids = []; + $('#<?=$id?> tr.selected').each(function () { + ids.push($(this).attr('data-id')); + }); + } else { + var g = $.grep(autotables['<?=$id?>'].table().rows().nodes(), function (e) { + return e.classList.contains('selected'); + }); + ids = []; + $.each(g, function (i, e) { + var ee = false; + var eee = false; + try { ee = e.getElementsByClassName('ajaxident')[0].getAttribute('data-id'); } catch (e) { e; } + try { eee = e.getElementsByClassName('ajaxident')[0].getAttribute('data-persid'); } catch (e) { e; } + if (ee) ids.push(ee); + else if (eee) ids.push(eee); + else if (e.getAttribute('data-id')) ids.push(e.getAttribute('data-id')); + else ids.push(e.getAttribute('data-persid')); + }); + } + } + $('#doemail_ids_<?=$id?>').val(ids); + $('#doemail_<?=$id?>').submit(); +} + +if ($('#<?=$id?>Actions').length > 0) { + $('#<?=$id?>Actions').append(' '); + $('<button class="medium" onclick="return doEmail_<?=$id?>();"><i class="fas fa-envelope"></i> E-Mail senden</button>').appendTo('#<?=$id?>Actions'); +} + +<?php minEnd(); ?> +</script> + +<? +})(); +?> |
