def practice_choose_topic(course_id): """ Present a list of topics for them to choose from the given course """ user_id = session['user_id'] try: course = Courses2.get_course(course_id) except KeyError: course = None abort(404) try: topics = Courses2.get_topics_list(course_id) except KeyError: topics = [] abort(404) members = None for topic in topics: if topic['visibility'] == 2: # course only if not members: members = Courses.get_users(course_id) if not user_id in members: topics.remove(topic) return render_template( "practicecourse.html", courses=Setup.get_sorted_courselist(), canpreview=check_perm(user_id, course_id, "questionpreview"), topics=topics, course=course )
def cadmin_topic_save(course_id, topic_id): """ Receive the page from cadmin_edit_topic and process any changes. """ L.debug("cadmin_topic_save(%s, %s), REQUEST=%s" % (course_id, topic_id, repr(request))) user_id = session['user_id'] if not course_id: abort(404) if "cancel_edit" in request.form: flash("Topic Changes Cancelled!") return redirect(url_for('cadmin_top', course_id=course_id)) if "save_changes" in request.form: (what, result) = Setup.do_topic_page_commands(request, topic_id, user_id) if what == 1: # flash(result['mesg']) return redirect( url_for('cadmin_edit_topic', course_id=course_id, topic_id=topic_id)) if what == 2: return result flash("Error saving Topic Information!") L.error("Error saving Topic Information " % repr(request.form)) return redirect( url_for('cadmin_edit_topic', course_id=course_id, topic_id=topic_id))
def cadmin_topic_save(course_id, topic_id): """ Receive the page from cadmin_edit_topic and process any changes. """ user_id = session['user_id'] if not course_id: abort(404) if "cancel_edit" in request.form: flash("Topic Changes Cancelled!") return redirect(url_for('cadmin_top', course_id=course_id)) if "save_changes" in request.form: (what, result) = Setup.do_topic_page_commands(request, topic_id, user_id) if what == 1: # flash(result['mesg']) return redirect(url_for('cadmin_edit_topic', course_id=course_id, topic_id=topic_id)) if what == 2: return result flash("Error saving Topic Information!") L.error( "Error saving Topic Information " % repr(request.form)) return redirect(url_for('cadmin_edit_topic', course_id=course_id, topic_id=topic_id))
def practice_choose_topic(course_id): """ Present a list of topics for them to choose from the given course """ user_id = session['user_id'] try: course = Courses2.get_course(course_id) except KeyError: course = None abort(404) try: topics = Courses2.get_topics_list(course_id) except KeyError: topics = [] abort(404) members = None for topic in topics: if topic['visibility'] == 2: # course only if not members: members = Courses.get_users(course_id) if user_id not in members: topics.remove(topic) return render_template( "practicecourse.html", courses=Setup.get_sorted_courselist(), canpreview=check_perm(user_id, course_id, "questionpreview"), topics=topics, course=course )
def admin_top(): """ Present the top level admin page """ db_version = DB.get_db_version() return render_template( "admintop.html", courses=Setup.get_sorted_courselist(), db_version=db_version )
def setup_courses(): """ Let the user choose a course to administer """ user_id = session['user_id'] is_sysadmin = check_perm(user_id, -1, 'sysadmin') return render_template( "setupchoosecourse.html", courses=Setup.get_sorted_courselist(only_active=False), is_sysadmin=is_sysadmin)
def setup_courses(): """ Let the user choose a course to administer """ user_id = session['user_id'] is_sysadmin = check_perm(user_id, -1, 'sysadmin') return render_template( "setupchoosecourse.html", courses=Setup.get_sorted_courselist(only_active=False), is_sysadmin=is_sysadmin )
def admin_sysstats(): """ Present the top level admin page """ db_version = DB.get_db_version() db_sizes = DB.get_db_size() return render_template( "admin_sysstats.html", courses=Setup.get_sorted_courselist(), db_version=db_version, db_sizes=db_sizes )
def admin_sysstats(): """ Present the top level admin page """ db_version = DB.get_db_version() db_sizes = DB.get_db_size() db_queue_size = DB.dbpool.total() db_queue_free = len(DB.dbpool) if OaConfig.memcache_enable: mc_queue_size = DB.MC.total() mc_queue_free = len(DB.MC) else: mc_queue_free = 0 mc_queue_size = 0 return render_template( "admin_sysstats.html", courses=Setup.get_sorted_courselist(), db_version=db_version, db_sizes=db_sizes, db_queue_size=db_queue_size, db_queue_free=db_queue_free, mc_enable=OaConfig.memcache_enable, mc_queue_size=mc_queue_size, mc_queue_free=mc_queue_free )
def practice_top(): """ Present the top level practice page - let them choose a course """ return render_template( "practicetop.html", courses=Setup.get_sorted_courselist() )