def combined_notifications(request, course_id): """ Gets combined notifications from the grading controller and displays them """ course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id) course = get_course_with_access(request.user, 'load', course_key) user = request.user notifications = open_ended_notifications.combined_notifications(course, user) response = notifications['response'] notification_tuples = open_ended_notifications.NOTIFICATION_TYPES notification_list = [] for response_num in xrange(len(notification_tuples)): tag = notification_tuples[response_num][0] if tag in response: url_name = notification_tuples[response_num][1] human_name = notification_tuples[response_num][2] url = _reverse_without_slash(url_name, course_key) has_img = response[tag] # check to make sure we have descriptions and alert messages if human_name in DESCRIPTION_DICT: description = DESCRIPTION_DICT[human_name] else: description = "" if human_name in ALERT_DICT: alert_message = ALERT_DICT[human_name] else: alert_message = "" notification_item = { 'url': url, 'name': human_name, 'alert': has_img, 'description': description, 'alert_message': alert_message } #The open ended panel will need to link the "peer grading" button in the panel to a peer grading #xmodule defined in the course. This checks to see if the human name of the server notification #that we are currently processing is "peer grading". If it is, it looks for a peer grading #module in the course. If none exists, it removes the peer grading item from the panel. if human_name == "Peer Grading": found_module, problem_url = find_peer_grading_module(course) if found_module: notification_list.append(notification_item) else: notification_list.append(notification_item) ajax_url = _reverse_with_slash('open_ended_notifications', course_key) combined_dict = { 'error_text': "", 'notification_list': notification_list, 'course': course, 'success': True, 'ajax_url': ajax_url, } return render_to_response('open_ended_problems/combined_notifications.html', combined_dict)
def _combined_open_ended_grading(tab, user, course, active_page): if user.is_authenticated(): link = reverse('open_ended_notifications', args=[course.id]) tab_name = "Open Ended Panel" notifications = open_ended_notifications.combined_notifications(course, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "open_ended", pending_grading, img_path)] return tab return []
def _combined_open_ended_grading(tab, user, course, active_page): if user.is_authenticated(): link = reverse('open_ended_notifications', args=[course.id]) tab_name = "Open Ended Panel" notifications = open_ended_notifications.combined_notifications(course, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "open_ended", pending_grading, img_path)] return tab return []
def _combined_open_ended_grading(tab, user, course, active_page, request): if user.is_authenticated(): link = reverse('open_ended_notifications', args=[course.id]) # Translators: "Open Ended Panel" appears on a tab that, when clicked, # opens up a panel that displays information about openended problems # that a user has submitted or needs to grade tab_name = _("Open Ended Panel") notifications = open_ended_notifications.combined_notifications(course, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] tab = [CourseTab(tab_name, link, active_page == "open_ended", pending_grading, img_path)] return tab return []
def _combined_open_ended_grading(tab, user, course, active_page, request): if user.is_authenticated(): link = reverse('open_ended_notifications', args=[course.id]) # Translators: "Open Ended Panel" appears on a tab that, when clicked, # opens up a panel that displays information about openended problems # that a user has submitted or needs to grade tab_name = _("Open Ended Panel") notifications = open_ended_notifications.combined_notifications( course, user) pending_grading = notifications['pending_grading'] img_path = notifications['img_path'] tab = [ CourseTab(tab_name, link, active_page == "open_ended", pending_grading, img_path) ] return tab return []
def combined_notifications(request, course_id): """ Gets combined notifications from the grading controller and displays them """ course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id) course = get_course_with_access(request.user, 'load', course_key) user = request.user notifications = open_ended_notifications.combined_notifications( course, user) response = notifications['response'] notification_tuples = open_ended_notifications.NOTIFICATION_TYPES notification_list = [] for response_num in xrange(len(notification_tuples)): tag = notification_tuples[response_num][0] if tag in response: url_name = notification_tuples[response_num][1] human_name = notification_tuples[response_num][2] url = _reverse_without_slash(url_name, course_key) has_img = response[tag] # check to make sure we have descriptions and alert messages if human_name in DESCRIPTION_DICT: description = DESCRIPTION_DICT[human_name] else: description = "" if human_name in ALERT_DICT: alert_message = ALERT_DICT[human_name] else: alert_message = "" notification_item = { 'url': url, 'name': human_name, 'alert': has_img, 'description': description, 'alert_message': alert_message } #The open ended panel will need to link the "peer grading" button in the panel to a peer grading #xmodule defined in the course. This checks to see if the human name of the server notification #that we are currently processing is "peer grading". If it is, it looks for a peer grading #module in the course. If none exists, it removes the peer grading item from the panel. if human_name == "Peer Grading": found_module, problem_url = find_peer_grading_module(course) if found_module: notification_list.append(notification_item) else: notification_list.append(notification_item) ajax_url = _reverse_with_slash('open_ended_notifications', course_key) combined_dict = { 'error_text': "", 'notification_list': notification_list, 'course': course, 'success': True, 'ajax_url': ajax_url, } return render_to_response( 'open_ended_problems/combined_notifications.html', combined_dict)