{$ADMIN_HEADER}
{literal}
<script type="text/javascript">
function AddEmail(){
table = document.getElementById('MainTable');
_node = table.rows[table.rows.length-1].cloneNode(true);
_node.style.display = '';
//ClearFields(_node);
table.appendChild(_node);
ClearFields(_node);
}
function IsNumeric(ControlObj)
{
//alert(ControlObj.value+''+ControlObj.name);
var strValidChars = "0123456789";
var strChar;
var blnResult = true;
var flg = 1;
// test strString consists of valid characters listed above
for (i = 0; i < ControlObj.value.length && blnResult == true; i++)
{
strChar = ControlObj.value.charAt(i);
if(strChar == "." && flg == 0)
{
blnResult = false;
}
else if(strChar == ".")
{
flg = 0;
}
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
if(!blnResult)
{
alert("Invalid day input.");
ControlObj.value = '';
ControlObj.focus();
}
}
function _ClearFields(obj,elems) {
_rand = obj.rowIndex;
for (i=0;i<elems.length;i++) {
elems[i].style.visibility = 'visible';
elems[i].disabled = false;
try {
if (!elems[i].getAttribute('keep')) {
if (elems[i].tagName == 'INPUT') {
elems[i].value= "";
}
if (elems[i].tagName == 'SELECT') {
elems[i].selectedIndex = 0;
}
}
if (elems[i].getAttribute('name_tpl')) {
elems[i].name = elems[i].getAttribute('name_tpl').replace(new RegExp('\\[\\]+','g'), '\['+_rand+'\]');
}
elems[i].setAttribute('_grRand',_rand);
elems[i].id = elems[i].name;
}
catch(e){}
}
}
function ClearFields(obj){
elems = obj.getElementsByTagName("INPUT");
_ClearFields(obj,elems);
elems = obj.getElementsByTagName("SELECT");
_ClearFields(obj,elems);
}
function DeleteRow(obj){
table = document.getElementById('MainTable');
if (obj.parentNode.parentNode.rowIndex != 1)
{
table.removeChild(obj.parentNode.parentNode);
}
else
{
obj.parentNode.parentNode.style.display = 'none';
DisableFields(obj.parentNode.parentNode);
}
}
function browseForEmails(obj){
inputName = obj.name.substr(1); //button object
emailIdField = document.getElementById(inputName); // hidden id field
emailNameField = document.getElementById('name__' + inputName); // text input field
//emailEnabledField = document.getElementById('enabled__' + inputName);
wnd = window.open('admin_canned_email_v.php?module=Emails&action=SelectEmail&email_id='+Math.abs(emailIdField.value),
'', 'dependent=1,scrollbars=1,directories=0,height=550,width=800,location=0');
/*wnd.focus();*/
}
</script>
{/literal}
<div id="content" class="setdiv">
<div id="full-contentdiv">
<div class="righttop">
<h2 align="center">
{if $IsEdit neq ''}
Edit Campaign
{assign var="action" value="update"}
{else}
Create Campaign
{assign var="action" value="insert"}
{/if}
</h2>
</div>
<div class="whole-page clear">
<form name="frmAutoResponder" id="frmAutoResponder" action="admin_email_autoresponder.php?action={$action}" method="post">
<div class="borderless borderless-1">
<table border="0" cellpadding="0" cellspacing="0" style="width:800px" align="center">
<tr>
<td colspan="2">
<div class="horizontal-line">
</div>
</td>
</tr>
<tr>
<td class="right-side-text-borderless space" valign="top" style="width:137px !important;*width:250px !important"><label>
Groups :
</label>
</td>
<td class="left-side-text-borderless">
<select id="groups[]" name="groups[]" multiple="" style="width: 650px ! important;" >
<option selected="selected" value="2" label="members">members</option>
</select>
</td>
</tr>
<tr>
<td class="left-side-text-borderless" colspan="2">
<table width="100%" cellspacing="0" cellpadding="2">
<tbody width="100%" id="MainTable">
<tr>
<th> </th>
<th class="details" style="padding-left:22px;*padding-left:19px">Day</th>
<th class="details"><center>Select Email(s) for this Campaign<br/> <font style="font-weight: normal;">(You may select 1 or more emails for a given campaign)</font></center></th>
</tr>
<tr>
<td align="center">
<input type="button" style="width: 30px;" onclick="DeleteRow(this);" keep="1" value="X" name="X" class="btncss"/></td>
<td nowrap="nowrap" align="center" class="comment">
<input type="text" onmouseout="" onmouseover="" style="width:30px" onkeypress="return IsNumeric(this);" maxlength="3" value="" id="autorespond[1][day]" name="autorespond[1][day]" name_tpl="autorespond[][day]" class="txtcss"/>
day(s)
<select class="selectcss" name="autorespond[0][type]" name_tpl="autorespond[][type]">
<option value="BE">before expiration</option>
<option value="AE">after expiration </option>
<option value="AS">after subscribing</option>
</select>
</td>
<td nowrap="nowrap" align="center">
<input type="hidden" name_tpl="autorespond[][email_id]" value="" id="autorespond[1][email_id]" name="autorespond[1][email_id]"/>
<input type="text" name_tpl="name__autorespond[][email_id]" value="" size="30" style="width: 400px;" class="txtcss" readonly="" id="name__autorespond[1][email_id]" name="name__autorespond[1][email_id]"/>
<input type="button" name_tpl="_autorespond[][email_id]" keep="1" class="btncss" onclick="javascript:browseForEmails(this);" value="Browse" name="_autorespond[1][email_id]"/>
</td>
</tr>
<tr>
<td align="center">
<input type="button" style="width: 30px; visibility: visible;" onclick="DeleteRow(this);" keep="1" value="X" name="X" class="btncss" _grrand="2" id="X"/></td>
<td nowrap="nowrap" align="center" class="comment">
<input type="text" onmouseout="" onmouseover="" style="width:30px" onkeypress="return IsNumeric(this);" maxlength="3" value="" name="autorespond[2][day]" name_tpl="autorespond[][day]" class="txtcss" _grrand="2" id="autorespond[2][day]"/>
day(s)
<select class="selectcss" name="autorespond[1][type]" name_tpl="autorespond[][type]">
<option selected="" value="BE">before expiration</option>
<option value="AE">after expiration </option>
<option value="AS">after subscribing</option>
</select>
</td>
<td nowrap="nowrap" align="center">
<input type="hidden" name_tpl="autorespond[][email_id]" value="" id="autorespond[2][email_id]" name="autorespond[2][email_id]" style="visibility: visible;" _grrand="2"/>
<input type="text" name_tpl="name__autorespond[][email_id]" value="" size="30" style="width: 400px; visibility: visible;" class="txtcss" readonly="" id="name__autorespond[2][email_id]" name="name__autorespond[2][email_id]" _grrand="2"/>
<input type="button" name_tpl="_autorespond[][email_id]" class="btncss" keep="1" onclick="javascript:browseForEmails(this);" value="Browse" name="_autorespond[2][email_id]" style="visibility: visible;" _grrand="2" id="_autorespond[2][email_id]"/>
</td>
</tr>
</tbody>
</table>
<td>
</tr>
<tr>
<td class="left-side-text-borderless" colspan="2" style="text-align:center !important">
<input type="button" class="btncss" onclick="javascript:AddEmail();" style="width: 194px;" value="Add Email(s) to this Campaign" name="add"/>
</td>
</tr>
<tr>
<td colspan="2">
<div class="comment-div" style="width:775px !important">
<center><strong>Using the Autoresponder to send your campaign Email automatically :</strong></center><br/>
In the "Day" column below:<br/>
1. Select zero ( 0 ) when you desire a given Email to be sent out immediately;<br/>
2. Select a positive number to indicate how many days after he subscribes a member should receive a given Email (example: to<br/> send a given Email to a member 3 days after he subscribes, select 3), and<br/>
3. Select a negative number to indicate how many days in advance of an approaching expiration a member should be alerted <br/>
(example: to alert a member his membership will expire in 3 days, select -3).<br/>
<br/>
<br/>
<span style="color:red;font-style:italic">Note</span><br/>
MemberSite cron job must be added to and configured on your host server before the Autoresponder will perform properly! You must<br/> contact your host to have this done.<br/>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="horizontal-line">
</div>
</td>
</tr>
<tr>
<td class="buttontd" colspan="2" style="text-align:center !important">
<input type="submit" class="btncss" name="submit" {if $IsEdit eq 'yes'}value="Update Compaign"{else}value="Create Compaign"{/if}>
<input type="button" class="btncss" name="btnBack" value="Cancel" onclick="javascript:location.href='admin_canned_email_v.php';">
</td>
</tr>
</table>
</div>
</form>
{literal}
<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
var frmvalidator = new Validator("frmAutoResponder");
frmvalidator.EnableMsgsTogether();
//frmvalidator.EnableOnPageErrorDisplaySingleBox();
/*
frmvalidator.addValidation("txtName","req","Please enter Canned Email name.");
frmvalidator.addValidation("txtName","maxlen=100", "Maximum length for Canned Email name is 100 character.");
frmvalidator.addValidation("txtName","alnum_s","Enter only alphabetic/numeric characters in Canned Email name.");
frmvalidator.addValidation("txtSenderName","req","Please enter Sender name.");
frmvalidator.addValidation("txtSenderName","maxlen=45", "Maximum length for Sender name is 45 character.");
frmvalidator.addValidation("txtSenderName","alnum_s","Enter only alphabetic/numeric characters Sender name.");
frmvalidator.addValidation("txtSenderEmail","req","Please enter Sender Email.");
frmvalidator.addValidation("txtSenderEmail","maxlen=45","Maximum length for Sender Email is 45 character.");
frmvalidator.addValidation("txtSenderEmail","email","Invalid Sender Email.");
// frmvalidator.addValidation("dirlist","dontselect=''","Please select Email attachment.");
*/
/*
frmvalidator.addValidation("txtFieldDescription","req","Please enter field description.");
frmvalidator.addValidation("txtFieldDescription","maxlen=100","Max length for field description is 100 character.");
frmvalidator.addValidation("ddlSQLFieldType","dontselect=''","Please select SQL field type.");
frmvalidator.addValidation("txtFieldSize","req","Please enter field size.");
frmvalidator.addValidation("txtFieldSize","maxlen=20", "Max length for field name is 20 character.");
frmvalidator.addValidation("txtFieldSize","num","Enter only digits in field size.");
frmvalidator.addValidation("txtDefaultValue","req","Please enter field default value.");
frmvalidator.addValidation("ddlDisplaySignup","dontselect=''","Please select display in signup form.");
frmvalidator.addValidation("ddlDisplayProfile","dontselect=''","Please select display in profile form.");
frmvalidator.addValidation("ddlValidateFunction","dontselect=''","Please select validate function.");
*/
</script>
{/literal}
</div>
</div>
</div>
{$ADMIN_FOOTER}