-
Notifications
You must be signed in to change notification settings - Fork 1
/
ViewData_Edit.php
108 lines (88 loc) · 2.64 KB
/
ViewData_Edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="zh-cn">
<?php require_once('Php/HTML_Head.php') ?>
<?php
if (!isset($LandUser)) {
header('Location: /Message.php?Msg=您没有登陆,无权访问测试点编辑页面');
die();
}
if (!can_edit_problem()) {
header('Location: /Message.php?Msg=您无权访问测试点编辑页面');
die();
}
$problemID = intval($_GET['Problem']);
$dataID = intval($_GET['Data']);
$inputData = '';
$outputData = '';
$sql = "SELECT `input`,`output` FROM `oj_problem_data` WHERE `problemID`=$problemID AND `testID`=$dataID LIMIT 1";
$have = oj_mysql_query($sql);
$row = oj_mysql_fetch_array($have);
if ($row) {
$testData = $row;
$inputData = $testData["input"];
$outputData = $testData["output"];
}
?>
<body>
<?php require_once('Php/Page_Header.php') ?>
<div class="container animated fadeInLeft">
<h3>测试点 # <?php echo intval($_GET['Data']) ?></h3>
<br>
<form id="dataform" onsubmit="return save()">
<div class="panel panel-default">
<div class="panel-heading">基础信息</div>
<div class="panel-body">
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon">题目ID</span>
<input name="problemID" type="text" class="form-control" value="<?php echo $problemID ?>">
</div>
<br>
</div>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon">测试点ID</span>
<input name="dataID" type="number" class="form-control" value="<?php echo $dataID ?>">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">输入数据</div>
<div class="panel-body">
<textarea style="height:200px" name="inputData" class="form-control"><?php echo $inputData ?></textarea>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">输出数据</div>
<div class="panel-body">
<textarea style="height:200px" name="outputData" class="form-control"><?php echo $outputData ?></textarea>
</div>
</div>
<center>
<a class="btn btn-default" href="javascript:history.go(-1);">返回</a>
<a class="btn btn-default" href="javascript:save();">保存</a>
</center>
</form>
</div>
<?php
$PageActive = '#problem';
require_once('Php/Page_Footer.php');
?>
<script>
function save() {
$.post("/Php/SubmitData.php", $('#dataform').serialize(), function(msg) {
var obj = eval('(' + msg + ')');
if (obj.status === 0) {
alert('测试点编辑成功!');
history.go(-1);
} else {
alert('测试点编辑失败!');
history.go(-1);
}
});
return false;
}
</script>
</body>
</html>