Documentation ¶
Overview ¶
Package admin defines admin routes.
Index ¶
- func DoRejudge(db db.DBContext, id []int, stage string) error
- func NewVersionMessageGet() (string, error)
- type AnnouncementForm
- type AnnouncementsCtx
- type BatchUsersGenerateForm
- type ClarificationReplyForm
- type ClarificationsCtx
- type ContestCtx
- type ContestForm
- type ContestWithProblems
- type ContestsCtx
- type Group
- func (g *Group) AnnouncementAddPost(c echo.Context) error
- func (g *Group) AnnouncementsGet(c echo.Context) error
- func (g *Group) BatchUsersEmptyGet(c echo.Context) error
- func (g *Group) BatchUsersGenerateGet(c echo.Context) error
- func (g *Group) BatchUsersPost(c echo.Context) error
- func (g *Group) ClarificationReplyPost(c echo.Context) error
- func (g *Group) ClarificationsGet(c echo.Context) error
- func (g *Group) ConfigTogglePost(c echo.Context) error
- 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) FileCompile(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) 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 ¶
func NewVersionMessageGet ¶
NewVersionMessageGet checks if there is a new version of kjudge
Types ¶
type AnnouncementForm ¶ added in v0.6.0
AnnouncementForm is the form for creating a new announcement.
func (*AnnouncementForm) Bind ¶ added in v0.6.0
func (f *AnnouncementForm) Bind(a *models.Announcement)
Bind binds the form into a model.
type AnnouncementsCtx ¶ added in v0.6.0
type AnnouncementsCtx struct { Contest *models.Contest Problems map[int]*models.Problem Announcements []*models.Announcement Error error Form AnnouncementForm }
AnnouncementsCtx is the context for rendering admin/contest_announcements
func (*AnnouncementsCtx) Render ¶ added in v0.6.0
func (a *AnnouncementsCtx) Render(c echo.Context) error
Render renders the context.
type BatchUsersGenerateForm ¶
type BatchUsersGenerateForm struct { Prefix string `form:"prefix"` Count int `form:"count"` Offset int `form:"offset"` }
BatchUsersGenerateForm is the form for generating a CSV users file.
func (*BatchUsersGenerateForm) Verify ¶
func (f *BatchUsersGenerateForm) Verify() error
Verify verifies the content of the form.
type ClarificationReplyForm ¶ added in v0.6.0
type ClarificationReplyForm struct {
Response string
}
ClarificationReplyForm is a form for replying a clarification.
type ClarificationsCtx ¶ added in v0.6.0
type ClarificationsCtx struct { Clarifications []*models.Clarification Problems map[int]*models.Problem Contests map[int]*models.Contest }
ClarificationsCtx is the context for rendering clarifications.
func (*ClarificationsCtx) Render ¶ added in v0.6.0
func (ctx *ClarificationsCtx) Render(c echo.Context) error
Render renders the context.
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 ¶
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) AnnouncementAddPost ¶ added in v0.6.0
AnnouncementAddPost implements POST /admin/contests/:id/announcements
func (*Group) AnnouncementsGet ¶ added in v0.6.0
AnnouncementsGet implements GET /admin/contests/:id/announcements
func (*Group) BatchUsersEmptyGet ¶
BatchUsersEmptyGet implements GET /admin/batch_users/empty.
func (*Group) BatchUsersGenerateGet ¶
BatchUsersGenerateGet implements GET /admin/batch_users/generate
func (*Group) BatchUsersPost ¶
BatchUsersPost implements POST /admin/batch_users.
func (*Group) ClarificationReplyPost ¶ added in v0.6.0
ClarificationReplyPost implements POST /admin/clarifications/:id
func (*Group) ClarificationsGet ¶ added in v0.6.0
ClarificationsGet implements GET /admin/clarifications
func (*Group) ConfigTogglePost ¶
ConfigTogglePost implements POST /admin/config/toggle
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 ¶
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) FileCompile ¶ added in v0.6.0
FileCompile implements POST /admin/files/:id/compile
func (*Group) FileDelete ¶
FileDelete implements POST /admin/files/:id/delete
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 ¶
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 ¶
ScoreboardCSVGet implements GET /admin/contests/:id/scoreboard/csv
func (*Group) ScoreboardGet ¶
ScoreboardGet implements GET /admin/contests/:id/scoreboard
func (*Group) ScoreboardJSONGet ¶
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 ¶
TestGroupGet implements GET /admin/test_groups/:id
func (*Group) TestGroupRejudgePost ¶
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) TestOutput ¶
TestOutput implements GET /admin/tests/:id/output
func (*Group) UserDelete ¶
UserDelete implement POST /admin/users/:id/delete
type HomeCtx ¶
type HomeCtx struct { Contests []*models.Contest Queue *models.QueueOverview NewVersionMessage string }
HomeCtx is a context for rendering Home page.
type JobsCtx ¶
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"` MaxSubmissionsCount int `form:"max_submissions_count"` SecondsBetweenSubmissions int `form:"seconds_between_submissions"` }
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 ¶
type ScoreboardCtx struct {
*models.Scoreboard
}
ScoreboardCtx is the context required to display the scoreboard page
func (*ScoreboardCtx) JSONLink ¶
func (s *ScoreboardCtx) JSONLink() string
JSONLink returns the link to the JSON scoreboard.
func (*ScoreboardCtx) Render ¶
func (s *ScoreboardCtx) Render(c echo.Context, wide bool) error
Render renders the scoreboard context
func (*ScoreboardCtx) RenderJSON ¶
func (s *ScoreboardCtx) RenderJSON(c echo.Context) error
RenderJSON renders a scoreboard in JSON.
func (*ScoreboardCtx) Show ¶
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 ¶
type TestGroupCtx struct { *models.TestGroupWithTests Contest *models.Contest Problem *models.Problem }
TestGroupCtx is the context for rendering test-group.
func (*TestGroupCtx) Render ¶
func (ctx *TestGroupCtx) Render(c echo.Context) error
Render renders the context.
func (*TestGroupCtx) ToForm ¶
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) UnmarshalParam ¶
UnmarshalParam implement echo's Bind.
type UserCtx ¶
type UserCtx struct { *models.User Submissions *SubmissionsCtx EditForm *UserForm EditFormError error }
UserCtx is a context for rendering an user.