示例#1
0
def show_tasks(user_id):
    alert = {}
    open = 0

    if request.method == "POST":
        response = react_to_post_request(request, current_user)
        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            open = response["open"]
            # fall trough

    user = User.query.get(int(user_id))
    if not user:
        return redirect(url_for("error404"))

    name = user.name

    articles_writing = user.get_articles_writing().fetchall()
    articles_editing = user.get_articles_editing().fetchall()
    pictures_responsible = user.get_pictures_responsible().fetchall()
    articles_language_checking = user.get_articles_language_checking(
    ).fetchall()

    return render_template(
        "people/tasks.html",
        articles_writing=articles_writing,
        articles_editing=articles_editing,
        pictures_responsible=pictures_responsible,
        articles_language_checking=articles_language_checking,
        posessive_form="" + name + "'s",
        system_name=user.name,
        person_is=name + " is",
        user_id=user.id)
示例#2
0
def mypage():
    alert = {}
    open = 0

    if request.method == "POST":
        response = react_to_post_request(request, current_user)
        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            open = response["open"]
            # fall trough

    return render_template(
        "people/tasks.html",
        person_is="I am",
        posessive_form="My",
        system_name=current_user.name,
        articles_writing=current_user.get_articles_writing().fetchall(),
        articles_editing=current_user.get_articles_editing().fetchall(),
        pictures_responsible=current_user.get_pictures_responsible().fetchall(
        ),
        articles_language_checking=current_user.get_articles_language_checking(
        ).fetchall(),
        open=open,
        alert=alert,
        user_id=current_user.id)
示例#3
0
def language_consultant_page():
    alert = {}

    if request.method == "POST":
        response = react_to_post_request(request, current_user)

        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            # fall trough

    articles = getArticlesWithCondition(
        "(Article.editing_status = 100" + \
        " AND Article.writing_status = 100" + \
        " AND NOT Article.language_checked" + \
        " AND Article.language_consultant IS NULL)")
    articles = articles.fetchall()

    my_articles = None
    if current_user.is_authenticated:
        my_articles = getArticlesWithCondition(
            "(Article.editing_status = 100" + \
            " AND Article.writing_status = 100" + \
            " AND NOT Article.language_checked" + \
            " AND Article.language_consultant = %s)" % current_user.id)
        my_articles = my_articles.fetchall()

    return render_template("auth/language_consultant_page.html",
                           articles=articles,
                           my_articles=my_articles,
                           current_user=current_user,
                           alert=alert)
示例#4
0
def articles_in_issue(issue):
    try:
        issueid = Issue.query.filter_by(name=issue).first().id
    except:
        return redirect(url_for("error404"))

    alert = {}
    open = 0

    if request.method == "POST":
        response = react_to_post_request(request, current_user)

        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            open = response["open"]
            # fall trough

    return render_template(
        "articles/editor_view.html",
        planned_articles=Article.get_all_planned_articles(int(issueid)),
        draft_articles=Article.get_all_draft_articles(int(issueid)),
        written_articles=Article.get_all_written_articles(int(issueid)),
        edited_articles=Article.get_all_edited_articles(int(issueid)),
        finished_articles=Article.get_all_finished_articles(int(issueid)),
        alert=alert,
        open=open,
        topic="Articles " + issue,
        issue=issue)
示例#5
0
def pictures_index():
    alert = {}
    open = 0

    if request.method == "POST":
        response = react_to_post_request(request, current_user)
        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            open = response["open"]
            # fall through

    pictures = getPicturesWithCondition("0=0").fetchall()

    return render_template("pictures/list.html",
                           pictures=pictures,
                           alert=alert,
                           open=open)
示例#6
0
def articles_orphans():
    alert = {}
    open = 0

    if request.method == "POST":
        response = react_to_post_request(request, current_user)

        if response["redirect"]:
            return response["redirect"]
        else:
            alert = response["alert"]
            open = response["open"]
            # fall trough

    return render_template("articles/editor_view.html", 
        planned_articles = Article.get_all_planned_articles(None),
        draft_articles = Article.get_all_draft_articles(None),
        written_articles = Article.get_all_written_articles(None),
        edited_articles = Article.get_all_edited_articles(None),
        finished_articles = Article.get_all_finished_articles(None),
        alert = alert,
        open = open,
        topic = "Orphan articles",
        redirect_to = url_for('articles_orphans'))