Documentation ¶
Overview ¶
Package admin defines admin routes.
Index ¶
- func DoRejudge(db db.DBContext, id []int, stage string) error
- type ContestCtx
- type ContestForm
- type ContestWithProblems
- type ContestsCtx
- type Group
- func (g *Group) ContestAddProblem(c echo.Context) error
- func (g *Group) ContestDelete(c echo.Context) error
- func (g *Group) ContestEdit(c echo.Context) error
- func (g *Group) ContestGet(c echo.Context) error
- func (g *Group) ContestRejudgePost(c echo.Context) error
- func (g *Group) ContestSubmissionsGet(c echo.Context) error
- func (g *Group) ContestsGet(c echo.Context) error
- func (g *Group) ContestsPost(c echo.Context) error
- func (g *Group) FileDelete(c echo.Context) error
- func (g *Group) FileGet(c echo.Context) error
- func (g *Group) Home(c echo.Context) error
- func (g *Group) JobsGet(c echo.Context) error
- func (g *Group) LoginGet(c echo.Context) error
- func (g *Group) LoginPost(c echo.Context) error
- func (g *Group) LogoutPost(c echo.Context) error
- func (g *Group) ProblemAddFile(c echo.Context) error
- func (g *Group) ProblemAddTestGroup(c echo.Context) error
- func (g *Group) ProblemDelete(c echo.Context) error
- func (g *Group) ProblemEdit(c echo.Context) error
- func (g *Group) ProblemGet(c echo.Context) error
- func (g *Group) ProblemRejudgePost(c echo.Context) error
- func (g *Group) ProblemSubmissionsGet(c echo.Context) error
- func (g *Group) RejudgePost(c echo.Context) error
- func (g *Group) ScoreboardCSVGet(c echo.Context) error
- func (g *Group) ScoreboardGet(c echo.Context) error
- func (g *Group) ScoreboardJSONGet(c echo.Context) error
- func (g *Group) SubmissionBinaryGet(c echo.Context) error
- func (g *Group) SubmissionGet(c echo.Context) error
- func (g *Group) SubmissionVerdictGet(c echo.Context) error
- func (g *Group) SubmissionsGet(c echo.Context) error
- func (g *Group) TestDelete(c echo.Context) error
- func (g *Group) TestGroupDelete(c echo.Context) error
- func (g *Group) TestGroupEdit(c echo.Context) error
- func (g *Group) TestGroupGet(c echo.Context) error
- func (g *Group) TestGroupRejudgePost(c echo.Context) error
- func (g *Group) TestGroupUploadMultiple(c echo.Context) error
- func (g *Group) TestGroupUploadSingle(c echo.Context) error
- func (g *Group) TestInput(c echo.Context) error
- func (g *Group) TestOutput(c echo.Context) error
- func (g *Group) ToggleEnableRegistration(c echo.Context) error
- func (g *Group) UserDelete(c echo.Context) error
- func (g *Group) UserEdit(c echo.Context) error
- func (g *Group) UserGet(c echo.Context) error
- func (g *Group) UsersAdd(c echo.Context) error
- func (g *Group) UsersGet(c echo.Context) error
- type HomeCtx
- type JobsCtx
- type LoginCtx
- type OptionalInt64
- type ProblemCtx
- type ProblemForm
- type ScoreboardCtx
- type SubmissionCtx
- type SubmissionsCtx
- type TestGroupCtx
- type TestGroupForm
- type Timestamp
- type UserCtx
- type UserForm
- type UsersCtx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContestCtx ¶
type ContestCtx struct { *models.Contest FormError error Form ContestForm Problems []*models.Problem ProblemForm ProblemForm ProblemFormError error }
ContestCtx is the context for rendering admin/contest.
func (*ContestCtx) Render ¶ added in v0.4.1
func (ctx *ContestCtx) Render(c echo.Context) error
type ContestForm ¶
type ContestForm struct { Name string `form:"name"` StartTime Timestamp `form:"start_time"` EndTime Timestamp `form:"end_time"` ContestType models.ContestType `form:"contest_type"` ScoreboardViewStatus models.ScoreboardViewStatus `form:"scoreboard_view_status"` }
ContestForm is a form for uploading a new contest.
func ContestToForm ¶
func ContestToForm(c *models.Contest) *ContestForm
ContestToForm creates a form with the initial values of the contest.
func (*ContestForm) Bind ¶
func (f *ContestForm) Bind(c *models.Contest)
Bind binds the form's content to the contest's.
type ContestWithProblems ¶
ContestWithProblems is a contest with embedded problems.
type ContestsCtx ¶
type ContestsCtx struct { Contests []*models.Contest FormError error Form ContestForm }
ContestsCtx is a context for rendering contests.
type Group ¶
type Group struct { *echo.Group // contains filtered or unexported fields }
Group represents a router Group with handling functions.
func (*Group) ContestAddProblem ¶
ContestAddProblem implements POST /admin/contest/:id/add_problem
func (*Group) ContestDelete ¶
ContestDelete implement POST /admin/contest/:id/delete
func (*Group) ContestEdit ¶
ContestEdit implements POST /admin/contest/:id
func (*Group) ContestGet ¶
ContestGet implements GET /admin/contest/:id
func (*Group) ContestRejudgePost ¶ added in v0.4.1
ContestRejudgePost implements POST /admin/contests/:id/rejudge
func (*Group) ContestSubmissionsGet ¶
ContestSubmissionsGet implements GET /admin/contests/:id/submissions.
func (*Group) ContestsGet ¶
ContestsGet handles GET /admin/contests
func (*Group) ContestsPost ¶
ContestsPost handles POST /admin/contests.
func (*Group) FileDelete ¶
FileDelete implements POST /admin/files/:id/delete
func (*Group) FileGet ¶
FileGet implements GET /admin/files/:id
func (*Group) JobsGet ¶ added in v0.2.0
JobsGet implements GET "/admin/jobs".
func (*Group) LoginGet ¶
LoginGet implements GET /admin/login.
func (*Group) LoginPost ¶
LoginPost implements POST /admin/login.
func (*Group) LogoutPost ¶
LogoutPost implements GET/POST /admin/logout.
func (*Group) ProblemAddFile ¶
ProblemAddFile implements POST /admin/problems/:id/add_file
func (*Group) ProblemAddTestGroup ¶
ProblemAddTestGroup implements /admin/problems/:id/add_test_group
func (*Group) ProblemDelete ¶
ProblemDelete implements POST /admin/problems/:id/delete
func (*Group) ProblemEdit ¶
ProblemEdit implements POST /admin/problems/:id
func (*Group) ProblemGet ¶
ProblemGet implements GET /admin/problems/:id
func (*Group) ProblemRejudgePost ¶ added in v0.4.1
ProblemRejudgePost implements POST /admin/problems/:id/rejudge
func (*Group) ProblemSubmissionsGet ¶
ProblemSubmissionsGet implements GET /admin/problems/:id/submissions.
func (*Group) RejudgePost ¶
RejudgePost implements POST /admin/rejudge.
func (*Group) ScoreboardCSVGet ¶ added in v0.4.1
ScoreboardCSVGet implements GET /admin/contests/:id/scoreboard/csv
func (*Group) ScoreboardGet ¶ added in v0.4.1
ScoreboardGet implements GET /admin/contests/:id/scoreboard
func (*Group) ScoreboardJSONGet ¶ added in v0.4.1
ScoreboardJSONGet implements GET /admin/contests/:id/scoreboard/json
func (*Group) SubmissionBinaryGet ¶
SubmissionBinaryGet implements GET /admin/submissions/:id/binary
func (*Group) SubmissionGet ¶
SubmissionGet implement GET /admin/submissions/:id
func (*Group) SubmissionVerdictGet ¶
SubmissionVerdictGet implements GET /admin/submissions/:id/verdict
func (*Group) SubmissionsGet ¶
SubmissionsGet implements GET /admin/submissions
func (*Group) TestDelete ¶
TestDelete implements GET /admin/tests/:id/delete
func (*Group) TestGroupDelete ¶
TestGroupDelete implements POST /admin/test_groups/:id/delete
func (*Group) TestGroupEdit ¶
TestGroupEdit implements POST /admin/test_groups/:id
func (*Group) TestGroupGet ¶ added in v0.4.1
TestGroupGet implements GET /admin/test_groups/:id
func (*Group) TestGroupRejudgePost ¶ added in v0.4.1
TestGroupRejudgePost implements POST /admin/test_groups/:id/rejudge
func (*Group) TestGroupUploadMultiple ¶
TestGroupUploadMultiple implements POST /admin/test_groups/:id/upload_multiple
func (*Group) TestGroupUploadSingle ¶
TestGroupUploadSingle implements POST /admin/test_groups/:id/upload_single.
func (*Group) TestInput ¶
TestInput implements GET /admin/tests/:id/input
func (*Group) TestOutput ¶
TestOutput implements GET /admin/tests/:id/output
func (*Group) ToggleEnableRegistration ¶
ToggleEnableRegistration implements POST /admin/config/toggle_enable_registration
func (*Group) UserDelete ¶
UserDelete implement POST /admin/users/:id/delete
func (*Group) UserEdit ¶
UserEdit implements POST /admin/user/:id
func (*Group) UserGet ¶
UserGet implements GET /admin/user/:id
type HomeCtx ¶
type HomeCtx struct { Contests []*models.Contest Queue *models.QueueOverview }
HomeCtx is a context for rendering Home page.
type JobsCtx ¶ added in v0.2.0
type JobsCtx struct { Jobs []*models.Job Tests map[int]*models.Test TestGroups map[int]*models.TestGroup Problems map[int]*models.Problem }
JobsCtx is a context for rendering jobs.
type LoginCtx ¶
type LoginCtx struct {
Error error
}
LoginCtx is the context for rendering the login page.
type OptionalInt64 ¶
OptionalInt64 implements a NullInt64 with binding capabilities.
func (OptionalInt64) String ¶
func (o OptionalInt64) String() string
func (*OptionalInt64) UnmarshalParam ¶
func (o *OptionalInt64) UnmarshalParam(src string) error
UnmarshalParam implement echo's Bind.
type ProblemCtx ¶
type ProblemCtx struct { *models.Problem Contest *models.Contest TestGroups []*models.TestGroupWithTests Files []*models.File // Edit Problem Form EditForm ProblemForm EditFormError error // New TestGroup form TestGroupForm TestGroupForm TestGroupFormError error }
ProblemCtx is the context for rendering admin/problem.
type ProblemForm ¶
type ProblemForm struct { DisplayName string `form:"display_name"` MemoryLimit int `form:"memory_limit"` Name string `form:"name"` PenaltyPolicy models.PenaltyPolicy `form:"penalty_policy"` ScoringMode models.ScoringMode `form:"scoring_mode"` TimeLimit int `form:"time_limit"` }
ProblemForm is a form for creating/updating a problem.
func ProblemToForm ¶
func ProblemToForm(p *models.Problem) ProblemForm
ProblemForm produces an edit form from the problem.
func (*ProblemForm) Bind ¶
func (f *ProblemForm) Bind(p *models.Problem)
Bind binds the form's content into the Problem.
type ScoreboardCtx ¶ added in v0.4.1
type ScoreboardCtx struct {
*models.Scoreboard
}
ScoreboardCtx is the context required to display the scoreboard page
func (*ScoreboardCtx) JSONLink ¶ added in v0.4.1
func (s *ScoreboardCtx) JSONLink() string
JSONLink returns the link to the JSON scoreboard.
func (*ScoreboardCtx) Render ¶ added in v0.4.1
func (s *ScoreboardCtx) Render(c echo.Context, wide bool) error
Render renders the scoreboard context
func (*ScoreboardCtx) RenderJSON ¶ added in v0.4.1
func (s *ScoreboardCtx) RenderJSON(c echo.Context) error
RenderJSON renders a scoreboard in JSON.
func (*ScoreboardCtx) Show ¶ added in v0.4.1
func (s *ScoreboardCtx) Show() error
Show decides whether the scoreboard can be shown. For compability with contests.ScoreboardCtx
type SubmissionCtx ¶
type SubmissionCtx struct { Submission *models.Submission Problem *models.Problem Contest *models.Contest TestGroups []*models.TestGroupWithTests TestResults map[int]*models.TestResult }
SubmissionCtx is the context for rendering the submission interface.
func (*SubmissionCtx) Render ¶
func (s *SubmissionCtx) Render(c echo.Context) error
Render renders the context.
type SubmissionsCtx ¶
type SubmissionsCtx struct { User *models.User // or Users map[string]*models.User Problem *models.Problem // or ProblemsMap map[int]*models.Problem // AND one of Contest *ContestWithProblems Contests []*ContestWithProblems Submissions []*models.Submission }
SubmissionsCtx is a context for *listing submissions*.
func SubmissionsAll ¶
func SubmissionsAll(db db.DBContext) (*SubmissionsCtx, error)
SubmissionsAll returns a context of all submissions.
func SubmissionsBy ¶
func SubmissionsBy(db db.DBContext, u *models.User, c *models.Contest, p *models.Problem) (*SubmissionsCtx, error)
SubmissionsBy applies a filter to the submission list: - either with an user (if u != nil) - or with a contest... (if c != nil) - or with a single problem (if p != nil, overrides contest).
type TestGroupCtx ¶ added in v0.4.1
type TestGroupCtx struct { *models.TestGroupWithTests Contest *models.Contest Problem *models.Problem }
TestGroupCtx is the context for rendering test-group.
func (*TestGroupCtx) Render ¶ added in v0.4.1
func (ctx *TestGroupCtx) Render(c echo.Context) error
Render renders the context.
func (*TestGroupCtx) ToForm ¶ added in v0.4.1
func (ctx *TestGroupCtx) ToForm() TestGroupForm
ToForm converts the context into a nicer form format.
type TestGroupForm ¶
type TestGroupForm struct { MemoryLimit OptionalInt64 `form:"memory_limit"` Name string `form:"name"` Score float64 `form:"score"` ScoringMode models.TestScoringMode `form:"scoring_mode"` TimeLimit OptionalInt64 `form:"time_limit"` }
func (*TestGroupForm) Bind ¶
func (f *TestGroupForm) Bind(t *models.TestGroup)
Bind binds the form's values to the TestGroup.
type Timestamp ¶
Timestamp is a wrapped time.Time for form-parsing.
func (Timestamp) String ¶
String formats the timestamp as RFC3339.
type UserCtx ¶
type UserCtx struct { *models.User Submissions *SubmissionsCtx EditForm *UserForm EditFormError error }
UserCtx is a context for rendering an user.