Пример #1
0
def privacy(request):
    return HttpResponse(Page(
        h2("Privacy Policy", cls="page-title"),
        Card("TL;DR", "OpenContest as an organization is too lazy to steal your data (we're busy enough keeping track of our own). " +
             "However, the organizers of your contest may collect any data you submit, " +
             "including your name (which the organizers provide) and any code submissions, which they may use for any purpose."),
        Card("Data collected",
             div(
                h.span("OpenContest collects the following data:"),
                h.ul(
                    h.li("Your name as provided by the contest organizers"),
                    h.li("Your password as generated by the app"),
                    h.li("Any problem statements written by the contest organizers"),
                    h.li("Any contest details created by the contest organizers"),
                    h.li("Any code submissions by contest participants")
                )
             )
        ),
        Card("Data usage",
             div(
                h.span("Any data collected by OpenContest may be accessible to"),
                h.ul(
                    h.li("The contest organizers"),
                    h.li("Anyone with access to the server that OpenContest is running on"),
                    h.li("Anyone in the world, though we have tried to eliminate this possibility")
                ),
                h.span("Any data collected in OpenContest is stored in plain text on the server that OpenContest is running on. " +
                       "No data is not sent to the developers of OpenContest.")
             )
        )
    ))
Пример #2
0
 def __init__(self, contest: Contest):
     self.html = Card(contest.name,
                      div(
                          h.span(contest.start,
                                 cls='time-format',
                                 data_timestamp=contest.start), " - ",
                          h.span(contest.end,
                                 cls='time-format',
                                 data_timestamp=contest.end)),
                      link=f"/contests/{contest.id}",
                      delete=f"deleteContest('{contest.id}')",
                      cls=contest.id)
Пример #3
0
 def __init__(self, submission: Submission):
     subTime = submission.timestamp
     probName = submission.problem.title
     cls = "gray" if submission.status == Submission.STATUS_REVIEW else "red" if submission.result != "ok" else ""
     self.html = div(
         cls="modal-content",
         contents=[
             div(cls=f"modal-header {cls}",
                 contents=[
                     h.h5(f"Submission to {probName} at ",
                          h.span(subTime, cls="time-format")), """
             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                 <span aria-hidden="true">&times;</span>
             </button>"""
                 ]),
             div(cls="modal-body",
                 contents=[
                     h.strong(
                         "Language: <span class='language-format'>{}</span>"
                         .format(submission.language)),
                     h.br(),
                     h.strong("Result: "),
                     verdict_name[submission.getContestantResult()],
                     h.br(),
                     h.br(),
                     h.strong("Code:"),
                     h.code(code_encode(submission.code), cls="code"),
                 ])
         ])
Пример #4
0
 def __init__(self, sub):
     result = sub.getContestantResult()
     self.html = h.tr(h.td(sub.problem.title),
                      h.td(cls='time-format', contents=sub.timestamp),
                      h.td(sub.language),
                      h.td(h.i("&nbsp;", cls=f"fa fa-{icons[result]}"),
                           h.span(verdict_name[result])),
                      onclick=f"submissionPopupContestant('{sub.id}')")
Пример #5
0
 def __init__(self):
     self.html = div(
         cls="footer",
         contents=[
             h2('Copyright &copy; {} by <a href="https://nathantheinventor.com" target="_blank">Nathan Collins</a> and BJU'
                .format(datetime.now().year)),
             div(cls="footer-links",
                 contents=[
                     h.span(h.a("System Status", href="/status")),
                     h.span(
                         h.a("Privacy Policy",
                             href="/privacy",
                             target="_blank")),
                     h.span(h.a("About", href="/about", target="_blank")),
                     h.span(h.a("FAQs", href="/faqs", target="_blank"))
                 ])
         ])
Пример #6
0
 def __init__(self, title, endtimestamp=None):
     timeRemaining = ""
     if endtimestamp:
         timeRemaining = str(int(((endtimestamp / 1000) - time.time())))
     self.html = div(
         cls="top",
         contents=[
             div(cls="header",
                 contents=[
                     h1(title),
                     div(cls="spacer"),
                     div(cls="header-right",
                         contents=[
                             h.span(cls="time-remaining",
                                    data_timeremaining=timeRemaining),
                             h.br(),
                             h.span(cls="login-user")
                         ])
                 ])
         ])
Пример #7
0
 def __init__(self, sub):
     checkoutUser = User.get(sub.checkout)
     self.html = h.tr(
         h.td(sub.user.username),
         h.td(sub.problem.title),
         h.td(sub.id),  # cls='time-format', contents=sub.timestamp
         h.td(sub.language),
         h.td(h.i("&nbsp;", cls=f"fa fa-{icons.get(sub.result)}"),
              h.span(verdict_name.get(sub.result))),
         h.td(contents=[
             sub.status,
             h.p(sub.version, id=f"{sub.id}-version", hidden=True)
         ]),
         h.td(
             checkoutUser.username if checkoutUser is not None else "None"),
         id=sub.id,
         cls="submit-row",
     )
Пример #8
0
 def __init__(self, title, body, footer, modalID=""):
     '''
     modalID - used to uniquely identify different modals. Only necessary when
               two or more modals are present on page
     '''
     # taken from https://getbootstrap.com/docs/4.1/components/modal/
     self.html = div(
         cls=f"modal {modalID}",
         role="dialog",
         contents=[
             div(cls="modal-dialog",
                 role="document",
                 contents=[
                     div(cls="modal-content",
                         contents=[
                             div(cls="modal-header",
                                 contents=[
                                     h.h5(title, cls="modal-title"),
                                     h.button(**{
                                         "type": "button",
                                         "class": "close",
                                         "data-dismiss": "modal",
                                         "arial-label": "close"
                                     },
                                              contents=[
                                                  h.span(
                                                      "&times;", **{
                                                          "aria-hidden":
                                                          "true"
                                                      })
                                              ])
                                 ]),
                             div(body, cls="modal-body"),
                             div(footer, cls="modal-footer")
                         ])
                 ])
         ])
Пример #9
0
 def __init__(self, submission: Submission, user, force):
     subTime = submission.timestamp
     probName = submission.problem.title
     cls = "red" if submission.result != "ok" else ""
     self.html = div(
         cls="modal-content",
         contents=[
             div(cls=f"modal-header {cls}",
                 contents=[
                     h.h5(
                         f"{probName} from {submission.user.username} at ",
                         h.span(subTime, cls="time-format"),
                         f" (id {submission.id})",
                     ), """
             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                 <span aria-hidden="true">&times;</span>
             </button>"""
                 ]),
             div(cls="modal-body",
                 contents=[
                     h.input(type="hidden",
                             id="version",
                             value=f"{submission.version}"),
                     h.strong(
                         "Result: ",
                         h.select(
                             cls=f"result-choice {submission.id}",
                             contents=[*resultOptions(submission.result)])),
                     h.strong(
                         "&emsp;Status: ",
                         h.select(
                             cls=f"status-choice {submission.id}",
                             contents=[*statusOptions(submission.status)])),
                     h.span("&emsp;"),
                     h.button(
                         "Save",
                         type="button",
                         onclick=
                         f"changeSubmissionResult('{submission.id}', '{submission.version}')",
                         cls="btn btn-primary"),
                     h.span(" "),
                     h.button("Retest",
                              type="button",
                              onclick=f"rejudge('{submission.id}')",
                              cls="btn btn-primary rejudge"),
                     h.span(" "),
                     h.button("Download",
                              type="button",
                              onclick=f"download('{submission.id}')",
                              cls="btn btn-primary rejudge"),
                     h.br(),
                     h.br(),
                     h.strong(
                         f"Language: <span class='language-format'>{submission.language}</span>"
                     ),
                     h.code(code_encode(submission.code), cls="code"),
                     div(cls="result-tabs",
                         id="result-tabs",
                         contents=[
                             h.ul(*map(lambda x: TestCaseTab(x, submission),
                                       enumerate(submission.results))),
                             *map(
                                 lambda x: TestCaseData(x, submission),
                                 zip(
                                     range(submission.problem.tests),
                                     submission.readFilesForDisplay('in'),
                                     submission.readFilesForDisplay('out'),
                                     submission.readFilesForDisplay(
                                         'error'),
                                     submission.readFilesForDisplay(
                                         'answer')))
                         ])
                 ])
         ])