Current File : //root/panel/modules/mail_admin/module.zpm
<div class="zmodule_content panel" id="zmodule_header_<@ ModuleName @>">
    <div class="panel-heading">
        <img src="<@ ModuleIcon @>" width="35" height="35" border="0" alt="<@ ModuleName @>">

        <div class="zmodule_title">
            <@ ModuleName @>
        </div>

        <div class="zmodule_desc" id="zmodule_desc_<@ ModuleName @>"><@ ModuleDesc @></div>

    </div>
<style>
.helpicon {
display: block;
float: right;
border: 1px solid #ccc;
background-color: #f3f3f3;
padding: 5px 10px;
font-size: 12px;
margin-top:-83px;
margin-right:5px;
-webkit-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-webkit-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
}

</style>
<div class="helpicon">
<a href="<@ helpicon @>" target="_blank"><img src="etc/styles/CstyleX-master/images/help.png" style="float:left;" ><span style="float:left;margin-top:8px;font-weight:bold;font-size:12px;" >Video Tutorial</span></a>
</div>

    <@ Result @>

    <div class="zgrid_wrapper">
        <h2><: Configure your Mail Settings :></h2>
        <form action="./?module=mail_admin&action=UpdateConfig" method="post">
            <table class="table table-striped">
                <% loop Config %>
                <tr valign="top">
                    <th nowrap="nowrap"><& cleanname &></th>
                    <td><& fieldhtml &></td>
                    <td><& description &></td>
                </tr>
                <% endloop %>
		<% if allip %>
<tr>
<th>Server private ip</th>
<td >
<select name="ipdetail" >
<% loop allip %>
<option value="<& private_ip &>"><& public_ip &></option>
<% endloop %>
</select>
</td>
<td>Send mail from perticular IP</td>

</tr>
<% endif %>
 		<tr> <td colspan="3" ><: Enable SMTP PORT :>&nbsp;&nbsp;&nbsp;&nbsp; <span id="smtp_port" >&nbsp;</span></td> </tr>
 		
                <tr>
                    <th colspan="3">
                        <button class="button-loader btn btn-primary" type="submit" id="button" name="inSaveSystem"><: Save Changes :></button>
                        <button class="button-loader btn btn-default" type="button" onclick="window.location.href='./?module=mail_admin';return false;"><: Cancel :></button>
                    </th>
                </tr>
            </table>
            <@ CSFR_Tag @>
        </form>
    </div>

</div>
<script type="text/javascript" >
var st_msg = "Something wrong , please contact system admin";
var fd = null;
function  hrpanel()
{
    var _self = this;

	_self.allip = function()
    {
        var ajaxdata1={
        "ajaxurl":"./?module=mail_admin&action=allip",
        "ajaxmethod":"POST",
        "ajaxsync":true,
        "calldetail":2,
        "statusdetail":3,
        "datadetail":"",
        "callback":function(response)
            {
            }

        };
       _self.ajaxcall(ajaxdata1);
    }



    _self.smtp_data = function()
    {
        var ajaxdata1={
        "ajaxurl":"./?module=mail_admin&action=smtpdetail",
        "ajaxmethod":"POST",
        "ajaxsync":true,
        "calldetail":2,
        "statusdetail":3,
        "datadetail":"",
        "callback":function(response)
            {
                if(typeof response['status'] != "undefined" )
                {
                    if(parseInt(response['status']) == 1)
                    {
                        if(parseInt(response['std']) == 1)
                        {
                            document.getElementById("smtp_port").innerHTML="<input type=\"checkbox\" name=\"smtp_enable\" value=\"1\" checked >&nbsp;(If SMTP 25 port  is not working then you can enable 26 port for mail)";
                        }
                        else
                        {
                            document.getElementById("smtp_port").innerHTML="<input type=\"checkbox\" name=\"smtp_enable\" value=\"0\"  >&nbsp;(If SMTP 25 port  is not working  then you can enable 26 port for mail)";
                        }
                    }
                    else
                    {
                        document.getElementById("smtp_port").innerHTML=st_msg;   
                    }
                
                }
                else
                {
                document.getElementById("smtp_port").innerHTML=st_msg;                    
                }
            }
            
        };
       _self.ajaxcall(ajaxdata1);
    }
    _self.ajaxcall = function(ajaxdata) {
        var xmlhttp = ""; // The variable that makes Ajax possible!
        try {
            // Opera 8.0+, Firefox, Safari
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            // Internet Explorer Browsers
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    // Something went wrong
                    console.log("Your browser broke!");
                    return false;
                }
            }
        }
        // Create a function that will receive data sent from the server
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			console.log(xmlhttp.responseText);
                        try{
                            var jsondata = JSON.parse(xmlhttp.responseText);
                           ajaxdata.callback(jsondata)
                        
                        }
                        catch(ex)
                        {
                             console.log(ex);
                        }        
                                   
            } else if (xmlhttp.status == 404 || xmlhttp.status == 500) {
                console.log("404 or 505 error");
            } else {}
        }
        if (ajaxdata.ajaxsync == true) {
            xmlhttp.open(ajaxdata.ajaxmethod, ajaxdata.ajaxurl, ajaxdata.ajaxsync);
        } else {
            xmlhttp.open(ajaxdata.ajaxmethod, ajaxdata.ajaxurl);
        }
        if (ajaxdata.statusdetail == 4) {
            xmlhttp.send(ajaxdata.formdata);
        } else {
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send(ajaxdata.datadetail);
        }
    }
}

document.addEventListener("DOMContentLoaded",function()
{
    fd = new hrpanel();
    fd.smtp_data();

});
</script>