This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
DBHomework/web/booksys/install.html

108 lines
3.0 KiB
HTML
Raw Normal View History

<!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>
<style>
div.login_panel
{
text-align:center;
margin: auto;
}
2017-11-27 11:45:39 +08:00
div.progressbar_label
{
text-align:center;
}
</style>
</head>
<body>
2017-11-27 11:45:39 +08:00
<div class="error"></div>
<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>
</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").fadeTo(0,0).text("No Error");
2017-11-27 11:45:39 +08:00
createError($(".error"));
$("#submit").click(function(){
$("#submit").hide("");
2017-11-27 11:45:39 +08:00
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).delay(500).fadeTo(500,0,function(){
$("#submit").show("");
});
2017-11-27 11:45:39 +08:00
}
},"json")
.fail(function(err){
console.log("Failed to post");
$(".error").text("Failed to Install");
createError($(".error"));
$(".error").fadeTo(0,1).delay(500).fadeTo(500,0,function(){
$("#submit").show("");
});
2017-11-27 11:45:39 +08:00
})
.always(function(){
bar.hide();
});
});
</script>
</body>
</html>