Skip to content

Commit

Permalink
Merge pull request #1590 from Daksh119/ac-3-final
Browse files Browse the repository at this point in the history
Ac 3 course code and minor fixes
  • Loading branch information
prabhatsuman authored May 4, 2024
2 parents bf0d1e3 + 7a0fc39 commit 4dc7f39
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 59 deletions.
66 changes: 33 additions & 33 deletions FusionIIIT/applications/online_cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,75 +7,75 @@
urlpatterns = [

url(r'^$', views.viewcourses, name='viewcourses'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/$', views.course, name='course'),
# url(r'^(?P<course_code>[A-Z0-9]+)/edit_marks$', views.edit_marks, name='edit_marks'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/get_exam_data$', views.get_exam_data, name='get_exam_data'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/forum$', views.forum,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/$', views.course, name='course'),
# url(r'^(?P<course_code>[A-Za-z0-9]+)/edit_marks$', views.edit_marks, name='edit_marks'),
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/get_exam_data$', views.get_exam_data, name='get_exam_data'),
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/forum$', views.forum,
name='forum'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_reply$', views.ajax_reply,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/ajax_reply$', views.ajax_reply,
name='ajax_reply'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_new$', views.ajax_new,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/ajax_new$', views.ajax_new,
name='ajax_new'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_remove$', views.ajax_remove,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/ajax_remove$', views.ajax_remove,
name='ajax_remove'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/upload_assignment$', views.upload_assignment,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/upload_assignment$', views.upload_assignment,
name='upload_assignment'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/add_modules$', views.add_modules,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/add_modules$', views.add_modules,
name='add_modules'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/add_documents$', views.add_document,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/add_documents$', views.add_document,
name='add_document'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/add_assignment$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/add_assignment$',
views.add_assignment, name='add_assignment'),
# url(r'^(?P<course_code>[A-Z0-9]+)/add_video$', views.add_videos,
# url(r'^(?P<course_code>[A-Za-z0-9]+)/add_video$', views.add_videos,
# name='add_videos'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/delete/$', views.delete,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/delete/$', views.delete,
name='delete'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_assess$', views.ajax_assess,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/ajax_assess$', views.ajax_assess,
name='ajax_assess'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_feedback$', views.ajax_feedback,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/ajax_feedback$', views.ajax_feedback,
name='ajax_feedback'),
url(r'^quiz/(?P<quiz_id>[0-9]+)/$', views.quiz, name='quiz'),
url(r'^(?P<course_code>[A-Z0-9]+)/create_quiz/$', views.create_quiz, name='create_quiz'),
url(r'^(?P<course_code>[A-Z0-9]+)/edit_quiz/(?P<quiz_code>[0-9]+)/$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/create_quiz/$', views.create_quiz, name='create_quiz'),
url(r'^(?P<course_code>[A-Za-z0-9]+)/edit_quiz/(?P<quiz_code>[0-9]+)/$',
views.edit_quiz, name='edit_quiz'),
url(r'^(?P<course_code>[A-Z0-9]+)/edit_quiz/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/edit_quiz/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
views.edit_quiz_topic, name='edit_quiz_topic'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<quiz_id>[0-9]+)/add_question_topic$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<quiz_id>[0-9]+)/add_question_topic$',
views.add_question_topicwise, name='add_question_topicwise'),
url(r'^(?P<course_id>[0-9]+?)/(?P<quiz_id>[0-9]+)/add_questions_to_quiz$',
views.add_questions_to_quiz, name='add_questions_to_quiz'),
url(
r'^(?P<course_code>[A-Z0-9]+)/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_quiz_question$',
r'^(?P<course_code>[A-Za-z0-9]+)/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_quiz_question$',
views.remove_quiz_question, name='remove_quiz_question'),
url(r'^(?P<course_code>[A-Z0-9]+)/preview_quiz/(?P<quiz_code>[0-9]+)/$', views.preview_quiz,
url(r'^(?P<course_code>[A-Za-z0-9]+)/preview_quiz/(?P<quiz_code>[0-9]+)/$', views.preview_quiz,
name='preview_quiz'),
url(r'^(?P<course_code>[A-Z0-9]+)/edit_quiz_details/(?P<quiz_code>[0-9]+)/$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/edit_quiz_details/(?P<quiz_code>[0-9]+)/$',
views.edit_quiz_details, name='edit_quiz_details'),
url(r'^(?P<quiz_code>[0-9]+)/ajax$', views.ajax_q, name='ajax_q'),
url(r'^(?P<quiz_code>[0-9]+)/submit$', views.submit, name='submit'),
url(r'^(?P<course_code>[A-Z0-9]+)/remove_quiz$', views.remove_quiz,
url(r'^(?P<course_code>[A-Za-z0-9]+)/remove_quiz$', views.remove_quiz,
name='remove_quiz'),
url(r'^(?P<course_code>[A-Z0-9]+)/remove_bank$', views.remove_bank,
url(r'^(?P<course_code>[A-Za-z0-9]+)/remove_bank$', views.remove_bank,
name='remove_bank'),
url(r'^(?P<course_code>[A-Z0-9]+)/remove_topic$', views.remove_topic,
url(r'^(?P<course_code>[A-Za-z0-9]+)/remove_topic$', views.remove_topic,
name='remove_topic'),
url(r'^(?P<course_code>[A-Z0-9]+)/create_bank$', views.create_bank,
url(r'^(?P<course_code>[A-Za-z0-9]+)/create_bank$', views.create_bank,
name='create_bank'),
url(r'^(?P<course_code>[A-Z0-9]+)/create_topic$', views.create_topic,
url(r'^(?P<course_code>[A-Za-z0-9]+)/create_topic$', views.create_topic,
name='create_topic'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
views.edit_qb_topics, name='edit_qb_topics'),
url(r'^(?P<course_id>[0-9]+?)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)/add_question$',
views.add_question, name='add_question'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_question$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_question$',
views.remove_question, name='remove_question'),
url(r'^(?P<course_code>[A-Z0-9]+)/edit_bank/(?P<qb_code>[0-9]+)$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/edit_bank/(?P<qb_code>[0-9]+)$',
views.edit_bank, name='edit_bank'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/attendance$', views.submit_attendance,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/attendance$', views.submit_attendance,
name='submit_attendance'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/add_attendance$', views.add_attendance,
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/add_attendance$', views.add_attendance,
name='add_attendance'),
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/create_grading_scheme$',
url(r'^(?P<course_code>[A-Za-z0-9]+)/(?P<version>[\d.]+)/create_grading_scheme$',
views.create_grading_scheme, name='Create_grading_scheme'),
url(r'^admin/add_academic_calendar', views.add_academic_calendar, name='Add Calendar'),
url(r'^admin/update_calendar', views.update_calendar, name='Add Calendar'),
Expand Down
2 changes: 1 addition & 1 deletion FusionIIIT/applications/online_cms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def course(request, course_code, version):
gradingscheme_grades = {}

try:
student_grades = Student_grades.objects.select_related().filter(course_id=course)
student_grades = Student_grades.objects.select_related().filter(course_id=course).order_by('roll_no')
except Student_grades.DoesNotExist:
student_grades = {}

Expand Down
4 changes: 2 additions & 2 deletions FusionIIIT/templates/academic_procedures/academicfac.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</div>
</a>
</td>

{%if items.0.type != "Swayam" %}
<td class="collapsing"><a class="tiny ui positive animated button" style="background:#2590e2;" tabindex="0"
href="{% url 'online_cms:course' obj.course_id.code obj.course_id.version %}"
type="Submit" name="Submit">
Expand All @@ -156,7 +156,7 @@
</div>
</a>
</td>

{%endif %}
</tr>
{% endfor %}
</tbody>
Expand Down
57 changes: 34 additions & 23 deletions FusionIIIT/templates/coursemanagement/manageEval.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block manageEval %}
<div style="height:45em;overflow:auto;overflow-x:hidden;width:100%;">
<h3 class="ui dividing header">Manage Evaluations</h3>

<p>(Please Click on Generate button before uploading)</p>
<form class="ui form" id="manageEval" method="post" action="/ocms/{{ course.code }}/{{course.version}}/submit_marks">
{% csrf_token %}

Expand All @@ -17,7 +17,6 @@ <h3 class="ui dividing header">Manage Evaluations</h3>
<table class="ui fixed single line celled table" id="grading_table">
<thead>
<tr>
<th style="width: 25%;">S.No.</th>
<th style="width: 25%;">Roll No</th>
<th style="width: 25%;">Total Marks (%)</th>
<th style="width: 25%;">
Expand All @@ -30,7 +29,6 @@ <h3 class="ui dividing header">Manage Evaluations</h3>
{% if student_grades %}
{% for row in student_grades %}
<tr>
<td>{{forloop.counter}}</td>
<td>
<input type="text" readonly name="stu_marks" id="roll_no{{forloop.counter}}" value="{{row.roll_no}}" />
</td>
Expand All @@ -45,12 +43,11 @@ <h3 class="ui dividing header">Manage Evaluations</h3>
{% else%}
{% for stu in registered_students %}
<tr>
<td>{{forloop.counter}}</td>
<td>
<input type="text" readonly name="stu_marks" id="roll_no{{forloop.counter}}" value="{{stu.student_id.id.user.username}}" />
</td>
<td>
<input type="number" name="stu_marks" id="total_marks{{forloop.counter}}" value="" placeholder="Enter total marks" />
<input type="number" name="stu_marks" id="total_marks{{forloop.counter}}" value="0" placeholder="Enter total marks" />
</td>
<td>
<input name="stu_marks" id="grade{{forloop.counter}}" value="" placeholder="Add manually" />
Expand All @@ -60,7 +57,14 @@ <h3 class="ui dividing header">Manage Evaluations</h3>
{% endif %}
</tbody>
</table>
<input type="button" class="ui primary button" id="submit_grades" style ="float:right;" value="Upload">
<div style="float: right;">
<div class="load" id="load_submit_grades" style="display:none">
<span>Please wait...Grades are being saved!</span>
</div>
<br>
<input type="button" class="ui primary button" id="submit_grades" style="float: right;" value="Upload">
</div>

</div>
</form>
</div>
Expand Down Expand Up @@ -143,25 +147,28 @@ <h3 class="ui dividing header">Manage Evaluations</h3>
});
}


function searchByUsername() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("usernameSearchInput");
filter = input.value.toUpperCase();
table = document.getElementById("grading_table");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.getElementsByTagName("input")[0].value;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}

$(document).ready(function(){
$('#grading_table th').click(function(){
if ($(this).index() == 0) {
var table = $(this).parents('table').eq(0);
var rows = table.find('tr:gt(0)').toArray().sort(comparer($(this).index()));
this.asc = !this.asc;
if (!this.asc){rows = rows.reverse()}
for (var i = 0; i < rows.length; i++){table.append(rows[i])}
}
});
function comparer(index) {
return function(a, b) {
var valA = getCellValue(a, index), valB = getCellValue(b, index);
return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB);
};
}
}
function getCellValue(row, index){
// Get input value of the specified column
return $(row).find('input').eq(index).val();
}
});

// Function to handle form submission
function submitForm() {
Expand All @@ -170,15 +177,19 @@ <h3 class="ui dividing header">Manage Evaluations</h3>

var xhr = new XMLHttpRequest();
xhr.open(form.method, form.action, true);
$('#load_submit_grades').show();
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
successAlert('Success: ' + xhr.responseText); // Display success message
$('#load_submit_grades').hide();
} else {
alert('Error: ' + xhr.statusText); // Display error message
$('#load_submit_grades').hide();
}
};
xhr.onerror = function () {
alert('Request failed'); // Display request failure message
$('#load_submit_grades').hide();
};
xhr.send(formData);
}
Expand Down

0 comments on commit 4dc7f39

Please sign in to comment.