remove ui

This commit is contained in:
undefined committed 2020-07-19 13:31:56 +08:00
1 parent 9dd370fa72
commit 87123659aa
546 files changed
+180 -33522

No files matched your search

+1 -1
View File
@@ -9,4 +9,4 @@ SETTINGS_PRIVACY.allowRegisteredUsers
model.setting.ui.name
pdoc.secretConfig?
在线IDE 更换颜色主题, fix resize
better place to store config.json
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env node
const hydro = require('../dist/loader');
hydro.addon('.');
try {
const uiDefault = require.resolve('@hydrooj/ui-default');
hydro.addon(uiDefault);
} catch (e) {
console.error('Please also install @hydrooj/ui-default');
process.exit(1);
}
hydro.load().catch((e) => {
console.error(e);
process.exit(1);
});
-51
View File
@@ -1,51 +0,0 @@
const fs = require('fs');
const path = require('path');
module.exports = {
formidable: () => {
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
for (const task of tasks) {
const p = require.resolve(`formidable/lib/${task}`);
const file = fs.readFileSync(p).toString().split('\n');
if (file[0].includes('if (global.GENTLY) require = GENTLY.hijack(require);')) {
file[0] = '// Hacked';
fs.writeFileSync(p, file.join('\n'));
} else if (!file[0].includes('// Hacked')) {
console.error('Cannot hack formidable', task);
}
}
},
sockjs: () => {
const p = require.resolve('sockjs/lib/sockjs.js');
const file = fs.readFileSync(p).toString().split('\n');
if (file[139].includes('this.app.log')) {
file[139] = '// Hacked';
fs.writeFileSync(p, file.join('\n'));
} else if (!file[139].includes('// Hacked')) {
console.error('Cannot hack sockjs');
}
},
saslprep: () => {
const q = require.resolve('saslprep');
const mem = path.join(path.dirname(q), 'code-points.mem');
const p = path.join(path.dirname(q), 'lib', 'memory-code-points.js');
const data = fs.readFileSync(mem);
const file = fs.readFileSync(p).toString().split('\n');
if (file[7].includes('fs.readFileSync')) {
file[7] = `const memory = Buffer.from('${data.toString('base64')}', 'base64');`;
fs.writeFileSync(p, file.join('\n'));
} else if (!file[7].includes('Buffer.from')) {
console.error('Cannot hack saslprep');
}
},
ftp: () => {
const p = require.resolve('ftp/lib/connection');
const file = fs.readFileSync(p).toString().split('\n');
if (file[51].includes('new Buffer')) {
file[51] = file[51].replace('new Buffer', 'Buffer.from');
fs.writeFileSync(p, file.join('\n'));
} else if (!file[51].includes('Buffer.from')) {
console.error('Cannot hack ftp');
}
},
};
-20
View File
@@ -1,20 +0,0 @@
/* eslint-disable no-await-in-loop */
const path = require('path');
const fs = require('fs-extra');
const argv = require('yargs-parser')(process.argv.slice(2));
const hack = require('./hack');
async function build(type) {
if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`);
fs.ensureDirSync(path.resolve(__dirname, '..', '.build'));
for (const task in hack) hack[task]();
console.log('Build::Main');
await require('./webpack')(type);
console.log('Build::Resources');
require('./resource')(type);
}
build(argv.development ? 'development' : 'production').catch((e) => {
console.error(e);
process.exit(1);
});
-13
View File
@@ -1,13 +0,0 @@
const AdmZip = require('adm-zip');
function build() {
const zip = new AdmZip();
zip.addLocalFolder('public', 'public');
zip.addLocalFolder('locales', 'locales');
zip.addLocalFolder('templates', 'templates');
zip.addLocalFolder('wiki', 'wiki');
zip.addLocalFile('package.json');
zip.writeZip('.build/builtin.hydro');
}
module.exports = build;
-59
View File
@@ -1,59 +0,0 @@
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const webpack = require('webpack');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const build = async (type) => {
const config = {
mode: type,
entry: {
app: path.resolve(__dirname, '..', 'hydro', 'loader.ts'),
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '..', '.build'),
},
target: 'node',
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'cache-loader',
options: {
cacheDirectory: path.resolve(__dirname, '..', '.cache', 'ts'),
},
},
'ts-loader',
],
},
],
},
node: {
__dirname: false,
},
resolve: { extensions: ['.js', '.ts'] },
plugins: [
new webpack.ProgressPlugin(),
new FriendlyErrorsPlugin({
clearConsole: false,
}),
],
};
const compiler = webpack(config);
await new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) {
console.error(err.stack || err);
if (err.details) console.error(err.details);
reject();
}
if (stats.hasErrors()) process.exitCode = 1;
resolve();
});
});
};
module.exports = build;
+14
View File
@@ -0,0 +1,14 @@
const loader = require('./dist/loader');
function load(callback) {
callback({ addon: loader.addon });
loader.load().catch((e) => {
console.error(e);
process.exit(1);
});
}
load.load = loader.load;
load.addon = loader.addon;
module.exports = load;
+1
View File
@@ -246,6 +246,7 @@ export async function wiki(pending: string[], fail: string[]) {
} catch (e) {
fail.push(i);
console.error(`Wiki Load Fail: ${i}`);
console.error(e);
}
}
}
+2 -2
View File
@@ -5,8 +5,8 @@ import {
builtinLib, builtinHandler, builtinModel,
} from './common';
export async function load(call) {
let pending = await require('../lib/hpm').getInstalled();
export async function load(call, args) {
let pending = args;
const fail = [];
require('../lib/i18n');
require('../utils');
+4 -3
View File
@@ -1,7 +1,7 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
import http from 'http';
import fs from 'fs-extra';
import Koa from 'koa';
import Body from 'koa-body';
import Router from 'koa-router';
@@ -89,7 +89,7 @@ const env = new nunjucks.Environment(new Loader(), { autoescape: true, trimBlock
function render(name) {
return new Promise((resolve, reject) => {
env.render(name, {
_: (str) => str,
_: (str: string) => str,
}, (err, res) => {
if (err) reject(err);
else resolve(res);
@@ -145,7 +145,8 @@ export function load() {
{ upsert: true },
),
]);
fs.writeFileSync(path.resolve(process.cwd(), 'config.json'), JSON.stringify({
fs.ensureDirSync(path.resolve(os.homedir(), '.hydro'));
fs.writeFileSync(path.resolve(os.homedir(), '.hydro', 'config.json'), JSON.stringify({
host, port, name, username, password,
}));
ctx.body = `<h1>This page will reload in 3 secs.</h1>
-78
View File
@@ -1,78 +0,0 @@
/* eslint-disable no-continue */
import os from 'os';
import path from 'path';
import AdmZip from 'adm-zip';
import fs from 'fs-extra';
const moduleRoots = [];
const _moduleRoots = Array.from(new Set([
path.resolve(process.cwd(), 'node_modules', '@hydrooj'),
path.resolve(process.cwd(), 'modules'),
path.resolve(process.cwd(), 'module'),
path.resolve(process.cwd(), '.build'),
process.cwd(),
path.resolve(__dirname, 'node_modules', '@hydrooj'),
path.resolve(__dirname, 'modules'),
path.resolve(__dirname, 'module'),
path.resolve(__dirname, '.build'),
__dirname,
path.resolve(os.homedir(), '.hydro', 'module'),
// TODO add npm global path
'/usr/local/share/.config/yarn/global/node_modules/@hydrooj',
path.resolve(os.homedir(), 'AppData', 'Local', 'Yarn', 'Data', 'global', 'node_modules', '@hydrooj'),
]));
for (const moduleRoot of _moduleRoots) {
if (fs.existsSync(moduleRoot)) moduleRoots.push(moduleRoot);
}
if (process.env.debug) console.log('Module roots: ', moduleRoots);
const moduleTemp = path.resolve(os.tmpdir(), 'hydro', 'module');
const publicTemp = path.resolve(os.tmpdir(), 'hydro', 'public');
const tmp = path.resolve(os.tmpdir(), 'hydro', '__');
process.on('unhandledRejection', (e) => {
console.error(e);
process.exit(1);
});
export async function load() {
fs.ensureDirSync(moduleTemp);
fs.ensureDirSync(publicTemp);
for (const moduleRoot of moduleRoots) {
if (fs.existsSync(moduleRoot)) {
const files = fs.readdirSync(moduleRoot);
for (const file of files) {
try {
const modulePath = path.join(moduleRoot, file);
const packagejson = path.join(modulePath, 'package.json');
if (fs.statSync(modulePath).isFile() && file.endsWith('.hydro')) {
// Is *.hydro module
const zip = new AdmZip(modulePath);
const targetPath = path.resolve(moduleTemp, file.split('.')[0]);
zip.extractAllTo(targetPath, true);
const content = fs.readdirSync(targetPath);
const ipath = path.join(targetPath, content[0]);
if (content.length === 1 && fs.statSync(ipath).isDirectory()) {
fs.moveSync(ipath, tmp);
fs.rmdirSync(targetPath);
fs.moveSync(tmp, targetPath);
}
const publicPath = path.resolve(moduleTemp, file.split('.')[0], 'public');
if (fs.existsSync(publicPath)) fs.copySync(publicPath, publicTemp);
} else if (fs.existsSync(packagejson)) {
// Is a npm package
const q = fs.readFileSync(packagejson).toString();
if (!JSON.parse(q).name.startsWith('@hydrooj/')) continue;
const publicPath = path.resolve(modulePath, 'public');
if (fs.existsSync(publicPath)) fs.copySync(publicPath, publicTemp);
} else continue;
} catch (e) {
console.error('Module extract fail:', file, e);
}
}
}
}
console.log('Unzip done.');
process.exit(0);
}
+2 -2
View File
@@ -5,8 +5,8 @@ import {
builtinLib, builtinScript, builtinHandler, builtinModel,
} from './common';
export async function load() {
let pending = await require('../lib/hpm').getInstalled();
export async function load(call, args) {
let pending = args;
const fail = [];
const active = [];
require('../lib/i18n');
+2 -1
View File
@@ -292,8 +292,9 @@ declare global {
locales: Dict<Dict<string>>,
postInit: Function[],
},
nodeModules: any,
onDestory: Function[],
addons: string[],
argv: any,
}
}
}
+1 -15
View File
@@ -13,20 +13,6 @@ const moduleRoots = Array.from(new Set([
path.resolve(os.tmpdir(), 'hydro', 'module'),
]));
export async function getInstalled() {
const modules = [];
for (const moduleRoot of moduleRoots) {
if (fs.existsSync(moduleRoot)) {
const files = fs.readdirSync(moduleRoot);
for (const file of files) {
const info = path.resolve(moduleRoot, file, 'package.json');
if (fs.existsSync(info)) modules.push(path.resolve(moduleRoot, file));
}
}
}
return modules;
}
export async function getDetail() {
const modules = [];
for (const moduleRoot of moduleRoots) {
@@ -55,5 +41,5 @@ export function install(url: string, name: string = '') {
}
global.Hydro.lib.hpm = {
getInstalled, getDetail, install,
getDetail, install,
};
+75 -23
View File
@@ -1,12 +1,17 @@
/* eslint-disable no-continue */
/* eslint-disable import/no-dynamic-require */
/* eslint-disable no-await-in-loop */
/* eslint-disable no-eval */
import './interface';
import os from 'os';
import path from 'path';
import cluster from 'cluster';
import fs from 'fs-extra';
import parse from 'yargs-parser';
import AdmZip from 'adm-zip';
const argv = parse(process.argv.slice(2));
global.argv = parse(process.argv.slice(2));
global.Hydro = {
stat: { reqCount: 0 },
@@ -30,8 +35,9 @@ global.Hydro = {
postInit: [],
};
global.onDestory = [];
global.addons = [];
if (argv.debug) {
if (global.argv.debug) {
console.log(process.argv);
process.env.debug = 'enable';
}
@@ -46,7 +52,7 @@ async function terminate() {
async function fork(args: string[] = []) {
const _args = process.argv.slice(2);
_args.push(...args);
_args.push(...args, `--addons=${Buffer.from(JSON.stringify(global.addons)).toString('base64')}`);
cluster.setupMaster({ args: _args });
return cluster.fork();
}
@@ -54,7 +60,8 @@ async function fork(args: string[] = []) {
async function entry(config: any) {
if (config.entry) {
if (config.newProcess) {
const p = await fork([`--entry=${config.entry}`]);
const sargv = [`--entry=${config.entry}`];
const p = await fork(sargv);
await new Promise((resolve, reject) => {
p.on('exit', resolve);
p.on('error', (err: Error) => {
@@ -64,7 +71,7 @@ async function entry(config: any) {
});
} else {
const loader = require(`./entry/${config.entry}`);
return await loader.load(entry);
return await loader.load(entry, global.addons);
}
}
return null;
@@ -75,8 +82,9 @@ async function stopWorker() {
}
async function startWorker(cnt: number) {
await fork(['--firstWorker']);
for (let i = 1; i < cnt; i++) await fork();
const sargv = [`--args=${Buffer.from(JSON.stringify(global.addons)).toString('base64')}`];
await fork(['--firstWorker', ...sargv]);
for (let i = 1; i < cnt; i++) await fork(sargv);
}
async function executeCommand(input: string) {
@@ -92,7 +100,9 @@ async function executeCommand(input: string) {
async function messageHandler(worker: cluster.Worker, msg: any) {
if (!msg) msg = worker;
if (msg.event) {
if (msg.event === 'bus') {
if (msg.event === 'setAddon') {
global.addons = msg.addons;
} else if (msg.event === 'bus') {
if (cluster.isMaster) {
for (const i in cluster.workers) {
cluster.workers[i].send(msg);
@@ -113,19 +123,61 @@ async function messageHandler(worker: cluster.Worker, msg: any) {
}
}
async function load() {
global.nodeModules = {
'adm-zip': require('adm-zip'),
superagent: require('superagent'),
'js-yaml': require('js-yaml'),
mongodb: require('mongodb'),
};
const moduleTemp = path.resolve(os.tmpdir(), 'hydro', 'module');
const publicTemp = path.resolve(os.tmpdir(), 'hydro', 'public');
const tmp = path.resolve(os.tmpdir(), 'hydro', '__');
export function addon(addonPath: string) {
let modulePath = path.resolve(addonPath);
if (!(fs.existsSync(addonPath) && fs.statSync(addonPath).isFile())) {
try {
// Is a npm package
const packagejson = require.resolve(`${addonPath}/package.json`);
modulePath = path.dirname(packagejson);
const publicPath = path.resolve(modulePath, 'public');
if (fs.existsSync(publicPath)) fs.copySync(publicPath, publicTemp);
global.addons.push(modulePath);
} catch (e) {
throw new Error(`Addon not found: ${addonPath}`);
}
} else {
try {
// Is *.hydro module
const t = modulePath.split(path.sep);
const name = t[t.length - 1].split('.')[0];
const zip = new AdmZip(modulePath);
const targetPath = path.resolve(moduleTemp, name);
zip.extractAllTo(targetPath, true);
const content = fs.readdirSync(targetPath);
const ipath = path.join(targetPath, content[0]);
if (content.length === 1 && fs.statSync(ipath).isDirectory()) {
fs.moveSync(ipath, tmp);
fs.rmdirSync(targetPath);
fs.moveSync(tmp, targetPath);
}
const publicPath = path.resolve(targetPath, 'public');
if (fs.existsSync(publicPath)) fs.copySync(publicPath, publicTemp);
global.addons.push(targetPath);
} catch (e) {
console.error('Addon load fail: ', e);
throw e;
}
}
}
export async function load() {
while (!global.addons) {
await new Promise((resolve) => {
setTimeout(resolve, 100);
});
}
addon(path.resolve(__dirname, '..'));
Error.stackTraceLimit = 50;
process.on('unhandledRejection', (e) => console.error(e));
process.on('SIGINT', terminate);
process.on('message', messageHandler);
cluster.on('message', messageHandler);
if (cluster.isMaster || argv.startAsMaster) {
if (cluster.isMaster || global.argv.startAsMaster) {
console.log(`Master ${process.pid} Starting`);
process.stdin.setEncoding('utf8');
process.stdin.on('data', (buf) => {
@@ -139,7 +191,6 @@ async function load() {
executeCommand(input);
}
});
await entry({ entry: 'unzip', newProcess: true });
const cnt = await entry({ entry: 'master' });
console.log('Master started');
cluster.on('exit', (worker, code, signal) => {
@@ -153,14 +204,15 @@ async function load() {
});
cluster.on('online', (worker) => {
console.log(`Worker ${worker.process.pid} ${worker.id} is online`);
worker.send({ event: 'setAddon', addons: global.addons });
});
await startWorker(cnt);
} else if (argv.entry) {
console.log(`Worker ${process.pid} Starting as ${argv.entry}`);
await entry({ entry: argv.entry });
console.log(`Worker ${process.pid} Started as ${argv.entry}`);
} else if (global.argv.entry) {
console.log(`Worker ${process.pid} Starting as ${global.argv.entry}`);
await entry({ entry: global.argv.entry });
console.log(`Worker ${process.pid} Started as ${global.argv.entry}`);
} else {
if (argv.firstWorker) cluster.isFirstWorker = true;
if (global.argv.firstWorker) cluster.isFirstWorker = true;
else cluster.isFirstWorker = false;
console.log(`Worker ${process.pid} Starting`);
await entry({ entry: 'worker' });
@@ -169,7 +221,7 @@ async function load() {
if (global.gc) global.gc();
}
if (argv.pandora || !module.parent) {
if (global.argv.pandora || !module.parent) {
load().catch((e) => {
console.error(e);
process.exit(1);
+1 -10
View File
@@ -113,6 +113,7 @@ SystemSetting(
Setting('setting_smtp', 'smtp.port', null, 465, 'number', 'SMTP Server Port'),
Setting('setting_smtp', 'smtp.from', null, null, 'text', 'Mail From'),
Setting('setting_smtp', 'smtp.secure', null, false, 'boolean', 'SSL'),
Setting('setting_server', 'server.name', null, 'Hydro', 'text', 'Server Name'),
Setting('setting_server', 'server.worker', null, 1, 'number', 'Server Workers Number'),
Setting('setting_server', 'server.hostname', null, null, 'text', 'Server Hostname'),
Setting('setting_server', 'server.host', null, null, 'text', 'Server Host'),
@@ -125,16 +126,6 @@ SystemSetting(
Setting('setting_session', 'session.secure', null, false, 'boolean', 'session.secure'),
Setting('setting_session', 'session.saved_expire_seconds', null, 3600 * 24 * 30, 'number', 'Saved session expire seconds'),
Setting('setting_session', 'session.unsaved_expire_seconds', null, 3600 * 3, 'number', 'Unsaved session expire seconds'),
Setting('setting_ui', 'ui.name', null, 'Hydro', 'text', 'Site Name'),
Setting('setting_ui', 'ui.footer_extra_html', null, '', 'textarea', 'Footer Extra HTML'),
Setting('setting_ui', 'ui.header_logo', null, '/components/header/header-logo.png', 'text', 'Header Logo'),
Setting('setting_ui', 'ui.header_logo_2x', null, '/components/header/header-logo@2x.png', 'text', 'Header Logo@2x'),
Setting('setting_ui', 'ui.header_background', null, '/components/header/header-background.png', 'text', 'Header Background'),
Setting('setting_ui', 'ui.header_background_2x', null, '/components/header/header-background@2x.png', 'text', 'Header Background@2x'),
Setting('setting_ui', 'ui.nav_logo_light', null, '/components/navigation/nav-logo-small_light.png', 'text', 'Nav Logo(Light)'),
Setting('setting_ui', 'ui.nav_logo_dark', null, '/components/navigation/nav-logo-small_dark.png', 'text', 'Nav Logo(Dark)'),
Setting('setting_ui', 'ui.nav_logo_light_2x', null, '/components/navigation/nav-logo-small@2x_light.png', 'text', 'Nav Logo@2x(Light)'),
Setting('setting_ui', 'ui.nav_logo_dark_2x', null, '/components/navigation/nav-logo-small@2x_dark.png', 'text', 'Nav Logo@2x(Dark)'),
Setting('setting_oauth', 'oauth.githubappid', null, null, 'text', 'Github Oauth AppID'),
Setting('setting_oauth', 'oauth.githubsecret', null, null, 'text', 'Github Oauth Secret', null, FLAG_SECRET),
Setting('setting_oauth', 'oauth.googleappid', null, null, 'text', 'Google Oauth ClientID', null),
+1
View File
@@ -6,6 +6,7 @@ export default function load() {
let f = path.resolve(process.cwd(), 'config.json');
if (!fs.existsSync(f)) f = path.resolve(__dirname, 'config.json');
if (!fs.existsSync(f)) f = path.resolve(os.homedir(), '.config', 'hydro', 'config.json');
if (!fs.existsSync(f)) f = path.resolve(os.homedir(), '.hydro', 'config.json');
if (!fs.existsSync(f)) f = path.resolve('/config/config.json');
return JSON.parse(fs.readFileSync(f).toString());
}
+6 -21
View File
@@ -1,7 +1,8 @@
{
"name": "hydrooj",
"version": "2.8.5",
"main": "hydro/loader.ts",
"version": "2.9.0",
"main": "entry.js",
"bin": "bin/hydrooj.js",
"repository": "https://github.com/hydro-dev/Hydro.git",
"author": "masnn",
"license": "GPL-3.0-only",
@@ -65,35 +66,19 @@
"@types/yargs": "^15.0.5",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"cache-loader": "^4.1.0",
"eslint": "^7.4.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"friendly-errors-webpack-plugin": "^1.7.0",
"snyk": "^1.354.0",
"ts-loader": "^8.0.0",
"typescript": "^3.9.6",
"webpack": "^4.42.1"
"typescript": "^3.9.7"
},
"scripts": {
"build": "node build --development",
"build:development": "node build --development",
"build:production": "node build --production",
"build:all": "cd ui && yarn && yarn build:production && cd .. && yarn && yarn build:production",
"start": "ts-node hydro/loader.ts",
"pkg": "pkg .",
"build": "tsc",
"build:watch": "tsc --watch",
"lint": "eslint build hydro tool --ext ts,js --fix",
"snyk-protect": "snyk protect",
"prepare": "yarn run snyk-protect"
},
"pkg": {
"scripts": [
".build/app.js"
],
"assets": [
".build/module/**"
]
},
"snyk": true
}
-34
View File
@@ -1,34 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Hydro 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;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>
<span style="color: #75715e">/*</span>
<span style="color: #75715e">{{ error.message }}</span>
<span style="color: #75715e">{{ error.stack }}</span>
<span style="color: #75715e">*/</span>
</pre>
</div>
</body>
</html>
@@ -1,150 +0,0 @@
{% import "components/user.html" as user with context %}
{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %}
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
<div class="media">
<div class="media__left top">
<img src="{{ gravatar(udoc['gravatar']) }}" width="50" height="50" class="medium user-profile-avatar">
</div>
<div class="media__body top no-heading">
{% if not mode_create %}
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, avatar=false) }}
@ {{ datetimeSpan(rdoc['_id'])|safe }}
</div>
{{ reply_operations(doc, rdoc) }}
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('discussion_tail_reply_raw', did=doc.parentId, drid=doc._id, drrid=rdoc._id) }}">
{{ rdoc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
{% else %}
<div class="commentbox-placeholder"></div>
{% endif %}
</div>
</div>
</li>
{% endmacro %}
{% macro reply_operations(doc, rdoc) %}
<div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.user._id or handler.user.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{{ {operation: reply_edit_op, drid: doc._id, drrid: rdoc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.user._id or handler.user.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{{ {operation: reply_delete_op, drid: doc._id, drrid: rdoc._id}|json }}"
><span class="icon icon-delete"></span></a>
{% endif %}
</div>
{% endmacro %}
{% macro render(
view, docs, udict,
comment_ref,
reply_ref,
comment_post_perm,
comment_edit_perm,
comment_edit_self_perm,
comment_delete_perm,
comment_delete_self_perm,
reply_post_perm,
reply_edit_perm,
reply_edit_self_perm,
reply_delete_perm,
reply_delete_self_perm,
comment_placeholder = 'Write Your Comment',
comment_post_op = 'reply',
comment_edit_op = 'edit_reply',
comment_post_text = 'Comment',
comment_edit_text = 'Update',
reply_post_op = 'tail_reply',
reply_post_text = 'Reply',
reply_edit_op = 'edit_tail_reply',
reply_edit_text = 'Update',
comment_delete_op = 'delete_reply',
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--discussion">
{% if handler.user.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
<img src="{{ gravatar(handler.user.gravatar) }}" width="60" height="60" class="medium user-profile-avatar">
</div>
<div class="media__body top no-heading">
<div class="hasjs--hide">
<form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel">
<div>
<textarea name="content" class="textbox" data-markdown required></textarea>
</div>
<div>
<input type="submit" class="rounded primary button dczcomments__box__submit" value="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-reply="{{ _(reply_post_text) }} (Ctrl+Enter)" data-value-comment="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-comment-update="{{ _(comment_edit_text) }} (Ctrl+Enter)" data-value-reply-update="{{ _(reply_edit_text) }} (Ctrl+Enter)">
<input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="{{ _('Cancel') }} (Esc)">
</div>
<input type="hidden" name="operation" value="{{ comment_post_op }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
</form>
</div>
<div class="nojs--hide">
<textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{{ {operation: comment_post_op}|json }}" placeholder="{{ _(comment_placeholder) }}"></textarea>
</div>
<div class="commentbox-placeholder"></div>
<ul style="display:none">
{{ reply(true, handler.user) }}
</ul>
</div>
</div>
</li>
{% endif %}
{% for doc in docs %}
{% set udoc = udict[doc.owner] %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
<img src="{{ gravatar(udoc['gravatar']) }}" width="60" height="60" class="medium user-profile-avatar">
</div>
<div class="media__body top no-heading">
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, avatar=false) }}
@ {{ datetimeSpan(doc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{{ {operation: reply_post_op, drid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{{ {operation: comment_edit_op, drid: doc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{{ {operation: comment_delete_op, drid: doc._id}|json }}"
><span class="icon icon-delete"></span></a>
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('discussion_reply_raw', did=doc.parentId, drid=doc._id) }}">
{{ doc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
<ul class="dczcomments__replies commentbox-reply-target">
{% for rdoc in doc['reply'] %}
{{ reply(false, udict[rdoc.owner], doc, rdoc) }}
{% endfor %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ul>
{% endmacro %}
-177
View File
@@ -1,177 +0,0 @@
{% import "components/user.html" as user with context %}
{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %}
{% endmacro %}
{% macro render(
view, docs, udict,
comment_ref,
reply_ref,
comment_post_perm,
comment_edit_perm,
comment_edit_self_perm,
comment_delete_perm,
comment_delete_self_perm,
reply_post_perm,
reply_edit_perm,
reply_edit_self_perm,
reply_delete_perm,
reply_delete_self_perm,
comment_placeholder = 'Write Your Comment',
comment_post_op = 'reply',
comment_edit_op = 'edit_reply',
comment_post_text = 'Comment',
comment_edit_text = 'Update',
reply_post_op = 'tail_reply',
reply_post_text = 'Reply',
reply_edit_op = 'edit_tail_reply',
reply_edit_text = 'Update',
comment_delete_op = 'delete_reply',
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--solution">
{% if handler.user.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
<div class="vote vote--discussion">
<div class="vote-number">0</div>
</div>
</div>
<div class="media__body top no-heading">
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(handler.user) }}
</div>
</div>
<div class="hasjs--hide">
<form method="post" class="dczcomments__box" name="dczcomments__box__form" data-hotkey="ctrl+enter:submit,esc:vjCommentBoxCancel">
<div>
<textarea name="content" class="textbox" data-markdown required></textarea>
</div>
<div>
<input type="submit" class="rounded primary button dczcomments__box__submit" value="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-reply="{{ _(reply_post_text) }} (Ctrl+Enter)" data-value-comment="{{ _(comment_post_text) }} (Ctrl+Enter)" data-value-comment-update="{{ _(comment_edit_text) }} (Ctrl+Enter)" data-value-reply-update="{{ _(reply_edit_text) }} (Ctrl+Enter)">
<input type="button" class="rounded button nojs--hide" name="dczcomments__box__cancel" value="{{ _('Cancel') }} (Esc)">
</div>
<input type="hidden" name="operation" value="{{ comment_post_op }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
</form>
</div>
<div class="nojs--hide">
<textarea class="textbox" name="dczcomments__dummy-box" readonly data-form="{{ {operation: comment_post_op}|json }}" placeholder="{{ _(comment_placeholder) }}"></textarea>
</div>
<div class="commentbox-placeholder"></div>
<ul style="display:none">
<li class="dczcomments__reply commentbox-container">
<div class="media">
<div class="media__body top no-heading">
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(handler.user, badge=false) }}
</div>
</div>
<div class="commentbox-placeholder"></div>
</div>
</div>
</li>
</ul>
</div>
</div>
</li>
{% endif %}
{% for doc in docs %}
{% set udoc = udict[doc.owner] %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
<div class="vote vote--discussion">
{% if handler.user.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
<div class="vote-number rotator--enabled">{{ doc.vote }}</div>
<div class="vote-op clearfix">
<form method="post">
<input type="hidden" name="operation" value="upvote">
<input type="hidden" name="psid" value="{{ doc._id }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="vote-button upvote{% if pssdict[doc._id].vote == 1 %} active{% endif %}" data-tooltip="{{ _('Upvote') }}" data-tooltip-pos="bottom center" aria-label="{{ _('Upvote') }}"><span class="icon icon-vote--up"></span></button>
</form>
<form method="post">
<input type="hidden" name="operation" value="downvote">
<input type="hidden" name="psid" value="{{ doc._id }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="vote-button downvote{% if pssdict[doc._id].vote == -1 %} active{% endif %}" data-tooltip="{{ _('Downvote') }}" data-tooltip-pos="bottom center" aria-label="{{ _('Downvote') }}"><span class="icon icon-vote--down"></span></button>
</form>
</div>
{% else %}
<div class="vote-number">{{ doc.vote }}</div>
{% endif %}
</div>
</div>
<div class="media__body top no-heading">
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc) }}
@ {{ datetimeSpan(doc._id)|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{{ {operation: comment_edit_op, psid: doc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{{ {operation: comment_delete_op, psid: doc._id}|json }}"
><span class="icon icon-delete"></span></a>
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('problem_solution_raw', pid=doc.parentId, psid=doc._id) }}">
{{ doc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
<ul class="dczcomments__replies commentbox-reply-target">
{% for rdoc in doc['reply'] %}
{% set udoc = udict[rdoc['owner']] %}
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
<div class="media">
<div class="media__body top no-heading">
<div class="clearfix">
<div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc, badge=false) }} @ {{ datetimeSpan(rdoc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if (handler.user.hasPerm(reply_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{{ {operation: reply_edit_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if (handler.user.hasPerm(reply_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{{ {operation: reply_delete_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-delete"></span></a>
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('problem_solution_reply_raw', pid=doc.parentId, psid=doc._id, psrid=rdoc._id) }}">
{{ rdoc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ul>
{% endmacro %}
-8
View File
@@ -1,8 +0,0 @@
{% import "components/user.html" as user with context %}
{% macro render_time(tdoc_time) %}
{{ datetimeSpan(tdoc_time, false, '%Y-%m-%d %H:%M')|safe }}
{% endmacro %}
{% macro render_duration(tdoc) %}
{{ ((tdoc.endAt.getTime() - tdoc.beginAt.getTime()) /1000 / 3600)|round(1) }}
{% endmacro %}
-201
View File
@@ -1,201 +0,0 @@
{% macro form_begin(args) %}
{% set label = args.label %}
{% set columns = args.columns %}
{% set last_column = args.last_column|default(true) %}
{% set required = args.required or false %}
{% set hotkeys = args.hotkeys or none %}
{% set row = args.row|default(true) %}
{% set no_label = args.no_label or false %}
{% set label_wrap = args.label_wrap|default(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(args) %}
{% set help_text = args.help_text or none %}
{% set row = args.row|default(true) %}
{% set no_label = args.no_label or false %}
{% set label_wrap = args.label_wrap|default(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, args) %}
{% set disabled = args.disabled or false %}
{% set required = args.required or false %}
{% set autofocus = args.autofocus or false %}
{% set date = args.date or false %}
{% set time = args.time or 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, args) %}
{% set extra_class = args.extra_class or none %}
class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}"
{% endmacro %}
{% macro select(args) %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('select-container', args) }}
>
<select
name="{{ args.name }}"
{{ form_attr('select', args) }}
>
{% for k, v in args.options %}
<option value="{{ k }}"{% if args.value == k %} selected{% endif %}>
{{ _(v) }}
</option>
{% endfor %}
</select>
</div>
{% endmacro %}
{% macro form_select(args) %}
{{ form_begin({columns:5}|assign(args)) }}
{{ select(args) }}
{{ form_end(args) }}
{% endmacro %}
{% macro radio(args) %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('radiobox-container', args) }}
>
{% for k, v in options %}
<label class="radiobox">
<input
value="{{ k }}"
type="radio"
name="{{ v }}"
{{ form_attr('radiobox__input', args) }}
{% if value == args.id %} checked{% endif %}
/> {{ _(v) }}
</label>
{% endfor %}
</div>
{% endmacro %}
{% macro form_radio(args) %}
{{ form_begin({columns:5, label_wrap:false}|assign(args)) }}
{{ radio(args) }}
{{ form_end({label_warp:false}|assign(args)) }}
{% endmacro %}
{% macro image_radio(args) %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('radiobox-container with-image', args) }}
>
{% for k, v in options %}
<label class="radiobox with-image">
<input
value="{{ k }}"
type="radio"
name="{{ args.name }}"
{{ form_attr('radiobox__input', args) }}
{% if value == k %} checked{% endif %}
/>
<div class="radiobox__image-container" data-tooltip="{{ _(v) }}">
<div class="radiobox__image {{ image_class.format(k) }}"></div>
</div>
</label>
{% endfor %}
</div>
{% endmacro %}
{% macro form_image_radio(args) %}
{{ form_begin({columns:8, label_warp:false}|assign(args)) }}
{{ image_radio(args) }}
{{ form_end({label_warp:false}|assign(args)) }}
{% endmacro %}
{% macro text(args) %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('textbox-container', args) }}
>
<input
type="{{ args.type or 'text' }}"
name="{{ args.name }}"
value="{{ args.value }}"
placeholder="{{ args.placeholder }}"
{{ form_attr('textbox', args) }}
>
</div>
{% endmacro %}
{% macro form_text(args) %}
{{ form_begin({columns:5}|assign(args)) }}
{{ text(args) }}
{{ form_end(args) }}
{% endmacro %}
{% macro textarea(args) %}
{% set markdown = args.markdown or false %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('textarea-container', args) }}
>
<textarea
name="{{ args.name }}"
placeholder="{{ args.placeholder }}"
{% if markdown %}data-markdown{% endif %}
{{ form_attr('textbox', args) }}
>{{ args.value }}</textarea>
</div>
{% endmacro %}
{% macro form_textarea(args) %}
{{ form_begin({columns:8}|assign(args)) }}
{{ textarea(args) }}
{{ form_end(args) }}
{% endmacro %}
{% macro checkbox(args) %}
<div
name="form_item_{{ args.name }}"
{{ container_attr('checkbox-container', args) }}
>
<label class="checkbox">
<input type="checkbox" name="{{ args.name }}"{% if args.value %} checked{% endif %}
{{ form_attr('checkbox', args) }}
>{{ _(args.label) }}
</label>
</div>
{% endmacro %}
{% macro form_checkbox(args) %}
{{ form_begin({columns:5, no_label:true}|assign(args)) }}
{{ checkbox(args) }}
{{ form_end({no_label:true}|assign(args)) }}
{% endmacro %}
-15
View File
@@ -1,15 +0,0 @@
{% import "components/sidemenu.html" as sidemenu with context %}
{% macro render_sidebar() %}
<div class="section side">
<ol class="menu">
{{ sidemenu.render_item('account--circle', 'user_detail', {uid:handler.user._id}, label='My Profile') }}
{{ sidemenu.render_item('comment--multiple', 'home_messages') }}
<li class="menu__seperator"></li>
{{ sidemenu.render_item('wrench', 'home_settings', {category:'account'}) }}
{{ sidemenu.render_item('sliders', 'home_settings', {category:'preference'}) }}
{{ sidemenu.render_item('security', 'home_security') }}
<li class="menu__seperator"></li>
{{ sidemenu.render_item('file', 'home_file') }}
</ol>
</div>
{% endmacro %}
-8
View File
@@ -1,8 +0,0 @@
{% import "components/user.html" as user with context %}
{% macro render_time(tdoc_time) %}
{{ datetimeSpan(tdoc_time, false, '%Y-%m-%d %H:%M')|safe }}
{% endmacro %}
{% macro render_extension(tdoc) %}
{{ ((tdoc['endAt'].getTime() - tdoc['penaltySince'].getTime())/ 1000 / 3600/ 24)|round(1) }}
{% endmacro %}
-29
View File
@@ -1,29 +0,0 @@
<div class="section side">
<div class="section__body typo">
<dl>
<dt>{{ _('Inline codes') }}</dt>
<dd><pre>`std::cout()`</pre></dd>
<dt>{{ _('Code blocks') }}</dt>
<dd>
<pre>```c++
int main() {
return 0;
}
```</pre>
</dd>
<dt>{{ _('Inline formulas') }}</dt>
<dd><pre>$ E=mc^2 $</pre></dd>
<dt>{{ _('Formula blocks') }}</dt>
<dd><pre>$$ E=mc^2 $$</pre></dd>
<dt>{{ _('Links') }}</dt>
<dd><pre>[{{ _('Text') }}](http://...)</pre></dd>
<dt>{{ _('Images') }}</dt>
<dd><pre>![{{ _('Description') }}](http://...)</pre></dd>
</dl>
<h2>{{ _('Learn More') }}</h2>
<ul>
<li><a href="http://commonmark.org/help/" target="_blank"><span class="icon icon-link--external"></span> {{ _('CommonMark Syntax') }}</a></li>
<li><a href="http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm" target="_blank"><span class="icon icon-link--external"></span> {{ _('LaTeX Expressions') }}</a></li>
</ul>
</div>
</div>
-15
View File
@@ -1,15 +0,0 @@
{% macro render() %}
{% if not isIE(handler.request.headers['user-agent']) %}
<noscript><div class="section__body no-padding">
<blockquote class="warn">
<p>{{ _('This page needs JavaScript to work.') }}</p>
</blockquote>
</div></noscript>
{% else %}
<div class="section__body no-padding">
<blockquote class="warn">
<p>{{ _('This page needs JavaScript to work.') }}</p>
</blockquote>
</div>
{% endif %}
{% endmacro %}
-6
View File
@@ -1,6 +0,0 @@
{% macro render(text, compact=false) %}
<div class="nothing-placeholder{% if compact %} compact{% endif %}">
<div class="nothing-icon"></div>
{{ _(text) }}
</div>
{% endmacro %}
-25
View File
@@ -1,25 +0,0 @@
{% macro render(page, num_pages, add_qs='') %}
{% if num_pages > 0 %}
<ul class="pager">
{% for type, page0 in paginate(page, num_pages) %}
<li>
{% if type == 'first' %}
<a class="pager__item first link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_first') }}</a>
{% elif type == 'previous' %}
<a class="pager__item previous link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_previous') }}</a>
{% elif type == 'ellipsis' %}
<span class="pager__item ellipsis">...</span>
{% elif type == 'page' %}
<a class="pager__item page link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ page0 }}</a>
{% elif type == 'current' %}
<span class="pager__item current">{{ page0 }}</span>
{% elif type == 'next' %}
<a class="pager__item next link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_next') }}</a>
{% elif type == 'last' %}
<a class="pager__item last link" href="?page={{ page0 }}{% if add_qs %}&{{ add_qs }}{% endif %}">{{ _('pager_last') }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
-37
View File
@@ -1,37 +0,0 @@
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false) %}
{%- if not invalid %}
<a
{%- if tdoc and tdoc.docType == model.document.TYPE_CONTEST %}
href="{{ url('contest_detail_problem', tid=tdoc.docId, pid=pdoc.docId) }}"
{%- elif tdoc and tdoc.docType == model.document.TYPE_HOMEWORK %}
href="{{ url('homework_detail_problem', tid=tdoc.docId, pid=pdoc.docId) }}"
{%- else %}
href="{{ url('problem_detail', pid=pdoc.pid) }}"
{%- endif %}
>
{%- endif %}
{{ pdoc['pid'] }} {{ pdoc['title'] }}
{%- if not invalid %}
</a>
{%- endif %}
{%- if pdoc['hidden'] and show_invisible_flag %}
<span class="text-orange">({{ _('Hidden') }})</span>
{%- endif %}
{%- if show_tags %}
{{ render_problem_tags(pdoc) }}
{%- endif %}
{% endmacro %}
{% macro render_problem_tags(pdoc, show_none_label=false) %}
{%- if pdoc['tag']|length > 0 %}
<ul class="problem__tags">
{%- for tag in pdoc['tag'] %}
<li class="problem__tag"><a class="problem__tag-link" href="{{ url('problem_category', category=tag) }}">{{ tag }}</a></li>
{%- endfor %}
</ul>
{%- else %}
{%- if show_none_label %}
{{ _('(None)') }}
{%- endif %}
{%- endif %}
{% endmacro %}
-15
View File
@@ -1,15 +0,0 @@
{% macro render_status_td(rdoc, rid_key='_id') %}
<td class="col--status record-status--border {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
<div class="col--status__text">
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
<a href="{{ url('record_detail', rid=rdoc._id) }}" class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
{{ model.builtin.STATUS_TEXTS[rdoc['status']] }}
</a>
</div>
{% if rdoc['status'] == STATUS.STATUS_JUDGING %}
<div class="col--status__progress-container">
<div class="col--status__progress" style="width: {{ rdoc['progress']|default(50)|int }}%"></div>
</div>
{% endif %}
</td>
{% endmacro %}
-15
View File
@@ -1,15 +0,0 @@
{% macro render_item(icon_name, page_name, args={}, label=none) %}
{% set target_url = url(page_name, args) %}
<li class="menu__item" id="menu-item-{{ page_name }}">
<a href="{{ target_url }}" class="menu__link{% if handler.request.path == target_url %} active{% endif %}">
{% if icon_name %}
<span class="icon icon-{{ icon_name }}"></span>
{% endif %}
{% if label %}
{{ _(label) }}
{% else %}
{{ _(page_name) }}
{% endif %}
</a>
</li>
{% endmacro %}
-21
View File
@@ -1,21 +0,0 @@
{% macro render_inline(
udoc,
avatar=true,
badge=true,
modbadge=true
) %}
<span class="user-profile-link">
{% if avatar %}
<img class="small user-profile-avatar v-center" src="{{ gravatar(udoc['gravatar']|default('')) }}" width="20" height="20">
{% endif %}
<a class="user-profile-name" href="{{ url('user_detail', uid=udoc._id) }}">
{{ udoc['uname'] }}
</a>
{% if badge %}
<a class="user-profile-badge v-center badge--lv{{ udoc['level']|default(0) }}" href="{{ url('user_detail', uid=udoc._id) }}" title="LV {{ udoc['level']|default(0) }}: Top {{ model.builtin.LEVELS[udoc['level']|default(0)]|default('N/A') }}%">LV {{ udoc['level']|default(0) }}</a>
{% if modbadge and udoc.hasPerm(perm.PERM_MOD_BADGE) %}
<span class="user-profile-badge v-center badge--mod" title="Moderator">MOD</span>
{% endif %}
{% endif %}
</span>
{% endmacro %}
-79
View File
@@ -1,79 +0,0 @@
{% extends "layout/basic.html" %}
{% import "components/contest.html" as contest with context %}
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body typo">
{{ tdoc['content']|markdown|safe }}
{% if model.contest.isOngoing(tdoc) %}
<blockquote class="warn">
<p>{{ _('We will check code similarity after this contest.') }}</p>
</blockquote>
{% endif %}
</div>
</div>
{% if model.contest.isOngoing(tdoc) or model.contest.isDone(tdoc) %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Problem') }}</h1>
</div>
{% if attended or model.contest.isDone(tdoc) %}
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
<col class="col--problem">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
<th class="col--problem">{{ _('Problem') }}</th>
</tr>
</thead>
<tbody>
{% for pid in tdoc.pids %}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if handler.canShowRecord(tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc._id)|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
<td class="col--problem col--problem-name">
#{{ loop.index }}:
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{{ nothing.render('Please attend contest to see the problems.') }}
{% endif %}
</div>
{% endif %}
</div>
<div class="medium-3 columns">
{% set owner_udoc = udict[tdoc.owner] %}
{% include "partials/contest_sidebar.html" %}
</div>
</div>
{% endblock %}
-97
View File
@@ -1,97 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<form method="post">
<div class="row">
{{ form.form_select({
columns:4,
label:'Rule',
name:'rule',
options:rules,
value:tdoc['rule']|default(''),
row:false
}) }}
{{ form.form_text({
columns:4,
label:'Title',
name:'title',
placeholder:_('title'),
value:tdoc.title|default(''),
autofocus:true,
row:false
}) }}
{{ form.form_checkbox({
columns:4,
label:'Rated',
name:'rated',
placeholder:_('Is rated'),
value:tdoc.rated|default(true),
row:false
}) }}
</div><div class="row">
{{ form.form_text({
columns:4,
label:'Begin Date',
name:'beginAtDate',
placeholder:'YYYY-mm-dd',
value:date_text,
date:true,
row:false
}) }}
{{ form.form_text({
columns:4,
label:'Begin Time',
name:'beginAtTime',
placeholder:'HH:MM',
value:time_text,
time:true,
row:false
}) }}
{{ form.form_text({
columns:4,
label:'Duration (hours)',
name:'duration',
value:duration|default('3'),
row:false
}) }}
</div>
{{ form.form_text({
columns:null,
label:'Problems',
name:'pids',
value:pids
}) }}
{{ form.form_textarea({
columns:null,
label:'Content',
name:'content',
value:tdoc['content']|default(''),
markdown:true
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
{% if page_name == 'contest_edit' %}
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% else %}
<button type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
{% endif %}
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
{% include 'components/md_hint.html' %}
</div>
</div>
{% endblock %}
-132
View File
@@ -1,132 +0,0 @@
{% extends "layout/basic.html" %}
{% import "components/contest.html" as contest with context %}
{% macro render_important_contest(view, title, tdoc) %}
<div class="section immersive--content section--contest {{ view }}">
<div class="media">
<div class="media__body middle">
<div class="section__body">
<div>
<h2 class="status_title">{{ _(title) }}</h2>
</div>
<h1>{{ tdoc.title }}</h1>
<ul class="info">
<li>
<span class="icon icon-award"></span>
{{ _('Rule') }}: {{ model.contest.RULES[tdoc['rule']].TEXT }}
</li>
<li>
<span class="icon icon-calendar"></span>
{{ _('Start at') }}: {{ contest.render_time(tdoc.beginAt) }}
</li>
<li>
<span class="icon icon-schedule--fill"></span>
{{ _('Duration') }}: {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
</li>
<li>
<span class="icon icon-user--multiple"></span>
{{ _('Partic.') }}: {{ tdoc['attend']|default(0) }}
</li>
</ul>
</div>
</div>
<div class="media__right middle">
<div class="section__body">
<a href="{{ url('contest_detail', tid=tdoc.docId) }}" class="detail-button">{{ _('View Details') }}</a>
<div class="typo text-center">
{% if tsdict[tdoc.docId].attend %}
<p><span class="icon icon-check"></span> {{ _('Attended') }}</p>
{% else %}
<p><span class="icon icon-schedule"></span> {{ _('Not Attended') }}</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endmacro %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
{% for tdoc in tdocs %}
{% if model.contest.isOngoing(tdoc) %}
{{ render_important_contest('live', 'Live...', tdoc) }}
{% elif model.contest.isUpcoming(tdoc) %}
{{ render_important_contest('ready', 'Ready (☆▽☆)', tdoc) }}
{% endif %}
{% endfor %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{% if not rule %}{{ _('All Contests') }}{% else %}{{ _('All {0} Contests').format(_(model.contest.RULES[rule].TEXT)) }}{% endif %}</h1>
<div class="section__tools">
<form method="get" name="filter-form">
{{ _('Show') }}:
<select class="inline compact select" name="rule">
<option value="0"{% if not rule %} selected{% endif %}>{{ _('All') }}</option>
{% for k, v in model.contest.RULES %}
<option value="{{ k }}"{% if rule == k %} selected{% endif %}>{{ _('All {0} Contests').format(_(v.TEXT)) }}</option>
{% endfor %}
</select>
<button type="submit" class="button hasjs--hide">
{{ _('Search') }}
</button>
</form>
</div>
</div>
<div class="section__body no-padding">
{% if not tdocs.length %}
{{ nothing.render('There are no contests...') }}
{% else %}
<ol class="section__list contest__list">
{% for tdoc in tdocs %}
<li class="section__list__item contest__item contest-type--{{ tdoc['rule'] }}">
<div class="media">
<div class="media__left medium">
<div class="contest__date numbox">
<div class="numbox__num large">{{ datetimeSpan(tdoc['beginAt'], false, '%d')|safe }}</div>
<div class="numbox__text">{{ datetimeSpan(tdoc['beginAt'], false, '%Y-%m')|safe }}</div>
</div>
</div>
<div class="media__body medium">
<h1 class="contest__title"><a href="{{ url('contest_detail', tid=tdoc.docId) }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
<ul class="supplementary list">
<li>
<a href="?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ model.contest.RULES[tdoc.rule].TEXT }}</a>
</li>
<li>
<span class="icon icon-schedule--fill text-blue"></span> {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
</li>
<li>
<span class="icon icon-user--multiple"></span> {{ tdoc['attend']|default(0) }}
</li>
{% if tsdict[tdoc.docId]['attend'] == 1 %}
<li class="contest__info-attended">
<span class="icon icon-check"></span> {{ _('Attended') }}
</li>
{% endif %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
{{ paginator.render(page, tpcount, add_qs=qs) }}
{% endif %}
</div>
</div>
</div>
<div class="medium-3 columns">
{% if handler.user.hasPerm(perm.PERM_CREATE_CONTEST) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">
{{ _('Create Contest') }}
</h1>
</div>
<div class="section__body">
<p><a href="{{ url('contest_create') }}" class="expanded primary button">{{ _('Create a contest') }}</a></p>
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}
-54
View File
@@ -1,54 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row"><div class="medium-12 columns">
<div class="section visible">
<div class="section__header">
<a class="button" target="_blank" href="{{ url('contest_scoreboard_download', tid=tdoc.docId, ext='html') }}">
<span class="icon icon-download"></span> {{ _('Export as HTML') }}
</a>
<a class="button" href="{{ url('contest_scoreboard_download', tid=tdoc.docId, ext='csv') }}">
<span class="icon icon-download"></span> {{ _('Export as CSV') }}
</a>
</div>
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{%- for column in rows[0] -%}
<col class="col--{{ column.type }}">
{%- endfor -%}
</colgroup>
<thead>
<tr>
{%- for column in rows[0] -%}
<th class="col--{{ column.type }}">
{% if column.type == 'problem_detail' %}
<a href="{{ url('contest_detail_problem', tid=tdoc.docId, pid=column.raw) }}" data-tooltip="{{ pdict[column.raw].title }}">{{ column.value }}</a>
{% else %}
{{ column.value }}
{% endif %}
</th>
{%- endfor -%}
</tr>
</thead>
<tbody>
{%- for row in rows -%}{% if loop.index0>0 %}
<tr>
{%- for column in row -%}
<td class="col--{{ rows[0][loop.index0]['type'] }}">
{% if column.type == 'user' %}
{{ user.render_inline(udict[column.raw], badge=false) }}
{% elif column.type == 'record' and column.raw %}
<a href="{{ url('record_detail', rid=column.raw) }}">{{ column.value }}</a>
{% else %}
{{ column.value }}
{% endif %}
</td>
{%- endfor -%}
</tr>
{% endif %}{%- endfor -%}
</tbody>
</table>
</div>
</div>
</div></div>
{% endblock %}
@@ -1,48 +0,0 @@
<meta charset="UTF-8">
<style>
body {
font-family: "Open Sans", "Seravek", "Segoe UI", "Verdana", "PingFang SC", "Hiragino Sans GB", "Lantinghei SC", "Microsoft Yahei", "WenQuanYi Micro Hei", "sans";
font-size: 14px;
}
table {
table-layout: fixed;
width: 100%;
border-collapse: collapse;
border-spacing: 0;
font-size: inherit;
}
th, td {
text-align: left;
border: 1px solid #CCC;
padding: 5px;
}
thead tr {
background: #5f9fd6;
color: #FFF;
}
tbody tr:nth-child(even) {
background: #F0F0F0;
}
</style>
<table>
<thead>
<tr>
{%- for column in rows[0] -%}
<th class="col--{{ column['type'] }}">
{{ column['value'] }}
</th>
{%- endfor -%}
</tr>
</thead>
<tbody>
{%- for row in rows -%}{% if loop.index0 %}
<tr>
{%- for column in row -%}
<td>
{{ column['value'] }}
</td>
{%- endfor -%}
</tr>
{% endif %}{%- endfor -%}
</tbody>
</table>
-29
View File
@@ -1,29 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Create Discussion in {0}').format(vnode.title) }}</h1>
</div>
<div class="section__body">
<form method="post">
{% include "partials/discussion_edit_form.html" %}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button">
{{ _('Create') }} (Ctrl+Enter)
</button>
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
{% include 'components/md_hint.html' %}
</div>
</div>
{% endblock %}
-136
View File
@@ -1,136 +0,0 @@
{% extends "layout/basic.html" %}
{% import "components/comments_discussion.html" as comments with context %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<ul class="supplementary list">
<li>
<a class="discussion-node-tag" href="{{ url('discussion_node', type=model.discussion.typeDisplay[vnode.type], name=vnode.id) }}">
{% if ddoc.parentType == model.document.TYPE_DISCUSSION_NODE %}
<span class="v-center icon icon-tag"></span>
{% elif ddoc.parentType == model.document.TYPE_CONTEST %}
<span class="v-center icon icon-award"></span>
{% else %}
<span class="v-center icon icon-flag"></span>
{% endif %}
{{ vnode['title'] }}
</a>
</li>
<li>
{{ user.render_inline(udict[ddoc.owner]) }}
@
{{ datetimeSpan(ddoc._id)|safe }}
</li>
</ul>
<div class="typo topic__content" data-emoji-enabled data-raw-url="{{ url('discussion_raw', did=ddoc.docId) }}">
{{ ddoc['content']|markdown|safe }}
</div>
</div>
<ul class="section__footer supplementary dot list">
{% if ddoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION) %}
<li>
<a href="{{ url('discussion_edit', did=ddoc.docId) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li>
{% endif %}
<li>
{{ _('{0} views').format(ddoc['views']) }}
</li>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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="csrfToken" value="{{ handler.csrfToken }}">
<button class="star{% if dsdoc['star'] %} activated{% endif %}" type="submit">
<span class="starred--hide"><span class="icon icon-star--outline"></span> {{ _('Star Topic') }}</span>
<span class="starred--show"><span class="icon icon-star"></span> {{ _('Unstar Topic') }}</span>
</button>
</form></li>
{% endif %}
<li>
<a href="{{ url('wiki', page='about', anchor='contact') }}"><span class="icon icon-warning"></span> {{ _('Report') }}</a>
</li>
</ul>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('{0} comments').format(drcount) }}</h1>
</div>
<div class="section__body">
{{ comments.render(
view = 'discussion',
docs = drdocs,
udict = udict,
comment_ref = 'drid',
reply_ref = 'drrid',
comment_post_op = 'reply',
reply_post_op = 'tail_reply',
comment_edit_op = 'edit_reply',
comment_delete_op = 'delete_reply',
reply_edit_op = 'edit_tail_reply',
reply_delete_op = 'delete_tail_reply',
comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
comment_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF
) }}
{{ paginator.render(page, pcount) }}
{% if drcount == 0 %}
{{ nothing.render('No comments so far...') }}
{% endif %}
</div>
</div>
</div>
<div class="medium-3 columns">
{% set udoc = udict[ddoc['owner']] %}
<div class="section side">
<div class="profile__bg user-profile-bg--1"></div>
<div class="section__body">
<div class="media sidebar-user-profile">
<div class="media__left">
<img src="{{ gravatar(udoc['gravatar']) }}" width="80" height="80" class="medium user-profile-avatar">
</div>
<div class="media__body">
<p>
{{ user.render_inline(udoc, avatar=false, modbadge=false) }}
</p>
</div>
</div>
</div>
<div class="section__body">
<div class="balancer sidebar-user-stat">
<div class="balancer__body">
<div class="numbox">
<div class="numbox__num medium">{{ udict[ddoc.owner].nAccept or 0 }}</div>
<div class="numbox__text">{{ _('Accepted') }}</div>
</div>
</div>
<div class="balancer__body">
<div class="numbox">
<div class="numbox__num medium">{{ udict[ddoc.owner].nLike or 0 }}</div>
<div class="numbox__text">{{ _('Solutions Liked') }}</div>
</div>
</div>
<div class="balancer__body">
<div class="numbox">
<div class="numbox__num medium">{{ udict[ddoc.owner].nProblems or 0 }}</div>
<div class="numbox__text">{{ _('Upload Problem') }}</div>
</div>
</div>
</div>
</div>
</div>
{% if vnode.type == model.document.TYPE_PROBLEM %}
{% set pdoc = vnode %}
{% set owner_udoc = udict[vnode['owner']] %}
{% include "partials/problem_sidebar.html" %}
{% endif %}
</div>
</div>
{% endblock %}
-31
View File
@@ -1,31 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<form method="post">
{% include "partials/discussion_edit_form.html" %}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Update') }} (Ctrl+Enter)
</button>
{% if ddoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
{% endif %}
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
{% include 'components/md_hint.html' %}
</div>
</div>
{% endblock %}
-44
View File
@@ -1,44 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
{% include "partials/discussion_list.html" %}
</div>
</div>
<div class="medium-3 columns">
{% if vnode.type == model.document.TYPE_PROBLEM %}
{% set pdoc = vnode %}
{% set owner_udoc = udict[vnode.owner] %}
{% include "partials/problem_sidebar.html" %}
{% elif vnode.type == model.document.TYPE_CONTEST %}
{% set tdoc = vnode %}
{% set owner_udoc = udict[vnode.owner] %}
{% include "partials/contest_sidebar.html" %}
{% elif vnode.type == model.document.TYPE_DISCUSSION_NODE %}
<div class="section side">
{% if vnode.pic %}<div class="discussion-node__bg {{ vnode.pic }}"></div>{% endif %}
<div class="section__header">
<h1 class="section__title">{{ vnode['title'] or _('Create Discussion') }}</h1>
</div>
<div class="section__body">
{% if vnode %}
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ url('discussion_create', type=model.discussion.typeDisplay[vnode.type], name=vnode.id) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %}
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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>
{% endif %}
{% endif %}
{% else %}
<p>{{ _('Select a node to create discussion.') }}</p>
{% endif %}
</div>
</div>
{% endif %}
{% include 'partials/discussion_nodes_widget.html' %}
</div>
</div>
{% endblock %}
-33
View File
@@ -1,33 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row" data-sticky-parent>
<div class="medium-9 columns">
{% block domain_content %}{% endblock %}
</div>
<div class="medium-3 columns"><div data-sticky="large">
<div class="section side">
<ol class="menu">
<li class="menu__item">
<div class="menu__link expandable">
<span class="icon icon-info"></span> {{ _('Properties') }}
</div>
<ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_dashboard') }}
{{ sidemenu.render_item(null, 'domain_edit') }}
</ol>
</li>
<li class="menu__item">
<div class="menu__link expandable">
<span class="icon icon-user"></span> {{ _('Access Control') }}
</div>
<ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_role') }}
{{ sidemenu.render_item(null, 'domain_user') }}
{{ sidemenu.render_item(null, 'domain_permission') }}
</ol>
</li>
</ol>
</div>
</div></div>
</div>
{% endblock %}
-56
View File
@@ -1,56 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title" id="create" data-heading>{{ _('Create Domain') }}</h1>
</div>
<div class="section__body">
<blockquote class="note typo">
<p>{{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}</p>
<ul>
<li>{{ _('Unique') }}</li>
<li>{{ _('At least 4 characters') }}</li>
<li>{{ _('Not wrapped with space') }}</li>
<li>{{ _('Not started with a number') }}</li>
<li>{{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}</li>
</ul>
</blockquote>
<form method="post">
{{ form.form_text({
label:'ID',
name:'id',
autofocus:true,
required:true
}) }}
{{ form.form_text({
label:'Name',
name:'name',
required:true
}) }}
{{ form.form_textarea({
label:'Bulletin',
name:'bulletin',
markdown:true,
required:true
}) }}
{{ form.form_text({
label:'Gravatar',
name:'gravatar'
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
-22
View File
@@ -1,22 +0,0 @@
{% import "components/user.html" as user %}
{% extends "domain_base.html" %}
{% block domain_content %}
{% if domain.bulletin %}
<div class="section">
<div class="section__body typo">
{{ domain.bulletin|markdown|safe }}
</div>
</div>
{% endif %}
<div class="section">
<div class="section__header">
<h1 class="section__title" data-heading>{{ _('Information') }}</h1>
</div>
<div class="section__body typo">
<dl class="large horizontal">
<dt>{{ _('Gravatar') }}</dt><dd><img src="{{ gravatar(domain.gravatar) }}" width="32" height="32"></dd>
<dt>{{ _('Name') }}</dt><dd>{{ domain.name }}</dd>
</dl>
</div>
</div>
{% endblock %}
-6
View File
@@ -1,6 +0,0 @@
{% extends "domain_base.html" %}
{% block domain_content %}
<div class="section">
{% include "partials/setting.html" %}
</div>
{% endblock %}
-60
View File
@@ -1,60 +0,0 @@
{% extends "domain_base.html" %}
{% block domain_content %}
<form method="post">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('{0}: Permissions').format(domain.name) }}</h1>
</div>
<div class="section__body no-padding domain-users">
<table class="data-table">
<colgroup>
<col class="col--description">
{% for role in roles %}
<col class="col--p">
{% endfor %}
</colgroup>
<thead>
<tr>
<th class="col--description">{{ _('Permissions') }}</th>
{% for role in roles %}
<th class="col--p"><span data-tooltip="{{ role._id }}">{{ role._id }}</span></th>
{% endfor %}
</tr>
</thead>
{% for family, perms in PERMS_BY_FAMILY %}
<tbody>
<tr>
<td class="col--family" colspan="{{ (roles|length)+1 }}">
{{ _(family) }}
</td>
</tr>
{% for perm in perms %}
<tr>
<td class="col--description">
{{ _(perm.desc) }}
</td>
{% for role in roles %}
<td class="col--p">
<label class="compact checkbox">
<input name="{{ role._id }}" data-checkbox-group="{{ role._id }}" data-checkbox-range value="{{ log2(perm.key) }}" type="checkbox"{% if role.perm|bitand(perm.key) %} checked{% endif %}{% if role._id == 'admin' %} disabled{% endif %}>
</label>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
</div>
<div class="section__body">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button class="rounded primary button" role="submit">
{{ _('Update Permission') }}
</button>
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div>
</div>
</form>
{% endblock %}
-72
View File
@@ -1,72 +0,0 @@
{% extends "domain_base.html" %}
{% block domain_content %}
<div style="display: none" class="dialog__body--create-role">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Create Role') }}</h1>
</div></div>
<div class="row"><div class="columns">
<blockquote class="note">
<p>{{ _('Role name can only contains numbers, letters and underscores.') }}</p>
</blockquote>
{{ form.form_text({
columns:None,
label:'Name',
name:'role',
autofocus:true
}) }}
</div></div>
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('{0}: Roles').format(domain.name) }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="create_role">{{ _('Create Role') }}</button>
</div>
</div>
{{ noscript_note.render() }}
<div class="section__body no-padding domain-roles">
<table class="data-table">
<colgroup>
<col class="col--checkbox">
<col class="col--id">
<col class="col--description">
<col class="col--users">
</colgroup>
<thead>
<tr>
<th class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-toggle="role">
</label>
</th>
<th class="col--id">{{ _('Role') }}</th>
<th class="col--users">{{ _('Users') }}</th>
</tr>
</thead>
<tbody>
{% for role in roles %}
{% set isBuiltin = role._id in ['default', 'guest', 'admin'] %}
<tr{% if isBuiltin %} data-role="{{ role._id }}"{% endif %}>
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="role" {{ "data-checkbox-range" if isBuiltin else "disabled" }}>
</label>
</td>
<td class="col--id">
{{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }}
</td>
<td class="col--users">
{{ role.count|default('--') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="section__body">
<button class="rounded button" name="delete_selected">{{ _('Delete Selected Roles') }}</button>
</div>
</div>
{% endblock %}
-112
View File
@@ -1,112 +0,0 @@
{% extends "domain_base.html" %}
{% block domain_content %}
<div style="display: none" class="dialog__body--add-user">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Add User') }}</h1>
</div></div>
<div class="row">
<div class="medium-6 columns">
<label>
{{ _('Username / UID') }}
<input name="user" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
<div class="medium-6 columns">
<label>
{{ _('Role') }}
{{ form.select({
label:_('Select a role'),
options:rolesSelect,
name:'role',
value:'default'
}) }}
</label>
</div>
</div>
</div>
</div>
<div style="display: none" class="dialog__body--set-role">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Set Role') }}</h1>
</div></div>
<div class="row">
<div class="medium-12 columns">
<label>
{{ _('Set Roles for selected users') }}
{{ form.select({
label:_('Select a role'),
options:rolesSelect,
name:'role'
}) }}
</label>
</div>
</div>
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('{0}: Users').format(domain.name) }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="add_user">{{ _('Add User') }}</button>
</div>
</div>
{{ noscript_note.render() }}
<div class="section__body no-padding domain-users">
<table class="data-table">
<colgroup>
<col class="col--checkbox">
<col class="col--uid">
<col class="col--user">
<col class="col--role">
</colgroup>
<thead>
<tr>
<th class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" name="select_all" data-checkbox-toggle="user">
</label>
</th>
<th class="col--uid">{{ _('User ID') }}</th>
<th class="col--user">{{ _('Username') }}</th>
<th class="col--role">{{ _('Role') }}</th>
</tr>
</thead>
<tbody>
{% for role in roles %}
{% for rudoc in rudocs[role._id] %}
{% set is_disabled=(rudoc._id == handler.user._id) %}
<tr data-uid="{{ rudoc._id }}">
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="user" {% if is_disabled %}disabled{% else %}data-checkbox-range{% endif %}>
</label>
</td>
<td class="col--uid">
{{ rudoc._id }}
</td>
<td class="col--user">
{{ user.render_inline(udict[rudoc._id], badge=false) }}
</td>
<td class="col--role">
{{ form.select({
options:rolesSelect,
name:'role',
value:rudoc.role,
extra_class:'compact',
disabled:is_disabled
}) }}
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
<div class="section__body">
<button class="rounded button" name="remove_selected">{{ _('Remove Selected User') }}</button>
<button class="rounded button" name="set_roles">{{ _('Set Roles for Selected User') }}</button>
</div>
</div>
{% endblock %}
-22
View File
@@ -1,22 +0,0 @@
{% set no_path_section = true %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="error__container clearfix">
<div class="error__icon-container">
<div class="error__twd2"></div>
</div>
<div class="error__text-container">
<h1>{{ _('Oops!') }}</h1>
<p>{{ _(error.message).format.apply(error.params) }}</p>
<p>{{ _('Technical Information') }}:</p>
<p>{{ _('Type') }}: {{ error.code }}</p>
<p>{{ _('Arguments') }}:
<ol>
{% for param in error.params %}
<li>{{ param }}</li>
{% endfor %}
</ol>
</p>
</div>
</div>
{% endblock %}
-54
View File
@@ -1,54 +0,0 @@
/* {% if header_logo %} */
.header__logo {
background: url({{header_logo}})
}
/* {% endif %} */
/* {% if header_background %} */
.header {
background: url({{header_background}})
}
/* {% endif %} */
/* {% if nav_logo_light %} */
.nav__logo, .header--mobile__domain.is--system {
background-image: url({{nav_logo_light}})
}
/* {% endif %} */
/* {% if nav_logo_dark %} */
.nav.floating .nav__logo, .nojs .nav .nav__logo {
background-image: url({{nav_logo_dark}}) !important
}
/* {% endif %} */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 1.5dppx), only screen and (min-resolution: 144dpi) {
/* {% if header_2x %} */
.header__logo {
background-image: url({{header_2x}})
}
/* {% endif %} */
/* {% if header_background_2x %} */
.header {
background-image: url({{header_background_2x}})
}
/* {% endif %} */
/* {% if nav_logo_light_2x %} */
.nav__logo, .header--mobile__domain.is--system {
background-image: url({{nav_logo_light_2x}}) !important
}
/* {% endif %} */
/* {% if nav_logo_dark_2x %} */
.nav.floating .nav__logo, .nojs .nav .nav__logo, .header--mobile__domain.is--system {
background-image: url({{nav_logo_dark_2x}}) !important
}
/* {% endif %} */
}
-21
View File
@@ -1,21 +0,0 @@
{% extends 'layout/simple.html' %}
{% block body %}
{% if fdoc %}
<p>{{ _('Uploaded file info') }}:</p>
<p>{{ _('ID') }}: {{ fdoc['_id'] }}</p>
<p>{{ _('Userfile doc_id') }}: {{ ufid }}</p>
<p>{{ _('MD5') }}: {{ fdoc['md5'] }}</p>
<p>{{ _('URL') }}: {{ model.file.url(fdoc) }}</p>
{% endif %}
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<p>
{{ _('New file') }}:
<input type="text" name="title" placeholder="{{ _('Description') }}">
<input type="file" name="file">
<input type="submit" value="{{ _('Upload') }}" class="rounded primary button">
</p>
<p>{{ _('Note: file size should be less than or equal to {0}, and file type should be in {1}. Empty files are not allowed.').format(size(FILE_MAX_LENGTH), ALLOWED_MIMETYPE_PREFIX) }}</p>
<p>{{ _('Usage: {0}, Quota: {1}').format(size(usage), size(quota)) }}</p>
</form>
{% endblock %}
-53
View File
@@ -1,53 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('My Domains') }}</h1>
<div class="section__tools">
{% if handler.user.hasPriv(model.builtin.PRIV.PRIV_CREATE_DOMAIN) %}
<a class="primary rounded button" href="{{ url('home_domain_create') }}"><span class="icon icon-add"></span> {{ _('Create Domain') }}</a>
{% endif %}
<a class="tool-button" href="{{ url('wiki', page='help', anchor='domain') }}"><span class="icon icon-help"></span> {{ _("What's domain?") }}</a>
</div>
</div>
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
<col class="col--icon">
<col class="col--name">
<col class="col--role">
<col class="col--action">
</colgroup>
<thead>
<tr>
<th class="col--icon">&nbsp;</th>
<th class="col--name">{{ _('Name') }} ({{ _('ID') }})</th>
<th class="col--role">{{ _('My Role') }}</th>
<th class="col--action">{{ _('Action') }}</th>
</tr>
</thead>
<tbody>
{% for ddoc in ddocs %}
<tr>
<td class="col--icon">
<img src="{{ gravatar(ddoc.gravatar) }}" width="32" height="32">
</td>
<td class="col--name">
{{ ddoc['name'] }} ({{ ddoc['_id'] }})
</td>
<td class="col--role">
{{ dudict[ddoc._id].role|default('default') }}
</td>
<td class="col--action">
<a class="typo-a" href="{{ url('homepage', domainId=ddoc['_id']) }}">{{ _('Visit') }}</a>
{% if canManage[ddoc['_id']] %}
· <a class="typo-a" href="{{ url('domain_manage', domainId=ddoc['_id']) }}">{{ _('Manage') }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
-42
View File
@@ -1,42 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('My Files') }}</h1>
<div class="section__tools">
{% if handler.user.hasPriv(model.builtin.PRIV.PRIV_CREATE_FILE) %}
<a class="primary rounded button" href="{{ url('file_upload') }}" target="_blank"><span class="icon icon-add"></span> {{ _('Upload File') }}</a>
{% endif %}
<a class="tool-button" href="{{ url('wiki', page='help', anchor='file') }}"><span class="icon icon-help"></span> {{ _("What's file?") }}</a>
</div>
</div>
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
<col class="col--desc">
<col class="col--length">
<col class="col--hash">
<col class="col--action">
</colgroup>
<thead>
<tr>
<th class="col--desc">{{ _('Description') }}</th>
<th class="col--length">{{ _('Size') }}</th>
<th class="col--hash">{{ _('Hash') }}</th>
<th class="col--action">{{ _('Action') }}</th>
</tr>
</thead>
<tbody>
{% for ufdoc in ufdocs %}
<tr>
<td class="col--desc">{{ ufdoc.filename }}</td>
<td class="col--length">{{ size(ufdoc.size) if ufdoc.size else '?' }}</td>
<td class="col--hash">{{ ufdoc.md5|default('?') }}</td>
<td class="col--action"><a class="typo-a" href="{{ model.file.url(ufdoc) }}">{{ _('Download') }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
-24
View File
@@ -1,24 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div style="display: none" class="dialog__body--user-select">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Select User') }}</h1>
</div></div>
<div class="row">
<div class="columns">
<label>
{{ _('Username / UID') }}
<input name="user" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
</div>
</div>
<div class="section">
<div id="messagePad">
{{ noscript_note.render() }}
<div class="loader-container"><div class="loader"></div></div>
</div>
</div>
{% endblock %}
-135
View File
@@ -1,135 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div data-heading-extract-to="#menu-item-home_security">
<div class="row">
<div class="medium-6 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title" id="email" data-heading>{{ _('Change Email') }}</h1>
</div>
<div class="section__body">
<form method="post">
{{ form.form_text({
type:'password',
label:'Current Password',
columns:10,
name:'password',
required:true
}) }}
{{ form.form_text({
type:'text',
label:'Current Email',
columns:10,
name:'currentEmail',
value:handler.user.mail,
disabled:true
}) }}
{{ form.form_text({
type:'text',
label:'New Email',
columns:10,
name:'mail',
required:true
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<input type="hidden" name="operation" value="change_mail">
<input type="submit" class="rounded primary button" value="{{ _('Change Email') }}">
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-6 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title" id="password" data-heading>{{ _('Change Password') }}</h1>
</div>
<div class="section__body">
<form method="post">
{{ form.form_text({
type:'password',
label:'Current Password',
columns:10,
name:'current',
required:true
}) }}
{{ form.form_text({
type:'password',
label:'New Password',
columns:10,
name:'password',
required:true
}) }}
{{ form.form_text({
type:'password',
label:'Repeat Password',
columns:10,
name:'verifyPassword',
required:true
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<input type="hidden" name="operation" value="change_password">
<input type="submit" class="rounded primary button" value="{{ _('Change Password') }}">
</div></div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="columns">
<div class="section">
<div class="section__header">
<h1 class="section__title" id="session" data-heading>{{ _('Active Sessions') }}</h1>
</div>
<div class="section__body">
<ul class="sessionlist">
{% for session in sessions %}
<li class="sessionlist__item">
<div class="media">
<div class="media__left medium">
<span class="sessionlist__icon icon icon-platform--{{ icon(session.updateUa.os) }}"></span>
</div>
<div class="media__body medium typo">
<p>{{ _('Last Update At') }}: {{ datetimeSpan(session.updateAt)|safe }}</p>
<p>{{ _('Location') }}: {{ _(session.updateGeoip.display) }} ({{ session.updateIp }})</p>
<p>{{ _('Operating System') }}: {{ session.updateUa.os }}</p>
<p>{{ _('Browser') }}: {{ session.updateUa.name }} {{ session.updateUa.version }}</p>
{% if session.isCurrent %}
<p class="sessionlist__current-session"><span class="icon icon-check"></span> {{ _('This is the current session') }}</p>
{% endif %}
</div>
{% if not session.isCurrent %}
<div class="media__right medium">
<form method="post">
<input type="hidden" name="operation" value="delete_token">
<input type="hidden" name="tokenDigest" value="{{ session._id }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<input type="submit" value="{{ _('Logout This Session') }}" class="rounded button">
</form>
</div>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
</div>
<div class="section__body">
<form method="post">
<input type="hidden" name="operation" value="delete_all_tokens">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<input type="submit" value="{{ _('Logout All Sessions') }}" class="primary rounded button">
</form>
{% if geoipProvider %}
<div class="typo">
<p><small>IP geo-location data is provided by {{ geoipProvider|safe }}.</small></p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
-6
View File
@@ -1,6 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div class="section" data-heading-extract-to="#menu-item-home_{{ category }}">
{% include "partials/setting.html" %}
</div>
{% endblock %}
-77
View File
@@ -1,77 +0,0 @@
{% extends "layout/basic.html" %}
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Homework Introduction') }}</h1>
</div>
<div class="section__body typo">
{{ tdoc['content']|markdown|safe }}
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Problem') }}</h1>
</div>
{% if model.contest.isNotStarted(tdoc) %}
{{ nothing.render('This homework is not open and you cannot view problems.') }}
{% else %}
{% if attended or model.contest.isDone(tdoc) %}
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
<col class="col--problem">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
<th class="col--problem">{{ _('Problem') }}</th>
</tr>
</thead>
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% set rdoc = rdict[psdict[pid]['rid']] %}
{% if handler.canShowRecord(tdoc) %}
{{ record.render_status_td(rdoc) }}
{% else %}
<td class="col--status record-status--border"><a href="{{ url('record_detail', rid=rdoc._id) }}">{{ _('Submitted') }}</a></td>
{% endif %}
<td class="col--submit-at">{{ datetimeSpan(rdoc['_id'])|safe }}</td>
{% else %}
<td class="col--status record-status--border">{{ _('No Submissions') }}</td>
<td class="col--submit-at">-</td>
{% endif %}
{% endif %}
<td class="col--problem col--problem-name">
#{{ loop.index }}:
{{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{{ nothing.render('Please claim the assignment to see the problems.') }}
{% endif %}{# attended or handler.is_done(tdoc) #}
{% endif %}{# handler.is_not_started(tdoc) #}
</div>
</div>
<div class="medium-3 columns">
{% include "partials/homework_sidebar.html" %}
</div>
</div>
{% endblock %}
-105
View File
@@ -1,105 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<form method="post">
{{ form.form_text({
columns:8,
label:'Title',
name:'title',
placeholder:_('title'),
value:tdoc['title']|default(''),
autofocus:true
}) }}
<div class="row">
{{ form.form_text({
columns:4,
label:'Begin Date',
name:'beginAtDate',
placeholder:'YYYY-mm-dd',
value:dateBeginText,
date:true,
row:false
}) }}
{{ form.form_text({
columns:4,
last_column:true,
label:'Begin Time',
name:'beginAtTime',
placeholder:'HH:MM',
value:timeBeginText,
time:true,
row:false
}) }}
</div><div class="row">
{{ form.form_text({
columns:4,
label:'End Date',
name:'penaltySinceDate',
placeholder:'YYYY-mm-dd',
value:datePenaltyText,
date:true,
row:false
}) }}
{{ form.form_text({
columns:4,
last_column:true,
label:'End Time',
name:'penaltySinceTime',
placeholder:'HH:MM',
value:timePenaltyText,
time:true,
row:false
}) }}
</div>
{{ form.form_text({
columns:4,
label:'Extension (days)',
name:'extensionDays',
value:extension_days
}) }}
<div class="row"><div class="columns">
<label>
{{ _('Extension Score Penalty') }}
<textarea name="penaltyRules" class="monospace textbox">{% if tdoc %}{{ penaltyRules }}{% else %}{% include 'partials/homework_default_penalty_rules.yaml' %}{% endif %}</textarea>
</label>
</div></div>
{{ form.form_text({
columns:null,
label:'Problems',
name:'pids',
value:pids
}) }}
{{ form.form_textarea({
columns:null,
label:'Content',
name:'content',
value:tdoc['content']|default(''),
markdown:true
}) }}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
{% if page_name == 'homework_edit' %}
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% else %}
<button type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
{% endif %}
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
{% include 'components/md_hint.html' %}
</div>
</div>
{% endblock %}
-68
View File
@@ -1,68 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<script>
var Context = {
'docs': {{ calendar|json|safe }},
};
</script>
<div class="row">
<div class="medium-12 columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('All Homeworks') }}</h1>
<div class="section__tools">
<span class="nojs-hide">
{{ _('View') }}:
<select class="inline compact select" name="homework_display">
<option value="calendar">{{ _('Calendar View') }}</option>
<option value="list">{{ _('List View') }}</option>
</select>
</span>
{% if handler.user.hasPerm(perm.PERM_CREATE_HOMEWORK) %}
<a class="compact button" href="{{ url('homework_create') }}">{{ _('Create Homework') }}</a>
{% endif %}
</div>
</div>
<div class="section__body no-padding">
{% if not tdocs.length %}
{{ nothing.render('There is no homework so far ╰(*°▽°*)╯') }}
{% else %}
<ol class="section__list homework__list hasjs--hide">
{% for tdoc in tdocs %}
<li class="section__list__item homework__item">
<div class="media">
<div class="media__left medium">
<div class="homework__date numbox">
<div class="numbox__num large">{{ datetimeSpan(tdoc['penaltySince'], false, '%d')|safe }}</div>
<div class="numbox__text">{{ datetimeSpan(tdoc['penaltySince'], false, '%Y-%m')|safe }}</div>
</div>
</div>
<div class="media__body medium">
<h1 class="homework__title"><a href="{{ url('homework_detail', tid=tdoc.docId) }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
<ul class="supplementary list">
<li>
{{ _('Status') }}: <span class="homework-status--text {{ model.contest.getStatus(tdoc) }}">{{ _(model.contest.statusText(tdoc)) }}</span>
</li>
<li>
{{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
</li>
<li>
{% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %}
{{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }}
{% else %}
{{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }}
{% endif %}
</li>
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
<div name="calendar_entry"></div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
-6
View File
@@ -1,6 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row"><div class="columns">
<div id="messages"></div>
</div></div>
{% endblock %}
-19
View File
@@ -1,19 +0,0 @@
{% set layout_name = "basic" %}
{% extends "layout/html5.html" %}
{% block body %}
{% include "partials/nav.html" %}
<div class="slideout-panel" id="panel">
<div class="slideout-overlay"></div>
{% include "partials/header_mobile.html" %}
{% include "partials/header.html" %}
<div class="main">
{% block content %}{% endblock %}
</div>
{% include "partials/footer.html" %}
</div>
{% include "partials/login_dialog.html" %}
{% endblock %}
-13
View File
@@ -1,13 +0,0 @@
{% import "components/home.html" as home with context %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="row" data-sticky-parent>
<div class="medium-9 columns">
{% block home_content %}{% endblock %}
</div>
<div class="medium-3 columns"><div data-sticky="large">
{{ home.render_sidebar() }}
{% block home_sidebar %}{% endblock %}
</div></div>
</div>
{% endblock %}
-44
View File
@@ -1,44 +0,0 @@
{% import "components/form.html" as form with context %}
{% import "components/sidemenu.html" as sidemenu with context %}
{% import "components/paginator.html" as paginator with context %}
{% import "components/nothing.html" as nothing with context %}
{% import "components/noscript_note.html" as noscript_note with context %}
{% import "components/user.html" as user with context %}
<!DOCTYPE html>
<html data-page="{{ page_name }}" data-layout="{{ layout_name }}" class="layout--{{ layout_name }} page--{{ page_name }} nojs" lang="{{ handler.viewLang }}">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="apple-touch-icon" sizes="180x180" href="{{ static_url('apple-touch-icon-180x180.png') }}">
<link rel="icon" type="image/png" href="{{ static_url('favicon-32x32.png') }}" sizes="32x32">
<link rel="icon" type="image/png" href="{{ static_url('android-chrome-192x192.png') }}" sizes="192x192">
<link rel="icon" type="image/png" href="{{ static_url('favicon-96x96.png') }}" sizes="96x96">
<link rel="icon" type="image/png" href="{{ static_url('favicon-16x16.png') }}" sizes="16x16">
<link rel="manifest" href="{{ static_url('manifest.json') }}">
<meta name="msapplication-TileColor" content="#579e9a">
<meta name="msapplication-TileImage" content="{{ static_url('mstile-144x144.png') }}">
<meta name="theme-color" content="#56758f">
<link rel="stylesheet" media="all" href="{{ static_url('vj4.css') }}">
<link rel="stylesheet" media="all" href="{{ static_url('extra.css') }}">
<title>{{ handler.renderTitle(page_name) }}</title>
{% if not isIE(handler.request.headers['user-agent']) %}
<script>
var _htmlNode = document.documentElement;
_htmlNode.className = _htmlNode.className.replace(' nojs', ' hasjs');
var UiContext = {{ handler.UIContext|json|safe }};
var UserContext = {{ UserContext|json|safe }};
</script>
{% endif %}
</head>
<body>
{% block body %}{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
<script type="text/javascript" src="{{ static_url('locale/{0}.js'.format(handler.user.viewLang)) }}"></script>
<script type="text/javascript" src="{{ static_url('vj4.js') }}"></script>
{% endif %}
</body>
</html>
-22
View File
@@ -1,22 +0,0 @@
{% set layout_name = "immersive" %}
{% set no_path_section = true %}
{% extends "layout/html5.html" %}
{% block body %}
{% include "partials/nav.html" %}
<div class="slideout-panel" id="panel">
<div class="slideout-overlay"></div>
{% include "partials/header_mobile.html" %}
<div class="nav--placeholder"></div>
<div class="main">
{% block content %}{% endblock %}
</div>
{% set show_topics = false %}
{% include "partials/footer.html" %}
</div>
{% include "partials/login_dialog.html" %}
{% endblock %}
-30
View File
@@ -1,30 +0,0 @@
{% set layout_name = "mail" %}
<style>
body, .hydro { margin:0;color:#333;font-size:14px;font-family:"Tahoma","Segoe UI","Verdana","微软雅黑","Microsoft YaHei","宋体";background:#F2F2F2; }
.hydro { padding:30px; }
.hydro-box { background:#fff;box-shadow:0 0 15px rgba(0,0,0,0.3);border-radius:5px; }
.hydro-header { background:#3AA9DE;color:#FFF;padding:10px;line-height:200%;font-size:15px;border-radius:5px 5px 0 0;border-bottom:3px solid #85CAEB; }
.hydro-footer { font-size:12px;color:#444;padding:10px;border-top:1px solid #DDD;background:#F4F4F4;border-radius:0 0 5px 5px; }
.hydro-content { padding:30px; }
.hydro-content p { margin:5px 0; }
.hydro a,
.hydro a:visited,
.hydro a:link,
.hydro a:active { color:#1D76C7;text-decoration:none; }
.hydro a:hover { color:#3A93E2;text-decoration:underline; }
.hydro blockquote { padding:5px 10px;border-left:10px solid #E2EFFA;margin:20px;margin-left:0;_zoom:1; }
#hydro_mail .t { font-size:16px; }
#hydro_mail .f { font-style:italic; }
</style>
<div class="hydro">
<div class="hydro-box">
<div class="hydro-header">{% block title %}{% endblock %} - Hydro</div>
<div class="hydro-content">
{% block content %}{% endblock %}
</div>
<div class="hydro-footer">
<p>{{ _('This email was sent by {0} automatically, and please do not reply directly.').format('<a href="' + url_prefix + '/" target="_blank">Hydro</a>')|safe }}</p>
</div>
</div>
</div>
-4
View File
@@ -1,4 +0,0 @@
{% set layout_name = "basic" %}
{% extends "layout/html5.html" %}
{% block body %}
{% endblock %}
-197
View File
@@ -1,197 +0,0 @@
{% set no_path_section = true %}
{% set page_name = "homepage" %}
{% extends "layout/basic.html" %}
{% import "components/contest.html" as contest with context %}
{% block content %}
{% if domain['bulletin'] %}
<div class="row">
<div class="large-12 columns">
<div class="section">
<div class="section__body typo">
{{ domain['bulletin']|markdown|safe }}
</div>
</div>
</div>
</div>
{% endif %}
<div class="row">
<div class="large-9 columns">
{% if tdocs.length %}
<div class="section page--contest_main">
<div class="section__header">
<h1 class="section__title">{{ _('Contest') }}</h1>
</div>
<ol class="section__list contest__list">
{% for tdoc in tdocs %}
<li class="section__list__item contest__item contest-type--{{ tdoc.rule }}">
<div class="media">
<div class="media__left medium">
<div class="contest__date numbox">
<div class="numbox__num large">{{ datetimeSpan(tdoc['beginAt'], false, '%d')|safe }}</div>
<div class="numbox__text">{{ datetimeSpan(tdoc['beginAt'], false, '%Y-%m')|safe }}</div>
</div>
</div>
<div class="media__body medium">
<h1 class="contest__title"><a href="{{ url('contest_detail', tid=tdoc.docId) }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
<ul class="supplementary list">
<li>
<a href="{{ url('contest_main', query={rule:tdoc.rule}) }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ model.contest.RULES[tdoc.rule].TEXT }}</a>
</li>
<li>
<span class="icon icon-schedule--fill text-blue"></span> {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
</li>
<li>
<span class="icon icon-user--multiple"></span> {{ tdoc['attend']|default(0) }}
</li>
{% if tsdict[tdoc.docId]['attend'] == 1 %}
<li class="contest__info-attended">
<span class="icon icon-check"></span> {{ _('Attended') }}
</li>
{% endif %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
</div>
{% endif %}
{% if htdocs.length %}
<div class="section page--homework_main">
<div class="section__header">
<h1 class="section__title">{{ _('Homework') }}</h1>
</div>
<ol class="section__list homework__list">
{% for tdoc in htdocs %}
<li class="section__list__item homework__item">
<div class="media">
<div class="media__left medium">
<div class="homework__date numbox">
<div class="numbox__num large">{{ datetimeSpan(tdoc['penaltySince'], false, '%d')|safe }}</div>
<div class="numbox__text">{{ datetimeSpan(tdoc['penaltySince'], false, '%Y-%m')|safe }}</div>
</div>
</div>
<div class="media__body medium">
<h1 class="homework__title"><a href="{{ url('homework_detail', tid=tdoc.docId) }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
<ul class="supplementary list">
<li>
{{ _('Status') }}: <span class="homework-status--text {{ model.contest.getStatus(tdoc) }}">{{ _(model.contest.statusText(tdoc)) }}</span>
</li>
<li>
{{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
</li>
<li>
{% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %}
{{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }}
{% else %}
{{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }}
{% endif %}
</li>
{% if htsdict[tdoc['docId']]['attend'] == 1 %}
<li class="homework__info-attended">
<span class="icon icon-check"></span> {{ _('Claimed') }}
</li>
{% endif %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
</div>
{% endif %}
{% if trdocs.length %}
<div class="section page--training_main">
<div class="section__header">
<h1 class="section__title">{{ _('Training') }}</h1>
</div>
{% set tdocs = trdocs %}
{% set tsdict = trsdict %}
<ol class="section__list all primary training__list">
{% for tdoc in tdocs %}
<li class="section__list__item training__item">
<div class="media">
<div class="media__left middle">
<div class="training__participants numbox">
<div class="numbox__num large">{{ tdoc['enroll']|default(0) }}</div>
<div class="numbox__text">{{ _('Enrolled') }}</div>
</div>
</div>
<div class="media__body middle">
<h1 class="training__title"><a href="{{ url('training_detail', tid=tdoc.docId) }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
<div class="training__intro typo">
<p>{{ tdoc['content'] }}</p>
</div>
<ul class="supplementary list training__progress">
<li>
<span class="icon icon-flag text-blue"></span> {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc)|length) }}
</li>
<li>
{% if tsdict[tdoc.docId]['enroll'] %}
{% if not tsdict[tdoc.docId]['done'] %}
<span class="icon training-status--icon progress"></span>
<span class="training-status--text progress">{{ _('Completed') }} {{ (100 * tsdict[tdoc.docId]['donePids']|length / model.training.getPids(tdoc)|length)|round|int }}%</span>
{% else %}
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
</div>
{% endif %}
{% if ddocs.length %}
<div class="section page--discussion_main">
<div class="section__header">
<h1 class="section__title">{{ _('Discussion') }}</h1>
</div>
{% include "partials/discussion_list.html" %}
</div>
{% endif %}
</div>
<div class="large-3 columns">
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{% include 'partials/discussion_nodes_widget.html' %}
{% endif %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Recommended') }}</h1>
</div>
<div class="section__body"><ul class="group-list">
<li class="group-list__item">
<h2 class="section__title">{{ _('Chinese') }}</h2>
<ol class="chip-list">
<li class="chip-list__item"><a class="typo-a" href="https://www.xuetangx.com/courses/course-v1:TsinghuaX+30240184+sp/about" target="_blank">清华数据结构 MOOC 上</a><a class="typo-a" href="https://www.xuetangx.com/courses/course-v1:TsinghuaX+30240184_2X+sp/about" target="_blank">/下</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://www.51nod.com/" target="_blank">51Nod</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://www.luogu.org/" target="_blank">洛谷</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://www.rqnoj.cn/" target="_blank">RQNOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://www.lydsy.com/JudgeOnline/" target="_blank">BZOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://acm.zju.edu.cn/onlinejudge/" target="_blank">ZOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://uoj.ac/" target="_blank">UOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://loj.ac/" target="_blank">LibreOJ</a></li>
</ol>
</li>
<li class="group-list__item">
<h2 class="section__title">{{ _('English') }}</h2>
<ol class="chip-list">
<li class="chip-list__item"><a class="typo-a" href="https://acm.njupt.edu.cn/" target="_blank">NOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://www.topcoder.com/" target="_blank">TopCoder</a></li>
<li class="chip-list__item"><a class="typo-a" href="https://uva.onlinejudge.org/" target="_blank">UVa</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://codeforces.com/" target="_blank">Codeforces</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://www.usaco.org/" target="_blank">USACO</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://spoj.pl/" target="_blank">SPOJ</a></li>
<li class="chip-list__item"><a class="typo-a" href="http://poj.org/" target="_blank">POJ</a></li>
</ol>
</li>
</ul></div>
</div>
</div>
</div>
{% endblock %}
-25
View File
@@ -1,25 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row" data-sticky-parent>
<div class="medium-9 columns">
{% block manage_content %}{% endblock %}
</div>
<div class="medium-3 columns"><div data-sticky="large">
<div class="section side">
<ol class="menu">
<li class="menu__item">
<div class="menu__link expandable">
<span class="icon icon-info"></span> {{ _('Properties') }}
</div>
<ol class="menu collapsed">
{{ sidemenu.render_item(null, 'manage_dashboard') }}
{{ sidemenu.render_item(null, 'manage_script') }}
{{ sidemenu.render_item(null, 'manage_module') }}
{{ sidemenu.render_item(null, 'manage_setting') }}
</ol>
</li>
</ol>
</div>
</div></div>
</div>
{% endblock %}
-32
View File
@@ -1,32 +0,0 @@
{% import "components/user.html" as user %}
{% extends "manage_base.html" %}
{% block manage_content %}
<script>
var Context = {
'socketUrl': "/manage/check-conn?token={{ handler.UIContext.token }}"
};
</script>
<div class="section">
<div class="section__header">
<h1 class="section__title" data-heading>{{ _('Messages') }}</h1>
</div>
<div class="section__body typo" id="messages"></div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title" data-heading>{{ _('Information') }}</h1>
<div class="section__tools">
<form method="post">
<input type="hidden" name="operation" value="restart">
<button type="submit" class="primary rounded button"><span class="icon icon-refresh"></span> {{ _('Restart') }}</button>
</form>
</div>
</div>
<div class="section__body typo">
<dl class="large horizontal">
<dt>{{ _('Gravatar') }}</dt><dd><img src="{{ gravatar(domain.gravatar) }}" width="32" height="32"></dd>
<dt>{{ _('Name') }}</dt><dd>{{ domain.name }}</dd>
</dl>
</div>
</div>
{% endblock %}
-55
View File
@@ -1,55 +0,0 @@
{% extends "manage_base.html" %}
{% block manage_content %}
<div style="display: none" class="dialog__body--add-module">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Add Module') }}</h1>
</div></div>
<div class="row">
<div class="medium-12 columns">
<label>
{{ _('URL') }}
<input name="url" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Installed Modules') }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="add_module"><span class="icon icon-add"></span> {{ _('Add Module') }}</button>
<a class="tool-button" href="{{ url('wiki', page='help', anchor='module') }}"><span class="icon icon-help"></span> {{ _("What's module?") }}</a>
</div>
</div>
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
<col class="col--id">
<col class="col--desc">
<col class="col--size">
<col class="col--version">
</colgroup>
<thead>
<tr>
<th class="col--id">{{ _('ID') }}</th>
<th class="col--desc">{{ _('Description') }}</th>
<th class="col--size">{{ _('Size') }}</th>
<th class="col--version">{{ _('Version') }}</th>
</tr>
</thead>
<tbody>
{% for module in installed %}
<tr>
<td class="col--id">{{ module.id }}</td>
<td class="col--desc">{{ _(module.description|default(_('None'))) }}</td>
<td class="col--size">{{ size(module.size) if module.size else '?' }}</td>
<td class="col--version">{{ module.version|default('?') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
-56
View File
@@ -1,56 +0,0 @@
{% extends "manage_base.html" %}
{% block manage_content %}
<div style="display: none" class="dialog__body--run-script">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Run script') }}</h1>
</div></div>
<div class="row">
<div class="medium-12 columns">
<label>
{{ _('Params') }}
<input name="args" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
</div>
</div>
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Scripts') }}</h1>
<div class="section__tools">
<a class="tool-button" href="{{ url('wiki', page='help', anchor='script') }}"><span class="icon icon-help"></span> {{ _("What's script?") }}</a>
</div>
</div>
<div class="section__body no-padding">
{{ noscript_note.render() }}
<table class="data-table">
<colgroup>
<col class="col--id">
<col class="col--desc">
<col class="col--action">
</colgroup>
<thead>
<tr>
<th class="col--id">{{ _('ID') }}</th>
<th class="col--desc">{{ _('Description') }}</th>
<th class="col--action">{{ _('Action') }}</th>
</tr>
</thead>
<tbody>
{% for id, script in scripts %}
{% if not script.hidden %}
<tr>
<td class="col--id">{{ id }}</td>
<td class="col--desc">{{ _(script.description|default(_('None'))) }}</td>
<td class="col--action">
<a class="typo-a" href="javascript: window.runScript('{{ id }}')">{{ _('Run') }}</a>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
-6
View File
@@ -1,6 +0,0 @@
{% extends "manage_base.html" %}
{% block manage_content %}
<div class="section">
{% include "partials/setting.html" %}
</div>
{% endblock %}
-92
View File
@@ -1,92 +0,0 @@
{% import "components/user.html" as user with context %}
{% import "components/contest.html" as contest with context %}
<div class="section side">
{% if page_name != 'contest_detail' %}
<a class="contest-sidebar__bg" href="{{ url('contest_detail', tid=tdoc.docId) }}">
<div class="section__body">
<h1>{{ tdoc.title }}</h1>
<div class="contest-sidebar__status">
{% if attended %}
<span class="icon icon-check"></span> {{ _('Attended') }}
{% else %}
<span class="icon icon-schedule"></span> {{ _('Not Attended') }}
{% endif %}
</div>
</div>
</a>
{% endif %}
<div>
<ol class="menu">
{% if page_name != 'contest_detail' %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_detail', tid=tdoc.docId) }}">
<span class="icon icon-award"></span> {{ _('View Contest') }}
</a></li>
{% endif %}
{% if not attended and not model.contest.isDone(tdoc) %}
<li class="menu__item">
{% if handler.user.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form action="{{ url('contest_detail', tid=tdoc.docId) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button class="menu__link" type="submit">
<span class="icon icon-add"></span> {{ _('Attend Contest') }}
</button>
</form>
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
</a>
{% else %}
<a class="menu__link disabled" href="javascript:;">
<span class="icon icon-add"></span> {{ _('No Permission to Attend Contest') }}
</a>
{% endif %}
</li>
{% endif %}
{% if handler.canShowScoreboard(tdoc, False) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_scoreboard', tid=tdoc.docId) }}">
<span class="icon icon-statistics"></span> {{ _('Scoreboard') }}
</a></li>
{% elif handler.canViewHiddenScoreboard(tdoc) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_scoreboard', tid=tdoc.docId) }}">
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if user._id == tdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_edit', tid=tdoc.docId) }}">
<span class="icon icon-edit"></span> {{ _('Edit Contest') }}
</a></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_code', tid=tdoc.docId) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
{% endif %}
<li class="menu__item"><a class="menu__link" href="{{ url('record_main', query={tid:tdoc.docId}) }}">
<span class="icon icon-flag"></span> {{ _('All Submissions') }}
</a></li>
<li class="menu__item"><a class="menu__link" href="{{ url('wiki', page='help', anchor='contest') }}">
<span class="icon icon-help"></span> {{ _('Help') }}
</a></li>
<li class="menu__seperator"></li>
</ol>
</div>
<div class="section__body typo">
<dl class="large horizontal">
<dt>{{ _('Status') }}</dt><dd>{{ _(model.contest.statusText(tdoc)) }}</dd>
<dt>{{ _('Rule') }}</dt><dd>{{ model.contest.RULES[tdoc.rule].TEXT }}</dd>
<dt>{{ _('Problem') }}</dt><dd>{{ tdoc.pids.length }}</dd>
<dt>{{ _('Start at') }}</dt><dd>{{ contest.render_time(tdoc.beginAt) }}</dd>
<dt>{{ _('End at') }}</dt><dd>{{ contest.render_time(tdoc.endAt) }}</dd>
<dt>{{ _('Duration') }}</dt><dd>{{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}</dd>
<dt>{{ _('Host') }}</dt><dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
<dt>{{ _('Partic.') }}</dt>
<dd>
{{ tdoc['attend']|default(0) }}
{% if attended %}
({{ _('Attended') }})
{% endif %}
</dd>
</dl>
</div>
</div>
@@ -1,24 +0,0 @@
{% import "components/form.html" as form with context %}
{% if ddoc.highlight or handler.user.hasPerm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{{ form.form_checkbox({
label:'Highlight',
name:'highlight',
value:ddoc.highlight|default(false)
}) }}
{% endif %}
{{ form.form_text({
label:'Title',
name:'title',
value:ddoc.title|default(''),
autofocus:true,
required:true
}) }}
{{ form.form_textarea({
columns:12,
label:'Content',
name:'content',
value:ddoc.content|default(''),
hotkeys:'ctrl+enter:submit',
markdown:true,
required:true
}) }}
-46
View File
@@ -1,46 +0,0 @@
{% import "components/nothing.html" as nothing with context %}
{% import "components/user.html" as user with context %}
{% import "components/paginator.html" as paginator with context %}
{% if not ddocs.length %}
{{ nothing.render('no discussion yet...') }}
{% else %}
<ol class="section__list discussion__list">
{% for ddoc in ddocs %}
<li class="section__list__item discussion__item{% if ddoc.highlight %} highlight{% endif %}">
<div class="media">
<div class="media__left">
<div class="discussion__replies numbox">
<div class="numbox__num large">{{ ddoc.nReply }}</div>
<div class="numbox__text">{{ _('Comments') }}</div>
</div>
</div>
<div class="media__body top">
<h1 class="discussion__title"><a href="{{ url('discussion_detail', did=ddoc._id, anchor=ddoc.updateAt.getTime()) }}" data-emoji-enabled>{{ ddoc['title'] }}</a></h1>
<ul class="supplementary list">
<li>
<a class="discussion-node-tag" href="{{ url('discussion_node', type=model.discussion.typeDisplay[ddoc.parentType], name=ddoc.parentId) }}">
{% if ddoc.parentType == model.document.TYPE_PROBLEM %}
<span class="v-center icon icon-tag"></span>
{% elif ddoc.parentType == model.document.TYPE_CONTEST %}
<span class="v-center icon icon-award"></span>
{% else %}
<span class="v-center icon icon-flag"></span>
{% endif %}
{{ vndict[ddoc.parentType][ddoc.parentId].title|default(_('(missing)')) }}
</a>
</li>
<li>
{{ user.render_inline(udict[ddoc.owner], badge=false) }}
@
{{ datetimeSpan(ddoc.updateAt)|safe }}
</li>
</ul>
</div>
</div>
</li>
{% endfor %}
</ol>
{% if page != undefined and dpcount != undefined %}
{{ paginator.render(page, dpcount) }}
{% endif %}
{% endif %}
@@ -1,17 +0,0 @@
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Discussion Nodes') }}</h1>
</div>
<div class="section__body"><ul class="group-list">
{%- for category, nodes in vnodes|groupby('content') -%}
<li class="group-list__item">
<h2 class="section__title">{{ category }}</h2>
<ol class="chip-list">
{%- for node in nodes -%}
<li class="chip-list__item"><a class="typo-a" href="{{ url('discussion_node', type=model.discussion.typeDisplay[model.document.TYPE_DISCUSSION_NODE], name=node.docId) }}">{{ node.docId }}</a></li>
{%- endfor -%}
</ol>
</li>
{%- endfor -%}
</ul></div>
</div>
-74
View File
@@ -1,74 +0,0 @@
{% if not isIE(handler.request.headers['user-agent']) %}
<div class="footer">
<div class="row"><div class="columns">
{% if show_topics|default(true) %}
<div class="row footer__links">
<div class="medium-3 large-2 columns footer__category expandable">
<h1>
{{ _('Status') }}
<span class="expand-icon">
<span class="icon icon-expand_more"></span>
</span>
</h1>
<div class="footer__category__expander"><ul class="footer__category__list">
<li class="footer__category__item"><a href="{{ url('record_main') }}">{{ _('Judging Queue') }}</a></li>
<li class="footer__category__item"><a href="{{ url('status') }}">{{ _('Service Status') }}</a></li>
</ul></div>
</div>
<div class="medium-3 large-2 columns footer__category expandable">
<h1>
{{ _('Development') }}
<span class="expand-icon">
<span class="icon icon-expand_more"></span>
</span>
</h1>
<div class="footer__category__expander"><ul class="footer__category__list">
<li class="footer__category__item"><a href="https://github.com/hydro-dev/Hydro" target="_blank">{{ _('Open Source') }}</a></li>
<li class="footer__category__item"><a href="{{ url('wiki', page='api') }}">{{ _('API') }}</a></li>
</ul></div>
</div>
<div class="medium-3 large-2 columns footer__category expandable end">
<h1>
{{ _('Support') }}
<span class="expand-icon">
<span class="icon icon-expand_more"></span>
</span>
</h1>
<div class="footer__category__expander"><ul class="footer__category__list">
<li class="footer__category__item"><a href="{{ url('wiki', page='about') }}">{{ _('Help') }}</a></li>
<!--<li class="footer__category__item"><a href="#">{{ _('Blog') }}</a></li>-->
<li class="footer__category__item"><a href="{{ url('wiki', page='contact') }}">{{ _('QQ Group') }}</a></li>
</ul></div>
</div>
</div>
{% endif %}
<div class="footer__extra-link clearfix">
<div class="footer__extra-left">
<ol class="clearfix">
<li class="footer__extra-link-item"><a href="{{ url('wiki', page='about') }}">{{ _('About') }}</a></li>
<li class="footer__extra-link-item"><a href="{{ url('wiki', page='contact') }}">{{ _('Contact Us') }}</a></li>
<li class="footer__extra-link-item"><a href="{{ url('wiki', page='about', anchor='privacy') }}">{{ _('Privacy') }}</a></li>
<li class="footer__extra-link-item"><a href="{{ url('wiki', page='about', anchor='tos') }}">{{ _('Terms of Service') }}</a></li>
<li class="footer__extra-link-item"><a href="{{ url('wiki', page='about', anchor='copyright-complaint') }}">{{ _('Copyright Complaint') }}</a></li>
<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 k, v in model.setting.langRange %}
<li class="menu__item"><a class="menu__link" href="{{ url('switch_language', lang=k) }}">{{ v }}</a></li>
{% endfor %}
</ol>
</li>
</ol>
</div>
<div class="footer__extra-right">
<ol class="clearfix">
<!-- TODO -->
{% for html in model.builtin.FOOTER_EXTRA_HTMLS %}
<li class="footer__extra-link-item">{{ html|safe }}</li>
{% endfor %}
</ol>
</div>
</div>
</div></div>
</div>
{% endif %}
-7
View File
@@ -1,7 +0,0 @@
<button type="button" class="header__hamburger">
<div class="hamburger hamburger--spin">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</div>
</button>
-6
View File
@@ -1,6 +0,0 @@
<div class="header{% if no_path_section %} mini{% endif %}">
<div class="header__content"><div class="row"><div class="columns">
<a class="header__logo" href="/" target="_self"></a>
</div></div></div>
{% include "partials/path.html" %}
</div>
-12
View File
@@ -1,12 +0,0 @@
{% if no_path_section %}
<div class="header--mobile">
<div class="row"><div class="columns clearfix">
<div class="float-left">
<a class="header--mobile__domain is--system" href="/" target="_self">&nbsp;</a>
</div>
<div class="float-right">
{% include "partials/hamburger.html" %}
</div>
</div></div>
</div>
{% endif %}
@@ -1,6 +0,0 @@
# Format:
# hours: coefficient
1: 0.9
3: 0.8
12: 0.75
9999: 0.5
-85
View File
@@ -1,85 +0,0 @@
{% import "components/user.html" as user with context %}
{% import "components/homework.html" as homework with context %}
<div class="section side">
{% if page_name != 'homework_detail' %}
<a class="contest-sidebar__bg" href="{{ url('homework_detail', tid=tdoc.docId) }}">
<div class="section__body">
<h1>{{ tdoc['title'] }}</h1>
<div class="contest-sidebar__status">
{% if attended %}
<span class="icon icon-check"></span> {{ _('Claimed') }}
{% else %}
<span class="icon icon-schedule"></span> {{ _('Not Claimed') }}
{% endif %}
</div>
</div>
</a>
{% endif %}
<div>
<ol class="menu">
{% if page_name != 'homework_detail' %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_detail', tid=tdoc.docId) }}">
<span class="icon icon-homework"></span> {{ _('View Homework') }}
</a></li>
{% endif %}
{% if not attended and not model.contest.isDone(tdoc) %}
<li class="menu__item">
{% if handler.user.hasPerm(perm.PERM_ATTEND_HOMEWORK) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form action="{{ url('homework_detail', tid=tdoc.docId) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button class="menu__link" type="submit">
<span class="icon icon-add"></span> {{ _('Claim Homework') }}
</button>
</form>
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Claim Homework') }}
</a>
{% else %}
<a class="menu__link disabled" href="javascript:;">
<span class="icon icon-add"></span> {{ _('No Permission to Claim Homework') }}
</a>
{% endif %}
</li>
{% endif %}
{% if handler.canShowScoreboard(tdoc, false) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_scoreboard', tid=tdoc.docId) }}">
<span class="icon icon-statistics"></span> {{ _('Scoreboard') }}
</a></li>
{% elif handler.canViewHiddenScoreboard(tdoc) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_scoreboard', tid=tdoc.docId) }}">
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_edit', tid=tdoc.docId) }}">
<span class="icon icon-edit"></span> {{ _('Edit Homework') }}
</a></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_code', tid=tdoc.docId) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
{% endif %}
{% if attended %}
<li class="menu__item"><a class="menu__link" href="{{ url('record_detail', query={uidOrName:handler.user._id, tid:tdoc.docId}) }}">
<span class="icon icon-flag"></span> {{ _('My Recent Submissions') }}
</a></li>
{% endif %}
<li class="menu__item"><a class="menu__link" href="{{ url('wiki', page='help', anchor='homework') }}">
<span class="icon icon-help"></span> {{ _('Help') }}
</a></li>
<li class="menu__seperator"></li>
</ol>
</div>
<div class="section__body typo">
<dl class="large horizontal">
<dt>{{ _('Status') }}</dt><dd><span class="homework-status--text {{ model.contest.getStatus(tdoc) }}">{{ _(model.contest.statusText(tdoc)) }}</span></dd>
<dt>{{ _('Problem') }}</dt><dd>{{ tdoc['pids']|length }}</dd>
<dt>{{ _('Open Since') }}</dt><dd>{{ homework.render_time(tdoc['beginAt']) }}</dd>
<dt>{{ _('Deadline') }}</dt><dd>{{ homework.render_time(tdoc['penaltySince']) }}</dd>
<dt>{{ _('Can be Extended For') }}</dt><dd>{{ homework.render_extension(tdoc) }} {{ _('hour(s)') }}</dd>
</dl>
</div>
</div>
-52
View File
@@ -1,52 +0,0 @@
<div class="dialog dialog--signin" style="display:none">
<div class="dialog__content">
<div class="dialog--signin__bg">
<div class="dialog--signin__side">
<h1>{{ _("Don't have an account?") }}</h1>
<p>{{ _('By signing up a Hydro universal account, you can submit code and join discussions in all online judging services provided by us.') }}</p>
<div><a href="{{ url('user_register') }}" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
</div>
</div>
<div class="dialog--signin__main">
<form action="{{ url('user_login') }}" method="post">
<div class="dialog--signin__close-container supplementary">
<a name="dialog--signin__close" href="javascript:;">{{ _('CLOSE') }}</a>
</div>
<h1 class="dialog--signin__title">{{ _('SIGN IN') }}</h1>
<p class="dialog--signin__note">{{ _('Using your Hydro universal account') }}</p>
<div class="row"><div class="columns">
<label class="material textbox">
{{ _('Username') }}
<input name="uname" type="text" data-autofocus>
</label>
</div></div>
<div class="row"><div class="columns">
<label class="material textbox">
{{ _('Password') }}
<input name="password" type="password">
</label>
</div></div>
<div class="row"><div class="columns">
<label class="checkbox">
<input type="checkbox" name="rememberme">{{ _('Remember me') }}
</label>
</div></div>
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<div class="row"><div class="columns">
<a href="{{ url('user_oauth', type='github') }}" class="expanded rounded button">{{ _('Login with Github') }}</a>
</div></div>
<div class="row"><div class="columns">
<a href="{{ url('user_oauth', type='google') }}" class="expanded rounded button">{{ _('Login with Google') }}</a>
</div></div>
<div class="row"><div class="columns">
<input type="submit" value="{{ _('Sign In') }}" class="expanded rounded primary button">
</div></div>
<div class="row"><div class="columns">
<div class="supplementary text-center">
<a href="{{ url('user_lostpass') }}">{{ _('Forgot password or username?') }}</a>
</div>
</div></div>
</form>
</div>
</div>
</div>
-76
View File
@@ -1,76 +0,0 @@
{%- macro nav_item(target_page_name, target_page_args, target_page_prefix) -%}
<li class="nav__list-item">
<a href="{{ url(target_page_name, target_page_args) }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
{{ _(target_page_name) }}
</a>
</li>
{%- endmacro -%}
<nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix">
<li class="nav__list-item"><a href="/" class="nav__logo">&nbsp;</a></li>
{% for item in Context.nav %}
{% if item.checker(handler) %}
{{ nav_item(item.name, item.args, item.prefix) }}
{% endif %}
{% endfor %}
</ol>
<ol class="nav__list nav__list--secondary clearfix">
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<li class="nav__list-item"><a href="{{ url('user_login') }}" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="{{ 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="{{ 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="{{ url('user_detail', uid=handler.user._id) }}" class="menu__link">
<span class="icon icon-account--circle"></span> {{ _('My Profile') }}
</a>
</li>
<li class="menu__item">
<a href="{{ url('home_messages') }}" class="menu__link">
<span class="icon icon-comment--multiple"></span> {{ _('home_messages') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ url('home_settings', category='account') }}" class="menu__link">
<span class="icon icon-wrench"></span> {{ _('home_account') }}
</a>
</li>
<li class="menu__item">
<a href="{{ url('home_settings', category='preference') }}" class="menu__link">
<span class="icon icon-sliders"></span> {{ _('home_preference') }}
</a>
</li>
<li class="menu__item">
<a href="{{ url('home_security') }}" class="menu__link">
<span class="icon icon-security"></span> {{ _('home_security') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ url('home_file') }}" class="menu__link">
<span class="icon icon-file"></span> {{ _('My Files') }}
</a>
</li>
<li class="menu__item">
<a href="{{ url('home_domain') }}" class="menu__link">
<span class="icon icon-web"></span> {{ _('My Domains') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ url('user_logout') }}" class="menu__link" name="nav_logout">
<span class="icon icon-logout"></span> {{ _('Logout') }}
</a>
</li>
</ol>
</li>
{% endif %}
</ol>
</div></div>
</nav>
<nav class="nav--shadow"></nav>
-19
View File
@@ -1,19 +0,0 @@
<div class="location" data-fragment-id="path">
{% if not no_path_section %}
<div class="row"><div class="columns">
<div class="media">
<div class="media__body">
<div class="location-path">
{% for c in path %}
/ {% if loop.index < path.length %}<a href="{{ url(c[1], c[2])|default('#') }}">{{ c[0] if c[3] else _(c[0]) }}</a>{% endif %}
{%- endfor %}
</div>
<h1 class="location-current" data-emoji-enabled>{{ path[path.length - 1][0] if path[path.length - 1][3] else _(path[path.length - 1][0]) }}</h1>
</div>
<div class="media__right">
{% include "partials/hamburger.html" %}
</div>
</div>
</div></div>
{% endif %}
</div>
-30
View File
@@ -1,30 +0,0 @@
# Background
Special for beginners, ^_^
# Description
Given two integers x and y, print the sum.
# Format
## Input
Two integers x and y, satisfying $0\leq x,y\leq 32767$ .
## Output
One integer, the sum of x and y.
# Sample 1
## Input
```
123 500
```
## Output
```
623
```
# Limitation
1s, 1024KiB for each test case.
-54
View File
@@ -1,54 +0,0 @@
{% import "components/paginator.html" as paginator with context %}
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% import "components/nothing.html" as nothing with context %}
<div data-fragment-id="problem_list">
{% if not pdocs.length %}
{{ nothing.render('Sorry, there is no problem in the problem set') }}
{% else %}
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
{% endif %}
<col class="col--name">
<col class="col--submit_n">
<col class="col--ac_rate">
<col class="col--difficulty">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
<th class="col--submit_n">{{ _('Submit') }}</th>
<th class="col--ac_rate">% {{ _('AC') }}</th>
<th class="col--difficulty">{{ _('Difficulty') }}</th>
</tr>
</thead>
<tbody>
{% for pdoc in pdocs %}
{% set psdoc = psdict[pdoc['docId']] %}
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
<td class="col--status record-status--border">
</td>
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{{ problem.render_problem_title(pdoc) }}
</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>
{% endfor %}
</tbody>
</table>
{{ paginator.render(page, ppcount) }}
{% endif %}
</div>
-10
View File
@@ -1,10 +0,0 @@
<div data-fragment-id="problem_lucky">
<p>
<a href="{{ url('problem_random', query={category:category}) if category else url('problem_random') }}" class="expanded button" target="_blank">
<span class="icon icon-feeling-lucky"></span> {{ _('Lucky') }}
</a>
</p>
<div class="typo supplementary">
<p>{{ _('Pick a problem randomly based on current filter') }}</p>
</div>
</div>
-17
View File
@@ -1,17 +0,0 @@
{% if tdoc %}
{% if tdoc.docType == 60 %}
{% include "partials/problem_sidebar_homework.html" %}
{% if not owner_udoc %}
{% set owner_udoc = udoc %}
{% endif %}
{% include "partials/homework_sidebar.html" %}
{% else %}
{% include "partials/problem_sidebar_contest.html" %}
{% if not owner_udoc %}
{% set owner_udoc = udoc %}
{% endif %}
{% include "partials/contest_sidebar.html" %}
{% endif %}
{% else %}
{% include "partials/problem_sidebar_normal.html" %}
{% endif %}
@@ -1,42 +0,0 @@
{% import "components/user.html" as user with context %}
<div class="section side section--problem-sidebar">
{% if page_name != 'problem_detail' and page_name != 'contest_detail_problem' %}
<div class="section__header">
<h1 class="section__title">{{ pdoc['title'] }}</h1>
</div>
{% endif %}
<div>
<ol class="menu">
{% if model.contest.isOngoing(tdoc) %}
{% if page_name == 'contest_detail_problem' %}
<li class="menu__item scratchpad--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_detail_problem', tid=tdoc.docId, pid=pdoc.docId) }}">
<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="{{ url('contest_detail_problem_submit', tid=tdoc.docId, pid=pdoc.docId) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif model.contest.isDone(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.pid) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if pdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ url('problem_edit', pid=pdoc.pid) }}">
<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="{{ url('problem_settings', pid=pdoc.pid) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
</ol>
</div>
</div>
@@ -1,42 +0,0 @@
{% import "components/user.html" as user with context %}
<div class="section side section--problem-sidebar">
{% if page_name != 'problem_detail' and page_name != 'homework_detail_problem' %}
<div class="section__header">
<h1 class="section__title">{{ pdoc['title'] }}</h1>
</div>
{% endif %}
<div>
<ol class="menu">
{% if model.contest.isOngoing(tdoc) or model.contest.isExtended(tdoc) %}
{% if page_name == 'homework_detail_problem' %}
<li class="menu__item scratchpad--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_detail_problem', tid=tdoc.docId, pid=pdoc.docId) }}">
<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="{{ url('homework_detail_problem_submit', tid=tdoc.docId, pid=pdoc.docId) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif model.contest.isDone(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.pid) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if pdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ url('problem_edit', pid=pdoc.pid) }}">
<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="{{ url('problem_settings', pid=pdoc.pid) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
</ol>
</div>
</div>
@@ -1,168 +0,0 @@
{% import "components/user.html" as user with context %}
{% import "components/problem.html" as problem with context %}
<div class="section side section--problem-sidebar">
{% if page_name != 'problem_detail' and page_name != 'contest_detail_problem' %}
<div class="section__header">
<h1 class="section__title">{{ pdoc['title'] }}</h1>
</div>
{% endif %}
<div>
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ url('discussion_create', type='problem', name=pdoc.docId) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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 %}
<li class="menu__item"><a class="menu__link disabled" href="javascript:;">
<span class="icon icon-add"></span> {{ _('No Permission to Create a Discussion') }}</a></li>
{% endif %}
{% endif %}
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.user.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.pid) }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ url('problem_submit', pid=pdoc.pid) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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>
{% else %}
<li class="menu__item scratchpad--hide"><a class="menu__link disabled{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:;">
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
</a></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__seperator"></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ url('discussion_node', type='problem', name=pdoc.docId) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ url('problem_solution', pid=pdoc.pid) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ url('problem_edit', pid=pdoc.pid) }}">
<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="{{ url('problem_settings', pid=pdoc.pid) }}">
<span class="icon icon-wrench"></span> {{ _('Settings') }}
</a></li>
{% endif %}
</ol>
</div>
</div>
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
</div>
<div class="section__body typo">
<dl class="large horizontal">
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc.docId }}</dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc.psdoc.status %}
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
<a href="{{ url('record_detail', rid=pdoc.psdoc.rid) }}" class="record-status--text {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
{{ model.builtin.STATUS_TEXTS[pdoc['psdoc']['status']] }}
</a>
{% else %}
{{ _('(None)') }}
{% endif %}
{% if pdoc['acMsg'] and pdoc['psdoc']['status'] == STATUS.STATUS_ACCEPTED %}
<dt>{{ _('AC Message') }}</dt>
<dd>{{ pdoc['acMsg'] }}</dd>
{% endif %}
</dd>
{% endif %}
{% endif %}
<dt>{{ _('Difficulty') }}</dt>
<dd>{{ pdoc['difficulty'] or _('(None)') }}</dd>
<dt>{{ _('Category') }}</dt>
<dd>
{% if pdoc['category'] %}
<span class="hasjs--hide" name="problem-sidebar__categories">
{% for category in pdoc['category'] %}
<a href="{{ url('problem_category', category=category) }}">{{ category }}</a>
{% if loop.index < pdoc['category']|length %}
{{ _('problem-subcategory-delim') }}
{% endif %}
{% endfor %}
</span>
<span class="nojs--hide">
<a href="javascript:;" name="problem-sidebar__show-category">{{ _('page.problem_detail.sidebar.show_category') }}</a>
</span>
{% else %}
{{ _('(None)') }}
{% endif %}
</dd>
<dt>{{ _('Tags') }}</dt>
<dd>
{{ problem.render_problem_tags(pdoc, true) }}
</dd>
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId}) }}">{{ pdoc.nSubmit }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId, uidOrName:handler.user._id}) }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
{% endif %}
{% endif %}
<dt>{{ _('Accepted') }}</dt>
<dd>{{ pdoc.nAccept }}</dd>
<dt>{{ _('Accepted Ratio') }}</dt>
<dd>{% if pdoc.nSubmit > 0 %}{{ (100 * pdoc.nAccept / pdoc.nSubmit)|round|int }}%{% else %}{{ _('?') }}{% endif %}</dd>
<dt>{{ _('Uploaded By') }}</dt>
<dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
</dl>
</div>
</div>
{% if page_name == 'problem_detail' and (tdocs or ctdocs) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Related') }}</h1>
</div>
<div class="section__body typo">
{% if tdocs %}
<p>{{ _('In following training plans') }}: </p>
{% for tdoc in tdocs %}
<p><a href="{{ url('training_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
{% endfor %}
{% endif %}
{% if ctdocs %}
<p>{{ _('In following contests') }}: </p>
{% for tdoc in ctdocs %}
<p><a href="{{ url('contest_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a></p>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
-3
View File
@@ -1,3 +0,0 @@
<div class="section__body" data-fragment-id="problem_stat">
<p>{{ _('{0} problems').format(pcount) }}</p>
</div>
-84
View File
@@ -1,84 +0,0 @@
<form method="post">
{% for family, family_settings in settings|groupby('family') %}
<div class="section__header">
<h1 class="section__title" id="{{ family }}" data-heading>{{ _(family) }}</h1>
</div>
<div class="section__body">
{% for setting in family_settings %}
{% if not setting.flag|bitand(model.setting.FLAG_HIDDEN) %}
{% set secret = setting.flag|bitand(model.setting.FLAG_SECRET) != 0 %}
{% if setting.type == 'text' or setting.type == 'password' or setting.type == 'number' %}
{{ form.form_text({
type:setting.type,
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:'' if secret else (current[setting.key]|default(setting.value)),
disabled:setting.disabled,
placeholder:_('(Not changed)') if secret else ''
}) }}
{% elif setting.type == 'select' %}
{{ form.form_select({
options:setting.range,
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:current[setting.key] or setting.value,
disabled:setting.disabled
}) }}
{% elif setting.type == 'radio' %}
{{ form.form_radio({
options:setting.range,
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:current[setting.key] or setting.value,
disabled:setting.disabled
}) }}
{% elif setting.type == 'image_radio' %}
{{ form.form_image_radio({
options:setting.range,
image_class:setting.image_class,
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:current[setting.key] or setting.value,
disabled:setting.disabled
}) }}
{% elif setting.type == 'textarea' %}
{{ form.form_textarea({
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:'' if secret else (current[setting.key]|default(setting.value)),
disabled:setting.disabled,
placeholder:_('(Not changed)') if secret else ''
}) }}
{% elif setting.type == 'markdown' %}
{{ form.form_textarea({
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:'' if secret else (current[setting.key]|default(setting.value)),
markdown:true,
disabled:setting.disabled,
placeholder:_('(Not changed)') if secret else ''
}) }}
{% elif setting.type == 'boolean' %}
{{ form.form_checkbox({
label:setting.name,
help_text:setting.desc,
name:setting.key,
value:current[setting.key] or setting.value,
disabled:setting.disabled
})}}
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endfor %}
<div class="section__body">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<input type="submit" class="rounded primary button" value="{{ _('Save All Changes') }}">
</div>
</form>
-14
View File
@@ -1,14 +0,0 @@
[
{
"_id": 1,
"title": "最初的最初 - A+B Problem",
"requireNids": [],
"pids": [1000, "56c52ade2fefd90539000005"]
},
{
"_id": 2,
"title": "最初的进阶",
"requireNids": [1],
"pids": [1001, 1002]
}
]
-54
View File
@@ -1,54 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<script>
var Context = {{ {
problemId: pdoc.pid,
postSubmitUrl: url('problem_submit', pid=pdoc.pid),
postPretestUrl: url('problem_pretest', pid=pdoc.pid),
getSubmissionsUrl: url('problem_submit', pid=pdoc.pid),
getRecordDetailUrl: url('record_detail', rid='{rid}'),
codeLang: handler.user.codeLang,
codeTemplate: handler.user.codeTemplate
}|json|safe }};
</script>
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="problem-content-container"><div class="problem-content" data-marker-enabled>
<div class="section__header non-scratchpad--hide">
<h1>{{ pdoc['title'] }}</h1>
</div>
<div class="section__body typo">
{% if not pdoc['data'] %}
<blockquote class="warn">
<p>{{ _('No dataset at present.') }}</p>
</blockquote>
{% elif typeof(pdoc.data) == 'string' %}
<blockquote class="note">
<p>{{ _('Test data comes from') }} <a href="#" target="_blank">{{ pdoc.data.split(':')[1] }}</a></p>
</blockquote>
{% endif %}
{% if tdoc %}
{% if tdoc['docType'] == model.document.TYPE_CONTEST %}
{% if model.contest.isDone(tdoc) %}
<blockquote class="note">
<p>{{ _('You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.') }}</p>
</blockquote>
{% endif %}{# handler.isDone(tdoc) #}
{% endif %}{# tdoc['docType'] == model.document.TYPE_CONTEST #}
{% endif %}{# tdoc #}
{{ pdoc['content']|markdown|safe }}
</div>
</div></div>
</div>
</div>
<div class="medium-3 columns">
{% set owner_udoc = udoc %}
{% include "partials/problem_sidebar.html" %}
</div>
</div>
<div class="scratchpad-container" style="display:none">
<div style="display:none" class="loader-container"><div class="loader"></div></div>
<div id="scratchpad" style="opacity:0"></div>
</div>
{% endblock %}
-64
View File
@@ -1,64 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<form method="post">
<div class="row">
<div class="medium-7 columns">
<label>
{{ _('Title') }}
<input name="title" placeholder="{{ _('title') }}" value="{{ pdoc['title']|default('') }}" class="textbox" autofocus>
</label>
</div>
<div class="medium-3 columns">
<label>
{{ _('pid') }}
<br>
<label>
<input name="pid" placeholder="{{ _('Leave blank to use numeric pid.') }}" value="{{ pdoc['pid']|default('') }}" class="textbox">
</label>
</label>
</div>
<div class="medium-2 columns">
<label>
<br>
<label class="checkbox">
<input type="checkbox" name="hidden" value="on"{% if pdoc['hidden'] %} checked{% endif %}>{{ _('Hidden') }}
</label>
</label>
</div>
</div>
<div class="row"><div class="columns">
<label>
{{ _('Content') }}
<textarea name="content" class="textbox" data-markdown style="height: 500px">{% if pdoc %}{{ pdoc['content'] }}{% else %}{% include 'partials/problem_default.md' %}{% endif %}</textarea>
</label>
</div></div>
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
{% if page_name == 'problem_edit' %}
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% else %}
<button type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
{% endif %}
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
{% if page_name == 'problem_edit' %}
{% set owner_udoc = udoc %}
{% include "partials/problem_sidebar.html" %}
{% else %}
{% include 'components/md_hint.html' %}
{% endif %}
</div>
</div>
{% endblock %}
-60
View File
@@ -1,60 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
<div class="medium-9 columns">
<div class="section">
<div class="section__body">
<form method="post">
<div class="row">
<div class="medium-2 columns">
<label>
{{ _('Source type') }}
<input name="remoteType" placeholder="syzoj" class="textbox" autocomplete="off">
</label>
</div>
<div class="medium-6 columns">
<label>
{{ _('Import from') }}
<input name="url" placeholder="{{ _('Source') }}" class="textbox" autocomplete="off">
</label>
</div>
<div class="medium-2 columns">
<label>
{{ _('Settings') }}
<input name="pid" placeholder="{{ _('ProblemID') }}" class="textbox" autocomplete="off">
</label>
</div>
<div class="medium-2 columns">
<label>
<br>
<label class="checkbox">
<input type="checkbox" name="hidden" value="on">{{ _('Hidden') }}
</label>
</label>
</div>
</div>
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button">
{{ _('Import') }}
</button>
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
<div class="medium-3 columns">
<div class="section side">
<div class="section__body typo">
<h2>{{ _('What is this?') }}</h2>
<p>{{ _('With this feature, you can import problems that you can view from a site to here. Their title, content, tags and categories will be imported. However, their test data are not copied directly.') }}</p>
<h2>{{ _('About test data') }}</h2>
<p>{{ _('Instead of copying the test data directly, the test data of the import problems will be linked to the test data of the source problems (called the source test data). Thus, the copied problems can observe the changes in the source test data. The permissions of the test data of the copied problems follow the source test data, e.g., you still might not download them but the judges can. By uploading some new test data, the link will be broken and the new test data will be used.') }}</p>
</div>
</div>
</div>
</div>
{% endblock %}
-94
View File
@@ -1,94 +0,0 @@
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% extends "layout/basic.html" %}
{% block content %}
<script>
var Context = {
getProblemUrlWithCategory: "{{ url('problem_category', category='{category}') }}",
getProblemUrlWithoutCategory: "{{ url('problem_main') }}",
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>
<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 model.builtin.CATEGORIES %}
<li class="group-list__item">
<h2 class="section__title">
<a href="{{ url('problem_category', category=category) }}">{{ 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="{{ url('problem_category', category=(category + ',' + sub_category)) }}">{{ 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="{{ url('problem_main') }}">
<div class="section__body">
<label>
<input name="q" type="text" class="textbox" value="{{ category }}" placeholder="1001">
</label>
<button type="submit" class="primary button">{{ _('Search') }}</button>
</div>
</form>
</div>
{% if handler.user.hasPerm(perm.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="{{ url('problem_create') }}" class="menu__link">
<span class="icon icon-add"></span>
{{ _('Create Problem') }}</a>
</li>
<li class="menu__item">
<a href="{{ url('problem_import') }}" class="menu__link">
<span class="icon icon-copy"></span>
{{ _('Import 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>
{% endblock %}
Loaded 100 of 546 files, more files were not shown because too many files have changed in this diff. Show more