103 lines
2.6 KiB
HTML
103 lines
2.6 KiB
HTML
<!DOCTYPE>
|
|
<html>
|
|
<head>
|
|
<title>BookSystem 安装</title>
|
|
{{Header}}
|
|
|
|
<style>
|
|
div.login_panel
|
|
{
|
|
text-align:center;
|
|
margin: auto;
|
|
}
|
|
div.progressbar_label
|
|
{
|
|
text-align:center;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="error"></div>
|
|
<div class="login_panel">
|
|
<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>
|
|
|
|
<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");
|
|
createError($(".error"));
|
|
|
|
$("#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).delay(500).fadeTo(500,0,function(){
|
|
$("#submit").show("");
|
|
});
|
|
}
|
|
},"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("");
|
|
});
|
|
})
|
|
.always(function(){
|
|
bar.hide();
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |