Subversion Repositories wpShopGermany4

Rev

Rev 5261 | Rev 6453 | 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">
134
	<h3 class="wpsg_handlediv">
135
		<span title="<?php echo __('Zum Ein/Ausklappen hier klicken', 'wpsg'); ?>" class="handlediv"><br /></span>
136
		<span><?php echo __('Kundenkontakt', 'wpsg'); ?></span>
137
	</h3>
1272 david 138
	<div class="inside">
2759 daniel 139
		<div style="padding:5px;">
1272 david 140
 
3755 daniel 141
			<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">
142
 
6204 thomas 143
				<label><?php echo __("Template", "wpsg"); ?>:</label>
144
				<select name="kk_template" class="wpsg_kundenkontakt_template" id="kk_template" onchange="kk_switchTemplate();">
1272 david 145
					<option value="-1"><?php echo __("Bitte auswählen", "wpsg"); ?></option>
146
					<?php foreach ($this->view['arTemplates'] as $k => $v) { ?>
6204 thomas 147
						<option value="<?php echo rawurlencode($v['filename']); ?>"><?php echo htmlspecialchars($v['name']); ?></option>
1272 david 148
					<?php } ?>
6204 thomas 149
				</select>
3755 daniel 150
				<div class="wpsg_clear"></div>
151
 
6204 thomas 152
				<label><?php echo __("Betreff", "wpsg"); ?>:</label>
153
				<input type="text" name="kk_subject" class="wpsg_kundenkontakt_betreff" id="kk_subject" />
3755 daniel 154
				<div class="wpsg_clear"></div>
155
 
156
				<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
4886 daniel 157
 
3755 daniel 158
					<?php echo __('Text (HTML)', 'wpsg'); ?>:<br /><br />
4885 daniel 159
 
3755 daniel 160
					<?php wp_editor('', 'kk_html'); ?>
4885 daniel 161
 
4886 daniel 162
 
3755 daniel 163
				<div class="wpsg_clear"></div>
164
				<?php } else { ?>
6204 thomas 165
				<label><?php echo __("Text", "wpsg"); ?>:<br /></label>
166
				<textarea id="kk_text" class="wpsg_kundenkontakt_textarea"></textarea>
3755 daniel 167
				<div class="wpsg_clear"></div>
168
				<?php } ?>
169
 
1272 david 170
				<br />
3755 daniel 171
				<input type="button" class="button" onclick="kk_sendMail(); return false;" value="<?php echo __("Absenden", "wpsg"); ?>" style="float:right;" />
172
				<div class="wpsg_clear"></div>
173
 
1272 david 174
			</form>
3438 daniel 175
 
1272 david 176
		</div>
177
	</div>
178
</div>