2017-11-19 15:43:47 +08:00
|
|
|
<!DOCTYPE>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>BookSystem 安装</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
2017-11-27 11:45:39 +08:00
|
|
|
<link rel="stylesheet" href="jquery-ui.css">
|
|
|
|
<link rel="stylesheet" href="jquery-ui.structure.css">
|
|
|
|
<link rel="stylesheet" href="jquery-ui.theme.css">
|
|
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
|
|
<script type="text/javascript" src="jquery-ui.js"></script>
|
|
|
|
|
2017-11-19 15:43:47 +08:00
|
|
|
<style>
|
|
|
|
div.login_panel
|
|
|
|
{
|
|
|
|
text-align:center;
|
|
|
|
margin: auto;
|
|
|
|
}
|
2017-11-27 11:45:39 +08:00
|
|
|
div.progressbar_label
|
|
|
|
{
|
|
|
|
text-align:center;
|
|
|
|
}
|
|
|
|
|
2017-11-19 15:43:47 +08:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2017-11-27 11:45:39 +08:00
|
|
|
<div class="error"></div>
|
2017-11-19 15:43:47 +08:00
|
|
|
<div class="login_panel">
|
2017-11-27 11:45:39 +08:00
|
|
|
<p>欢迎使用BookSystem安装程序!</p>
|
|
|
|
<div>
|
|
|
|
<p>数据库地址: <input type="text" value="127.0.0.1" id="dbaddr" name="dbaddr"></p>
|
|
|
|
<p>数据库端口: <input type="text" value="3306" id="dbport" name="dbport"></p>
|
|
|
|
<p>数据库用户名: <input type="text" value="root" id="dbuser" name="dbuser"></p>
|
|
|
|
<p>数据库密码: <input type="password" id="dbpass" name="dbpass"></p>
|
|
|
|
<p>数据库名: <input type="text" id="dbname" name="dbname"></p>
|
|
|
|
<p><button id="submit">Install</button></p>
|
|
|
|
<div id="progressbar">
|
|
|
|
<div class="progressbar_label"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-11-19 15:43:47 +08:00
|
|
|
</div>
|
2017-11-27 11:45:39 +08:00
|
|
|
|
|
|
|
<script>
|
|
|
|
// Button Init
|
|
|
|
$("button").button();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
//functions start
|
|
|
|
function createHighlight(obj){
|
|
|
|
obj.addClass('ui-state-highlight ui-corner-all');
|
|
|
|
obj.html('<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right:.3em;"></span>'+obj.html()+'</p>');
|
|
|
|
}
|
|
|
|
|
|
|
|
function createError(obj){
|
|
|
|
obj.addClass('ui-state-error ui-corner-all');
|
|
|
|
obj.html('<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right:.3em;"></span>'+obj.html()+'</p>');
|
|
|
|
}
|
|
|
|
|
|
|
|
$(".error").hide();
|
|
|
|
$(".error").text("No Error");
|
|
|
|
createError($(".error"));
|
|
|
|
$(".error").fadeTo(0,0);
|
|
|
|
$(".error").show();
|
|
|
|
|
|
|
|
$("#submit").click(function(){
|
|
|
|
$("#submit").hide();
|
|
|
|
var bar=$("#progressbar").progressbar({
|
|
|
|
value:false
|
|
|
|
});
|
|
|
|
$(".progressbar_label").text("Installing...");
|
|
|
|
console.log("Clicked");
|
|
|
|
console.log("Begin Post");
|
|
|
|
$.post("/cgi-bin/booksys/doInstall",
|
|
|
|
{
|
|
|
|
dbaddr:$("#dbaddr").val(),
|
|
|
|
dbport:$("#dbport").val(),
|
|
|
|
dbuser:$("#dbuser").val(),
|
|
|
|
dbpass:$("#dbpass").val(),
|
|
|
|
dbname:$("#dbname").val()
|
|
|
|
},function(data){
|
|
|
|
console.log("Post Done!");
|
|
|
|
if(data.success==1) {
|
|
|
|
// Success
|
|
|
|
location.href="install-success.html";
|
|
|
|
} else {
|
|
|
|
// Fail
|
|
|
|
console.log("Install Failure");
|
|
|
|
$(".error").text("Install Failure.");
|
|
|
|
createError($(".error"));
|
|
|
|
$(".error").fadeTo(0,1).show().delay(1500).fadeTo(3000,0);
|
|
|
|
}
|
|
|
|
},"json")
|
|
|
|
.fail(function(err){
|
|
|
|
console.log("Failed to post");
|
|
|
|
$(".error").text("Failed to Install");
|
|
|
|
createError($(".error"));
|
|
|
|
$(".error").fadeTo(0,1).show().delay(1500).fadeTo(3000,0);
|
|
|
|
})
|
|
|
|
.always(function(){
|
|
|
|
$("#submit").show();
|
|
|
|
bar.hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2017-11-19 15:43:47 +08:00
|
|
|
</body>
|
|
|
|
</html>
|