def addPassageEditor(request):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:addPassage')
    form_data = {}
    header = "Add a passage"
    initial_text = ""
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def addEntryEditor(request):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Blog:addEntry')
    form_data = {}
    header = "Add a blog post"
    initial_text = ""
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def editEntryEditor(request,blogEntry_pk):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Blog:editEntry',args=[blogEntry_pk])
    form_data = {}
    header = "Edit a blog post"
    initial_text = BlogEntry.objects.get(pk=blogEntry_pk).text
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def addQuestionEditor(request,passage_pk,is_free_response):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:addQuestion')
    form_data = serialize_json({'passage_pk':passage_pk,'is_free_response':is_free_response})
    header = "Add a question"
    initial_text = ""
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def addAnswerEditor(request,question_pk):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:addAnswer')
    form_data = serialize_json({'question_pk':question_pk,})
    header = "Add an answer"
    initial_text = ""
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def editPassageEditor(request,passage_pk):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:editPassage',args=[passage_pk])
    form_data = {}
    header = "Edit a passage"
    # get initial text
    passage = Passage.objects.get(pk=passage_pk)
    initial_text = passage.text
    # return editor
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def editQuestionEditor(request,question_pk):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:editQuestion',args=[question_pk])
    form_data = {}
    header = "Edit a question"
    # get initial text
    question = Question.objects.get(pk=question_pk)
    initial_text = question.text
    # return html
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def editExplanationEditor(request,answer_pk):
    if not request.user.is_superuser:
        return HttpResponse("You are not a superuser")
    submit_url = reverse('Test:editExplanation',args=[answer_pk])
    form_data = {}
    header = "Edit an explanation"
    # get initial text
    answer = Answer.objects.get(pk=answer_pk)
    initial_text = answer.explanation
    # return html
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html
def editCommentEditor(request,comment_pk):
    comment = Comment.objects.get(pk=comment_pk)
    if request.user.pk != comment.user.pk:
        return HttpResponse("You do not have permission to edit this comment")
    submit_url = reverse('Test:editComment',args=[comment_pk])
    form_data = {}
    header = "Edit your comment"
    # get initial text
    initial_text = comment.text
    # return html
    html = editor(request,submit_url,form_data,header,initial_text) # See MCEditor.views
    return html