Пример #1
0
function zen_get_email_template_for_status()
{
    global $request_type;
    $templates = get_email_templates();
    $out = "<strong>" . TEXT_SELECT_EMAIL_TEMPLATES . "</strong>";
    $out .= zen_draw_pull_down_menu('et_id', $templates, $grp, 'id="et_id"');
    $languages = get_languages();
    $out .= "  <strong>" . TEXT_SELECT_LANGUAGES . "</strong>";
    $out .= zen_draw_pull_down_menu('lang_id', $languages, '', 'id="lang_id"');
    $out .= '<br />' . zen_draw_input_field('', BUTTON_READ_EMAIL_TEMPLATE, 'onclick="readEmailTemplate();"', false, 'button');
    return '<script type="text/javascript">
	        <!--
	        var notify            = document.getElementsByName("notify")[0];
	        var notify_comments   = document.getElementsByName("notify_comments")[0];
                if (notify) {
                  notify.value = \'on\';
                  notify.removeAttribute(\'checked\');
                }
                if (notify_comments) {
                  notify_comments.value = \'on\';
                  notify_comments.removeAttribute(\'checked\');
                }

	        function readEmailTemplate()
	        {
						var comments          = document.getElementById("comments");
						var notify            = document.getElementsByName("notify")[0];
						var notify_comments   = document.getElementsByName("notify_comments")[0];
						var email_template_id = document.getElementById("et_id");
						var language_id = document.getElementById("lang_id");
                                                var template_node = document.getElementById(\'templateparent\');
                                                var real_email_template_id = document.getElementById(\'email_template_id\');

                                              // しない?
                                              if (email_template_id.value == "") {
                                                if (notify)
                                                  notify.removeAttribute(\'checked\');
                                                if (notify_comments)
                                                  notify_comments.removeAttribute(\'checked\');
                                                if (real_email_template_id)
                                                  real_email_template_id.value = "";
                                                if (template_node)
                                                  template_node.parentNode.removeChild(template_node);
                                              } else {
						$.ajax({
						  type: "GET",
						  url:  "' . zen_href_link("../index.php?main_page=addon", '', $request_type) . '",
						  data: {
						    module: "email_templates",
						    id:   email_template_id.value,
						    language_id: language_id.value
						  },
						  success: function(msg) {
						    var comments = document.getElementsByName(\'comments\')[0];
                                                      var newNode = document.getElementById(\'templateparent\');
                                                      if (newNode) {
                                                        newNode.parentNode.removeChild(newNode);
                                                      }
                                                      var newNode = document.createElement(\'div\');
                                                      newNode.id = \'templateparent\';
                                                      var templateTitle = document.createElement(\'div\');
                                                      templateTitle.class = \'innertitle\';
                                                      templateTitle.innerHTML = \'' . TEXT_EMAIL_TEMPLATE . '\';
                                                      newNode.appendChild(templateTitle);
                                                      var newChild = document.getElementById(\'templatearea\');
                                                      var newChild = document.createElement(\'textarea\');
                                                      newChild.id = \'templatearea\';
                                                      newChild.setAttribute(\'wrap\', \'soft\');
                                                      newChild.setAttribute(\'rows\', \'20\');
                                                      newChild.setAttribute(\'cols\', \'60\');
                                                      newChild.setAttribute(\'readonly\', \'readonly\');
                                                      newChild.value = msg;
                                                      newNode.appendChild(newChild);
                                                      var commentTitle = document.createElement(\'div\');
                                                      commentTitle.class = \'innertitle\'; 
                                                      commentTitle.innerHTML = \'' . TEXT_EMAIL_TEMPLATE_DESCRIPTION . '\';
                                                      newNode.appendChild(commentTitle);
                                                      comments.parentNode.insertBefore(newNode, comments);
						  }
						});
						if (notify)
								notify.setAttribute(\'checked\', \'checked\');
						if (notify_comments)
								notify_comments.setAttribute(\'checked\', \'checked\');
                                                if (real_email_template_id)
                                                                real_email_template_id.value = email_template_id.value;
                                              }
	        }
	        // -->
	        </script>
		       ' . $out . zen_draw_hidden_field('email_template_id', '', 'id="email_template_id"');
}
Пример #2
0
   <a href="emails.php?action=add">Add</a>
   </div>

   <p>Via this page, you can set up email templates for you to use later on
   when emailing members and affiliates when needed. Existing email
   templates are shown below. If you want to add an email template,
   click on the "Add" submenu item.</p>

   <table>

   <tr><th>Template Name</th>
   <th>Subject</th>
   <th>Content Excerpt</th>
   <th>Action</th></tr>
<?php 
    $templates = get_email_templates();
    $shade = false;
    foreach ($templates as $t) {
        $class = '';
        if ($shade) {
            $class = ' class="rowshade"';
            $shade = false;
        } else {
            $shade = true;
        }
        $info = get_template_info($t);
        ?>
      <tr<?php 
        echo $class;
        ?>
><td>