Merge branch 'dev' into hohoTT-dev

This commit is contained in:
hohoTT 2015-08-21 18:19:01 +08:00
commit 9c43fe92ff
22 changed files with 4271 additions and 151 deletions

View File

@ -36,7 +36,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
groups = Group.objects.filter(id__in=data["groups"])
else:
groups = Group.objects.filter(id__in=data["groups"], admin=request.user)
groups = Group.objects.filter(id__in=data["groups"], created_by=request.user)
if not groups.count():
return error_response(u"至少选择一个小组")
else:
@ -75,7 +75,7 @@ class AnnouncementAdminAPIView(APIView):
if request.user.admin_type == SUPER_ADMIN:
groups = Group.objects.filter(id__in=data["groups"])
else:
groups = Group.objects.filter(id__in=data["groups"], admin=request.user)
groups = Group.objects.filter(id__in=data["groups"], created_by=request.user)
if not groups.count():
return error_response(u"至少选择一个小组")
announcement.title = data["title"]

View File

@ -1,10 +1,11 @@
# coding=utf-8
# from __future__ import absolute_import
import datetime
import redis
import MySQLdb
import subprocess
from ..judger.result import result
from ..judger_controller.celery import app
from settings import docker_config, source_code_dir, test_case_dir, submission_db
from settings import docker_config, source_code_dir, test_case_dir, submission_db, redis_config
@app.task
@ -36,3 +37,5 @@ def judge(submission_id, time_limit, memory_limit, test_case_id):
(result["system_error"], str(e), submission_id))
conn.commit()
conn.close()
r = redis.Redis(host=redis_config["host"], port=redis_config["port"], db=redis_config["db"])
r.decr("judge_queue_length")

0
monitor/__init__.py Normal file
View File

19
monitor/views.py Normal file
View File

@ -0,0 +1,19 @@
# coding=utf-8
import redis
import datetime
from rest_framework.views import APIView
from judge.judger.result import result
from judge.judger_controller.settings import redis_config
from utils.shortcuts import success_response
from submission.models import Submission
class QueueLengthMonitorAPIView(APIView):
def get(self, request):
r = redis.Redis(host=redis_config["host"], port=redis_config["port"], db=redis_config["db"])
waiting_number = r.get("judge_queue_length")
if waiting_number is None:
waiting_number = 0
now = datetime.datetime.now()
return success_response({"time": ":".join([str(now.hour), str(now.minute), str(now.second)]),
"count": waiting_number})

View File

@ -17,6 +17,7 @@ from admin.views import AdminTemplateView
from problem.views import TestCaseUploadAPIView, ProblemTagAdminAPIView, ProblemAdminAPIView
from submission.views import SubmissionAPIView, SubmissionAdminAPIView
from monitor.views import QueueLengthMonitorAPIView
urlpatterns = [
@ -62,5 +63,6 @@ urlpatterns = [
name="join_group_request_admin_api"),
url(r'^api/submission/$', SubmissionAPIView.as_view(), name="submission_api"),
url(r'^api/admin/submission/$', SubmissionAdminAPIView.as_view(), name="submission_admin_api_view"),
url(r'^api/admin/monitor/$', QueueLengthMonitorAPIView.as_view(), name="queue_length_monitor_api"),
]

3272
static/src/css/animate/animate.css vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,208 @@
/**
* fullPage 2.6.6
* https://github.com/alvarotrigo/fullPage.js
* MIT licensed
*
* Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo
*/
html.fp-enabled,
.fp-enabled body {
margin: 0;
padding: 0;
overflow:hidden;
/*Avoid flicker on slides transitions for mobile phones #336 */
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
#superContainer {
height: 100%;
position: relative;
/* Touch detection for Windows 8 */
-ms-touch-action: none;
/* IE 11 on Windows Phone 8.1*/
touch-action: none;
}
.fp-section {
position: relative;
-webkit-box-sizing: border-box; /* Safari<=5 Android<=3 */
-moz-box-sizing: border-box; /* <=28 */
box-sizing: border-box;
}
.fp-slide {
float: left;
}
.fp-slide, .fp-slidesContainer {
height: 100%;
display: block;
}
.fp-slides {
z-index:1;
height: 100%;
overflow: hidden;
position: relative;
-webkit-transition: all 0.3s ease-out; /* Safari<=6 Android<=4.3 */
transition: all 0.3s ease-out;
}
.fp-section.fp-table, .fp-slide.fp-table {
display: table;
table-layout:fixed;
width: 100%;
}
.fp-tableCell {
display: table-cell;
vertical-align: middle;
width: 100%;
height: 100%;
}
.fp-slidesContainer {
float: left;
position: relative;
}
.fp-controlArrow {
position: absolute;
z-index: 4;
top: 50%;
cursor: pointer;
width: 0;
height: 0;
border-style: solid;
margin-top: -38px;
-webkit-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.fp-controlArrow.fp-prev {
left: 15px;
width: 0;
border-width: 38.5px 34px 38.5px 0;
border-color: transparent #fff transparent transparent;
}
.fp-controlArrow.fp-next {
right: 15px;
border-width: 38.5px 0 38.5px 34px;
border-color: transparent transparent transparent #fff;
}
.fp-scrollable {
overflow: scroll;
}
.fp-notransition {
-webkit-transition: none !important;
transition: none !important;
}
#fp-nav {
position: fixed;
z-index: 100;
margin-top: -32px;
top: 50%;
opacity: 1;
-webkit-transform: translate3d(0,0,0);
}
#fp-nav.right {
right: 17px;
}
#fp-nav.left {
left: 17px;
}
.fp-slidesNav{
position: absolute;
z-index: 4;
left: 50%;
opacity: 1;
}
.fp-slidesNav.bottom {
bottom: 17px;
}
.fp-slidesNav.top {
top: 17px;
}
#fp-nav ul,
.fp-slidesNav ul {
margin: 0;
padding: 0;
}
#fp-nav ul li,
.fp-slidesNav ul li {
display: block;
width: 14px;
height: 13px;
margin: 7px;
position:relative;
}
.fp-slidesNav ul li {
display: inline-block;
}
#fp-nav ul li a,
.fp-slidesNav ul li a {
display: block;
position: relative;
z-index: 1;
width: 100%;
height: 100%;
cursor: pointer;
text-decoration: none;
}
#fp-nav ul li a.active span,
.fp-slidesNav ul li a.active span,
#fp-nav ul li:hover a.active span,
.fp-slidesNav ul li:hover a.active span{
height: 12px;
width: 12px;
margin: -6px 0 0 -6px;
border-radius: 100%;
}
#fp-nav ul li a span,
.fp-slidesNav ul li a span {
border-radius: 50%;
position: absolute;
z-index: 1;
height: 4px;
width: 4px;
border: 0;
background: #333;
left: 50%;
top: 50%;
margin: -2px 0 0 -2px;
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
#fp-nav ul li:hover a span,
.fp-slidesNav ul li:hover a span{
width: 10px;
height: 10px;
margin: -5px 0px 0px -5px;
}
#fp-nav ul li .fp-tooltip {
position: absolute;
top: -2px;
color: #fff;
font-size: 14px;
font-family: arial, helvetica, sans-serif;
white-space: nowrap;
max-width: 220px;
overflow: hidden;
display: block;
opacity: 0;
width: 0;
}
#fp-nav ul li:hover .fp-tooltip,
#fp-nav.fp-show-active a.active + .fp-tooltip {
-webkit-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
width: auto;
opacity: 1;
}
#fp-nav ul li .fp-tooltip.right {
right: 20px;
}
#fp-nav ul li .fp-tooltip.left {
left: 20px;
}
.fp-auto-height.fp-section,
.fp-auto-height .fp-slide,
.fp-auto-height .fp-tableCell{
height: auto !important;
}

BIN
static/src/img/index/a.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
static/src/img/index/c.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
static/src/img/index/m.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -21,43 +21,110 @@ define("admin", ["jquery", "avalon"], function ($, avalon) {
hash = "index/index";
}
var superAdminNav = [
{ name: "首页",
children: [{name: "主页", hash: "#index/index"},
{name: "监控", hash: "#monitor/monitor"},
{name: "统计", hash: "#statistics/statistics"}]
},
{
name: "通用",
children: [{name: "公告管理", hash: "#announcement/announcement"},
{name: "用户管理", hash: "#user/user_list"}]
},
{
name: "题目管理",
children: [{name: "题目列表", hash: "#problem/problem_list"},
{name: "创建题目", hash: "#problem/add_problem"}]
},
{
name: "比赛管理",
children: [{name: "比赛列表", hash: "#contest/contest_list"},
{name: "创建比赛", hash: "#contest/add_contest"}]
},
{
name: "小组管理",
children: [{name: "小组列表", hash: "#group/group"},
{name: "加入小组请求", hash: "#group/join_group_request_list"}]
}
];
var adminNav = [
{ name: "首页",
children: [{name: "主页", hash: "#index/index"}]
},
{
name: "通用",
children: [{name: "公告管理", hash: "#announcement/announcement"}]
},
{
name: "比赛管理",
children: [{name: "比赛列表", hash: "#contest/contest_list"},
{name: "创建比赛", hash: "#contest/add_contest"}]
},
{
name: "小组管理",
children: [{name: "小组列表", hash: "#group/group"},
{name: "加入小组请求", hash: "#group/join_group_request_list"}]
}
];
var vm = avalon.define({
$id: "admin",
template_url: "template/" + hash + ".html",
groupId: -1,
problemId: -1,
adminNavList: [],
hide_loading: function () {
$("#loading-gif").hide();
},
getLiId: function(hash){
return hash.replace("#", "li-").replace("/", "-");
}
});
vm.$watch("showGroupDetailPage", function(groupId){
$.ajax({
url: "/api/user/",
method: "get",
dataType: "json",
success: function(data){
if(!data.code){
if (data.data.admin_type == 2){
vm.adminNavList = superAdminNav;
}
else{
vm.adminNavList = adminNav;
}
}
}
});
vm.$watch("showGroupDetailPage", function (groupId) {
vm.groupId = groupId;
vm.template_url = "template/group/group_detail.html";
});
vm.$watch("showEditProblemPage", function(problemId){
vm.$watch("showEditProblemPage", function (problemId) {
vm.problemId = problemId;
vm.template_url = "template/problem/edit_problem.html";
});
vm.$watch("showProblemListPage", function(){
vm.template_url = "template/problem/problem_list.html";
vm.$watch("showProblemListPage", function () {
vm.template_url = "template/problem/problem_list.html";
});
vm.$watch("showGroupListPage", function(){
vm.template_url = "template/group/group.html";
vm.$watch("showGroupListPage", function () {
vm.template_url = "template/group/group.html";
});
vm.$watch("showProblemSubmissionPage", function(problemId){
vm.$watch("showProblemSubmissionPage", function (problemId) {
vm.problemId = problemId;
vm.template_url = "template/problem/submission_list.html";
});
avalon.scan();
li_active("#li-" + hash.replace("/", "-"));
window.onhashchange = function () {
var hash = window.location.hash.substring(1);
if (hash) {
@ -66,6 +133,7 @@ define("admin", ["jquery", "avalon"], function ($, avalon) {
show_template("template/" + hash + ".html");
}
};
setTimeout(function(){li_active("#li-" + hash.replace("/", "-"));}, 500)
});

View File

@ -1,80 +1,42 @@
require(["jquery", "chart"], function ($, Chart) {
var data2 = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "2222222",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
}
]
};
new Chart($("#waiting-queue-chart").get(0).getContext("2d")).Line(data2);
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
labels: ["初始化"],
datasets: [
{
label: "11111111",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(250,68,68,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
},
{
label: "2222222",
label: "队列长度",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
data: [0]
}
]
};
Chart.defaults.global.responsive = true;
new Chart($("#judge-instance-chart").get(0).getContext("2d")).Line(data);
var chart = new Chart($("#waiting-queue-chart").get(0).getContext("2d")).Line(data);
var data1 = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "2222222",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
},
{
label: "2222222",
fillColor: "rgba(255,255,255,0.2)",
strokeColor: "rgba(252,214,48,1)",
pointColor: "rgba(252,214,48,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [30, 70, 58, 49, 19, 44, 100, 100, 89, 88, 77, 50, 80, 66, 100]
function getMonitorData(){
var hash = location.hash;
if (hash != "#monitor/monitor"){
clearInterval(intervalId);
}
$.ajax({
url: "/api/admin/monitor/",
method: "get",
dataType: "json",
success: function(data){
if(!data.code){
chart.addData([data.data["count"]], data.data["time"])
}
}
]
};
Chart.defaults.global.responsive = true;
new Chart($("#c1").get(0).getContext("2d")).Line(data1);
})
}
$("#clear-chart-data").click(function(){
chart.removeData();
});
var intervalId = setInterval(getMonitorData, 3000);
});

View File

@ -0,0 +1,56 @@
/*!
* fullPage 2.6.9
* https://github.com/alvarotrigo/fullPage.js
* @license MIT licensed
*
* Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo
*/
(function(c,m){"function"===typeof define&&define.amd?define(["jquery"],function(l){return m(l,c,c.document,c.Math)}):"undefined"!==typeof exports?module.exports=m(require("jquery"),c,c.document,c.Math):m(jQuery,c,c.document,c.Math)})("undefined"!==typeof window?window:this,function(c,m,l,p,H){var n=c(m),w=c(l);c.fn.fullpage=function(d){function Ka(){h.css({height:"100%",position:"relative"});h.addClass("fullpage-wrapper");c("html").addClass("fp-enabled");d.css3&&(d.css3=La());d.anchors.length||(d.anchors=
c("[data-anchor]").map(function(){return c(this).data("anchor").toString()}).get());e.setAllowScrolling(!0);h.removeClass("fp-destroyed");Ma();c(".fp-section").each(function(a){var b=c(this),e=b.find(".fp-slide"),h=e.length;a||0!==c(".fp-section.active").length||b.addClass("active");b.css("height",r+"px");d.paddingTop&&b.css("padding-top",d.paddingTop);d.paddingBottom&&b.css("padding-bottom",d.paddingBottom);"undefined"!==typeof d.sectionsColor[a]&&b.css("background-color",d.sectionsColor[a]);"undefined"!==
typeof d.anchors[a]&&(b.attr("data-anchor",d.anchors[a]),b.hasClass("active")&&I(d.anchors[a],a));d.menu&&d.css3&&c(d.menu).closest(".fullpage-wrapper").length&&c(d.menu).appendTo(q);0<h?Na(b,e,h):d.verticalCentered&&ia(b)});e.setAutoScrolling(d.autoScrolling,"internal");var a=c(".fp-section.active").find(".fp-slide.active");a.length&&(0!==c(".fp-section.active").index(".fp-section")||0===c(".fp-section.active").index(".fp-section")&&0!==a.index())&&U(a);d.fixedElements&&d.css3&&c(d.fixedElements).appendTo(q);
d.navigation&&Oa();d.scrollOverflow?("complete"===l.readyState&&ja(),n.on("load",ja)):ka();la();if(!d.animateAnchor&&(a=m.location.hash.replace("#","").split("/")[0],a.length)){var b=c('[data-anchor="'+a+'"]');b.length&&(d.autoScrolling?x(b.position().top):(x(0),t.scrollTop(b.position().top)),I(a,null),c.isFunction(d.afterLoad)&&d.afterLoad.call(b,a,b.index(".fp-section")+1),b.addClass("active").siblings().removeClass("active"))}ma();n.on("load",function(){var a=m.location.hash.replace("#","").split("/"),
b=a[0],a=a[1];b&&V(b,a)})}function Na(a,b,g){var f=100*g,e=100/g;b.wrapAll('<div class="fp-slidesContainer" />');b.parent().wrap('<div class="fp-slides" />');a.find(".fp-slidesContainer").css("width",f+"%");1<g&&(d.controlArrows&&Pa(a),d.slidesNavigation&&Qa(a,g));b.each(function(a){c(this).css("width",e+"%");d.verticalCentered&&ia(c(this))});a=a.find(".fp-slide.active");a.length?U(a):b.eq(0).addClass("active")}function Ma(){c(d.sectionSelector).each(function(){c(this).addClass("fp-section")});c(d.slideSelector).each(function(){c(this).addClass("fp-slide")})}
function Pa(a){a.find(".fp-slides").after('<div class="fp-controlArrow fp-prev"></div><div class="fp-controlArrow fp-next"></div>');"#fff"!=d.controlArrowColor&&(a.find(".fp-controlArrow.fp-next").css("border-color","transparent transparent transparent "+d.controlArrowColor),a.find(".fp-controlArrow.fp-prev").css("border-color","transparent "+d.controlArrowColor+" transparent transparent"));d.loopHorizontal||a.find(".fp-controlArrow.fp-prev").hide()}function Oa(){q.append('<div id="fp-nav"><ul></ul></div>');
var a=c("#fp-nav");a.addClass(function(){return d.showActiveTooltip?"fp-show-active "+d.navigationPosition:d.navigationPosition});for(var b=0;b<c(".fp-section").length;b++){var g="";d.anchors.length&&(g=d.anchors[b]);var g='<li><a href="#'+g+'"><span></span></a>',f=d.navigationTooltips[b];"undefined"!==typeof f&&""!==f&&(g+='<div class="fp-tooltip '+d.navigationPosition+'">'+f+"</div>");g+="</li>";a.find("ul").append(g)}c("#fp-nav").css("margin-top","-"+c("#fp-nav").height()/2+"px");c("#fp-nav").find("li").eq(c(".fp-section.active").index(".fp-section")).find("a").addClass("active")}
function ja(){c(".fp-section").each(function(){var a=c(this).find(".fp-slide");a.length?a.each(function(){J(c(this))}):J(c(this))});ka()}function ka(){var a=c(".fp-section.active"),b=a.find("SLIDES_WRAPPER"),g=a.find(".fp-scrollable");b.length&&(g=b.find(".fp-slide.active"));g.mouseover();K(a);na(a);c.isFunction(d.afterLoad)&&d.afterLoad.call(a,a.data("anchor"),a.index(".fp-section")+1);c.isFunction(d.afterRender)&&d.afterRender.call(h)}function oa(){var a;if(!d.autoScrolling||d.scrollBar){for(var b=
n.scrollTop(),g=0,f=p.abs(b-l.querySelectorAll(".fp-section")[0].offsetTop),e=l.querySelectorAll(".fp-section"),h=0;h<e.length;++h){var k=p.abs(b-e[h].offsetTop);k<f&&(g=h,f=k)}a=c(e).eq(g)}if(!d.autoScrolling||d.scrollBar){if(!a.hasClass("active")){W=!0;b=c(".fp-section.active");g=b.index(".fp-section")+1;f=X(a);e=a.data("anchor");h=a.index(".fp-section")+1;k=a.find(".fp-slide.active");if(k.length)var m=k.data("anchor"),q=k.index();y&&(a.addClass("active").siblings().removeClass("active"),c.isFunction(d.onLeave)&&
d.onLeave.call(b,g,h,f),c.isFunction(d.afterLoad)&&d.afterLoad.call(a,e,h),K(a),I(e,h-1),d.anchors.length&&(A=e,Y(q,m,e,h)));clearTimeout(Z);Z=setTimeout(function(){W=!1},100)}d.fitToSection&&(clearTimeout(aa),aa=setTimeout(function(){y&&(c(".fp-section.active").is(a)&&(v=!0),B(a),v=!1)},d.fitToSectionDelay))}}function pa(a){return a.find(".fp-slides").length?a.find(".fp-slide.active").find(".fp-scrollable"):a.find(".fp-scrollable")}function L(a,b){if(k.m[a]){var d,c;"down"==a?(d="bottom",c=e.moveSectionDown):
(d="top",c=e.moveSectionUp);if(0<b.length)if(d="top"===d?!b.scrollTop():"bottom"===d?b.scrollTop()+1+b.innerHeight()>=b[0].scrollHeight:void 0,d)c();else return!0;else c()}}function Ra(a){var b=a.originalEvent;if(!qa(a.target)&&ba(b)){d.autoScrolling&&a.preventDefault();a=c(".fp-section.active");var g=pa(a);y&&!z&&(b=ra(b),D=b.y,M=b.x,a.find(".fp-slides").length&&p.abs(N-M)>p.abs(E-D)?p.abs(N-M)>n.width()/100*d.touchSensitivity&&(N>M?k.m.right&&e.moveSlideRight():k.m.left&&e.moveSlideLeft()):d.autoScrolling&&
p.abs(E-D)>n.height()/100*d.touchSensitivity&&(E>D?L("down",g):D>E&&L("up",g)))}}function qa(a,b){b=b||0;var g=c(a).parent();return b<d.normalScrollElementTouchThreshold&&g.is(d.normalScrollElements)?!0:b==d.normalScrollElementTouchThreshold?!1:qa(g,++b)}function ba(a){return"undefined"===typeof a.pointerType||"mouse"!=a.pointerType}function Sa(a){a=a.originalEvent;d.fitToSection&&t.stop();ba(a)&&(a=ra(a),E=a.y,N=a.x)}function sa(a,b){for(var d=0,c=a.slice(p.max(a.length-b,1)),e=0;e<c.length;e++)d+=
c[e];return p.ceil(d/b)}function u(a){var b=(new Date).getTime();if(d.autoScrolling&&!O){a=a||m.event;var g=a.wheelDelta||-a.deltaY||-a.detail,f=p.max(-1,p.min(1,g));149<C.length&&C.shift();C.push(p.abs(g));d.scrollBar&&(a.preventDefault?a.preventDefault():a.returnValue=!1);a=c(".fp-section.active");a=pa(a);g=b-ta;ta=b;200<g&&(C=[]);y&&(b=sa(C,10),g=sa(C,70),b>=g&&(0>f?L("down",a):L("up",a)));return!1}d.fitToSection&&t.stop()}function ua(a){var b=c(".fp-section.active").find(".fp-slides"),g=b.find(".fp-slide").length;
if(!(!b.length||z||2>g)){var g=b.find(".fp-slide.active"),f=null,f="prev"===a?g.prev(".fp-slide"):g.next(".fp-slide");if(!f.length){if(!d.loopHorizontal)return;f="prev"===a?g.siblings(":last"):g.siblings(":first")}z=!0;F(b,f)}}function va(){c(".fp-slide.active").each(function(){U(c(this),"internal")})}function B(a,b,g){requestAnimFrame(function(){var f=a.position();if("undefined"!==typeof f){var e=a.hasClass("fp-auto-height")?f.top-r+a.height():f.top,f={element:a,callback:b,isMovementUp:g,dest:f,
dtop:e,yMovement:X(a),anchorLink:a.data("anchor"),sectionIndex:a.index(".fp-section"),activeSlide:a.find(".fp-slide.active"),activeSection:c(".fp-section.active"),leavingSection:c(".fp-section.active").index(".fp-section")+1,localIsResizing:v};if(!(f.activeSection.is(a)&&!v||d.scrollBar&&n.scrollTop()===f.dtop)){if(f.activeSlide.length)var h=f.activeSlide.data("anchor"),k=f.activeSlide.index();d.autoScrolling&&d.continuousVertical&&"undefined"!==typeof f.isMovementUp&&(!f.isMovementUp&&"up"==f.yMovement||
f.isMovementUp&&"down"==f.yMovement)&&(f.isMovementUp?c(".fp-section.active").before(f.activeSection.nextAll(".fp-section")):c(".fp-section.active").after(f.activeSection.prevAll(".fp-section").get().reverse()),x(c(".fp-section.active").position().top),va(),f.wrapAroundElements=f.activeSection,f.dest=f.element.position(),f.dtop=f.dest.top,f.yMovement=X(f.element));if(c.isFunction(d.onLeave)&&!f.localIsResizing){if(!1===d.onLeave.call(f.activeSection,f.leavingSection,f.sectionIndex+1,f.yMovement))return;
Ta(f.activeSection)}a.addClass("active").siblings().removeClass("active");y=!1;Y(k,h,f.anchorLink,f.sectionIndex);Ua(f);A=f.anchorLink;I(f.anchorLink,f.sectionIndex)}}})}function Ua(a){if(d.css3&&d.autoScrolling&&!d.scrollBar)wa("translate3d(0px, -"+a.dtop+"px, 0px)",!0),d.scrollingSpeed?ca=setTimeout(function(){da(a)},d.scrollingSpeed):da(a);else{var b=Va(a);c(b.element).animate(b.options,d.scrollingSpeed,d.easing).promise().done(function(){da(a)})}}function Va(a){var b={};d.autoScrolling&&!d.scrollBar?
(b.options={top:-a.dtop},b.element=".fullpage-wrapper"):(b.options={scrollTop:a.dtop},b.element="html, body");return b}function da(a){a.wrapAroundElements&&a.wrapAroundElements.length&&(a.isMovementUp?c(".fp-section:first").before(a.wrapAroundElements):c(".fp-section:last").after(a.wrapAroundElements),x(c(".fp-section.active").position().top),va());a.element.find(".fp-scrollable").mouseover();c.isFunction(d.afterLoad)&&!a.localIsResizing&&d.afterLoad.call(a.element,a.anchorLink,a.sectionIndex+1);
K(a.element);na(a.element);y=!0;c.isFunction(a.callback)&&a.callback.call(this)}function K(a){var b=a.find(".fp-slide.active");b.length&&(a=c(b));a.find("img[data-src], source[data-src], audio[data-src]").each(function(){c(this).attr("src",c(this).data("src"));c(this).removeAttr("data-src");c(this).is("source")&&c(this).closest("video").get(0).load()})}function na(a){a.find("video, audio").each(function(){var a=c(this).get(0);a.hasAttribute("autoplay")&&"function"===typeof a.play&&a.play()})}function Ta(a){a.find("video, audio").each(function(){var a=
c(this).get(0);a.hasAttribute("data-ignore")||"function"!==typeof a.pause||a.pause()})}function xa(){if(!W&&!d.lockAnchors){var a=m.location.hash.replace("#","").split("/"),b=a[0],a=a[1];if(b.length){var c="undefined"===typeof A,f="undefined"===typeof A&&"undefined"===typeof a&&!z;(b&&b!==A&&!c||f||!z&&ea!=a)&&V(b,a)}}}function Wa(a){y&&(a.pageY<P?e.moveSectionUp():a.pageY>P&&e.moveSectionDown());P=a.pageY}function F(a,b){var g=b.position(),f=b.index(),e=a.closest(".fp-section"),h=e.index(".fp-section"),
k=e.data("anchor"),l=e.find(".fp-slidesNav"),m=ya(b),n=v;if(d.onSlideLeave){var q=e.find(".fp-slide.active"),r=q.index(),t;t=r==f?"none":r>f?"left":"right";if(!n&&"none"!==t&&c.isFunction(d.onSlideLeave)&&!1===d.onSlideLeave.call(q,k,h+1,r,t,f)){z=!1;return}}b.addClass("active").siblings().removeClass("active");K(b);!d.loopHorizontal&&d.controlArrows&&(e.find(".fp-controlArrow.fp-prev").toggle(0!==f),e.find(".fp-controlArrow.fp-next").toggle(!b.is(":last-child")));e.hasClass("active")&&Y(f,m,k,h);
var u=function(){n||c.isFunction(d.afterSlideLoad)&&d.afterSlideLoad.call(b,k,h+1,m,f);z=!1};d.css3?(g="translate3d(-"+p.round(g.left)+"px, 0px, 0px)",za(a.find(".fp-slidesContainer"),0<d.scrollingSpeed).css(Aa(g)),fa=setTimeout(function(){u()},d.scrollingSpeed,d.easing)):a.animate({scrollLeft:p.round(g.left)},d.scrollingSpeed,d.easing,function(){u()});l.find(".active").removeClass("active");l.find("li").eq(f).find("a").addClass("active")}function Ba(){la();if(Q){var a=c(l.activeElement);a.is("textarea")||
a.is("input")||a.is("select")||(a=n.height(),p.abs(a-ga)>20*p.max(ga,a)/100&&(e.reBuild(!0),ga=a))}else clearTimeout(ha),ha=setTimeout(function(){e.reBuild(!0)},350)}function la(){var a=d.responsive||d.responsiveWidth,b=d.responsiveHeight;a&&e.setResponsive(n.width()<a);b&&(h.hasClass("fp-responsive")||e.setResponsive(n.height()<b))}function za(a){var b="all "+d.scrollingSpeed+"ms "+d.easingcss3;a.removeClass("fp-notransition");return a.css({"-webkit-transition":b,transition:b})}function Xa(a,b){if(825>
a||900>b){var d=p.min(100*a/825,100*b/900).toFixed(2);q.css("font-size",d+"%")}else q.css("font-size","100%")}function I(a,b){d.menu&&(c(d.menu).find(".active").removeClass("active"),c(d.menu).find('[data-menuanchor="'+a+'"]').addClass("active"));d.navigation&&(c("#fp-nav").find(".active").removeClass("active"),a?c("#fp-nav").find('a[href="#'+a+'"]').addClass("active"):c("#fp-nav").find("li").eq(b).find("a").addClass("active"))}function X(a){var b=c(".fp-section.active").index(".fp-section");a=a.index(".fp-section");
return b==a?"none":b>a?"up":"down"}function J(a){a.css("overflow","hidden");var b=a.closest(".fp-section"),c=a.find(".fp-scrollable"),f;c.length?f=c.get(0).scrollHeight:(f=a.get(0).scrollHeight,d.verticalCentered&&(f=a.find(".fp-tableCell").get(0).scrollHeight));b=r-parseInt(b.css("padding-bottom"))-parseInt(b.css("padding-top"));f>b?c.length?c.css("height",b+"px").parent().css("height",b+"px"):(d.verticalCentered?a.find(".fp-tableCell").wrapInner('<div class="fp-scrollable" />'):a.wrapInner('<div class="fp-scrollable" />'),
a.find(".fp-scrollable").slimScroll({allowPageScroll:!0,height:b+"px",size:"10px",alwaysVisible:!0})):Ca(a);a.css("overflow","")}function Ca(a){a.find(".fp-scrollable").children().first().unwrap().unwrap();a.find(".slimScrollBar").remove();a.find(".slimScrollRail").remove()}function ia(a){a.addClass("fp-table").wrapInner('<div class="fp-tableCell" style="height:'+Da(a)+'px;" />')}function Da(a){var b=r;if(d.paddingTop||d.paddingBottom)b=a,b.hasClass("fp-section")||(b=a.closest(".fp-section")),a=parseInt(b.css("padding-top"))+
parseInt(b.css("padding-bottom")),b=r-a;return b}function wa(a,b){b?za(h):h.addClass("fp-notransition");h.css(Aa(a));setTimeout(function(){h.removeClass("fp-notransition")},10)}function Ea(a){var b=c('.fp-section[data-anchor="'+a+'"]');b.length||(b=c(".fp-section").eq(a-1));return b}function V(a,b){var d=Ea(a);"undefined"===typeof b&&(b=0);a===A||d.hasClass("active")?Fa(d,b):B(d,function(){Fa(d,b)})}function Fa(a,b){if("undefined"!==typeof b){var d=a.find(".fp-slides"),c;c=a.find(".fp-slides");var e=
c.find('.fp-slide[data-anchor="'+b+'"]');e.length||(e=c.find(".fp-slide").eq(b));c=e;c.length&&F(d,c)}}function Qa(a,b){a.append('<div class="fp-slidesNav"><ul></ul></div>');var c=a.find(".fp-slidesNav");c.addClass(d.slidesNavPosition);for(var f=0;f<b;f++)c.find("ul").append('<li><a href="#"><span></span></a></li>');c.css("margin-left","-"+c.width()/2+"px");c.find("li").first().find("a").addClass("active")}function Y(a,b,c,f){f="";d.anchors.length&&!d.lockAnchors&&(a?("undefined"!==typeof c&&(f=c),
"undefined"===typeof b&&(b=a),ea=b,Ga(f+"/"+b)):("undefined"!==typeof a&&(ea=b),Ga(c)));ma()}function Ga(a){if(d.recordHistory)location.hash=a;else if(Q||R)history.replaceState(H,H,"#"+a);else{var b=m.location.href.split("#")[0];m.location.replace(b+"#"+a)}}function ya(a){var b=a.data("anchor");a=a.index();"undefined"===typeof b&&(b=a);return b}function ma(){var a=c(".fp-section.active"),b=a.find(".fp-slide.active"),e=a.data("anchor"),f=ya(b),a=a.index(".fp-section"),a=String(a);d.anchors.length&&
(a=e);b.length&&(a=a+"-"+f);a=a.replace("/","-").replace("#","");q[0].className=q[0].className.replace(RegExp("\\b\\s?fp-viewing-[^\\s]+\\b","g"),"");q.addClass("fp-viewing-"+a)}function La(){var a=l.createElement("p"),b,d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};l.body.insertBefore(a,null);for(var c in d)a.style[c]!==H&&(a.style[c]="translate3d(1px,1px,1px)",b=m.getComputedStyle(a).getPropertyValue(d[c]));
l.body.removeChild(a);return b!==H&&0<b.length&&"none"!==b}function Ya(){if(Q||R){var a=Ha();c(".fullpage-wrapper").off("touchstart "+a.down).on("touchstart "+a.down,Sa);c(".fullpage-wrapper").off("touchmove "+a.move).on("touchmove "+a.move,Ra)}}function Za(){if(Q||R){var a=Ha();c(".fullpage-wrapper").off("touchstart "+a.down);c(".fullpage-wrapper").off("touchmove "+a.move)}}function Ha(){return m.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"}}function ra(a){var b=
[];b.y="undefined"!==typeof a.pageY&&(a.pageY||a.pageX)?a.pageY:a.touches[0].pageY;b.x="undefined"!==typeof a.pageX&&(a.pageY||a.pageX)?a.pageX:a.touches[0].pageX;R&&ba(a)&&d.scrollBar&&(b.y=a.touches[0].pageY,b.x=a.touches[0].pageX);return b}function U(a,b){e.setScrollingSpeed(0,"internal");"undefined"!==typeof b&&(v=!0);F(a.closest(".fp-slides"),a);"undefined"!==typeof b&&(v=!1);e.setScrollingSpeed(G.scrollingSpeed,"internal")}function x(a){d.scrollBar?h.scrollTop(a):d.css3?wa("translate3d(0px, -"+
a+"px, 0px)",!1):h.css("top",-a)}function Aa(a){return{"-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,transform:a}}function Ia(a,b,c){switch(b){case "up":k[c].up=a;break;case "down":k[c].down=a;break;case "left":k[c].left=a;break;case "right":k[c].right=a;break;case "all":"m"==c?e.setAllowScrolling(a):e.setKeyboardScrolling(a)}}function $a(){x(0);c("#fp-nav, .fp-slidesNav, .fp-controlArrow").remove();c(".fp-section").css({height:"","background-color":"",padding:""});c(".fp-slide").css({width:""});
h.css({height:"",position:"","-ms-touch-action":"","touch-action":""});t.css({overflow:"",height:""});c("html").removeClass("fp-enabled");c.each(q.get(0).className.split(/\s+/),function(a,b){0===b.indexOf("fp-viewing")&&q.removeClass(b)});c(".fp-section, .fp-slide").each(function(){Ca(c(this));c(this).removeClass("fp-table active")});h.addClass("fp-notransition");h.find(".fp-tableCell, .fp-slidesContainer, .fp-slides").each(function(){c(this).replaceWith(this.childNodes)});t.scrollTop(0)}function S(a,
b,c){d[a]=b;"internal"!==c&&(G[a]=b)}function T(a,b){console&&console[a]&&console[a]("fullPage: "+b)}var t=c("html, body"),q=c("body"),e=c.fn.fullpage;d=c.extend({menu:!1,anchors:[],lockAnchors:!1,navigation:!1,navigationPosition:"right",navigationTooltips:[],showActiveTooltip:!1,slidesNavigation:!1,slidesNavPosition:"bottom",scrollBar:!1,css3:!0,scrollingSpeed:700,autoScrolling:!0,fitToSection:!0,fitToSectionDelay:1E3,easing:"easeInOutCubic",easingcss3:"ease",loopBottom:!1,loopTop:!1,loopHorizontal:!0,
continuousVertical:!1,normalScrollElements:null,scrollOverflow:!1,touchSensitivity:5,normalScrollElementTouchThreshold:5,keyboardScrolling:!0,animateAnchor:!0,recordHistory:!0,controlArrows:!0,controlArrowColor:"#fff",verticalCentered:!0,resize:!1,sectionsColor:[],paddingTop:0,paddingBottom:0,fixedElements:null,responsive:0,responsiveWidth:0,responsiveHeight:0,sectionSelector:".section",slideSelector:".slide",afterLoad:null,onLeave:null,afterRender:null,afterResize:null,afterReBuild:null,afterSlideLoad:null,
onSlideLeave:null},d);(function(){d.continuousVertical&&(d.loopTop||d.loopBottom)&&(d.continuousVertical=!1,T("warn","Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled"));d.scrollBar&&d.scrollOverflow&&T("warn","Option `scrollBar` is mutually exclusive with `scrollOverflow`. Sections with scrollOverflow might not work well in Firefox");d.continuousVertical&&d.scrollBar&&(d.continuousVertical=!1,T("warn","Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled"));
c.each(d.anchors,function(a,b){(c("#"+b).length||c('[name="'+b+'"]').length)&&T("error","data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).")})})();c.extend(c.easing,{easeInOutCubic:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c}});c.extend(c.easing,{easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c}});e.setAutoScrolling=function(a,b){S("autoScrolling",a,b);var g=c(".fp-section.active");d.autoScrolling&&!d.scrollBar?
(t.css({overflow:"hidden",height:"100%"}),e.setRecordHistory(d.recordHistory,"internal"),h.css({"-ms-touch-action":"none","touch-action":"none"}),g.length&&x(g.position().top)):(t.css({overflow:"visible",height:"initial"}),e.setRecordHistory(!1,"internal"),h.css({"-ms-touch-action":"","touch-action":""}),x(0),g.length&&t.scrollTop(g.position().top))};e.setRecordHistory=function(a,b){S("recordHistory",a,b)};e.setScrollingSpeed=function(a,b){S("scrollingSpeed",a,b)};e.setFitToSection=function(a,b){S("fitToSection",
a,b)};e.setLockAnchors=function(a){d.lockAnchors=a};e.setMouseWheelScrolling=function(a){a?l.addEventListener?(l.addEventListener("mousewheel",u,!1),l.addEventListener("wheel",u,!1),l.addEventListener("DOMMouseScroll",u,!1)):l.attachEvent("onmousewheel",u):l.addEventListener?(l.removeEventListener("mousewheel",u,!1),l.removeEventListener("wheel",u,!1),l.removeEventListener("DOMMouseScroll",u,!1)):l.detachEvent("onmousewheel",u)};e.setAllowScrolling=function(a,b){"undefined"!==typeof b?(b=b.replace(/ /g,
"").split(","),c.each(b,function(b,c){Ia(a,c,"m")})):a?(e.setMouseWheelScrolling(!0),Ya()):(e.setMouseWheelScrolling(!1),Za())};e.setKeyboardScrolling=function(a,b){"undefined"!==typeof b?(b=b.replace(/ /g,"").split(","),c.each(b,function(b,c){Ia(a,c,"k")})):d.keyboardScrolling=a};e.moveSectionUp=function(){var a=c(".fp-section.active").prev(".fp-section");a.length||!d.loopTop&&!d.continuousVertical||(a=c(".fp-section").last());a.length&&B(a,null,!0)};e.moveSectionDown=function(){var a=c(".fp-section.active").next(".fp-section");
a.length||!d.loopBottom&&!d.continuousVertical||(a=c(".fp-section").first());!a.length||d.onBeforeMoveSection&&c.isFunction(d.onBeforeMoveSection)&&!1===d.onBeforeMoveSection.call(this,direction,currentSlide,destiny,slides,activeSection)||B(a,null,!1)};e.silentMoveTo=function(a,b){e.setScrollingSpeed(0,"internal");e.moveTo(a,b);e.setScrollingSpeed(G.scrollingSpeed,"internal")};e.moveTo=function(a,b){var c=Ea(a);"undefined"!==typeof b?V(a,b):0<c.length&&B(c)};e.moveSlideRight=function(){ua("next")};
e.moveSlideLeft=function(){ua("prev")};e.reBuild=function(a){if(!h.hasClass("fp-destroyed")){v=!0;var b=n.width();r=n.height();d.resize&&Xa(r,b);c(".fp-section").each(function(){var a=c(this).find(".fp-slides"),b=c(this).find(".fp-slide");d.verticalCentered&&c(this).find(".fp-tableCell").css("height",Da(c(this))+"px");c(this).css("height",r+"px");d.scrollOverflow&&(b.length?b.each(function(){J(c(this))}):J(c(this)));1<b.length&&F(a,a.find(".fp-slide.active"))});(b=c(".fp-section.active").index(".fp-section"))&&
e.silentMoveTo(b+1);v=!1;c.isFunction(d.afterResize)&&a&&d.afterResize.call(h);c.isFunction(d.afterReBuild)&&!a&&d.afterReBuild.call(h)}};e.setResponsive=function(a){var b=h.hasClass("fp-responsive");a?b||(e.setAutoScrolling(!1,"internal"),e.setFitToSection(!1,"internal"),c("#fp-nav").hide(),h.addClass("fp-responsive")):b&&(e.setAutoScrolling(G.autoScrolling,"internal"),e.setFitToSection(G.autoScrolling,"internal"),c("#fp-nav").show(),h.removeClass("fp-responsive"))};var z=!1,Q=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),
R="ontouchstart"in m||0<navigator.msMaxTouchPoints||navigator.maxTouchPoints,h=c(this),r=n.height(),v=!1,A,ea,y=!0,C=[],O,k={m:{up:!0,down:!0,left:!0,right:!0}};k.k=c.extend(!0,{},k.m);var G=c.extend(!0,{},d),ha,ca,fa,Z,aa,Ja;c(this).length&&Ka();var W=!1;n.on("scroll",oa);var E=0,N=0,D=0,M=0,ta=(new Date).getTime();m.requestAnimFrame=function(){return m.requestAnimationFrame||function(a){a()}}();n.on("hashchange",xa);w.keydown(function(a){clearTimeout(Ja);var b=c(":focus");b.is("textarea")||b.is("input")||
b.is("select")||!d.keyboardScrolling||!d.autoScrolling||(-1<c.inArray(a.which,[40,38,32,33,34])&&a.preventDefault(),Ja=setTimeout(function(){var b=a.shiftKey;O=a.ctrlKey;switch(a.which){case 38:case 33:k.k.up&&e.moveSectionUp();break;case 32:if(b&&k.k.up){e.moveSectionUp();break}case 40:case 34:k.k.down&&e.moveSectionDown();break;case 36:k.k.up&&e.moveTo(1);break;case 35:k.k.down&&e.moveTo(c(".fp-section").length);break;case 37:k.k.left&&e.moveSlideLeft();break;case 39:k.k.right&&e.moveSlideRight()}},
150))});w.keyup(function(a){O=a.ctrlKey});c(m).blur(function(){O=!1});h.mousedown(function(a){2==a.which&&(P=a.pageY,h.on("mousemove",Wa))});h.mouseup(function(a){2==a.which&&h.off("mousemove")});var P=0;w.on("click touchstart","#fp-nav a",function(a){a.preventDefault();a=c(this).parent().index();B(c(".fp-section").eq(a))});w.on("click touchstart",".fp-slidesNav a",function(a){a.preventDefault();a=c(this).closest(".fp-section").find(".fp-slides");var b=a.find(".fp-slide").eq(c(this).closest("li").index());
F(a,b)});d.normalScrollElements&&(w.on("mouseenter",d.normalScrollElements,function(){e.setMouseWheelScrolling(!1)}),w.on("mouseleave",d.normalScrollElements,function(){e.setMouseWheelScrolling(!0)}));c(".fp-section").on("click touchstart",".fp-controlArrow",function(){c(this).hasClass("fp-prev")?k.m.left&&e.moveSlideLeft():k.m.right&&e.moveSlideRight()});n.resize(Ba);var ga=r;e.destroy=function(a){e.setAutoScrolling(!1,"internal");e.setAllowScrolling(!1);e.setKeyboardScrolling(!1);h.addClass("fp-destroyed");
clearTimeout(fa);clearTimeout(ca);clearTimeout(ha);clearTimeout(Z);clearTimeout(aa);n.off("scroll",oa).off("hashchange",xa).off("resize",Ba);w.off("click","#fp-nav a").off("mouseenter","#fp-nav li").off("mouseleave","#fp-nav li").off("click",".fp-slidesNav a").off("mouseover",d.normalScrollElements).off("mouseout",d.normalScrollElements);c(".fp-section").off("click",".fp-controlArrow");clearTimeout(fa);clearTimeout(ca);a&&$a()}}});

View File

@ -1,5 +1,6 @@
# coding=utf-8
import json
import redis
from django.shortcuts import render
@ -7,6 +8,7 @@ from rest_framework.views import APIView
from judge.judger.result import result
from judge.judger_controller.tasks import judge
from judge.judger_controller.settings import redis_config
from account.decorators import login_required
from account.models import SUPER_ADMIN
from problem.models import Problem
@ -41,6 +43,10 @@ class SubmissionAPIView(APIView):
except Exception:
return error_response(u"提交判题任务失败")
# 增加redis 中判题队列长度的计数器
r = redis.Redis(host=redis_config["host"], port=redis_config["port"], db=redis_config["db"])
r.incr("judge_queue_length")
return success_response({"submission_id": submission.id})
else:
return serializer_invalid_response(serializer)

151
template/404.html Normal file
View File

@ -0,0 +1,151 @@
{% extends "oj_base.html" %}
{% block css_block %}
<style>
pre {
position: relative;
padding: 10px;
border: none;
overflow: auto;
line-height: 1.3;
max-height: 500px;
}
.hljs {
display: block;
padding: 0.5em;
background: #fdf6e3;
color: #657b83;
}
.hljs-comment,
.hljs-template_comment,
.diff .hljs-header,
.hljs-doctype,
.hljs-pi,
.lisp .hljs-string,
.hljs-javadoc {
color: #93a1a1;
}
/* Solarized Green */
.hljs-keyword,
.hljs-winutils,
.method,
.hljs-addition,
.css .hljs-tag,
.hljs-request,
.hljs-status,
.nginx .hljs-title {
color: #859900;
}
/* Solarized Cyan */
.hljs-number,
.hljs-command,
.hljs-string,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.hljs-phpdoc,
.tex .hljs-formula,
.hljs-regexp,
.hljs-hexcolor,
.hljs-link_url {
color: #2aa198;
}
/* Solarized Blue */
.hljs-title,
.hljs-localvars,
.hljs-chunk,
.hljs-decorator,
.hljs-built_in,
.hljs-identifier,
.vhdl .hljs-literal,
.hljs-id,
.css .hljs-function {
color: #268bd2;
}
/* Solarized Yellow */
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body,
.smalltalk .hljs-number,
.hljs-constant,
.hljs-class .hljs-title,
.hljs-parent,
.haskell .hljs-type,
.hljs-link_reference {
color: #b58900;
}
/* Solarized Orange */
.hljs-preprocessor,
.hljs-preprocessor .hljs-keyword,
.hljs-pragma,
.hljs-shebang,
.hljs-symbol,
.hljs-symbol .hljs-string,
.diff .hljs-change,
.hljs-special,
.hljs-attr_selector,
.hljs-subst,
.hljs-cdata,
.clojure .hljs-title,
.css .hljs-pseudo,
.hljs-header {
color: #cb4b16;
}
/* Solarized Red */
.hljs-deletion,
.hljs-important {
color: #dc322f;
}
/* Solarized Violet */
.hljs-link_label {
color: #6c71c4;
}
.tex .hljs-formula {
background: #eee8d5;
}
</style>
{% endblock %}
{% block body %}
<div class="container">
<h2>404 - Page Not Found</h2>
<hr>
<div class="article fmt">
<pre><code class="cpp"><span class="hljs-comment">// C</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;stdio.h&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
<span class="hljs-built_in">printf</span>(<span class="hljs-string">"404 - Page Not Found"</span>);
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="cpp"><span class="hljs-comment">// C++</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;iostream&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
std::<span class="hljs-built_in">cout</span> &lt;&lt; <span class="hljs-string">"404 - Page Not Found"</span> &lt;&lt; std::endl;
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="java"><span class="hljs-comment">// Java</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Main</span>
</span>{
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span>
</span>{
System.out.println(<span class="hljs-string">"404 - Page Not Found"</span>);
}
}</code></pre>
<pre><code class="js"><span class="hljs-comment">// JavaScript</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"404 - Page Not Found"</span>)</code></pre>
<pre><code class="python"><span class="hljs-comment">// Python</span>
<span class="hljs-keyword">print</span> <span class="hljs-string">"404 - Page Not Found"</span></code></pre>
</div>
</div>
{% endblock %}

151
template/500.html Normal file
View File

@ -0,0 +1,151 @@
{% extends "oj_base.html" %}
{% block css_block %}
<style>
pre {
position: relative;
padding: 10px;
border: none;
overflow: auto;
line-height: 1.3;
max-height: 500px;
}
.hljs {
display: block;
padding: 0.5em;
background: #fdf6e3;
color: #657b83;
}
.hljs-comment,
.hljs-template_comment,
.diff .hljs-header,
.hljs-doctype,
.hljs-pi,
.lisp .hljs-string,
.hljs-javadoc {
color: #93a1a1;
}
/* Solarized Green */
.hljs-keyword,
.hljs-winutils,
.method,
.hljs-addition,
.css .hljs-tag,
.hljs-request,
.hljs-status,
.nginx .hljs-title {
color: #859900;
}
/* Solarized Cyan */
.hljs-number,
.hljs-command,
.hljs-string,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.hljs-phpdoc,
.tex .hljs-formula,
.hljs-regexp,
.hljs-hexcolor,
.hljs-link_url {
color: #2aa198;
}
/* Solarized Blue */
.hljs-title,
.hljs-localvars,
.hljs-chunk,
.hljs-decorator,
.hljs-built_in,
.hljs-identifier,
.vhdl .hljs-literal,
.hljs-id,
.css .hljs-function {
color: #268bd2;
}
/* Solarized Yellow */
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body,
.smalltalk .hljs-number,
.hljs-constant,
.hljs-class .hljs-title,
.hljs-parent,
.haskell .hljs-type,
.hljs-link_reference {
color: #b58900;
}
/* Solarized Orange */
.hljs-preprocessor,
.hljs-preprocessor .hljs-keyword,
.hljs-pragma,
.hljs-shebang,
.hljs-symbol,
.hljs-symbol .hljs-string,
.diff .hljs-change,
.hljs-special,
.hljs-attr_selector,
.hljs-subst,
.hljs-cdata,
.clojure .hljs-title,
.css .hljs-pseudo,
.hljs-header {
color: #cb4b16;
}
/* Solarized Red */
.hljs-deletion,
.hljs-important {
color: #dc322f;
}
/* Solarized Violet */
.hljs-link_label {
color: #6c71c4;
}
.tex .hljs-formula {
background: #eee8d5;
}
</style>
{% endblock %}
{% block body %}
<div class="container">
<h2>500 - Server Error</h2>
<hr>
<div class="article fmt">
<pre><code class="cpp"><span class="hljs-comment">// C</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;stdio.h&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
<span class="hljs-built_in">printf</span>(<span class="hljs-string">"500 - Server Error"</span>);
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="cpp"><span class="hljs-comment">// C++</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;iostream&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
std::<span class="hljs-built_in">cout</span> &lt;&lt; <span class="hljs-string">"500 - Server Error"</span> &lt;&lt; std::endl;
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="java"><span class="hljs-comment">// Java</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Main</span>
</span>{
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span>
</span>{
System.out.println(<span class="hljs-string">"500 - Server Error"</span>);
}
}</code></pre>
<pre><code class="js"><span class="hljs-comment">// JavaScript</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"500 - Server Error"</span>)</code></pre>
<pre><code class="python"><span class="hljs-comment">// Python</span>
<span class="hljs-keyword">print</span> <span class="hljs-string">"500 - Server Error"</span></code></pre>
</div>
</div>
{% endblock %}

View File

@ -1,3 +1,4 @@
{% verbatim %}
<!DOCTYPE html>
<html>
<head>
@ -8,10 +9,6 @@
<title>在线评测系统 - 后台管理</title>
<!-- custom css begin -->
{% block css_block %}{% endblock %}
<!-- custom css end -->
<!-- global css begin -->
<link href="/static/css/admin.css" rel="stylesheet">
<!-- global css end -->
@ -70,7 +67,13 @@
<!-- admin left begin-->
<div class="col-md-2">
<ul class="list-group">
<li class="list-group-header">首页</li>
<div ms-repeat="adminNavList">
<li class="list-group-header">{{ el.name }}</li>
<li class="list-group-item" ms-attr-id="getLiId(item.hash)" ms-repeat-item="el.children">
<a ms-attr-href="el.hash">{{ item.name }}</a>
</li>
</div>
<!--<li class="list-group-header">首页</li>
<li class="list-group-item" id="li-index-index">
<a href="#index/index">主页</a>
</li>
@ -80,8 +83,12 @@
<li class="list-group-item" id="li-statistics-statistics">
<a href="#statistics/statistics">统计</a>
</li>
<li class="list-group-header">通用</li>
<li class="list-group-item" id="li-announcement-announcement">
<a href="#announcement/announcement">公告</a>
<a href="#announcement/announcement">公告管理</a>
</li>
<li class="list-group-item" id="li-user-user_list">
<a href="#user/user_list">用户管理</a>
</li>
<li class="list-group-header">题目管理</li>
<li class="list-group-item" id="li-problem-problem_list">
@ -97,17 +104,14 @@
<li class="list-group-item" id="li-contest-add_contest">
<a href="#contest/add_contest">创建比赛</a>
</li>
<li class="list-group-header">用户管理</li>
<li class="list-group-item" id="li-user-user_list">
<a href="#user/user_list">用户列表</a>
</li>
<li class="list-group-header">小组管理</li>
<li class="list-group-item" id="li-group-group">
<a href="#group/group">小组列表</a>
</li>
<li class="list-group-item" id="li-group-join_group_request_list">
<a href="#group/join_group_request_list">加入小组请求</a>
</li>
</li>-->
</ul>
</div>
<!-- admin left end -->
@ -133,4 +137,5 @@
</div>
<!-- footer end -->
</body>
</html>
</html>
{% endverbatim %}

View File

@ -9,21 +9,7 @@
<canvas class="line-chart" id="waiting-queue-chart"></canvas>
</div>
</div>
<div>
<h3>【10.1.24.23 - judge1 】</h3>
<div>
<canvas class="line-chart" id="judge-instance-chart"></canvas>
<div class="chart-description">判题实例数量变化</div>
</div>
<div>
<canvas id="c1" class="line-chart"></canvas>
<div class="chart-description">cpu 和 内存</div>
</div>
</div>
</div>
<button class="btn btn-danger" id="clear-chart-data">清空图表数据</button>
<script src="/static/js/app/admin/monitor/monitor.js"></script>
</div>

View File

@ -1,39 +1,139 @@
{% extends "oj_base.html" %}
{% block body %}
<div class="container">
<div class="container">
<!DOCTYPE html>
<html>
<div class="jumbotron">
<h1>青岛大学在线评测平台</h1>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>青岛大学在线评测平台 - 首页</title>
<p class="lead">走心的在线评测平台和算法交流社区,全新登场~</p>
<link rel="stylesheet" type="text/css" href="/static/css/fullpage/jquery.fullPage.css">
<style>
html, textarea, input, option, select, button {
font: 1em "Helvetica Neue", Helvetica, "Lantinghei SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", "STHeiti", "WenQuanYi Micro Hei", SimSun, sans-serif;
color: #FFF;
}
<p><a class="btn btn-lg btn-primary" href="/problems/" role="button">开始刷题!</a></p>
</div>
a {
text-decoration: none;
color: #FFF;
}
<!-- Example row of columns -->
<div class="row">
<div class="col-lg-4">
<h2>全新UI 全新设计</h2>
#header {
position: fixed;
height: 30px;
display: block;
width: 100%;
background: transparent;
z-index: 10;
padding: 20px 20px 0 20px;
}
<p>精心设计的UI和交互让你。。。编不下去了 </p>
</div>
<div class="col-lg-4">
<h2>分布式评测</h2>
#name {
font-size: 45px;
margin-right: 20px;
}
<p>技术领先的高性能分布式评测机制,根据提交数量自动伸缩判题机器实例。</p>
</div>
<div class="col-lg-4">
<h2>高质量原创题目</h2>
.section {
position: relative;
}
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id
ligula
porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum
nibh,
ut fermentum massa.</p>
</div>
</div>
.section h1 {
font-size: 60px;
}
.section h3 {
font-size: 30px;
font-weight: normal;
}
.bottom-pointer {
top: auto;
bottom: 20px;
position: absolute;
left: 48%;
}
.index-section-text {
position: absolute;
top: 30%;
width: 100%;
text-align: center;
}
.section-text {
text-align: center;
}
.icon {
max-height: 300px;
max-width: 300px;
}
</style>
<link rel="stylesheet" href="/static/css/animate/animate.css">
<script src="/static/js/lib/jquery/jquery.js"></script>
<script src="/static/js/lib/fullpage/jquery.fullPage.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#fullpage').fullpage({
sectionsColor: ['#28ac72', '#2f7ddb', '#FAC832', '#B01414'],
css3: true,
navigation: true,
loopBottom: true
});
});
</script>
</head>
<body>
<div id="header">
<span id="name">qduoj</span>
<a href="/problems/">题目</a>&nbsp;&nbsp;<a href="#">比赛</a>&nbsp;&nbsp;<a href="#">小组</a>
</div>
<div id="fullpage">
<div class="section" id="section0">
<div class="index-section-text animated bounceInUp">
<h1>青岛大学在线评测平台</h1>
<h3>全新面貌,新的开始~</h3>
</div>
<div class="bottom-pointer">↓继续滚动~</div>
</div>
<div class="section" id="section1">
<div class="section-text">
<img class="icon" id="img1" src="/static/img/index/a.png">
<h1>分布式评测</h1>
<h3>再也不怕一直是 waiting 了~~</h3>
</div>
</div>
<div class="section" id="section2">
<div class="section-text">
<img class="icon" id="img2" src="/static/img/index/c.png">
<h1>多种比赛模式</h1>
<h3>ACM 模式AC 数量模式,单题得分模式等</h3>
</div>
</div>
{% endblock %}
<div class="section" id="section3">
<div class="section-text">
<img class="icon" id="img3" src="/static/img/index/m.png">
<h1>自由举办小组赛</h1>
<h3>内部比赛,日常作业,期末考试,通通搞定</h3>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,7 +1,7 @@
{% extends "oj_base.html" %}
{% block body %}
{% load problem %}
<div class="container main" ms-controller="problem_list">
<div class="container main">
<div class="row">
<div class="col-lg-9">
<div class="row">

View File

@ -1,10 +1,151 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
{{ error }}
</body>
</html>
{% extends "oj_base.html" %}
{% block css_block %}
<style>
pre {
position: relative;
padding: 10px;
border: none;
overflow: auto;
line-height: 1.3;
max-height: 500px;
}
.hljs {
display: block;
padding: 0.5em;
background: #fdf6e3;
color: #657b83;
}
.hljs-comment,
.hljs-template_comment,
.diff .hljs-header,
.hljs-doctype,
.hljs-pi,
.lisp .hljs-string,
.hljs-javadoc {
color: #93a1a1;
}
/* Solarized Green */
.hljs-keyword,
.hljs-winutils,
.method,
.hljs-addition,
.css .hljs-tag,
.hljs-request,
.hljs-status,
.nginx .hljs-title {
color: #859900;
}
/* Solarized Cyan */
.hljs-number,
.hljs-command,
.hljs-string,
.hljs-tag .hljs-value,
.hljs-rules .hljs-value,
.hljs-phpdoc,
.tex .hljs-formula,
.hljs-regexp,
.hljs-hexcolor,
.hljs-link_url {
color: #2aa198;
}
/* Solarized Blue */
.hljs-title,
.hljs-localvars,
.hljs-chunk,
.hljs-decorator,
.hljs-built_in,
.hljs-identifier,
.vhdl .hljs-literal,
.hljs-id,
.css .hljs-function {
color: #268bd2;
}
/* Solarized Yellow */
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body,
.smalltalk .hljs-number,
.hljs-constant,
.hljs-class .hljs-title,
.hljs-parent,
.haskell .hljs-type,
.hljs-link_reference {
color: #b58900;
}
/* Solarized Orange */
.hljs-preprocessor,
.hljs-preprocessor .hljs-keyword,
.hljs-pragma,
.hljs-shebang,
.hljs-symbol,
.hljs-symbol .hljs-string,
.diff .hljs-change,
.hljs-special,
.hljs-attr_selector,
.hljs-subst,
.hljs-cdata,
.clojure .hljs-title,
.css .hljs-pseudo,
.hljs-header {
color: #cb4b16;
}
/* Solarized Red */
.hljs-deletion,
.hljs-important {
color: #dc322f;
}
/* Solarized Violet */
.hljs-link_label {
color: #6c71c4;
}
.tex .hljs-formula {
background: #eee8d5;
}
</style>
{% endblock %}
{% block body %}
<div class="container">
<h2>出错了~~ {{ error }}</h2>
<hr>
<div class="article fmt">
<pre><code class="cpp"><span class="hljs-comment">// C</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;stdio.h&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
<span class="hljs-built_in">printf</span>(<span class="hljs-string">"An error occurred\n"</span>);
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="cpp"><span class="hljs-comment">// C++</span>
<span class="hljs-preprocessor">#<span class="hljs-keyword">include</span> &lt;iostream&gt;</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
std::<span class="hljs-built_in">cout</span> &lt;&lt; <span class="hljs-string">"An error occurred"</span> &lt;&lt; std::endl;
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>
<pre><code class="java"><span class="hljs-comment">// Java</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Main</span>
</span>{
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span>
</span>{
System.out.println(<span class="hljs-string">"An error occurred"</span>);
}
}</code></pre>
<pre><code class="js"><span class="hljs-comment">// JavaScript</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"An error occurred\n"</span>)</code></pre>
<pre><code class="python"><span class="hljs-comment">// Python</span>
<span class="hljs-keyword">print</span> <span class="hljs-string">"An error occurred"</span></code></pre>
</div>
</div>
{% endblock %}

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
{{ info }}
</body>
</html>