Current File : //root/panel/modules/weebly/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>			
		
	<div class="zgrid_wrapper">
		<h2><: Current Weebly Domain List :></h2>
        <% if WeeblyList %>
            <table class="table table-striped">
                <tr>
                    <th><: Domain :></th>
                    <th><: Link :></th>
                </tr>
                <% loop WeeblyList %>
                <tr>
					<td style="max-width: 200px; display: inline-block; word-wrap: break-word;"><a href="http://<& domain &>/" target="_blank"><& domain &></a></td>
					<td style="min-width:450px;">
					<form id="rcLogin" name="rcLogin" method="post" action="./?module=weebly&action=CreateLink" target="_blank" style="display: contents;">
						<button class="btn btn-default" type="submit" name="w_id" value="<& weeblyid &>" />Edit Site</button>
					</form>
                    </td>
                </tr>
                <% endloop %>
            </table>
        <% else %><!-- ELSE MailboxList -->
        <: Sorry there are currently no Weebly configured! :>
        <% endif %><!-- END MailboxList -->
    </div>
		
    <div class="zgrid_wrapper">
	<form action="./?module=weebly&action=CreateWeebly" method="post">
        <table class="none" width="100%" cellborder="0" cellspacing="0">
            <tr valign="top">
                <td>
                    <h2><: Weebly For Your Domain :></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> Weebly Install for Your all active domains. If you want Login into your account click Login Weebly.</td>
                            </tr>
                            <tr>
                               <!-- <th><button class="button-loader btn btn-primary" type="submit" name="CreateWeebly" id="CreateWeebly" value="inCreate"><: Create :></button></th>-->
							    <th><button class="button-loader btn btn-primary" type="submit" ><: Create :></button></th>
                                <td></td>
                                <td></td>
                            </tr>
                        </table>
                        <@ CSFR_Tag @>    
                    </form>						
                </td>
            </tr>
        </table>
    </div>
    
</div> 

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

		}
		});
});

$(document).ready(function(){
	
		$.ajax({
			type: 'POST',
			url: './?module=weebly&action=CreateWeebly',
			success: function(data) {
				$("#zgrid_wrapper").html(data);
			},
			error: function(ts) 
			{ 
				console.log(ts.responseText);
			}
		});
	});

    */$(document).ready(function(){

        $("#CreateWeebly").click(function(){
		$("#zloader_overlay").show();
		$("#zloader").show();

		var inDomain=$("#inDomain option:selected").val();
		var Weeblybutton = document.getElementById("CreateWeebly");
		Weeblybutton.disabled = "true";
		ajax_call(inDomain,function(st)
		{
		  Weeblybutton.disabled = "false";
		});
		
		$.ajax({ 

		type: 'POST',
		url: './?module=weebly&action=CreateWeebly',
		data:{inDomain:inDomain},
		success: function(data) {
		console.log (data);
			data=data.replace("\n","");
			if(data=="BADPOINTING")
			{
				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> Your Domain name is not pointing to the IP.</p></div>');
				$("#zloader_overlay").hide();
				$("#zloader").hide();
				$("#CreateWeebly").removeAttr("disabled");
				return false;
			} 
		
	if(data=="HTTPCODEERR")
			{
				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> Your website not working properly. Kindly update your website that should given a http code as 200</p></div>');
				$("#zloader_overlay").hide();
				$("#zloader").hide();
				$("#CreateWeebly").removeAttr("disabled");
				return false;
			} 
					
			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();
			$("#CreateWeebly").removeAttr("disabled");
			return false;
			}
			
			$('#close_button').trigger("click");
		},
		error: function(ts) { 
		console.log(ts.responseText);
		$("#zloader_overlay").hide();
		$("#zloader").hide();

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

});
});*/

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

function ajax_call(domain,callback)
{
	function  real_ajax()
	{

	 var xhttp = new XMLHttpRequest();
	  xhttp.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
		try 
		{
			 var jd = JSON.parse(this.responseText);
			if(jd.status == 1)
			{
				callback(true);
			}
			else
			{
				setTimeout(function(){ real_ajax();},60000);
			}
		}
		catch(err) {
			console.log("Error in server");
		}
		
		}
	  };
	  xhttp.open("POST", "./?module=weebly&action=WeeblyButtonDisable", true);
	   xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
       xhttp.send("dom_detail="+encodeURIComponent(domain));

	}
	real_ajax();
}

function showLog()
{
	 $.ajax({

     url : './?module=weebly&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>