1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
<?php
/** @version 4.6.1 */
$data = $this->view['campaign_data'];
$templates = isset($this->view['campaign_templates']) && is_array($this->view['campaign_templates']) ? $this->view['campaign_templates'] : array();
$assignedTemplateId = isset($data['assigned_template_id']) ? intval($data['assigned_template_id']) : 0;
$isEdit = intval($data['id']) > 0;
$sendDateValue = '';
if (strtotime($data['send_date']) > 0) {
$sendDateValue = date('Y-m-d\TH:i', strtotime($data['send_date']));
}
?>
<div class="wrap columns-2 wpng_campaign_addedit">
<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
<h2>
<?php echo __('Kampagnen', 'wpsg'); ?> - <?php echo $isEdit ? __('Bearbeiten', 'wpsg') : __('Neu hinzufügen', 'wpsg'); ?>
</h2>
<form method="post" action="<?php echo esc_url(admin_url('admin.php?page=wpng-mod_campaign&wpng_action=save&noheader=1')); ?>">
<?php wp_nonce_field('wpsg-campaigns-save'); ?>
<input type="hidden" name="id" value="<?php echo intval($data['id']); ?>" />
<div class="metabox-holder has-right-sidebar wpng_metabox-holder">
<div id="side-info-column" class="inner-sidebar" style="width:386px;">
<div id="side-sortables" class="meta-box-sortables ui-sortable" style="width:380px;">
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Einstellungen', 'wpsg'); ?></h3>
<div class="inside">
<p>
<label for="delay_value"><strong><?php echo __('Verzögerung', 'wpsg'); ?></strong></label><br />
<input type="number" min="0" id="delay_value" name="delay_value" value="<?php echo (($data['delay_value'] === null || $data['delay_value'] === '')?'':intval($data['delay_value'])); ?>" style="width:120px;" />
<select id="delay_unit" name="delay_unit">
<?php $units = $this->callMod('wpsg_mod_campaigns', 'getDelayUnitOptions'); if (!is_array($units)) $units = array(); foreach ($units as $unit => $unitLabel) { ?>
<option value="<?php echo esc_attr($unit); ?>" <?php selected($data['delay_unit'], $unit); ?>><?php echo esc_html($unitLabel); ?></option>
<?php } ?>
</select>
<br /><small><?php echo __('Leer lassen, um die Verzögerung aus dem Versandprofil zu übernehmen.', 'wpsg'); ?></small>
</p>
<p>
<label for="format"><strong><?php echo __('Format', 'wpsg'); ?></strong></label><br />
<select id="format" name="format">
<option value="0" <?php selected(intval($data['format']), 0); ?>><?php echo __('Text', 'wpsg'); ?></option>
<option value="1" selected <?php selected(intval($data['format']), 1); ?>><?php echo __('HTML und Text', 'wpsg'); ?></option>
<option value="2" <?php selected(intval($data['format']), 2); ?>><?php echo __('HTML', 'wpsg'); ?></option>
</select>
</p>
<p>
<label for="priority"><strong><?php echo __('Priorität', 'wpsg'); ?></strong></label><br />
<?php $priority = (intval($data['priority']) >= 1) ? intval($data['priority']) : 3; ?>
<select id="priority" name="priority">
<option value="1" <?php selected($priority, 1); ?>><?php echo __('Sehr niedrig', 'wpsg'); ?></option>
<option value="2" <?php selected($priority, 2); ?>><?php echo __('Niedrig', 'wpsg'); ?></option>
<option value="3" <?php selected($priority, 3); ?>><?php echo __('Normal', 'wpsg'); ?></option>
<option value="4" <?php selected($priority, 4); ?>><?php echo __('Hoch', 'wpsg'); ?></option>
<option value="5" <?php selected($priority, 5); ?>><?php echo __('Sehr hoch', 'wpsg'); ?></option>
</select>
</p>
<p class="submit">
<input type="submit" class="button-primary" name="submit" value="<?php echo __('Speichern', 'wpsg'); ?>" />
<input type="submit" class="button" name="submit_index" value="<?php echo __('Speichern und zur Übersicht', 'wpsg'); ?>" />
</p>
</div>
</div>
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Template-Zuordnung', 'wpsg'); ?></h3>
<div class="inside">
<p>
<label for="template_id"><strong><?php echo __('Versandprofil', 'wpsg'); ?></strong></label><br />
<select id="template_id" name="template_id" style="width:100%;">
<option value="0"><?php echo __('Kein Versandprofil zugeordnet', 'wpsg'); ?></option>
<?php foreach ($templates as $template) { ?>
<?php $templateId = intval($template['id']); ?>
<option value="<?php echo $templateId; ?>" data-trigger-event="<?php echo esc_attr((string)($template['trigger_event'] ?? '')); ?>" <?php selected($assignedTemplateId, $templateId); ?>>
<?php echo esc_html($template['name']); ?>
</option>
<?php } ?>
</select>
<small><?php echo __('Eine Kampagne kann genau einem Versandprofil zugeordnet werden.', 'wpsg'); ?></small>
</p>
</div>
</div>
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Versandeinstellungen', 'wpsg'); ?></h3>
<div class="inside">
<p>
<label for="subject"><strong><?php echo __('Betreff', 'wpsg'); ?></strong></label><br />
<input type="text" class="widefat" id="subject" name="subject" value="<?php echo esc_attr($data['subject']); ?>" />
</p>
<p>
<label for="from"><strong><?php echo __('Absender', 'wpsg'); ?></strong></label><br />
<input type="text" class="widefat" id="from" name="from" value="<?php echo esc_attr($data['from']); ?>" />
</p>
<p>
<label for="cc"><strong><?php echo __('CC', 'wpsg'); ?></strong></label><br />
<input type="text" class="widefat" id="cc" name="cc" value="<?php echo esc_attr($data['cc']); ?>" />
</p>
<p>
<label for="bcc"><strong><?php echo __('BCC', 'wpsg'); ?></strong></label><br />
<input type="text" class="widefat" id="bcc" name="bcc" value="<?php echo esc_attr($data['bcc']); ?>" />
</p>
</div>
</div>
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Verfügbare Platzhalter', 'wpsg'); ?></h3>
<div class="inside">
<p><small><?php echo __('Diese Platzhalter werden beim Versand automatisch mit den Bestell- und Kundendaten ersetzt. Nutzbar in Betreff, HTML- und Text-Inhalt.', 'wpsg'); ?></small></p>
<ul style="margin:0; padding-left:18px; list-style:disc;">
<li><code>%kunde_anrede%</code> – <?php echo __('Anrede', 'wpsg'); ?></li>
<li><code>%kunde_vname%</code> – <?php echo __('Vorname', 'wpsg'); ?></li>
<li><code>%kunde_name%</code> – <?php echo __('Nachname', 'wpsg'); ?></li>
<li><code>%kunde_email%</code> – <?php echo __('E-Mail-Adresse', 'wpsg'); ?></li>
<li><code>%order_id%</code> – <?php echo __('Bestellnummer', 'wpsg'); ?></li>
<li><code>%order_cdate_format_de%</code> – <?php echo __('Bestelldatum', 'wpsg'); ?></li>
<li><code>%product_name%</code> – <?php echo __('Produktname', 'wpsg'); ?></li>
</ul>
</div>
</div>
</div>
</div>
<div id="post-body">
<div id="titlediv" style="margin-right:400px;">
<div id="titlewrap">
<input type="text" value="<?php echo esc_attr($data['name']); ?>" size="30" name="name" id="title" required />
</div>
</div>
<div id="normal-sortables" class="meta-box-sortables" style="margin-right:400px; width:initial !important;">
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Inhalt (HTML)', 'wpsg'); ?></h3>
<div class="inside">
<!-- Einbindung TinyMCE -->
<div id="wpng_rte_inside" class="inside wpng_rte_inside">
<?php if ($this->get_option('wpng_rte') == '1') { ?>
<?php
// wpNewsletterGermany deklariert dieselbe Funktion
if (!function_exists('wpng_tiny_mce_before_init')) { function wpng_tiny_mce_before_init($in)
{
$in['readonly'] = true;
return $in;
} }
function wpng_ShowTinyMCE() {
wp_enqueue_script('common');
wp_enqueue_script('jquery-color');
wp_print_scripts('editor');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_enqueue_script('utils');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
}
// Damit die qTranslate Interne Editor Übersetzung nicht aufgerufen wird
remove_filter('the_editor', 'qtrans_modifyRichEditor');
remove_filter('the_editor', 'wpautop');
add_filter('mce_buttons', 'wpng_tinymce_button');
add_filter('mce_external_plugins', 'wpng_tinymce_plugin');
add_filter('admin_head','wpng_ShowTinyMCE');
wp_editor(@$data['content_html'], 'content_html');
?>
<?php } else if ($this->get_option('wpng_rte') == '0') { ?>
<?php /* Ohne Editor ein einfaches Textfeld — vorher stand hier id/name "content_text",
wodurch der HTML-Inhalt unter dem Textfeld-Namen gepostet wurde und mit dem
echten Textfeld weiter unten kollidierte. */ ?>
<textarea id="content_html" name="content_html" rows="12" class="large-text code"><?php echo esc_textarea($data['content_html']); ?></textarea>
<?php } else if ($this->get_option('wpng_rte') == '2') { $this->callMods('newsletter_addedit_rte', array($data)); } ?>
<!-- Einbindung TinyMCE -->
<!-- <textarea id="content_html" name="content_html" rows="12" class="large-text code">--><?php //echo esc_textarea($data['content_html']); ?><!--</textarea>-->
</div>
</div>
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Inhalt (Text)', 'wpsg'); ?></h3>
<div class="inside">
<textarea id="content_text" name="content_text" rows="10" class="large-text code"><?php echo esc_textarea($data['content_text']); ?></textarea>
</div>
</div>
<div class="postbox">
<h3 class="postbox-header"><?php echo __('Bedingungen', 'wpsg'); ?></h3>
<div class="inside">
<?php include(WPSG_PATH_VIEW . '/mods/mod_campaigns/conditions_fields.phtml'); ?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<script type="text/javascript">/* <![CDATA[ */
/**
* Die Bedingung "Bestellstatus" ergibt nur Sinn, wenn das zugeordnete Versandprofil auf
* den Statuswechsel-Trigger steht. Beim Produktkauf steht die Bestellung zum
* Pruefzeitpunkt immer auf "Eingegangen" — die Bedingung koennte dort nur diesen einen
* Wert treffen und wuerde jede andere Auswahl den Versand verhindern.
*/
( function() {
var elTemplate = document.getElementById('template_id');
var elCond = document.getElementById('wpsg_cond_order_status_wrap');
if (!elTemplate || !elCond) return;
function wpsgToggleStatusCondition() {
var elOption = elTemplate.options[elTemplate.selectedIndex];
var sEvent = (elOption ? elOption.getAttribute('data-trigger-event') : '');
elCond.style.display = ((sEvent === 'order_status') ? '' : 'none');
}
elTemplate.addEventListener('change', wpsgToggleStatusCondition);
wpsgToggleStatusCondition();
} )();
/* ]]> */</script>
|