aboutsummaryrefslogtreecommitdiffstats
path: root/toj
diff options
context:
space:
mode:
Diffstat (limited to 'toj')
-rw-r--r--toj/index.html135
-rw-r--r--toj/jcs/common.css19
-rw-r--r--toj/jcs/common.js439
-rw-r--r--toj/jcs/home.js132
-rw-r--r--toj/jcs/index.css89
-rw-r--r--toj/jcs/index.js96
-rw-r--r--toj/jcs/notice.css8
-rw-r--r--toj/jcs/notice.js142
-rw-r--r--toj/jcs/pro.js206
-rw-r--r--toj/jcs/sq.js158
-rw-r--r--toj/jcs/stat.css69
-rw-r--r--toj/jcs/stat.js443
-rw-r--r--toj/jcs/user.css141
-rw-r--r--toj/jcs/user.js603
-rw-r--r--toj/php/_json.php3
-rw-r--r--toj/php/_test.php20
-rw-r--r--toj/php/common.inc.php2
-rw-r--r--toj/php/event.inc.php2
-rw-r--r--toj/php/event_exec.cpp2
-rw-r--r--toj/php/problem.inc.php28
-rw-r--r--toj/php/problem.php2
-rw-r--r--toj/php/sqlib_scoreboard.inc.php10
-rw-r--r--toj/php/square.php2
-rw-r--r--toj/php/status.inc.php32
-rw-r--r--toj/php/status.php26
-rw-r--r--toj/php/step.inc.php17
-rw-r--r--toj/php/step.php64
-rw-r--r--toj/php/teamt.php28
-rw-r--r--toj/php/test.php32
-rw-r--r--toj/php/user.inc.php5
-rwxr-xr-xtoj/pmod/pmod_multisub/pmod_multisub.css21
-rwxr-xr-xtoj/pmod/pmod_multisub/pmod_multisub.js73
-rwxr-xr-xtoj/pmod/pmod_test/pmod_test.css33
-rwxr-xr-xtoj/pmod/pmod_test/pmod_test.html5
-rwxr-xr-xtoj/pmod/pmod_test/pmod_test.js121
-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
-rwxr-xr-xtoj/sqmod/sqmod_test/sqmod_test.css57
-rwxr-xr-xtoj/sqmod/sqmod_test/sqmod_test.html14
-rw-r--r--toj/sqmod/sqmod_test/sqmod_test.inc.php33
-rwxr-xr-xtoj/sqmod/sqmod_test/sqmod_test.js127
-rwxr-xr-xtoj/sqmod/sqmod_test/sqmod_test.php6
-rwxr-xr-xtoj/sqmod/sqmod_test/sqmod_test_man.php174
45 files changed, 2161 insertions, 1663 deletions
diff --git a/toj/index.html b/toj/index.html
index 5126216..615a7d7 100644
--- a/toj/index.html
+++ b/toj/index.html
@@ -22,6 +22,12 @@
<script src="/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="/codemirror.js"></script>
<script type="text/javascript" src="/clike.js"></script>
+<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+<script type="text/x-mathjax-config">
+ MathJax.Hub.Config({
+ tex2jax:{inlineMath:[['$','$'],['\\(','\\)']]}
+ });
+</script>
<script src="/toj/jcs/common.js"></script>
<script src="/toj/jcs/index.js"></script>
@@ -32,19 +38,39 @@
<script src="/toj/jcs/sq.js"></script>
<script src="/toj/jcs/pro.js"></script>
+<link href='http://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
+<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
<style type="text/css">
+/*@font-face{
+ font-family:Droid Sans Mono;
+ src:url('/DroidSansMono.ttf');
+}*/
+
+/*::-webkit-scrollbar{
+ width:12px;
+}
+::-webkit-scrollbar-track{
+ background-color:#E9E9E9;
+}
+::-webkit-scrollbar-thumb {
+ background-color:rgba(0,0,0,0.4);
+}
+::-webkit-scrollbar-thumb:window-inactive {
+ background-color:rgba(0,0,0,0.1);
+}*/
+
body{
color:#E9E9E9;
background-color:#373C38;
- font-family:\5FAE\8EDF\6B63\9ED1\9AD4,\65B0\7D30\660E\9AD4;
- overflow-y:hidden;
+ font-family:'Roboto','LiHei Pro','微軟正黑體';
+ overflow-y:scroll;
}
button{
height:32px;
margin:0px 0px;
padding:0px 16px 0px 16px;
font-size:16px;
- font-family:\5FAE\8EDF\6B63\9ED1\9AD4,\65B0\7D30\660E\9AD4;
+ font-family:'Roboto','LiHei Pro','微軟正黑體';
color:#E9E9E9;
background-color:#00896C;
border:none;
@@ -53,10 +79,23 @@ button{
button:hover{
background-color:#24936E;
}
+a{
+ color:#E9E9E9;
+ text-decoration:none;
+}
+a:hover{
+ color:#E9E9E9;
+ text-decoration:underline;
+}
+input,select{
+ font-size:16px;
+ font-family:'Roboto','LiHei Pro','微軟正黑體';
+}
+
</style>
<script type="text/javascript">
$(document).ready(function(){
- common.init();
+ com.init();
user.init();
index.init();
notice.init();
@@ -65,48 +104,50 @@ button:hover{
sq.init();
pro.init();
- common.exheight();
- $(window).resize(function(e){common.exheight();});
+ com.exheight();
+ $(window).resize(function(e){com.exheight();});
$(window).on('popstate',function(e){
- if(location.href != common.url_curr){
- common.url_prev = common.url_curr;
- common.url_curr = location.href;
- common.page_urlchange();
+ if(location.href != com.url_curr){
+ com.url_prev = com.url_curr;
+ com.url_curr = location.href;
+ com.url_chg();
}
});
- common.page_urlchange();
+ com.url_chg();
});
</script>
</head>
<body>
-<div id="index_head" class="index_head">
- <div class="title">Taiwan Online Judge</div>
- <div class="tab_box"></div>
- <div class="content_box"></div>
+<div class="index_head_box">
+ <div id="index_head" class="index_head">
+ <div class="title">Taiwan Online Judge</div>
+ <div class="tab_box"></div>
+ <div class="content_box"></div>
+ </div>
<div id="index_head_panel" class="panel">開始</div>
<div id="index_head_notice" class="notice" style="display:none">[0]</div>
<div id="index_head_nickname" class="nickname"><a class="nickname"></a></div>
</div>
<div id="index_panel_box" exheight=true class="index_panel_box"><ul id="index_panel" class="index_panel">
- <li page="home" class="button"><a href="/toj/home/" class="button">首頁</a></li>
- <li page="stat" class="button"><a href="/toj/stat/" class="button">狀態</a></li>
- <li page="user" class="button" style="display:none;"><a class="button">個人</a></li>
- <li page="square" class="button"><a class="button">方塊</a></li>
+ <li class="button home"><a href="/toj/home/" class="button">首頁</a></li>
+ <li class="button stat"><a href="/toj/stat/allsub/" class="button">狀態</a></li>
+ <li class="button user" style="display:none;"><a class="button">個人</a></li>
+ <li class="button square"><a class="button">方塊</a></li>
<ul class="square_box"></ul>
- <li page="login" class="button" style="margin:64px 0px 0px 0px; display:none;"><a href="/toj/login/" class="button">登入</a></li>
- <li page="register" class="button" style="display:none;"><a href="/toj/register/" class="button">註冊</a></li>
- <li page="logout" class="button" style="margin:64px 0px 0px 0px; display:none;"><a href="/toj/logout/" class="button">登出</a></li>
+ <li class="button login" style="margin:64px 0px 0px 0px; display:none;"><a href="/toj/login/" class="button">登入</a></li>
+ <li class="button register" style="display:none;"><a href="/toj/register/" class="button">註冊</a></li>
+ <li class="button logout" style="margin:64px 0px 0px 0px; display:none;"><a href="/toj/logout/" class="button">登出</a></li>
</ul></div>
<div id="notice_list_box" exheight=true class="notice_list_box"><ul id="notice_list" class="notice_list"></ul></div>
-<div id="index_page" exheight=true class="index_page">
+<div id="index_page" class="index_page">
- <div page="home" class="common_page home_page">
+ <div exheight=true extop=32 class="com_pbox home_pbox">
<audio id="tmpload_audio" src="/tmpload.ogg" preload></audio>
<audio id="tmp_audio" src="/tmp.ogg" preload></audio>
<div id="tmpani" style="width:100%; height:100%; background-color:#0C0C0C;">
@@ -114,15 +155,15 @@ button:hover{
</div>
</div>
- <div page="none" class="common_page none_page">
- <div style="margin:192px 0px 0px 256px;">
+ <div class="com_pbox none_pbox">
+ <div style="margin:192px 0px 0px 246px;">
<h1>Oops! 此頁不存在</h1>
<a href="/toj/home/" style="margin-left:6px; color:#E9E9E9;">回首頁</a>
</div>
</div>
- <div page="stat" class="common_page stat_page">
- <div tab="allsub" class="common_tab sub_tab">
+ <div class="stat_page">
+ <div class="com_pbox sub_pbox allsub_pbox">
<table class="sublist">
<tr class="head">
<th class="subid">SubID</th>
@@ -139,14 +180,14 @@ button:hover{
</div>
</div>
- <div page="user" class="common_page user_page">
- <div tab="main" class="common_tab main_tab">
+ <div class="user_page">
+ <div class="com_pbox main_pbox">
<div class="info_box">
<img class="avatar"></img>
<div class="aboutme"></div>
</div>
</div>
- <div tab="edit" class="common_tab edit_tab">
+ <div class="com_pbox edit_pbox">
<div class="edit_box">
<h1>個人資料</h1>
<label>暱稱</label>
@@ -172,7 +213,7 @@ button:hover{
<button class="cancel">取消</button>
</div>
</div>
- <div tab="mgsq" class="common_tab mgsq_tab">
+ <div class="com_pbox mgsq_pbox">
<div class="in_box">
<h1>已加入方塊</h1>
<h2>等待中</h2>
@@ -192,7 +233,7 @@ button:hover{
<div class="past"></div>
</div>
</div>
- <div tab="mg" class="common_tab mg_tab">
+ <div class="com_pbox mg_pbox">
<div class="left_box">
<h1>方塊</h1>
<button class="newsq">建立方塊</button>
@@ -200,10 +241,11 @@ button:hover{
</div>
</div>
- <div page="sq" class="common_page sq_page"></div>
- <div page="pro" class="common_page pro_page"></div>
+ <div class="sq_page"></div>
+
+ <div class="com_pbox pro_pbox"></div>
- <div page="login" class="common_page login_page">
+ <div class="com_pbox login_pbox">
<div class="info_box">
<h1>登入TOJ, 開始你的解題</h1>
<strong>沒有帳號?</strong><a href="/toj/register/" style="margin-left:6px; color:#E9E9E9;">註冊</a>
@@ -217,7 +259,7 @@ button:hover{
</div>
</div>
- <div page="register" class="common_page register_page">
+ <div class="com_pbox register_pbox">
<div class="info_box">
<h1>註冊TOJ, 開始你的解題</h1>
<strong>有帳號?</strong><a href="/toj/login/" style="margin-left:6px; color:#E9E9E9;">登入</a>
@@ -236,9 +278,11 @@ button:hover{
</div>
-<div id="index_mask" class="index_mask">
+<div id="index_mask" class="index_mask_nopbox">
+ <button class="close">關閉</button>
+
<div class="user_mask">
- <div class="common_mask_box editsq_mbox">
+ <div class="com_mbox editsq_mbox">
<div class="edit_box">
<h1>基本資料</h1>
<label>方塊名稱</label>
@@ -269,17 +313,17 @@ button:hover{
<input name="e_day" type="textbox" size="1" placeholder="1" style="display:inline-block">
<input name="e_hr" type="textbox" size="1" placeholder="18" style="margin:0px 0px 0px 6px; display:inline-block">
<input name="e_min" type="textbox" size="1" placeholder="30" style="display:inline-block">
- </div><br>
- <button class="delete" style="display:none;">刪除</button><br><br>
+ </div>
<div class="error"></div>
<button class="submit">確定</button>
<button class="cancel">取消</button>
+ <button class="delete" style="display:none;">刪除</button>
</div>
</div>
</div>
<div class="pro_mask">
- <div exheight=true extop=32 exbottom=32 class="common_mask_box sub_mbox">
+ <div exheight=true extop=32 exbottom=32 class="com_mbox sub_mbox">
<div class="head">
<div class="title"></div>
<div class="error"></div>
@@ -288,14 +332,17 @@ button:hover{
<option value="1">C++</option>
</select>
<button class="submit">確定</button>
- <button class="cancel">取消</button>
</div>
</div>
<div exheight=true extop=76 exbottom=38 class="codebox"></div>
</div>
</div>
<div class="stat_mask">
- <div class="common_mask_box subinfo_mbox"></div>
+ <div class="com_mbox subres_mbox"></div>
+ <div class="com_mbox subfile_mbox">
+ <button class="result" style="margin:6px 0px 0px 0px; float:right;">結果</button>
+ <h2 class="subid"></h2>
+ </div>
</div>
</div>
diff --git a/toj/jcs/common.css b/toj/jcs/common.css
index f693f3d..f05adea 100644
--- a/toj/jcs/common.css
+++ b/toj/jcs/common.css
@@ -1,18 +1,13 @@
-div.common_page{
- height:100%;
+div.com_pbox{
+ width:1224px;
+ margin:0px auto 0px auto;
position:relative;
- overflow:auto;
display:none;
}
-div.common_tab{
- height:100%;
- position:relative;
- overflow:auto;
- display:none;
-}
-div.common_mask_box{
- margin:32px auto;
- padding:0px 32px 0px 32px;
+div.com_mbox{
+ width:978px;
+ margin:32px auto 32px auto;
+ padding:0px 6px 0px 6px;
background-color:#373C38;
position:relative;
display:none;
diff --git a/toj/jcs/common.js b/toj/jcs/common.js
index 84468e3..976614c 100644
--- a/toj/jcs/common.js
+++ b/toj/jcs/common.js
@@ -14,18 +14,99 @@ var __extend = function(child,parent){
child.prototype.__super = parent;
};
-var common = {
- page_list:new Array(),
- url_prev:null,
- url_curr:null,
- mbox_curr:null,
- mbox_defer:null,
-
- init:function(){
+var vus = new function(){
+ var that = this;
+
+ that.node = function(name){
+ var that = this;
+ that.name = name;
+ that.parent = null;
+ that.child = new Object;
+ that.delay_child = new Object;
+
+ that.url_chg = function(direct,url_upart,url_dpart){
+ return 'cont';
+ };
+ that.child_set = function(node){
+ var delay_obj;
+
+ node.parent = that;
+ that.child[node.name] = node;
+
+ if(node.name in that.delay_child){
+ delay_obj = that.delay_child[node.name];
+ delete that.delay_child[node.name];
+ delay_obj.defer.resolve();
+ }
+ };
+ that.child_delayset = function(name){
+ that.delay_child[name] = {
+ 'defer':$.Deferred()
+ };
+ };
+ that.child_del = function(node){
+ node.parent = null;
+ delete that.child[node.name];
+ };
+ that.lookup = function(url,close_flag){
+ var i;
+ var url_part;
+ var node_curr;
+ var node_prev;
+
+ url_part = url.match(/\/toj\/(.*)/)[1].split('/');
+ url_part.pop();
+ node_prev = null;
+ node_curr = that;
+ for(i = 0;i < url_part.length;i++){
+ node_prev = node_curr;
+ if((node_curr = node_curr.child[url_part[i]]) == undefined){
+ if(close_flag == true){
+ return node_prev;
+ }else{
+ return null;
+ }
+ }
+ }
+ return node_curr;
+ }
+ };
+};
+var com = new function(){
+ var that = this;
+
+ var check_mbox_url = function(url){
+ if(url.search(/toj\/m\/.*/) != -1){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ that.url_curr = null;
+ that.url_prev = null;
+ that.url_back = null;
+ that.pbox_exist = false;
+
+ that.init = function(){
var i;
var url;
var urlpart;
+ that.vus_root = new vus.node(null);
+ that.vus_mbox = new vus.node('m');
+
+ that.vus_mbox.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ index.mask_show();
+ }else if(direct == 'out'){
+ index.mask_hide();
+ }
+
+ return 'cont';
+ };
+ that.vus_root.child_set(that.vus_mbox);
+
urlpart = location.href.split('?');
if(urlpart[0].search(/\/$/) == -1){
url = urlpart[0] + '/';
@@ -38,20 +119,155 @@ var common = {
window.history.replaceState(null,document.title,url);
}
- common.url_curr = location.href;
-
$(document).on('click','a',function(e){
- common.pushurl($(this).attr('href'));
+ that.url_push($(this).attr('href'));
return false;
});
- $(document).on('keyup',function(e){
- if(e.which == 27){
- common.hidembox(false);
+ };
+
+ that.url_push = function(url){
+ that.url_prev = location.href;
+ that.url_back = that.url_prev;
+ window.history.pushState(null,document.title,url);
+ com.url_chg();
+ };
+ that.url_push_back = function(block_regexp){
+ if(that.url_back == null || that.url_back.search(block_regexp) != -1){
+ that.url_push('/toj/home/');
+ }else{
+ that.url_push(that.url_back);
+ }
+ };
+ that.url_update = function(url){
+ that.url_prev = location.href;
+ window.history.replaceState(null,document.title,url);
+ com.url_chg();
+ };
+ that.url_pull = function(){
+ window.history.back();
+ };
+ that.url_chg = function(){
+ var i;
+ var j;
+ var ret;
+ var len;
+
+ var url_old;
+ var url_new;
+ var url_cpart;
+ var url_ppart;
+
+ var url_upart;
+ var url_dpart;
+ var node_curr;
+ var node_parent;
+
+ var _chg_in = function(url_cpart,idx,node_curr,url_upart,url_dpart){
+ var delay_obj;
+
+ for(;idx < url_cpart.length;idx++){
+ console.log(node_curr.child[url_cpart[idx]]);
+
+ node_parent = node_curr;
+ if((node_curr = node_parent.child[url_cpart[idx]]) == undefined){
+ if((delay_obj = node_parent.delay_child[url_cpart[idx]]) == undefined){
+ com.url_update('/toj/none/');
+ }else{
+ delay_obj.url_curr = that.url_curr;
+ delay_obj.defer.done(function(){
+ if(that.url_curr == delay_obj.url_curr){
+ _chg_in(url_cpart,idx,node_parent,url_upart,url_dpart);
+ }
+ });
+ }
+ break;
+ }
+ url_upart.push(url_dpart.shift());
+
+ ret = node_curr.url_chg('in',url_upart,url_dpart);
+ if(ret == 'stop'){
+ break;
+ }
}
- });
- },
+ };
- exheight:function(){
+ that.url_curr = location.href;
+ console.log(that.url_curr);
+
+ if(arguments.callee.reentrant == true){
+ arguments.callee.hasnext = true;
+ return;
+ }else{
+ arguments.callee.reentrant = true;
+ arguments.callee.hasnext = true;
+ }
+
+ while(arguments.callee.hasnext){
+ arguments.callee.hasnext = false;
+
+ url_old = that.url_prev;
+ url_new = that.url_new;
+
+ url_cpart = that.url_curr.match(/toj\/(.*)/)[1].split('/');
+ url_cpart.pop();
+
+ if(that.url_prev == null || (!check_mbox_url(that.url_prev) && check_mbox_url(that.url_curr))){
+ node_curr = that.vus_root;
+ url_upart = new Array;
+ url_dpart = url_cpart.slice(0);
+ j = 0;
+ }else{
+ url_ppart = that.url_prev.match(/toj\/(.*)/)[1].split('/');
+ url_ppart.pop();
+
+ len = Math.min(url_ppart.length,url_cpart.length);
+ for(i = 0;i < len;i++){
+ if(url_ppart[i] != url_cpart[i]){
+ break;
+ }
+ }
+
+ if((node_curr = that.vus_root.lookup(that.url_prev,true)) != undefined){
+ url_upart = url_ppart.slice(0);
+ url_dpart = new Array;
+ for(j = url_ppart.length - 1;j >=i;j--){
+ node_parent = node_curr.parent;
+ node_curr.url_chg('out',url_upart,url_dpart);
+ url_dpart = url_dpart.splice(0,0,url_upart.pop());
+ node_curr = node_parent;
+ }
+ }
+
+ node_curr = that.vus_root;
+ url_upart = new Array;
+ url_dpart = url_cpart.slice(0);
+ for(j = 0;j < i;j++){
+ if((node_curr = node_curr.child[url_cpart[j]]) == undefined){
+ break;
+ }
+ url_upart.push(url_dpart.shift());
+
+ ret = node_curr.url_chg('same',url_upart,url_dpart);
+ if(ret == 'stop'){
+ break;
+ }
+ }
+ }
+
+ if(that.url_prev == null || that.pbox_exist == false || !(check_mbox_url(that.url_prev) && !check_mbox_url(that.url_curr))){
+ _chg_in(url_cpart,j,node_curr,url_upart,url_dpart);
+ }
+
+ if(that.pbox_exist == false && !check_mbox_url(that.url_curr)){
+ that.pbox_exist = true;
+ $('#index_mask').removeClass('index_mask_nopbox');
+ $('#index_mask').addClass('index_mask');
+ }
+ }
+ arguments.callee.reentrant = false;
+ };
+
+ that.exheight = function(){
var i;
var es;
var extop;
@@ -73,8 +289,8 @@ var common = {
j_e.css('height',($(window).height() - (extop + exbottom) + 'px'));
}
- },
- getcookie:function(){
+ };
+ that.get_cookie = function(){
var ret;
var i;
var part;
@@ -89,13 +305,13 @@ var common = {
}
return ret;
- },
- getdate:function(str){
+ };
+ that.get_date = function(str){
var part;
part = str.match(/(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/);
return new Date(part[1],parseInt(part[2]) - 1,part[3],part[4],part[5],part[6],0);
- },
- getdatestring:function(date,secflag){
+ };
+ that.get_datestring = function(date,secflag){
var month;
var day;
var hr;
@@ -128,8 +344,8 @@ var common = {
}else{
return date.getFullYear() + '-' + month + '-' + day + ' ' + hr + ':' + min;
}
- },
- getlang:function(value){
+ };
+ that.get_lang = function(value){
var i;
var ret;
var langlist = ['C++','JAVA','Pascal'];
@@ -144,174 +360,12 @@ var common = {
}
return ret;
- },
-
- geturlpart:function(url){
- if(url == undefined){
- return location.href.match(/toj\/(.*)/)[1].split('/');
- }else{
- return url.match(/toj\/(.*)/)[1].split('/');
- }
- },
- pushurl:function(url){
- common.url_prev = location.href;
- window.history.pushState(null,document.title,url);
- common.url_curr = location.href;
- common.page_urlchange();
- },
- replaceurl:function(url){
- window.history.replaceState(null,document.title,url);
- common.url_curr = location.href;
- },
- prevurl:function(notpagename){
- if(common.url_prev == null || common.geturlpart(common.url_prev)[0] == notpagename){
- common.pushurl('/toj/home/');
- }else{
- common.pushurl(common.url_prev);
- }
- },
- page_urlchange:function(){
- var urlpart;
- var pagename;
- var pagename_prev;
-
- if(arguments.callee.reentrant == true){
- arguments.callee.hasnext = true;
- return;
- }else{
- arguments.callee.reentrant = true;
- arguments.callee.hasnext = true;
- }
-
- while(arguments.callee.hasnext){
- arguments.callee.hasnext = false;
-
- if(common.mbox_curr != null){
- common.hidembox(false);
- }
-
- urlpart = common.geturlpart();
- pagename = urlpart[0];
- if(pagename == ''){
- common.replaceurl('/toj/home/');
- common.page_urlchange();
- continue;
- }else if(!(pagename in common.page_list)){
- common.replaceurl('/toj/none/');
- common.page_urlchange();
- continue;
- }
-
- if(common.url_prev != null){
- pagename_prev = common.geturlpart(common.url_prev)[0];
- if(pagename == pagename_prev){
- common.page_list[pagename].urlchange('same');
- }else{
- if(pagename_prev in common.page_list){
- common.page_list[pagename_prev].urlchange('out');
- }
- common.page_list[pagename].urlchange('in');
- }
- }else{
- common.page_list[pagename].urlchange('in');
- }
- }
- arguments.callee.reentrant = false;
- },
- addpage:function(pagename,pageobj){
- common.page_list[pagename] = pageobj;
- },
- removepage:function(pagename){
- delete common.page_list[pagename];
- },
-
- showmbox:function(mboxobj){
- common.mbox_curr = mboxobj;
- mboxobj.switchchange('in');
- common.mbox_defer = $.Deferred();
- return common.mbox_defer.promise();
- },
- hidembox:function(done){
- if(common.mbox_curr != null){
- common.mbox_curr.switchchange('out');
- common.mbox_curr = null;
- if(done == true){
- common.mbox_defer.resolve();
- }else{
- common.mbox_defer.reject();
- }
- }
- }
-};
-
-var class_common_page = function(){
- var that = this;
- that.tab_list = Array();
- that.tabname_curr = null;
-
- that.urlchange = function(direct){};
- that.fadein = function(j_e){
- j_e.stop().fadeIn('fast');
- };
- that.fadeout = function(j_e){
- j_e.stop().hide();
- };
-
- that.tab_urlchange = function(tabname){
- if(arguments.callee.reentrant == true){
- arguments.callee.hasnext = true;
- return;
- }else{
- arguments.callee.reentrant = true;
- arguments.callee.hasnext = true;
- }
-
- while(arguments.callee.hasnext){
- arguments.callee.hasnext = false;
-
- if(tabname == null){
- if(that.tabname_curr in that.tab_list){
- index.lltab(that.tabname_curr);
- that.tab_list[that.tabname_curr].urlchange('out');
- }
- that.tab_list = new Array();
- that.tabname_curr = null;
- continue;
- }
-
- if(!(tabname in that.tab_list)){
- common.replaceurl('/toj/none/');
- common.page_urlchange();
- return;
- }
-
- if(tabname == that.tabname_curr){
- that.tab_list[tabname].urlchange('same');
- }else{
- if(that.tabname_curr in that.tab_list){
- index.lltab(that.tabname_curr);
- that.tab_list[that.tabname_curr].urlchange('out');
- }
- that.tabname_curr = tabname;
- index.hltab(tabname);
- that.tab_list[tabname].urlchange('in');
- }
- }
- arguments.callee.reentrant = false;
- };
- that.addtab = function(tabname,tabobj){
- that.tab_list[tabname] = tabobj;
- };
- that.removetab = function(tabname){
- delete that.tab_list[tabname];
};
};
-var class_common_tab = function(paobj){
+var class_com_pbox = function(){
var that = this;
- that.paobj = paobj;
- that.urlchange = function(direct){};
that.fadein = function(j_e){
j_e.stop().fadeIn('fast');
};
@@ -319,18 +373,13 @@ var class_common_tab = function(paobj){
j_e.stop().hide();
};
};
-
-var class_common_mbox = function(paobj){
+var class_com_mbox = function(){
var that = this;
- that.paobj = paobj;
- that.switchchange = function(direct){};
that.fadein = function(j_e){
j_e.stop().show();
- index.showmask();
};
that.fadeout = function(j_e){
- index.hidemask();
j_e.stop().hide();
};
-}
+};
diff --git a/toj/jcs/home.js b/toj/jcs/home.js
index bdc509d..98c9683 100644
--- a/toj/jcs/home.js
+++ b/toj/jcs/home.js
@@ -1,28 +1,33 @@
-var home = {
- init:function(){
- home.home_page = new class_home_page;
- home.none_page = new class_none_page;
+var home = new function(){
+ var that = this;
+
+ that.init = function(){
+ home.home_pbox = new class_home_pbox;
+ home.none_pbox = new class_none_pbox;
}
};
-var class_home_page = function(){
+var class_home_pbox = function(){
var that = this;
- var j_page = $($('#index_page > [page="home"]')[0]);
+ var j_pbox = $('#index_page > div.home_pbox');
+ that.node = new vus.node('home');
+
that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_page);
- index.settitle('Taiwan Online Judge');
+ that.fadein(j_pbox);
+ index.title_set('Taiwan Online Judge');
tmp();
}else if(direct == 'out'){
- that.fadeout(j_page);
+ that.fadeout(j_pbox);
tmp_stop = true;
}
- }
- common.addpage('home',that);
+ return 'cont';
+ }
+ com.vus_root.child_set(that.node);
var tmp_stop = true;
var tmp_first = true;
@@ -182,15 +187,17 @@ var class_home_page = function(){
ctx.lineWidth = 8;
drawCircle(ctx,700,500,330,bd * 60,bd * ((prog * 3) % 360 + 260));
- ctx.lineWidth = 4;
- drawCircle(ctx,700,500,300,bd * 360,0);
- ctx.lineWidth = 16;
- drawCircle(ctx,700,500,295,bd * 80,-bd * ((prog * 4) % 360 + 90));
-
+ if(prog % 6 < 4 || prog < 456 || prog > 912){
+ ctx.lineWidth = 4;
+ drawCircle(ctx,700,500,300,bd * 360,0);
+ ctx.lineWidth = 16;
+ drawCircle(ctx,700,500,295,bd * 80,-bd * ((prog * 4) % 360 + 90));
+ }
+
ctx.lineWidth = 8;
- drawCircle(ctx,700,500,260,bd * 90,bd * ((prog * 4) % 360));
- drawCircle(ctx,700,500,230,bd * 120,-bd * ((prog * 5) % 360 + 120));
+ drawCircle(ctx,700,500,260,bd * 90,bd * ((prog * 6) % 360 + 120));
drawCircle(ctx,700,500,210,bd * 160,bd * ((prog * 3) % 360 + 270));
+ drawCircle(ctx,700,500,230,bd * 120,-bd * ((prog * 5) % 360 + 120));
ctx.strokeStyle = 'rgba(128,128,128,' + (1 - (prog % 24)/24) + ')';
ctx.lineWidth = 8;
@@ -199,7 +206,7 @@ var class_home_page = function(){
drawCircle(ctx,700,500,70 + (prog % 24) * 4,bd * 360,0);
ctx.font = 'bold 16px tahoma';
- drawTextAlongArc(ctx,"Hello TOJ [FORCORO]",700,500,460,bd * 60,bd * (prog % 360 + 115) * 2);
+ drawTextAlongArc(ctx,"Hello TOJ",700,500,460,bd * 60,bd * (prog % 360 + 115) * 2);
drawTextAlongArc(ctx,"Are You Happy?",700,500,460,bd * 50,bd * (prog % 360 + 30) * 2);
if(prog < 456 || prog > 912){
@@ -227,13 +234,13 @@ var class_home_page = function(){
ctx.strokeStyle = 'rgba(255,255,255,1)';
ctx.lineWidth = 6;
- drawCircle(ctx,700,500,60,bd * 60,-bd * ((prog * 15) % 360));
- drawCircle(ctx,700,500,60,bd * 60,-bd * ((prog * 15) % 360 + 180));
+ drawCircle(ctx,700,500,40,bd * 60,-bd * ((prog * 15) % 360));
+ drawCircle(ctx,700,500,40,bd * 60,-bd * ((prog * 15) % 360 + 180));
}
v = prog % 96;
if((v >= 24 && v < 26)|| (v >= 28 && v < 30)){
- ctx.shadowBlur = 5;
+ ctx.shadowBlur = 8;
}else{
ctx.shadowBlur = 0;
}
@@ -250,7 +257,7 @@ var class_home_page = function(){
u += ctx.measureText('aiwan').width;
if((v >= 32 && v < 34)|| (v >= 36 && v < 38)){
- ctx.shadowBlur = 5;
+ ctx.shadowBlur = 8;
}else{
ctx.shadowBlur = 0;
}
@@ -265,7 +272,7 @@ var class_home_page = function(){
u += ctx.measureText('nline').width;
if((v >= 40 && v < 42)|| (v >= 44 && v < 46)){
- ctx.shadowBlur = 5;
+ ctx.shadowBlur = 8;
}else{
ctx.shadowBlur = 0;
}
@@ -285,8 +292,8 @@ var class_home_page = function(){
ctx.font = 'bold 50px 微軟正黑體';
ctx.fillStyle = 'rgba(255,255,255,1)';
- ctx.fillText('Taiwan Online Judge へようこそ システムテスト',1920 - (prog % 360) / 360 * 3000,980);
- ctx.fillText('Taiwan Online Judge へようこそ システムテスト',1920 - ((prog + 180) % 360) / 360 * 3000,980);
+ ctx.fillText('Taiwan Online Judge システムテスト',1920 - (prog % 720) / 720 * 3000,980);
+ ctx.fillText('Taiwan Online Judge システムテスト',1920 - ((prog + 360) % 720) / 720 * 3000,980);
ctx.font = 'bold 36px 微軟正黑體';
u = ctx.measureText('Parallel Judge 使用可能').width + 64;
@@ -355,20 +362,50 @@ var class_home_page = function(){
}
ctx.fillStyle = 'rgba(8,8,8,1)';
- drawRect(ctx,0,0,1920,1080);
+ drawRect(ctx,0,0,320,1080);
+
+ //v = ctx.measureText('TF ∪ CK').width;
+ //ctx.fillStyle = 'rgba(128,0,0,' + u + ')';
+ //ctx.fillRect(960 - v / 2 - 10,380,v + 20,200);
+
+ //var canvas = document.createElement('xxxxx');
+ //var context = canvas.getContext('2d');
+ //var img = document.getElementById('myimg');
+ //context.drawImage(img, 0, 0 );
+ //var myData = context.getImageData(0, 0, img.width, img.height);
+ //ctx.fillStyle = 'rgba(255,255,255,' + u + ')';
+ //ctx.font = 'bold 36px tahoma';//v
+ //ctx.fillText('TF ∪ CK',1560 - v / 2,850);
+
+
+ var imageObjSprout = new Image();
+ imageObjSprout.src = '/toj/jcs/xxxxx.png';
+ ctx.drawImage(imageObjSprout, 690,260,500,500);
+ //var imgdSprout = ctx.getImageData(0, 0, 300, 300);
+ //var Sproutpix_alpha = imgdSprout.data;
+ //for(var spj = 3, spn = Sproutpix_alpha.length; spj < spn; spj += 4) {
+ // Sproutpix_alpha[spj] = Sproutpix_alpha[spj] * 0.2;
+ //}
+ //ctx.drawImage(Sproutpix_alpha, 2, 2);
+ //ctx.putImageData(imgdSprout, 0, 0, 300, 300);
+ var spu = 1.0-u;
+ //alert(pu);
+ var spuint=parseInt(8);
+ //if(spuint<1)spuint=1;
+ ctx.fillStyle = 'rgba(' + spuint + ',' + spuint + ',' + spuint + ',' + spu + ')';
+
+ ctx.fillRect(690-1+23,260-1+23,500+2-46+2,500+2-46+3);
+
+ //ctx.fillStyle = 'rgba(255,255,255,' + u + ')';
+ //ctx.font = 'bold 32px tahoma';//v
+ //ctx.fillText('TF∪CK ',1560 - v / 2,850);
- v = ctx.measureText('TF∪CK ').width;
- ctx.fillStyle = 'rgba(128,0,0,' + u + ')';
- ctx.fillRect(960 - v / 2 - 10,380,v + 20,200);
-
- ctx.fillStyle = 'rgba(255,255,255,' + u + ')';
- ctx.font = 'bold 192px tahoma';
- ctx.fillText('TF∪CK ',960 - v / 2,550);
prog++;
if(prog == 400){
prog = 0;
st = 0;
+ document.getElementById('tmp_audio').volume = 0.5;
document.getElementById('tmp_audio').play();
ani();
}else{
@@ -392,6 +429,7 @@ var class_home_page = function(){
setTimeout(waitaudio,100);
}else{
e_audio = document.getElementById('tmpload_audio');
+ e_audio.volume = 0.5;
e_audio.play();
loadani();
}
@@ -411,23 +449,25 @@ var class_home_page = function(){
tmp_first = false;
}
-}; __extend(class_home_page,class_common_page);
+}; __extend(class_home_pbox,class_com_pbox);
-var class_none_page = function(){
+var class_none_pbox = function(){
var that = this;
- var j_page = $($('#index_page > [page="none"]')[0]);
+ var j_pbox = $('#index_page > div.none_pbox');
+
+ that.node = new vus.node('none');
that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_page);
- index.settitle('Taiwan Online Judge');
+ that.fadein(j_pbox);
+ index.title_set('Taiwan Online Judge');
}else if(direct == 'out'){
- that.fadeout(j_page);
+ that.fadeout(j_pbox);
}
- }
- common.addpage('none',that);
-}; __extend(class_none_page,class_common_page);
-
+ return 'cont';
+ }
+ com.vus_root.child_set(that.node);
+}; __extend(class_none_pbox,class_com_pbox);
diff --git a/toj/jcs/index.css b/toj/jcs/index.css
index d5d8dd2..e784785 100644
--- a/toj/jcs/index.css
+++ b/toj/jcs/index.css
@@ -1,28 +1,34 @@
-div.index_head{
+div.index_head_box{
width:100%;
height:32px;
- font-size:20px;
+ font-size:16px;
line-height:32px;
background-color:#1C1C1C;
- position:absolute;
- left:0px;
+ color:#E9E9E9;
+ position:fixed;
top:0px;
+ left:0px;
z-index:1;
}
+div.index_head{
+ width:1224px;
+ height:100%;
+ margin:0px auto 0px auto;
+}
div.index_head > div.title{
- width:250px;
+ width:240px;
height:100%;
- margin:0px 0px 0px 6px;
float:left;
}
div.index_head > div.tab_box{
- width:auto;
height:100%;
+ margin:0px 0px 0px 6px;
float:left;
}
div.index_head > div.tab_box > div.button{
height:100%;
- margin:0px 0px;
+ width:117px;
+ margin:0px 6px 0px 0px;
float:left;
}
div.index_head > div.tab_box > div.button_s{
@@ -43,52 +49,59 @@ div.index_head > div.content_box{
height:100%;
float:left;
}
-div.index_head > div.panel{
+div.index_head_box > div.panel{
width:96px;
height:100%;
text-align:center;
cursor:pointer;
- float:right;
+ position:absolute;
+ top:0px;
+ right:0px;
}
-div.index_head > div.panel_m{
+div.index_head_box > div.panel_m{
color:#FFFFFF;
}
-div.index_head > div.notice{
+div.index_head_box > div.notice{
width:96px;
height:100%;
text-align:center;
- font-family:monospace;
+ font-family:Droid Sans Mono;
+ font-weight:400;
cursor:pointer;
- float:right;
+ position:absolute;
+ top:0px;
+ right:96px;
}
-div.index_head > div:hover.notice{
+div.index_head_box > div:hover.notice{
color:#FFFFFF;
}
-div.index_head > div.notice_s{
+div.index_head_box > div.notice_s{
color:#FFFFFF;
}
-div.index_head > div.notice_h{
+div.index_head_box > div.notice_h{
background-color:#E83015;
color:#FFFFFF;
}
-div.index_head > div.nickname{
+div.index_head_box > div.nickname{
height:100%;
padding:0px 16px 0px 16px;
- float:right;
+ position:absolute;
+ top:0px;
+ right:192px;
}
-div.index_head > div.nickname > a.nickname{
+div.index_head_box > div.nickname > a.nickname{
height:100%;
color:#E9E9E9;
text-align:center;
text-decoration:none;
}
-div.index_head > div.nickname > a:hover.nickname{
+div.index_head_box > div.nickname > a:hover.nickname{
color:#FFFFFF;
}
div.index_panel_box{
width:0px;
- position:absolute;
+ position:fixed;
left:auto;
right:0px;
top:32px;
@@ -96,7 +109,7 @@ div.index_panel_box{
z-index:110;
}
ul.index_panel{
- width:256px;
+ width:240px;
height:100%;
margin:0px 0px;
padding:0px 0px;
@@ -104,7 +117,7 @@ ul.index_panel{
opacity:0;
position:absolute;
left:auto;
- right:-256px;
+ right:-240px;
top:0px;
z-index:2;
overflow-x:hidden;
@@ -114,7 +127,7 @@ ul.index_panel{
ul.index_panel > li.button{
width:auto;
height:64px;
- padding:0px 0px 0px 32px;
+ padding:0px 0px 0px 38px;
font-size:20px;
line-height:64px;
}
@@ -166,12 +179,34 @@ div.index_page{
div.index_mask{
width:100%;
- height:100%;
+ min-height:100%;
background-color:rgba(0,0,0,0.9);
position:absolute;
top:0px;
left:0px;
z-index:3;
display:none;
- overflow:auto;
+}
+div.index_mask_nopbox{
+ width:100%;
+ position:absolute;
+ top:32px;
+ left:0px;
+ z-index:0;
+ display:none;
+}
+div.index_mask > button.close{
+ height:32px;
+ line-height:32px;
+ position:absolute;
+ top:0px;
+ right:96px;
+}
+div.index_mask_nopbox > button.close{
+ height:32px;
+ line-height:32px;
+ position:absolute;
+ top:0px;
+ right:96px;
+ display:none;
}
diff --git a/toj/jcs/index.js b/toj/jcs/index.js
index e97242a..97c0c4b 100644
--- a/toj/jcs/index.js
+++ b/toj/jcs/index.js
@@ -1,6 +1,8 @@
-var index = {
- init:function(){
- $('body').on('mouseover',function(e){
+var index = new function(){
+ var that = this;
+
+ that.init = function(){
+ $(window).on('mouseover',function(e){
var j_panel;
if(e.target == null || e.target.id == 'index_panel' || $(e.target).parents('#index_panel').length > 0){
@@ -13,13 +15,13 @@ var index = {
$('#notice_list').stop().animate({opacity:0},'fast','easeOutQuad',
function(){
$('#notice_list_box').css('width','0px');
- $('#notice_list').css('right','-256px');
+ $('#notice_list').css('right','-240px');
$('#notice_list a.item').css('left','50%');
}
);
j_panel.addClass('panel_m');
- $('#index_panel_box').stop().animate({width:256},'slow','easeOutExpo');
+ $('#index_panel_box').stop().animate({width:240},'slow','easeOutExpo');
$('#index_panel').css('opacity','1').stop().animate({right:0},'slow','easeOutExpo');
$('#index_panel a.button').stop().animate({left:0},'slow','easeOutQuart');
}else{
@@ -27,7 +29,7 @@ var index = {
$('#index_panel').stop().animate({opacity:0},'fast','easeOutQuad',
function(){
$('#index_panel_box').css('width','0px');
- $('#index_panel').css('right','-256px');
+ $('#index_panel').css('right','-240px');
$('#index_panel a.button').css('left','50%');
}
);
@@ -41,7 +43,7 @@ var index = {
return false;
});
- $('#index_panel > [page="square"] > a.button').off('click').on('click',function(e){
+ $('#index_panel > li.square > a.button').off('click').on('click',function(e){
var j_ul;
j_ul = $('#index_panel > ul.square_box');
@@ -55,31 +57,34 @@ var index = {
});
$('#index_mask').on('click',function(e){
- if((e.target == this || $(e.target).parents('div.common_mask_box').length == 0) && !$(e.target).hasClass('common_mask_box') && common.mbox_curr != null){
- common.hidembox(false);
+ if((e.target == this || e.target.parentNode == this) && $(this).hasClass('index_mask')){
+ com.url_pull();
}
});
- },
-
- showpanel:function(pagename){
- $('#index_panel > [page="' + pagename + '"]').show();
- },
- hidepanel:function(pagename){
- $('#index_panel > [page="' + pagename + '"]').hide();
- },
- setpanel:function(pagename,panellink,paneltext){
+ $('#index_mask > button.close').on('click',function(e){
+ com.url_pull();
+ });
+ };
+
+ that.panel_show = function(name){
+ $('#index_panel > .' + name).show();
+ };
+ that.panel_hide = function(name){
+ $('#index_panel > .' + name).hide();
+ };
+ that.panel_set = function(name,panellink,paneltext){
var j_a;
- j_a = $('#index_panel > [page="' + pagename + '"] > a.button');
+ j_a = $('#index_panel > .' + name + ' > a.button');
j_a.attr('href',panellink);
j_a.text(paneltext);
- },
+ };
- settitle:function(titletext){
+ that.title_set = function(titletext){
$('#index_head > div.title').text(titletext);
- },
+ };
- addtab:function(tabname,tablink,tabtext){
+ that.tab_add = function(tabname,tablink,tabtext){
var j_div;
var j_a;
@@ -94,35 +99,44 @@ var index = {
$('#index_head > div.tab_box').append(j_div);
return j_div;
- },
- settab:function(tabname,tablink,tabtext){
+ };
+ that.tab_set = function(tabname,tablink,tabtext){
var j_a;
j_a = $('#index_head > div.tab_box [tab="' + tabname + '"] > a.button');
j_a.attr('href',tablink);
j_a.text(tabtext);
- },
- emptytab:function(){
+ };
+ that.tab_empty = function(){
$('#index_head > div.tab_box').empty();
- },
- hltab:function(tabname){
+ };
+ that.tab_hl = function(tabname){
$('#index_head > div.tab_box > [tab="' + tabname + '"]').addClass('button_s');
- },
- lltab:function(tabname){
+ };
+ that.tab_ll = function(tabname){
$('#index_head > div.tab_box > [tab="' + tabname + '"]').removeClass('button_s');
- },
+ };
- setcontent:function(j_content){
+ that.content_set = function(j_content){
$('#index_head > div.content_box').append(j_content);
- },
- emptycontent:function(){
+ };
+ that.content_empty = function(){
$('#index_head > div.content_box').empty();
- },
+ };
+
+ that.mask_show = function(){
+ var j_mask;
+
+ j_mask = $('#index_mask');
+ j_mask.stop().fadeIn('fast');
- showmask:function(){
- $('#index_mask').stop().fadeIn('fast');
- },
- hidemask:function(){
+ if(j_mask.hasClass('index_mask')){
+ $('#index_page').attr('exheight',true).css('overflow','hidden');
+ com.exheight();
+ }
+ };
+ that.mask_hide = function(){
+ $('#index_page').attr('exheight',false).css('height','auto').css('overflow','visible');
$('#index_mask').stop().hide();
- }
+ };
};
diff --git a/toj/jcs/notice.css b/toj/jcs/notice.css
index 44c790e..375bfef 100644
--- a/toj/jcs/notice.css
+++ b/toj/jcs/notice.css
@@ -1,6 +1,6 @@
div.notice_list_box{
width:0px;
- position:absolute;
+ position:fixed;
left:auto;
right:0px;
top:32px;
@@ -8,7 +8,7 @@ div.notice_list_box{
z-index:100;
}
ul.notice_list{
- width:256px;
+ width:322px;
height:100%;
margin:0px 0px;
padding:0px 0px;
@@ -16,7 +16,7 @@ ul.notice_list{
opacity:0;
position:absolute;
left:auto;
- right:-256px;
+ right:-322px;
top:0px;
z-index:2;
overflow-x:hidden;
@@ -26,7 +26,7 @@ ul.notice_list{
ul.notice_list > li.item{
width:auto;
height:96px;
- padding:0px 0px 0px 6px;
+ padding:0px 0px 0px 38px;
}
ul.notice_list > li:hover.item{
color:#FFFFFF;
diff --git a/toj/jcs/notice.js b/toj/jcs/notice.js
index 64e93ef..016b652 100644
--- a/toj/jcs/notice.js
+++ b/toj/jcs/notice.js
@@ -1,48 +1,9 @@
-var notice = {
- j_ajax:null,
- enid:null,
+var notice = new function(){
+ var that = this;
+ var j_ajax = null;
+ var enid = null;
- init:function(){
- $('body').on('click',function(e){
- var j_notice;
-
- if(e.target == null || ($(e.target).parents('a.item').length == 0 && $(e.target).parents('#notice_list').length > 0)){
- return;
- }
-
- j_notice = $('#index_head_notice');
- if(e.target.id == 'index_head_notice' && !j_notice.hasClass('notice_s')){
- j_notice.addClass('notice_s');
- $('#notice_list_box').stop().animate({width:256},'slow','easeOutExpo');
- $('#notice_list').css('opacity','1').stop().animate({right:0},'slow','easeOutExpo');
- $('#notice_list a.item').stop().animate({left:0},'slow','easeOutQuart');
- }else{
- j_notice.removeClass('notice_s');
- $('#notice_list').stop().animate({opacity:0},'fast','easeOutQuad',
- function(){
- $('#notice_list_box').css('width','0px');
- $('#notice_list').css('right','-256px');
- $('#notice_list a.item').css('left','50%');
- }
- );
- }
- });
- $('#index_head_notice').on('click',function(e){
- var j_list;
-
- j_list = $('#notice_list');
- if(j_list.css('opacity') == 0){
- j_list.empty();
- notice.enid = null;
- notice.updatenew();
- }
- }).on('mousedown',function(e){
- return false;
- });
-
- notice.refresh();
- },
- listnew:function(noticeo){
+ var listnew = function(noticeo){
j_item = $('<li class="item"><a class="item"><div class="head"></div><div class="content"></div></a></li>')
j_a = j_item.find('a.item');
j_head = j_item.find('div.head');
@@ -50,23 +11,28 @@ var notice = {
switch(noticeo.type){
case 'result':
- j_a.attr('href','/toj/stat/allsub/' + noticeo.subid + '/');
- j_head.text('Submit ' + noticeo.subid);
- j_content.html('ProID ' + noticeo.proid + ' 結果: ' + RESULTMAP[noticeo.result] + '<br>' + noticeo.runtime+ 'ms / ' + noticeo.memory + 'KB');
+ j_a.attr('href','/toj/m/sub/' + noticeo.subid + '/res/');
+ if(noticeo.rejudge_flag == false){
+ j_head.text('Submit ' + noticeo.subid);
+ }else{
+ j_head.text('Rejudge ' + noticeo.subid);
+ }
+ j_content.html('ProID ' + noticeo.proid + ' 結果: ' + RESULTMAP[noticeo.result] + ' 分數: ' + noticeo.score + '<br>' +
+ noticeo.runtime+ 'ms / ' + noticeo.memory + 'KB');
break;
}
return j_item;
- },
- updatenew:function(){
+ };
+ var updatenew = function(){
var j_list;
- if(notice.j_ajax != null){
- notice.j_ajax.abort();
+ if(j_ajax != null){
+ j_ajax.abort();
}
j_list = $('#notice_list');
- notice.j_ajax = $.post('/toj/php/notice.php',{'action':'get','data':JSON.stringify({'nid':0,'count':10})},
+ j_ajax = $.post('/toj/php/notice.php',{'action':'get','data':JSON.stringify({'nid':0,'count':10})},
function(res){
var i;
@@ -86,25 +52,25 @@ var notice = {
j_a.stop().animate({left:0},'slow','easeOutQuart');
}
- if(notice.enid == null){
+ if(enid == null){
if(reto.length == 0){
- notice.enid = 2147483647;
+ enid = 2147483647;
}else{
- notice.enid = reto[0].nid;
+ enid = reto[0].nid;
}
- notice.updateprev();
+ updateprev();
}
}
- notice.j_ajax = null;
+ j_ajax = null;
}
);
- },
- updateprev:function(){
+ };
+ var updateprev = function(){
var j_list;
j_list = $('#notice_list');
- $.post('/toj/php/notice.php',{'action':'get','data':JSON.stringify({'nid':notice.enid,'count':10})},
+ $.post('/toj/php/notice.php',{'action':'get','data':JSON.stringify({'nid':enid,'count':10})},
function(res){
var i;
@@ -116,17 +82,17 @@ var notice = {
reto = JSON.parse(res);
for(i = reto.length - 1;i >= 0;i--){
noticeo = JSON.parse(reto[i].txt);
- j_item = notice.listnew(noticeo);
+ j_item = listnew(noticeo);
j_list.append(j_item);
j_item.find('a.item').stop().animate({left:0},'slow','easeOutQuart');
}
- notice.enid = 0;
+ enid = 0;
}
}
);
- },
- refresh:function(){
+ };
+ var refresh = function(){
$.post('/toj/php/notice.php',{'action':'count','data':JSON.stringify({})},
function(res){
var count;
@@ -140,16 +106,58 @@ var notice = {
j_notice.text('[' + count + ']');
}else{
if($('#notice_list').css('opacity') == 1){
- notice.updatenew();
+ updatenew();
}else{
j_notice.addClass('notice_h');
j_notice.text('[' + count + ']');
}
}
- setTimeout(notice.refresh,1000);
+ setTimeout(refresh,2000);
}
}
);
- }
+ };
+
+ that.init = function(){
+ $(window).on('click',function(e){
+ var j_notice;
+
+ if(e.target == null || ($(e.target).parents('a.item').length == 0 && $(e.target).parents('#notice_list').length > 0)){
+ return;
+ }
+
+ j_notice = $('#index_head_notice');
+ if(e.target.id == 'index_head_notice' && !j_notice.hasClass('notice_s')){
+ j_notice.addClass('notice_s');
+ $('#notice_list_box').stop().animate({width:322},'slow','easeOutExpo');
+ $('#notice_list').css('opacity','1').stop().animate({right:0},'slow','easeOutExpo');
+ $('#notice_list a.item').stop().animate({left:0},'slow','easeOutQuart');
+ }else{
+ j_notice.removeClass('notice_s');
+ $('#notice_list').stop().animate({opacity:0},'fast','easeOutQuad',
+ function(){
+ $('#notice_list_box').css('width','0px');
+ $('#notice_list').css('right','-322px');
+ $('#notice_list a.item').css('left','50%');
+ }
+ );
+ }
+ });
+ $('#index_head_notice').on('click',function(e){
+ var j_list;
+
+ j_list = $('#notice_list');
+ if(j_list.css('opacity') == 0){
+ j_list.empty();
+ enid = null;
+ updatenew();
+ }
+ }).on('mousedown',function(e){
+ return false;
+ });
+
+ refresh();
+ };
+
};
diff --git a/toj/jcs/pro.js b/toj/jcs/pro.js
index 5e4db35..ee28217 100644
--- a/toj/jcs/pro.js
+++ b/toj/jcs/pro.js
@@ -1,113 +1,105 @@
-var pro = {
- init:function(){
- pro.pro_page = new class_pro_page;
- }
-};
+var pro = new function(){
+ var that = this;
+ var j_pbox = null;
+ var pro_pbox = null;
+ var pro_proid = null;
+ var pro_pmodname = null;
-var class_pro_page = function(){
- var that = this;
- var ori_prop = new Object;
- var j_page = $('#index_page > [page="pro"]');
- var sub_mbox = new class_pro_sub_mbox(that);
+ that.init = function(){
+ j_pbox = $('#index_page > div.pro_pbox');
- that.proid = null;
- that.proname = null;
- that.pmodname = null;
+ that.sub_mbox = new class_pro_sub_mbox();
- that.__super();
+ that.node = new vus.node('pro');
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ var proid;
- that.urlchange = function(direct){
- var proid;
+ var _clean = function(){
+ if(pro_pbox != null){
+ that.node.child_del(pro_pbox.node);
+ }
+ j_pbox.empty();
+ j_pbox.removeClass(pro_pmodname);
+ index.content_empty();
+
+ pro_pbox = null;
+ pro_proid = null;
+ pro_pmodname = null;
+ };
+
+ if(direct == 'in' || direct == 'same'){
+ index.title_set('TOJ-題目');
+
+ proid = url_dpart[0];
+ if(proid == ''){
+ com.url_update('/toj/none/');
+ return 'stop';
+ }
+ proid = parseInt(proid);
+ if(proid == pro_proid){
+ return 'cont';
+ }
- var _check = function(){
- proid = common.geturlpart()[1];
- if(proid == ''){
- return false;
- }
- proid = parseInt(proid);
- return true;
- };
- var _in = function(){
- index.settitle('TOJ-題目');
-
- $.post('/toj/php/problem.php',{'action':'get_pro','data':JSON.stringify({'proid':proid})},function(res){
- var css;
- var reto;
-
- if(res[0] != 'E'){
- that.proid = proid;
- reto = JSON.parse(res);
- that.proname = reto.proname;
- that.pmodname = reto.pmodname;
- j_page.addClass(that.pmodname);
-
- css = $('<link rel="stylesheet" type="text/css" href="/toj/pmod/' + that.pmodname + '/' + that.pmodname + '.css">');
- $('head').append(css);
- css.ready(function(){
- $.get('/toj/pmod/' + that.pmodname + '/' + that.pmodname + '.html',{},function(res){
- j_page.html(res);
- $.getScript('/toj/pmod/' + that.pmodname + '/' + that.pmodname + '.js',function(script,stat,res){
- eval(that.pmodname + '.init(that,j_page)');
- that.export_urlchange('in');
+ _clean();
+ that.node.child_delayset(proid.toString());
+
+ $.post('/toj/php/problem.php',{'action':'get_pro','data':JSON.stringify({'proid':proid})},function(res){
+ var css;
+ var reto;
+
+ if(res[0] != 'E'){
+ pro_proid = proid;
+ reto = JSON.parse(res);
+ pro_pmodname = reto.pmodname;
+
+ css = $('<link rel="stylesheet" type="text/css" href="/toj/pmod/' + pro_pmodname + '/' + pro_pmodname + '.css">');
+ $('head').append(css);
+ css.ready(function(){
+ j_pbox.addClass(pro_pmodname);
+
+ $.get('/toj/pmod/' + pro_pmodname + '/' + pro_pmodname + '.html',{},function(res){
+ j_pbox.html(res);
+ $.getScript('/toj/pmod/' + pro_pmodname + '/' + pro_pmodname + '.js',function(script,stat,res){
+ pro_pbox = new class_pro_pbox(pro_proid,reto.proname);
+ eval('new ' + pro_pmodname + '(pro_pbox,j_pbox)');
+ that.node.child_set(pro_pbox.node);
+ });
});
});
- });
- }
- });
- };
- var _out = function(){
- that.export_urlchange('out');
-
- for(key in that){
- if(!(key in ori_prop)){
- delete that[key];
- }else{
- that[key] = ori_prop[key];
- }
+ }else{
+ com.url_update('/toj/none/');
+ }
+ });
+ }else if(direct == 'out'){
+ _clean();
}
- j_page.empty();
- j_page.removeClass(that.pmodname);
- index.emptycontent();
- index.emptytab();
- that.proid = null;
- that.proname = null;
- that.pmodname = null;
+ return 'cont';
};
-
- if(direct == 'in'){
- if(_check()){
- _in();
- }
- }else if(direct == 'out'){
- _out();
- }else if(direct == 'same'){
- if(_check()){
- if(proid != that.proid){
- _out();
- _in();
- }else{
- that.export_urlchange('same');
- }
- }
- }
+ com.vus_root.child_set(that.node);
};
+};
+
+var class_pro_pbox = function(proid,proname){
+ var that = this;
+ var j_pbox = $('#index_page > div.pro_pbox');
+
+ that.proid = proid;
+ that.proname = proname;
+ that.node = new vus.node(proid.toString());
+
+ that.__super();
+
that.submit = function(proid){
if(proid == undefined){
proid = that.proid
}
- sub_mbox.init(proid);
- common.showmbox(sub_mbox);
+ pro.sub_mbox.init(proid);
+ com.url_push('/toj/m/pro_sub/');
};
+}; __extend(class_pro_pbox,class_com_pbox);
- for(key in that){
- ori_prop[key] = that[key];
- }
-
- common.addpage('pro',that);
-}; __extend(class_pro_page,class_common_page);
-
-var class_pro_sub_mbox = function(paobj){
+var class_pro_sub_mbox = function(){
var that = this;
var j_mbox = $('#index_mask > div.pro_mask > div.sub_mbox');
var j_error = j_mbox.find('div.head > div.error');
@@ -118,27 +110,36 @@ var class_pro_sub_mbox = function(paobj){
matchBrackets:true,
indentUnit:4
});
+ var proid = null;
- that.__super(paobj);
+ that.node = new vus.node('pro_sub');
- that.init = function(proid){
- that.proid = proid;
- j_mbox.find('div.head > div.title').text('上傳ProID:' + that.proid);
+ that.__super();
+
+ that.init = function(id){
+ proid = id;
+ j_mbox.find('div.head > div.title').text('上傳ProID:' + proid);
j_error.text('');
$(j_mbox.find('[name="lang"] > option')[0]).attr('selected',true);
codebox.setValue('');
+
+ com.vus_mbox.child_set(that.node);
};
- that.switchchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
that.fadein(j_mbox);
codebox.refresh();
}else if(direct == 'out'){
that.fadeout(j_mbox);
+ proid = null;
+ com.vus_mbox.child_del(that.node);
}
+
+ return 'cont';
};
j_mbox.find('div.head > div.oper > button.submit').on('click',function(e){
- $.post('/toj/php/problem.php',{'action':'submit_code','data':JSON.stringify({'proid':that.proid,'lang':1,'code':codebox.getValue()})},function(res){
+ $.post('/toj/php/problem.php',{'action':'submit_code','data':JSON.stringify({'proid':proid,'lang':1,'code':codebox.getValue()})},function(res){
if(res[0] == 'E'){
if(res == 'Enot_login'){
j_error.text('未登入');
@@ -150,16 +151,13 @@ var class_pro_sub_mbox = function(paobj){
j_error.text('其他錯誤');
}
}else{
- common.hidembox(j_mbox);
+ com.url_pull();
}
});
});
- j_mbox.find('div.head > div.oper > button.cancel').on('click',function(e){
- common.hidembox(j_mbox);
- });
codebox.getWrapperElement().style.width = '100%';
codebox.getWrapperElement().style.height = '100%';
codebox.getScrollerElement().style.width = '100%';
codebox.getScrollerElement().style.height = '100%';
-}; __extend(class_pro_sub_mbox,class_common_mbox);
+}; __extend(class_pro_sub_mbox,class_com_mbox);
diff --git a/toj/jcs/sq.js b/toj/jcs/sq.js
index e3026b2..17c07c0 100644
--- a/toj/jcs/sq.js
+++ b/toj/jcs/sq.js
@@ -1,100 +1,88 @@
-var sq = {
- init:function(){
- sq.sq_page = new class_sq_page;
- }
-};
-
-var class_sq_page = function(){
+var sq = new function(){
var that = this;
- var ori_prop = new Object;
- var j_page = $('#index_page > [page="sq"]');
+ var j_page = null;
+ var sq_page = null;
+ var sq_sqid = null;
+ var sq_sqmodname = null;
- that.sqid = null;
- that.sqname = null;
- that.sqmodname = null;
+ that.init = function(){
+ j_page = $('#index_page > div.sq_page');
+
+ that.node = new vus.node('sq');
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ var sqid;
- that.__super();
+ var _clean = function(){
+ if(sq_page != null){
+ that.node.child_del(sq_page.node);
+ }
- that.urlchange = function(direct){
- var sqid;
+ j_page.empty();
+ j_page.removeClass(sq_sqmodname);
+ index.content_empty();
+ index.tab_empty();
- var _check = function(){
- sqid = common.geturlpart()[1];
- if(sqid == ''){
- return false;
- }
- sqid = parseInt(sqid);
- return true;
- };
- var _in = function(){
- $.post('/toj/php/square.php',{'action':'get_sq','data':JSON.stringify({'sqid':sqid})},function(res){
- var css;
- var reto;
+ sq_page = null;
+ sq_sqid = null;
+ sq_sqmodname = null;
+ };
+
+ if(direct == 'in' || direct == 'same'){
+ sqid = url_dpart[0];
+ if(sqid == ''){
+ com.url_update('/toj/none/');
+ return 'stop';
+ }
+ sqid = parseInt(sqid);
+ if(sqid == sq_sqid){
+ return 'cont';
+ }
+
+ _clean();
+ that.node.child_delayset(sqid.toString());
+
+ $.post('/toj/php/square.php',{'action':'get_sq','data':JSON.stringify({'sqid':sqid})},function(res){
+ var css;
+ var reto;
- if(res[0] != 'E'){
- that.sqid = sqid;
- reto = JSON.parse(res);
- that.sqname = reto.sqname;
- that.sqmodname = reto.sqmodname;
- j_page.addClass(that.sqmodname);
- index.settitle('TOJ-' + that.sqname);
+ if(res[0] != 'E'){
+ sq_sqid = sqid;
+ reto = JSON.parse(res);
+ sq_sqmodname = reto.sqmodname;
- css = $('<link rel="stylesheet" type="text/css" href="/toj/sqmod/' + that.sqmodname + '/' + that.sqmodname + '.css">');
- $('head').append(css);
- css.ready(function(){
- $.get('/toj/sqmod/' + that.sqmodname + '/' + that.sqmodname + '.html',{},function(res){
- j_page.html(res);
- $.getScript('/toj/sqmod/' + that.sqmodname + '/' + that.sqmodname + '.js',function(script,stat,res){
- eval(that.sqmodname + '.init(that,j_page)');
- that.export_urlchange('in');
+ css = $('<link rel="stylesheet" type="text/css" href="/toj/sqmod/' + sq_sqmodname + '/' + sq_sqmodname + '.css">');
+ $('head').append(css);
+ css.ready(function(){
+ j_page.addClass(sq_sqmodname);
+
+ $.get('/toj/sqmod/' + sq_sqmodname + '/' + sq_sqmodname + '.html',{},function(res){
+ j_page.html(res);
+ $.getScript('/toj/sqmod/' + sq_sqmodname + '/' + sq_sqmodname + '.js',function(script,stat,res){
+ sq_page = new class_sq_page(sq_sqid,reto.sqname);
+ eval('new ' + sq_sqmodname + '(sq_page,j_page)');
+ that.node.child_set(sq_page.node);
+ });
});
});
- });
- }
- });
- };
- var _out = function(){
- that.export_urlchange('out');
+ }else{
+ com.url_update('/toj/none/');
+ }
+ });
- for(key in that){
- if(!(key in ori_prop)){
- delete that[key];
- }else{
- that[key] = ori_prop[key];
- }
+ }else if(direct == 'out'){
+ _clean();
}
- j_page.empty();
- j_page.removeClass(that.sqmodname);
- index.emptycontent();
- index.emptytab();
- that.sqid = null;
- that.sqname = null;
- that.sqmodname = null;
+ return 'cont';
};
+ com.vus_root.child_set(that.node);
+ };
+};
- if(direct == 'in'){
- if(_check()){
- _in();
- }
- }else if(direct == 'out'){
- _out();
- }else if(direct == 'same'){
- if(_check()){
- if(sqid != that.sqid){
- _out();
- _in();
- }else{
- that.export_urlchange('same');
- }
- }
- }
- }
-
- for(key in that){
- ori_prop[key] = that[key];
- }
-
- common.addpage('sq',that);
-}; __extend(class_sq_page,class_common_page);
+var class_sq_page = function(sqid,sqname){
+ var that = this;
+ that.sqid = sqid;
+ that.sqname = sqname;
+ that.node = new vus.node(sqid.toString());
+};
diff --git a/toj/jcs/stat.css b/toj/jcs/stat.css
index e0885e2..607b922 100644
--- a/toj/jcs/stat.css
+++ b/toj/jcs/stat.css
@@ -1,56 +1,59 @@
-div.stat_page > div.sub_tab > table.sublist{
- width:85%;
- margin:0px auto 6px auto;
+div.stat_page > div.sub_pbox > table.sublist{
+ width:978px;
+ margin:0px 0px 6px 164px;
border-collapse:collapse;
text-align:left;
}
-div.stat_page > div.sub_tab > table.sublist tr.head{
+div.stat_page > div.sub_pbox > table.sublist tr.head{
height:64px;
- font-size:20px;
}
-div.stat_page > div.sub_tab > table.sublist tr.item{
+div.stat_page > div.sub_pbox > table.sublist tr.item{
height:32px;
display:none;
}
-div.stat_page > div.sub_tab > table.sublist tr:hover.item{
+div.stat_page > div.sub_pbox > table.sublist tr:hover.item{
background-color:rgba(255,255,255,0.2);
}
-div.stat_page > div.sub_tab > table.sublist th.subid,div.stat_page > div.sub_tab > table.sublist td.subid{
- width:96px;
+div.stat_page > div.sub_pbox > table.sublist th,div.stat_page > div.sub_pbox > table.sublist td{
+ padding:0px 0px 0px 6px;
}
-div.stat_page > div.sub_tab > table.sublist th.proid,div.stat_page > div.sub_tab > table.sublist td.proid{
- width:96px;
+div.stat_page > div.sub_pbox > table.sublist th.subid,div.stat_page > div.sub_pbox > table.sublist td.subid{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist th.nickname,div.stat_page > div.sub_tab > table.sublist td.nickname{
+div.stat_page > div.sub_pbox > table.sublist th.proid,div.stat_page > div.sub_pbox > table.sublist td.proid{
+ width:76px;
+}
+div.stat_page > div.sub_pbox > table.sublist th.nickname,div.stat_page > div.sub_pbox > table.sublist td.nickname{
width:auto;
}
-div.stat_page > div.sub_tab > table.sublist th.runtime,div.stat_page > div.sub_tab > table.sublist td.runtime{
- width:96px;
+div.stat_page > div.sub_pbox > table.sublist th.runtime,div.stat_page > div.sub_pbox > table.sublist td.runtime{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist th.memory,div.stat_page > div.sub_tab > table.sublist td.memory{
- width:96px;
+div.stat_page > div.sub_pbox > table.sublist th.memory,div.stat_page > div.sub_pbox > table.sublist td.memory{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist th.result,div.stat_page > div.sub_tab > table.sublist td.result{
- width:64px;
+div.stat_page > div.sub_pbox > table.sublist th.result,div.stat_page > div.sub_pbox > table.sublist td.result{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist th.score,div.stat_page > div.sub_tab > table.sublist td.score{
- width:96px;
+div.stat_page > div.sub_pbox > table.sublist th.score,div.stat_page > div.sub_pbox > table.sublist td.score{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist th.time,div.stat_page > div.sub_tab > table.sublist td.time{
- width:256px;
+div.stat_page > div.sub_pbox > table.sublist th.time,div.stat_page > div.sub_pbox > table.sublist td.time{
+ width:237px;
}
-div.stat_page > div.sub_tab > table.sublist th.lang,div.stat_page > div.sub_tab > table.sublist td.lang{
- width:64px;
+div.stat_page > div.sub_pbox > table.sublist th.lang,div.stat_page > div.sub_pbox > table.sublist td.lang{
+ width:76px;
}
-div.stat_page > div.sub_tab > table.sublist a.link{
- color:#E9E9E9;
- text-decoration:none;
+
+div.stat_mask > div.subfile_mbox > h2.subid{
+ width:50%;
+ padding:6px 0px 0px 82px;
}
-div.stat_page > div.sub_tab > table.sublist a:hover.link{
- color:#E9E9E9;
- text-decoration:underline;
+div.stat_mask > div.subfile_mbox > label{
+ padding:6px 0px 32px 82px;
}
-
-div.stat_mask > div.subinfo_mbox{
- width:85%;
+div.stat_mask > div.subfile_mbox > div.filebox{
+ width:814px;
+ height:384px;
+ padding:6px 0px 32px 82px;
}
diff --git a/toj/jcs/stat.js b/toj/jcs/stat.js
index e0c7d55..41a2796 100644
--- a/toj/jcs/stat.js
+++ b/toj/jcs/stat.js
@@ -1,87 +1,182 @@
-var stat = {
- init:function(){
- stat.stat_page = new class_stat_page;
- }
-};
-
-class_stat_page = function(){
+var stat = new function(){
var that = this;
- var j_page = $('#index_page > [page="stat"]');
- var j_blank = $('#index_page > [page="stat"] > div.blank');
- var allsub_tab = new class_stat_allsub_tab(that);
+ var stat_allsub_pbox = null;
- that.subinfo_mbox = new class_stat_subinfo_mbox(that);
- that.__super();
+ var sub_node = null;
+ var subid_node = null;
+
+
+ var j_subres_mbox = null;
+ var subres_mbox = null;
+ var subfile_mbox = null;
- that.urlchange = function(direct){
- var _in = function(){
- that.fadein(j_page);
- index.settitle('TOJ-狀態');
+ that.sub_subid = null;
- that.addtab('allsub',allsub_tab);
- index.addtab('allsub','/toj/stat/allsub/','全部動態');
+ that.init = function(){
+ stat_allsub_pbox = new class_stat_sub_pbox('allsub');
+ subfile_mbox = new class_stat_subfile_mbox;
+ j_subres_mbox = $('#index_mask > div.stat_mask > div.subres_mbox');
- _change();
+ that.stat_node = new vus.node('stat');
+ that.stat_node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ index.title_set('TOJ-狀態');
+
+ index.tab_add('allsub','/toj/stat/allsub/','全部動態');
+ if(url_dpart[0] != 'allsub'){
+ com.url_update('/toj/stat/allsub/');
+ return 'stop';
+ }
+ }else if(direct == 'out'){
+ index.tab_empty();
+ }
+
+ return 'cont';
};
- var _out = function(){
- that.fadeout(j_page);
- index.emptytab();
- that.tab_urlchange(null);
+ that.stat_node.child_set(stat_allsub_pbox.node);
+ com.vus_root.child_set(that.stat_node);
+
+
+
+
+ sub_node = new vus.node('sub');
+ subid_node = new vus.node('');
+
+ sub_node.url_chg = function(direct,url_upart,url_dpart){
+ var subid;
+
+ if(direct == 'in' || direct == 'same'){
+ if((subid = url_dpart[0]) == ''){
+ com.url_update('/toj/none/');
+ return 'stop';
+ }
+ subid = parseInt(url_dpart[0]);
+ if(subid == that.sub_subid){
+ return 'cont';
+ }
+
+ if(that.sub_subid != null){
+ sub_node.child_del(subid_node);
+ }
+ that.sub_subid = subid;
+
+ subid_node.name = that.sub_subid.toString();
+ sub_node.child_set(subid_node);
+ }else if(direct == 'out'){
+ if(that.sub_subid != null){
+ sub_node.child_del(subid_node);
+ }
+ that.sub_subid = null;
+ }
+
+ return 'cont';
};
- var _change = function(){
- var tabname;
+ com.vus_mbox.child_set(sub_node);
+
+
+
+
+ subid_node.mbox_name = null;
+ subid_node.smodname = null;
+ subid_node.url_chg = function(direct,url_upart,url_dpart){
+ var mbox_name;
+
+ var _clean = function(){
+ if(subres_mbox != null){
+ subid_node.child_del(subres_mbox.node);
+
+ j_subres_mbox.empty();
+ j_subres_mbox.removeClass(subid_node.smodname);
+
+ subres_mbox = null;
+ subid_node.smodname = null;
+ }
+ };
+
+ if(direct == 'in' || direct == 'same'){
+ mbox_name = url_dpart[0];
+ if(mbox_name == subid_node.mbox_name){
+ return 'cont';
+ }
+
+ _clean();
+
+ subid_node.mbox_name = mbox_name;
+ if(mbox_name == 'res'){
+ subid_node.child_delayset('res');
+
+ $.post('/toj/php/status.php',{'action':'get_by_subid','data':JSON.stringify({'subid':that.sub_subid})},function(res){
+ var reto;
+
+ if(res[0] != 'E'){
+ reto = JSON.parse(res);
+ subid_node.smodname = reto.smodname;
+ reto.submit_time = com.get_date(reto.submit_time);
+ delete reto.smodname;
+
+
+ css = $('<link rel="stylesheet" type="text/css" href="/toj/smod/' + subid_node.smodname + '/' + subid_node.smodname + '.css">');
+ $('head').append(css);
+ css.ready(function(){
+ j_subres_mbox.addClass(subid_node.smodname);
- tabname = common.geturlpart()[1];
- if(!(tabname in that.tab_list)){
- tabname = 'allsub';
- common.replaceurl('/toj/stat/allsub/');
+ $.get('/toj/smod/' + subid_node.smodname + '/' + subid_node.smodname + '.html',{},function(res){
+ var j_h;
+ var j_button;
+
+ j_subres_mbox.html(res);
+
+ j_h = $('<h2 style="padding:6px 0px 0px 82px;"></h2>');
+ j_h.text('SubID: ' + that.sub_subid);
+ j_subres_mbox.prepend(j_h);
+
+ if(reto.uid == user.uid || user.level == -1){
+ j_button = $('<button style="margin:6px 0px 0px 0px; float:right;">檔案</button>');
+ j_button.on('click',function(e){
+ com.url_update('/toj/m/sub/' + that.sub_subid + '/file/');
+ });
+ j_subres_mbox.prepend(j_button);
+ }
+
+ $.getScript('/toj/smod/' + subid_node.smodname + '/' + subid_node.smodname + '.js',function(script,stat,res){
+ subres_mbox = new class_stat_subres_mbox(that.sub_subid,reto);
+ eval('new ' + subid_node.smodname + '(subres_mbox,j_subres_mbox)');
+ subid_node.child_set(subres_mbox.node);
+ });
+ });
+ });
+ }else{
+ com.url_update('/toj/node/');
+ }
+ });
+ }
+ }else if(direct == 'out'){
+ _clean();
+ subid_node.mbox_name = null;
}
- that.tab_urlchange(tabname);
- }
-
- if(direct == 'in'){
- _in();
- }else if(direct == 'out'){
- _out();
- }else if(direct == 'same'){
- _change();
- }
- };
- common.addpage('stat',that);
-}; __extend(class_stat_page,class_common_page);
+ return 'cont';
+ };
+ subid_node.child_set(subfile_mbox.node);
+ };
+};
-var class_stat_allsub_tab = function(paobj){
+var class_stat_sub_pbox = function(pbox_name){
var that = this;
- var j_tab = $('#index_page > [page="stat"] > [tab="allsub"]');
- var j_table = j_tab.find('table.sublist');
+ var j_pbox = $('#index_page > div.stat_page > div.' + pbox_name + '_pbox');
+ var j_table = j_pbox.find('table.sublist');
var refresh_flag = false;
var j_ajax = null;
var ssubid = 0;
var esubid = 2147483647;
- var lastupdate = null;
- var topflag = true;
- var topqueue = new Array;
- var downblock = false;
- var subid_curr = null;
-
- var subinfo_switch = function(subid){
- if(subid == undefined){
- subid = common.geturlpart()[2];
- }
- if(subid != '' && subid != subid_curr){
- subid_curr = parseInt(subid);
- common.replaceurl('/toj/stat/allsub/' + subid_curr + '/');
- that.paobj.subinfo_mbox.init(subid_curr);
- common.showmbox(that.paobj.subinfo_mbox).always(function(){
- subid_curr = null;
- //common.prevurl();
- });
- }
- };
+ var last_update = null;
+ var top_flag = true;
+ var top_queue = new Array;
+ var down_block = false;
+
var sub_listset = function(j_item,subo){
var j_a;
@@ -89,11 +184,11 @@ var class_stat_allsub_tab = function(paobj){
j_item.find('td.subid').text(subo.subid);
- j_a = j_item.find('td.proid > a.link');
+ j_a = j_item.find('td.proid > a');
j_a.attr('href','/toj/pro/' + subo.proid+ '/');
j_a.text(subo.proid);
- j_a = j_item.find('td.nickname > a.link');
+ j_a = j_item.find('td.nickname > a');
j_a.attr('href','/toj/user/' + subo.uid+ '/');
j_a.text(subo.nickname);
@@ -101,19 +196,19 @@ var class_stat_allsub_tab = function(paobj){
j_item.find('td.memory').text(subo.memory);
j_item.find('td.result').text(RESULTMAP[subo.result]);
j_item.find('td.score').text(subo.score);
- j_item.find('td.time').text(common.getdatestring(subo.submit_time,true));
- j_item.find('td.lang').text(common.getlang(subo.lang)[0]);
+ j_item.find('td.time').text(com.get_datestring(subo.submit_time,true));
+ j_item.find('td.lang').text(com.get_lang(subo.lang)[0]);
j_item.off('click').on('click',function(e){
if(e.target.tagName != 'A'){
- subinfo_switch(subo.subid);
+ com.url_push('/toj/m/sub/' + subo.subid + '/res/');
}
});
};
var sub_listnew = function(subo){
var j_item;
- j_item = $('<tr class="item"><td class="subid"></td><td class="proid"><a class="link"></a></td><td class="nickname"><a class="link"></a></td><td class="runtime"></td><td class="memory"></td><td class="result"></td><td class="score"></td><td class="time"></td><td class="lang"></td></tr>');
+ j_item = $('<tr class="item"><td class="subid"></td><td class="proid"><a></a></td><td class="nickname"><a></a></td><td class="runtime"></td><td class="memory"></td><td class="result"></td><td class="score"></td><td class="time"></td><td class="lang"></td></tr>');
sub_listset(j_item,subo);
return j_item;
@@ -131,26 +226,27 @@ var class_stat_allsub_tab = function(paobj){
'sort':{'score':null,'runtime':null,'memory':null,'subid':[1,0]},
'wait':10,
'count':100,
- 'last_update':lastupdate
+ 'last_update':last_update
})}
,function(res){
var i;
+
var reto;
var j_item;
- var maxsubid;
+ var masubid;
if(res[0] != 'E'){
reto = JSON.parse(res);
- maxsubid = ssubid;
+ masubid = ssubid;
for(i = 0;i < reto.length;i++){
- reto[i].submit_time = common.getdate(reto[i].submit_time);
+ reto[i].submit_time = com.get_date(reto[i].submit_time);
j_item = j_table.find('[subid="' + reto[i].subid + '"]')
if(j_item.length > 0){
sub_listset(j_item,reto[i]);
}else if(reto[i].subid > ssubid){
- if(topflag == true){
+ if(top_flag == true){
j_item = sub_listnew(reto[i]);
j_item.insertAfter(j_table.find('tr.head'));
j_item.css('opacity',0).slideDown('fast').fadeTo(100,1);
@@ -161,14 +257,14 @@ var class_stat_allsub_tab = function(paobj){
}
}
- if(reto[i].subid > maxsubid){
- maxsubid = reto[i].subid;
+ if(reto[i].subid > masubid){
+ masubid = reto[i].subid;
}
- if(reto[i].last_update > lastupdate){
- lastupdate = reto[i].last_update;
+ if(reto[i].last_update > last_update){
+ last_update = reto[i].last_update;
}
}
- ssubid = maxsubid;
+ ssubid = masubid;
}
j_ajax = null;
@@ -178,11 +274,11 @@ var class_stat_allsub_tab = function(paobj){
};
var sub_update = function(type){
if(type == 0){
- while(topqueue.length > 0){
- j_table.find('[subid="' + topqueue.pop() + '"]').css('opacity',0).slideDown('fast').fadeTo(100,1);
+ while(top_queue.length > 0){
+ j_table.find('[subid="' + top_queue.pop() + '"]').css('opacity',0).slideDown('fast').fadeTo(100,1);
}
- }else if(type == 1 && downblock == false){
- downblock = true;
+ }else if(type == 1 && down_block == false){
+ down_block = true;
$.post('/toj/php/status.php',{'action':'get_submit',
'data':JSON.stringify({
'filter':{'uid':null,'result':null,'proid':null,'lang':null},
@@ -197,70 +293,76 @@ var class_stat_allsub_tab = function(paobj){
if(res[0] == 'E'){
if(res != 'Eno_result'){
- downblock = false;
+ down_block = false;
}
}else{
reto = JSON.parse(res);
for(i = 0;i < reto.length;i++){
- reto[i].submit_time = common.getdate(reto[i].submit_time);
+ reto[i].submit_time = com.get_date(reto[i].submit_time);
j_item = sub_listnew(reto[i]);
j_table.append(j_item);
j_item.css('opacity',0).slideDown('fast').fadeTo(100,1);
}
- if(lastupdate == null){
+ if(last_update == null){
for(i = 0;i < reto.length;i++){
if(ssubid < reto[i].subid){
ssubid = reto[i].subid;
}
}
- lastupdate = reto[0].last_update;
+ last_update = reto[0].last_update;
for(i = 1;i < reto.length;i++){
- if(lastupdate < reto[i].last_update){
- lastupdate = reto[i].last_update;
+ if(last_update < reto[i].last_update){
+ last_update = reto[i].last_update;
}
}
sub_refresh();
- j_tab.on('scroll',function(e){
- if(Math.floor(j_tab.scrollTop() / 32) < 10){
- if(topflag == false){
- topflag = true;
+ $(window).off('scroll').on('scroll',function(e){
+ var j_window;
+
+ j_window = $(window);
+ if(Math.floor(j_window.scrollTop() / 32) < 10){
+ if(top_flag == false){
+ top_flag = true;
sub_update(0);
}
}else{
- topflag = false;
+ top_flag = false;
}
- if(Math.floor((j_table.height() - j_tab.scrollTop()) / 32) < 50){
+ if(Math.floor((j_table.height() - j_window.scrollTop()) / 32) < 50){
sub_update(1);
}
});
}
esubid = reto[reto.length - 1].subid;
- downblock = false;
+ down_block = false;
}
}
);
}
};
- that.__super(paobj);
+ that.node = new vus.node(pbox_name);
+
+ that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct){
if(direct == 'in'){
- that.fadein(j_tab);
+ index.tab_hl(pbox_name);
+ that.fadein(j_pbox);
refresh_flag = true;
sub_update(1);
- subinfo_switch();
}else if(direct == 'out'){
- that.fadeout(j_tab);
- j_tab.off('scorll');
+ index.tab_ll(pbox_name);
+ that.fadeout(j_pbox);
+ $(window).off('scorll');
j_table.find('tr.item').remove();
if(j_ajax != null){
@@ -271,94 +373,91 @@ var class_stat_allsub_tab = function(paobj){
refresh_flag = false;
j_ajax = null;
esubid = 2147483647;
- lastupdate = null;
- topflag = true;
- topqueue = new Array;
- downblock = false;
+ last_update = null;
+ top_flag = true;
+ top_queue = new Array;
+ down_block = false;
subid_curr = null;
- }else if(direct == 'same'){
- subinfo_switch();
}
+
+ return 'cont';
};
j_table.on('mousedown',function(e){
return false;
});
-}; __extend(class_stat_allsub_tab,class_common_tab);
+}; __extend(class_stat_sub_pbox,class_com_pbox);
+
+var class_stat_subres_mbox = function(subid,subo){
+ var that = this;
-var class_stat_subinfo_mbox = function(paobj){
+ that.subid = subid;
+ that.subo = subo;
+ that.node = new vus.node('res');
+
+ that.__super();
+}; __extend(class_stat_subres_mbox,class_com_mbox);
+var class_stat_subfile_mbox = function(){
var that = this;
- var ori_prop = new Object;
- var j_mbox = $('#index_mask > div.stat_mask > div.subinfo_mbox');
- var subid = null;
+ var j_mbox = $('#index_mask > div.stat_mask > div.subfile_mbox');
+
+ var filebox_add = function(filename,content){
+ var j_name;
+ var j_box;
+ var filebox;
+
+ j_name = $('<label></label>');
+ j_name.text(filename);
+ j_box = $('<div class="filebox"></div>');
+ filebox = CodeMirror(j_box[0],{
+ mode:'text/x-c++src',
+ theme:'lesser-dark',
+ lineNumbers:true,
+ matchBrackets:true,
+ indentUnit:4,
+ readOnly:true
+ });
+ filebox.getWrapperElement().style.width = '100%';
+ filebox.getWrapperElement().style.height = '100%';
+ filebox.getScrollerElement().style.width = '100%';
+ filebox.getScrollerElement().style.height = '100%';
+ filebox.setValue(content);
+
+ j_mbox.append(j_name);
+ j_mbox.append(j_box);
+ filebox.refresh();
+ }
- that.subid = null;
- that.smodname = null;
- that.subo = null;
+ that.node = new vus.node('file');
- that.__super(paobj);
+ that.__super();
- that.init = function(id){
- subid = id;
- };
- that.switchchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- $.post('/toj/php/status.php',{'action':'get_by_subid','data':JSON.stringify({'subid':subid})},function(res){
+ that.fadein(j_mbox);
+ j_mbox.find('h2.subid').text('SubID:' + stat.sub_subid);
+
+ $.post('/toj/php/status.php',{'action':'get_submit_data','data':JSON.stringify({'subid':stat.sub_subid})},function(res){
+ var i;
var reto;
if(res[0] != 'E'){
- that.subid = subid;
reto = JSON.parse(res);
- that.smodname = reto.smodname;
- that.subo = reto;
- delete that.subo.smodname;
-
- j_mbox.addClass(that.smodname);
-
- css = $('<link rel="stylesheet" type="text/css" href="/toj/smod/' + that.smodname + '/' + that.smodname + '.css">');
- $('head').append(css);
- css.ready(function(){
- $.get('/toj/smod/' + that.smodname + '/' + that.smodname + '.html',{},function(res){
- var j_h;
- var j_button;
-
- j_mbox.html(res);
-
- j_h = $('<h2 style="padding:6px 0px 0px 0px;"></h2>');
- j_h.text('SubID:' + that.subo.subid);
- j_button = $('<button style="margin:6px 0px 0px 0px; float:right;">關閉</button>');
- j_button.on('click',function(e){
- common.hidembox('false');
- });
- j_mbox.prepend(j_h);
- j_mbox.prepend(j_button);
-
- $.getScript('/toj/smod/' + that.smodname + '/' + that.smodname + '.js',function(script,stat,res){
- eval(that.smodname + '.init(that,j_mbox)');
- that.export_switchchange('in');
- });
- });
- });
+ for(i = 0;i < reto.length;i++){
+ filebox_add(reto[i].filename,reto[i].content);
+ }
}
});
}else if(direct == 'out'){
- that.export_switchchange('out');
-
- for(key in that){
- if(!(key in ori_prop)){
- delete that[key];
- }
- }
-
- j_mbox.empty();
- j_mbox.removeClass(that.smodname);
- that.subid = null;
- that.smodname = null;
- that.subo = null;
+ that.fadeout(j_mbox);
+ j_mbox.find('label').remove();
+ j_mbox.find('div.filebox').remove();
}
+
+ return 'cont';
};
- for(key in that){
- ori_prop[key] = true;
- }
-}; __extend(class_stat_subinfo_mbox,class_common_mbox);
+ j_mbox.find('button.result').on('click',function(e){
+ com.url_update('/toj/m/sub/' + stat.sub_subid + '/res/');
+ });
+}; __extend(class_stat_subfile_mbox,class_com_mbox);
diff --git a/toj/jcs/user.css b/toj/jcs/user.css
index 171efaf..71af8d7 100644
--- a/toj/jcs/user.css
+++ b/toj/jcs/user.css
@@ -1,175 +1,154 @@
-div.user_page > div.main_tab > div.info_box{
- width:256px;
- height:100%;
- background-color:#1C1C1C;
- font-size:20px;
+div.user_page > div.main_pbox > div.info_box{
+ width:240px;
+ padding:32px 0px 32px 0px;
float:left;
}
-div.user_page > div.main_tab > div.info_box > div.aboutme{
- margin:6px 6px;
+div.user_page > div.main_pbox > div.info_box > div.aboutme{
+ padding:6px 0px 6px 0px;
word-break:break-all;
}
-div.user_page > div.main_tab > div.info_box > img.avatar{
+div.user_page > div.main_pbox > div.info_box > img.avatar{
width:100%;
display:block;
}
-div.user_page > div.edit_tab > div.edit_box{
- padding:64px 0px 64px 256px;
+div.user_page > div.edit_pbox > div.edit_box{
+ width:240px;
+ margin:0px 0px 0px 246px;
+ padding:0px 0px 32px 0px;
}
-div.user_page > div.edit_tab > div.edit_box > img.avatar{
- width:268px;
+div.user_page > div.edit_pbox > div.edit_box > img.avatar{
+ width:100%;
margin:0px 0px 16px 0px;
display:block;
}
-div.user_page > div.edit_tab > div.edit_box > div.error{
+div.user_page > div.edit_pbox > div.edit_box > div.error{
margin:0px 0px 16px 0px;
- font-size:16px;
color:#FFA0A0;
}
-div.user_page > div.edit_tab > div.edit_box label{
- font-size:16px;
-}
-div.user_page > div.edit_tab > div.edit_box input{
- width:256px;
+div.user_page > div.edit_pbox > div.edit_box input{
+ width:228px;
height:32px;
margin:0px 0px 16px 0px;
padding:0px 6px 0px 6px;
border-width:0px;
- font-size:16px;
display:block;
}
-div.user_page > div.mgsq_tab > div.in_box{
+div.user_page > div.mgsq_pbox > div.in_box{
width:480px;
- padding:0px 0px 64px 0px;
- position:absolute;
- top:64px;
- left:256px;
+ margin:0px 0px 0px 246px;
+ padding:0px 0px 32px 0px;
+ float:left;
}
-div.user_page > div.mgsq_tab > div.out_box{
+div.user_page > div.mgsq_pbox > div.out_box{
width:480px;
- padding:0px 6px 64px 0px;
- position:absolute;
- top:64px;
- left:752px;
+ margin:0px 0px 0px 6px;
+ padding:0px 0px 32px 0px;
+ float:left;
}
-div.user_page > div.mgsq_tab div.item{
+div.user_page > div.mgsq_pbox div.item{
+ width:auto;
margin:6px 0px 6px 0px;
- padding:6px 6px;
- font-size:16px;
+ padding:6px 0px 6px 6px;
cursor:pointer;
}
-div.user_page > div.mgsq_tab div.item_s{
+div.user_page > div.mgsq_pbox div.item_s{
background-color:rgba(255,255,255,0.2);
}
-div.user_page > div.mgsq_tab div:hover.item{
+div.user_page > div.mgsq_pbox div:hover.item{
background-color:rgba(255,255,255,0.2);
}
-div.user_page > div.mgsq_tab div.item > div.info{
+div.user_page > div.mgsq_pbox div.item > div.info{
width:100%;
height:32px;
line-height:32px;
}
-div.user_page > div.mgsq_tab div.item > div.info > span.time{
+div.user_page > div.mgsq_pbox div.item > div.info > span.time{
+ width:237px;
height:32px;
font-size:14px;
line-height:32px;
- text-align:right;
float:right;
}
-div.user_page > div.mgsq_tab div.item > div.data{
+div.user_page > div.mgsq_pbox div.item > div.data{
width:100%;
height:32px;
margin:6px 0px 0px 0px;
display:none;
}
-div.user_page > div.mgsq_tab div.item a{
- height:100%;
- text-decoration:none;
- color:#E9E9E9;
-}
-div.user_page > div.mgsq_tab div.item a:hover{
- text-decoration:underline;
-}
-div.user_page > div.mg_tab > div.left_box{
- padding:64px 0px 0px 256px;
+div.user_page > div.mg_pbox > div.left_box{
+ margin:0px 0px 0px 246px;
+ padding:0px 0px 32px 0px;
float:left;
}
-div.user_mask > div.editsq_mbox{
- width:31%;
-}
+
div.user_mask > div.editsq_mbox > div.edit_box{
- padding:64px 0px 64px 0px;
+ margin:0px 0px 0px 246px;
+ padding:6px 0px 32px 0px;
}
div.user_mask > div.editsq_mbox > div.edit_box > div.error{
margin:0px 0px 16px 0px;
- font-size:16px;
color:#FFA0A0;
}
-div.user_mask > div.editsq_mbox > div.edit_box label{
- font-size:16px;
-}
div.user_mask > div.editsq_mbox > div.edit_box input{
+ width:146px;
height:32px;
margin:0px 0px 16px 0px;
padding:0px 6px 0px 6px;
border-width:0px;
- font-size:16px;
display:block;
}
div.user_mask > div.editsq_mbox > div.edit_box select{
+ width:76px;
height:32px;
margin:0px 0px 16px 0px;
border-width:0px;
- font-size:16px;
display:block;
}
-div.login_page > div.info_box{
- width:31%;
- margin:192px 0px 0px 19%;
+div.login_pbox > div.info_box{
+ width:486px;
+ margin:128px 0px 0px 246px;
float:left;
}
-div.login_page > div.login_box{
- width:31%;
- margin:192px auto 0px auto;
+div.login_pbox > div.login_box{
+ width:240px;
+ margin:128px 0px 0px 0px;
+ padding:0px 6px 0px 0px;
float:left;
}
-div.login_page > div.login_box > div.error{
+div.login_pbox > div.login_box > div.error{
margin:0px 0px 16px 0px;
- font-size:16px;
color:#FFA0A0;
}
-div.login_page > div.login_box > input{
- width:256px;
+div.login_pbox > div.login_box > input{
+ width:228px;
height:32px;
margin:0px 0px 16px 0px;
padding:0px 6px 0px 6px;
border-width:0px;
- font-size:16px;
display:block;
}
-div.register_page > div.info_box{
- width:31%;
- margin:192px 0px 0px 19%;
+div.register_pbox > div.info_box{
+ width:486px;
+ margin:128px 0px 0px 246px;
float:left;
}
-div.register_page > div.register_box{
- width:31%;
- margin:192px auto 0px auto;
+div.register_pbox > div.register_box{
+ width:240px;
+ margin:128px 0px 0px 0px;
+ padding:0px 6px 0px 0px;
float:left;
}
-div.register_page > div.register_box > div.error{
+div.register_pbox > div.register_box > div.error{
margin:0px 0px 16px 0px;
- font-size:16px;
color:#FFA0A0;
}
-div.register_page > div.register_box > input{
- width:256px;
+div.register_pbox > div.register_box > input{
+ width:228px;
height:32px;
margin:0px 0px 16px 0px;
padding:0px 6px 0px 6px;
border-width:0px;
- font-size:16px;
display:block;
}
diff --git a/toj/jcs/user.js b/toj/jcs/user.js
index b8ffd3e..9b36dbe 100644
--- a/toj/jcs/user.js
+++ b/toj/jcs/user.js
@@ -5,28 +5,102 @@ square state
2 => past
*/
-var user = {
- uid:null,
- level:null,
- username:null,
- nickname:null,
- avatar:null,
- aboutme:null,
- email:null,
- sq_inlist:null,
- loginchange:$.Callbacks(),
- datachange:$.Callbacks(),
-
- init:function(){
- user.user_page = new class_user_page;
- user.login_page = new class_login_page;
- user.register_page = new class_register_page;
-
- $('#index_panel > [page="logout"] > a.button').off('click').on('click',function(e){
+var user = new function(){
+ var that = this;
+ var main_pbox = null;
+ var edit_pbox = null;
+ var mgsq_pbox = null;
+ var mg_pbox = null;
+ var uid_node = null;
+
+ that.login_chg = $.Callbacks();
+ that.data_chg = $.Callbacks();
+
+ that.uid = null;
+ that.level = null;
+ that.username = null;
+ that.nickname = null;
+ that.avatar = null;
+ that.aboutme = null;
+ that.email = null;
+ that.sq_inlist = null;
+
+ that.view_uid = null;
+
+ that.init = function(){
+ that.login_pbox = new class_login_pbox;
+ that.register_pbox = new class_register_pbox;
+
+ main_pbox = new class_user_main_pbox;
+ edit_pbox = new class_user_edit_pbox;
+ mgsq_pbox = new class_user_mgsq_pbox;
+ mg_pbox = new class_user_mg_pbox;
+ that.editsq_mbox = new class_user_editsq_mbox;
+
+ that.user_node = new vus.node('user');
+
+ uid_node = new vus.node('');
+ uid_node.child_set(main_pbox.node);
+ uid_node.child_set(edit_pbox.node);
+ uid_node.child_set(mgsq_pbox.node);
+ uid_node.child_set(mg_pbox.node);
+
+ that.user_node.url_chg = function(direct,url_upart,url_dpart){
+ var uid;
+
+ if(direct == 'in' || direct == 'same'){
+ index.title_set('TOJ-使用者');
+
+ if((uid = url_dpart[0]) == ''){
+ com.url_update('/toj/none/');
+ return 'stop';
+ }
+ uid = parseInt(uid);
+ if(uid == that.view_uid){
+ return 'cont';
+ }
+
+ if(uid != null){
+ that.user_node.child_del(uid_node);
+ index.tab_empty();
+ }
+
+ uid_node.name = uid.toString();
+ that.user_node.child_set(uid_node);
+
+ if(url_dpart[1] == undefined){
+ com.url_update('/toj/user/' + uid + '/main/');
+ return 'stop';
+ }
+
+ that.view_uid = uid;
+
+ index.tab_add('main','/toj/user/' + that.view_uid + '/main/','個人');
+ if(that.view_uid == that.uid){
+ index.tab_add('edit','/toj/user/' + that.uid + '/edit/','設定');
+ index.tab_add('mgsq','/toj/user/' + that.uid + '/mgsq/','方塊');
+ if((user.level & USER_LEVEL_SUPERADMIN) == USER_LEVEL_SUPERADMIN){
+ index.tab_add('mg','/toj/user/' + that.uid + '/mg/','管理');
+ }
+ }
+ }else if(direct == 'out'){
+ if(that.view_uid != null){
+ that.user_node.child_del(uid_node);
+ }
+ that.view_uid = null;
+
+ index.tab_empty();
+ }
+
+ return 'cont';
+ };
+ com.vus_root.child_set(that.user_node);
+
+ $('#index_panel > li.logout > a.button').off('click').on('click',function(e){
var cookie;
var key;
- cookie = common.getcookie();
+ cookie = com.get_cookie();
for(key in cookie){
document.cookie = key + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/toj/';
}
@@ -34,32 +108,36 @@ var user = {
location.href = '/toj/home/';
return false;
});
- user.loginchange.add(function(login){
+ that.login_chg.add(function(login){
var j_notice;
var j_nickname;
j_notice = $('#index_head_notice');
- j_nickname = $('#index_head_nickname > a.nickname')
+ j_nickname = $('#index_head_nickname > a.nickname');
if(login){
j_notice.show();
- j_nickname.attr('href','/toj/user/' + user.uid + '/');
- j_nickname.text(user.nickname);
-
- index.showpanel('logout');
- index.setpanel('user','/toj/user/' + user.uid + '/','個人');
- index.showpanel('user');
+ j_nickname.attr('href','/toj/user/' + that.uid + '/main/');
+ j_nickname.text(that.nickname);
+
+ index.panel_hide('login');
+ index.panel_hide('register');
+ index.panel_show('logout');
+ index.panel_set('user','/toj/user/' + that.uid + '/main/','個人');
+ index.panel_show('user');
}else{
j_notice.hide();
j_nickname.attr('href','');
j_nickname.text('');
- index.hidepanel('logout');
- index.hidepanel('user');
- index.setpanel('user',null,'個人');
+ index.panel_show('login');
+ index.panel_show('register');
+ index.panel_hide('logout');
+ index.panel_set('user',null,'個人');
+ index.panel_hide('user');
}
});
- user.datachange.add(function(){
+ that.data_chg.add(function(){
var i;
var j_ul;
var j_li;
@@ -82,6 +160,8 @@ var user = {
j_li.show();
};
+ $('#index_head_nickname > a.nickname').text(that.nickname);
+
j_ul = $('#index_panel > ul.square_box');
j_ul.find('li.button').hide();
for(i = 0;i < user.sq_inlist.length;i++){
@@ -92,10 +172,9 @@ var user = {
}
});
- user.updatedata(true);
- },
-
- updatedata:function(sync){
+ user.update(true);
+ };
+ that.update = function(sync){
$.ajax({'url':'/toj/php/user.php',
'type':'POST',
'data':{'action':'view','data':JSON.stringify({'uid':null})},
@@ -104,33 +183,33 @@ var user = {
var reto;
var old_uid;
- old_uid = user.uid;
+ old_uid = that.uid;
if(res[0] == 'E'){
- user.uid = null;
- user.level = null;
- user.username = null;
- user.nickname = null;
- user.avatar = null;
- user.aboutme = null;
- user.email = null;
- user.sq_inlist = null;
+ that.uid = null;
+ that.level = null;
+ that.username = null;
+ that.nickname = null;
+ that.avatar = null;
+ that.aboutme = null;
+ that.email = null;
+ that.sq_inlist = null;
- user.loginchange.fire(false);
+ that.login_chg.fire(false);
}else{
reto = JSON.parse(res);
- user.uid = reto.uid;
- user.level = reto.level;
- user.username = reto.username;
- user.nickname = reto.nickname;
- user.avatar = reto.avatar;
- user.aboutme = reto.aboutme;
- user.email = reto.email;
-
- if(old_uid != user.uid){
- user.loginchange.fire(true);
+ that.uid = reto.uid;
+ that.level = reto.level;
+ that.username = reto.username;
+ that.nickname = reto.nickname;
+ that.avatar = reto.avatar;
+ that.aboutme = reto.aboutme;
+ that.email = reto.email;
+
+ if(old_uid != that.uid){
+ that.login_chg.fire(true);
}
- $.post('/toj/php/square.php',{'action':'get_entered_sq','data':JSON.stringify({'uid':user.uid})},function(res){
+ $.post('/toj/php/square.php',{'action':'get_entered_sq','data':JSON.stringify({'uid':that.uid})},function(res){
var i;
var reto;
var ts;
@@ -142,19 +221,19 @@ var user = {
}
reto = JSON.parse(res);
- ts = common.getdate(reto.timestamp);
+ ts = com.get_date(reto.timestamp);
sqlist = reto.list;
for(i = 0;i < sqlist.length;i++){
sqo = sqlist[i];
sqo.state = 1;
if(sqo.start_time != null){
- sqo.start_time = common.getdate(sqo.start_time);
+ sqo.start_time = com.get_date(sqo.start_time);
if(ts < sqo.start_time){
sqo.state = 0;
}
}
if(sqo.end_time != null){
- sqo.end_time = common.getdate(sqo.end_time);
+ sqo.end_time = com.get_date(sqo.end_time);
if(sqo.end_time < ts){
sqo.state = 2;
}
@@ -162,180 +241,93 @@ var user = {
}
user.sq_inlist = sqlist;
- user.datachange.fire(true);
+ user.data_chg.fire(true);
});
}
}
});
- }
+ };
};
-var class_user_page = function(){
+var class_user_main_pbox = function(){
var that = this;
- var j_page = $('#index_page > [page="user"]');
- var main_tab = new class_user_main_tab(that);
- var edit_tab = new class_user_edit_tab(that);
- var mgsq_tab = new class_user_mgsq_tab(that);
- var mg_tab = new class_user_mg_tab(that);
+ var j_pbox = $('#index_page > div.user_page > div.main_pbox');
- that.__super();
+ that.node = new vus.node('main');
- that.editsq_mbox = new class_user_editsq_mbox(that);
+ that.__super();
- that.uid = null;
- that.nickname = null;
- that.avatar = null;
- that.aboutme = null;
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ index.tab_hl('main');
+ that.fadein(j_pbox);
- that.urlchange = function(direct){
- var uid;
- var _check = function(){
- uid = common.geturlpart()[1];
- if(uid == ''){
- if(user.uid == null){
- common.pushurl('/toj/none/');
- return false;
- }
- uid = user.uid;
- common.replaceurl('/toj/user/' + uid + '/main/');
- }
- return true;
- };
- var _in = function(){
- $.post('/toj/php/user.php',{'action':'view','data':JSON.stringify({'uid':uid})},function(res){
+ $.post('/toj/php/user.php',{'action':'view','data':JSON.stringify({'uid':user.view_uid})},function(res){
var reto;
if(res[0] == 'E'){
- common.pushurl('/toj/none/');
+ com.url_update('/toj/none/');
}else{
reto = JSON.parse(res);
- that.uid = reto.uid;
- that.nickname = reto.nickname;
- that.avatar = reto.avatar;
- that.aboutme = reto.aboutme;
-
- that.fadein(j_page);
-
- index.settitle('TOJ-使用者');
-
- that.addtab('main',main_tab);
- index.addtab('main','/toj/user/' + that.uid + '/main/',that.nickname);
-
- if(uid == user.uid){
- that.addtab('mgsq',mgsq_tab);
- index.addtab('mgsq','/toj/user/' + that.uid + '/mgsq/','你的方塊');
- that.addtab('edit',edit_tab);
- index.addtab('edit','/toj/user/' + that.uid + '/edit/','更改資料');
-
- if((user.level & USER_LEVEL_SUPERADMIN) == USER_LEVEL_SUPERADMIN){
- that.addtab('mg',mg_tab);
- index.addtab('mg','/toj/user/' + that.uid + '/mg/','管理');
- }
+ if(reto.avatar == ''){
+ j_pbox.find('div.info_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
+ }else{
+ j_pbox.find('div.info_box > img.avatar').attr('src',reto.avatar);
}
-
- _change();
+ j_pbox.find('div.info_box > div.aboutme').text(reto.aboutme);
+
}
});
- };
- var _out = function(){
- index.emptytab();
- that.fadeout(j_page);
- that.tab_urlchange(null);
- that.uid = null;
- };
- var _change = function(){
- var tabname;
-
- tabname = common.geturlpart()[2];
- if(!(tabname in that.tab_list)){
- tabname = 'main';
- common.replaceurl('/toj/user/' + that.uid + '/main/');
- }
- that.tab_urlchange(tabname);
- };
-
- if(direct == 'in'){
- if(_check()){
- _in();
- }
}else if(direct == 'out'){
- _out();
- }else if(direct = 'same'){
- if(_check()){
- if(uid != that.uid || that.forceupdate){
- that.forceupdate = false;
- _out();
- _in();
- }else{
- _change();
- }
- }
+ index.tab_ll('main');
+ that.fadeout(j_pbox);
}
};
+}; __extend(class_user_main_pbox,class_com_pbox);
- common.addpage('user',that);
-}; __extend(class_user_page,class_common_page);
-
-var class_user_main_tab = function(paobj){
+var class_user_edit_pbox = function(){
var that = this;
- var j_tab = $('#index_page > [page="user"] > [tab="main"]');
+ var j_pbox = $('#index_page > div.user_page > div.edit_pbox');
- that.__super(paobj);
+ that.node = new vus.node('edit');
- that.urlchange = function(direct){
- if(direct == 'in'){
- that.fadein(j_tab);
-
- if(user.user_page.avatar == ''){
- j_tab.find('div.info_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
- }else{
- j_tab.find('div.info_box > img.avatar').attr('src',that.paobj.avatar);
- }
- j_tab.find('div.info_box > div.aboutme').text(that.paobj.aboutme);
- }else if(direct == 'out'){
- that.fadeout(j_tab);
- }
- };
-}; __extend(class_user_main_tab,class_common_tab);
-
-var class_user_edit_tab = function(paobj){
- var that = this;
- var j_tab = $('#index_page > [page="user"] > [tab="edit"]');
-
- that.__super(paobj);
+ that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_tab);
+ index.tab_hl('edit');
+ that.fadein(j_pbox);
- j_tab.find('div.edit_box > [name="nickname"]').val(user.nickname);
- j_tab.find('div.edit_box > [name="avatar"]').val(user.avatar);
+ j_pbox.find('div.edit_box > [name="nickname"]').val(user.nickname);
+ j_pbox.find('div.edit_box > [name="avatar"]').val(user.avatar);
if(user.avatar == ''){
- j_tab.find('div.edit_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
+ j_pbox.find('div.edit_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
}else{
- j_tab.find('div.edit_box > img.avatar').attr('src',user.avatar);
+ j_pbox.find('div.edit_box > img.avatar').attr('src',user.avatar);
}
- j_tab.find('div.edit_box > [name="aboutme"]').val(user.aboutme);
- j_tab.find('div.edit_box > [name="email"]').val(user.email);
+ j_pbox.find('div.edit_box > [name="aboutme"]').val(user.aboutme);
+ j_pbox.find('div.edit_box > [name="email"]').val(user.email);
}else if(direct == 'out'){
- that.fadeout(j_tab);
- j_tab.find('div.edit_box > input').val('');
- j_tab.find('div.edit_box > img.avatar').attr('src',null);
- j_tab.find('div.edit_box > div.error').text('');
+ index.tab_ll('edit');
+ that.fadeout(j_pbox);
+
+ j_pbox.find('div.edit_box > input').val('');
+ j_pbox.find('div.edit_box > img.avatar').attr('src',null);
+ j_pbox.find('div.edit_box > div.error').text('');
}
};
- j_tab.find('div.edit_box > [name="avatar"]').change(function(e){
+ j_pbox.find('div.edit_box > [name="avatar"]').change(function(e){
var avatar;
avatar = $(this).val();
if(avatar == ''){
- j_tab.find('div.edit_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
+ j_pbox.find('div.edit_box > img.avatar').attr('src','http://i.imgur.com/ykkQD.png');
}else{
- j_tab.find('div.edit_box > img.avatar').attr('src',avatar);
+ j_pbox.find('div.edit_box > img.avatar').attr('src',avatar);
}('test')
});
- j_tab.find('div.edit_box > button.submit').click(function(e){
+ j_pbox.find('div.edit_box > button.submit').click(function(e){
var j_error;
var nickname;
var avatar;
@@ -346,14 +338,14 @@ var class_user_edit_tab = function(paobj){
var password_repeat;
var data;
- j_error = j_tab.find('div.edit_box > div.error');
- nickname = j_tab.find('div.edit_box > [name="nickname"]').val();
- avatar = j_tab.find('div.edit_box > [name="avatar"]').val();
- aboutme = j_tab.find('div.edit_box > [name="aboutme"]').val();
- email = j_tab.find('div.edit_box > [name="email"]').val();
- password_old = j_tab.find('div.edit_box > [name="password_old"]').val();
- password_new = j_tab.find('div.edit_box > [name="password_new"]').val();
- password_repeat = j_tab.find('div.edit_box > [name="password_repeat"]').val();
+ j_error = j_pbox.find('div.edit_box > div.error');
+ nickname = j_pbox.find('div.edit_box > [name="nickname"]').val();
+ avatar = j_pbox.find('div.edit_box > [name="avatar"]').val();
+ aboutme = j_pbox.find('div.edit_box > [name="aboutme"]').val();
+ email = j_pbox.find('div.edit_box > [name="email"]').val();
+ password_old = j_pbox.find('div.edit_box > [name="password_old"]').val();
+ password_new = j_pbox.find('div.edit_box > [name="password_new"]').val();
+ password_repeat = j_pbox.find('div.edit_box > [name="password_repeat"]').val();
data = {'nickname':nickname,'avatar':avatar,'aboutme':aboutme,'email':email};
if(password_old != '' || password_new != '' || password_repeat != ''){
@@ -394,21 +386,19 @@ var class_user_edit_tab = function(paobj){
break;
}
}else{
- user.updatedata(true);
-
- that.paobj.forceupdate = true;
- common.pushurl('/toj/user/' + user.uid + '/main/');
+ user.update(true);
+ com.url_push('/toj/user/' + user.uid + '/main/');
}
});
});
- j_tab.find('div.edit_box > button.cancel').click(function(e){
- common.pushurl('/toj/user/' + user.uid + '/main/');
+ j_pbox.find('div.edit_box > button.cancel').click(function(e){
+ com.url_push('/toj/user/' + user.uid + '/main/');
});
-}; __extend(class_user_edit_tab,class_common_tab);
+}; __extend(class_user_edit_pbox,class_com_pbox);
-var class_user_mgsq_tab = function(paobj){
+var class_user_mgsq_pbox = function(){
var that = this;
- var j_tab = $('#index_page > [page="user"] > [tab="mgsq"]');
+ var j_pbox = $('#index_page > div.user_page > div.mgsq_pbox');
var sq_join = function(sqid){
$.post('/toj/php/square.php',{'action':'add_user','data':JSON.stringify({'uid':user.uid,'sqid':sqid})},function(res){
@@ -427,7 +417,6 @@ var class_user_mgsq_tab = function(paobj){
var sq_listset = function(j_item,sqo){
var j_info;
var j_data;
- var j_a;
var j_button;
j_info = j_item.find('div.info');
@@ -436,27 +425,25 @@ var class_user_mgsq_tab = function(paobj){
j_item.attr('sqid',sqo.sqid);
- j_a = j_info.find('span.name > a');
- j_a.attr('href','/toj/sq/' + sqo.sqid + '/pro/');
- j_a.text(sqo.sqname);
+ j_info.find('span.name').text(sqo.sqname);
if(sqo.end_time == null){
j_info.find('span.time').text('');
}else{
- j_info.find('span.time').text(common.getdatestring(sqo.start_time,false) + ' > ' + common.getdatestring(sqo.end_time,false));
+ j_info.find('span.time').text(com.get_datestring(sqo.start_time,false) + ' > ' + com.get_datestring(sqo.end_time,false));
}
if(sqo.relationship == 3 || (user.level & USER_LEVEL_SUPERADMIN) == USER_LEVEL_SUPERADMIN){
j_button = $('<button style="margin:0px 6px 0px 0px;">管理</button>');
j_button.on('click',function(e){
- that.paobj.editsq_mbox.init('edit',sqo);
- common.showmbox(that.paobj.editsq_mbox).done(sq_update);
+ user.editsq_mbox.init('edit',sqo).done(sq_update);
+ com.url_push('/toj/m/user_editsq/');
return false;
});
j_data.append(j_button);
}
- j_button = $('<button></button>');
+ j_button = $('<button style="margin:0px 6px 0px 0px;"></button>');
if(sqo.relationship == 0){
if(sqo.publicity == 2 && (user.level & USER_LEVEL_SUPERADMIN) != USER_LEVEL_SUPERADMIN){
j_button.text('申請');
@@ -468,7 +455,7 @@ var class_user_mgsq_tab = function(paobj){
return false;
});
}else{
- if(sqo.relationship == 1 && (user.level & USER_LEVEL_SUPERADMIN) != USER_LEVEL_SUPERADMIN){
+ if(sqo.relationship == 1){
j_button.text('取消申請');
}else{
j_button.text('退出');
@@ -480,6 +467,15 @@ var class_user_mgsq_tab = function(paobj){
}
j_data.append(j_button);
+ if(sqo.relationship >= 2){
+ j_button = $('<button>開啟</button>');
+ j_button.on('click',function(e){
+ com.url_push('/toj/sq/' + sqo.sqid + '/pro/');
+ return false;
+ });
+ j_data.append(j_button);
+ }
+
j_item.off('click').on('click',function(e){
if(j_data.is(':visible')){
j_item.removeClass('item_s');
@@ -496,7 +492,7 @@ var class_user_mgsq_tab = function(paobj){
var j_data;
j_item = $('<div class="item"></div>');
- j_info = $('<div class="info"><span class="name"><a></a></span><span class="time"></span></div>');
+ j_info = $('<div class="info"><span class="name"></span><span class="time"></span></div>');
j_item.append(j_info);
j_data = $('<div class="data"></div>');
j_item.append(j_data);
@@ -554,7 +550,7 @@ var class_user_mgsq_tab = function(paobj){
}
};
- user.datachange.add(function(){
+ user.data_chg.add(function(){
var i;
var sqo;
var sqwait;
@@ -565,7 +561,7 @@ var class_user_mgsq_tab = function(paobj){
var j_run;
var j_past;
- user.datachange.remove(arguments.callee);
+ user.data_chg.remove(arguments.callee);
sqwait = new Array();
sqrun = new Array();
@@ -585,15 +581,15 @@ var class_user_mgsq_tab = function(paobj){
};
}
- j_wait = j_tab.find('div.in_box > div.wait');
- j_run = j_tab.find('div.in_box > div.run');
- j_past = j_tab.find('div.in_box > div.past');
+ j_wait = j_pbox.find('div.in_box > div.wait');
+ j_run = j_pbox.find('div.in_box > div.run');
+ j_past = j_pbox.find('div.in_box > div.past');
_updatelist(j_wait,sqwait);
_updatelist(j_run,sqrun);
_updatelist(j_past,sqpast);
});
- user.updatedata(false);
+ user.update(false);
$.post('/toj/php/square.php',{'action':'get_available_sq','data':null},function(res){
var i;
@@ -614,7 +610,7 @@ var class_user_mgsq_tab = function(paobj){
}
reto = JSON.parse(res);
- ts = common.getdate(reto.timestamp);
+ ts = com.get_date(reto.timestamp);
sqlist = reto.list;
sqwait = new Array();
sqrun = new Array();
@@ -624,13 +620,13 @@ var class_user_mgsq_tab = function(paobj){
sqo.relationship = 0;
sqo.state = 1;
if(sqo.start_time != null){
- sqo.start_time = common.getdate(sqo.start_time);
+ sqo.start_time = com.get_date(sqo.start_time);
if(ts < sqo.start_time){
sqo.state = 0;
}
}
if(sqo.end_time != null){
- sqo.end_time = common.getdate(sqo.end_time);
+ sqo.end_time = com.get_date(sqo.end_time);
if(sqo.end_time < ts){
sqo.state = 2;
}
@@ -649,9 +645,9 @@ var class_user_mgsq_tab = function(paobj){
}
}
- j_wait = j_tab.find('div.out_box > div.wait');
- j_run = j_tab.find('div.out_box > div.run');
- j_past = j_tab.find('div.out_box > div.past');
+ j_wait = j_pbox.find('div.out_box > div.wait');
+ j_run = j_pbox.find('div.out_box > div.run');
+ j_past = j_pbox.find('div.out_box > div.past');
_updatelist(j_wait,sqwait);
_updatelist(j_run,sqrun);
@@ -659,54 +655,68 @@ var class_user_mgsq_tab = function(paobj){
});
}
- that.__super(paobj);
+ that.node = new vus.node('mgsq');
+
+ that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_tab);
+ index.tab_hl('mgsq');
+ that.fadein(j_pbox);
sq_update();
}else if(direct == 'out'){
- that.fadeout(j_tab);
- j_tab.find('div.in_box > div > div').remove();
- j_tab.find('div.out_box > div > div').remove();
+ index.tab_ll('mgsq');
+ that.fadeout(j_pbox);
+ j_pbox.find('div.in_box > div > div').remove();
+ j_pbox.find('div.out_box > div > div').remove();
}
+
+ return 'cont';
};
-}; __extend(class_user_mgsq_tab,class_common_tab);
+}; __extend(class_user_mgsq_pbox,class_com_pbox);
-var class_user_mg_tab = function(paobj){
+var class_user_mg_pbox = function(){
var that = this;
- var j_tab = $('#index_page > [page="user"] > [tab="mg"]');
+ var j_pbox = $('#index_page > div.user_page > div.mg_pbox');
- that.__super(paobj);
+ that.node = new vus.node('mg');
+
+ that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_tab);
+ index.tab_hl('mg');
+ that.fadein(j_pbox);
}else if(direct == 'out'){
- that.fadeout(j_tab);
+ index.tab_ll('mg');
+ that.fadeout(j_pbox);
}
+
+ return 'cont';
};
- j_tab.find('button.newsq').on('click',function(e){
- that.paobj.editsq_mbox.init('new');
- common.showmbox(that.paobj.editsq_mbox);
+ j_pbox.find('button.newsq').on('click',function(e){
+ user.editsq_mbox.init('new');
+ com.url_push('/toj/m/user_editsq/');
});
-}; __extend(class_user_mg_tab,class_common_tab);
+}; __extend(class_user_mg_pbox,class_com_pbox);
-var class_user_editsq_mbox = function(paobj){
+var class_user_editsq_mbox = function(){
var that = this;
var j_mbox = $('#index_mask > div.user_mask > div.editsq_mbox');
var action = null;
- var sqid;
+ var sqid = null;
+ var defer = null;
+
+ that.node = new vus.node('user_editsq');
- that.__super(paobj);
+ that.__super();
that.init = function(act,sqo){
action = act;
if(action == 'edit'){
sqid = sqo.sqid;
- console.log(sqo);
j_mbox.find('[name="sqname"]').val(sqo.sqname);
j_mbox.find('[name="sqmodname"]').val(sqo.sqmodname);
j_mbox.find('[name="publicity"]').val(sqo.publicity);
@@ -728,19 +738,35 @@ var class_user_editsq_mbox = function(paobj){
}
j_mbox.find('button.delete').show();
}
+
+ com.vus_mbox.child_set(that.node);
+
+ defer = $.Deferred();
+ return defer.promise();
};
- that.switchchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
that.fadein(j_mbox);
}else if(direct == 'out'){
that.fadeout(j_mbox);
+
+ sqid = null;
+
j_mbox.find('input').val('');
j_mbox.find('[name="publicity"]').val(3);
j_mbox.find('[name="infinite"]').val(1);
j_mbox.find('div.time').hide();
j_mbox.find('button.delete').hide();
j_mbox.find('div.error').text('');
+
+ if(defer.state() == 'pending'){
+ defer.reject();
+ }
+
+ com.vus_mbox.child_del(that.node);
}
+
+ return 'cont';
};
j_mbox.find('[name="infinite"]').on('change',function(e){
@@ -768,7 +794,8 @@ var class_user_editsq_mbox = function(paobj){
break;
}
}else{
- common.hidembox(true);
+ defer.resolve();
+ com.url_pull();
}
});
}
@@ -824,7 +851,8 @@ var class_user_editsq_mbox = function(paobj){
break;
}
}else{
- common.hidembox(true);
+ defer.resolve();
+ com.url_pull();
}
});
}else if(action == 'edit'){
@@ -847,34 +875,40 @@ var class_user_editsq_mbox = function(paobj){
break;
}
}else{
- user.updatedata(false);
- common.hidembox(true);
+ user.update(false);
+ defer.resolve();
+ com.url_pull();
}
});
}
});
j_mbox.find('button.cancel').on('click',function(e){
- common.hidembox(false);
+ com.url_pull();
});
-}; __extend(class_user_editsq_mbox,class_common_mbox);
+}; __extend(class_user_editsq_mbox,class_com_mbox);
-var class_login_page = function(){
+var class_login_pbox = function(){
var that = this;
- var j_page = $('#index_page > [page="login"]');
+ var j_page = $('#index_page > div.login_pbox');
+
+ that.node = new vus.node('login');
that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
that.fadein(j_page);
- index.settitle('TOJ-登入');
+ index.title_set('TOJ-登入');
j_page.find('div.login_box [name="username"]').focus();
}else if(direct == 'out'){
that.fadeout(j_page);
j_page.find('div.login_box > div.error').text('');
j_page.find('div.login_box > input').val('');
}
+
+ return 'cont';
};
+ com.vus_root.child_set(that.node);
j_page.find('div.login_box > input').keypress(function(e){
if(e.which == 13){
@@ -902,34 +936,25 @@ var class_login_page = function(){
if(res[0] == 'E'){
j_error.text('登入錯誤');
}else{
- user.updatedata(true);
- common.prevurl('register');
+ user.update(true);
+ com.url_push_back('/toj\/register/');
}
});
});
+}; __extend(class_login_pbox,class_com_pbox);
- user.loginchange.add(function(login){
- if(login){
- that.urlchange('out');
- common.removepage('login');
- index.hidepanel('login');
- }else{
- common.addpage('login',that);
- index.showpanel('login');
- }
- });
-}; __extend(class_login_page,class_common_page);
-
-var class_register_page = function(){
+var class_register_pbox = function(){
var that = this;
- var j_page = $('#index_page > [page="register"]');
+ var j_page = $('#index_page > div.register_pbox');
+
+ that.node = new vus.node('register');
that.__super();
- that.urlchange = function(direct){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
that.fadein(j_page);
- index.settitle('TOJ-註冊');
+ index.title_set('TOJ-註冊');
j_page.find('div.register_box [name="username"]').focus();
}else if(direct == 'out'){
that.fadeout(j_page);
@@ -937,7 +962,10 @@ var class_register_page = function(){
j_page.find('div.register_box > div.register_box > input').val('');
j_page.find('div.register_box > div.register_box > div.cover').show();
}
+
+ return 'cont';
};
+ com.vus_root.child_set(that.node);
j_page.find('div.register_box > input').keypress(function(e){
if(e.which == 13){
@@ -1006,20 +1034,9 @@ var class_register_page = function(){
break;
}
}else{
- user.updatedata(true);
- common.prevurl('login');
+ user.update(true);
+ com.url_push_back('/toj\/login/');
}
});
});
-
- user.loginchange.add(function(login){
- if(login){
- that.urlchange('out');
- common.removepage('register');
- index.hidepanel('register');
- }else{
- common.addpage('register',that);
- index.showpanel('register');
- }
- });
-}; __extend(class_register_page,class_common_page);
+}; __extend(class_register_pbox,class_com_pbox);
diff --git a/toj/php/_json.php b/toj/php/_json.php
deleted file mode 100644
index b3c443e..0000000
--- a/toj/php/_json.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-echo json_encode("#include <stdio.h>\nint main(){while(scanf(\"%d%d\", &a, &b)==2)printf(\"%d\n\", a+b); return 0;}\n");
-?>
diff --git a/toj/php/_test.php b/toj/php/_test.php
deleted file mode 100644
index 5ce8271..0000000
--- a/toj/php/_test.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<form action="notice.php" method=post>
- <input type='hidden' value='{"uid":111}' name='data'>
- <input type='hidden' value='count' name='action'>
- <input type='submit' value='ti jiao count'>
-</form>
-<form action="notice.php" method=post>
- <input type='text' value='{"uid":111}' name='data'>
- <input type='hidden' value='get' name='action'>
- <input type='submit' value='ti jiao get'>
-</form>
-<form action="notice.php" method=post>
- <input type='hidden' value='{"uid":111}' name='data'>
- <input type='hidden' value='clear' name='action'>
- <input type='submit' value='ti jiao clear'>
-</form>
-<form action="notice.php" method=post>
- <input type='text' value='{"uid":111,"type":1,"value":111,"context":"aaaaaa"}' name='data'>
- <input type='hidden' value='add' name='action'>
- <input type='submit' value='ti jiao add'>
-</form>
diff --git a/toj/php/common.inc.php b/toj/php/common.inc.php
index d31a596..0922c91 100644
--- a/toj/php/common.inc.php
+++ b/toj/php/common.inc.php
@@ -1,6 +1,8 @@
<?php
date_default_timezone_set('Asia/Taipei');
+//error_reporting(E_ALL ^ E_NOTICE);
+//error_reporting(0);
require('connect.inc.php');
diff --git a/toj/php/event.inc.php b/toj/php/event.inc.php
index 9d2a23c..acc2f14 100644
--- a/toj/php/event.inc.php
+++ b/toj/php/event.inc.php
@@ -5,7 +5,7 @@ class event
private static function init()
{
- event::$white_list = array('10.8.0.2');
+ event::$white_list = array('127.0.0.1');
}
// execute function $name in file $fname
diff --git a/toj/php/event_exec.cpp b/toj/php/event_exec.cpp
index 25d7944..af258c0 100644
--- a/toj/php/event_exec.cpp
+++ b/toj/php/event_exec.cpp
@@ -1,7 +1,7 @@
#include "event_exec.h"
#define EVENT_BUFLEN 1005
-#define EVENT_URL "http://10.8.0.2/toj/php/event.php"
+#define EVENT_URL "http://localhost/toj/php/event.php"
struct event_handle
{
diff --git a/toj/php/problem.inc.php b/toj/php/problem.inc.php
index e41e633..d6f8851 100644
--- a/toj/php/problem.inc.php
+++ b/toj/php/problem.inc.php
@@ -131,6 +131,7 @@ class problem
mkdir($pardir.$subid, 0755) or die('Ecannot_mkdir');
mkdir($pardir.$subid.'/data', 0755) or die('Ecannot_mkdir');
mkdir($pardir.$subid.'/result', 0755) or die('Ecannot_mkdir');
+ chmod($pardir.$subid.'/result', 0775) or die('Ecannot_chmod');
//$file = fopen($pardir.$subid.'/data/'.$subid.'.'.$ext,'w');
//20130205 tmp change
@@ -246,6 +247,33 @@ class problem
return $ret;
}
+
+ public static function rejudge_pro($sqlc, $proid)
+ {
+ $sqlstr = 'SELECT "subid" FROM "submit" WHERE "proid"=$1 ORDER BY "subid";';
+ $sqlarr = array($proid);
+ $res = pg_query_params($sqlc, $sqlstr, $sqlarr);
+ $ok = true;
+ $sublist = pg_fetch_all_columns($res, 0);
+ if(!$sublist)return false;
+ foreach($sublist as $sub)
+ {
+ $subid = intval($sub);
+ if(!problem::send_socket($subid, $proid))$ok = false;
+ }
+ return $ok;
+ }
+
+ public static function rejudge_sub($sqlc, $subid)
+ {
+ $sqlstr = 'SELECT "proid" FROM "submit" WHERE "subid"=$1;';
+ $sqlarr = array($subid);
+ $res = pg_query_params($sqlc, $sqlstr, $sqlarr);
+ $proid = intval(pg_fetch_result($res, 0));
+ if(!$proid)return false;
+
+ return problem::send_socket($subid, $proid);
+ }
}
diff --git a/toj/php/problem.php b/toj/php/problem.php
index be79ecb..0bca821 100644
--- a/toj/php/problem.php
+++ b/toj/php/problem.php
@@ -130,7 +130,7 @@ if($action == 'get_pro_stat')
$ret = problem::get_pro_stat($sqlc, $proid, $uid);
if(!$ret)
die('Eerror_get_pro_stat');
-
+
echo(json_encode($ret));
}
diff --git a/toj/php/sqlib_scoreboard.inc.php b/toj/php/sqlib_scoreboard.inc.php
index 84a71ef..e5e7d66 100644
--- a/toj/php/sqlib_scoreboard.inc.php
+++ b/toj/php/sqlib_scoreboard.inc.php
@@ -51,11 +51,19 @@
if($new)
{
$sqlstr = 'INSERT INTO "sqlib_scoreboard_last_update" ("sqid", "sboard_id", "last_update") VALUES ($1, $2, $3);';
+ sqlib_scoreboard::clear_scoreboard($msqlc, $sqid, $sboard_id);
}
$sqlarr = array($sqid, $sboard_id, $now);
$res = pg_query_params($msqlc, $sqlstr, $sqlarr);
}
+ public static function clear_scoreboard($msqlc, $sqid, $sboard_id)
+ {
+ $sqlstr = 'DELETE FROM "sqlib_scoreboard_main" WHERE "sqid"=$1 AND "sboard_id"=$2;';
+ $sqlarr = array($sqid, $sboard_id);
+ $res = pg_query_params($msqlc, $sqlstr, $sqlarr);
+ }
+
public static function get_scoreboard($sqlc, $msqlc, $sqid, $sboard_id, $score_func, $start_time = null, $end_time = null, $start_offset, $number, $uid = null)
{
if(!$start_time)$start_time = '1900-01-01 01:01:01+08';
@@ -83,7 +91,7 @@
$obj->rank = intval($item['rank']);
$obj->problem = array();
- $sqlstr = 'SELECT "proid", "best_score", "best_time", "is_ac", "ac_time", "tries_before_ac", "last_score", "last_status", "last_time", "tries", "rank_score" FROM "sqlib_scoreboard_pro" WHERE "sqid"=$1 AND "sboard_id"=$2 AND "uid"=$3;';
+ $sqlstr = 'SELECT "proid", "best_score", "best_time", "is_ac", "ac_time", "tries_before_ac", "last_score", "last_status", "last_time", "tries", "rank_score" FROM "sqlib_scoreboard_pro" WHERE "sqid"=$1 AND "sboard_id"=$2 AND "uid"=$3 ORDER BY "proid";';
$sqlarr = array($sqid, $sboard_id, $obj->uid);
$res = pg_query_params($msqlc, $sqlstr, $sqlarr);
$data = pg_fetch_all($res);
diff --git a/toj/php/square.php b/toj/php/square.php
index 4880ab3..ca57994 100644
--- a/toj/php/square.php
+++ b/toj/php/square.php
@@ -255,6 +255,7 @@ if($action == 'get_available_sq')
$list = square::get_available_sq($sqlc, $uid, $pub);
+ $ret = new stdClass;
$ret->list = $list;
$ret->timestamp = date('Y-m-d H:i:s');
@@ -277,6 +278,7 @@ if($action == 'get_entered_sq')
$list = square::get_entered_sq($sqlc, $uid);
+ $ret = new stdClass;
$ret->list = $list;
$ret->timestamp = date('Y-m-d H:i:s');
diff --git a/toj/php/status.inc.php b/toj/php/status.inc.php
index d9f4f7d..33765b0 100644
--- a/toj/php/status.inc.php
+++ b/toj/php/status.inc.php
@@ -71,7 +71,7 @@ class status
}
- $sqlstr = 'SELECT "submit".*, "user"."nickname" FROM ("submit" INNER JOIN "user" ON "submit"."uid"="user"."uid") INNER JOIN "problem" ON "submit"."proid"="problem"."proid" WHERE '.$condstr.' ORDER BY '.$ordstr.' LIMIT '.pg_escape_string($count).';';
+ $sqlstr = 'SELECT "submit".*, "user"."nickname", "problem"."proname" FROM ("submit" INNER JOIN "user" ON "submit"."uid"="user"."uid") INNER JOIN "problem" ON "submit"."proid"="problem"."proid" WHERE '.$condstr.' ORDER BY '.$ordstr.' LIMIT '.pg_escape_string($count).';';
//echo($sqlstr.'<br>');
$sqlr = pg_query($sqlc, $sqlstr);
@@ -112,6 +112,7 @@ class status
$ret->memory = intval($ret->memory);
$ret->score = intval($ret->score);
$ret->lang = intval($ret->lang);
+ $ret->nickname = user::get_nickname($sqlc, $ret->uid);
return $ret;
}
@@ -128,6 +129,35 @@ class status
return false;
return true;
}
+
+ public static function get_submit_data($subid)
+ {
+ //get submit data files
+ //if nothing return false
+
+ $ret = array();
+ $path = '../center/submit/'.(floor($subid/1000)*1000).'/'.$subid.'/data';
+ $dir_it = new RecursiveDirectoryIterator($path);
+ $it = new RecursiveIteratorIterator($dir_it, RecursiveIteratorIterator::SELF_FIRST);
+
+ foreach($it as $file)
+ {
+ if($file->isFile())
+ {
+ $obj = new stdClass();
+ $obj->filename = $file->getPathname();
+ $obj->content = file_get_contents($obj->filename);
+ for($i = 0; $i < 6; $i++)
+ {
+ $pos = strpos($obj->filename, '/');
+ $obj->filename = substr($obj->filename, $pos+1);
+ }
+ array_push($ret, $obj);
+ }
+ }
+
+ return $ret;
+ }
}
?>
diff --git a/toj/php/status.php b/toj/php/status.php
index 5c00580..8f0074f 100644
--- a/toj/php/status.php
+++ b/toj/php/status.php
@@ -65,6 +65,32 @@ if($action == 'get_by_subid')
echo(json_encode($obj));
}
+if($action == 'get_submit_data')
+{
+ //get submission data : code or something
+ //data: subid
+
+ if(!sec_is_login())
+ die('Enot_login');
+
+ $dt = json_decode($data);
+ $subid = intval($dt->subid);
+ if(!$subid)
+ die('Eno_subid');
+
+ $sub = status::get_by_subid($sqlc, $subid);
+ if(!$sub)
+ die('Ewrong_subid');
+
+ if(!sec_check_level($sqlc, USER_LEVEL_SUPERADMIN) && ($sub->uid != intval($_COOKIE['uid'])))
+ die('Epermission_denied');
+
+ $ret = status::get_submit_data($subid);
+ if(!$ret)
+ die('Eerror_get_submit_data');
+
+ echo(json_encode($ret));
+}
db_close($sqlc);
?>
diff --git a/toj/php/step.inc.php b/toj/php/step.inc.php
deleted file mode 100644
index a116a64..0000000
--- a/toj/php/step.inc.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-require_once('common.inc.php');
-require_once('square.inc.php');
-require_once('sqlib_scoreboard.inc.php');
-
-function get_prob_stat_uid($sqlc, $msqlc, $sqid, $sboard_id, $uid)
-{
- $sq = square::get($sqlc, $sqid);
- if(!$sq)die('Eno_such_sq');
-
- $data = sqlib_scoreboard::get_scoreboard_uid($sqlc, $msqlc, $sqid, $sboard_id, null, $sq->start_time, $sq->end_time, $uid);
-
- return $data[0];
-}
-
-?>
diff --git a/toj/php/step.php b/toj/php/step.php
deleted file mode 100644
index 6425ae1..0000000
--- a/toj/php/step.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-//ini_set("display_errors", "On");
-
-require_once('common.inc.php');
-require_once('step.inc.php');
-require_once('teamt.php');
-
-$sqlc = db_connect();
-$msqlc = db_connect('toj_mod');
-
-if(strlen($action)==0)
- die('Eno_action');
-if($action == '')
-{
-}
-
-$uid = $_GET['uid'];
-$dat = get_prob_stat_uid($sqlc, $msqlc, 1, 2, $uid);
-
-//var_dump($dat);
-echo('uid : '.$dat->uid.'<br>');
-foreach($dat->problem as $prob)
-{
- echo('problem '.$prob->proid.' : ');
- if(!$prob->tries)
- {
- echo('--<br>');
- continue;
- }
- echo($prob->best_score.' ');
- if($prob->is_ac)echo('AC');
- echo('<br>');
-}
-
-$term = 1;
-$teamid = get_teamid($msqlc, $term, $uid);
-echo('<br>Team : '.$teamid.'<br>Members : <br>');
-$members = get_team_member($msqlc, $term, $teamid);
-foreach($members as $mem)
-{
- echo('<br>Uid : '.$mem->uid.' ( Level '.$mem->level.' )<br>');
- $uid = intval($mem->uid);
- if($uid == intval($_GET['uid']))continue;
- $dat = get_prob_stat_uid($sqlc, $msqlc, 1, 2, $uid);
-
- foreach($dat->problem as $prob)
- {
- echo('problem '.$prob->proid.' : ');
- if(!$prob->tries)
- {
- echo('--<br>');
- continue;
- }
- echo($prob->best_score.' ');
- if($prob->is_ac)echo('AC');
- echo('<br>');
- }
-}
-
-
-db_close($sqlc);
-db_close($msqlc);
-
-?>
diff --git a/toj/php/teamt.php b/toj/php/teamt.php
deleted file mode 100644
index ca1cd4b..0000000
--- a/toj/php/teamt.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-require_once('common.inc.php');
-
-function get_teamid($msqlc, $term, $uid)
-{
- $sqlstr = 'SELECT "teamid" FROM "sqmod_sprout_team" WHERE "term"=$1 AND "uid"=$2;';
- $sqlarr = array($term, $uid);
- $res = pg_query_params($sqlstr, $sqlarr);
- $teamid = pg_fetch_result($res, 0);
- return $teamid;
-}
-
-function get_team_member($msqlc, $term, $teamid)
-{
- $sqlstr = 'SELECT "uid", "level" FROM "sqmod_sprout_team" WHERE "term"=$1 AND "teamid"=$2 ORDER BY "level" DESC, "uid";';
- $sqlarr = array($term, $teamid);
- $res = pg_query_params($sqlstr, $sqlarr);
- $ret = array();
- while($obj = pg_fetch_object($res))
- {
- array_push($ret, $obj);
- }
- return $ret;
-}
-
-
-?>
diff --git a/toj/php/test.php b/toj/php/test.php
deleted file mode 100644
index a38a8a8..0000000
--- a/toj/php/test.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-ini_set("display_errors", "On");
-error_reporting(E_ALL & ~E_NOTICE);
-
-require_once('common.inc.php');
-require_once('sqlib.inc.php');
-require_once('user.inc.php');
-
-$msqlc = db_connect('toj_mod');
-$sqlc = db_connect();
-
-function func($sqid, $proid, $best_score, $best_time, $is_ac, $ac_time, $tries_before_ac, $last_score, $last_status, $last_time, $tries)
-{
- return $best_score;
-}
-
-//$a = intval($_GET['a']);
-//sqlib_scoreboard::set_last_update($msqlc, 1, 4, false);
-//$scb = sqlib_scoreboard::get_scoreboard($sqlc, $msqlc, 1, $a, func, null, null, 1, 20);
-//var_dump($scb);
-//echo(json_encode($scb));
-//$test = sqlib_scoreboard::get_last_update($msqlc, 1, $a);
-//echo($test.'<br>');
-//echo(strtotime($test).'<br>');
-//echo(time());
-
-$res = user::reset_password($sqlc, 130);
-var_dump($res);
-
-db_close($sqlc);
-db_close($msqlc);
-?>
diff --git a/toj/php/user.inc.php b/toj/php/user.inc.php
index 1a3eaef..8b3bb61 100644
--- a/toj/php/user.inc.php
+++ b/toj/php/user.inc.php
@@ -157,7 +157,7 @@ class user
else $c = chr(97 + $v - 36);
$newpass = $newpass.$c;
}
- echo($newpass.'<br>');
+ //echo($newpass.'<br>');
//email
@@ -180,12 +180,11 @@ class user
$cmail->Body = 'Hi '.$user->nickname.' ('.$user->username.') , your new password is '.$newpass.' .';
if(!$cmail->Send())
{
- echo($cmail->ErrorInfo.'<br>');
+ //echo($cmail->ErrorInfo.'<br>');
return false;
}
- return true;
$user->password = hash('sha512', $newpass);
$nuser = user::update($sqlc, $user);
diff --git a/toj/pmod/pmod_multisub/pmod_multisub.css b/toj/pmod/pmod_multisub/pmod_multisub.css
index 308cc94..eb73770 100755
--- a/toj/pmod/pmod_multisub/pmod_multisub.css
+++ b/toj/pmod/pmod_multisub/pmod_multisub.css
@@ -1,5 +1,5 @@
div.pmod_multisub > div.main_content{
- margin:32px 0px 32px 256px;
+ margin:32px 0px 32px 246px;
}
div.pmod_multisub > table.probox{
width:100%;
@@ -7,7 +7,7 @@ div.pmod_multisub > table.probox{
border-collapse:collapse;
}
div.pmod_multisub > table.probox td.info{
- width:250px;
+ width:240px;
padding:0px 0px 0px 6px;
vertical-align:top;
}
@@ -17,10 +17,11 @@ div.pmod_multisub > table.probox td.info > table.statlist{
border-collapse:collapse;
}
div.pmod_multisub > table.probox td.info > table.statlist td.name{
- width:96px;
+ width:76px;
}
div.pmod_multisub > table.probox td.info > table.statlist td.value{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_multisub > table.probox td.info > table.limitlist{
width:100%;
@@ -28,25 +29,29 @@ div.pmod_multisub > table.probox td.info > table.limitlist{
border-collapse:collapse;
}
div.pmod_multisub > table.probox td.info > table.limitlist td.name{
- width:96px
+ width:76px
}
div.pmod_multisub > table.probox td.info > table.limitlist td.value{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_multisub > table.probox td.info > table.scorelist{
width:100%;
text-align:left;
border-collapse:collapse;
}
-div.pmod_multisub > table.probox td.info > table.scorelist tr.item{
- font-size:16;
-}
div.pmod_multisub > table.probox td.info > table.scorelist th.no,div.pmod_multisub > td.info > table.scorelist td.no{
- width:64px;
+ width:76px;
}
div.pmod_multisub > table.probox td.info > table.scorelist th.score,div.pmod_multisub > td.info > table.scorelist td.score{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_multisub > table.probox td.content{
+ width:978px;
+ margin:0px 0px 0px 6px;
vertical-align:top;
}
+div.pmod_multisub p{
+ text-indent:32px;
+}
diff --git a/toj/pmod/pmod_multisub/pmod_multisub.js b/toj/pmod/pmod_multisub/pmod_multisub.js
index 9cbd7a3..33402d0 100755
--- a/toj/pmod/pmod_multisub/pmod_multisub.js
+++ b/toj/pmod/pmod_multisub/pmod_multisub.js
@@ -1,46 +1,12 @@
-var pmod_multisub = {
- that:null,
- j_page:null,
-
- init:function(that,j_page){
- pmod_multisub.that = that;
- pmod_multisub.j_page = j_page;
-
- that.export_urlchange = function(direct){
- if(direct == 'in'){
- that.fadein(j_page);
-
- $.post('/toj/pmod/pmod_multisub/pmod_multisub.php',{'proid':JSON.stringify(that.proid)},function(res){
- var i;
- var reto;
-
- reto = JSON.parse(res);
- if(reto.redirect != undefined){
- common.pushurl('/toj/pro/' + reto.redirect + '/');
- }else{
- j_page.find('div.main_content').text(reto.main_content);
- index.setcontent($('<span>' + reto.proname + '</span>'));
-
- for(i = 0;i < reto.pro.length;i++){
- pmod_multisub.probox_add(reto.pro[i]);
- }
- }
- });
- }else if(direct == 'out'){
- that.fadeout(j_page);
- }else if(direct == 'same'){
-
- }
- };
- },
- probox_add:function(proo){
+var pmod_multisub = function(that,j_pbox){
+ var probox_add = function(proo){
var i;
var j_probox;
var j_table;
var j_item;
- j_probox = pmod_multisub.j_page.find('table.ori_probox').clone();
+ j_probox = j_pbox.find('table.ori_probox').clone();
j_probox.removeClass('ori_probox');
j_probox.find('td.info > h2.partname').text(proo.partname + ' (' + proo.score + '%)');
@@ -89,10 +55,39 @@ var pmod_multisub = {
}
j_probox.find('td.info > button.submit').on('click',function(e){
- pmod_multisub.that.submit(proo.proid);
+ that.submit(proo.proid);
});
j_probox.show();
- pmod_multisub.j_page.append(j_probox);
+ j_pbox.append(j_probox);
}
+
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ that.fadein(j_pbox);
+
+ $.post('/toj/pmod/pmod_multisub/pmod_multisub.php',{'proid':JSON.stringify(that.proid)},function(res){
+ var i;
+ var reto;
+
+ reto = JSON.parse(res);
+ if(reto.redirect != undefined){
+ com.url_push('/toj/pro/' + reto.redirect + '/');
+ }else{
+ j_pbox.find('div.main_content').html(reto.main_content);
+ index.content_set($('<span>' + reto.proname + '</span>'));
+
+ for(i = 0;i < reto.pro.length;i++){
+ probox_add(reto.pro[i]);
+ }
+
+ MathJax.Hub.Queue(["Typeset",MathJax.Hub,j_pbox[0]]);
+ }
+ });
+ }else if(direct == 'out'){
+ that.fadeout(j_pbox);
+ }
+ };
+
+
};
diff --git a/toj/pmod/pmod_test/pmod_test.css b/toj/pmod/pmod_test/pmod_test.css
index 2cd5bfb..f8a48a6 100755
--- a/toj/pmod/pmod_test/pmod_test.css
+++ b/toj/pmod/pmod_test/pmod_test.css
@@ -1,11 +1,6 @@
div.pmod_test > div.info{
- width:250px;
- height:100%;
- padding:0px 0px 0px 6px;
- position:absolute;
- top:0px;
- left:0px;
- overflow:auto;
+ width:240px;
+ float:left;
}
div.pmod_test > div.info > table.statlist{
width:100%;
@@ -13,10 +8,11 @@ div.pmod_test > div.info > table.statlist{
border-collapse:collapse;
}
div.pmod_test > div.info > table.statlist td.name{
- width:96px;
+ width:76px;
}
div.pmod_test > div.info > table.statlist td.value{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_test > div.info > table.limitlist{
width:100%;
@@ -24,30 +20,29 @@ div.pmod_test > div.info > table.limitlist{
border-collapse:collapse;
}
div.pmod_test > div.info > table.limitlist td.name{
- width:96px
+ width:76px;
}
div.pmod_test > div.info > table.limitlist td.value{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_test > div.info > table.scorelist{
width:100%;
text-align:left;
border-collapse:collapse;
}
-div.pmod_test > div.info > table.scorelist tr.item{
- font-size:16;
-}
div.pmod_test > div.info > table.scorelist th.no,div.pmod_test > div.info > table.scorelist td.no{
- width:64px;
+ width:76px;
}
div.pmod_test > div.info > table.scorelist th.score,div.pmod_test > div.info > table.scorelist td.score{
width:auto;
+ padding:0px 0px 0px 6px;
}
div.pmod_test > div.content{
- height:100%;
- padding:0px 6px 0px 0px;
- position:absolute;
- top:0px;
- left:256px;
- overflow:auto;
+ width:978px;
+ margin:0px 0px 0px 6px;
+ float:left;
+}
+div.pmod_test p{
+ text-indent:32px;
}
diff --git a/toj/pmod/pmod_test/pmod_test.html b/toj/pmod/pmod_test/pmod_test.html
index 10b297b..7f1a1b8 100755
--- a/toj/pmod/pmod_test/pmod_test.html
+++ b/toj/pmod/pmod_test/pmod_test.html
@@ -17,11 +17,11 @@
<h3>限制</h3>
<table class="limitlist">
<tr>
- <td class="name">時間限制</td>
+ <td class="name">執行時間</td>
<td class="value timelimit"></td>
</tr>
<tr>
- <td class="name">記憶體限制</td>
+ <td class="name">記憶體</td>
<td class="value memlimit"></td>
</tr>
</table>
@@ -35,3 +35,4 @@
</table>
</div>
<div class="content"></div>
+<div style="width:100%; height:32px; clear:both;"></div>
diff --git a/toj/pmod/pmod_test/pmod_test.js b/toj/pmod/pmod_test/pmod_test.js
index c691c8a..3f1e577 100755
--- a/toj/pmod/pmod_test/pmod_test.js
+++ b/toj/pmod/pmod_test/pmod_test.js
@@ -1,74 +1,75 @@
-var pmod_test = {
- init:function(that,j_page){
- that.export_urlchange = function(direct){
- if(direct == 'in'){
- that.fadein(j_page);
- j_page.find('div.info > h2.proid').text('ProID:' + that.proid);
- $.post('/toj/pmod/pmod_test/pmod_test.php',{'proid':JSON.stringify(that.proid)},function(res){
- var i;
- var reto;
- var seto;
- var j_table;
- var j_item;
+var pmod_test = function(that,j_pbox){
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ that.fadein(j_pbox);
- if(res[0] != 'E'){
- reto = JSON.parse(res);
- seto = reto.set;
- index.setcontent($('<span>' + that.proname + '</span>'));
- j_page.find('div.content').html(reto.content);
+ j_pbox.find('div.info > h2.proid').text('ProID:' + that.proid);
+ $.post('/toj/pmod/pmod_test/pmod_test.php',{'proid':JSON.stringify(that.proid)},function(res){
+ var i;
+ var reto;
+ var seto;
+ var j_table;
+ var j_item;
- $.post('/toj/php/problem.php',{'action':'get_pro_stat','data':JSON.stringify({'proid':that.proid})},function(res){
- var reto
+ if(res[0] != 'E'){
+ reto = JSON.parse(res);
+ seto = reto.set;
+ index.content_set($('<span>' + that.proname + '</span>'));
+ j_pbox.find('div.content').html(reto.content);
- if(res[0] != 'E'){
- reto = JSON.parse(res);
- j_page.find('div.info > table.statlist td.bscore').text(reto.score);
- if(reto.tried == false){
- j_page.find('div.info > table.statlist td.bscore').css('color','#1C1C1C');
- j_page.find('div.info > table.statlist td.stat').text('未嘗試');
+ $.post('/toj/php/problem.php',{'action':'get_pro_stat','data':JSON.stringify({'proid':that.proid})},function(res){
+ var reto
+
+ if(res[0] != 'E'){
+ reto = JSON.parse(res);
+ j_pbox.find('div.info > table.statlist td.bscore').text(reto.score);
+ if(reto.tried == false){
+ j_pbox.find('div.info > table.statlist td.bscore').css('color','#1C1C1C');
+ j_pbox.find('div.info > table.statlist td.stat').text('未嘗試');
+ }else{
+ if(reto.score < 60){
+ j_pbox.find('div.info > table.statlist td.bscore').css('color','#FF0000');
+ }else if(reto.score < 80){
+ j_pbox.find('div.info > table.statlist td.bscore').css('color','#00FF00');
+ }else if(reto.score < 100){
+ j_pbox.find('div.info > table.statlist td.bscore').css('color','#FFFF00');
}else{
- if(reto.score < 60){
- j_page.find('div.info > table.statlist td.bscore').css('color','#FF0000');
- }else if(reto.score < 80){
- j_page.find('div.info > table.statlist td.bscore').css('color','#00FF00');
- }else if(reto.score < 100){
- j_page.find('div.info > table.statlist td.bscore').css('color','#FFFF00');
- }else{
- j_page.find('div.info > table.statlist td.bscore').css('color','#FFFFFF');
- }
+ j_pbox.find('div.info > table.statlist td.bscore').css('color','#FFFFFF');
+ }
- if(reto.is_ac == true){
- j_page.find('div.info > table.statlist td.stat').text('已通過');
- }else{
- j_page.find('div.info > table.statlist td.stat').text('已嘗試');
- }
+ if(reto.is_ac == true){
+ j_pbox.find('div.info > table.statlist td.stat').text('已通過');
+ }else{
+ j_pbox.find('div.info > table.statlist td.stat').text('已嘗試');
}
}
- });
+ }
+ });
- j_page.find('div.info > table.limitlist td.timelimit').text(seto.timelimit + ' ms');
- j_page.find('div.info > table.limitlist td.memlimit').text(seto.memlimit + ' KB');
+ j_pbox.find('div.info > table.limitlist td.timelimit').text(seto.timelimit + ' ms');
+ j_pbox.find('div.info > table.limitlist td.memlimit').text(seto.memlimit + ' KB');
- j_table = j_page.find('table.scorelist');
- j_table.find('tr.item').remove();
- for(i = 0;i < seto.count;i++){
- j_item = $('<tr class="item"><td class="no"></td><td class="score"></td></tr>');
- j_item.find('td.no').text(i + 1);
- j_item.find('td.score').text(seto.score[i]);
- j_table.append(j_item);
- }
+ j_table = j_pbox.find('table.scorelist');
+ j_table.find('tr.item').remove();
+ for(i = 0;i < seto.count;i++){
+ j_item = $('<tr class="item"><td class="no"></td><td class="score"></td></tr>');
+ j_item.find('td.no').text(i + 1);
+ j_item.find('td.score').text(seto.score[i]);
+ j_table.append(j_item);
}
- });
- }else if(direct == 'out'){
- that.fadeout(j_page);
- }else if(direct == 'same'){
- }
- };
+ MathJax.Hub.Queue(["Typeset",MathJax.Hub,j_pbox[0]]);
+ }
+ });
+ }else if(direct == 'out'){
+ that.fadeout(j_pbox);
+ }
+
+ return 'cont';
+ };
- j_page.find('div.info > button.submit').on('click',function(e){
- that.submit();
- });
- }
+ j_pbox.find('div.info > button.submit').on('click',function(e){
+ that.submit();
+ });
};
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.'}');
?>
diff --git a/toj/sqmod/sqmod_test/sqmod_test.css b/toj/sqmod/sqmod_test/sqmod_test.css
index 52009d2..4680479 100755
--- a/toj/sqmod/sqmod_test/sqmod_test.css
+++ b/toj/sqmod/sqmod_test/sqmod_test.css
@@ -1,54 +1,47 @@
-div.sqmod_test > div.pro_tab > table.prolist{
- width:62%;
- margin:0px 0px 6px 257px;
+div.sqmod_test > div.pro_pbox > table.prolist{
+ width:1060px;
+ margin:0px 0px 6px 164px;
border-collapse:collapse;
text-align:left;
}
-div.sqmod_test > div.pro_tab > table.prolist tr.head{
+div.sqmod_test > div.pro_pbox > table.prolist tr.head{
height:64px;
- font-size:20px;
}
-div.sqmod_test > div.pro_tab > table.prolist tr.item{
+div.sqmod_test > div.pro_pbox > table.prolist tr.item{
height:32px;
border-left:2px solid;
border-color:#1C1C1C;
}
-div.sqmod_test > div.pro_tab > table.prolist tr:hover.item{
+div.sqmod_test > div.pro_pbox > table.prolist tr:hover.item{
background-color:rgba(255,255,255,0.2);
}
-div.sqmod_test > div.pro_tab > table.prolist th.no,div.sqmod_test > div.pro_tab > table.prolist td.no{
- width:96px;
+div.sqmod_test > div.pro_pbox > table.prolist th,div.sqmod_test > div.pro_pbox > table.prolist td{
padding:0px 0px 0px 6px;
}
-div.sqmod_test > div.pro_tab > table.prolist th.name,div.sqmod_test > div.pro_tab > table.prolist td.name{
- width:auto;
-}
-div.sqmod_test > div.pro_tab > table.prolist th.bscore,div.sqmod_test > div.pro_tab > table.prolist td.bscore{
- width:128px;
+div.sqmod_test > div.pro_pbox > table.prolist th.no,div.sqmod_test > div.pro_pbox > table.prolist td.no{
+ width:76px;
}
-div.sqmod_test > div.pro_tab > table.prolist th.team,div.sqmod_test > div.pro_tab > table.prolist td.team{
- width:64px;
- display:none;
+div.sqmod_test > div.pro_pbox > table.prolist th.name,div.sqmod_test > div.pro_pbox > table.prolist td.name{
+ width:auto;
+ padding:0px 0px 0px 0px;
}
-div.sqmod_test > div.pro_tab > table.prolist a.link{
- color:#E9E9E9;
- text-decoration:none;
+div.sqmod_test > div.pro_pbox > table.prolist th.bscore,div.sqmod_test > div.pro_pbox > table.prolist td.bscore{
+ width:76px;
}
-div.sqmod_test > div.pro_tab > table.prolist a:hover.link{
- color:#E0E0E0;
- text-decoration:underline;
+div.sqmod_test > div.pro_pbox > table.prolist th.team,div.sqmod_test > div.pro_pbox > table.prolist td.team{
+ width:76px;
}
-div.sqmod_test > div.pro_tab > table.stat{
- margin:32px 0px 6px 256px;
+div.sqmod_test > div.pro_pbox > table.stat{
+ margin:32px 0px 6px 164px;
border-collapse:collapse;
text-align:left;
}
-div.sqmod_test > div.pro_tab > table.stat tr{
+div.sqmod_test > div.pro_pbox > table.stat tr{
height:32px;
}
-div.sqmod_test > div.pro_tab div.prog_box{
- width:512px;
+div.sqmod_test > div.pro_pbox div.prog_box{
+ width:486px;
height:16px;
background-color:rgba(255,255,255,0.2);
color:#1C1C1C;
@@ -58,7 +51,7 @@ div.sqmod_test > div.pro_tab div.prog_box{
text-align:right;
position:relative;
}
-div.sqmod_test > div.pro_tab div.prog_box > div.pass{
+div.sqmod_test > div.pro_pbox div.prog_box > div.pass{
width:0%;
height:16px;
border-right:rgba(0,255,0,0.8) 2px solid;
@@ -67,7 +60,7 @@ div.sqmod_test > div.pro_tab div.prog_box > div.pass{
left:0%;
overflow:hidden;
}
-div.sqmod_test > div.pro_tab div.prog_box > div.good{
+div.sqmod_test > div.pro_pbox div.prog_box > div.good{
width:0%;
height:16px;
border-right:rgba(255,255,0,0.8) 2px solid;
@@ -76,7 +69,7 @@ div.sqmod_test > div.pro_tab div.prog_box > div.good{
left:0%;
overflow:hidden;
}
-div.sqmod_test > div.pro_tab div.prog_box > div.total{
+div.sqmod_test > div.pro_pbox div.prog_box > div.total{
width:0%;
height:16px;
border-right:rgba(255,255,255,0.8) 2px solid;
@@ -85,7 +78,7 @@ div.sqmod_test > div.pro_tab div.prog_box > div.total{
left:0%;
overflow:hidden;
}
-div.sqmod_test > div.pro_tab div.prog_box > div.prog{
+div.sqmod_test > div.pro_pbox div.prog_box > div.prog{
width:0%;
height:16px;
background-color:rgba(0,0,0,0);
diff --git a/toj/sqmod/sqmod_test/sqmod_test.html b/toj/sqmod/sqmod_test/sqmod_test.html
index 9b93096..14f44dd 100755
--- a/toj/sqmod/sqmod_test/sqmod_test.html
+++ b/toj/sqmod/sqmod_test/sqmod_test.html
@@ -1,19 +1,15 @@
-<div tab="pro" class="common_tab pro_tab">
+<div tab="pro" class="com_pbox pro_pbox">
<table class="prolist">
<tr class="head">
<th class="no">#</th>
<th class="name">題目名稱</th>
<th class="bscore">最佳分數</th>
- <th class="team"><a class="link"></a></th>
- <th class="team"><a class="link"></a></th>
- <th class="team"><a class="link"></a></th>
- <th class="team"><a class="link"></a></th>
</tr>
</table>
<table class="stat">
<tr class="user_prog">
- <td style="width:105px;">個人進度</td>
- <td><div class="prog_box user_prog">
+ <td style="width:76px;">個人進度</td>
+ <td style="padding:0px 0px 0px 6px;"><div class="prog_box user_prog">
<div class="pass"></div>
<div class="good"></div>
<div class="total"></div>
@@ -21,8 +17,8 @@
</div></td>
</tr>
<tr class="team_prog" style="display:none;">
- <td>小組進度</td>
- <td><div class="prog_box team_prog">
+ <td style="width:76px;">小組進度</td>
+ <td style="padding:0px 0px 0px 6px;"><div class="prog_box team_prog">
<div class="pass"></div>
<div class="good"></div>
<div class="total"></div>
diff --git a/toj/sqmod/sqmod_test/sqmod_test.inc.php b/toj/sqmod/sqmod_test/sqmod_test.inc.php
index 3e472e7..f7e5dca 100644
--- a/toj/sqmod/sqmod_test/sqmod_test.inc.php
+++ b/toj/sqmod/sqmod_test/sqmod_test.inc.php
@@ -8,6 +8,37 @@ const SQMODNAME = 'sqmod_test';
const SCOREBOARD_ID_PROBSTAT = 1;
+function score_func($sqid, $proid, $best_score, $best_time, $is_ac, $ac_time, $tries_before_ac, $last_score, $last_status, $tries)
+{
+ $data = get_setting($sqid);
+ $fscore = 0;
+
+ foreach($data->pro as $pro)
+ {
+ if($pro->proid == $proid && $pro->method == 'normal')
+ {
+ $fscore = $pro->score;
+ break;
+ }
+ if($pro->method == 'max')
+ {
+ foreach($pro->config as $cf)
+ {
+ foreach($cf as $sp)
+ {
+ if($sp[0] == $proid)
+ {
+ $fscore = $sp[1];
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ $rscore = $best_score * $fscore / 100;
+ return $rscore;
+}
function get_pro_stat_uid($sqlc, $msqlc, $sqid, $sboard_id, $uid)
{
@@ -15,7 +46,7 @@ function get_pro_stat_uid($sqlc, $msqlc, $sqid, $sboard_id, $uid)
$sq = square::get($sqlc, $sqid);
if(!$sq)die('Eno_such_sq');
- $data = sqlib_scoreboard::get_scoreboard_uid($sqlc, $msqlc, $sqid, $sboard_id, null, $sq->start_time, $sq->end_time, $uid);
+ $data = sqlib_scoreboard::get_scoreboard_uid($sqlc, $msqlc, $sqid, $sboard_id, 'score_func', $sq->start_time, $sq->end_time, $uid);
return $data[0];
}
diff --git a/toj/sqmod/sqmod_test/sqmod_test.js b/toj/sqmod/sqmod_test/sqmod_test.js
index 6d01881..1792b77 100755
--- a/toj/sqmod/sqmod_test/sqmod_test.js
+++ b/toj/sqmod/sqmod_test/sqmod_test.js
@@ -1,46 +1,28 @@
-var sqmod_test = {
- init:function(that,j_page){
- var pro_tab = new class_sqmod_test_pro_tab(that);
-
- that.export_urlchange = function(direct){
- var _in = function(){
- that.fadein(j_page);
-
- that.addtab('pro',pro_tab);
- index.addtab('pro','/toj/sq/' + that.sqid + '/','題目');
-
- _change();
- };
- var _out = function(){
- that.fadeout(j_page);
- index.emptytab();
- that.tab_urlchange(null);
- };
- var _change = function(){
- var tabname;
-
- tabname = common.geturlpart()[2];
- if(!(tabname in that.tab_list)){
- tabname = 'pro';
- common.replaceurl('/toj/sq/' + that.sqid + '/pro/');
- }
- that.tab_urlchange(tabname);
- }
-
- if(direct == 'in'){
- _in();
- }else if(direct == 'out'){
- _out();
- }else if(direct == 'same'){
- _change();
+var sqmod_test = function(that,j_page){
+ var pro_pbox = new class_sqmod_test_pro_pbox(that.sqid,j_page);
+
+ that.node.url_chg = function(direct,url_upart,url_dpart){
+ if(direct == 'in'){
+ index.title_set('TOJ-' + that.sqname);
+
+ index.tab_add('pro','/toj/sq/' + that.sqid + '/','題目');
+
+ if(url_dpart[0] == ''){
+ com.url_update('/toj/sq/' + that.sqid + '/pro/');
+ return 'stop';
}
+ }else if(direct == 'out'){
+ index.tab_empty();
}
- }
+
+ return 'cont';
+ };
+ that.node.child_set(pro_pbox.node);
};
-var class_sqmod_test_pro_tab = function(paobj){
+var class_sqmod_test_pro_pbox = function(sqid,j_page){
var that = this;
- var j_tab = $('#index_page > [page="sq"] > [tab="pro"]');
+ var j_pbox = j_page.find('div.pro_pbox');
var promap = null;
var pro_listset = function(j_item,proo){
@@ -56,13 +38,13 @@ var class_sqmod_test_pro_tab = function(paobj){
j_item.attr('proid',proo.proid);
j_item.find('td.no').text(proo.prono);
- j_a = j_item.find('td.name > a.link');
+ j_a = j_item.find('td.name > a');
j_a.attr('href','/toj/pro/' + proo.proid + '/');
j_a.text(proo.proname);
bscore = proo.bscore;
fscore = proo.full_score;
- j_item.find('td.bscore').text(bscore + ' / ' + fscore);
+ j_item.find('td.bscore').text(Math.floor(bscore) + ' / ' + Math.floor(fscore));
if(proo.tried == false){
j_item.css('border-color','#1C1C1C');
@@ -80,18 +62,18 @@ var class_sqmod_test_pro_tab = function(paobj){
}
}
- j_team = j_item.find('td.team');
- j_team.hide();
+ j_item.find('td.team').remove();
for(i = 0;i < proo.tscore.length;i++){
- $(j_team[i]).text(proo.tscore[i]);
- $(j_team[i]).show();
+ j_team = $('<td class="team"></td>');
+ j_team.text(Math.floor(proo.tscore[i]));
+ j_item.append(j_team);
}
}
};
var pro_listnew = function(proo){
var j_item;
- j_item = $('<tr class="item"><td class="no"></td><td class="name"><a class="link"></a></td><td class="bscore"></td><td class="team"></td><td class="team"></td><td class="team"></td><td class="team"></td></tr>');
+ j_item = $('<tr class="item"><td class="no"></td><td class="name"><a></a></td><td class="bscore"></td></tr>');
pro_listset(j_item,proo);
return j_item;
@@ -105,24 +87,24 @@ var class_sqmod_test_pro_tab = function(paobj){
ratio = baseline.pass_score * 100 / baseline.total_score;
j_prog = j_progbox.find('div.pass');
j_prog.css('width',ratio + '%');
- j_prog.html(baseline.pass_score + '&nbsp');
+ j_prog.html(Math.floor(baseline.pass_score) + '&nbsp');
off += ratio;
ratio = (baseline.good_score - baseline.pass_score) * 100 / baseline.total_score;
j_prog = j_progbox.find('div.good');
j_prog.css('left',off + '%');
j_prog.css('width',ratio + '%');
- j_prog.html(baseline.good_score + '&nbsp');
+ j_prog.html(Math.floor(baseline.good_score) + '&nbsp');
off += ratio;
ratio = 100 - off;
j_prog = j_progbox.find('div.total');
j_prog.css('left',off + '%');
j_prog.css('width',ratio + '%');
- j_prog.html(baseline.total_score + '&nbsp');
+ j_prog.html(Math.floor(baseline.total_score) + '&nbsp');
ratio = totalscore * 100 / baseline.total_score;
j_prog = j_progbox.find('div.prog');
j_prog.css('width',ratio + '%');
- j_prog.html(totalscore + '&nbsp');
+ j_prog.html(Math.floor(totalscore) + '&nbsp');
if(totalscore < baseline.pass_score){
ratio = totalscore / baseline.pass_score;
j_prog.css('background-color','rgba(255,' + Math.round(64 * ratio) + ',0,0.8)');
@@ -141,7 +123,7 @@ var class_sqmod_test_pro_tab = function(paobj){
return;
}
- $.post('/toj/sqmod/sqmod_test/sqmod_test.php',{'action':'get_user_stat','data':JSON.stringify({'sqid':paobj.sqid,'display_team':true})},function(res){
+ $.post('/toj/sqmod/sqmod_test/sqmod_test.php',{'action':'get_user_stat','data':JSON.stringify({'sqid':sqid,'display_team':true})},function(res){
var i;
var j;
@@ -155,6 +137,7 @@ var class_sqmod_test_pro_tab = function(paobj){
var team_total;
var maxscore;
var j_list;
+ var j_head;
var j_team;
var j_a;
var j_item;
@@ -164,15 +147,17 @@ var class_sqmod_test_pro_tab = function(paobj){
team = reto.team;
prostat = reto.prostat;
- j_list = j_tab.find('table.prolist');
+ j_list = j_pbox.find('table.prolist');
if(team != undefined){
- j_team = j_list.find('th.team');
+ j_head = j_list.find('tr.head');
+ j_head.find('th.team').remove();
for(i = 0;i < team.length;i++){
teamo = team[i];
- j_a = j_team.find('a.link');
- $(j_a[i]).attr('href','/toj/user/' + teamo.uid + '/')
- $(j_a[i]).text(teamo.name);
+ j_team = $('<th class="team"><a></a></th>');
+ j_a = j_team.find('a');
+ j_a.attr('href','/toj/user/' + teamo.uid + '/')
+ j_a.text(teamo.name);
for(j = 0;j < teamo.prostat.length;j++){
if(teamo.prostat[j].tried == true){
@@ -182,10 +167,10 @@ var class_sqmod_test_pro_tab = function(paobj){
}
}
- j_team.show();
+ j_head.append(j_team);
}
- j_tab.find('table.stat tr.team_prog').show();
+ j_pbox.find('table.stat tr.team_prog').show();
}
user_total = 0;
@@ -208,22 +193,25 @@ var class_sqmod_test_pro_tab = function(paobj){
team_total += maxscore;
}
- prog_set(j_tab.find('table.stat div.user_prog'),reto.base_line,user_total);
- prog_set(j_tab.find('table.stat div.team_prog'),reto.team_base_line,team_total);
+ prog_set(j_pbox.find('table.stat div.user_prog'),reto.base_line,user_total);
+ prog_set(j_pbox.find('table.stat div.team_prog'),reto.team_base_line,team_total);
setTimeout(prostat_refresh,2000);
}
});
};
- that.__super(paobj);
+ that.node = new vus.node('pro');
- that.urlchange = function(direct){
+ that.__super();
+
+ that.node.url_chg = function(direct,url_upart,url_dpart){
if(direct == 'in'){
- that.fadein(j_tab);
+ index.tab_hl('pro');
+ that.fadein(j_pbox);
refresh_flag = true;
- $.post('/toj/sqmod/sqmod_test/sqmod_test.php',{'action':'get_prolist','data':JSON.stringify({'sqid':paobj.sqid})},function(res){
+ $.post('/toj/sqmod/sqmod_test/sqmod_test.php',{'action':'get_prolist','data':JSON.stringify({'sqid':sqid})},function(res){
var i;
var reto;
var proo;
@@ -234,13 +222,14 @@ var class_sqmod_test_pro_tab = function(paobj){
reto = JSON.parse(res);
promap = new Array;
- j_list = j_tab.find('table.prolist');
+ j_list = j_pbox.find('table.prolist');
+ console.log(j_pbox.length);
for(i = 0;i < reto.length;i++){
proo = reto[i];
proo.bscore = 0;
proo.tscore = new Array;
proo.tried = false;
- if(proo.hidden == false){
+ if(proo.hidden == false || user.level == -1){
promap[proo.proid] = proo;
j_item = pro_listnew(proo);
j_list.append(j_item);
@@ -250,10 +239,12 @@ var class_sqmod_test_pro_tab = function(paobj){
prostat_refresh();
}
});
-
}else if(direct == 'out'){
- that.fadeout(j_tab);
+ index.tab_ll('pro');
+ that.fadeout(j_pbox);
refresh_flag = false;
}
+
+ return 'cont';
};
-}; __extend(class_sqmod_test_pro_tab,class_common_tab);
+}; __extend(class_sqmod_test_pro_pbox,class_com_pbox);
diff --git a/toj/sqmod/sqmod_test/sqmod_test.php b/toj/sqmod/sqmod_test/sqmod_test.php
index 40093e2..1c61362 100755
--- a/toj/sqmod/sqmod_test/sqmod_test.php
+++ b/toj/sqmod/sqmod_test/sqmod_test.php
@@ -8,7 +8,7 @@ require_once('team.inc.php');
require_once('../../php/sqlib_scoreboard.inc.php');
$sqlc = db_connect();
-$msqlc = db_connect('toj_mod');
+$msqlc = db_connect('toj_mod2');
$action = $_POST['action'];
$data = $_POST['data'];
@@ -24,7 +24,7 @@ if($action == 'get_prolist')
if(!sec_is_login())
die('Enot_login');
$uid = intval($_COOKIE['uid']);
- if(square::get_user_relationship($sqlc, $uid, $sqid) != SQUARE_USER_ACTIVE)
+ if(square::get_user_relationship($sqlc, $uid, $sqid) < SQUARE_USER_ACTIVE)
die('Ecannot_view_sq');
$list = square::get_pro_list($sqlc, $sqid);
@@ -44,7 +44,7 @@ if($action == 'get_user_stat')
if(!sec_is_login())
die('Enot_login');
$uid = intval($_COOKIE['uid']);
- if(square::get_user_relationship($sqlc, $uid, $sqid) != SQUARE_USER_ACTIVE)
+ if(square::get_user_relationship($sqlc, $uid, $sqid) < SQUARE_USER_ACTIVE)
die('Ecannot_view_sq');
$data = get_setting($sqid);
diff --git a/toj/sqmod/sqmod_test/sqmod_test_man.php b/toj/sqmod/sqmod_test/sqmod_test_man.php
new file mode 100755
index 0000000..82fe04a
--- /dev/null
+++ b/toj/sqmod/sqmod_test/sqmod_test_man.php
@@ -0,0 +1,174 @@
+<?php
+
+require_once('../../php/common.inc.php');
+require_once('../../php/square.inc.php');
+require_once('../../php/user.inc.php');
+require_once('../../php/sqlib_scoreboard.inc.php');
+require_once('sqmod_test.inc.php');
+
+function get_sprout_data($msqlc, $uid, $term)
+{
+ $sqlstr = 'SELECT * FROM "sqmod_sprout_student" INNER JOIN "sqmod_sprout_team" ON "sqmod_sprout_student"."uid"="sqmod_sprout_team"."uid" WHERE "sqmod_sprout_student"."uid"=$1 AND "sqmod_sprout_team"."term"=$2;';
+ $sqlarr = array($uid, $term);
+ $res = pg_query_params($sqlstr, $sqlarr);
+ $ret = pg_fetch_object($res);
+ return $ret;
+}
+
+function trans_type($type)
+{
+ if($type==1)return '高中男';
+ if($type==2)return '高中女';
+ if($type==3)return '大學生';
+ if($type==4)return '小老師';
+ if($type==5)return '內測員';
+ if($type==6)return '管理員';
+}
+
+function team_cmp($a, $b)
+{
+ if($a->sspd->teamid == $b->sspd->teamid)return ($a->sspd->type < $b->sspd->type);
+ //var_dump($a);
+ //echo($a->sspd->teamid.','.$b->sspd->teamid.'<br>');
+ return $a->sspd->teamid > $b->sspd->teamid;
+}
+
+function get_user_spent_time($sqlc, $sqid, $uid, $start_time = null, $end_time = null)
+{
+ if(!$start_time)$start_time = '1990-01-01 01:01:01';
+ if(!$end_time)$end_time = '2222-02-02 02:02:02';
+ $sqlstr = 'SELECT "submit_time" FROM "submit" WHERE "uid"=$1 AND "submit_time">=$2 AND "submit_time"<$3 AND "proid" IN (SELECT "proid" FROM "pro_sq" WHERE "sqid"=$4) ORDER BY "submit_time";';
+ $sqlarr = array($uid, $start_time, $end_time, $sqid);
+ $res = pg_query_params($sqlc, $sqlstr, $sqlarr);
+ $arr = pg_fetch_all_columns($res, 0);
+ $last_time = 0;
+ $tot_time = 0;
+ $cnt = 0;
+ //return 3;
+ foreach($arr as $str)
+ {
+ $cnt += 1;
+ $time = strtotime($str);
+ //return $time/60;
+ $mid = 10 * 60;
+ $lng = 90 * 60;
+
+ $nl_time = $time + $mid;
+ if($nl_time <= $last_time + $lng)
+ {
+ $tot_time += $nl_time - $last_time;
+ }
+ else
+ {
+ $tot_time += 2 * $mid;
+ }
+
+ $last_time = $nl_time;
+ }
+ return array($tot_time, $cnt);
+}
+
+$sqlc = db_connect();
+$msqlc = db_connect('toj_mod2');
+
+$sqid = intval($_GET['sqid']);
+if(!$sqid)
+ die('Eno_sqid');
+
+$sboard_id = 1;
+$sq = square::get($sqlc, $sqid);
+if(!$sq)
+ die('Eerror_sqid');
+
+$stime = $sq->start_time;
+$etime = $sq->end_time;
+
+$sbdata = sqlib_scoreboard::get_scoreboard($sqlc, $msqlc, $sqid, $sboard_id, 'score_func', $sq->start_time, $sq->end_time, 1, null);
+
+//var_dump($sbdata);
+
+$prol = '';
+foreach($sbdata[0]->problem as $pro)
+{
+ $prol = $prol.'<td align=center width=50>'.$pro->proid.'</td>';
+}
+
+$dt = get_setting($sqid);
+$base = get_base_line($dt, $sqid, false);
+$term = get_term($dt, $sqid);
+
+echo('<meta http-equiv="Content-Type" content="text/html; charset=utf8">');
+echo('<table border = 1>');
+echo('<h align=center><td>rank</td><td>uid</td><td>Nickname</td><td>Name</td><td>StuNo.</td><td>Team</td><td>Type</td><td>Total</td>'.$prol.'<td>Sub.</td><td>Est. Time</td></h>');
+
+$teamsc = array();
+
+foreach($sbdata as $usr)
+{
+ $usr->sspd = get_sprout_data($msqlc, $usr->uid, $term);
+}
+
+if($_GET['sort']=='team')usort($sbdata, 'team_cmp');
+
+foreach($sbdata as $usr)
+{
+ $spd = $usr->sspd;
+ if($_GET['stu_only'] && !($spd->type>=1 && $spd->type<=4))
+ continue;
+ echo('<tr align="center">');
+ echo('<td>'.$usr->rank.'</td>');
+ echo('<td>'.$usr->uid.'</td>');
+ $user = user::get_from_uid($sqlc, $usr->uid);
+ $original_nickname=$user->nickname;
+ if(mb_strlen($user->nickname,'UTF-8')>7){
+ $user->nickname=mb_substr($user->nickname,0,6,'UTF-8').'...';
+ echo('<td title="'.str_replace("!","!",htmlspecialchars($original_nickname)).'">'.$user->nickname.'</td>');
+ } else {
+ echo('<td>'.$user->nickname.'</td>');
+ }
+ echo('<td>'.$spd->name.'</td>');
+ echo('<td>'.$spd->stuno.'</td>');
+ echo('<td>'.$spd->teamid.'</td>');
+ echo('<td>'.trans_type($spd->type).'</td>');
+
+ $color = 'black';
+ if($usr->rank_score >= $base->total_score)$color = 'gray';
+ else if($usr->rank_score >= $base->good_score)$color = 'goldenrod';
+ else if($usr->rank_score >= $base->pass_score)$color = 'limegreen';
+ echo('<td><b><font color="'.$color.'">'.intval($usr->rank_score).'</font></b></td>');
+
+
+ foreach($usr->problem as $pro)
+ {
+ if(!$pro->tries){echo('<td></td>');continue;}
+
+ $clr = 'red';
+ $b = false;
+ if($pro->is_ac){$clr = 'green';$b = true;}
+ else if($pro->best_score>=50)$clr = 'orange';
+ echo('<td><font color="'.$clr.'">'.(b?'<b>':'').intval($pro->rank_score).(b?'</b>':'').'</font></td>');
+ }
+
+ $usr_time = get_user_spent_time($sqlc, $sqid, $usr->uid, $stime, $etime);
+ $uttmin = floor($usr_time[0] / 60);
+ $uttcnt = $usr_time[1];
+ $tm_clr = 'black';
+ $utmin = $uttmin % 60;
+ if($utmin<10)$utmin = '0'.$utmin;
+ $uthr = floor($uttmin/60);
+ if($uthr >= 2)$tm_clr = 'lime';
+ if($uthr >= 6)$tm_clr = 'orange';
+ if($uthr >= 10)$tm_clr = 'red';
+ echo('<td>'.$uttcnt.'</td><td><font color="'.$tm_clr.'">'.$uthr.':'.$utmin.'</font></td>');
+
+
+ echo('</tr>');
+}
+
+echo('</table>');
+
+
+db_close($sqlc);
+db_close($msqlc);
+
+?>