Source code for uw.local.teaching.webui.integration
"""
"""
from .crowdmark import format_crowdmark_link
from ..db.markbox import format_markbox_link
from ll.xist.ns import html
[docs]def format_integration (exam, url=""):
"""Render an HTML link to Crowdmark or Markbox with explanatory text.
:param exam: a database row representing an examination.
:param url: the URL, relative to the main page for the examination, of the
page which should be the target of the link.
If the examination is not using scanning integration, return None.
Otherwise, return an HTML link to the integrated system, with extra text to
make clear that the examination is using scanning integration; even if the
Crowdmark or Markbox code has not yet been recorded, still include the
explanatory text.
"""
if exam.scanning_integration == 'C':
result = ['Use Crowdmark']
link = format_crowdmark_link (exam, url)
if link is not None:
result.extend ([' (', link, ')'])
if exam.master_accepted is not None:
result.append (html.form (
html.input (type="submit", value="Upload PDF to Crowdmark!"),
method="post", action="crowdmark-upload"
))
return result
elif exam.scanning_integration == 'M':
result = ['Use Markbox']
link = format_markbox_link (exam, url)
if link is not None:
result.extend ([' (', link, ')'])
return result
else:
return None