Location: PHPKode > projects > MembersGear > membersgear/templates/installation_configuration_email.tpl
{$INSTALLATION_HEADER}
{literal}
<script language="JavaScript" type="text/javascript" >     
 function checkSpecialChar()
        {                  
         var error=""
         var altfiled="";    
         var foc=1;
        var emailfromname=document.getElementById('emailfromname').value;
        if(!checkSpecialChar_error(emailfromname))
         {
          error="only alphabates and space is alllow in email from name." ;
          if(foc==1)
           {  
              focus='emailfromname'; 
              foc=0;
            }
         } 
         
        if(error=="")
        {
         return true;
        }
       else
        {
          alert(error);
           var FocusControl = document.getElementById(focus);
           FocusControl.focus();
           return false;
                                                                             

        } 
     } 
     
     function checkSpecialChar_error(data)
     {                   
          
       var sts=true;
       var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?~_"; 

       for (var i = 0; i < data.length; i++) {
          if (iChars.indexOf(data.charAt(i)) != -1) {
            sts=false;
         
          }
      }
       return sts;  
     } 
      
                  
                  
</script>
{/literal}
  <div id="content" class="setdiv">
    
    {if $msg neq ''}
        <div class="errormsg"  style="width:350px">
            {$msg}
        </div>
    {/if}
    
    <div id="full-contentdiv">
        
        <div class="righttop">
             <h2><center>
                    Step 3. Configure Email System</h2>
         </div>
        <div class="whole-page clear">
                        
           <form name="frmConfigureEmailSystem" id="frmConfigureEmailSystem" 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:300px;"><label>
                             Send Email Method <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="radio" name="mailMethod" id='smtpRdo' value="smtp" class="chkcss" {if $os eq 'win'} checked="" {/if} >SMTP
                                <input type="radio" name="mailMethod" id='sandmailrdo'  value="sendmail" {if $os eq 'other'} checked="" {/if}  class="chkcss">Send Mail
                               
                            </td>
                    </tr>
                     <tr id='host_tr' style="display:none">
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Mail System Host <label class="star">*</label>
                            </label><div class="FieldLabelNote" >In most cases localhost.</div>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="host" name="host" style="width: 554px ! important;" value="{$phpmailer_host}">
                            </td>
                    </tr>
                    
                     <tr id='auth_tr' style="display:none">
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Mail System SMTP Authentication <label class="star"></label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                               {if $phpmailer_smtpauth eq 'false' or $phpmailer_smtpauth eq '' }
                                  <input id='chkAuth' name="chkAuth" type="checkbox" value="true" class="chkcss" name="auth" style="border-width: 0px;"/>    
                               {else}
                                <input id='chkAuth' type="checkbox" value="true" class="chkcss" name="auth" checked style="border-width: 0px;"/>
                                
                              {/if}       
                            </td>
                    </tr>
                    
                    <tr id='user_tr' style="display:none">
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Mail System Username <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="authusername" name="authusername" style="width: 554px ! important;" value="{$phpmailer_username}">
                            </td>
                    </tr>
                    
                    <tr id='pass_tr' style="display:none">
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Mail System Password <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="password" class="txtcss" id="authupassword" name="authupassword" style="width: 554px ! important;" value="{$phpmailer_password}">
                            </td>
                    </tr>
                    
                    <tr id="port_tr" style="display:none">
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Mail System Port <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="port" name="port" style="width: 50px ! important;" value="{$phpmailer_port}">
                            </td>
                    </tr>
                    
                    <tr>
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Email From <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="emailfrom" name="emailfrom" style="width: 554px ! important;" value="{$phpmailer_email_form}">
                            </td>
                    </tr>
                    
                    <tr>
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                             Email From Name <label class="star">*</label>
                            </label>
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="emailfromname" name="emailfromname" style="width: 554px ! important;" value="{$phpmailer_email_form_name}">
                            </td>
                    </tr>
                    
                    <tr>
                            <td class="right-side-text-borderless space" valign="top" style="width:300px;"><label>
                                Administrator Email Address <label class="star">*</label>
                            </label>
                                    <input type="hidden" id="hdn-admin-email" name="hdn-admin-email" value="">
                            </td>
                            <td class="left-side-text-borderless">
                                <input type="text" class="txtcss" id="txt-admin-email" name="txt-admin-email" style="width: 554px ! important;" value="{$administrator_email}">
                            </td>
                    </tr>

                    
                   <tr>
                             <td class="right-side-text" width="50%"> &nbsp;</td>
                           <td class="buttontd" width="50%">
                                <input  type="submit" value="Save"  class="btncss" align="middle">

                            </td>
                        </tr>


              </table>
            
        </div>
         <div>&nbsp;</div>
           <center>
           
            <div class="comment-div" style="margin: 0px 0px 5px 5px ! important; width: 805px ! important;">
                            <table class="formformat_comment">
                                  <tr>
                                     <td><strong> Note: </strong></td>
                                     <td>
                                       You can change Email configuration later on by going to Admin's Control Panel->Configure Email System.
                                     </td>
                                  </tr>
                                </table>
                                
                          </div>  

           </center>
           </div>

           </form>
         {literal}
           <script language="JavaScript" type="text/javascript">
           
                var $n = jQuery.noConflict();  
                $n(document).ready(function(){  
                
                     $n("#smtpRdo").click(function() {
                        showHideOptions();
                     });
                     
                     $n("#sandmailrdo").click(function() {
                        showHideOptions();
                     });
                     
                   showHideOptions();  
                
                });
                
                  $n("#chkAuth").click(function() {
                        showHideAuthCredentials();
                  });
                
                function showHideOptions(){
                  
                      if($n("#smtpRdo").is(':checked')){
                      
                            $n("#host_tr").show();
                            $n("#auth_tr").show();
                            $n("#port_tr").show();
                            showHideAuthCredentials();
                      
                        }
                      else if($n("#sandmailrdo").is(':checked')){
                      
                              $n("#host_tr").hide();
                              $n("#auth_tr").hide();
                              $n("#port_tr").hide();
                              $n("#user_tr").hide();
                              $n("#pass_tr").hide();
                            
                              
                      
                      }   
                  }
                
               function showHideAuthCredentials(){
               
               
                      if($n("#chkAuth").is(':checked')){ 
                      
                             $n("#user_tr").show();
                             $n("#pass_tr").show();
                      }
                     else{
                            $n("#user_tr").hide();
                            $n("#pass_tr").hide();
                       } 
               
               }    
                 
                //You should create the validator only after the definition of the HTML form
                  var frmvalidator  = new Validator("frmConfigureEmailSystem");

                  frmvalidator.EnableMsgsTogether();
                  frmvalidator.addValidation("txt-admin-email","req","Please enter Administrator Email address.");
                  frmvalidator.addValidation("txt-admin-email","email","Please enter valid email address.");
                  frmvalidator.addValidation("host","req","Please enter Hostname.","is_host_validationRequired()=='yes'");
                  frmvalidator.addValidation("authusername","req","Please enter Mail system Username.","is_username_validationRequired()=='yes'");
                  frmvalidator.addValidation("authupassword","req","Please enter Mail system Password.","is_password_validationRequired()=='yes'");
                  frmvalidator.addValidation("port","req","Please enter Mail system Port Number.","is_port_validationRequired()=='yes'");
                  frmvalidator.addValidation("port","numeric","Please enter only numeric value in Mail system Port Number.");
                  frmvalidator.addValidation("emailfrom","req","Please enter from email address.");
                  frmvalidator.addValidation("emailfrom","email","Please enter valid email address.");  
                  frmvalidator.addValidation("emailfromname","req","Please enter from email name.");                                
                  //frmvalidator.addValidation("emailfromname","alpaha","only Alphabetic characters allow in  from email name.");     
                  frmvalidator.setAddnlValidationFunction("checkSpecialChar");
                 
                 function is_host_validationRequired(){
                 
                    if($n("#smtpRdo").is(':checked')){
                    
                    return 'yes';
                    }
                   else return 'no'; 
                 
                 }
                 
                function is_username_validationRequired(){
                     if($n("#smtpRdo").is(':checked')){ 
                      
                        if($n("#chkAuth").is(':checked')){ 
                          return 'yes';
                        }
                       else
                        return 'no'; 
                     
                     }
                   else
                     return 'no';  
               
               } 
               
             function is_password_validationRequired(){
            
                if($n("#smtpRdo").is(':checked')){ 

                    if($n("#chkAuth").is(':checked')){ 
                       return 'yes';
                    }
                   else
                     return 'no';  

                }
                else
                  return 'no';  
            
            }
           function is_port_validationRequired(){
           
                if($n("#smtpRdo").is(':checked')){
                
                  return 'yes';
                }
                else return 'no'; 
           
           
           }      
                  
           </script>
          {/literal}
    </div>
</div>
</div>
{$INSTALLATION_FOOTER}
Return current item: MembersGear