Rev 6453 | Rev 7349 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<script type="text/javascript">
jQuery(document).ready(function() {
kk_switchTemplate();
} );
/**
*
*/
function kk_switchTemplate()
{
var template_val = jQuery("#kk_template").val();
if (template_val != "-1")
{
jQuery.ajax( {
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' ?>",
dataType: 'json',
data: {
template_file: template_val
},
success: function(data) {
jQuery("#kk_subject").val(data.subject);
<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
jQuery('#kk_html').html(data.content);
tinyMCE.get("kk_html").setContent(data.content);
<?php } else { ?>
jQuery("#kk_text").text(data.content);
<?php } ?>
}
} );
}
else
{
jQuery("#kk_subject").val('');
jQuery("#kk_template").val(-1);
<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
jQuery('#kk_html').html('');
//tinyMCE.get("kk_html").setContent('');
<?php } else { ?>
jQuery("#kk_text").text('');
<?php } ?>
}
}
/**
*
*/
function kk_sendMail()
{
if (jQuery('#kk_subject').val() == '')
{
alert("<?php echo __('Bitte einen Betreff angeben!', 'wpsg'); ?>");
return;
}
if (jQuery('#kk_text').val() == '')
{
alert("<?php echo __('Bitte einen Text angeben!', 'wpsg'); ?>");
return;
}
var text = "";
<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
text = tinyMCE.get('kk_html').getContent();
<?php } else { ?>
text = jQuery('#kk_text').val();
<?php } ?>
jQuery.ajax( {
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' ?>",
method: 'post',
data: {
text: text,
absendermail: jQuery('#kk_absendermail').val(),
absendername: jQuery('#kk_absendername').val(),
subject: jQuery('#kk_subject').val(),
empfaenger: "<?php echo $this->view['data']['email']; ?>"
},
success: function(data) {
if (data != '1')
{
alert("<?php echo __("Mail konnte nicht versendet werden es ist ein Fehler aufgetreten!", "wpsg"); ?>");
}
else
{
<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
tinyMCE.get('kk_html').setContent('');
<?php } else { ?>
jQuery('#kk_text').html('');
<?php } ?>
jQuery('#kk_subject').val('');
jQuery('#kk_absendermail').val('');
jQuery('#kk_absendername').val('');
jQuery('#kk_template').val(-1);
alert("<?php echo __('Mail wurde erfolgreich an den Kunden gesendet.', 'wpsg'); ?>");
location.reload();
}
}
} );
}
</script>
<?php //wpsg_debug($this->view) ?>
<?php echo wpsg_drawForm_AdminboxStart(__('Kundenkontakt', 'wpsg'));?>
<div class="inside">
<div style="padding:5px;">
<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">
<label><?php echo __("Template", "wpsg"); ?>:</label>
<select name="kk_template" class="wpsg_kundenkontakt_template" id="kk_template" onchange="kk_switchTemplate();">
<option value="-1"><?php echo __("Bitte auswählen", "wpsg"); ?></option>
<?php foreach ($this->view['arTemplates'] as $k => $v) { ?>
<option value="<?php echo rawurlencode($v['filename']); ?>"><?php echo htmlspecialchars($v['name']); ?></option>
<?php } ?>
</select>
<div class="wpsg_clear"></div>
<label><?php echo __("Betreff", "wpsg"); ?>:</label>
<input type="text" name="kk_subject" class="wpsg_kundenkontakt_betreff" id="kk_subject" />
<div class="wpsg_clear"></div>
<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
<?php echo __('Text (HTML)', 'wpsg'); ?>:<br /><br />
<?php wp_editor('', 'kk_html'); ?>
<div class="wpsg_clear"></div>
<?php } else { ?>
<label><?php echo __("Text", "wpsg"); ?>:<br /></label>
<textarea id="kk_text" class="wpsg_kundenkontakt_textarea"></textarea>
<div class="wpsg_clear"></div>
<?php } ?>
<br />
<input type="button" class="button" onclick="kk_sendMail(); return false;" value="<?php echo __("Absenden", "wpsg"); ?>" style="float:right;" />
<div class="wpsg_clear"></div>
</form>
</div>
</div>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>