diff options
| author | Daniel Schmitzer <noreply@maennchen1.de> | 2018-09-19 05:52:43 +0000 |
|---|---|---|
| committer | Daniel Schmitzer <noreply@maennchen1.de> | 2018-09-19 05:52:43 +0000 |
| commit | ffe2c578ed26485e4869762e88c97e90b181bab3 (patch) | |
| tree | ec3851761cea04578400de82272a35648a2e5c11 /views | |
| parent | b1cd3f800d12677ffe4b73ab893d02aad20506b0 (diff) | |
- Email Anhang universell in E-Mail Konfiguration
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7156 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views')
| -rw-r--r-- | views/admin/emailconf.phtml | 84 | ||||
| -rw-r--r-- | views/admin/form/emailconf.phtml | 98 | ||||
| -rw-r--r-- | views/css/admin.css | 5 |
3 files changed, 174 insertions, 13 deletions
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 @@ </div>
+<script>
+
+ var uploadData = {};
+
+</script>
+
<div class="wpsg_admin_content form-horizontal">
<form name="form1" method="post" enctype="multipart/form-data" action="<?php echo wpsg_hspc(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf&noheader=1'); ?>">
@@ -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: "<?php echo __('Auswählen oder Hochladen von Medien', 'wpsg'); ?>",
+ button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
+ 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();
diff --git a/views/admin/form/emailconf.phtml b/views/admin/form/emailconf.phtml index e89055d..98fd45c 100644 --- a/views/admin/form/emailconf.phtml +++ b/views/admin/form/emailconf.phtml @@ -11,19 +11,39 @@ <?php echo wpsg_drawForm_Input('wpsg_'.$this->view['field_key'].'_cc', __('CC', 'wpsg'), $this->get_option('wpsg_'.$this->view['field_key'].'_cc')); ?>
<?php echo wpsg_drawForm_Input('wpsg_'.$this->view['field_key'].'_bcc', __('BCC', 'wpsg'), $this->get_option('wpsg_'.$this->view['field_key'].'_bcc')); ?>
- <?php if ($this->view['field_attachment'] === true) { ?>
-
- <?php echo wpsg_drawForm_Upload('wpsg_'.$this->view['field_key'].'_attachfile', __('Mailanhang', 'wpsg'), '', '43', '100000'); ?>
- <br />
- <div class="wpsg_hinweis">
- <strong><?php echo __('Aktueller Anhang', 'wpsg') ?>: </strong><?php echo ((wpsg_isSizedString($this->get_option('wpsg_'.$this->view['field_key'].'_attachfile')))?$this->get_option('wpsg_'.$this->view['field_key'].'_attachfile'):__('keiner', 'wpsg')); ?>
- <?php echo ((wpsg_isSizedString($this->get_option('wpsg_kundenmail_attachfile')))?'<a class="wpsg_glyphicon_right glyphicon glyphicon-minus-sign" titel="'.__('Datei entfernen', 'wpsg').'" href="'.WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction='.$_REQUEST['subaction'].'&cmd=del_attach_file"></a>':''); ?>
- </div>
- <br />
-
- <?php } ?>
+ <div class="form-group form-group-sm">
+
+ <label class="col-sm-6 control-label">
+
+ <input value="<?php echo __('Neuer Anhang', 'wpsg'); ?>" data-key="<?php echo $this->view['field_key']; ?>" class="btnAddAttachment button" type="text" style="text-align:center;" size="10" id="media_<?php echo $this->view['field_key']; ?>" />
+
+ </label>
+
+ <div class="col-sm-6">
+
+ <div class="wpsg_mailattachment" id="wpsg_mailattachment_<?php echo $this->view['field_key']; ?>">
+ <div v-for="a in arAttachment">
+
+ <div class="wpsg_flex wpsg_flex_justify_content_space_between wpsg_flex_align_items_center">
+ <a target="_blank" v-bind:href="a.url">{{a.filename}}</a>
+ <a href="" v-bind:data-id="a.id" data-key="<?php echo $this->view['field_key']; ?>" onclick="return wpsg_removeAttachemnt(this);">
+ <span class="fa fa-trash"></span>
+ </a>
+ </div>
+
+ </div>
+ <input type="hidden" v-bind:value="getIds" name="wpsg_<?php echo $this->view['field_key']; ?>_mediaattachment" />
+ </div>
+
+ </div>
+
+ <div class="clearfix wpsg_clear"></div>
+
+ </div>
+
+ <hr />
- <br /><p style="font-weight:700;"><?php echo (__('Text unter der E-Mail', 'wpsg')); ?></p>
+ <p style="font-weight:700;"><?php echo (__('Text unter der E-Mail', 'wpsg')); ?></p>
<?php
@@ -47,5 +67,59 @@ <?php } ?>
<br />
+
+ <script>
+
+ uploadData['<?php echo $this->view['field_key']; ?>'] = <?php
+
+ $arAttachment = [];
+ $arAttachmentSet = $this->get_option('wpsg_'.$this->view['field_key'].'_mediaattachment');
+
+ if (wpsg_isSizedString($arAttachmentSet)) {
+
+ $arAttachmentSet = explode(',', $arAttachmentSet);
+
+ foreach ($arAttachmentSet as $a_id) {
+
+ $a_file = get_attached_file($a_id);
+ $a_url = wp_get_attachment_url($a_id);
+
+ $arAttachment[] = [
+ 'id' => $a_id,
+ 'filename' => basename($a_file),
+ 'url' => $a_url
+ ];
+
+ }
+
+ }
+
+ echo json_encode($arAttachment);
+
+ ?>;
+
+ var wpsg_mailattachment_<?php echo $this->view['field_key']; ?> = new Vue( {
+ el: '#wpsg_mailattachment_<?php echo $this->view['field_key']; ?>',
+ data: {
+ arAttachment: uploadData.<?php echo $this->view['field_key']; ?>
+ },
+ computed: {
+ getIds: function() {
+
+ var arReturn = [];
+
+ for (var i in this.arAttachment) {
+
+ arReturn.push(this.arAttachment[i].id);
+
+ }
+
+ return arReturn;
+
+ }
+ }
+ } );
+
+ </script>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
\ No newline at end of file diff --git a/views/css/admin.css b/views/css/admin.css index 5377fad..8de5fbb 100644 --- a/views/css/admin.css +++ b/views/css/admin.css @@ -3,6 +3,9 @@ /* Allgemein */
.wpsg_clear { clear:both; }
+.wpsg_flex { display:flex; width:100%; }
+.wpsg_flex_justify_content_space_between { justify-content:space-between; }
+.wpsg_flex_align_items_center { align-items:center; }
/* Bootstrap Teil */
#wpsg-bs { margin-top:20px; min-width:1000px; }
@@ -178,6 +181,8 @@ table.wpsgitrecht_table { width:100%; } .email-logo-alignment, .email-logo-alignment input[type="radio"] { font-family: FontAwesome; margin: 0; outline: 0; }
.email-logo { padding-bottom: 10px; }
.email-logo-watermark { position:absolute; top:10%; left:0; right:0; display:flex; justify-content:center; align-items:center; }
+.wpsg_mailattachment { padding:8px 0px; }
+.wpsg_mailattachment a { display:block; min-height:24px; line-height:24px; }
/* Produktverwaltung */
.wpsg_pic_col { width:50px; }
|
