template: problem_list

This commit is contained in:
masnn committed 2020-04-03 20:56:20 +08:00
1 parent fc26af30ef
commit 2e23d05a59
28 files changed
+357 -270

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
{% extends "layout/mail.html" %}
{% block title %}{{ _('P{0} - {1} Accepted!').format(pdoc['doc_id'], pdoc['title']) }}{% endblock %}
{% block title %}{{ _('P{0} - {1} Accepted!').format(pdoc['_id'], pdoc['title']) }}{% endblock %}
{% block content %}
<p>{{ _('Congratulations! Your submission is accepted.') }}</p>
<p>{{ _('Problem') }}: <a href="{{ url_prefix }}{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['doc_id']) }}">P{{ pdoc['doc_id'] }} {{ pdoc['title'] }}</a></p>
<p>{{ _('Problem') }}: <a href="{{ url_prefix }}{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['_id']) }}">P{{ pdoc['_id'] }} {{ pdoc['title'] }}</a></p>
<p>{{ _('Code') }}:</p>
<pre>
{{ rdoc['code'] }}
+27 -22
View File
@@ -1,28 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Vijos System Error</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
background: #272822;
padding-top: 100px;
}
pre{
font-family: "monaco", "Consolas", "Source Code Pro", "Courier New", monospace;
}
</style>
</head>
<body>
<div class="code-content" style="text-align: center"><pre style="font-size: 18px; line-height: 125%; display: inline-block; text-align: left; white-space: pre-wrap; word-wrap: break-word;"><span style="color: #75715e">#include &lt;string.h&gt;</span>
<head>
<title>Vijos System Error</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
background: #272822;
padding-top: 100px;
}
pre {
font-family: "monaco", "Consolas", "Source Code Pro", "Courier New", monospace;
}
</style>
</head>
<body>
<div class="code-content" style="text-align: center">
<pre style="font-size: 18px; line-height: 125%; display: inline-block; text-align: left; white-space: pre-wrap; word-wrap: break-word;">
<span style="color: #75715e">#include &lt;string.h&gt;</span>
<span style="color: #66d9ef">int</span> <span style="color: #a6e22e">main</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">{</span>
<span style="color: #66d9ef">char</span> <span style="color: #f8f8f2">answer[</span><span style="color: #ae81ff">42</span><span style="color: #f8f8f2">];</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;twd2 will tell you the answer to life the universe and everything,&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;but first of all, he is very sorry that Vijos meets some issues now.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;please <a href="javascript:window.location.reload()" style="color: #e6db74" title="Try again">wait patiently</a>, or <a style="color: #e6db74" href="mailto:twd2@163.com">contact twd2</a> impatiently about this error.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;masnn will tell you the answer to life the universe and everything,&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;but first of all, she is very sorry that Hydro meets some issues now.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">strcpy(answer,</span> <span style="color: #e6db74">&quot;please <a href="javascript:window.location.reload()" style="color: #e6db74" title="Try again">wait patiently</a>, or <a style="color: #e6db74" href="mailto:masnn0@outlook.com">contact masnn</a> impatiently about this error.&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #66d9ef">return</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">;</span>
<span style="color: #f8f8f2">}</span>
</pre></div>
</body>
</html>
<span style="color: #75715e">/*</span>
<span style="color: #75715e">{{error.stack}}</span>
<span style="color: #75715e">*/</span>
</pre>
</div>
</body>
</html>
+64 -64
View File
@@ -1,12 +1,12 @@
{% macro form_begin() %}
{% set label = kwargs.pop('label') %}
{% set columns = kwargs.pop('columns') %}
{% set last_column = kwargs.pop('last_column', true) %}
{% set required = kwargs.pop('required', false) %}
{% set hotkeys = kwargs.pop('hotkeys', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% macro form_begin(args) %}
{% set label = args.pop('label') %}
{% set columns = args.pop('columns') %}
{% set last_column = args.pop('last_column', true) %}
{% set required = args.pop('required', false) %}
{% set hotkeys = args.pop('hotkeys', none) %}
{% set row = args.pop('row', true) %}
{% set no_label = args.pop('no_label', false) %}
{% set label_wrap = args.pop('label_wrap', true) %}
{% if row %}
<div class="row">
{% endif %}
@@ -26,11 +26,11 @@
{% endif %}
{% endmacro %}
{% macro form_end() %}
{% set help_text = kwargs.pop('help_text', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% macro form_end(args) %}
{% set help_text = args.pop('help_text', none) %}
{% set row = args.pop('row', true) %}
{% set no_label = args.pop('no_label', false) %}
{% set label_wrap = args.pop('label_wrap', true) %}
{% if not no_label and label_wrap %}
</label>
{% endif %}
@@ -43,12 +43,12 @@
{% endif %}
{% endmacro %}
{% macro form_attr(form_class) %}
{% set disabled = kwargs.pop('disabled', false) %}
{% set required = kwargs.pop('required', false) %}
{% set autofocus = kwargs.pop('autofocus', false) %}
{% set date = kwargs.pop('date', false) %}
{% set time = kwargs.pop('time', false) %}
{% macro form_attr(form_class, args) %}
{% set disabled = args.pop('disabled', false) %}
{% set required = args.pop('required', false) %}
{% set autofocus = args.pop('autofocus', false) %}
{% set date = args.pop('date', false) %}
{% set time = args.pop('time', false) %}
class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% if disabled %}disabled{% endif %}
{% if required %}required{% endif %}
@@ -57,19 +57,19 @@
{% if time %}data-pick-time{% endif %}
{% endmacro %}
{% macro container_attr(container_class) %}
{% set extra_class = kwargs.pop('extra_class', none) %}
{% macro container_attr(container_class, args) %}
{% set extra_class = args.pop('extra_class', none) %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %}
{% macro select(options, name='', value='') %}
{% macro select(options, name='', value='', args) %}
<div
name="form_item_{{ name }}"
{{ container_attr('select-container', **kwargs) }}
{{ container_attr('select-container', args) }}
>
<select
name="{{ name }}"
{{ form_attr('select', **kwargs) }}
{{ form_attr('select', args) }}
>
{% for k, v in options %}
<option value="{{ k }}"{% if value == k %} selected{% endif %}>
@@ -80,16 +80,16 @@
</div>
{% endmacro %}
{% macro form_select(columns=5) %}
{{ form_begin(columns=columns, **kwargs) }}
{{ select(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{% macro form_select(columns=5, args) %}
{{ form_begin({columns:columns}|assign(args)) }}
{{ select({columns:columns}|assign(args)) }}
{{ form_end({columns:columns}|assign(args)) }}
{% endmacro %}
{% macro radio(options, name='', value='') %}
{% macro radio(options, name='', value='', args) %}
<div
name="form_item_{{ name }}"
{{ container_attr('radiobox-container', **kwargs) }}
{{ container_attr('radiobox-container', args) }}
>
{% for k, v in options %}
<label class="radiobox">
@@ -97,7 +97,7 @@
value="{{ k }}"
type="radio"
name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }}
{{ form_attr('radiobox__input', args) }}
{% if value == k %} checked{% endif %}
/> {{ _(v) }}
</label>
@@ -105,16 +105,16 @@
</div>
{% endmacro %}
{% macro form_radio(columns=5) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }}
{{ radio(columns=columns, **kwargs) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }}
{% macro form_radio(columns=5, args) %}
{{ form_begin({columns:columns, label_wrap:false}|assign(args)) }}
{{ radio({columns:columns}|assign(args)) }}
{{ form_end({columns:columns, label_warp:false}|assign(args)) }}
{% endmacro %}
{% macro image_radio(options, name='', value='', image_class='') %}
{% macro image_radio(options, name='', value='', image_class='', args) %}
<div
name="form_item_{{ name }}"
{{ container_attr('radiobox-container with-image', **kwargs) }}
{{ container_attr('radiobox-container with-image', args) }}
>
{% for k, v in options %}
<label class="radiobox with-image">
@@ -122,7 +122,7 @@
value="{{ k }}"
type="radio"
name="{{ name }}"
{{ form_attr('radiobox__input', **kwargs) }}
{{ form_attr('radiobox__input', args) }}
{% if value == k %} checked{% endif %}
/>
<div class="radiobox__image-container" data-tooltip="{{ _(v) }}">
@@ -133,69 +133,69 @@
</div>
{% endmacro %}
{% macro form_image_radio(columns=8) %}
{{ form_begin(columns=columns, label_wrap=false, **kwargs) }}
{{ image_radio(columns=columns, **kwargs) }}
{{ form_end(columns=columns, label_wrap=false, **kwargs) }}
{% macro form_image_radio(columns=8, args) %}
{{ form_begin({columns:columns, label_warp:false}|assign(args)) }}
{{ image_radio({columns:columns}|assign(args)) }}
{{ form_end({columns:columns, label_warp:false}|assign(args)) }}
{% endmacro %}
{% macro text(name='', value='', placeholder='', type='text') %}
{% macro text(name='', value='', placeholder='', type='text', args) %}
<div
name="form_item_{{ name }}"
{{ container_attr('textbox-container', **kwargs) }}
{{ container_attr('textbox-container', args) }}
>
<input
type="{{ type }}"
name="{{ name }}"
value="{{ value }}"
placeholder="{{ placeholder }}"
{{ form_attr('textbox', **kwargs) }}
{{ form_attr('textbox', args) }}
>
</div>
{% endmacro %}
{% macro form_text(columns=5) %}
{{ form_begin(columns=columns, **kwargs) }}
{{ text(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{% macro form_text(columns=5, args) %}
{{ form_begin({columns:columns}|assign(args)) }}
{{ text({columns:columns}|assign(args)) }}
{{ form_end({columns:columns}|assign(args)) }}
{% endmacro %}
{% macro textarea(name='', value='', placeholder='') %}
{% set markdown = kwargs.pop('markdown', false) %}
{% macro textarea(name='', value='', placeholder='', args) %}
{% set markdown = args.pop('markdown', false) %}
<div
name="form_item_{{ name }}"
{{ container_attr('textarea-container', **kwargs) }}
{{ container_attr('textarea-container', args) }}
>
<textarea
name="{{ name }}"
placeholder="{{ placeholder }}"
{% if markdown %}data-markdown{% endif %}
{{ form_attr('textbox', **kwargs) }}
{{ form_attr('textbox', args) }}
>{{ value }}</textarea>
</div>
{% endmacro %}
{% macro form_textarea(columns=8) %}
{{ form_begin(columns=columns, **kwargs) }}
{{ textarea(columns=columns, **kwargs) }}
{{ form_end(columns=columns, **kwargs) }}
{{ form_begin({columns:columns}|assign(args)) }}
{{ textarea({columns:columns}|assign(args)) }}
{{ form_end({columns:columns}|assign(args)) }}
{% endmacro %}
{% macro checkbox(label='', name='', value=false) %}
{% macro checkbox(label='', name='', value=false, args) %}
<div
name="form_item_{{ name }}"
{{ container_attr('checkbox-container', **kwargs) }}
{{ container_attr('checkbox-container', args) }}
>
<label class="checkbox">
<input type="checkbox" name="{{ name }}"{% if value %} checked{% endif %}
{{ form_attr('checkbox', **kwargs) }}
{{ form_attr('checkbox', args) }}
>{{ _(label) }}
</label>
</div>
{% endmacro %}
{% macro form_checkbox(columns=5) %}
{{ form_begin(columns=columns, no_label=True, **kwargs) }}
{{ checkbox(columns=columns, **kwargs) }}
{{ form_end(columns=columns, no_label=True, **kwargs) }}
{% macro form_checkbox(columns=5, args) %}
{{ form_begin({columns:columns, no_label:true}|assign(args)) }}
{{ checkbox({columns:columns}|assign(args)) }}
{{ form_end({columns:columns, no_label:true}|assign(args)) }}
{% endmacro %}
+4 -4
View File
@@ -2,15 +2,15 @@
{%- if not invalid %}
<a
{%- if tdoc is none %}
href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['doc_id']) }}"
href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['_id']) }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
href="{{ reverse_url('contest_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['doc_id'], tid=tdoc['doc_id']) }}"
href="{{ reverse_url('contest_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['_id'], tid=tdoc['doc_id']) }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_HOMEWORK %}
href="{{ reverse_url('homework_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['doc_id'], tid=tdoc['doc_id']) }}"
href="{{ reverse_url('homework_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['_id'], tid=tdoc['doc_id']) }}"
{%- endif %}
>
{%- endif %}
{% if pdoc['doc_id']|string|length < 10 %}P{{ pdoc['doc_id'] }} {% endif %}{{ pdoc['title'] }}
{% if pdoc['_id']|string|length < 10 %}P{{ pdoc['_id'] }} {% endif %}{{ pdoc['title'] }}
{%- if not invalid %}
</a>
{%- endif %}
+1 -1
View File
@@ -1,6 +1,6 @@
{% macro render_item(icon_name, page_name, label=none) %}
<li class="menu__item" id="menu-item-{{ page_name }}">
{% set target_url = reverse_url(page_name, **kwargs) %}
{% set target_url = reverse_url(page_name, args) %}
<a href="{{ target_url }}" class="menu__link{% if handler.request.path_qs == target_url %} active{% endif %}">
{% if icon_name %}
<span class="icon icon-{{ icon_name }}"></span>
+3 -3
View File
@@ -24,7 +24,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -32,7 +32,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -42,7 +42,7 @@
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %}
+1 -1
View File
@@ -37,7 +37,7 @@
<li>
{{ _('{0} views').format(ddoc['views']) }}
</li>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<li><form class="form--inline" method="post">
<input type="hidden" name="operation" value="{% if not dsdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
+1 -1
View File
@@ -26,7 +26,7 @@
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
{% else %}
<p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
+1 -1
View File
@@ -139,7 +139,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
+2 -2
View File
@@ -7,9 +7,9 @@
</div>
<div class="error__text-container">
<h1>{{ _('Oops!') }}</h1>
<p>{{ _(error.message).format(*error.args) }}</p>
<p>{{ _(error.message).format(error.args) }}</p>
<p>{{ _('Technical Information') }}:</p>
<p>{{ _('Type') }}: {{ error.__class__.__name__ }}</p>
<p>{{ _('Type') }}: {{ error.code }}</p>
<p>{{ _('Arguments') }}:
<ol>
{% for arg in error.args %}
+3 -3
View File
@@ -23,7 +23,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -31,7 +31,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -41,7 +41,7 @@
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% with rdoc=rdict[psdict[pid]['rid']] %}
{% if handler.can_show_record(tdoc) %}
+3 -3
View File
@@ -23,7 +23,7 @@
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
{% else %}
@@ -40,7 +40,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('contest_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -48,7 +48,7 @@
<span class="icon icon-add"></span> {{ _('Attend Contest') }}
</button>
</form>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
</a>
+3 -3
View File
@@ -55,8 +55,8 @@
<li class="footer__extra-link-item" data-dropdown-target="#menu-footer-lang">
<span><span class="icon icon-global"></span> Language <span class="icon icon-expand_less"></span></span>
<ol class="dropdown-target menu" id="menu-footer-lang">
{% for code, name in vj4.util.locale.VIEW_LANGS.items() %}
<li class="menu__item"><a class="menu__link" href="/lang/{{ code }}">{{ name }}</a></li>
{% for item in builtin.VIEW_LANGS %}
<li class="menu__item"><a class="menu__link" href="/lang/{{ item.code }}">{{ item.name }}</a></li>
{% endfor %}
</ol>
</li>
@@ -64,7 +64,7 @@
</div>
<div class="footer__extra-right">
<ol class="clearfix">
{% for html in vj4.model.builtin.FOOTER_EXTRA_HTMLS %}
{% for html in builtin.FOOTER_EXTRA_HTMLS %}
<li class="footer__extra-link-item">{{ html|safe }}</li>
{% endfor %}
</ol>
+2 -2
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -32,7 +32,7 @@
<span class="icon icon-add"></span> {{ _('Claim Homework') }}
</button>
</form>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Claim Homework') }}
</a>
+9 -11
View File
@@ -1,6 +1,6 @@
{% macro nav_item(target_page_name, target_page_prefix) %}
<li class="nav__list-item">
<a href="{{ reverse_url(target_page_name) }}" class="nav__item{% if page_name.startswith(target_page_prefix) %} nav--active{% endif %}">
<a href="{{ reverse_url(target_page_name) }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
{{ _(target_page_name) }}
</a>
</li>
@@ -9,36 +9,34 @@
<nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix">
{% if domain_id == vj4.model.builtin.DOMAIN_ID_SYSTEM %}
<li class="nav__list-item"><a href="{{ reverse_url('domain_main', domain_id=vj4.model.builtin.DOMAIN_ID_SYSTEM) }}" class="nav__logo">&nbsp;</a></li>
{% endif %}
{{ nav_item('domain_main', 'domain_main') }}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM) %}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM) %}
{{ nav_item('problem_main', 'problem') }}
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_TRAINING) %}
{% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
{{ nav_item('training_main', 'training') }}
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('discussion_main', 'discussion') }}
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_CONTEST) %}
{% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('contest_main', 'contest') }}
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_HOMEWORK) %}
{% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
{{ nav_item('homework_main', 'homework') }}
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_EDIT_DESCRIPTION) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PERM) %}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
{{ nav_item('domain_manage', 'domain_manage') }}
{% endif %}
</ol>
<ol class="nav__list nav__list--secondary clearfix">
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="nav__list-item"><a href="{{ reverse_url('user_login') }}" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="{{ reverse_url('user_register') }}" class="nav__item--round">{{ _('Sign Up') }}</a></li>
{% else %}
<li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-target="#menu-nav-user" data-dropdown-trigger-desktop-only>
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="nav__item">{{ handler.domain_user['display_name']|default(handler.user['uname'], true) }} <span class="icon icon-expand_more nojs--hide"></span></a>
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="nav__item">{{ handler.user.uname }} <span class="icon icon-expand_more nojs--hide"></span></a>
<ol class="dropdown-target menu" id="menu-nav-user">
<li class="menu__item">
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="menu__link">
+7 -22
View File
@@ -8,7 +8,7 @@
{% else %}
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -18,7 +18,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -29,9 +29,9 @@
</thead>
<tbody>
{% for pdoc in pdocs %}
{% with psdoc = psdict[pdoc['doc_id']] %}
{% set psdoc = psdict[pdoc['_id']] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -40,27 +40,12 @@
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['doc_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit">
<span class="starred--hide"><span class="icon icon-star--outline" data-tooltip="{{ _('Star') }}"></span></span>
<span class="starred--show"><span class="icon icon-star" data-tooltip="{{ _('Unstar') }}"></span></span>
</button>
</form>
{% endif %}
{{ problem.render_problem_title(
pdoc,
rp=vj4.job.rp.get_rp_expect(pdoc) if (not psdoc or psdoc['status'] != vj4.constant.record.STATUS_ACCEPTED) else none
) }}
{{ problem.render_problem_title(pdoc) }}
</td>
<td class="col--submit_n">{{ pdoc['num_submit'] }}</td>
<td class="col--ac_rate">{{ (100 * pdoc['num_accept'] / pdoc['num_submit'])|round|int if pdoc['num_submit'] > 0 else _('?') }}</td>
<td class="col--submit_n">{{ pdoc['nSubmit'] }}</td>
<td class="col--ac_rate">{{ (100 * pdoc['nAccept'] / pdoc['nSubmit'])|round|int if pdoc['nSubmit'] > 0 else _('?') }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
@@ -16,24 +16,24 @@
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_detail_problem', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_detail_problem', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'contest_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('contest_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'contest_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('contest_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
@@ -16,24 +16,24 @@
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_detail_problem', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_detail_problem', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'homework_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'homework_detail_problem_submit' %} active{% endif %}" href="{{ reverse_url('homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
+16 -16
View File
@@ -10,11 +10,11 @@
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
{% else %}
@@ -34,15 +34,15 @@
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ reverse_url('problem_submit', pid=pdoc['doc_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ reverse_url('problem_submit', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:showSignInDialog();">
<span class="icon icon-send"></span> {{ _('Login to Submit') }}
</a></li>
@@ -55,16 +55,16 @@
<li class="menu__seperator"></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ reverse_url('discussion_node_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ reverse_url('discussion_node_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ reverse_url('problem_solution', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ reverse_url('problem_solution', pid=pdoc['_id']) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if page_name == 'problem_detail' and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if page_name == 'problem_detail' and handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link" name="problem-sidebar__copy-to" href="javascript:;">
<span class="icon icon-copy"></span> {{ _('Copy Problem') }}
@@ -72,10 +72,10 @@
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['doc_id']) }}">
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="{{ reverse_url('problem_settings', pid=pdoc['_id']) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
@@ -89,12 +89,12 @@
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if pdoc['doc_id']|string|length < 10 %}
{% if pdoc['_id']|string|length < 10 %}
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc['doc_id'] }}</dd>
<dd>{{ pdoc['_id'] }}</dd>
{% endif %}
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc['psdoc']['status'] %}
@@ -141,11 +141,11 @@
{{ problem.render_problem_tags(pdoc, true) }}
</dd>
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['doc_id'] }}">{{ pdoc['num_submit'] }}</a></dd>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['_id'] }}">{{ pdoc['num_submit'] }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['doc_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc']['num_submit']|default(0) }}</a></dd>
<dd><a href="{{ reverse_url('record_main') }}?pid={{ pdoc['_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc']['num_submit']|default(0) }}</a></dd>
{% endif %}
{% endif %}
<dt>{{ _('Accepted') }}</dt>
+3 -3
View File
@@ -1,3 +1,3 @@
<div class="section__body" data-fragment-id="problem_stat">
<p>{{ _('{0} problems').format(pcount) }}</p>
</div>
<div class="section__body" data-fragment-id="problem_stat">
<p>{{ _('{0} problems').format(pcount) }}</p>
</div>
+5 -5
View File
@@ -29,11 +29,11 @@
</div>
<script>
var Context = {{ {
'problemId': pdoc['doc_id'],
'socketUrl': '{}-conn'.format(reverse_url('problem_pretest', pid=pdoc['doc_id'])),
'postPretestUrl': reverse_url('problem_pretest', pid=pdoc['doc_id']),
'postSubmitUrl': reverse_url('problem_submit', pid=pdoc['doc_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']),
'getSubmissionsUrl': reverse_url('problem_submit', pid=pdoc['doc_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['doc_id']),
'problemId': pdoc['_id'],
'socketUrl': '{}-conn'.format(reverse_url('problem_pretest', pid=pdoc['_id'])),
'postPretestUrl': reverse_url('problem_pretest', pid=pdoc['_id']),
'postSubmitUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getSubmissionsUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getRecordDetailUrl': reverse_url('record_detail', rid='{rid}'),
'code_lang': handler.get_setting('code_lang'),
'code_template': handler.get_code_template(),
+90 -78
View File
@@ -2,84 +2,96 @@
{% import "components/problem.html" as problem with context %}
{% extends "layout/basic.html" %}
{% block content %}
<script>
var Context = {{ {
'getProblemUrlWithCategory': reverse_url('problem_category', category='{category}'),
'getProblemUrlWithoutCategory': reverse_url('problem_main'),
'currentCategory': category,
}|json|safe }};
</script>
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body no-padding">
{% include "partials/problem_list.html" %}
</div>
</div>
</div>
<div class="medium-3 columns">
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Categories') }}</h1>
</div>
<div class="section__body"><ul class="group-list" data-widget-cf-container>
{% for category, sub_categories in categories.items() %}
<li class="group-list__item">
<h2 class="section__title"><a href="{{ reverse_url('problem_category', category=category|urlencode) }}">{{ category }}</a></h2>
{% if sub_categories|length > 0 %}
<ol class="chip-list">
{% for sub_category in sub_categories %}
<li class="chip-list__item"><a class="typo-a" href="{{ reverse_url('problem_category', category=(category|urlencode + ',' + sub_category|urlencode)) }}">{{ sub_category }}</a></li>
{% endfor %}
</ol>
{% endif %}
</li>
{% endfor %}
</ul></div>
<div class="section__body">
{% include "partials/problem_lucky.html" %}
</div>
</div>
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Search') }}</h1>
</div>
<form method="get" action="{{ reverse_url('problem_search') }}">
<div class="section__body">
<!-- TODO: replace with form_builder -->
<label>
<input name="q" type="text" class="textbox" value="" placeholder="1001">
</label>
<button type="submit" class="primary button">{{ _('Search') }}</button>
<script>
var Context = {
getProblemUrlWithCategory: "/p?category={{category}}",
getProblemUrlWithoutCategory: "/p",
currentCategory: "{{category}}"
};
</script>
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body no-padding">
{% include "partials/problem_list.html" %}
</div>
</div>
</div>
</form>
</div>
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_PROBLEM) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Problem') }}</h1>
</div>
<ol class="menu">
<li class="menu__item">
<a href="{{ reverse_url('problem_create') }}" class="menu__link"><span class="icon icon-add"></span> {{ _('Create Problem') }}</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('problem_copy') }}" class="menu__link"><span class="icon icon-copy"></span> {{ _('Copy Problem') }}</a>
</li>
</ol>
<div class="section__body">
<div class="typo supplementary">
<p>{{ _('You have permissions to create problems for this domain.') }}</p>
<div class="medium-3 columns">
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Categories') }}</h1>
</div>
<div class="section__body">
<ul class="group-list" data-widget-cf-container>
{% for category in builtin.CATEGORIES %}
{% for sub_categories in category %}
<li class="group-list__item">
<h2 class="section__title">
<a href="{{ reverse_url('problem_category', category=category|urlencode) }}">{{ category }}</a>
</h2>
{% if sub_categories | length > 0 %}
<ol class="chip-list">
{% for sub_category in sub_categories %}
<li class="chip-list__item">
<a class="typo-a" href="{{ reverse_url('problem_category', category=(category|urlencode + ',' + sub_category|urlencode)) }}">{{ sub_category }}</a>
</li>
{% endfor %}
</ol>
{% endif %}
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
<div class="section__body">
{% include "partials/problem_lucky.html" %}
</div>
</div>
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Search') }}</h1>
</div>
<form method="get" action="{{ reverse_url('problem_search') }}">
<div class="section__body">
<!-- TODO: replace with form_builder -->
<label>
<input name="q" type="text" class="textbox" value="" placeholder="1001">
</label>
<button type="submit" class="primary button">{{ _('Search') }}</button>
</div>
</form>
</div>
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_PROBLEM) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Problem') }}</h1>
</div>
<ol class="menu">
<li class="menu__item">
<a href="{{ reverse_url('problem_create') }}" class="menu__link">
<span class="icon icon-add"></span>
{{ _('Create Problem') }}</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('problem_copy') }}" class="menu__link">
<span class="icon icon-copy"></span>
{{ _('Copy Problem') }}</a>
</li>
</ol>
<div class="section__body">
<div class="typo supplementary">
<p>{{ _('You have permissions to create problems for this domain.') }}</p>
</div>
</div>
</div>
{% endif %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Statistics') }}</h1>
</div>
{% include "partials/problem_stat.html" %}
</div>
</div>
</div>
</div>
{% endif %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Statistics') }}</h1>
</div>
{% include "partials/problem_stat.html" %}
</div>
</div>
</div>
{% endblock %}
{% endblock %}
+2 -2
View File
@@ -7,10 +7,10 @@
<h1 class="section__title">{{ _('Dataset') }}</h1>
</div>
<div class="section__body">
<iframe src="{{ reverse_url('problem_upload', pid=pdoc['doc_id']) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<iframe src="{{ reverse_url('problem_upload', pid=pdoc['_id']) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<p class="help-text">{{ _('Hint') }}: <a href="{{ reverse_url('wiki_help') }}#upload">{{ _('Dataset Format') }}</a>, {{ _('An example of dataset') }}: <a href="https://github.com/vijos/jd4/blob/master/jd4/testdata/aplusb-legacy.zip?raw=true">{{ _('Download') }}</a></p>
{% if pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<p><a href="{{ reverse_url('problem_data', pid=pdoc['doc_id']) }}" class="expanded button">{{ _('Download Dataset') }}</a></p>
<p><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}" class="expanded button">{{ _('Download Dataset') }}</a></p>
{% endif %}
</div>
</div>
+1 -1
View File
@@ -81,7 +81,7 @@
<dd><a href="{{ reverse_url('record_pretest_data', rid=rdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% elif rdoc['type'] == vj4.constant.record.TYPE_SUBMISSION and pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<dt>{{ _('Problem Data') }}</dt>
<dd><a href="{{ reverse_url('problem_data', pid=pdoc['doc_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
<dd><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% endif %}
<dt>{{ _('Language') }}</dt>
<dd>
+87
View File
@@ -0,0 +1,87 @@
{% macro form_begin(kwargs) %}
{% set label = kwargs.pop('label') %}
{% set columns = kwargs.pop('columns') %}
{% set last_column = kwargs.pop('last_column', true) %}
{% set required = kwargs.pop('required', false) %}
{% set hotkeys = kwargs.pop('hotkeys', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% if row %}
<div class="row">
{% endif %}
<div
class="{% if columns %}medium-{{ columns }} {% endif %}columns form__item{% if last_column %} end{% endif %}"
{% if hotkeys %}data-hotkey="{{ hotkeys }}"{% endif %}
>
{% if not no_label %}
<label>
{{ _(label) }}
{% if required %}
({{ _('required') }})
{% endif %}
{% if not label_wrap %}
</label>
{% endif %}
{% endif %}
{% endmacro %}
{% macro form_end(kwargs) %}
{% set help_text = kwargs.pop('help_text', none) %}
{% set row = kwargs.pop('row', true) %}
{% set no_label = kwargs.pop('no_label', false) %}
{% set label_wrap = kwargs.pop('label_wrap', true) %}
{% if not no_label and label_wrap %}
</label>
{% endif %}
{% if help_text %}
<p class="help-text">{{ _(help_text)|safe }}</p>
{% endif %}
</div>
{% if row %}
</div>
{% endif %}
{% endmacro %}
{% macro form_attr(form_class, kwargs) %}
{% set disabled = kwargs.pop('disabled', false) %}
{% set required = kwargs.pop('required', false) %}
{% set autofocus = kwargs.pop('autofocus', false) %}
{% set date = kwargs.pop('date', false) %}
{% set time = kwargs.pop('time', false) %}
class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% if disabled %}disabled{% endif %}
{% if required %}required{% endif %}
{% if autofocus %}autofocus data-autofocus{% endif %}
{% if date %}data-pick-date{% endif %}
{% if time %}data-pick-time{% endif %}
{% endmacro %}
{% macro container_attr(container_class, kwargs) %}
{% set extra_class = kwargs.pop('extra_class', none) %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %}
{% macro select(options, name='', value='', kwargs) %}
<div
name="form_item_{{ name }}"
{{ container_attr('select-container', kwargs) }}
>
<select
name="{{ name }}"
{{ form_attr('select', kwargs) }}
>
{% for k, v in options %}
<option value="{{ k }}"{% if value == k %} selected{% endif %}>
{{ _(v) }}
</option>
{% endfor %}
</select>
</div>
{% endmacro %}
{% macro form_select(columns=5) %}
{{ form_begin({columns:1, ...kwargs}, kwargs) }}
{{ select(columns=columns, kwargs) }}
{{ form_end(columns=columns, kwargs) }}
{% endmacro %}
+7 -7
View File
@@ -79,7 +79,7 @@
<div class="section__body no-padding training__problems">
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -89,7 +89,7 @@
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -103,7 +103,7 @@
{% if pid in pdict %}
{% with pdoc=pdict[pid], psdoc=psdict[pid] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -111,9 +111,9 @@
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['doc_id'] }}">
<input type="hidden" name="pid" value="{{ pdoc['_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit">
@@ -164,7 +164,7 @@
<div class="section side">
<div>
<ol class="menu">
{% if not tsdoc['enroll'] and handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if not tsdoc['enroll'] and handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="menu__item">
<form action="" method="POST">
<input type="hidden" name="operation" value="enroll">
@@ -188,7 +188,7 @@
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd>
{% endif %}
{% if tsdoc['enroll'] %}
+2 -2
View File
@@ -37,7 +37,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% elif handler.has_perm(perm.PERM_LOGGEDIN) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
@@ -52,7 +52,7 @@
</div>
</div>
<div class="large-3 columns">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Enrolled') }}</h1>
+1 -1
View File
@@ -111,7 +111,7 @@
</div>
<div class="section__body">
{% for pdoc in pdocs %}
<p><a href="{{ reverse_url('problem_detail', pid=pdoc['doc_id']) }}">{{ pdoc['title'] }}</a></p>
<p><a href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">{{ pdoc['title'] }}</a></p>
{% endfor %}
</div>
{% endif %}{# if pdocs #}