LMS: Fixed views for article and video
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index 19e495f..9e87427 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -1,23 +1,31 @@
from __future__ import unicode_literals
import erpnext.education.utils as utils
+from urlparse import urlparse, parse_qs
import frappe
def get_context(context):
if frappe.form_dict['course']:
- context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
- context.course_name = frappe.form_dict["course"]
- context.current_course = utils.get_contents_in_course(context.course_name)
- context.current_program = frappe.form_dict["program"]
- context.next_content = get_next_content(context)
- if context.current_content.content_type == "Quiz":
- context.questions = utils.get_quiz_as_dict(context.current_content.name)
+ # Save form_dict variables
+ program_name = frappe.form_dict["program"]
+ course_name = frappe.form_dict["course"]
+ content_name = frappe.form_dict["content"]
+ content_type = frappe.form_dict["type"]
+ # Get the required doctypes
+ current_course = frappe.get_doc("Course", course_name)
+ current_content = frappe.get_doc(content_type, content_name)
-def get_next_content(context):
- if context.current_course:
- course_data = [content.name for content in context.current_course]
- try:
- return course_data[course_data.index(context.current_content.name) + 1]
- except IndexError:
- return None
\ No newline at end of file
+ # Saving context variables for Jinja
+ context.current_content = current_content
+ context.course_name = course_name
+ context.program_name = program_name
+ context.content_type = content_type
+ context.next_content_type, context.next_content = get_next_content(content_name, content_type, current_course.get_content_info())
+
+def get_next_content(c_name, c_type, content_list):
+ try:
+ next = content_list[content_list.index([c_type, c_name]) + 1]
+ return next[0], next[1]
+ except IndexError:
+ return None, None
\ No newline at end of file