From 4d2a5c129eff549fcddd635358553414aef81638 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 2 Aug 2015 08:59:01 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=20qduoj=20->=20oj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manage.py | 2 +- {qduoj => oj}/__init__.py | 0 {qduoj => oj}/local_settings.py | 0 {qduoj => oj}/server_settings.py | 0 {qduoj => oj}/settings.py | 6 +++--- {qduoj => oj}/urls.py | 4 ---- {qduoj => oj}/wsgi.py | 2 +- 7 files changed, 5 insertions(+), 9 deletions(-) rename {qduoj => oj}/__init__.py (100%) rename {qduoj => oj}/local_settings.py (100%) rename {qduoj => oj}/server_settings.py (100%) rename {qduoj => oj}/settings.py (97%) rename {qduoj => oj}/urls.py (85%) rename {qduoj => oj}/wsgi.py (82%) diff --git a/manage.py b/manage.py index b4ba977..31881f3 100755 --- a/manage.py +++ b/manage.py @@ -3,7 +3,7 @@ import os import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "qduoj.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oj.settings") from django.core.management import execute_from_command_line diff --git a/qduoj/__init__.py b/oj/__init__.py similarity index 100% rename from qduoj/__init__.py rename to oj/__init__.py diff --git a/qduoj/local_settings.py b/oj/local_settings.py similarity index 100% rename from qduoj/local_settings.py rename to oj/local_settings.py diff --git a/qduoj/server_settings.py b/oj/server_settings.py similarity index 100% rename from qduoj/server_settings.py rename to oj/server_settings.py diff --git a/qduoj/settings.py b/oj/settings.py similarity index 97% rename from qduoj/settings.py rename to oj/settings.py index 52eaac6..3fa0e0b 100644 --- a/qduoj/settings.py +++ b/oj/settings.py @@ -1,6 +1,6 @@ # coding=utf-8 """ -Django settings for qduoj project. +Django settings for oj project. Generated by 'django-admin startproject' using Django 1.8. @@ -63,7 +63,7 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.security.SecurityMiddleware', ) -ROOT_URLCONF = 'qduoj.urls' +ROOT_URLCONF = 'oj.urls' TEMPLATES = [ { @@ -81,7 +81,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = 'qduoj.wsgi.application' +WSGI_APPLICATION = 'oj.wsgi.application' # Internationalization diff --git a/qduoj/urls.py b/oj/urls.py similarity index 85% rename from qduoj/urls.py rename to oj/urls.py index 59baceb..a9438fa 100644 --- a/qduoj/urls.py +++ b/oj/urls.py @@ -6,10 +6,6 @@ from django.views.generic import TemplateView from account.views import UserLoginAPIView urlpatterns = [ - # Examples: - # url(r'^$', 'qduoj.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - url(r'^docs/', include('rest_framework_swagger.urls')), url(r'^admin/', include(admin.site.urls)), diff --git a/qduoj/wsgi.py b/oj/wsgi.py similarity index 82% rename from qduoj/wsgi.py rename to oj/wsgi.py index 5fe94cc..c085191 100644 --- a/qduoj/wsgi.py +++ b/oj/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "qduoj.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oj.settings") application = get_wsgi_application() From 64f31a61be4c4c4c581196bef64778f9e8c723ef Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 2 Aug 2015 09:47:15 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E4=B8=A4=E4=B8=AA=20cs?= =?UTF-8?q?s=20=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/css/{ => datetime_picker}/bootstrap-datetimepicker.css | 0 static/src/css/{ => webuploader}/webuploader.css | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename static/src/css/{ => datetime_picker}/bootstrap-datetimepicker.css (100%) rename static/src/css/{ => webuploader}/webuploader.css (100%) diff --git a/static/src/css/bootstrap-datetimepicker.css b/static/src/css/datetime_picker/bootstrap-datetimepicker.css similarity index 100% rename from static/src/css/bootstrap-datetimepicker.css rename to static/src/css/datetime_picker/bootstrap-datetimepicker.css diff --git a/static/src/css/webuploader.css b/static/src/css/webuploader/webuploader.css similarity index 100% rename from static/src/css/webuploader.css rename to static/src/css/webuploader/webuploader.css From 8b058a37857edd06fa91c873f51d04e9a11a014e Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 2 Aug 2015 09:47:50 +0800 Subject: [PATCH 03/27] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=86=99=E5=A5=BD=E7=9A=84=20admin=20=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oj/settings.py | 4 +- oj/urls.py | 6 +- static/src/css/admin.css | 25 +++++ static/src/css/oj.css | 49 --------- static/src/js/app/admin.js | 5 +- static/src/js/config.js | 11 +- template/admin/add_contest.html | 183 ++++++++++++++++++++++++++++++++ template/admin/index.html | 4 + template/admin_base.html | 112 ++++++++++++++++++- template/contest/problems.html | 15 +++ template/oj_base.html | 8 +- template/utils/index.html | 37 +++++++ 12 files changed, 391 insertions(+), 68 deletions(-) create mode 100644 static/src/css/admin.css create mode 100644 template/admin/add_contest.html create mode 100644 template/admin/index.html create mode 100644 template/contest/problems.html create mode 100644 template/utils/index.html diff --git a/oj/settings.py b/oj/settings.py index 3fa0e0b..803e43a 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -31,8 +31,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'hzfp^8mbgapc&x%$#xv)0=t8s7_ilingw(q3!@h&2fty6v6fxz' - - ALLOWED_HOSTS = [] @@ -103,7 +101,7 @@ USE_TZ = True STATIC_URL = '/static/' -STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/release/"),) +STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/src/"),) TEMPLATE_DIRS = ( os.path.join(BASE_DIR, "template"), diff --git a/oj/urls.py b/oj/urls.py index a9438fa..7c7e30e 100644 --- a/oj/urls.py +++ b/oj/urls.py @@ -6,12 +6,14 @@ from django.views.generic import TemplateView from account.views import UserLoginAPIView urlpatterns = [ + url("^$", TemplateView.as_view(template_name="utils/index.html"), name="index_page"), url(r'^docs/', include('rest_framework_swagger.urls')), - - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/$', TemplateView.as_view(template_name="admin/index.html"), name="admin_index_page"), url(r'^login/$', TemplateView.as_view(template_name="account/login.html"), name="user_login_page"), url(r'^api/login/$', UserLoginAPIView.as_view(), name="login_api"), url(r'^api/login/$', UserLoginAPIView.as_view(), name="user_login_api"), url(r'^problem/(?P\d+)/$', "problem.views.problem_page", name="problem_page"), + url(r'^admin/contest/$', TemplateView.as_view(template_name="admin/add_contest.html"), name="add_contest_page"), + ] diff --git a/static/src/css/admin.css b/static/src/css/admin.css new file mode 100644 index 0000000..75fc901 --- /dev/null +++ b/static/src/css/admin.css @@ -0,0 +1,25 @@ +@import url("bootstrap/bootstrap.min.css"); +@import url("bootstrap/todc-bootstrap.min.css"); +@import url("codeMirror/codemirror.css"); +@import url("simditor/simditor.css"); +@import url("webuploader/webuploader.css"); +@import url("datetime_picker/bootstrap-datetimepicker.css"); +html, body { + height: 100%; +} + +img { + max-width: 100%; + height: auto; +} + +.footer { + padding-top: 30px; + padding-bottom: 30px; + float: bottom; + bottom: 0; +} + +label { + font-size: 16px; +} \ No newline at end of file diff --git a/static/src/css/oj.css b/static/src/css/oj.css index c83a8cc..4cbaf03 100644 --- a/static/src/css/oj.css +++ b/static/src/css/oj.css @@ -29,8 +29,6 @@ label { padding-top: 15px; } - - #loading { display: none; } @@ -40,53 +38,6 @@ label { height: 300px; } -.glyphicon-refresh-animate { - -animation: spin .9s infinite linear; - -webkit-animation: spin2 .9s infinite linear; -} - -@-webkit-keyframes spin2 { - from { - -webkit-transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - } -} - -@keyframes spin { - from { - transform: scale(1) rotate(0deg); - } - to { - transform: scale(1) rotate(360deg); - } -} - -.callout { - padding: 5px; - margin: 20px 0; - border: 1px solid #eee; - border-left-width: 5px; - border-radius: 3px; -} - -.callout-danger { - border-left-color: #dd4b39; -} - -.callout-info { - border-left-color: #d0e3f0; -} - -.callout-warning { - border-left-color: #f1e7bc; -} - -.callout p { - font-size: 16px;; -} - .problem-section { padding-top: 5px; padding-bottom: 5px; diff --git a/static/src/js/app/admin.js b/static/src/js/app/admin.js index e57b2c2..bc13d9d 100644 --- a/static/src/js/app/admin.js +++ b/static/src/js/app/admin.js @@ -1,5 +1,5 @@ -define(["jquery", "avalon", "editor", "uploader", "datetime_picker", - "validation", "dropdown" +require(["jquery", "avalon", "editor", "uploader", "datetimepicker", + "validation" ], function ($, avalon, editor, uploader) { $("#add-contest-form") @@ -102,7 +102,6 @@ define(["jquery", "avalon", "editor", "uploader", "datetime_picker", text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } - var editor1 = editor("#editor"); var vm = avalon.define({ diff --git a/static/src/js/config.js b/static/src/js/config.js index d0eb372..487d4ba 100644 --- a/static/src/js/config.js +++ b/static/src/js/config.js @@ -16,7 +16,6 @@ var require = { "bs_alert": "utils/bs_alert", submit_code: "app/problem/submit_code", - //formValidation 不要在代码中单独使用,而是使用和修改utils/validation base: "lib/formValidation/base", helper: "lib/formValidation/helper", @@ -39,10 +38,16 @@ var require = { code_mirror_clang: "lib/codeMirror/language/clike", //bootstrap - bootstrap: "lib/bootstrap/bootstrap" + bootstrap: "lib/bootstrap/bootstrap", + + // + "_datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker", + "datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker.zh-CN" }, shim: { - "bootstrap": {"deps": ['jquery']} + "bootstrap": {"deps": ['jquery']}, + "_datetimepicker": {"deps": ["jquery"]}, + "datetimepicker": {"deps": ["_datetimepicker"]} } }; \ No newline at end of file diff --git a/template/admin/add_contest.html b/template/admin/add_contest.html new file mode 100644 index 0000000..47bc2d3 --- /dev/null +++ b/template/admin/add_contest.html @@ -0,0 +1,183 @@ +{% extends "admin_base.html" %} +{% block body %} + {% verbatim %} +
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ OI + ACM +
+
+
+
+ 开放排名 +
+
+ +
+ + 添加 +
+
+
+
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ + + + 添加 + + +
+
+
+ 样例{{$index + 1}} + + + {{ sample.toggle_string }} + + + 删除 + + +
+
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
选择文件
+ +
+
+
+
+
+
+ +
+
+
+ {% endverbatim %} +{% endblock %} \ No newline at end of file diff --git a/template/admin/index.html b/template/admin/index.html new file mode 100644 index 0000000..df51a66 --- /dev/null +++ b/template/admin/index.html @@ -0,0 +1,4 @@ +{% extends "admin_base.html" %} +{% block body %} +Hello world +{% endblock %} \ No newline at end of file diff --git a/template/admin_base.html b/template/admin_base.html index 71ce692..2f404d8 100644 --- a/template/admin_base.html +++ b/template/admin_base.html @@ -1,10 +1,116 @@ - - - + + + + + + + 在线评测系统 - 后台管理 + + + {% block css_block %}{% endblock %} + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + {% block body %}{% endblock %} + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/template/contest/problems.html b/template/contest/problems.html new file mode 100644 index 0000000..88dd9d2 --- /dev/null +++ b/template/contest/problems.html @@ -0,0 +1,15 @@ +{% extends "oj_base.html" %} +{% block body %} +
+ +

第一次比赛

+ +

开始时间: 2015-6-8 19:00 结束时间: 2015-9-1 12:00

+ +
+{% endblock %} \ No newline at end of file diff --git a/template/oj_base.html b/template/oj_base.html index 66e760b..d90c1ef 100644 --- a/template/oj_base.html +++ b/template/oj_base.html @@ -26,7 +26,6 @@