Templates: modified routing logic, added data attributes in template

Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index ff7073d..0276102 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -3,6 +3,17 @@
 
 
 def get_context(context):
-    context.current_course = frappe.get_doc("Course", frappe.form_dict["course"])
-    context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
-    next_content = get_next_content()
\ No newline at end of file
+    if frappe.form_dict['course']:
+        context.current_course = frappe.get_doc("Course", frappe.form_dict["course"])
+        context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
+        context.current_program = frappe.form_dict["program"]
+        context.next_content = get_next_content(context)
+
+
+def get_next_content(context):
+    if context.current_course:
+        course_data = [content_item.content for content_item in context.current_course.course_content]
+        try: 
+            return course_data[course_data.index(context.current_content.name) + 1]
+        except IndexError:
+            return None
\ No newline at end of file