Example #1
0
def indexing():
    (domain, method, is_admin) = get_login_session()
    result, next_reindex, exclude_paths, exclude_types = get_manage_data(domain)
    if request.method == 'GET':
        return render_template('admin/manage-indexing.html', result=result, next_reindex=next_reindex, exclude_paths=exclude_paths, exclude_types=exclude_types, add_path=False, add_type=False)
    else: # i.e. if POST
        add = request.form.get("add")
        if add == "exclude_path":
            return render_template('admin/manage-indexing.html', result=result, next_reindex=next_reindex, exclude_paths=exclude_paths, exclude_types=exclude_types, add_path=True, add_type=False)
        elif add == "exclude_type":
            return render_template('admin/manage-indexing.html', result=result, next_reindex=next_reindex, exclude_paths=exclude_paths, exclude_types=exclude_types, add_path=False, add_type=True)
        else:
            save_exclude_path = request.form.get("save_exclude_path")
            save_exclude_type = request.form.get("save_exclude_type")
            if save_exclude_path:
                conn = get_db()
                cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
                cursor.execute(addexcludesql, (domain, "path", save_exclude_path, ))
                conn.commit()
            if save_exclude_type:
                conn = get_db()
                cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
                cursor.execute(addexcludesql, (domain, "type", save_exclude_type, ))
                conn.commit()
            return redirect(url_for('manage.indexing'))
Example #2
0
def reindex():
    (domain, method, is_admin) = get_login_session()
    conn = get_db()
    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
    cursor.execute(reindexsql, (domain, domain, ))
    conn.commit()
    message = 'The site has been queued for reindexing. You can check on progress by refreshing this page.'
    flash(message)
    return redirect(url_for('manage.indexing'))
Example #3
0
def delete():
    if request.method == 'GET':
        return render_template('admin/delete.html')
    else: # i.e. if POST 
        (domain, method, is_admin) = get_login_session()
        delete_domain(domain)
        # Construct message
        message = "<p>Your site has been successfully deleted.</p>"
        message += "<p>You can confirm there are no documents left in the search collection via " 
        message += '<a href="/search/?q=domain:{}">a search for domain:{}</a>.</p>'.format(domain, domain)
        message += '<p>Sorry to see you go. But you can always come back via <a href="{}">Add Site</a>.</p>'.format(url_for('add.add'))
        return render_template('admin/success.html', title="Delete My Site Success", message=message)
Example #4
0
def sitedetails_edit():
    (domain, method, is_admin) = get_login_session()
    result, next_reindex, exclude_paths, exclude_types = get_manage_data(domain)
    if request.method == 'GET':
        return render_template('admin/manage-sitedetails.html', result=result, edit=True)
    else: # i.e. if POST
        new_email = request.form.get("email")
        if new_email:
            conn = get_db()
            cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
            cursor.execute(updateemailsql, (new_email, domain,))
            conn.commit()
        return redirect(url_for('manage.sitedetails'))
Example #5
0
def indexing_delete():
    (domain, method, is_admin) = get_login_session()
    delete_exclude_path = request.form.get("delete_exclude_path")
    delete_exclude_type = request.form.get("delete_exclude_type")
    if delete_exclude_path:
        conn = get_db()
        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
        cursor.execute(deleteexcludesql, (domain, "path", delete_exclude_path, ))
        conn.commit()
    if delete_exclude_type:
        conn = get_db()
        cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
        cursor.execute(deleteexcludesql, (domain, "type", delete_exclude_type, ))
        conn.commit()
    return redirect(url_for('manage.indexing'))
Example #6
0
def sitedetails():
    (domain, method, is_admin) = get_login_session()
    result, next_reindex, exclude_paths, exclude_types = get_manage_data(domain)
    return render_template('admin/manage-sitedetails.html', result=result, edit=False)