<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$language.lblAdmin} : {$language.lblNewsletterEmailWizard}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<link href="{$view_styles}/inner-formlisting.css"rel="stylesheet" type="text/css" media="screen" />
<link href="{$view_styles}/right-menu.css" rel="stylesheet" type="text/css" />
<link href="{$view_styles}/jquery-ui-1.8.19.custom.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="{$view_styles}/ui.daterangepicker.css" />
<link href="{$view_styles}/colorbox.css" rel="stylesheet" type="text/css" />
<link href="{$view_styles}/newsletter-add.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/manage-product.css" />
{include file='CommonCustomStyles.tpl'}
</head><body>
<div class="outer_container">
  {include file='CommonTop.tpl'}
  <!--End:Header Container-->
  <!--************************************************START CONTAINER SECTION******************************************************-->
  <div class="content_container2"> 
  <div class="right-sidebar">
      <div class="side_wrapper">
        {include file="NewsLetterRightBlock.tpl"}
      </div>
    </div>       
    <!--End: Right Block-->
    <div class="left_wrapper">
     <div class="content_wrapper"> 
		<div class="strict_fixing_right">
	   {include file='ContentLanguageOptions.tpl'}
	   </div>
       <h2>{$language.lblNewsletterEmailWizard}</h2>
       <div id="common_message"></div>
       <div class="inner_content_wrapper">
         {form->start name="formNewsletter" action="" method="post"  enctype="multipart/form-data"}         
         <div class="form_listing form_listing03">{form->hidden name="newsletterID"}            
            {form->hidden name="newsLetterDetailsID"}            
            {form->hidden name="mailQueueID"}  
            {form->hidden name="previewBtn" value=""}
            <h4 ><span>{$language.lblMailHeaderDetails}</span></h4>    	
        	<ul>
                <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblCampaignTitle} </div>
                    <div class="rightside01">
                    {form->textbox tabindex="1" name="campaignTitle" class="textbox width50per" maxlength ="50" validate="required" error=$language.errCampaignTitle}
                    </div>
                </li>	
                 <li class="clearfix">
                 <div class="leftside01 mandatory">{$language.lblSubject}</div>
                 <div class="rightside01">
                    {form->textbox tabindex="1" name="newsLetterSubject" class="textbox width50per" validate="required" error=$language.errSubject maxlength ="200"}
                 </div>
                 </li>				
                <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblnewsletterFromName} </div>
                    <div class="rightside01">
                    {form->textbox tabindex="1" name="newsletterFromName" class="textbox width50per" maxlength ="50" validate="required" error=$language.errFromName}
                    </div>
                </li>
                <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblFromEmailAddress}</div>
                    <div class="rightside01">
                    {form->textbox tabindex="1" name="newsletterFromEmail" class="textbox width50per" maxlength ="50" validate="required~*email" error=$language.errFromEmail|cat:'~*'|cat:$language.errEnterValidEmail}
                    </div>
                </li>
				 <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblReplyEmailAddress}</div>
                    <div class="rightside01">
                    {form->textbox tabindex="1" name="newsletterReplyEmail" class="textbox width50per" maxlength ="50" validate="required~*email" error=$language.errReplyEmail|cat:'~*'|cat:$language.errEnterValidReplyEmail}
                    </div>
                </li>
				</ul>
					<h4 ><span>{$language.lblRecipients}</span></h4>
				   <ul>				
				 <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblNewsletterGroups}</div>
                    <div class="rightside01">
                   	{form->select id="newsletterGroup" name="newsletterGroup" class="select-custom"
								customselect="Yes"
								caption="->{$language.lblSelect}" options="customgroup->"|cat:"Custom Group"|cat:"~*savedgroup->"|cat:"Saved Group"|cat:"~*newgroup->"|cat:"New Group"|cat:"~*subscribers->"|cat:"Subscribers"
								validate="required" error=$language.errNewsletterGroup}
                    </div>
                </li>
				 <li class="clearfix hide" id="hideNewGroup">
                
                    
                   				<div class="wdgt-addblck"  > 					  
						{include file='NewsletterCustomConditions.tpl'}
						
                    </div>
                </li>	
				 <li class="clearfix hide" id="hideSavedGroup">
                	<div class="leftside01 mandatory " >{$language.lblSavedGroups}</div>
                    <div class="rightside01">
                   	{form->select id="customerRuleID" name="customerRuleID" class="select-custom"
								customselect="Yes"
								caption="->{$language.lblSelect}" 								options=$listCustomerRules validate="newsletterGroup->isequal->savedgroup~*required" error=$language.errNewsletterSavedGroup}
					<span>{html->anchor  class="edit02 icon-set showModalPopup"  id="editSavedGroup" style="display:none;" title="{$language.lblConditionsEdit}"
						popuptype="iframe" frameheight="80%" frameWidthClass="modal-lg"
								popuptitle="{$language.lblConditionsEdit}"}</span>			
                    </div>
                </li>	
 	
			<li class="clearfix hide" id="otherSubType" >
                <div class="leftside01">{$language.lblothers}({$language.lblEmailFormatText})</div>
                <div class="rightside01" >
				{form->hidden name="hidOtherType" value=0}
				{form->textarea  name="otherSubcriberType" tabindex="1" class="text-area-01" cols="4" rows="4" validate="hidOtherType->isequal->1~*required~*isMultipleEmail~*isDuplicateEmail"   error=""|cat:"~*"|cat:$language.errToEmails|cat:"~*"|cat:$language.errValidMultipleEmail|cat:"~*"|cat:$language.errDuplicateEmail}</div></li>   				
                </ul> 
				  <h4 ><span>{$language.lblMailTemplates}</span></h4>
                  <ul>
                <li class="clearfix">
                	<div class="leftside01 mandatory">{$language.lblTemplateSelection} </div>
                    <div class="rightside01">
                   {form->radio tabindex="1" name="templateType" class="now" options="static->{$language.lblStatic}~*product->{$language.lblProductPromotion}" value='static'}	
                    </div>
                </li>
                <li class="clearfix hide hideProductRule">
                	<div class="leftside01 mandatory">{$language.lblProductListingLimit} </div>
                    <div class="rightside01">
                   {form->textbox tabindex="1" name="productListingLimit"  maxlength="100" 
                            class="textbox width50per" validate="templateType->isequal->product~*required" error=$language.errCProductListingLimit}
                    </div>
                </li>	
                <li class="clearfix hide hideProductRule" id="hideProductRule">
                	
                   
                   {include file='WidgetTabConditions.tpl'}
                    
                </li>		
				  <li class="clearfix">
               	  <div class="leftside01 mandatory">{$language.lblContent}</div>
                    <div class="rightside01">	
                    {foreach $resNewletterTempList as $key=>$tempDetails}
                      {if $newsletterID|default:''}
                      	{if $tempDetails.nlTemplateID eq $nlTemplateID}
                      		{assign var="checked1" value="checked"}
							{assign var="newsLetterContentHtml" value=$tempDetails.nlTemplateContent|replace:'{$imageUrl}':$imageUrl}
                    		{else}
                    			{assign var="checked1" value=""}
                            {/if}
                      {else}
					
                           {if $tempDetails.templateType|default:'' neq 'product' && $key|default:'0' ==0}
                    			{assign var="checked1" value="checked"}
								{assign var="newsLetterContentHtml" value=$tempDetails.nlTemplateContent|replace:'{$imageUrl}':$imageUrl}
                    		{else}
                    			{assign var="checked1" value=""}
                    		{/if}
                    	{/if}

					{assign var="id" value=$tempDetails.nlTemplateID}
					{assign var="htmlContent" value="{$tempDetails.nlTemplateContent|replace:'{$imageUrl}':$imageUrl|html_entity_decode}"}					
					{html->anchor href="newsletter/tempPreview/id/{$id}" task="{$tempDetails.templateType|default:''}" content="<img src='{$view_public_path}/uploads/newsletter/{$tempDetails.nlTemplatePreview}' height='100' width='100' id='tempDetails_$id' caption='Smiley face'>" class="fancylink cboxElement" popuptype="iframe" frameheight="80%" frameWidthClass="modal-lg"}
                    {form->radio checked="{$checked1}" task="{$tempDetails.templateType|default:''}" tabindex="1" name="mailTemplates" class="mailTemplates" value=$tempDetails.nlTemplateID options=$options|default:''}
                   {form->hidden id="htmlClass{$id}"  name="htmlClass{$id}" value=$htmlContent}
				  {/foreach}		
                  </div>
                  </li>
                  </ul>
				    <h4 ><span>{$language.lblMailContent}</span></h4>
				   <ul >
				   <li class="clearfix" id="editorTemp">
               	   
                   <div  tabindex="1">
				   
                   {form->editor name="newsLetterContentHtml" rows="20" cols="40" mode="advanced" skin=2 uploads="editor-images/"  contenteditable="true"  validate="required" error=$language.errEmailBody}
                   </div>
                   </li>
                <li class="clearfix">
                	<div class="leftside01 ">{$language.lblAttachment} </div>
                    <div class="rightside01">
                    {form->upload name="newsletterAttachment" id="newsletterAttachment" tabindex="1"}
							{if $newsletterAttachment|default:''}
							<span  class="imageUploadDelete" style="font-weight:bold; color:#C00;">{$newsletterAttachment|default:''}</span>
							 {form->hidden name="hidNewsletterAttachment" value="{$newsletterAttachment|default:''}"} 
							 {/if}
                    </div>
                </li>	
				   </ul>
				  
				   <ul>
				 
	
                <li class="clearfix">
				<div class="leftside01"></div>
                <div class="rightside01 sendtime">
                {assign var="options" value="Drafted->{$language.lblsaveAsDraft}~*Now->{$language.lblsendImmediately}~*Scheduled->{$language.lblSchedule}"}
                 {if $newsletterID}	
                 {assign var="sendingTime" value="{$sendingTime}"}
                 {else}
                 {assign var="sendingTime" value="Now"}
                 {/if}
                {form->radio tabindex="1" name="sendingTime" class="now" options="Drafted->{$language.lblsaveAsDraft}~*Now->{$language.lblsendImmediately}~*Scheduled->{$language.lblSchedule}" value=$sendingTime}
                 </div>
                 </li>
                 <li {if $scheduleDate==''} style="display:none"{/if} class="newsletterScheduler clearfix">
                 <div class="leftside01">{$language.lblScheduledTime}</div>
                 <div class="rightside01">
                 {form->textbox tabindex="1" name="scheduleDate" readonly="readonly" class="date_picker_field textbox" validate="sendingTime->isequal->Scheduled~*required" error=$language.errSelectDate}                 
                </div>
                </li>
                <li>
                <div class="submit-block clearfix textto_center"> 
                  <span>&nbsp;</span>{form->submit tabindex="1" name="submitNewsletter" class="curve-3" value="{$language.lblSend}"}
                  {form->button name="previewNews" title="{$language.lblPreview}" id="previewNews" tabindex="1" class="curve-3" value="{$language.lblPreview}"}{$language.lblOr}
                  {html->anchor href=$returnUrl name="cancel" tabindex="1" caption="{$language.lblCancel}"}
                 </div>
                </li>
            </ul>
        </div>
        </div>
          <!--End:From Listing-->
          <div style="display:none">
          <div id="popup">
           <div class="popup-content">
            <div id="popup_message_err"></div>
            <div class="email-preview">
            <ul class="email-bx">
              <li class="content clearfix">
                <div id="popup_body" class="scroling_div default-style"></div>
              </li>
            </ul>
            </div>
            <div class="testEmail">
            <div class="search_container">
            <div class="inner">
              <table width="100%" cellspacing="0" cellpadding="0" border="0">
               <tbody>
				<tr>
                 <td align="left" width="10%" valign="middle" class="left"  style="font-weight:bold">{$language.lblEmailAddress}
				  </td>
                            
                  <td align="left" width="30%" valign="middle" class="padding-r-10">
				  {form->textbox name="testEmailId" class="textbox"  
validate="previewBtn->isequal->1~*required~*email"
error=$language.errFromEmail|cat:'~*'|cat:$language.errEnterValidEmail}</td>
                                

                   <td align="left" width="25%" valign="middle">
                   <div class="submit-block clearfix"> 
				   {form->button tabindex="1" name="sendTest" class="curve-3" value="{$language.lblSendTestMail}"} 
                    &nbsp; {$language.lblOr}
				   {html->anchor onclick="parent.$.colorbox.close();" tabindex="1" name="cancelTestMail"  caption="{$language.lblCancel}"}
                    </div> 
                  </td>               
                </tr>
              </tbody>
			 </table>             
            </div>
           </div>
           </div>          
           </div>
          </div>
         </div>
         {form->close} </div>
        <!--End:Border 3-->
      </div>
    <!--End: left Block-->
    <div class="clear"></div>
  </div>
  <!--****************************************************END CONTAINER SECTION*******************************************-->
  <!--End:Content Container-->
  {include file='CommonBottom.tpl'} 
</div>
<!--End:Outer Container-->
<script type="text/javascript">
    var msgTestMailSent 		 = "{$language.msgTestMailSent}";
    var errEnterValidEmail 		 = "{$language.errEnterValidEmail}";
	var errFromEmail 			 = "{$language.errFromEmail}";
    var errTestMailSendingFailed = "{$language.errTestMailSendingFailed}";
    var errEmailBody         	 = "{$language.errEmailBody}";
    var returnUrl   			 = "{$returnUrl}";
	var preview   				 = "{$language.lblPreview}";
	var lblSend   				 = "{$language.lblSend}";
	var lblSave   				 = "{$language.lblSave}";
	var lblSelectSubscriber		 = "{$language.lblSelectSubscriber}";
	var errFromName				 = "{$language.errFromName}";
	var errEnterValidReplyEmail	 = "{$language.errEnterValidReplyEmail}";
	var errSubject				 = "{$language.errSubject}";
	var lblDelete				 = "{$language.lblDelete}";
	
</script>
{include file='CommonJavaScriptBottom.tpl'}
<!--<script type="text/javascript" src="{$view_javascript}/jquery.multiselect.widget.js"></script> -->
<script type="text/javascript" src="{$common_js}/validate.plugin.js"></script>
<script type="text/javascript" src="{$view_javascript}/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="{$view_javascript}/jquery.colorbox.js"></script>
{form->editor_script names="newsLetterContentHtml"}
{form->validate_script form="formNewsletter"}
{html->messages_script id="common_message"}
<script type="text/javascript" src="{$view_javascript}/newsletterrule.page.js"></script>
<script type="text/javascript" src="{$view_javascript}/newsletter.page.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function(){
var currentPromoRootRel = '';
var currentPromoRoot = '';
var currentPopupPicker = '';
	$(document).on('click','.popupPicker', function (e) {	
		e.preventDefault();
		currentPromoRoot = $(this).closest(".promoRoot");
		currentPromoRootRel = $(this).closest(".promoRoot").attr("rel");
		currentPopupPicker = $(this);
		var url = currentPopupPicker.attr('href');
		var title = currentPopupPicker.attr('title');
		$.colorbox.remove();
		$.colorbox({iframe:true,width:"70%", height:"70%",href:url,title:title});
	});
	$('.side_wrapper ul li a[rel=Newsletter]').addClass('selected'); 
	setSideMenu();	
});
{/literal}
</script>
</body>
</html>
