mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use record-conn handler for pretest-conn
This commit is contained in:
1 parent
9b9243a87c
commit
c6d3ce1e79
10 files changed
+166
-141
No files matched your search
+20
-4
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable consistent-return */
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
/// <reference types="./jssh" />
|
/// <reference types="./jssh" />
|
||||||
|
|
||||||
@@ -93,7 +94,13 @@ const steps = [
|
|||||||
operations: [
|
operations: [
|
||||||
() => {
|
() => {
|
||||||
const res = exec1('bash -c "source /root/.nvm/nvm.sh && nvm install 14"', { NVM_NODEJS_ORG_MIRROR });
|
const res = exec1('bash -c "source /root/.nvm/nvm.sh && nvm install 14"', { NVM_NODEJS_ORG_MIRROR });
|
||||||
const ver = res.output.split('Now using node v')[1].split(' ')[0];
|
let ver;
|
||||||
|
try {
|
||||||
|
ver = res.output.split('Now using node v')[1].split(' ')[0];
|
||||||
|
} catch (e) {
|
||||||
|
log.error('Cannot parse version. Installation fail.');
|
||||||
|
return 'retry';
|
||||||
|
}
|
||||||
setenv('PATH', `/root/.nvm/versions/node/v${ver}/bin:${__env.PATH}`);
|
setenv('PATH', `/root/.nvm/versions/node/v${ver}/bin:${__env.PATH}`);
|
||||||
const rc_path = `/root/.${__env['SHELL'].endsWith('zsh') ? 'zsh' : 'bash'}rc`;
|
const rc_path = `/root/.${__env['SHELL'].endsWith('zsh') ? 'zsh' : 'bash'}rc`;
|
||||||
if (!fs.exist(rc_path)) fs.writefile(rc_path, source_nvm);
|
if (!fs.exist(rc_path)) fs.writefile(rc_path, source_nvm);
|
||||||
@@ -152,12 +159,17 @@ const steps = [
|
|||||||
Arch ? 'pacman --needed --quiet --noconfirm -S gcc fpc' : 'apt-get install -y g++ fp-compiler >/dev/null',
|
Arch ? 'pacman --needed --quiet --noconfirm -S gcc fpc' : 'apt-get install -y g++ fp-compiler >/dev/null',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
init: '正在安装沙箱 / Installing sandbox',
|
||||||
|
operations: [
|
||||||
|
`curl -fSL ${SANDBOX_DOWNLOAD} -o /usr/bin/sandbox`,
|
||||||
|
'chmod +x /usr/bin/sandbox',
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
init: '正在安装 HydroOJ / Installing HydroOJ',
|
init: '正在安装 HydroOJ / Installing HydroOJ',
|
||||||
operations: [
|
operations: [
|
||||||
'yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge',
|
'yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge',
|
||||||
() => http.download(SANDBOX_DOWNLOAD, '/usr/bin/sandbox'),
|
|
||||||
'chmod +x /usr/bin/sandbox',
|
|
||||||
() => fs.writefile('/root/.hydro/addon.json', '["@hydrooj/ui-default","@hydrooj/hydrojudge"]'),
|
() => fs.writefile('/root/.hydro/addon.json', '["@hydrooj/ui-default","@hydrooj/hydrojudge"]'),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -199,7 +211,11 @@ for (let i = 0; i < steps.length; i++) {
|
|||||||
if (!(step.skip && step.skip())) {
|
if (!(step.skip && step.skip())) {
|
||||||
for (const op of step.operations) {
|
for (const op of step.operations) {
|
||||||
if (typeof op === 'string') {
|
if (typeof op === 'string') {
|
||||||
exec(op);
|
let res = exec(op);
|
||||||
|
while (res === 'retry') {
|
||||||
|
log.warn('Retry...');
|
||||||
|
res = exec(op);
|
||||||
|
}
|
||||||
if (__code !== 0) log.fatal('Error when running %s', op);
|
if (__code !== 0) log.fatal('Error when running %s', op);
|
||||||
} else op();
|
} else op();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ async function postInit() {
|
|||||||
this.clean = [];
|
this.clean = [];
|
||||||
fs.ensureDirSync(this.tmpdir);
|
fs.ensureDirSync(this.tmpdir);
|
||||||
tmpfs.mount(this.tmpdir, getConfig('tmpfs_size'));
|
tmpfs.mount(this.tmpdir, getConfig('tmpfs_size'));
|
||||||
logger.info(`Submission: ${this.rid}`, { pid: this.pid });
|
logger.info(`Submission: ${this.domainId}/${this.rid}`, { pid: this.pid });
|
||||||
if (typeof this.input === 'string') await this.run();
|
if (typeof this.input === 'string') await this.run();
|
||||||
else await this.submission();
|
else await this.submission();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.26.25",
|
"version": "2.26.26",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -308,37 +308,6 @@ export class ProblemPretestHandler extends ProblemDetailHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProblemPretestConnectionHandler extends ConnectionHandler {
|
|
||||||
pid: string;
|
|
||||||
domainId: string;
|
|
||||||
dispose: bus.Disposable;
|
|
||||||
|
|
||||||
@param('pid', Types.Name)
|
|
||||||
async prepare(domainId: string, pid: string) {
|
|
||||||
const pdoc = await problem.get(domainId, pid);
|
|
||||||
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
|
|
||||||
if (pdoc.hidden) this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
|
||||||
this.pid = pdoc.docId.toString();
|
|
||||||
this.domainId = domainId;
|
|
||||||
this.dispose = bus.on('record/change', this.onRecordChange.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
async onRecordChange(rdoc: RecordDoc) {
|
|
||||||
if (
|
|
||||||
rdoc.uid !== this.user._id
|
|
||||||
|| rdoc.pid.toString() !== this.pid
|
|
||||||
|| rdoc.domainId !== this.domainId
|
|
||||||
) return;
|
|
||||||
// TODO handle update
|
|
||||||
if (rdoc.contest) return;
|
|
||||||
this.send({ rdoc });
|
|
||||||
}
|
|
||||||
|
|
||||||
async cleanup() {
|
|
||||||
if (this.dispose) this.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ProblemManageHandler extends ProblemDetailHandler {
|
export class ProblemManageHandler extends ProblemDetailHandler {
|
||||||
async prepare() {
|
async prepare() {
|
||||||
if (!this.user.own(this.pdoc, PERM.PERM_EDIT_PROBLEM_SELF)) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
if (!this.user.own(this.pdoc, PERM.PERM_EDIT_PROBLEM_SELF)) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||||
@@ -651,7 +620,6 @@ export async function apply() {
|
|||||||
Route('problem_solution_reply_raw', '/p/:pid/solution/:psid/:psrid/raw', ProblemSolutionRawHandler, PERM.PERM_VIEW_PROBLEM);
|
Route('problem_solution_reply_raw', '/p/:pid/solution/:psid/:psrid/raw', ProblemSolutionRawHandler, PERM.PERM_VIEW_PROBLEM);
|
||||||
Route('problem_create', '/problem/create', ProblemCreateHandler, PERM.PERM_CREATE_PROBLEM);
|
Route('problem_create', '/problem/create', ProblemCreateHandler, PERM.PERM_CREATE_PROBLEM);
|
||||||
Route('problem_prefix_list', '/problem/list', ProblemPrefixListHandler, PERM.PERM_VIEW_PROBLEM);
|
Route('problem_prefix_list', '/problem/list', ProblemPrefixListHandler, PERM.PERM_VIEW_PROBLEM);
|
||||||
Connection('problem_pretest_conn', '/conn/pretest', ProblemPretestConnectionHandler, PERM.PERM_SUBMIT_PROBLEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global.Hydro.handler.problem = apply;
|
global.Hydro.handler.problem = apply;
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
import { FilterQuery, ObjectID } from 'mongodb';
|
import { FilterQuery, ObjectID } from 'mongodb';
|
||||||
import { ContestNotFoundError, PermissionError, RecordNotFoundError } from '../error';
|
import {
|
||||||
|
ContestNotFoundError, PermissionError, ProblemNotFoundError,
|
||||||
|
RecordNotFoundError, UserNotFoundError,
|
||||||
|
} from '../error';
|
||||||
import { RecordDoc } from '../interface';
|
import { RecordDoc } from '../interface';
|
||||||
import { PERM, STATUS, PRIV } from '../model/builtin';
|
import { PERM, STATUS, PRIV } from '../model/builtin';
|
||||||
import * as system from '../model/system';
|
import * as system from '../model/system';
|
||||||
@@ -158,14 +161,44 @@ class RecordDetailHandler extends Handler {
|
|||||||
class RecordMainConnectionHandler extends ConnectionHandler {
|
class RecordMainConnectionHandler extends ConnectionHandler {
|
||||||
dispose: bus.Disposable;
|
dispose: bus.Disposable;
|
||||||
tid: string;
|
tid: string;
|
||||||
|
uid: number;
|
||||||
|
pid: number;
|
||||||
|
status: number;
|
||||||
|
pretest: boolean;
|
||||||
|
|
||||||
@param('tid', Types.ObjectID, true)
|
@param('tid', Types.ObjectID, true)
|
||||||
async prepare(domainId: string, tid?: ObjectID) {
|
@param('pid', Types.Name, true)
|
||||||
|
@param('uidOrName', Types.Name, true)
|
||||||
|
@param('status', Types.Int, true)
|
||||||
|
@param('pretest', Types.Boolean)
|
||||||
|
async prepare(domainId: string, tid?: ObjectID, pid?: string, uidOrName?: string, status?: number, pretest = false) {
|
||||||
if (tid) {
|
if (tid) {
|
||||||
const tdoc = await contest.get(domainId, tid, -1);
|
const tdoc = await contest.get(domainId, tid, -1);
|
||||||
if (contest.canShowRecord.call(this, tdoc)) this.tid = tid.toHexString();
|
if (contest.canShowRecord.call(this, tdoc)) this.tid = tid.toHexString();
|
||||||
else throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
else throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||||
}
|
}
|
||||||
|
if (tid) {
|
||||||
|
const tdoc = await contest.get(domainId, tid, -1);
|
||||||
|
if (!tdoc) throw new ContestNotFoundError(domainId, tid);
|
||||||
|
if (!contest.canShowScoreboard.call(this, tdoc, true)) throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||||
|
this.tid = tid.toHexString();
|
||||||
|
}
|
||||||
|
if (uidOrName) {
|
||||||
|
let udoc = await user.getById(domainId, +uidOrName);
|
||||||
|
if (udoc) this.uid = udoc._id;
|
||||||
|
else {
|
||||||
|
udoc = await user.getByUname(domainId, uidOrName);
|
||||||
|
if (udoc) this.uid = udoc._id;
|
||||||
|
else throw new UserNotFoundError(uidOrName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pid) {
|
||||||
|
const pdoc = await problem.get(domainId, pid);
|
||||||
|
if (pdoc) this.pid = pdoc.docId;
|
||||||
|
else throw new ProblemNotFoundError(domainId, pid);
|
||||||
|
}
|
||||||
|
if (status) this.status = status;
|
||||||
|
if (pretest) this.pretest = true;
|
||||||
this.dispose = bus.on('record/change', this.onRecordChange.bind(this));
|
this.dispose = bus.on('record/change', this.onRecordChange.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,9 +215,11 @@ class RecordMainConnectionHandler extends ConnectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onRecordChange(rdoc: RecordDoc) {
|
async onRecordChange(rdoc: RecordDoc) {
|
||||||
if (rdoc.input) return;
|
|
||||||
if (rdoc.contest && rdoc.contest.tid.toString() !== this.tid) return;
|
|
||||||
if (rdoc.domainId !== this.domainId) return;
|
if (rdoc.domainId !== this.domainId) return;
|
||||||
|
if (!this.pretest && rdoc.input) return;
|
||||||
|
if (rdoc.contest && rdoc.contest.tid.toString() !== this.tid) return;
|
||||||
|
if (this.uid && rdoc.uid !== this.uid) return;
|
||||||
|
if (this.pid && rdoc.pid !== this.pid) return;
|
||||||
// eslint-disable-next-line prefer-const
|
// eslint-disable-next-line prefer-const
|
||||||
let [udoc, pdoc] = await Promise.all([
|
let [udoc, pdoc] = await Promise.all([
|
||||||
user.getById(this.domainId, rdoc.uid),
|
user.getById(this.domainId, rdoc.uid),
|
||||||
@@ -194,7 +229,8 @@ class RecordMainConnectionHandler extends ConnectionHandler {
|
|||||||
if (pdoc.hidden && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
if (pdoc.hidden && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
||||||
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null;
|
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null;
|
||||||
}
|
}
|
||||||
this.send({ html: await this.renderHTML('record_main_tr.html', { rdoc, udoc, pdoc }) });
|
if (this.pretest) this.send({ rdoc });
|
||||||
|
else this.send({ html: await this.renderHTML('record_main_tr.html', { rdoc, udoc, pdoc }) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,16 +157,18 @@ export default connect(mapStateToProps, mapDispatchToProps)(class ScratchpadTool
|
|||||||
{' '}
|
{' '}
|
||||||
{i18n('Pretest')}
|
{i18n('Pretest')}
|
||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
<ToolbarButton
|
{UiContext.canViewRecord && (
|
||||||
activated={this.props.recordsVisible}
|
<ToolbarButton
|
||||||
onClick={() => this.props.togglePanel('records')}
|
activated={this.props.recordsVisible}
|
||||||
data-global-hotkey="alt+r"
|
onClick={() => this.props.togglePanel('records')}
|
||||||
data-tooltip={`${i18n('Toggle Records Panel')} (Alt+R)`}
|
data-global-hotkey="alt+r"
|
||||||
>
|
data-tooltip={`${i18n('Toggle Records Panel')} (Alt+R)`}
|
||||||
<Icon name="flag" />
|
>
|
||||||
{' '}
|
<Icon name="flag" />
|
||||||
{i18n('Records')}
|
{' '}
|
||||||
</ToolbarButton>
|
{i18n('Records')}
|
||||||
|
</ToolbarButton>
|
||||||
|
)}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ function buildNestedPane([a, ...panes]) {
|
|||||||
a,
|
a,
|
||||||
...panes.filter((p) => p.props.visible),
|
...panes.filter((p) => p.props.visible),
|
||||||
];
|
];
|
||||||
if (elements.length === 1) {
|
if (elements.length === 1) return a;
|
||||||
return a;
|
|
||||||
}
|
|
||||||
return elements
|
return elements
|
||||||
.reduce((prev, curr) => (
|
.reduce((prev, curr) => (
|
||||||
<SplitPane
|
<SplitPane
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Notification from 'vj/components/notification';
|
import Notification from 'vj/components/notification';
|
||||||
|
import i18n from 'vj/utils/i18n';
|
||||||
|
|
||||||
export default function reducer(state = {
|
export default function reducer(state = {
|
||||||
main: {
|
main: {
|
||||||
@@ -9,94 +10,95 @@ export default function reducer(state = {
|
|||||||
size: 200,
|
size: 200,
|
||||||
},
|
},
|
||||||
records: {
|
records: {
|
||||||
visible: true,
|
visible: UiContext.canViewRecord,
|
||||||
size: 200,
|
size: 200,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
},
|
},
|
||||||
isPosting: false,
|
isPosting: false,
|
||||||
}, action) {
|
}, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'SCRATCHPAD_UI_CHANGE_SIZE': {
|
case 'SCRATCHPAD_UI_CHANGE_SIZE': {
|
||||||
const { uiElement, size } = action.payload;
|
const { uiElement, size } = action.payload;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[uiElement]: {
|
[uiElement]: {
|
||||||
...state[uiElement],
|
...state[uiElement],
|
||||||
size,
|
size,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SCRATCHPAD_UI_SET_VISIBILITY': {
|
case 'SCRATCHPAD_UI_SET_VISIBILITY': {
|
||||||
const { uiElement, visibility } = action.payload;
|
const { uiElement, visibility } = action.payload;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[uiElement]: {
|
[uiElement]: {
|
||||||
...state[uiElement],
|
...state[uiElement],
|
||||||
visible: visibility,
|
visible: visibility,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SCRATCHPAD_UI_TOGGLE_VISIBILITY': {
|
case 'SCRATCHPAD_UI_TOGGLE_VISIBILITY': {
|
||||||
const { uiElement } = action.payload;
|
const { uiElement } = action.payload;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[uiElement]: {
|
[uiElement]: {
|
||||||
...state[uiElement],
|
...state[uiElement],
|
||||||
visible: !state[uiElement].visible,
|
visible: !state[uiElement].visible,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SCRATCHPAD_POST_PRETEST_PENDING':
|
case 'SCRATCHPAD_POST_PRETEST_PENDING':
|
||||||
case 'SCRATCHPAD_POST_SUBMIT_PENDING': {
|
case 'SCRATCHPAD_POST_SUBMIT_PENDING': {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
isPosting: true,
|
isPosting: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'SCRATCHPAD_POST_PRETEST_FULFILLED':
|
case 'SCRATCHPAD_POST_PRETEST_FULFILLED':
|
||||||
case 'SCRATCHPAD_POST_SUBMIT_FULFILLED': {
|
case 'SCRATCHPAD_POST_SUBMIT_FULFILLED': {
|
||||||
return {
|
Notification.success(i18n('Submitted.'));
|
||||||
...state,
|
return {
|
||||||
isPosting: false,
|
...state,
|
||||||
};
|
isPosting: false,
|
||||||
}
|
};
|
||||||
case 'SCRATCHPAD_POST_PRETEST_REJECTED':
|
}
|
||||||
case 'SCRATCHPAD_POST_SUBMIT_REJECTED': {
|
case 'SCRATCHPAD_POST_PRETEST_REJECTED':
|
||||||
Notification.error(action.payload.message);
|
case 'SCRATCHPAD_POST_SUBMIT_REJECTED': {
|
||||||
return {
|
Notification.error(action.payload.message);
|
||||||
...state,
|
return {
|
||||||
isPosting: false,
|
...state,
|
||||||
};
|
isPosting: false,
|
||||||
}
|
};
|
||||||
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_PENDING': {
|
}
|
||||||
return {
|
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_PENDING': {
|
||||||
...state,
|
return {
|
||||||
records: {
|
...state,
|
||||||
...state.records,
|
records: {
|
||||||
isLoading: true,
|
...state.records,
|
||||||
},
|
isLoading: true,
|
||||||
};
|
},
|
||||||
}
|
};
|
||||||
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_REJECTED': {
|
}
|
||||||
Notification.error(action.payload.message);
|
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_REJECTED': {
|
||||||
return {
|
Notification.error(action.payload.message);
|
||||||
...state,
|
return {
|
||||||
records: {
|
...state,
|
||||||
...state.records,
|
records: {
|
||||||
isLoading: false,
|
...state.records,
|
||||||
},
|
isLoading: false,
|
||||||
};
|
},
|
||||||
}
|
};
|
||||||
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_FULFILLED': {
|
}
|
||||||
return {
|
case 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS_FULFILLED': {
|
||||||
...state,
|
return {
|
||||||
records: {
|
...state,
|
||||||
...state.records,
|
records: {
|
||||||
isLoading: false,
|
...state.records,
|
||||||
},
|
isLoading: false,
|
||||||
};
|
},
|
||||||
}
|
};
|
||||||
default:
|
}
|
||||||
return state;
|
default:
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.8.39",
|
"version": "4.8.40",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -7,19 +7,22 @@
|
|||||||
problemNumId: pdoc.docId,
|
problemNumId: pdoc.docId,
|
||||||
postCopyUrl: url('problem_send'),
|
postCopyUrl: url('problem_send'),
|
||||||
postPretestUrl: url('problem_pretest', pid=pdoc.docId),
|
postPretestUrl: url('problem_pretest', pid=pdoc.docId),
|
||||||
pretestConnUrl: "/conn/pretest?pid=" + pdoc.pid|default(pdoc.docId) + "&domainId=" + handler.domainId,
|
|
||||||
codeLang: handler.user.codeLang,
|
codeLang: handler.user.codeLang,
|
||||||
codeTemplate: handler.user.codeTemplate,
|
codeTemplate: handler.user.codeTemplate,
|
||||||
pdoc: pdoc
|
pdoc: pdoc
|
||||||
}) }}
|
}) }}
|
||||||
{% if tdoc %}
|
{% if tdoc %}
|
||||||
|
{{ set(UiContext, 'canViewRecord', model.contest.canShowRecord.call(handler, tdoc)) }}
|
||||||
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.docId, tid=tdoc.docId)) }}
|
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.docId, tid=tdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getSubmissionsUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.docId, tid=tdoc.docId)) }}
|
{{ set(UiContext, 'getSubmissionsUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.docId, tid=tdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
|
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
|
||||||
|
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.pid|default(pdoc.docId) + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{{ set(UiContext, 'canViewRecord', true) }}
|
||||||
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getSubmissionsUrl', url('problem_submit', pid=pdoc.docId)) }}
|
{{ set(UiContext, 'getSubmissionsUrl', url('problem_submit', pid=pdoc.docId)) }}
|
||||||
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}')) }}
|
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}')) }}
|
||||||
|
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.pid|default(pdoc.docId) + "&domainId=" + handler.domainId) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in new issue
Block a user