Current File : //etc/zpanel/panel/modules/ssl/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:-121px;
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>
	<div id="zform_wrapper">

				<@ Result @>
	</div>			
	<% if isDeleteDomain %>
		<div class="zform_wrapper alert alert-danger">
			 <h2><: Delete :>: <@ CurrentDomain @>?</h2>
			<p><: Please confirm that you want to delete SSL for this domain. :></p>
			
				<table class="none" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="2" align="right">
							<input type="hidden" Id="inDelete" name="inDelete" value="<@ CurrentID @>">
							<button class="button-loader delete btn btn-danger" type="submit" id="DelSSL" onclick="DelSSL()" ><: Delete :></button>
							<button class="button-loader btn btn-default" type="button" onclick="window.location.href='./?module=ssl';return false;"><: Cancel :></button>
						</td>
					</tr>
				</table>
				<@ CSFR_Tag @>
			
		</div>
	<% endif %>
				
	<div class="zgrid_wrapper" Id="zgrid_wrapper">
        
    </div>
				
    
    <div class="zgrid_wrapper">
        <table class="none" width="100%" cellborder="0" cellspacing="0">
            <tr valign="top">
                <td>
                    <h2><: Create a SSL Certificate :></h2>
                  
                        <table class="table table-striped">
							
							
                            <tr>
                                <th nowrap="nowrap"><: Email Address :>:</th>
								<td style="padding-top: 2px;"> <@ EmailList @> </td>
                                
                            </tr>
							
                            <tr>
                                <th nowrap="nowrap"><: Domain :>:</th>
                                <td style="padding-top: 2px;">
                                    <select name="inDomain" id="inDomain">
                                        <option value="" selected="selected">-- <: Select a domain :> --</option>
                                        <% loop DomainList %>
                                        <option value="<& domain &>"><& domain &></option>
                                        <% endloop %>
                                    </select>
                                </td>
								<td><b>Note :</b> SSL Installed for Your all active domains. If you want reinstall delete the domain and install.</td>
                            </tr>
							<tr>
							<td style="padding-top: 2px;">
							<input type="radio" name="wwwoption" value="with" style="vertical-align: sub;" checked>With WWW 
							</td>
							<td style="padding-top: 2px;">
							<input type="radio" name="wwwoption" value="without" style="vertical-align: sub;">Without WWW
							</td>
							</tr>
							<tr><td style="padding-top: 2px;"><input type="checkbox" name="httpscheck"><b>Enable HTTPS Redirect</b></td></tr>
                            <tr>
                                <th><button class="button-loader btn btn-primary" type="submit" name="CreateSSL" id="CreateSSL" value="inCreate"><: Create :></button></th>
                                <td></td>
                                <td></td>
                            </tr>
                        </table>
                        <@ CSFR_Tag @>                 
                    
                </td>
                
            </tr>
        </table>
    </div>
    
</div> 

<script type="text/javascript">
function DelSSL()
{

$("#zloader_overlay").show();
$("#zloader").show();
var inDelete;
inDelete=$("#inDelete").val();
//alert(inDelete);
$.ajax({
            url: './?module=ssl&action=DeleteSslDomain',
			type:'post',
            data: {inDelete:inDelete},
            success: function(data) {
$('#close_button').trigger("click");
$.ajax({
		type: 'POST',
		url: './?module=ssl&action=SslList',
		success: function(data) {
		$("#zgrid_wrapper").html(data);
		},
		error: function(ts) { 
		console.log(ts.responseText);

		}
		});
$(".zform_wrapper").hide();
$("#zform_wrapper").prepend('<div class="alert alert-block alert-info"><button type="button" Id="close_button" onClick="CloseParent();" class="close" data-dismiss="alert">×</button><p><strong>Success:</strong> SSL Certificate successfully Deleted .</p></div>');  
$("#zloader_overlay").hide();
$("#zloader").hide();
window.location='./?module=ssl';
},
 error: function(ts) { 
console.log(ts.responseText);
$("#zloader_overlay").hide();
$("#zloader").hide();

 }
        });
return false;
}
</script>

<script type="text/javascript">
    $(document).ready(function(){
	
		$.ajax({
		type: 'POST',
		url: './?module=ssl&action=SslList',
		success: function(data) {
		$("#zgrid_wrapper").html(data);
		},
		error: function(ts) { 
		console.log(ts.responseText);

		}
		});

        $("#CreateSSL").click(function(){
	
	$("#CreateSSL").prop("disabled",true);
	$("#zloader_overlay").show();
$("#zloader").show();

var inDomain=$("#inDomain option:selected").val();
var wwwoption=$("[name=wwwoption]:checked").val();
//var httpscheck=$("[name=httpscheck]:checked").val();
var httpscheck=0;
if($("[name=httpscheck]").is(":checked"))
{
httpscheck=1;
}
  console.log (wwwoption);
		$.ajax({ 

		type: 'POST',
		url: './?module=ssl&action=CreateSSL',
		data:{inDomain:inDomain,wwwoption:wwwoption,httpscheck:httpscheck},
		success: function(data) {

		$('#close_button').trigger("click");

		$.ajax({
		type: 'POST',
		url: './?module=ssl&action=SslList',
		success: function(data) {
		$("#zgrid_wrapper").html(data);
		
		
		$.ajax({

		url : './?module=ssl&action=SslSock',
		type : 'POST',
		data:{inDomain:inDomain,wwwoption:wwwoption,httpscheck:httpscheck},
		success : function (result) {
		console.log (result);
			if(result=="BADPOINTING")
			{
			$('#close_button').trigger("click");
			$("#zform_wrapper").prepend('<div class="alert alert-block alert-info"><button type="button" Id="close_button" onClick="CloseParent();" class="close" data-dismiss="alert">×</button><p><strong>Failed:</strong> Your Domain name is not pointing to the IP</p></div>');
			} 
					if(data=="SOCKETERR")
			{
			CloseParent();
			$("#zform_wrapper").prepend('<div class="alert alert-block alert-info" style="display: block !important;"><button type="button" Id="close_button" onClick="CloseParent();" class="close" data-dismiss="alert">×</button><p><strong>Failed:</strong> Server Busy, Please try after sometimes.</p></div>');
			$("#zloader_overlay").hide();
			$("#zloader").hide();
			$("#CreateSSL").removeAttr("disabled");
			return false;
			}
			
		},
		error : function () {
		console.log ('error');
		}

		});
		
		
		
		$("#zloader_overlay").hide();
		$("#zloader").hide();

		},
		error: function(ts) { 
		console.log(ts.responseText);

		}
		});
		},
		error: function(ts) { 
		console.log(ts.responseText);
		$("#zloader_overlay").hide();
		$("#zloader").hide();

		}
		}); 
//xhr.abort();

});
});
function CloseParent()
{
$("#close_button").parent().hide();
}

function showLog()
{
	 $.ajax({

     url : './?module=ssl&action=showLogcontent',
     type : 'POST',
	 
     success : function (result) {
		$("#zform_wrapper").html(result).addClass('alert alert-block alert-info');
		
	 },
     error : function () {
        console.log ('error');
     }

   }); 
return false;
}
</script>