From ffe2c578ed26485e4869762e88c97e90b181bab3 Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Wed, 19 Sep 2018 05:52:43 +0000 Subject: - Email Anhang universell in E-Mail Konfiguration git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7156 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/admin/emailconf.phtml | 84 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) (limited to 'views/admin/emailconf.phtml') diff --git a/views/admin/emailconf.phtml b/views/admin/emailconf.phtml index 2f86c8c..97e0c3d 100644 --- a/views/admin/emailconf.phtml +++ b/views/admin/emailconf.phtml @@ -16,6 +16,12 @@ + +
@@ -154,9 +160,85 @@ jQuery.cookie('wpsg_mail', wpsg_mail_open.join(',')); } // function wpsg_mail_save_cookie() - + + function wpsg_removeAttachemnt(a) { + + var id = parseInt(a.getAttribute('data-id')); + var key = a.getAttribute('data-key'); + + uploadData[key].forEach(function(item, index, object) { + + if (parseInt(item.id) === id) { + + object.splice(index, 1); + + } + + } ); + + return false; + + } + + var wpframe; + jQuery(document).ready(function() { + + jQuery(".btnAddAttachment").click(function(event) { + + var source = event.target || event.srcElement; + var key = jQuery(source).attr("data-key"); + + event.preventDefault(); + + if (wpframe) { wpframe.open(); return; } + + wpframe = wp.media.frames.file_frame = wp.media({ + title: "", + button: { text: "" }, + multiple: true + }); + + wpframe.on('select', function() { + + var attachments = wpframe.state().get('selection').map( function(attachment) { + + attachment.toJSON(); + + var bDrin = false; + + for (var i in uploadData[key]) { + + if (uploadData[key][i].id === attachment.id) { + + bDrin = true; + + break; + + } + + } + + if (!bDrin) { + + uploadData[key].push( { + id: attachment.id, + filename: attachment.attributes.filename, + url: attachment.attributes.url + } ); + + } + + return attachment; + + } ); + + } ); + + wpframe.open(); + } ); + jQuery('.wpsg_email_box .panel-heading').bind('click', function() { jQuery(this).next().toggle(); -- cgit v1.2.3