aboutsummaryrefslogtreecommitdiffstats
path: root/toj/smod
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-03-10 15:02:19 +0800
committerpzread <netfirewall@gmail.com>2013-03-10 15:02:19 +0800
commit0bcc905d92d2f69a0b961746be1f19ef096857a3 (patch)
tree514abd4fd4319cb6e05df7007580f8afc5896040 /toj/smod
parent898913018b1d3f289f10d4716e28489497c977cb (diff)
downloadtaiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar.gz
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar.bz2
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar.lz
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar.xz
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.tar.zst
taiwan-online-judge-0bcc905d92d2f69a0b961746be1f19ef096857a3.zip
Add Virtual URI System. New UI design. Improve sqmod_test
Diffstat (limited to 'toj/smod')
-rwxr-xr-xtoj/smod/smod_test/smod_test.css44
-rwxr-xr-xtoj/smod/smod_test/smod_test.html36
-rwxr-xr-xtoj/smod/smod_test/smod_test.js94
-rwxr-xr-xtoj/smod/smod_test/smod_test.php31
4 files changed, 159 insertions, 46 deletions
diff --git a/toj/smod/smod_test/smod_test.css b/toj/smod/smod_test/smod_test.css
index be7aac2..117c427 100755
--- a/toj/smod/smod_test/smod_test.css
+++ b/toj/smod/smod_test/smod_test.css
@@ -1,29 +1,55 @@
div.smod_test > h1.msg{
- padding:0px 0px 6px 0px;
+ margin:0px 0px 6px 82px;
}
+
+div.smod_test > table.subinfo{
+ width:322px;
+ margin:0px 0px 6px 82px;
+ border-collapse:collapse;
+ text-align:left;
+ float:left;
+}
+div.smod_test > table.subinfo tr.item{
+ height:32px;
+}
+div.smod_test > table.subinfo td.title{
+ width:76px;
+}
+div.smod_test > table.subinfo td.value{
+ width:240px;
+ padding:0px 0px 0px 6px;
+}
+
div.smod_test > table.subinfolist{
- padding:0px 0px 6px 0px;
+ width:486px;
+ padding:0px 0px 0px 6px;
text-align:left;
+ float:left;
}
div.smod_test > table.subinfolist tr.head{
height:32px;
- font-size:20px;
}
div.smod_test > table.subinfolist tr.item{
height:32px;
}
+div.smod_test > table.subinfolist th,div.smod_test > table.subinfolist td{
+ padding:0px 0px 0px 6px;
+}
div.smod_test > table.subinfolist th.runtime,div.smod_test > table.subinfolist td.runtime{
- width:96px;
+ width:76px;
+ padding:0px 0px 0px 0px;
}
div.smod_test > table.subinfolist th.memory,div.smod_test > table.subinfolist td.memory{
- width:96px;
+ width:76px;
}
div.smod_test > table.subinfolist th.status,div.smod_test > table.subinfolist td.status{
- width:96px;
+ width:76px;
}
div.smod_test > table.subinfolist th.score,div.smod_test > table.subinfolist td.score{
- width:96px;
+ width:76px;
}
-div.smod_test > table.subinfolist th.score,div.smod_test > table.subinfolist td.errmsg{
- width:auto;
+div.smod_test > table.subinfolist td.errmsg{
+ width:158px;
+ font-size:12px;
+ word-break:break-all;
}
diff --git a/toj/smod/smod_test/smod_test.html b/toj/smod/smod_test/smod_test.html
index 0e70522..5d1547d 100755
--- a/toj/smod/smod_test/smod_test.html
+++ b/toj/smod/smod_test/smod_test.html
@@ -1,4 +1,39 @@
<h1 class="msg" style="display:none;">Waiting</h1>
+
+<table class="subinfo" style="display:none;">
+ <tr class="item">
+ <td class="title">ProID</td>
+ <td class="value proid"><a></a></td>
+ </tr>
+ <tr class="item">
+ <td class="title">暱稱</td>
+ <td class="value nickname"><a></a></td>
+ </tr>
+ <tr class="item">
+ <td class="title">執行時間</td>
+ <td class="value runtime"></td>
+ </tr>
+ <tr class="item">
+ <td class="title">記憶體</td>
+ <td class="value memory"></td>
+ </tr>
+ <tr class="item">
+ <td class="title">結果</td>
+ <td class="value result"></td>
+ </tr>
+ <tr class="item">
+ <td class="title">分數</td>
+ <td class="value score"></td>
+ </tr>
+ <tr class="item">
+ <td class="title">時間</td>
+ <td class="value time"></td>
+ </tr>
+ <tr class="item">
+ <td class="title">語言</td>
+ <td class="value lang"></td>
+ </tr>
+</table>
<table class="subinfolist" style="display:none;">
<tr class="head">
<th class="runtime">執行時間</th>
@@ -8,3 +43,4 @@
<th class="errmsg"></th>
</tr>
</table>
+<div style="width:100%; height:32px; clear:both;"></div>
diff --git a/toj/smod/smod_test/smod_test.js b/toj/smod/smod_test/smod_test.js
index 0ef3674..90780d6 100755
--- a/toj/smod/smod_test/smod_test.js
+++ b/toj/smod/smod_test/smod_test.js
@@ -1,43 +1,65 @@
-var smod_test = {
- init:function(that,j_mbox){
- that.export_switchchange = function(direct){
- if(direct == 'in'){
- that.fadein(j_mbox);
- $.post('/toj/smod/smod_test/smod_test.php',{'subid':JSON.stringify(that.subid)},function(res){
- var i;
- var result;
- var reso;
- var j_table;
- var j_item;
+var smod_test = function(that,j_mbox){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ that.fadein(j_mbox);
+ $.post('/toj/smod/smod_test/smod_test.php',{'subid':JSON.stringify(that.subid)},function(res){
+ var i;
+ var reto;
+ var result;
+ var pro_set;
+ var reso;
+ var j_table;
+ var j_item;
+ var j_a;
+ if(res[0] == 'E'){
+ if(res == 'Enull'){
+ j_mbox.find('h1.msg').show();
+ }
+ }else{
+ reto = JSON.parse(res);
+ result = reto.result;
+ pro_set = reto.pro_setting;
- if(res[0] == 'E'){
- if(res == 'Enull'){
- j_mbox.find('h1.msg').show();
- }
- }else{
- result = JSON.parse(res).result;
+ j_table = j_mbox.find('table.subinfo');
+ j_a = j_table.find('td.proid > a');
+ j_a.attr('href','/toj/pro/' + that.subo.proid + '/');
+ j_a.text(that.subo.proid);
+
+ j_a = j_table.find('td.nickname > a');
+ j_a.attr('href','/toj/user/' + that.subo.uid+ '/');
+ j_a.text(that.subo.nickname);
+
+ j_table.find('td.runtime').text(that.subo.runtime);
+ j_table.find('td.memory').text(that.subo.memory);
+ j_table.find('td.result').text(RESULTMAP[that.subo.result]);
+ j_table.find('td.score').text(that.subo.score);
+ j_table.find('td.time').text(com.get_datestring(that.subo.submit_time,true));
+ j_table.find('td.lang').text(com.get_lang(that.subo.lang)[0]);
- j_table = j_mbox.find('table.subinfolist');
- for(i = 0;i < result.length;i++){
- reso = result[i];
- j_item = $('<tr class="item"><td class="runtime"></td><td class="memory"></td><td class="status"></td><td class="score"></td><td class="errmsg"></td></tr>')
- j_item.find('td.runtime').text(reso.runtime);
- j_item.find('td.memory').text(reso.memory);
- j_item.find('td.status').text(RESULTMAP[reso.status]);
- j_item.find('td.score').text(reso.score);
- if(reso.errmsg != undefined){
- j_item.find('td.errmsg').text(reso.errmsg);
- }
+ j_table.show();
- j_table.append(j_item);
+ j_table = j_mbox.find('table.subinfolist');
+ for(i = 0;i < result.length;i++){
+ reso = result[i];
+ j_item = $('<tr class="item"><td class="runtime"></td><td class="memory"></td><td class="status"></td><td class="score"></td><td class="errmsg"></td></tr>')
+ j_item.find('td.runtime').text(reso.runtime);
+ j_item.find('td.memory').text(reso.memory);
+ j_item.find('td.status').text(RESULTMAP[reso.status]);
+ j_item.find('td.score').text(reso.score + ' / ' + pro_set.score[i]);
+ if(reso.errmsg != undefined){
+ j_item.find('td.errmsg').text(reso.errmsg);
}
- j_table.show();
+
+ j_table.append(j_item);
}
- });
- }else if(direct == 'out'){
- that.fadeout(j_mbox);
- }
- };
- }
+ j_table.show();
+ }
+ });
+ }else if(direct == 'out'){
+ that.fadeout(j_mbox);
+ }
+
+ return 'cont';
+ };
};
diff --git a/toj/smod/smod_test/smod_test.php b/toj/smod/smod_test/smod_test.php
index 39d2cb3..b458ead 100755
--- a/toj/smod/smod_test/smod_test.php
+++ b/toj/smod/smod_test/smod_test.php
@@ -1,5 +1,6 @@
<?php
require_once('../../php/status.inc.php');
+require_once('../../php/problem.inc.php');
$subid = json_decode($_POST['subid']);
if(gettype($subid) != 'integer' || $subid < 1){
@@ -10,12 +11,40 @@ $sqlc = db_connect();
if(!status::subid_is_available($sqlc,$subid)){
exit('Epermission');
}
+
+$sub = status::get_by_subid($sqlc, $subid);
+$proid = $sub->proid;
+if(!$proid)
+ exit('Eno_such_subid');
+
+$prodir = '/srv/http/toj/center/pro/'.$proid.'/setting';
db_close($sqlc);
+$fd = fopen($prodir, 'r');
+while($line = fgets($fd)){
+ if($line[0] == '='){
+ break;
+ }
+}
+$set = '';
+while(($line = fgets($fd))){
+ $set = $set.$line;
+}
+fclose($fd);
+
+if(!$set)
+ exit('Eerr_pro_data');
+
+$proset = json_decode($set);
+
$subdir = '/srv/http/toj/center/submit/'.($subid - ($subid % 1000)).'/'.$subid.'/result/';
if(($result = file_get_contents($subdir.'result')) == ''){
exit('Enull');
}
-echo($result);
+$q = json_decode($result);
+$q->pro_setting = $proset;
+echo(json_encode($q));
+
+//echo('{"result":'.$result.', "pro_setting"='.$set.'}');
?>