summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/static/yaksh/css/design_course.css17
-rw-r--r--yaksh/static/yaksh/js/add_lesson.js11
-rw-r--r--yaksh/static/yaksh/js/course.js3
-rw-r--r--yaksh/static/yaksh/js/design_course.js28
-rw-r--r--yaksh/static/yaksh/js/edit_question.js10
-rw-r--r--yaksh/static/yaksh/js/lesson.js58
-rw-r--r--yaksh/static/yaksh/js/requesthandler.js2
7 files changed, 117 insertions, 12 deletions
diff --git a/yaksh/static/yaksh/css/design_course.css b/yaksh/static/yaksh/css/design_course.css
new file mode 100644
index 0000000..d1bf4bd
--- /dev/null
+++ b/yaksh/static/yaksh/css/design_course.css
@@ -0,0 +1,17 @@
+body {
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 13px;
+ font-weight: normal;
+ line-height: 18px;
+ color: #404040;
+}
+
+#available-lesson-quiz .col-md-8 > div{
+ background: #f5f5f5;
+ border: 1px solid #333333;
+ overflow-y: scroll;
+ height: 300px;
+}
+#available-lesson-quiz .available-list > div{
+ height: 300px;
+}
diff --git a/yaksh/static/yaksh/js/add_lesson.js b/yaksh/static/yaksh/js/add_lesson.js
new file mode 100644
index 0000000..4ad6e4d
--- /dev/null
+++ b/yaksh/static/yaksh/js/add_lesson.js
@@ -0,0 +1,11 @@
+$(document).ready(function(){
+ $("#submit").click(function(){
+ var selected_quiz = $("#id_quiz :selected").text();
+ var video_session = $("#id_video_session").val();
+ if(selected_quiz == "---------" && video_session.length == 0) {
+ $("#alert").toggle();
+ return false;
+ }
+ return true;
+ });
+}); \ No newline at end of file
diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js
index 6807cf4..f0d03e2 100644
--- a/yaksh/static/yaksh/js/course.js
+++ b/yaksh/static/yaksh/js/course.js
@@ -46,13 +46,12 @@ $(function() {
$("#send_mail").click(function(){
var subject = $("#subject").val();
- var body = $('#email_body').val();
+ var body = tinymce.get("email_body").getContent();
var status = false;
var selected = [];
$('#reject input:checked').each(function() {
selected.push($(this).attr('value'));
});
-
if (subject == '' || body == ''){
$("#error_msg").html("Please enter mail details");
$("#dialog").dialog();
diff --git a/yaksh/static/yaksh/js/design_course.js b/yaksh/static/yaksh/js/design_course.js
new file mode 100644
index 0000000..2e2f6c9
--- /dev/null
+++ b/yaksh/static/yaksh/js/design_course.js
@@ -0,0 +1,28 @@
+$(document).ready(function(){
+ var checked_vals = [];
+ $('input:checkbox[name="quiz_lesson"]').click(function() {
+ if($(this).prop("checked") == true){
+ checked_vals.push($(this).val());
+ }
+ else{
+ checked_vals.pop($(this).val());
+ }
+ });
+ $('#design_course_form').submit(function(eventObj) {
+ var input_order = $("input[name*='order']");
+ var order_list = []
+ if (input_order){
+ $(input_order).each(function(index) {
+ order_list.push($(this).data('item-id')+":"+$(this).val());
+ });
+ }
+ $(this).append('<input type="hidden" name="choosen_list" value='+checked_vals+'>');
+ $(this).append('<input type="hidden" name="ordered_list" value='+order_list+'>');
+ return true;
+ });
+ var msg = "If the value is True, Check if Prerequisite is completed. \n" +
+ "If the value is False, Don't check for Prerequisite. \n" +
+ "Prerequisite can either be a Quiz or Lesson. \n" +
+ "Prerequisite is checked according to the order of Quiz or Lesson.";
+ $("#prereq_msg").attr("title", msg);
+}); \ No newline at end of file
diff --git a/yaksh/static/yaksh/js/edit_question.js b/yaksh/static/yaksh/js/edit_question.js
index 7a0f56d..4eb25d0 100644
--- a/yaksh/static/yaksh/js/edit_question.js
+++ b/yaksh/static/yaksh/js/edit_question.js
@@ -35,15 +35,7 @@ function decrease(frm,n)
function grade_data(showHideDiv)
{
- var ele=document.getElementById(showHideDiv);
- if (ele.style.display=="block")
- {
- ele.style.display = "none";
- }
- else
- {
- ele.style.display = "block";
- }
+ $("#"+showHideDiv).toggle();
}
function setSelectionRange(input, selectionStart, selectionEnd)
diff --git a/yaksh/static/yaksh/js/lesson.js b/yaksh/static/yaksh/js/lesson.js
new file mode 100644
index 0000000..7968c7a
--- /dev/null
+++ b/yaksh/static/yaksh/js/lesson.js
@@ -0,0 +1,58 @@
+$(document).ready(function(){
+ function getCookie(name) {
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
+
+ var csrftoken = getCookie("csrftoken");
+ function csrfSafeMethod(method) {
+ // These HTTP methods do not require CSRF protection
+ return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
+ }
+ $.ajaxSetup({
+ beforeSend: function(xhr, settings) {
+ if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
+ xhr.setRequestHeader("X-CSRFToken", csrftoken);
+ }
+ }
+ });
+ $("#preview").click(function(){
+ var description = $("#id_description").val();
+ var preview_url = window.location.protocol + "//" +
+ window.location.host + "/exam/manage/courses/lesson/preview/";
+ $.ajax({
+ url: preview_url,
+ timeout: 15000,
+ type: 'POST',
+ data: JSON.stringify({'description': description}),
+ dataType: 'json',
+ contentType: 'application/json; charset=utf-8',
+ success: function(msg) {
+ preview_text(msg['data']);
+ },
+ error: function(jqXHR, textStatus) {
+
+ }
+ });
+ });
+
+ function preview_text(data){
+ var preview_div = $("#preview_text_div");
+ if (!preview_div.is(":visible")){
+ $("#preview_text_div").toggle();
+ }
+ $("#description_body").empty();
+ $("#description_body").append(data);
+ }
+}); \ No newline at end of file
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js
index 7ff90df..9749676 100644
--- a/yaksh/static/yaksh/js/requesthandler.js
+++ b/yaksh/static/yaksh/js/requesthandler.js
@@ -37,7 +37,7 @@ function unlock_screen() {
}
function get_result(uid){
- var url = "/exam/get_result/" + uid + "/";
+ var url = "/exam/get_result/" + uid + "/" + course_id + "/" + module_id + "/";
ajax_check_code(url, "GET", "html", null, uid)
}