def get_review(request, args): [hexsha] = args review = db.get("open_reviews", hexsha) patch = html.a("patch", href=html.absolute("patch", hexsha)) buttons = html.div(patch) header = html.div(review_to_html_summary((hexsha, review)), html.hr(), buttons) diff = review_to_diff(review) return html_page( "Review {}".format(hexsha[0:12]), header, *map(diff_to_html, diff), onload="initComments('{}');".format(hexsha) )
def get_commits(request, args): ref_name = "/".join(args) rows = [] for commit in repo.iter_commits(ref_name, max_count=config["displayed_commits"]): check = html.input(type="checkbox", name=commit.hexsha) rows.append(html.tr(html.td(check, " ", *commit_to_html(commit)))) create_review = html.input(value="Create Review", type="submit") reset = html.input(value="Reset", type="reset") body = html.form( create_review, reset, html.hr(), html.table(*rows, **{"class": "list"}), method="post", action=html.absolute("review", "create"), ) return html_page("Commits {}".format(ref_name), html.div(body))
def main_page(state): global page startPage("Highly Experimental RIF Demonstration Page") page << h.h2("Highly Experimental RIF Demonstration Page") page << h.p("This page currently only does translations between RIF XML and RIF PS, but the idea is to have various non-RIF languages supported as well") #for k in state.keys(): # page << h.p(`k`, '=', `state[k]`) form = h.form(method="GET", class_="f") form << h.h3("Step 1: Select Input Processor") select_input_processor(form, state) form << h.h3("Step 2: Provide Input") select_input(form, state) form << h.h3("Step 3: (Optional) Select transform or analysis plugins") select_middle(form, state) analysis_div = h.div() page << analysis_div form << h.h3("Step 4: Select Output Processor") select_output_processor(form, state) form << h.h3("Step 5: Begin Processing") form << h.br() output_div = h.div() output_done = run(output_div, state, analysis_div) page << form page << output_div if output_done: form << h.input(type="submit", name="action", value="Update Output Below") else: form << h.input(type="submit", name="action", value="Generate Output Below") #form << h.Raw(" ") #form << h.Raw(" ") #form << h.Raw(" ") #form << h.Raw(" ") #form << h.Raw(" ") #form << h.input(type="submit", name="action", value="Generate Output on New Page") if 0: page << h.h3('Translates to...') input = input.replace("\r\n", "\n") action=args.getfirst("action") if action: (notes, output) = translate(input, action) else: notes = "select a processing option" output = "" if notes: page << h.h4('Processor Message:') page << h.pre(notes, style="padding:0.5em; border: 2px solid red;") if output: page << h.pre(output, style="padding:0.5em; border: 2px solid black;") else: page << h.p("-- No Output --") page << h.hr() page << h.p("This page/software was developed by [email protected]. It's too buggy right now to use. Please don't even bother to report bugs.") print page