Current File : //etc/sentora/panel/modules/wordpress_installation/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);
}
#error_handler {
    display: none;
}
</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" Id="zgrid_wrapper">
        
    </div>
    <div id="error_handler" class="alert alert-danger " style="width:100%"><a href="#" class="close" data-dismiss="alert">×</a><div><p style="margin-top: 8px;">&nbsp;&nbsp;The following errors were found :</p><ul type="square" style="margin-top:8px; margin-left:29px; list-style: square !important;"><li style="font-size:13px;">Installation cannot proceed because the following files already exist in the target folder :<ul style="list-style: square !important; margin-left: 37px;"><li class="file_type"></li></ul>Please delete these files or choose another folder.<b>OR</b><br><input type="checkbox" name="overwrite_existing" id="overwrite_existing">&nbsp;&nbsp;<b><span style="color:#000;">Select the checkbox to overwrite all files and continue</span></b></li></ul></div></div>

    <div class="zgrid_wrapper">
        <table class="none" width="100%" cellborder="0" cellspacing="0">
            <tr valign="top">
                <td>
                    <h2><: Install your WordPress Website in One Click By fillup the below :></h2>
                        <table class="table table-striped">
                            <tr>
                                <th nowrap="nowrap"><: Email Address :>:</th>
                                <td><input name="EmailId" type="text" id="EmailId" value="<@ EmailList @>"/ style="padding: 5px;"></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>
                            </tr>
                            <tr>
                                <th><: Admin Username :>:</th>
                                <td><input name="admin_username" type="admin_username" id="admin_username" style="padding: 5px;"/></td>
                                <td><span id="result"></span></td>
                            </tr>
                            <tr>
                                <th><: Admin Password :>:</th>
                                <td><input name="admin_password" type="admin_password" id="admin_password" style="padding: 5px;"/></td>
                                <td><span id="result"></span></td>
                            </tr>
                            <tr>
                                <th><: In Directory :><br> <: The directory is relative to your domain and should not exist. :> <br> <: e.g. To install at http://mydomain/dir/ just type dir. :> <br> <: To install only in http://mydomain/ leave this empty :></th>
                                <td><input name="Directory" type="Directory" id="Directory" style="padding: 5px;"/></td>
                                <td><span id="result"></span></td>
                            </tr>
                            <tr>
                                <th><button class="btn btn-primary" type="submit" name="InstallWordPress" id="InstallWordPress" value=""><: Install :></button></th>
                            </tr>
                        </table>
                        <@ CSFR_Tag @>                 
                </td>
            </tr>
        </table>
    </div>
</div> 

<script type="text/javascript">
    $(document).ready(function()
    {
        $("#InstallWordPress").click(function()
        {
            $("#zform_wrapper").html('');
		    $("#zloader_overlay").show();
            $("#error_handler").hide();
		    var inDomain=$("#inDomain option:selected").val();
    		var admin_username=$("#admin_username").val();
	    	var admin_password=$("#admin_password").val();
	    	var EmailId=$("#EmailId").val();
		    var Directory=$("#Directory").val();
            var overwrite_existing = null;
            if(inDomain == '')
            {
                alert("Please choose Domain name ");
                $("#zloader_overlay").hide();
                $("#zloader").hide();
                return false;
            }
            else if(admin_username == '')
            {
                alert("Please enter admin username");
                $("#zloader_overlay").hide();
                $("#zloader").hide();
                return false;
            }
            else if(admin_password == '')
            {
                alert("Please enter admin password");
                $("#zloader_overlay").hide();
                $("#zloader").hide();
                return false;
            }
            if(Directory)
            {
                overwrite_existing = 2;
                InstallWordPress(inDomain, admin_username, admin_password, Directory, overwrite_existing, EmailId);                
                return true;
            }
            else
            {
                overwrite_existing = 3;
            } 

            if($("#overwrite_existing").is(':checked'))
            {
                overwrite_existing = 1;
                InstallWordPress(inDomain, admin_username, admin_password, Directory, overwrite_existing, EmailId);                
            }
            else
            {
    		    $.ajax({ 
                    type: 'POST',
                    url: './?module=wordpress_installation&action=CheckIndexFileExists',
                    data:{inDomain:inDomain},
                    success: function(data) 
                    {
                        if(data != false) 
                        { 
                            $(".file_type").html(data);
                            $("#error_handler").show();
                            $("#zloader_overlay").hide();
                            $("#zloader").hide();
                            return false;
                        }
                        else
                        {
                            InstallWordPress(inDomain, admin_username, admin_password, Directory, overwrite_existing, EmailId); 
                        }
                    },
                    error: function(ts) 
                    {
                        $("#zloader_overlay").hide();
                        $("#zloader").hide();
                    }
                }); 
            }
        });
});

function InstallWordPress(inDomain, admin_username, admin_password, Directory, overwrite_existing, EmailId)
{
    $.ajax({
        type: 'POST',
        url: './?module=wordpress_installation&action=InstallWordPress',
        data:{inDomain:inDomain, admin_username:admin_username,admin_password:admin_password,Directory:Directory,overwrite_existing:overwrite_existing, EmailId:EmailId},
        success: function(data)
        {
            console.log(data); 
            $("#zloader_overlay").hide();
            $("#zloader").hide();
            $("#zform_wrapper").prepend('<div class="alert alert-block alert-success"><button type="button" Id="close_button" onClick="CloseParent();" class="close" data-dismiss="alert">×</button><p><strong>Success:</strong>'+data+'</p></div>');
        },
        error: function(ts)
        {
            $("#zloader_overlay").hide();
            $("#zloader").hide();
        }
    });
}
function CloseParent()
{
$("#close_button").parent().hide();
}
</script>