Subversion Repositories wpShopGermany4

Rev

Rev 6204 | Rev 6455 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1272 david 1
<script type="text/javascript">
2759 daniel 2
 
1272 david 3
	jQuery(document).ready(function() {
3755 daniel 4
 
3438 daniel 5
		kk_switchTemplate();
6
 
2759 daniel 7
	} );
1272 david 8
 
9
	/**
10
	 *
11
	 */
12
	function kk_switchTemplate()
13
	{
14
 
15
		var template_val = jQuery("#kk_template").val();
16
 
17
		if (template_val != "-1")
18
		{
19
 
20
			jQuery.ajax( {
21
				url: "<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id='.$this->view['data']['id'].'&noheader=1&do=kk_switchTemplate' ?>",
3757 daniel 22
				dataType: 'json',
1272 david 23
				data: {
24
					template_file: template_val
25
				},
26
				success: function(data) {
27
 
3757 daniel 28
					jQuery("#kk_subject").val(data.subject);
1272 david 29
 
3757 daniel 30
					<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
31
					jQuery('#kk_html').html(data.content);
4885 daniel 32
					tinyMCE.get("kk_html").setContent(data.content);
3757 daniel 33
					<?php } else { ?>
34
					jQuery("#kk_text").text(data.content);
35
					<?php } ?>
36
 
1272 david 37
				}
38
			} );
39
 
40
		}
41
		else
42
		{
3438 daniel 43
 
3757 daniel 44
			jQuery("#kk_subject").val('');
45
			jQuery("#kk_template").val(-1);
46
 
47
			<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
48
			jQuery('#kk_html').html('');
4885 daniel 49
			//tinyMCE.get("kk_html").setContent('');
3757 daniel 50
			<?php } else { ?>
1272 david 51
			jQuery("#kk_text").text('');
3757 daniel 52
			<?php } ?>
3438 daniel 53
 
1272 david 54
		}
55
 
56
	}
57
 
58
	/**
59
	 *
60
	 */
61
	function kk_sendMail()
62
	{
3755 daniel 63
 
1272 david 64
		if (jQuery('#kk_subject').val() == '')
65
		{
66
 
67
			alert("<?php echo __('Bitte einen Betreff angeben!', 'wpsg'); ?>");
68
			return;
69
 
70
		}
71
 
72
		if (jQuery('#kk_text').val() == '')
73
		{
74
 
75
			alert("<?php echo __('Bitte einen Text angeben!', 'wpsg'); ?>");
76
			return;
77
 
78
		}
79
 
3755 daniel 80
		var text = "";
81
 
82
		<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
83
		text = tinyMCE.get('kk_html').getContent();
84
		<?php } else { ?>
85
		text = jQuery('#kk_text').val();
86
		<?php } ?>
87
 
1272 david 88
		jQuery.ajax( {
89
			url: "<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id='.$this->view['data']['id'].'&noheader=1&do=kk_sendMail' ?>",
4421 daniel 90
			method: 'post',
1272 david 91
			data: {
3755 daniel 92
				text: text,
1272 david 93
				absendermail: jQuery('#kk_absendermail').val(),
94
				absendername: jQuery('#kk_absendername').val(),
95
				subject: jQuery('#kk_subject').val(),
96
				empfaenger: "<?php echo $this->view['data']['email']; ?>"
97
			},
98
			success: function(data) {
3755 daniel 99
 
1272 david 100
				if (data != '1')
101
				{
102
					alert("<?php echo __("Mail konnte nicht versendet werden es ist ein Fehler aufgetreten!", "wpsg"); ?>");
103
				}
104
				else
105
				{
3755 daniel 106
 
107
					<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
108
					tinyMCE.get('kk_html').setContent('');
109
					<?php } else { ?>
110
					jQuery('#kk_text').html('');
111
					<?php } ?>
1272 david 112
 
113
					jQuery('#kk_subject').val('');
114
					jQuery('#kk_absendermail').val('');
115
					jQuery('#kk_absendername').val('');
116
					jQuery('#kk_template').val(-1);
117
 
118
					alert("<?php echo __('Mail wurde erfolgreich an den Kunden gesendet.', 'wpsg'); ?>");
1275 david 119
 
120
					location.reload();
1272 david 121
 
122
				}
3755 daniel 123
 
1272 david 124
			}
1275 david 125
 
1272 david 126
		} );
127
 
128
	}
129
 
130
 
131
</script>
132
<?php //wpsg_debug($this->view) ?>
1414 daniel 133
<div class="postbox" id="wpsg_kundenkontakt">
6453 thomas 134
 
135
	<?php echo wpsg_drawForm_AdminboxStart(__('Kundenkontakt', 'wpsg'));?>
136
 
1272 david 137
	<div class="inside">
2759 daniel 138
		<div style="padding:5px;">
1272 david 139
 
3755 daniel 140
			<form method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1">
141
 
6204 thomas 142
				<label><?php echo __("Template", "wpsg"); ?>:</label>
143
				<select name="kk_template" class="wpsg_kundenkontakt_template" id="kk_template" onchange="kk_switchTemplate();">
1272 david 144
					<option value="-1"><?php echo __("Bitte auswählen", "wpsg"); ?></option>
145
					<?php foreach ($this->view['arTemplates'] as $k => $v) { ?>
6204 thomas 146
						<option value="<?php echo rawurlencode($v['filename']); ?>"><?php echo htmlspecialchars($v['name']); ?></option>
1272 david 147
					<?php } ?>
6204 thomas 148
				</select>
3755 daniel 149
				<div class="wpsg_clear"></div>
150
 
6204 thomas 151
				<label><?php echo __("Betreff", "wpsg"); ?>:</label>
152
				<input type="text" name="kk_subject" class="wpsg_kundenkontakt_betreff" id="kk_subject" />
3755 daniel 153
				<div class="wpsg_clear"></div>
154
 
155
				<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
4886 daniel 156
 
3755 daniel 157
					<?php echo __('Text (HTML)', 'wpsg'); ?>:<br /><br />
4885 daniel 158
 
3755 daniel 159
					<?php wp_editor('', 'kk_html'); ?>
4885 daniel 160
 
4886 daniel 161
 
3755 daniel 162
				<div class="wpsg_clear"></div>
163
				<?php } else { ?>
6204 thomas 164
				<label><?php echo __("Text", "wpsg"); ?>:<br /></label>
165
				<textarea id="kk_text" class="wpsg_kundenkontakt_textarea"></textarea>
3755 daniel 166
				<div class="wpsg_clear"></div>
167
				<?php } ?>
168
 
1272 david 169
				<br />
3755 daniel 170
				<input type="button" class="button" onclick="kk_sendMail(); return false;" value="<?php echo __("Absenden", "wpsg"); ?>" style="float:right;" />
171
				<div class="wpsg_clear"></div>
172
 
1272 david 173
			</form>
3438 daniel 174
 
1272 david 175
		</div>
176
	</div>
6453 thomas 177
 
178
	<?php echo wpsg_drawForm_AdminboxEnd(); ?>
179
 
1272 david 180
</div>