diff options
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/base.html | 61 | ||||
-rw-r--r-- | yaksh/templates/manage.html | 37 | ||||
-rw-r--r-- | yaksh/templates/user.html | 8 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_lesson.html | 141 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_module.html | 31 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_topic.html | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_video_quiz.html | 94 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_added_modules.html | 16 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_forum.html | 259 | ||||
-rw-r--r-- | yaksh/templates/yaksh/course_modules.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/lessons_forum.html | 80 | ||||
-rw-r--r-- | yaksh/templates/yaksh/monitor.html | 54 | ||||
-rw-r--r-- | yaksh/templates/yaksh/post_comments.html | 79 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 9 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_lesson_quiz.html | 142 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_lesson_statistics.html | 191 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_toc.html | 74 | ||||
-rw-r--r-- | yaksh/templates/yaksh/show_video.html | 179 | ||||
-rw-r--r-- | yaksh/templates/yaksh/sidebar.html | 8 |
19 files changed, 1226 insertions, 251 deletions
diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html index c70c265..a946c12 100644 --- a/yaksh/templates/base.html +++ b/yaksh/templates/base.html @@ -20,6 +20,11 @@ <link rel="stylesheet" href="{% static 'yaksh/css/animate.min.css' %}" type="text/css" /> <link rel="stylesheet" href="{% static 'yaksh/css/font-awesome.css' %}" type="text/css" /> <link rel="stylesheet" href="{% static 'yaksh/css/ontop.css' %}" type="text/css" /> + <link rel="stylesheet" href="{% static 'yaksh/css/plyr.css' %}" /> + <link rel="stylesheet" type="text/css" href="{% static 'yaksh/css/simplemde.min.css' %}"> + <link rel="stylesheet" href="{% static 'yaksh/css/toastr.min.css' %}" /> + <!-- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.12.0/katex.min.css --> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous"> {% block meta %} @@ -37,9 +42,32 @@ <script language="JavaScript" type="text/javascript" src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"></script> <script language="JavaScript" type="text/javascript" src="{% static 'yaksh/js/bootstrap.min.js' %}"></script> <script language="JavaScript" type="text/javascript" src="{% static 'yaksh/js/wow.min.js' %}"></script> + <script src="{% static 'yaksh/js/plyr.js' %}"></script> + <script type="text/javascript" src="{% static 'yaksh/js/simplemde.min.js' %}"> + </script> + <script type="text/javascript" src="{% static 'yaksh/js/toastr.min.js' %}"> + </script> + <!-- The loading of KaTeX is deferred to speed up page rendering --> + <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script> + + <!-- To automatically render math in text elements, include the auto-render extension: --> + <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> + <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"> + </script> <script> new WOW().init(); + $(document).ready(function() { + renderMathInElement( + document.body, + { + delimiters: [ + {left: "$$", right: "$$", display: true}, + {left: "$", right: "$", display: false}, + ] + } + ); + }); </script> {% block script %} {% endblock %} @@ -50,9 +78,24 @@ <div id="ontop"> <div id="state"> Checking...<img src="{% static 'yaksh/images/check_answer.gif' %}"/> - </div></div> - - + </div> + </div> + <div id="loader"> + <div id="state1"> + <div class="spinner-grow text-success" role="status"> + <span class="sr-only">Loading...</span> + </div> + <div class="spinner-grow text-danger" role="status"> + <span class="sr-only">Loading...</span> + </div> + <div class="spinner-grow text-warning" role="status"> + <span class="sr-only">Loading...</span> + </div> + <div class="spinner-grow text-primary" role="status"> + <span class="sr-only">Loading...</span> + </div> + </div> + </div> {% block nav %} {% endblock %} @@ -68,6 +111,18 @@ {% block footer %} + <footer class="footer"> + <div class="container"> + <div class="row"> + <div class="col"> + Developed by FOSSEE group, IIT Bombay + </div> + <div class="col"> + Contact: pythonsupport@fossee.in + </div> + </div> + </div> + </footer> {% endblock %} </body> diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html index 6047fc5..047f784 100644 --- a/yaksh/templates/manage.html +++ b/yaksh/templates/manage.html @@ -65,36 +65,13 @@ </ul> </div> </nav> - -<!-- iframe div for video embed --> -<div id="iframe_div" style="display: none;"> - <iframe class="embed-responsive-item" id="video_frame" width="640" height="480" allowfullscreen> - </iframe> -</div> -<!-- end iframe div --> - -<!-- Dialog to video embed --> -<div id="dialog_iframe" title="Embed Video URL" style="display: none;"> - <div class="input-group mb-3"> - <input id="url" name="url" type="text" required="true" class="form-control" placeholder="Enter video link"> - <div class="input-group-append"> - <input type="button" id="submit_info" name="submit_info" class="btn btn-primary" value="Submit" /> - </div> - </div> - <div id="error_div" style="display: none;"> - <b> Please enter URL</b> - </div> - <div id="copy_div"> - <br> - <label>Paste HTML to embed in website:</label> - <textarea id="html_text" class="form-control" rows="5" cols="100"></textarea> - <br> - <a class="btn btn-secondary" id="copy" data-toggle="tooltip" title="Copy to Clipboard"> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </a> - </div> -</div> -<!-- end dialog --> +<script type="text/javascript"> + $(document).ready(function() { + $(".alert").delay(2000).slideUp(200, function() { + $(this).alert('close'); + }); + }); +</script> {% endblock %} {% block content %} diff --git a/yaksh/templates/user.html b/yaksh/templates/user.html index 4e3974b..7211d5c 100644 --- a/yaksh/templates/user.html +++ b/yaksh/templates/user.html @@ -43,7 +43,13 @@ </nav> </div> {% endblock %} - +<script type="text/javascript"> + $(document).ready(function() { + $(".alert").delay(2000).slideUp(200, function() { + $(this).alert('close'); + }); + }); +</script> {% block content %} {% block main %} diff --git a/yaksh/templates/yaksh/add_lesson.html b/yaksh/templates/yaksh/add_lesson.html index ae68af7..04838a6 100644 --- a/yaksh/templates/yaksh/add_lesson.html +++ b/yaksh/templates/yaksh/add_lesson.html @@ -21,14 +21,13 @@ {% block content %} <div class="container-fluid"> -{% if error %} -<div class="alert alert-danger"> - {{error}} -</div> -{% endif %} -<div class="container-fluid"> - <div class="row justify-content-center form-group"> - <div class="col-md-5 col-md-offset-4"> + {% if error %} + <div class="alert alert-danger"> + {{error}} + </div> + {% endif %} + <div class="row"> + <div class="col-md-6"> <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}"> <i class="fa fa-arrow-left"></i> Back </a> @@ -55,7 +54,7 @@ <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>{{ error|escape }}</strong> + <strong>{{ field.label }} : {{ error|escape }}</strong> </div> {% endfor %} {% endfor %} @@ -64,27 +63,40 @@ <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>{{ error|escape }}</strong> + <strong>{{ field.label }} : {{ error|escape }}</strong> </div> {% endfor %} {% endif %} {{lesson_form.name}} <br> + <div class="card" id="preview_text_div"> + <div class="card-header"> + <center> + <h3>Description Preview</h3> + </center> + </div> + <div class="card-body" id="description_body" style="max-height: 400px; overflow-y: auto;"> + </div> + </div> + <br> {{lesson_form.description}} <br> Active: {{lesson_form.active}} <br><br> - Video File: + Video Path: <span class="badge badge-info"> - {{lesson_form.video_file.help_text}} + {{lesson_form.video_path.help_text}} </span> - <div class="input-group mb-3"> - <div class="custom-file"> - {{lesson_form.video_file}} - <label class="custom-file-label" for="id_video_file"> - Choose file - </label> - </div> + {{lesson_form.video_path}} + <br> + Video File: + <div class="table-responsive"> + <span class="badge badge-info"> + {{lesson_form.video_file.help_text}} + </span> + </div> + <div class="col-md-4"> + {{lesson_form.video_file}} </div> <br> Lesson Files: @@ -129,30 +141,93 @@ <button class="btn btn-danger btn-lg" type="submit" id="submit" name="Delete"> <i class="fa fa-trash"></i> Delete Files </button> {% endif %} - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="preview"> - <i class="fa fa-eye"></i> - Preview Description - </button> - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="embed"> - <i class="fa fa-angle-left"></i> <i class="fa fa-angle-right"></i> - Embed Video link - </button> </center> - </form> - <hr> </fieldset> </form> </div> + <br><br> <div class="col-md-6"> + <br> + <div class="card"> + <div class="card-header"> + <a class="card-link" data-toggle="collapse" href="#toc-collapse"> + Table Of Contents <i class="fa fa-angle-down"></i> + </a> + </div> + <div class="collapse show" id="toc-collapse"> + <div class="card-body" id="toc" style="max-height: 400px; overflow-y: auto;">{{toc}}</div> + </div> + </div> + <br> <div class="card" id="preview_text_div"> <div class="card-header"> - <center> - <h3>Description Preview</h3> - </center> + Create lesson table of contents </div> - <div class="card-body" id="description_body"> + <div class="card-body"> + {% if lesson_form.instance and lesson_form.instance.video_path %} + {% with lesson_form.instance.video_path|video_name as video %} + {% if video.1 == "others" %} + <video id="player" playsinline controls> + <source src="{{video.0}}" /> + </video> + {% else %} + <div id="player" data-plyr-provider="{{video.1}}" data-plyr-embed-id="{{video.0}}"></div> + {% endif %} + <br> + <form action="{% url 'yaksh:add_marker' course_id lesson_form.instance.id %}" method="POST" id="marker-form" name="marker-form"> + {% csrf_token %} + <div class="row"> + <div class="col-md-3"> + <input type="text" id="vtimer" class="form-control" name="video_time" value="00:00:00" required=""> + </div> + <div class="col-md-4"> + <select name="content" class="custom-select" required="" id="content-type"> + <option value="">Select Marker</option> + <option value="1">Topic</option> + <option value="2">Graded Quiz</option> + <option value="3">Exercise</option> + <option value="4">Poll</option> + </select> + </div> + <div class="col-md-5"> + <select name="type" class="custom-select" id="id_type" style="display: none;"> + <option value="" selected="">Select question type</option> + + <option value="mcq">Single Correct Choice</option> + + <option value="mcc">Multiple Correct Choices</option> + + <option value="integer">Answer in Integer</option> + + <option value="string">Answer in String</option> + + <option value="float">Answer in Float</option> + </select> + </div> + <br><br> + <div class="col-md-4"> + <button type="submit" class="btn btn-success" id="add-marker"> + <i class="fa fa-plus-circle"> </i>Add + </button> + </div> + </div> + {% endwith %} + {% else %} + <div class="table-responsive"> + <div class="badge badge-info"> + <strong> + Add a Video Path or Upload a video file to setup lesson contents + </strong> + </div> + </div> + {% endif %} </div> </div> + <br> + <div class="card"> + <div class="card-header">Add/Edit Content</div> + <div class="card-body" id="lesson-content"></div> + </div> </div> </div> </div> diff --git a/yaksh/templates/yaksh/add_module.html b/yaksh/templates/yaksh/add_module.html index a4d1d35..9df194a 100644 --- a/yaksh/templates/yaksh/add_module.html +++ b/yaksh/templates/yaksh/add_module.html @@ -5,12 +5,14 @@ {% endblock %} {% block script %} -<script type="text/javascript" src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"></script> -<script type="text/javascript" src="{% static 'yaksh/js/design_course.js' %}"></script> -<script type="text/javascript" src="{% static 'yaksh/js/lesson.js' %}"></script> -<script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> -<script type="text/javascript" src="{% static 'yaksh/js/jquery-ui.js' %}"></script> -<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script> +<script type="text/javascript" src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"> +</script> +<script type="text/javascript" src="{% static 'yaksh/js/design_course.js' %}"> +</script> +<script type="text/javascript" src="{% static 'yaksh/js/lesson.js' %}"> +</script> +<script type="text/javascript" src="{% static 'yaksh/js/jquery-ui.js' %}"> +</script> {% endblock %} {% block css %} @@ -60,7 +62,7 @@ <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>{{ error|escape }}</strong> + <strong>{{field.label}} : {{ error|escape }}</strong> </div> {% endfor %} {% endfor %} @@ -69,29 +71,22 @@ <button type="button" class="close" data-dismiss="alert"> <i class="fa fa-close"></i> </button> - <strong>{{ error|escape }}</strong> + <strong>{{field.label}} : {{ error|escape }}</strong> </div> {% endfor %} {% endif %} {{module_form.name}} <br> - {{module_form.description}} - <br> Active: {{module_form.active}} <br> + <br> + {{module_form.description}} + <br> <center> <button class="btn btn-success btn-lg" type="submit" id="submit" name="Save"> <i class="fa fa-save"></i> Save </button> - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="preview"> - <i class="fa fa-eye"></i> - Preview Description - </button> - <button class="btn btn-outline-primary btn-lg" type="button" name="button" id="embed"> - <i class="fa fa-angle-left"></i> <i class="fa fa-angle-right"></i> - Embed Video link - </button> </center> </form> <hr> diff --git a/yaksh/templates/yaksh/add_topic.html b/yaksh/templates/yaksh/add_topic.html new file mode 100644 index 0000000..52923e7 --- /dev/null +++ b/yaksh/templates/yaksh/add_topic.html @@ -0,0 +1,12 @@ +{% if topic_id %} +<form class="form-group" method="POST" action="{% url 'yaksh:edit_topic' content_type course_id lesson_id toc_id topic_id %}" id="topic-form"> +{% else %} +<form class="form-group" method="POST" action="{% url 'yaksh:add_topic' content_type course_id lesson_id %}" id="topic-form"> +{% endif %} + {% csrf_token %} + {{ form.as_p }} + <br> + <button type="submit" class="btn btn-success"> + <i class="fa fa-save"></i> Save + </button> +</form> diff --git a/yaksh/templates/yaksh/add_video_quiz.html b/yaksh/templates/yaksh/add_video_quiz.html new file mode 100644 index 0000000..b8a788e --- /dev/null +++ b/yaksh/templates/yaksh/add_video_quiz.html @@ -0,0 +1,94 @@ +{% load static %} +<script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> +<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"> +</script> +{% if question_id %} +<form class="form-group" method="POST" action="{% url 'yaksh:edit_marker_quiz' content_type course_id lesson_id toc_id question_id %}" id="question-form"> +{% else %} +<form class="form-group" method="POST" action="{% url 'yaksh:add_marker_quiz' content_type course_id lesson_id %}" id="question-form"> +{% endif %} + {% csrf_token %} + <table class="table table-responsive-sm"> + {% for field in form %} + <tr> + <td>{{ field.label }}</td> + <td>{{ field }} <small>{{ field.help_text }}</small></td> + </tr> + {% endfor %} + </table> + {{ formset.management_form }} + <br> + <button type="button" id="add_more" class="btn btn-primary"> + <i class="fa fa-plus-circle"></i> Add More + </button> + <br><br> + <div id="form_set"> + {% for form in formset.forms %} + {{form.non_field_errors}} + {{form.errors}} + <table class='no_error'> + {{ form }} + </table> + <hr> + {% endfor %} + </div> + <div id="empty_form" style="display:none"> + <table class='no_error'> + {{ formset.empty_form }} + </table> + <hr> + </div> + <button type="submit" class="btn btn-success"> + <i class="fa fa-save"></i> Save + </button> +</form> +<script type="text/javascript"> + $(document).ready(function() { + var tc_type = "#id_"+"{{tc_class}}"+"_set-TOTAL_FORMS"; + $('#add_more').click(function() { + var form_idx = $(tc_type).val(); + $('#form_set').append($('#empty_form').html().replace(/__prefix__/g, form_idx)); + $(tc_type).val(parseInt(form_idx) + 1); + var form_type = "#id_"+'{{tc_class}}'+"_set-"+form_idx+"-type"; + $(form_type).val($("#id_"+'{{tc_class}}'+"_set-0-type").val()); + }); + $("#question-form").each(function() { + $(this).find('textarea').addClass("form-control"); + $(this).find('input[type=number]').addClass("form-control"); + }); + let option = $('#id_language').val(); + if(option === 'other') { + $('#id_topic').closest('tr').show(); + $('#id_topic').prop("required", true); + } else { + $('#id_topic').closest('tr').hide(); + $('#id_topic').prop("required", false); + } + $('#id_language').on('change', function() { + let lang_value = $(this).val(); + if (lang_value === "other") { + $('#id_topic').closest('tr').show(); + $('#id_topic').prop("required", true); + $('#id_type').children("option[value='code']").hide(); + } else { + $('#id_topic').closest('tr').hide(); + $('#id_topic').prop("required", false); + $('#id_type').children("option[value='code']").show(); + } + }); + $(function() { + tinymce.init({ + selector: 'textarea#que_description', + setup : function(ed) { + ed.on('change', function(e) { + tinymce.triggerSave(); + }); + }, + max_height: 400, + height: 400, + plugins: "image code link", + convert_urls: false + }); + }); + }); +</script>
\ No newline at end of file diff --git a/yaksh/templates/yaksh/course_added_modules.html b/yaksh/templates/yaksh/course_added_modules.html index 2d194b9..d420b95 100644 --- a/yaksh/templates/yaksh/course_added_modules.html +++ b/yaksh/templates/yaksh/course_added_modules.html @@ -93,6 +93,22 @@ Lesson {% endif %} </td> + <td> + {% if unit.type == "quiz" %} + {% if unit.quiz.questionpaper_set.get.id %} + <a href="{% url 'yaksh:show_statistics' unit.quiz.questionpaper_set.get.id course.id %}" class="btn btn-outline-primary"> + <i class="fa fa-line-chart"></i> + Statistics + </a> + {% else %} + ---- + {% endif %} + {% else %} + <a href="{% url 'yaksh:lesson_statistics' course.id unit.lesson.id %}" class="btn btn-outline-primary"> + <i class="fa fa-line-chart"></i> Statistics + </a> + {% endif %} + </td> </tr> {% endfor %} </table> diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index 4724981..b98688b 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -4,132 +4,169 @@ {{course.name}}: Discussion Forum {% endblock title %} {% block content %} - <div class="container"> - <div> - <h2><center>{{course.name}}</center></h2> - <center>Discussion Forum</center> - </div> - <div class="d-flex p-2 bd-highlight"> - <div class="col-md-4"> - {% if moderator %} - <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary"> - <i class="fa fa-arrow-left"></i> Back - </a> - {% else %} - <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> - <i class="fa fa-arrow-left"></i> Back - </a> - {% endif %} + <div id="wrapper" class="d-flex"> + {% include "yaksh/sidebar.html" %} + <div class="container" id="page-content-wrapper"> + <div> + <h2><center>{{course.name}}</center></h2> + <center>Discussion Forum</center> </div> - <div class="col-md"> - <button type="button" class="btn btn-success pull-right" data-toggle="modal" data-target="#newPostModal"> - <i class="fa fa-plus-circle"></i> New Post - </button> + <div class="d-flex p-2 bd-highlight"> + <div class="col-md-4"> + {% if moderator %} + <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% else %} + <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% endif %} + </div> + <div class="col-md"> + <button type="button" class="btn btn-success pull-right" data-toggle="modal" data-target="#newPostModal"> + <i class="fa fa-plus-circle"></i> New Post + </button> + </div> </div> - </div> - <!-- Modal --> - <div id="newPostModal" class="modal fade" role="dialog"> - <div class="modal-dialog"> + {% if messages %} + <div> + <center> + {% for message in messages %} + <div class="alert alert-dismissible alert-{{ message.tags }}"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ message }}</strong> + </div> + {% endfor %} + </center> + </div> + {% endif %} + <!-- Modal --> + <div id="newPostModal" class="modal fade" role="dialog"> + <div class="modal-dialog"> - <!-- Modal content--> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">Create a new Post</h4> - <button type="button" class="close" data-dismiss="modal">×</button> - </div> - <div class="modal-body"> - <form action="." method="POST" enctype='multipart/form-data'> - <div class="form-group"> - {% csrf_token %} - {{form}} - </div> - <input type="submit" class="btn btn-primary" value="Create Post"> - </form> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title">Create a new Post</h4> + <button type="button" class="close" data-dismiss="modal">×</button> + </div> + <div class="modal-body"> + <form action="." method="POST" enctype='multipart/form-data'> + <div class="form-group"> + {% csrf_token %} + {{form}} + </div> + <input type="submit" class="btn btn-primary" value="Create Post"> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </div> </div> </div> - - </div> - </div> - <br> - <div class="row justify-content-center"> - <div class="col-md-6"> - <form class="my-2 my-lg-0" action="" method="GET"> - <div class="input-group"> - <input type="search" placeholder="Search Post" name="search_post" class="form-control"> - <span class="input-group-append"> - <button class="btn btn-outline-info"> - <i class="fa fa-search"></i> Search - </button> - </span> + <br> + {% with objects as posts %} + {% if posts %} + <div class="row justify-content-center"> + <div class="col-md-6"> + <form class="my-2 my-lg-0" action="" method="GET"> + <div class="input-group"> + <input type="search" placeholder="Search Post" name="search_post" class="form-control"> + <span class="input-group-append"> + <button class="btn btn-outline-info"> + <i class="fa fa-search"></i> Search + </button> + </span> + </div> + </form> + </div> + <div class="col-md-4"> + <a class="btn btn-outline-danger" href="{% url 'yaksh:course_forum' course.id %}"> + <i class="fa fa-times"></i> Clear Search + </a> + </div> </div> - </form> - </div> - <div class="col-md-4"> - <a class="btn btn-outline-danger" href="{% url 'yaksh:course_forum' course.id %}"> - <i class="fa fa-times"></i> Clear Search - </a> - </div> + <br> + {% include "yaksh/paginator.html" %} + <br> + <table id="posts_table" class="tablesorter table"> + <thead class="thread-inverse"> + <tr> + <th width="700">Posts</th> + <th>Created by</th> + <th>Replies</th> + <th>Last reply</th> + <th></th> + </tr> + </thead> + <tbody> + {% for post in posts %} + <tr> + <td> + <a href="{% url 'yaksh:post_comments' course.id post.uid %}">{{post.title}}</a> + <small class="text-muted d-block">{{ post.description|truncatewords:30 }}</small> + <small class="text-muted"><strong>Last updated: {{post.modified_at}}</strong></small> + </td> + <td> + {% if post.anonymous %} + Anonymous + {% else %} + {{post.creator.username}} + {% endif %} + </td> + <td>{{post.get_comments_count}}</td> + <td> + {% with post.get_last_comment as last_comment %} + {% if last_comment %} + {{last_comment.creator}} + {% else %} + None + {% endif %} + {% endwith %} + </td> + <td> + {% if user == course.creator or user in course.get_teachers %} + <small><a href="{% url 'yaksh:hide_post' course.id post.uid %}" class="pull-right fa fa-trash"></i></a></small> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + <br> + {% include "yaksh/paginator.html" %} + {% else %} + <center>No discussion posts are there yet. Create one to start discussing.</center> + {% endif %} + {% endwith %} </div> - <br> - {% with objects as posts %} - {% if posts %} - {% include "yaksh/paginator.html" %} - <br> - <table id="posts_table" class="tablesorter table"> - <thead class="thread-inverse"> - <tr> - <th width="700">Posts</th> - <th>Created by</th> - <th>Replies</th> - <th>Last reply</th> - <th></th> - </tr> - </thead> - <tbody> - {% for post in posts %} - <tr> - <td> - <a href="{% url 'yaksh:post_comments' course.id post.uid %}">{{post.title}}</a> - <small class="text-muted d-block">{{ post.description|truncatewords:30 }}</small> - <small class="text-muted"><strong>Last updated: {{post.modified_at}}</strong></small> - </td> - <td>{{post.creator.username}}</td> - <td>{{post.get_comments_count}}</td> - <td> - {% with post.get_last_comment as last_comment %} - {% if last_comment %} - {{last_comment.creator}} - {% else %} - None - {% endif %} - {% endwith %} - </td> - <td> - {% if user.profile.is_moderator %} - <small><a href="{% url 'yaksh:hide_post' course.id post.uid %}" class="pull-right btn btn-danger">Delete</i></a></small> - {% endif %} - </td> - </tr> - {% endfor %} - </tbody> - </table> - <br> - {% include "yaksh/paginator.html" %} - {% else %} - No discussion posts are there yet. Create one to start discussing. - {% endif %} - {% endwith %} </div> {% endblock content %} {% block script %} <script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script> <script type="text/javascript" src="{% static 'yaksh/js/jquery.tablesorter.min.js' %}"></script> + <script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> <script type="text/javascript"> $(document).ready(() => { $("#posts_table").tablesorter(); + $(function() { + tinymce.init({ + selector: 'textarea#id_description', + setup : function(ed) { + ed.on('change', function(e) { + tinymce.triggerSave(); + }); + }, + max_height: 400, + height: 400, + plugins: "image code link", + convert_urls: false + }); + }); }); </script> {% endblock script %}
\ No newline at end of file diff --git a/yaksh/templates/yaksh/course_modules.html b/yaksh/templates/yaksh/course_modules.html index b808562..2ac1962 100644 --- a/yaksh/templates/yaksh/course_modules.html +++ b/yaksh/templates/yaksh/course_modules.html @@ -7,7 +7,7 @@ <div class="card"> <div class="card-header"> {{ course.name }} - <a href="{% url "yaksh:course_forum" course.id %}" class="btn btn-info pull-right">Discussion Forum</a> + <a href="{% url 'yaksh:course_forum' course.id %}" class="btn btn-info pull-right">Discussion Forum</a> </div> <div class="card-body"> {% if course.view_grade %} diff --git a/yaksh/templates/yaksh/lessons_forum.html b/yaksh/templates/yaksh/lessons_forum.html new file mode 100644 index 0000000..58fb360 --- /dev/null +++ b/yaksh/templates/yaksh/lessons_forum.html @@ -0,0 +1,80 @@ +{% extends base_template %} +{% load static %} +{% block title %} + {{course.name}}: Lessons Forum +{% endblock title %} +{% block content %} + <div id="wrapper" class="d-flex"> + {% include "yaksh/sidebar.html" %} + <div class="container" id="page-content-wrapper"> + <div class="d-flex p-2 bd-highlight"> + <div class="col-md-4"> + {% if moderator %} + <a href="{% url 'yaksh:course_detail' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% else %} + <a href="{% url 'yaksh:course_modules' course.id %}" class="btn btn-primary"> + <i class="fa fa-arrow-left"></i> Back + </a> + {% endif %} + </div> + </div> + {% if posts %} + <div> + <h2><center>{{course.name}}</center></h2> + <center>Discussion Forum</center> + </div> + <table class="table"> + <thead class="thread-inverse"> + <tr> + <th width="700">Posts</th> + <th>Created by</th> + <th>Replies</th> + <th>Last reply</th> + <th></th> + </tr> + </thead> + <tbody> + {% for post in posts %} + <tr> + <td> + <a href="{% url 'yaksh:post_comments' course.id post.uid %}">{{post.title}}</a> + <small class="text-muted d-block">{{ post.description|truncatewords:30 }}</small> + <small class="text-muted"><strong>Last updated: {{post.modified_at}}</strong></small> + </td> + <td> + {% if post.anonymouse %} + Anonymous + {% else %} + {{post.creator.username}} + {% endif %} + </td> + <td>{{post.get_comments_count}}</td> + <td> + {% with post.get_last_comment as last_comment %} + {% if last_comment %} + {{last_comment.creator}} + {% else %} + None + {% endif %} + {% endwith %} + </td> + <td> + {% if user == course.creator or user in course.get_teachers %} + <small><a href="{% url 'yaksh:hide_post' course.id post.uid %}" class="pull-right fa fa-trash"></i></a></small> + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% else %} + <div> + <center>No Lesson posts here. They will appear when someone comments on video lessons.</center> + </div> + {% endif %} + </div> + </div> +{% endblock content %} + diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html index 0a8e3e9..2b43ec1 100644 --- a/yaksh/templates/yaksh/monitor.html +++ b/yaksh/templates/yaksh/monitor.html @@ -4,7 +4,7 @@ {% block title %} Monitor {% endblock %} {% block pagetitle %} Monitor {% endblock pagetitle %} -{% block meta %} <meta http-equiv="refresh" content="30"/> {% endblock meta %} +{% block meta %} <meta http-equiv="refresh" content="300"/> {% endblock meta %} {% block script %} {% if papers %} @@ -88,21 +88,57 @@ $(document).ready(function() <br> <div class="row"> <div class="col-md-4"> - <a href="{% url 'yaksh:show_statistics' papers.0.question_paper.id course.id %}" class="btn btn-primary"> - <i class="fa fa-line-chart"></i> Question Statistics - </a> - </div> - <div class="col-md-4"> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#csvModal"> <i class="fa fa-download"></i> Download CSV </button> </div> <div class="col-md-4"> + <a href="{% url 'yaksh:show_statistics' papers.0.question_paper.id course.id %}" class="btn btn-primary"> + <i class="fa fa-line-chart"></i> Question Statistics + </a> + </div> + <div class="col-md-4"> <div class="badge badge-info"> - Auto-Refreshes every 30 seconds + Auto-Refreshes every 5 minutes </div> </div> </div> + <hr> + <div class="row"> + <div class="col-md-6"> + <p> + <b> + - Download the CSV file from the button above<br /> + - Edit and upload the same <br /> + </b> + </p> + </div> + <div class="col-md-6"> + <form id="upload_users" action="{% url 'yaksh:upload_marks' course.id papers.0.question_paper.id %}" method="POST" enctype="multipart/form-data"> + {% csrf_token %} + <div class="input-group mb-3"> + <div class="custom-file"> + <input type="file" class="custom-file-input" name="csv_file" id="upload"/> + <label class="custom-file-label" for="upload">Select</label> + </div> + <div class="input-group-append"> + <button class="btn btn-outline-primary" type="submit"> + <i class="fa fa-upload"></i> + Upload + </button> + </div> + </div> + <script> + $('#upload').on('change',function(){ + //get the file name + var fileName = $(this).val(); + //replace the "Choose a file" label + $(this).next('.custom-file-label').html(fileName); + }) + </script> + </form> + </div> + </div> <br> <table id="result-table" class="tablesorter table table-striped table-responsive-sm"> <thead> @@ -172,7 +208,11 @@ $(document).ready(function() {% for field in csv_fields %} <div class="form-check form-check-inline"> <label class="form-check-label"> + {% if field == 'username' or field == 'questions' %} + <input class="form-check-input" name="csv_fields" type="checkbox" value="{{ field }}" checked onclick="return false"> {{ field }} + {% else %} <input class="form-check-input" name="csv_fields" type="checkbox" value="{{ field }}" checked> {{ field }} + {% endif %} </label> </div> <br> diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html index b16b80c..aadc48b 100644 --- a/yaksh/templates/yaksh/post_comments.html +++ b/yaksh/templates/yaksh/post_comments.html @@ -6,24 +6,44 @@ {% block content %} <div class="container"> - <a class="btn btn-primary" href="{% url 'yaksh:course_forum' post.course.id %}"> + <a class="btn btn-primary" href="{% url 'yaksh:course_forum' course.id %}"> <i class="fa fa-arrow-left"></i> Back to Posts </a> <br> <br> + {% if messages %} + <div> + <center> + {% for message in messages %} + <div class="alert alert-dismissible alert-{{ message.tags }}"> + <button type="button" class="close" data-dismiss="alert"> + <i class="fa fa-close"></i> + </button> + <strong>{{ message }}</strong> + </div> + {% endfor %} + </center> + </div> + {% endif %} <div class="card mb-2 border-dark"> <div class="card-header text-white bg-dark py-2 px-3"> {{post.title}} <br> <small> - <strong>{{post.creator.username}}</strong> + <strong> + {% if post.anonymous %} + Anonymous + {% else %} + {{post.creator.username}} + {% endif %} + </strong> {{post.created_at}} - {% if user.profile.is_moderator %}<a href="{% url 'yaksh:hide_post' post.course.id post.uid %}" class="pull-right btn btn-danger">Delete</a>{% endif %} + {% if user == course.creator or user in course.get_teachers %}<a href="{% url 'yaksh:hide_post' post.target.id post.uid %}" class="pull-right fa fa-trash"></a>{% endif %} </small> </div> <div class="card-body"> - <p class="card-text description">{{post.description}}</p> + <p class="card-text description">{{post.description|safe}}</p> {% if post.image %} <a href="{{post.image.url}}" target="_blank"> <center><img src="{{post.image.url}}" class="post_image thumbnail" alt=""></center> @@ -31,6 +51,16 @@ {% endif %} </div> </div> + <div> + <b><u>Add comment:</u></b> + <form action="" method="POST" enctype='multipart/form-data'> + <div class="form-group"> + {% csrf_token %} + {{form}} + </div> + <input type="submit" value="Submit" class="btn btn-success"> + </form> + </div> <br> {% if comments %} {% for comment in comments %} @@ -38,13 +68,19 @@ <div class="card-body p-3"> <div class="row mb-3"> <div class="col-6"> - <strong class="text-muted">{{comment.creator.username}}</strong> + <strong class="text-muted"> + {% if comment.anonymous %} + Anonymous + {% else %} + {{comment.creator.username}} + {% endif %} + </strong> </div> <div class="col-6 text-right"> - <small class="text-muted">{{comment.created_at}} {% if user.profile.is_moderator %} <a href="{% url 'yaksh:hide_comment' post.course.id comment.uid %}" class="btn btn-danger">Delete</a>{% endif %}</small> + <small class="text-muted">{{comment.created_at}} {% if user == course.creator or user in course.get_teachers %} <a href="{% url 'yaksh:hide_comment' course.id comment.uid %}" class="fa fa-trash"></a>{% endif %}</small> </div> </div> - <p class="card-text description">{{comment.description}}</p> + <p class="card-text description">{{comment.description|safe}}</p> <div> {% if comment.image %} <a href="{{comment.image.url}}" target="_blank"> @@ -57,18 +93,27 @@ {% endfor %} {% endif %} <br> - <div> - <b><u>Add comment:</u></b> - <form action="{% url 'yaksh:post_comments' post.course.id post.uid %}" method="POST" enctype='multipart/form-data'> - <div class="form-group"> - {% csrf_token %} - {{form}} - </div> - <input type="submit" value="Submit" class="btn btn-success"> - </form> - </div> </div> {% endblock content %} {% block script %} <script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script> + <script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> + <script type="text/javascript"> + $(document).ready(() => { + $(function() { + tinymce.init({ + selector: 'textarea#id_description', + setup : function(ed) { + ed.on('change', function(e) { + tinymce.triggerSave(); + }); + }, + max_height: 400, + height: 400, + plugins: "image code link", + convert_urls: false + }); + }); + }); + </script> {% endblock script %}
\ No newline at end of file diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 3f7e67e..2dbfeed 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -276,6 +276,15 @@ question_type = "{{ question.type }}"; {% if question.type == "upload" %} <p>Upload assignment file for the said question<p> <input type=file id="assignment" name="assignment" multiple=""> + {% if assignment_files %} + <ul class="list-group"> + {% for as_file in assignment_files %} + <li class="list-group-item"> + <a href="{{as_file.assignmentFile.url}}" target="_blank">{{ as_file.assignmentFile.name|file_title }}</a> + </li> + {% endfor %} + </ul> + {% endif %} {% endif %} <!-- Arrange type question --> diff --git a/yaksh/templates/yaksh/show_lesson_quiz.html b/yaksh/templates/yaksh/show_lesson_quiz.html new file mode 100644 index 0000000..71c997d --- /dev/null +++ b/yaksh/templates/yaksh/show_lesson_quiz.html @@ -0,0 +1,142 @@ +{% load custom_filters %} +<script type="text/javascript"> + $(document).ready(function() { + renderMathInElement( + document.body, + { + delimiters: [ + {left: "$$", right: "$$", display: true}, + {left: "$", right: "$", display: false}, + ] + } + ); + }); + function user_arranged_options() { + var temp_array = [] + var add_array = document.getElementById("arrange_order"); + var ans_array = order_array.children().get() + var answer_is = $.each(ans_array, function(index, value) { + temp_array.push(value.id); + }); + add_array.value = temp_array + } +</script> +<form id="submit-quiz-form" method="POST" action="{% url 'yaksh:submit_marker_quiz' course_id toc.id %}"> + {% csrf_token %} + <div class="card"> + <div class="card-header"> + <div> + <div> + <h2>{{ question.summary }}</h2> + </div> + <div> + {% if question.language == "other" %} + <small class="text text-muted"><strong>Topic:</strong> <span class="badge badge-primary">{{question.topic}}</small></span> + {% else %} + <small class="textx text-muted"><strong>Language:</strong> <span class="badge badge-primary">{{question.language}}</span></small> + {% endif %} + {% if question.type == "mcq" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">SINGLE CORRECT CHOICE</span></small> + {% elif question.type == "mcc" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">MULTIPLE CORRECT CHOICES</span></small> + {% elif question.type == "integer" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH INTEGER ANSWER</span></small> + {% elif question.type == "string" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH STRING ANSWER</span></small> + {% if testcase.string_check == "lower" %} + <br>(CASE INSENSITIVE) + {% else %} + <br>(CASE SENSITIVE) + {% endif %} + {% elif question.type == "float" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH FLOAT ANSWER</span></small> + {% elif question.type == "arrange" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ARRANGE THE OPTIONS IN CORRECT ORDER</span></small> + {% endif %} + <span class="badge badge-info pull-right"> + <small><strong>Points: {{ question.points }}</strong></small> + </span> + </div> + </div> + </div> + <div class="card-body"> + <div> + {{ question.description|safe }} + </div> + <br> + {% if question.type == "mcq" %} + <!-- Single correct choice type Question --> + {% for test_case in test_cases %} + {% if last_attempt and last_attempt|to_int == test_case.id %} + <input name="answer" type="radio" value="{{ test_case.id }}" checked /> + {{ test_case.options|safe }} <br/> + {% else %} + <input name="answer" type="radio" value="{{ test_case.id }}" required="" /> + {{ test_case.options|safe }} <br/> + {% endif %} + {% endfor %} + {% endif %} + + {% if question.type == "integer" %} + <!-- Integer type Question --> + Enter Integer:<br/> + <input autofocus class="form-control" name="answer" type="number" id="integer" value="{{ last_attempt|to_integer }}" required=""/> + <br><br> + {% endif %} + + {% if question.type == "string" %} + <!-- String type question --> + Enter Text:<br/> + <textarea autofocus name="answer" id="string" class="form-control" style="width: 100%" required="">{{ last_attempt|to_str }}</textarea> + <br/><br/> + {% endif %} + + {% if question.type == "float" %} + <!-- Float type question --> + Enter Decimal Value :<br/> + <input autofocus class="form-control" name="answer" type="number" step="any" id="float" value="{{ last_attempt|to_float }}" required=""/> + <br/><br/> + {% endif %} + + {% if question.type == "mcc" %} + <!-- MCC type question --> + {% for test_case in test_cases %} + {% if last_attempt and test_case.id|safe in last_attempt|safe %} + <input name="answer" type="checkbox" value="{{ test_case.id }}" checked/> + {{ test_case.options| safe }} + <br> + {% else %} + <input name="answer" type="checkbox" value="{{ test_case.id }}"> + {{ test_case.options| safe }} + <br> + {% endif %} + {% endfor %} + {% endif %} + + {% if question.type == "arrange" %} + <!-- Arrange options type question --> + {% if last_attempt %} + {% get_answer_for_arrange_options last_attempt question as test_cases %} + {% endif %} + <input name="answer" type="hidden" id='arrange_order'/> + <div class="list-group"> + <ol class="arrange"> + {% for test_case in test_cases %} + <li class="list-group-item" id={{test_case.id}}> + {{test_case.options| safe }}</li> {% endfor %} + </ol> + </div> + <script type="text/javascript"> + var arrange = $("ol.arrange"); + var order_array = $(arrange).sortable(['serialize']); + </script> + {% endif %} + {% if question.type == "arrange" %} + <br><button class="btn btn-success" type="submit" name="check" id="check" onClick="return user_arranged_options();">Submit</button> + {% else %} + <br><button class="btn btn-success" type="submit" name="check" id="check">Submit + </button> + {% endif %} + </div> + </div> +</form>
\ No newline at end of file diff --git a/yaksh/templates/yaksh/show_lesson_statistics.html b/yaksh/templates/yaksh/show_lesson_statistics.html new file mode 100644 index 0000000..0c35e40 --- /dev/null +++ b/yaksh/templates/yaksh/show_lesson_statistics.html @@ -0,0 +1,191 @@ +{% extends "manage.html" %} +{% load custom_filters %} +{% block title %} Lesson Statistics {% endblock %} +{% block pagetitle %} Statistics for {{lesson}} {% endblock %} +{% block content %} +<div class="container-fluid"> + <br> + <div class="row"> + <div class="col-md-2"> + <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}"> + <i class="fa fa-arrow-left"></i> Back + </a> + </div> + <div class="col-md-4"> + <a class="btn btn-outline-dark" href="{% url 'stats:view_lesson_watch_stats' course_id lesson.id %}"> + <i class="fa fa-line-chart"></i> Video Statistics + </a> + </div> + </div> + <br> + {% if data %} + <div class="row"> + <div class="col-md-4"> + <ul class="list-group"> + {% for toc, count in data.items %} + <li class="list-group-item"> + <div class="row"> + <div class="col-md-4"> + {{ toc.content_object.summary }} + </div> + <div class="col-md-4"> + <span class="badge badge-pill badge-info"> + {{toc.get_content_display}} + </span> + </div> + <div class="col-md-4"> + <a href="{% url 'yaksh:lesson_statistics' toc.course_id toc.lesson_id toc.id %}" class="btn btn-outline-primary"> + <i class="fa fa-info-circle"></i> Details + </a> + </div> + </table> + </li> + {% endfor %} + </ul> + </div> + <div class="col-md-7"> + {% if not is_que_data %} + <table class="table table-responsive"> + <tr> + <th>TOC</th> + <th>Type</th> + <th>Submissions</th> + </tr> + {% for toc, count in data.items %} + <tr> + <td>{{ toc.content_object.summary }}</td> + <td>{{ toc.get_content_display }}</td> + <td>{{ count }}</td> + </tr> + {% endfor %} + </table> + {% else %} + <div class="card"> + <div class="card-header"> + {{question.summary}} + <div> + {% if question.language == "other" %} + <small class="text text-muted"><strong>Topic:</strong> <span class="badge badge-primary">{{question.topic}}</small></span> + {% else %} + <small class="textx text-muted"><strong>Language:</strong> <span class="badge badge-primary">{{question.language}}</span></small> + {% endif %} + {% if question.type == "mcq" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">SINGLE CORRECT CHOICE</span></small> + {% elif question.type == "mcc" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">MULTIPLE CORRECT CHOICES</span></small> + {% elif question.type == "code" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">PROGRAMMING</span></small> + {% elif question.type == "upload" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ASSIGNMENT UPLOAD</span></small> + {% elif question.type == "integer" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH INTEGER ANSWER</span></small> + {% elif question.type == "string" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH STRING ANSWER</span></small> + {% if testcase.string_check == "lower" %} + <br>(CASE INSENSITIVE) + {% else %} + <br>(CASE SENSITIVE) + {% endif %} + {% elif question.type == "float" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH FLOAT ANSWER</span></small> + {% elif question.type == "arrange" %} + <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ARRANGE THE OPTIONS IN CORRECT ORDER</span></small> + {% endif %} + <span class="badge badge-info pull-right"> + <small><strong>Marks: {{ question.points }}</strong></small> + </span> + </div> + </div> + <div class="card-body"> + {{question.description|safe}} + <br> + {% for tc in question.get_test_cases %} + {% if question.type == "mcc" or question.type == "mcq" %} + {% if tc.correct %} + <span class="badge badge-pill badge-success"> + {{forloop.counter}}. + </span> + {% else %} + <span class="badge badge-pill badge-dark"> + {{ forloop.counter }}. + </span> + {% endif %} + {{tc.options}} + {% if per_tc_ans %} + {% get_tc_percent tc.id per_tc_ans as percent %} + <div class="progress" style="width: 30%"> + {% if percent %} + <div class="progress-bar bg-success" role="progressbar" aria-valuenow="{{percent}}" + aria-valuemin="0" aria-valuemax="100" style="width:{{percent}}%"> + <b style="color: white;">{{percent}}%</b> + </div> + {% else %} + <b style="color: black;">0%</b> + {% endif %} + </div> + {% endif %} + {% elif question.type == "integer" %} + <span class="badge badge-pill badge-success">Answer:</span> + {{tc.correct}} + {% elif question.type == "string" %} + <span class="badge badge-pill badge-success">Answer:</span> + {{tc.correct}} ({{tc.get_string_check_display}}) + {% elif question.type == "float" %} + {{tc.correct}} with Error Margin {{ tc.error_margin }} + {% endif %} + <br> + {% endfor %} + </div> + </div> + <br> + <strong>Total Submissions: {{total_count}}</strong> + <br><br> + {% if question.type != 'mcq' and question.type != 'mcc' %} + <div id="plot_div"></div> + <script type="text/javascript"> + var x_data = []; + var y_data = []; + {% for i, j in per_tc_ans.items %} + x_data.push("{{i}}"); + y_data.push("{{j}}"); + {% endfor %} + var data = [{x: x_data, y: y_data, type: 'bar'}]; + var layout = { + title: "Submission records", + xaxis: {title: 'Submitted Value'}, + yaxis: {title: 'Number of Submissions'} + }; + var config = {responsive: true} + Plotly.newPlot('plot_div', data, layout, config); + </script> + <br><br> + {% endif %} + {% include "yaksh/paginator.html" %} + <table class="table table-responsive"> + <tr> + <th>Sr No.</th> + <th>Student Name</th> + <th>Email</th> + <th>Latest Submission</th> + </tr> + {% for data in objects.object_list %} + <tr> + <td>{{ forloop.counter0|add:objects.start_index }}</td> + <td>{{data.student__first_name}} {{data.student__last_name}}</td> + <td>{{data.student__email}}</td> + {% get_answers data.toc_id data.student_id as user_answer %} + <td>{{ user_answer.0 }}</td> + </tr> + {% endfor %} + </table> + {% include "yaksh/paginator.html" %} + {% endif %} + </div> + </div> + {% else %} + <div class="container alert alert-warning"> + No lesson quizzes found + </div> + {% endif %} +</div> +{% endblock %}
\ No newline at end of file diff --git a/yaksh/templates/yaksh/show_toc.html b/yaksh/templates/yaksh/show_toc.html new file mode 100644 index 0000000..4c8ffe2 --- /dev/null +++ b/yaksh/templates/yaksh/show_toc.html @@ -0,0 +1,74 @@ +{% load custom_filters %} +{% has_lesson_video lesson_id as has_video %} +{% if has_video %} + <div class="card"> + <div class="card-body"> + <a href="{% url 'yaksh:download_sample_toc' %}"> + <i class="fa fa-download"></i> Download Sample + </a> + <hr> + <form action="" method="POST" enctype="multipart/form-data"> + {% csrf_token %} + <input type="file" name="toc" required=""> + <button class="btn btn-outline-success" id="upload_toc" name="upload_toc"> + <i class="fa fa-upload"></i> Upload TOC + </button> + </form> + </div> + </div> + <br> +{% endif %} +<table class="table table-responsive"> +{% for toc in contents %} + {% with toc.get_toc_text as toc_name %} + <tr> + <td width="30%"> + {{ toc_name }} + </td> + <td> + {{toc.get_content_display}} + </td> + <td> + {{toc.time}} + </td> + <td> + {% if toc.content == 1 %} + <a href="#" class="btn btn-outline-info" data-url="{% url 'yaksh:edit_topic' toc.content toc.course_id toc.lesson_id toc.id toc.object_id %}" id="edit-toc" onclick="edit_toc(this)"> + {% else %} + <a href="#" class="btn btn-outline-info" data-url="{% url 'yaksh:edit_marker_quiz' toc.content toc.course_id toc.lesson_id toc.id toc.object_id %}" id="edit-toc" onclick="edit_toc(this)"> + {% endif %} + <i class="fa fa-edit"></i> Edit + </a> + </td> + <td> + <form action="{% url 'yaksh:delete_toc' toc.course_id toc.id %}" method="POST"> + {% csrf_token %} + <input type="hidden" name="redirect_url" id="redirect_url" class="hidden"> + <button class="btn btn-outline-danger" type="submit" onclick="return confirm('Are you sure you want to remove {{toc_name|capfirst}}?')"> + <i class="fa fa-trash"></i> Remove + </button> + </form> + </td> + </tr> + {% endwith %} +{% empty %} + <center> + <span class="badge badge-warning">No Table of contents added</span> + </center> +{% endfor %} +</table> +<script type="text/javascript"> + $(document).ready(function() { + var divs = document.getElementsByClassName("hidden"); + for(var i = 0; i < divs.length; i++) + { + divs[i].value = window.location.pathname; + } + }); + + function edit_toc(obj) { + var url = obj.getAttribute("data-url"); + lock_screen(); + ajax_call(url, "GET"); + } +</script>
\ No newline at end of file diff --git a/yaksh/templates/yaksh/show_video.html b/yaksh/templates/yaksh/show_video.html index 9c8d133..0151f6b 100644 --- a/yaksh/templates/yaksh/show_video.html +++ b/yaksh/templates/yaksh/show_video.html @@ -4,8 +4,16 @@ {% block title %} {{ learning_module.name }} {% endblock %} {% block script %} -<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"> +<script type="text/javascript"> + var player; + var contents_by_time = JSON.parse('{{ contents_by_time|safe }}'); + var loc = 0; + var video_time = []; +</script> +<script type="text/javascript" src="{% static 'yaksh/js/show_toc.js' %}"> </script> +<script src="{% static 'yaksh/js/jquery-sortable.js' %}"></script> +<script type="text/javascript" src="{% static 'yaksh/js/tinymce/js/tinymce/tinymce.min.js' %}"></script> {% endblock %} {% block main %} <div class="wrapper"> @@ -77,11 +85,9 @@ <!-- Page Content --> <div id="content"> - <button type="button" id="sidebarCollapse" class="btn btn-outline-info"> <i class="fa fa-navicon fa-lg"></i> </button> - <br><br> <ol class="breadcrumb"> <li class="breadcrumb-item"> @@ -95,7 +101,6 @@ {% endif %} </ol> <br> - {% if msg %} <center> <div class="alert alert-dismissible alert-warning"> @@ -127,41 +132,155 @@ </a> {% endif %} {% else %} <!-- Lesson body --> - <div class="col-md-6" style="width: 100%"> - {{lesson.html_data|safe}} + <!-- Lesson Table of contents --> + <div class="row"> + {% if lesson.video_path %} + <div class="col-md-8"> + <div class="card-body"> + {% with lesson.video_path|video_name as video %} + {% if video.1 == "others" %} + <video id="player" playsinline controls> + <source src="{{video.0}}" /> + </video> + {% else %} + <div id="player" data-plyr-provider="{{video.1}}" data-plyr-embed-id="{{video.0}}"></div> + {% endif %} + {% endwith %} + </div> + </div> + {% if toc %} + <div class="col-md-4"> + <div class="card"> + <div class="card-header"> + <a class="card-link" data-toggle="collapse" href="#toc-collapse"> + Table Of Contents <i class="fa fa-angle-down"></i> + </a> + </div> + <div class="collapse show" id="toc-collapse"> + <div class="card-body" id="toc" style="max-height: 400px; overflow-y: auto;"> + <table class="table table-responsive"> + {% for content in toc %} + {% with content.get_toc_text as toc_name %} + <tr> + <td> + <a href="#" onclick="select_toc(this);" data-toc="{{content.id}}" data-toc-type="{{content.content}}"> + {{ toc_name }} + </a> + </td> + <td> + {{content.get_content_display}} + </td> + <td id="toc_time_{{content.id}}"> + {{content.time}} + </td> + <input type="hidden" id="toc_{{content.id}}" value="{% url 'yaksh:get_marker_quiz' course.id content.id %}" data-content="{{content.content}}"/> + <input type="hidden" id="toc_desc_{{content.id}}" value="{{content.content_object.description|safe}}" data-content="{{content.content}}"/> + </tr> + {% endwith %} + {% empty %} + <center class=table-responsive> + <span class="badge badge-warning">No Table of contents added</span> + </center> + {% endfor %} + </table> + </div> + </div> + </div> + </div> + {% endif %} + {% endif %} + <div class="col-md-8"> + <form action="{% url 'stats:add_tracker' track_id %}" method="POST" id="track-form"> + {% csrf_token %} + <input type="hidden" name="video_duration" id="video_duration"> + <input type="hidden" name="current_video_time" id="current_video_time"> + </form> + <div class="card"> + <div class="card-header"><h3><strong>Lesson Description</strong></h3></div> + <div class="card-body"> + <div class="col" style="width: 100%"> + {{lesson.html_data|safe}} + </div> + <div class="card-body" id="topic-description"></div> + <div class="col-md-7"> + {% with lesson.get_files as lesson_files %} + {% if lesson_files %} + <div class="card"> + <div class="card-header"> + Files for this lesson + </div> + <div class="card-body"> + {% for f in lesson_files %} + <a href="{{f.file.url}}" class="list-group-item"> + {{forloop.counter}}.{{ f.file.name|file_title }} + </a> + {% endfor %} + </div> + </div> + {% endif %} + {% endwith %} + </div> + </div> + </div> + </div> + </div> <br> - <a href="{% url 'yaksh:next_unit' course.id learning_module.id current_unit.id %}" class="btn btn-info btn-lg" > - Next <i class="fa fa-step-forward"></i> + <a href="{% url 'yaksh:next_unit' course.id learning_module.id current_unit.id %}" class="btn btn-info btn-lg" id="next_unit"> + Next <i class="fa fa-step-forward"></i> </a> + {% endif %} + {% if state == 'lesson' %} + <div class="col-md-8"> + <hr> + <b><u>Comments:</u></b> + <form action="" method="POST" enctype='multipart/form-data'> + <div class="form-group"> + {% csrf_token %} + {{form.as_p}} + </div> + <input type="submit" value="Submit" class="btn btn-success btn-lg"> + </form> </div> - <br> - <div class="col-md-7"> - {% with lesson.get_files as lesson_files %} - {% if lesson_files %} - <div class="card"> - <div class="card-header"> - Files for this lesson + {% endif %} + <br> + {% if comments %} + {% for comment in comments %} + <div class="card mb-2 col-md-8"> + <div class="card-body p-3"> + <div class="row mb-3"> + <div class="col-6"> + <strong class="text-muted"> + {% if comment.anonymous %} + Anonymous + {% else %} + {{comment.creator.username}} + {% endif %} + </strong> + </div> + <div class="col-6 text-right"> + <small class="text-muted">{{comment.created_at}} {% if user.profile.is_moderator %} <a href="{% url 'yaksh:hide_comment' course.id comment.uid %}" class="fa fa-trash"></a>{% endif %}</small> + </div> </div> - <div class="card-body"> - {% for f in lesson_files %} - <a href="{{f.file.url}}" class="list-group-item"> - {{forloop.counter}}.{{ f.file.name|file_title }} + <p class="card-text description">{{comment.description|safe}}</p> + <div> + {% if comment.image %} + <a href="{{comment.image.url}}" target="_blank"> + <center><img src="{{comment.image.url}}" class="comment_image thumbnail" alt=""></center> </a> - {% endfor %} + {% endif %} </div> </div> - {% endif %} - {% endwith %} - </div> + </div> + {% endfor %} {% endif %} </div> </div> -<script type="text/javascript"> - $(document).ready(function () { - $('#sidebarCollapse').on('click', function () { - $('#sidebar').toggleClass('active'); - }); - }); -</script> +<div class="modal" tabindex="-1" role="dialog" id="myModal"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-body" id="lesson_quiz_question"></div> + </div> + </div> +</div> {% endblock %} diff --git a/yaksh/templates/yaksh/sidebar.html b/yaksh/templates/yaksh/sidebar.html new file mode 100644 index 0000000..7d0ac74 --- /dev/null +++ b/yaksh/templates/yaksh/sidebar.html @@ -0,0 +1,8 @@ +<!-- Sidebar --> +<div class="bg-light border-right" id="sidebar-wrapper"> + <div class="list-group list-group-flush"> + <a href="{% url 'yaksh:course_forum' course.id %}" class="list-group-item list-group-item-action {% if '/course_forum/' in request.path %}active{% endif %}">Course Forum</a> + <a href="{% url 'yaksh:lessons_forum' course.id %}" class="list-group-item list-group-item-action {% if '/lessons_forum/' in request.path %}active{% endif %}">Lessons Forum</a> + </div> +</div> +<!-- /#sidebar-wrapper --> |