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/addbookobj.html

104 lines
3.7 KiB
HTML
Raw Permalink Normal View History

2017-12-08 22:37:18 +08:00
<!DOCTYPE>
<html>
<head>
<title>BookSystem 添加图书实体</title>
{{Header}}
{{navcss}}
</head>
<body>
{{nav}}
<div>
<div id="info_panel"></div>
<div id="control_panel">
<p>添加图书实体</p>
<p>图书标题:【<span id="book_name">正在获取图书信息...</span>】么?</p>
<p>存放位置:<input type="text" id="book_position" /></p>
<p>状态:
<select id="book_status">
<option value=2>在馆</option>
</select>
</p>
<button id="b_confirm">添加图书实体</button>
<button id="b_cancel">取消</button>
</div>
</div>
<script>
$("button").button();
$("#info_panel").hide(0).click(function(){
$("#info_panel").hide(100,function(){
$("#control_panel").show(100);
});
});
var id=GetRequest()["id"];
console.log("ClassID is ",id);
if(isNaN(parseInt(id))) {
console.log("Cannot Parse");
GoBack();
}
var lastLocation="viewbook.html?id="+id;
mustLogin();
checkPermission(2,function() { location.href=lastLocation; } );
/// Fetch Book name
$.post("/cgi-bin/booksys/doViewBook",{id:id},function(data){
console.log("Fetch Ajax Success");
if(data.success==1) {
console.log("Fetch Success");
$("#book_name").text(data.book_name);
} else {
console.log("Fetch Failed.");
}
},"json").fail(function(err){
console.log("Fetch Ajax Error: ",err);
});
$("#b_cancel").click(function(){
console.log("Operation Canceled.");
location.href=lastLocation;
});
$("#b_confirm").click(function(){
console.log("Operation Confirmed");
$.post("/cgi-bin/booksys/doAddBookObj",
{
id:id,
book_pos:$("#book_position").val(),
bookobj_status:$("#book_status").val()
},
function(data){
console.log("AddBook Ajax Success");
if(data.success==1) {
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作成功");
createHighlight($("#info_panel"));
$("#info_panel").show(100,function(){
location.href=lastLocation;
});
});
} else {
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作失败(服务错误)");
createError($("#info_panel"));
$("#info_panel").show(100);
});
}
},"json").fail(function(err){
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作失败(一般错误)");
createError($("#info_panel"));
$("#info_panel").show(100);
});
});
});
</script>
</body>
</html>