Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ac-7' into ac-7
Browse files Browse the repository at this point in the history
harshabonu authored Apr 22, 2024
2 parents 142a872 + b29516b commit 7b3b409
Showing 31 changed files with 3,119 additions and 1,098 deletions.
1 change: 1 addition & 0 deletions FusionIIIT/applications/academic_procedures/api/views.py
Original file line number Diff line number Diff line change
@@ -396,3 +396,4 @@ def approve_thesis(request, id):
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
else:
return Response({'error':'Cannot approve thesis'}, status=status.HTTP_400_BAD_REQUEST)

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.ui-alerts {
position: fixed;
/* width: 360px; */
z-index: 2060;
padding: 23px;
}

.ui-alerts.center {
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -222px;
}

.ui-alerts.top-right{
top: 20px;
right: 20px;
}

.ui-alerts.top-center{
top: 20px;
margin-left: -222px;
left: 50%;
}

.ui-alerts.top-left{
top: 20px;
left: 20px;
}

.ui-alerts.bottom-right{
bottom: 0;
right: 20px;
}
.ui-alerts.bottom-center{
bottom: 0;
margin-left: -222px;
left: 50%;
}

.ui-alerts.bottom-left{
bottom: 0;
left: 20px;
}

.ui-alerts.ui-alerts > .message > .content > .header {
padding-right: 13px;
}

@media (min-width:320px) {
/* smartphones, portrait iPhone, portrait 480x320 phones (Android) */
.ui-alerts.top-center{
margin-left: -163px;
}
}
@media (min-width:480px) {
/* smartphones, Android phones, landscape iPhone */
}
@media (min-width:600px) {
/* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */
}
@media (min-width:801px) {
/* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) {
/* big landscape tablets, laptops, and desktops */
}
@media (min-width:1281px) {
/* hi-res laptops and desktops */
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
$.suiAlert = function (permanents) {
var options = $.extend({
title: 'Semantic UI Alerts',
description: 'semantic ui alerts library',
// alert types 'info, success, error, warning'
type: "error",
time: 5,
position: "top-right",
icon: false,
}, permanents);

// set alert icon
if (options.icon === false) {
if (options.type == "info") {
// announcement
options.icon = "announcement";
} else if (options.type == "success") {
// checkmark, checkmark box
options.icon = "checkmark";
} else if (options.type == "error") {
// ban, remove, remove circle
options.icon = "remove";
} else if (options.type == "warning") {
// warning sign, warning circle
options.icon = "warning circle";
}
}

// set close animation
var close_anim = "drop";
if (options.position == "top-right") {
close_anim = "fly left";
} else if (options.position == "top-center") {
close_anim = "fly down";
} else if (options.position == "top-left") {
close_anim = "fly right";
} else if (options.position == "bottom-right") {
close_anim = "fly left";
} else if (options.position == "bottom-center") {
close_anim = "fly up";
} else if (options.position == "bottom-left") {
close_anim = "fly right";
}

// screen size check
var alert_size = '';
var screen_width = $(window).width();
if (screen_width < 425)
alert_size = 'mini';

var alerts_class = "ui-alerts." + options.position;
if (!$('body > .' + alerts_class).length) {
$('body').append('<div class="ui-alerts ' + options.position + '"></div>');
}

var _alert = $('<div class="ui icon floating ' + alert_size + ' message ' + options.type + '" id="alert"> <i class="' + options.icon + ' icon"></i> <i class="close icon" id="alertclose"></i> <div class="content"> <div class="header">' + options.title + '</div> <p>' + options.description + '</p> </div> </div>');
$('.' + alerts_class).prepend(_alert);

_alert.transition('pulse');

/**
* Close the alert
*/
$('#alertclose').on('click', function () {
$(this).closest('#alert').transition({
animation: close_anim,
onComplete: function () {
_alert.remove();
}
});
});

var timer = 0;
$(_alert).mouseenter(function () {
clearTimeout(timer);
}).mouseleave(function () {
alertHide();
});

alertHide();

function alertHide() {
timer = setTimeout(function () {
_alert.transition({
animation: close_anim,
duration: '2s',
onComplete: function () {
_alert.remove();
}
});
}, (options.time * 1000));
}
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion FusionIIIT/applications/online_cms/admin.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ class QuizResultAdmin(admin.ModelAdmin):
raw_id_fields = ("student_id",)

admin.site.register(CourseDocuments)

admin.site.register(CourseVideo)

admin.site.register(Quiz)
30 changes: 28 additions & 2 deletions FusionIIIT/applications/online_cms/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# from django import forms
import datetime
from datetime import time, timedelta
#import information from the models
from django import forms
# from .models import StoreMarks
from applications.academic_information.models import Student_attendance
from applications.academic_information.models import (Student_attendance,Timetable)


from .models import *
#the types of exam whose marks can be stored from edit marks in assessment, related to StoreMarks table in models
EXAM_TYPES= [
('quiz1', 'Quiz 1'),
@@ -112,4 +115,27 @@ def clean(self):

examtype = self.cleaned_data.get("exam_type")
enteredmarks = self.cleaned_data.get("entered_marks")
return self.cleaned_data
return self.cleaned_data

class GradingSchemeForm(forms.Form):
quiz_weightage = forms.DecimalField(label='Quiz', max_digits=10, decimal_places=2)
midsem_weightage = forms.DecimalField(label='Mid Semester', max_digits=10, decimal_places=2)
assignment_weightage = forms.DecimalField(label='Assignment', max_digits=10, decimal_places=2)
endsem_weightage = forms.DecimalField(label='End Semester', max_digits=10, decimal_places=2)
project_weightage = forms.DecimalField(label='Project', max_digits=10, decimal_places=2)


class AcademicTimetableForm(forms.ModelForm):
"""
the form to add a new academic timetable to the database.
It consist of year, programme and the timetable file upload
@attrubutes:
model - the model used is the Timetable class
fields - the fields shown in the form for the user to fill up is year, programme and timetable file upload
widgets - defining the id, required and placeholder of the filed in the form
"""
class Meta:
model = Timetable
fields = ('programme', 'batch', 'branch', 'time_table')
27 changes: 20 additions & 7 deletions FusionIIIT/applications/online_cms/helpers.py
Original file line number Diff line number Diff line change
@@ -5,12 +5,25 @@


def semester(roll):
month = datetime.now().month
sem = 0
if month >= 8 and month <= 12:
sem = 1
semester = (datetime.now().year-int(roll))*2+sem
return semester
if not roll.isnumeric():
s=''
s+='2'
s+='0'
s+=roll[0]
s+=roll[1]
month = datetime.now().month
sem = 0
if month >= 8 and month <= 12:
sem = 1
semester = (datetime.now().year-int(s))*2+sem
return semester
else:
month = datetime.now().month
sem = 0
if month >= 8 and month <= 12:
sem = 1
semester = (datetime.now().year-int(roll))*2+sem
return semester

#storing media files like images, videos and assignments
def create_thumbnail(course_code,course, row, name, ext, attach_str, thumb_time, thumb_size):
@@ -19,4 +32,4 @@ def create_thumbnail(course_code,course, row, name, ext, attach_str, thumb_time,
filename = filename + name.replace(' ', '-') + '-' + attach_str + '.png'
process = 'ffmpeg -y -i ' + filepath + ' -vframes ' + str(1) + ' -an -s '
process = process + thumb_size + ' -ss ' + str(thumb_time) + ' ' + filename
subprocess.call(process, shell=True)
subprocess.call(process, shell=True)
82 changes: 48 additions & 34 deletions FusionIIIT/applications/online_cms/urls.py
Original file line number Diff line number Diff line change
@@ -1,72 +1,86 @@
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url

from . import views
app_name = 'online_cms'
app_name = 'online_cms'

urlpatterns = [

url(r'^$', views.viewcourses, name='viewcourses'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/$', views.course, name='course'),
# url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit_marks$', views.edit_marks, name='edit_marks'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/get_exam_data$', views.get_exam_data, name='get_exam_data'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/forum$', views.forum,
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,
name='forum'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/ajax_reply$', views.ajax_reply,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_reply$', views.ajax_reply,
name='ajax_reply'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/ajax_new$', views.ajax_new,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_new$', views.ajax_new,
name='ajax_new'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/ajax_remove$', views.ajax_remove,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_remove$', views.ajax_remove,
name='ajax_remove'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/upload_assignment$', views.upload_assignment,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/upload_assignment$', views.upload_assignment,
name='upload_assignment'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/add_documents$', views.add_document,
url(r'^(?P<course_code>[A-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,
name='add_document'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/add_assignment$',
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/add_assignment$',
views.add_assignment, name='add_assignment'),
# url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/add_video$', views.add_videos,
# url(r'^(?P<course_code>[A-Z0-9]+)/add_video$', views.add_videos,
# name='add_videos'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/delete/$', views.delete,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/delete/$', views.delete,
name='delete'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/ajax_assess$', views.ajax_assess,
url(r'^(?P<course_code>[A-Z0-9]+)/(?P<version>[\d.]+)/ajax_assess$', views.ajax_assess,
name='ajax_assess'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/ajax_feedback$', views.ajax_feedback,
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/create_quiz/$', views.create_quiz, name='create_quiz'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit_quiz/(?P<quiz_code>[0-9]+)/$',
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]+)/$',
views.edit_quiz, name='edit_quiz'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit_quiz/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/(?P<quiz_id>[0-9]+)/add_question_topic$',
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/(?P<quiz_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_quiz_question$',
r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/preview_quiz/(?P<quiz_code>[0-9]+)/$', views.preview_quiz,
url(r'^(?P<course_code>[A-Z0-9]+)/preview_quiz/(?P<quiz_code>[0-9]+)/$', views.preview_quiz,
name='preview_quiz'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit_quiz_details/(?P<quiz_code>[0-9]+)/$',
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/remove_quiz$', views.remove_quiz,
url(r'^(?P<course_code>[A-Z0-9]+)/remove_quiz$', views.remove_quiz,
name='remove_quiz'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/remove_bank$', views.remove_bank,
url(r'^(?P<course_code>[A-Z0-9]+)/remove_bank$', views.remove_bank,
name='remove_bank'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/remove_topic$', views.remove_topic,
url(r'^(?P<course_code>[A-Z0-9]+)/remove_topic$', views.remove_topic,
name='remove_topic'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/create_bank$', views.create_bank,
url(r'^(?P<course_code>[A-Z0-9]+)/create_bank$', views.create_bank,
name='create_bank'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/create_topic$', views.create_topic,
url(r'^(?P<course_code>[A-Z0-9]+)/create_topic$', views.create_topic,
name='create_topic'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)$',
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/(?P<qb_code>[0-9]+)/(?P<topic_id>[0-9]+)/remove_question$',
url(r'^(?P<course_code>[A-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-z]+[0-9]+[A-z]?)/edit_bank/(?P<qb_code>[0-9]+)$',
url(r'^(?P<course_code>[A-Z0-9]+)/edit_bank/(?P<qb_code>[0-9]+)$',
views.edit_bank, name='edit_bank'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/attendance$', views.submit_attendance,
name='submit_attendance'),]
url(r'^(?P<course_code>[A-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,
name='add_attendance'),
url(r'^(?P<course_code>[A-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'),
url(r'^admin/add_timetable', views.add_timetable, name="add_timetable"),
url(r'^admin/delete_timetable', views.delete_timetable, name='delete_timetable'),
url(r'^(?P<course_code>[A-z0-9]+)/(?P<version>[\d.]+)/submit_marks$',views.submit_marks, name='submit_marks'),
]

1,058 changes: 791 additions & 267 deletions FusionIIIT/applications/online_cms/views.py

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions FusionIIIT/applications/programme_curriculum/api/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
from rest_framework import serializers
from applications.programme_curriculum.models import Programme, Discipline, Curriculum, Semester, Course, Batch, CourseSlot, CourseInstructor

# this is for Programme model ....


class ProgrammeSerializer(serializers.ModelSerializer):
discipline = serializers.SerializerMethodField()
programmes = serializers.SerializerMethodField()

def get_discipline(self, obj):
disciplines = obj.get_discipline_objects.all()
return ', '.join([discipline.name for discipline in disciplines]) # Join disciplines into a single string

def get_programmes(self, obj):
return obj.name

class Meta:
model = Programme
fields = [ 'programmes', 'discipline']



# this is for Discipline ...
class DisciplineSerializer(serializers.ModelSerializer):
class Meta:
model = Discipline
fields = "__all__"



# this is for Curriculum ....
# fields in fronted form --> name, version , batch , no of semester
class BatchSerializer(serializers.ModelSerializer):
class Meta:
model = Batch
fields = ['name', 'year']



class CurriculumBatchSerializer(serializers.ModelSerializer):
class Meta:
model = Curriculum
fields = ['name', 'version', 'no_of_semester']

class CurriculumSerializer(serializers.ModelSerializer):
class Meta:
model = Curriculum
fields = ['name', 'version', 'batches', 'no_of_semester']

def to_representation(self, instance):
representation = super().to_representation(instance)
batches = instance.batches.all()
representations = []
for batch in batches:
batch_representation = {
'name': representation['name'],
'version': representation['version'],
'no_of_semester': representation['no_of_semester'],
'batch': f"{representation['name']} {batch.year}"
}
representations.append(batch_representation)
return representations



class ProgrammeInfoSerializer(serializers.ModelSerializer):

class Meta:
model = Programme
fields = ['category', 'name', 'programme_begin_year']




# this is for Semester model ...
# no frontend form for this model ...
class SemesterSerializer(serializers.ModelSerializer):
class Meta:
model = Semester
fields = "__all__"



# this is for course model ...
# fields in frontend form --> coursecode, coursename, credit
class CourseSerializer(serializers.ModelSerializer):
class Meta:
model = Course
fields = "__all__"



# this is for Batch model ...
# field in frontend form --> name, discipline, year, curriculum .
# class BatchSerializer(serializers.ModelSerializer):
# class Meta:
# model = Batch
# fields = "__all__"


# for this 2 there is no frontend form ...


# CourseSlot model serializers ...
class CourseSlotSerializer(serializers.ModelSerializer):
class Meta:
model = CourseSlot
fields = "__all__"



# CourseInstructor model serializers ...
class CourseInstructorSerializer(serializers.ModelSerializer):
class Meta:
model = CourseInstructor
fields = "__all__"


class ProgrammePostSerializer(serializers.ModelSerializer):
class Meta:
model = Programme
fields = ['id', 'category', 'name', 'programme_begin_year']
141 changes: 141 additions & 0 deletions FusionIIIT/applications/programme_curriculum/api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
from rest_framework import status

from applications.programme_curriculum.models import (
Programme,
Discipline,
Curriculum,
Semester,
Course,
Batch,
CourseSlot,
CourseInstructor,
)

from .serializers import (
ProgrammeSerializer,
CurriculumSerializer,
ProgrammePostSerializer,
SemesterSerializer,
DisciplineSerializer,
CourseSerializer,
CourseSlotSerializer,
BatchSerializer,
ProgrammeInfoSerializer,
)

from applications.programme_curriculum.filters import (
CourseFilter,
BatchFilter,
CurriculumFilter,
)
from rest_framework import generics


@api_view(["GET", "POST"])
def view_ug_programmes(request):
"""
This function is used to display all the ug programmes offered by the institute.
"""
ug = Programme.objects.filter(category="UG")

ug_serializer = ProgrammeSerializer(ug, many=True)

return Response(ug_serializer.data)


@api_view(["GET", "POST"])
def view_pg_programmes(request):
"""
This function is used to display all the ug programmes offered by the institute.
"""
ug = Programme.objects.filter(category="PG")

ug_serializer = ProgrammeSerializer(ug, many=True)

return Response(ug_serializer.data)


@api_view(["GET", "POST"])
def view_phd_programmes(request):
"""
This function is used to display all the ug programmes offered by the institute.
"""
ug = Programme.objects.filter(category="PHD")

ug_serializer = ProgrammeSerializer(ug, many=True)

return Response(ug_serializer.data)


@api_view(["GET"])
def get_programme_info(request):
if request.method == "GET":
# Fetch all programmes
programmes = Programme.objects.all()

# Serialize the data
serializer = ProgrammeInfoSerializer(programmes, many=True)

# Return the serialized data as response
return Response(serializer.data)


@api_view(["GET"])
def view_curriculumns(request):
if request.method == "GET":
# Fetch all programmes
curriculums = Curriculum.objects.all()
serializer = CurriculumSerializer(curriculums, many=True)
return Response(serializer.data)


@api_view(["POST"])
def create_programme(request):
if request.method == "POST":
# Extract data from the request
category = request.data.get("category")
name = request.data.get("name")
programme_begin_year = request.data.get("programme_begin_year")
discipline_names = request.data.get(
"discipline"
) # Assuming discipline names are sent as a list

# Validate data
if not category or not name or not programme_begin_year or not discipline_names:
return Response(
{
"message": "Please provide category, name, programme_begin_year, and discipline in the request body"
},
status=status.HTTP_400_BAD_REQUEST,
)

# Create Programme object
programme = Programme.objects.create(
category=category, name=name, programme_begin_year=programme_begin_year
)

# Find Discipline objects and associate them with the Programme
disciplines = []
for discipline_name in discipline_names:
try:
discipline = Discipline.objects.get(name=discipline_name)
discipline.programmes.add(programme)
disciplines.append(discipline)
except Discipline.DoesNotExist:
# If discipline does not exist, you may handle it according to your application's logic
# For example, you can create the discipline here
pass

# Serialize the Programme object
serializer = ProgrammePostSerializer(programme)

return Response(
{
"programme": serializer.data,
"disciplines": [discipline.name for discipline in disciplines],
},
status=status.HTTP_201_CREATED,
)
12 changes: 11 additions & 1 deletion FusionIIIT/templates/academic_procedures/academicfac.html
Original file line number Diff line number Diff line change
@@ -90,6 +90,16 @@
</a>
</td>

<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">
<div class="visible content">MANAGE</div>
<div class="hidden content">
<i class="folder open icon"></i>
</div>
</a>
</td>

</tr>
{% endfor %}
</tbody>
@@ -181,4 +191,4 @@
</script>
<script type="text/javascript" src="{% static 'globals/js/datepicker.js' %}"></script>
<script type="text/javascript" src="{% static 'globals/js/tablesort.js' %}"></script>
{% endblock %}
{% endblock %}
9 changes: 9 additions & 0 deletions FusionIIIT/templates/academic_procedures/current_sem.html
Original file line number Diff line number Diff line change
@@ -94,6 +94,15 @@
<td>
<center>{{curr_sem.semester_no}}</center>
</td>
<td class="collapsing"><a class="tiny ui positive animated button" style="background:#2590e2;" tabindex="0"
href="{% url 'online_cms:course' items.1.code items.1.version %}"
type="Submit" name="Submit">
<div class="visible content">MANAGE</div>
<div class="hidden content">
<i class="folder open icon"></i>
</div>
</a>
</td>
</tr>
{% endfor %}
</tbody>
192 changes: 192 additions & 0 deletions FusionIIIT/templates/coursemanagement/academicinfo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{% extends 'globals/base.html' %}
{% load static %}


{% block title %}
Academic Information System
{% endblock %}

{% block css %}

<link href="https://cdn.rawgit.com/mdehoog/Semantic-UI/6e6d051d47b598ebab05857545f242caf2b4b48c/dist/semantic.min.css"
rel="stylesheet" type="text/css" />


<link rel="stylesheet" type="text/css" href="{% static 'semantic/dist/components/semantic-ui-alerts.css' %}">


{% endblock %}

{% block body %}
{% block navBar %}
{% include 'dashboard/navbar.html' %}
{% endblock %}
<style>
span.circle {
background: orange;
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
color: black;
display: inline-block;
font-weight: bold;
line-height: 25px;
margin-right: 5px;
text-align: center;
width: 25px;
}
</style>

<div class="ui stackable doubling grid">

<div class="column"></div>

<div class="three wide column">

{% block usercard %}
{% include 'globals/usercard.html' %}
{% endblock %}

<div class="ui divider"></div>

<div class="ui large fluid vertical pointing menu" style="max-width: 320px;">


<a class="active item" data-tab="third">
Academic Calendar
<i class="right floated chevron right icon"></i>
</a>
<a class="item" data-tab="fourth">
Time Tables

<i class="right floated chevron right icon"></i>
</a>

</div>
<br><br>

</div>

<div class="eight wide column">

<div class="ui active tab segment" data-tab="third">
{% block calendar %}
{% include 'coursemanagement/calendar.html' %}
{% endblock %}
</div>

<div class="ui tab segment" data-tab="fourth" style="margin-top: 0px;">
{% block timetable %}
{% include 'coursemanagement/timetable.html' %}
{% endblock %}
</div>

</div>

<div class="three wide column">

<!-- <div class="row">
<div class="ui tab segment" data-tab="ninth">
{% block filter_stu %}
{% include 'ais/filter_student.html' %}
{% endblock %}
</div>
</div> -->
</div>
</div>
{% endblock %}

{% block javascript %}

<script type="text/javascript" src="{% static 'fusion/js/tablesort.js' %}"></script>
<script type="text/javascript" src="{% static 'fusion/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'globals/js/semantic.min.js' %}"></script>
<script type="text/javascript" src="{% static 'semantic/dist/components/semantic-ui-alerts.js' %}"></script>

<!-- <script src="https://code.jquery.com/jquery-2.1.4.js"></script> -->
<script
src="https://cdn.rawgit.com/mdehoog/Semantic-UI/6e6d051d47b598ebab05857545f242caf2b4b48c/dist/semantic.min.js"></script>
<script type="text/javascript">

function successAlert(data){
$.suiAlert({
title: 'Success',
description: data,
type: 'success',
time: '3',
position: 'top-center',
});
}

function errAlert(data){
$.suiAlert({
title: 'Error',
description: data,
type: 'error',
time: '3',
position: 'top-center',
});
}

function delAlert(data){
$.suiAlert({
title: 'Deleted',
description: data,
type: 'info',
time: '3',
position: 'top-center',
});
}

$(document).on('click','.trash',function(){
var pk = $(this).attr('data-pk');
$.ajax({
type: 'POST',
url: '/ocms/admin/delete_timetable',
data: {
'pk': pk,
'csrfmiddlewaretoken': '{{ csrf_token }}'
},
success: function(data) {
delAlert(data);
$("#add_timetable_refresh").load(" #add_timetable_refresh > *");
},
error: function(data, err) {
errAlert(err);
}
});
});

$(document).on('click','#add_timetable',function() {
var data = new FormData();
var img = $('#time_table')[0].files;
for (var i = 0; i < img.length; i++) {
data.append("img", img[i]);
}
data.append('img', img);
var other_data = $('#form7').serializeArray();
$.each(other_data, function(key, input) {
data.append(input.name, input.value);
});
$('#load_add_timetable').show();
$.ajax({
url: "/ocms/admin/add_timetable",
processData: false,
contentType: false,
type: 'POST',
data: data,
success: function(data) {
$('#load_add_timetable').hide();
successAlert(data);
//location.reload();
$("#add_timetable_refresh").load(" #add_timetable_refresh > *");
},
error: function(data, err) {
$('#load_add_timetable').hide();
errAlert(data.responseText);
}
});
});
</script>

{% endblock %}
92 changes: 72 additions & 20 deletions FusionIIIT/templates/coursemanagement/addcontent.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
{% load static %} {% block addcontent %}

<!-- <div class="ui pointing secondary menu">
<a class="active item" data-tab="video">
Add Video
</a>
<a class="item" data-tab="slide">
Add Slide
</a>
</div> -->

<div class="ui active tab segment" data-tab="slide" id="add_doc_refresh">
<div class="ui active tab segment" data-tab="slides" id="add_doc_refresh" style="margin-top:14px;">
<h4 class="ui dividing header">Add a Module</h4>
<div class="ui blue button" id="add_module_button">
Add Module
</div>
<form class="ui form" id="module_form" enctype="multipart/form-data" style="display: none">
{% csrf_token %}
<div class="field" style="margin-top: 10px;">
<label>Module Name <font color="red" size="4.5">*</font></label>
<input placeholder="Module Name" name="module_name" type="text">
</div>
<!-- Add more fields if needed -->
<div class="field">
<div class="two wide field">
<label><br></label>
<div class="ui blue button" id="submit_module" style="display: flex; align-items: center;">
<div class="content">Save</div>
<span style="margin-left: 4px;"><i class="ui save icon"></i>
</div>
<div class="load" id="load_submit_module" style="display:none">
<span>Your module is being saved!</span>
</div>
</div>
</div>
</form>
<br>
<h4 class="ui dividing header">Add a Slide</h4>
<div class="ui blue button" id="add_slide_button">
Add Slides </div>

<form class="ui form" id="form2" enctype="multipart/form-data" style="display: none">
{% csrf_token %}
<div class="field" style="margin-top: 10px;">
<label>Module <font color="red" size="4.5">*</font></label>
<select name="module_id" class="ui dropdown">
{% for module in modules %}
<option value="{{ module.id }}">{{ module.module_name }}</option>
{% endfor %}
</select>
</div>

<div class="field">
<!-- code change starts -->
<div class="One field">
@@ -41,20 +66,47 @@ <h4 class="ui dividing header">Add a Slide</h4>
<div class="fields">
<div class="two wide field">
<label><br></label>
<div class="ui primary button" id="submit_doc">
Save
<i class="ui save icon right floated"></i>
<div class="ui blue button" id="submit_doc" style="display: flex; align-items: center;">
<div class="content">Save</div>
<span style="margin-left: 4px;"><i class="ui save icon"></i>
</div>
<div class="load" id="load_submit_doc" style="display:none">
<img src="{% static 'globals/img/loading.gif'%}" alt="#loading">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
</div>
</div>
</form>
<br>
<h4 class="ui dividing header">Report:</h4>
<br>
<h4 class="ui dividing header">Modules:</h4>

<div style="overflow:scroll;height:15em;overflow-x:hidden;">
<table class="ui fixed single line sortable celled table">
<thead>
<tr>
<th class="sorted ascending" style="width: 14%;">Sr.</th>
<th class="" style="width: 35%;">Name</th>
<th class="" style="width:20%">Action</th>
</tr>
</thead>

<tbody>

{% for module, slides in modules.items %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{module.module_name}}</td>
<td><a href="#"><i class="trash icon" data-pk="{{module.pk}}" id="dustbin_module_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a></td>
</tr>
{% endfor %}


</tbody>
</table>
</div>
<h4 class="ui dividing header">Slides:</h4>

<div style="overflow:scroll;height:20em;overflow-x:hidden;">
<table class="ui fixed single line sortable celled table">
@@ -69,15 +121,16 @@ <h4 class="ui dividing header">Report:</h4>

<tbody>

{% for slide in slides %}
{% for slide in slides1 %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{slide.document_name}}</td>
{% comment %} <h1>{{slide.document_url}}</h1> {% endcomment %}
<td ><button class="ui primary button" style="mae">
<a id='visualize' href="/{{slide.document_url}}"style="color:white;">{{slide.document_name}}</a>
<a id='visualize' href="{{slide.document_url}}"style="color:white;">{{slide.document_name}}</a>

</button></td>
<td><a href="#"><i class="trash dustbin outline icon" data-pk="{{slide.pk}}" id="dustbin_slide_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a></td>
<td><a href="#"><i class="trash icon" data-pk="{{slide.pk}}" id="dustbin_slide_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a></td>
</tr>
{% endfor %}

@@ -87,5 +140,4 @@ <h4 class="ui dividing header">Report:</h4>
</div>
</div>


{% endblock %}
170 changes: 97 additions & 73 deletions FusionIIIT/templates/coursemanagement/assessment.html
Original file line number Diff line number Diff line change
@@ -3,89 +3,93 @@
<a class="item active" data-tab="assignment">
Assignment
</a>
<!-- <a class="item" data-tab="exams">
<!-- <a class="item" data-tab="exams">
Exams
</a> -->
</div>
<div class="ui active tab segment" data-tab="assignment" style="overflow:scroll;overflow-y:hidden">
<h4 class="ui dividing header">{{course.course_name}}</h4>
<div class="ui tab segment active" id="refresh_asn_tab" data-tab="assignment">
<h4 class="ui dividing header">{{course.name}}</h4>

<div class="ui top attached tabular menu">
<div class="ui top attached tabular menu" style="overflow:auto;overflow-y:hidden;">
{% for assi in assignment %}
<a class="item tabheading" data-pk="{{forloop.counter}}" id="tab{{forloop.counter}}" data-tab="{{forloop.counter}}">{{assi.assignment_name}}</a>
<a class="item tabheading" data-pk="{{forloop.counter}}" id="tab{{forloop.counter}}" data-tab="{{forloop.counter}}">{{assi.assignment_name}}</a>
{% endfor %}
</div>
{% for assi in assignment %}
<div class="ui bottom attached tab tabdata segment" data-pk="{{forloop.counter}}" id="tabdata{{forloop.counter}}" data-tab="{{forloop.counter}}">
<table class="ui very basic collapsing celled table">
<thead>
<tr>
<th>Student</th>
<th>Total Marks &amp; Feedback</th>
<th>Download Assignment</th>
<th>Marks</th>
<th>Feedback</th>
</tr>
</thead>
<tbody>
{% for student_assi in student_assignment %}
{% if student_assi %}
{% if assi.pk == student_assi.0.assignment_id.pk %}
{% for sa in student_assi %}
<tr>
<td>
<h4 class="ui image header">
<img src="{% static 'globals/img/jenny.jpg' %}" class="ui rounded image">
<div class="content">
{{sa.student_id.id.user.first_name}} {{sa.student_id.id.user.last_name}}
<div class="sub header">{{sa.student_id.id.id}}
</div>
</div>
</h4>
</td>
<td>
<div class="ui form" style="margin-bottom:10px">
<div class="field">
<input type="text" placeholder="Enter Marks" onkeydown="assess_student(this)" data-assign="{{sa.pk}}" id="assign{{sa.pk}}">
</div>
</div>
<div class="ui form">
<div class="field">
<input type="text" placeholder="Enter Feedback" onkeydown="assess_feedback(this)" data-feedback="{{sa.pk}}" id="feedback{{sa.pk}}">
</div>
</div>
</td>
<td>
<a class="ui primary button" href="{{sa.upload_url}}">Download</a>
</td>
<td >
{% if sa.score %}
<span id="score{{sa.pk}}">{{sa.score}}</span>
{% else %}
-
{% endif %}
</td>
<td >
{% if sa.feedback %}
<p id="feedback{{sa.pk}}">{{sa.feedback}}</p>
{% else %}
-
</div>
{% for assi in assignment %}
<div class="ui bottom attached tab tabdata segment" data-pk="{{forloop.counter}}" id="tabdata{{forloop.counter}}" data-tab="{{forloop.counter}}">
<div class="ui input">
<input type="text" id="studentSearchInput" placeholder="Search Student" onkeyup="searchStudents()">
</div>
<table id="studentTable" class="ui very basic collapsing celled table">
<thead>
<tr>
<th>Student</th>
<th>Total Marks & Feedback</th>
<th>Download Assignment</th>
<th>Marks</th>
<th>Feedback</th>
</tr>
</thead>
<tbody>
{% for student_assi in student_assignment %}
{% if student_assi %}
{% if assi.pk == student_assi.0.assignment_id.pk %}
{% for sa in student_assi %}
<tr>
<td>
<h4 class="ui image header">
<div class="content">
{{sa.student_id.id.user.first_name}} {{sa.student_id.id.user.last_name}}
<div class="sub header">{{sa.student_id.id.id}}</div>
</div>
</h4>
</td>
<td>
<div class="ui text">Press 'Enter' to upload</div>
<div class="ui form" style="margin-bottom:10px">
<div class="field">
<input type="text" placeholder="Enter Marks" onkeydown="assess_student(this)" data-assign="{{sa.pk}}" id="assign{{sa.pk}}">
</div>
</div>
<div class="ui text">Press 'Enter' to upload</div>
<div class="ui form">
<div class="field">
<input type="text" placeholder="Enter Feedback" onkeydown="assess_feedback(this)" data-feedback="{{sa.pk}}" id="feedb{{sa.pk}}">
</div>
</div>
</td>
<td>
<a class="ui primary button" href="{{sa.upload_url}}" target="_blank">Download</a>
</td>
<td>
{% if sa.score %}
<span id="score{{sa.pk}}">{{sa.score}}</span>
{% else %}
-
{% endif %}
</td>
<td>
{% if sa.feedback %}
<p id="feedback{{sa.pk}}">{{sa.feedback}}</p>
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
</div>


<div class="ui tab segment" data-tab="exams" style="overflow:scroll;overflow-y:hidden">

<form class="ui large form" name="entermarks" id="entermarks" method="POST" action="/ocms/{{curriculum.course_code}}/edit_marks">
<form class="ui large form" name="entermarks" id="entermarks" method="POST" action="/ocms/{{course.code}}/edit_marks">

{% csrf_token %}
<div id="refresh_table">
@@ -131,6 +135,26 @@ <h4 class="ui image header">
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript">

function searchStudents() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("studentSearchInput");
filter = input.value.toUpperCase();
table = document.getElementById("studentTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0]; // Assuming student ID is in the first column
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}


$(function() {
$("#entermarks").submit(function(event) {
event.preventDefault();
@@ -159,7 +183,7 @@ <h4 class="ui image header">

$.ajax({
method: "POST",
url: '/ocms/{{curriculum.course_code}}/get_exam_data',
url: '/ocms/{{course.code}}/get_exam_data',
data: {"exam_name": exam_name, 'csrfmiddlewaretoken': csrf }
}).done(function (response) {
console.log(response); // changing the default value as the already saved marks
73 changes: 66 additions & 7 deletions FusionIIIT/templates/coursemanagement/attendance.html
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@
<a class=" item" data-tab="submit">
Submit Attendance
</a>

</div>


@@ -89,7 +89,7 @@
<tr>
<th style="width: 30%;">Roll No.</th>
<th style="width: 30%;">Total Present</th>
<th style="width: 30%;">Attendance Percentage</th>
</tr>
</thead>
<tbody>
@@ -105,7 +105,8 @@
{% for roll_no, present in present_attendance.items %}
<tr>
<td>{{roll_no}}</td>
<td>{{present}}</td>
<td>{{present.count}}</td>
<td>{{present.attendance_percent}}</td>
</tr>
{% endfor %}

@@ -115,7 +116,7 @@
</div>
</div>
<div class="ui tab segment" id="refresh_submit_tab" data-tab="submit">
<form class="ui form" id="attendance_submit" method="post" action="/ocms/{{curriculum.course_code}}/attendance">
<form class="ui form" id="attendance_submit" method="post" action="/ocms/{{course.code}}/{{course.version}}/attendance">
{% csrf_token %}

<div class="field">
@@ -150,23 +151,81 @@
</tbody>
</table>
</div>
<br>

<!-- <div class="one wide field">
<label><br></label>
<a href="#" onclick="document.getElementById('form199').submit();">
<div class="ui primary button">Save</div>
</a>
</div> -->
<input type="submit" class="ui primary button" id="submit_attendance" value="Upload">
<input type="submit" class="ui primary button" id="submit_attendance" value="Upload">

</form>
<br>
<h4 class="ui dividing header" style="margin-left: 2px;">Upload Attendance file</h4>
<div class="ui blue button" id="add_att_button">
Upload File
</div>
<form class="ui form" id="form5" enctype="multipart/form-data" style="display: none">
{% csrf_token %}
<div class="One field" style="margin-top: 10px;">
<div class="field">
<label> Name <font color="red" size="4.5">*</font></label>
<input placeholder="Name" name="name" type="text">
</div>
</div>
<div class="field">
<div class="fields">
<div class="six wide field">
<label>Attendance File <font color="red" size="4.5">*</font></label>
<input placeholder="Attendance File" id="doc1" name="doc1" accept="application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/pdf" type="file">
</div>
</div>
<div class="fields">
<div class="two wide field">
<label><br></label>
<div class="ui blue button" id="submit_att" style="display: flex; align-items: center;">
<div class="content">Save</div>
<span style="margin-left: 4px;"><i class="ui save icon"></i>
</div>
<div class="load" id="load_att_doc" style="display:none">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
</div>
</div>
</form>
</div>

{% endblock %}

<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'globals/js/semantic.min.js' %}"></script>
<script type="text/javascript" src="{% static 'semantic/dist/components/semantic-ui-alerts.js' %}"></script>
<script type="text/javascript">

function successAlert(data){
$.suiAlert({
title: 'Success',
description: data,
type: 'success',
time: '3',
position: 'top-center',
});
}

function errAlert(data){
$.suiAlert({
title: 'Error',
description: data,
type: 'error',
time: '3',
position: 'top-center',
});
}

$(function() {
$("#attendance_submit").submit(function(event) {
$("#refresh_attend_tab").load(" #refresh_attend_tab > *");
@@ -177,12 +236,12 @@
var posting = $.post( friendForm.attr('action'), friendForm.serialize() );
// if success:
posting.done(function(data) {
alert('Upload Successful');
successAlert('Upload Successful');
// window.location = "/academic-procedures/main/";
});
// if failure
posting.fail(function(data) {
alert('Failed');
errAlert('Failed');
// window.location = "/academic-procedures/main/";
});
});
167 changes: 167 additions & 0 deletions FusionIIIT/templates/coursemanagement/calendar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{% load static %}
{% block calendar %}
<h3 class="ui header">Academic Calendar</h3>
<table class="ui celled table">
<thead>
<tr>
<th>Description</th>
<th>Start Date</th>
<th>End Date</th>
<th>Action</th>
</tr>
</thead>
{% for i in academic_calendar %}
{% csrf_token %}
<tr>
<td>{{ i.description }}</td><input type="hidden" name="desc" value="{{ i.description }}">
<td>{{ i.from_date }}</td>
<td>{{ i.to_date }}</td>
<td><button class="ui button red icon" id="{{ forloop.counter }}"><i class="edit icon"></i></button>
<div class="ui modal {{forloop.counter}}">
<i class="close icon"></i>
<div class="header">
Academic Calendar
</div>
<div class="image content">
<div class="description">
<form class="ui form" id='update_calendar_{{forloop.counter}}' action='/ocms/update_calendar/'>
{% csrf_token %}
<div class="field">
<label>Description:</label>
<input name="description" value="{{ i.description }}" type="text">
<input type="text" name="prev_desc" value="{{i.description}}" hidden="true">
</div>
<div class="ui calendar" id="date1">
<label>From Date:</label><br>
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="date" placeholder="From Date" id="fe_date_{{forloop.counter}}" name="from_date" value="{{i.from_date|date:"Y-m-d"}}">
</div>
</div><br>
<div class="ui calendar" id="date2">
<label>To Date:</label><br>
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="date" placeholder="To Date" id="toe_date_{{forloop.counter}}" name="to_date" value="{{i.to_date|date:"Y-m-d"}}">
</div>
</div>
<hr>
<button class="ui button black create_btn" type="submit">Submit</button>
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript">
$(function () {
$("#update_calendar_{{forloop.counter}}").submit(function (event) {
event.preventDefault();
var friendForm = $(this);
var start_date = $('#fe_date_{{forloop.counter}}').val();
var end_date = $('#toe_date_{{forloop.counter}}').val();
console.log(start_date,end_date);
console.log(Date.parse(start_date),Date.parse(end_date));
console.log(Date.parse(start_date) > Date.parse(end_date));
console.log(" ");
if (Date.parse(start_date) > Date.parse(end_date)) {
alert("Start Date must be less than End date");
} else {
var posting = $.post(friendForm.attr('action'), friendForm.serialize());
posting.done(function (data) {
alert('Academic Calendar Updated');
location.reload();
});
posting.fail(function (data) {
alert('Failed to update');
});
}

});
});
</script>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript">
$(function () {
$("#{{forloop.counter}}").click(function () {
$(".{{forloop.counter}}").modal('show');
});
$(".{{forloop.counter}}").modal({
closable: true
});
});
</script>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}
<button class="ui button yellow create_btn" type="button" id="test">Add More</button>
<div class="ui modal test">
<i class="close icon"></i>
<div class="header">
Academic Calendar
</div>
<div class="image content">
<div class="description">
<form class="ui form" id='add_calendar' action='/ocms/add_academic_calendar/' method='post'>
{% csrf_token %}
<div class="field">
<label>Description:</label>
<input name="description" placeholder="Enter the description..." type="text">
</div>
<div class="ui calendar" id="date1">
<label>From Date:</label><br>
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="date" placeholder="From Date" id="f_date" name="from_date">
</div>
</div><br>
<div class="ui calendar" id="date2">
<label>To Date:</label><br>
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="date" placeholder="To Date" id="to_date" name="to_date">
</div>
</div>
<hr>
<button class="ui button black create_btn" type="submit">Submit</button>
</form>
</div>
</div>
</div>
<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript">
$(function () {
$("#test").click(function () {
$(".test").modal('show');
});
$(".test").modal({
closable: true
});
});
$(function () {
$("#add_calendar").submit(function (event) {
event.preventDefault();
var friendForm = $(this);
var start_date = $('#f_date').val();
var end_date = $('#to_date').val();
console.log(start_date,end_date);
console.log(Date.parse(start_date),Date.parse(end_date));
console.log(Date.parse(start_date) > Date.parse(end_date));
console.log(" ");
if (Date.parse(start_date) > Date.parse(end_date)) {
alert("Start Date must be less than End date");
} else {
var posting = $.post(friendForm.attr('action'), friendForm.serialize());
posting.done(function (data) {
alert('Academic Calendar Updated');
location.reload()
});
posting.fail(function (data) {
alert('Failed to update');
});
}

});
});
</script>
28 changes: 15 additions & 13 deletions FusionIIIT/templates/coursemanagement/comments.html
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
{% load humanize %}
{% block comments %}

<div class="ui segment comments" style="height:45em;overflow:scroll;overflow-x:hidden;">
<h3 class="ui dividing header">Comments</h3>
<div class="ui segment comments" id="comments_refresh" style="height:68vh; overflow:auto;overflow-x:hidden;">
<h3 class="ui dividing header">Announcements</h3>
{% for key, value in answers.items %}
<div class="question" id="question{{key.pk}}">
<div class="comment comment_q" id="comment{{key.pk}}">
@@ -15,16 +15,16 @@ <h3 class="ui dividing header">Comments</h3>
<div class="metadata">
<span class="date">{{key.comment_time | naturaltime }}</span>
</div>

<div class="text">
<p>{{key.comment}}</p>
</div>
<div class="actions">
<a class="reply remove_q" data-user="{{key.commenter_id.user.pk}}" data-pk="{{key.pk}}" id="remove{{key.pk}}" name="remove{{key.pk}}">Remove</a>
</div>
</div>
<br>
</div>
<div class="comments answer" style="padding-left:10px;padding-bottom:10px">
<!-- <div class="comments answer" style="padding-left:10px;padding-bottom:10px">
{% for v in value %}
<div class="comment comment_r" id="comment{{v.forum_reply.pk}}">
<a class="avatar">
@@ -44,25 +44,27 @@ <h3 class="ui dividing header">Comments</h3>
</div>
</div>
{% endfor %}
<form class="ui form" id="{{key.pk}}" data-pk="{{key.pk}}" method="post">
{% comment %} <form class="ui form" id="{{key.pk}}" data-pk="{{key.pk}}" method="post">
{% csrf_token %}
<div class="field">
<input type="text" name="comment{{key.pk}}" placeholder="Enter Your Comment">
<input type="text" name="comment{{key.pk}}" placeholder="Enter Your Announcement">
</div>
<input type="submit" class="ui blue submit button submit_r" data-pk="{{key.pk}}" name="submit" value="Reply" />
</form>
</div>
</form> {% endcomment %}
</div> -->
</div>
{% endfor %}

</div>
{% if Lecturer == 1%}
<form class="ui form" id="new" method="post" style="margin-bottom:10px">
{% csrf_token %}
<div class="field">
<input type="text" name="new_comment" placeholder="Enter Your Comment">
<input type="text" name="new_comment" placeholder="Enter Your Announcement">
</div>
<input type="submit" class="ui blue submit button submit_new" data-pk="{{key.pk}}" name="submit" value="Comment">
<input type="submit" class="ui blue submit button submit_new" data-pk="{{key.pk}}" name="submit" value="Send">
</form>
</div>

{% endif %}


{% endblock %}
{% endblock %}
506 changes: 13 additions & 493 deletions FusionIIIT/templates/coursemanagement/coursemanagement1.html

Large diffs are not rendered by default.

266 changes: 266 additions & 0 deletions FusionIIIT/templates/coursemanagement/gradingscheme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'semantic/dist/components/semantic-ui-alerts.css' %}">

{% endblock %}
{% block gradingScheme %}
<div style="height:45em;overflow:auto;overflow-x:hidden;width:100%;">
<h3 class="ui dividing header">Create Grading Scheme</h3>

<form class="ui form" id="gradingScheme_submit" method="post" action="/ocms/{{ course.code }}/{{course.version}}/create_grading_scheme">
{% csrf_token %}

<div style="overflow:auto;overflow-x:hidden; margin-right:0.75em;">
<table class="ui fixed single line sortable celled table">
<thead>
<tr>
<th style="width: 30%;">Type of Evaluation</th>
<th style="width: 30%;">Weightage (%)</th>
</tr>
</thead>
<tbody id="grading_scheme_table">
{% comment %} {% if gradingscheme is defined %} {% endcomment %}
{% for eval in gradingscheme %}
<tr><td style="padding-left:28px;">{{eval.type_of_evaluation}}</td><td> <input type="number" name="{{eval.type_of_evaluation}}" id="{{eval.type_of_evaluation}}" value= {{eval.weightage}} /></tr>
{% endfor %}
{% comment %} {% endif %} {% endcomment %}

<tr id="addItem_Row">
<td style="overflow:visible; display:flex; ">
<input type="text" style="width:80%;" name="add_eval_type" id="add_eval_type" value="" placeholder="Enter New Evaluation" />
{% comment %} <select class="ui selection dropdown" id="add_item" >;
<option class="item" name="add_item" value="Assignment">Assignment</option>
<option class="item" name="add_item" value="Lab">Lab</option>
<option class="item" name="add_item" value="Project">Project</option>
<option class="item" name="add_item" value="Quiz">Quiz</option>
<option class="item" name="add_item" value="Quiz_2">Quiz_2</option>
<option class="item" name="add_item" value="Mid-Sem Exam">Mid-Sem Exam</option>
<option class="item" name="add_item" value="End-Sem Exam">End-Sem Exam</option>
<option class="item" name="add_item" value="Attendance">Attendance</option>
</select> {% endcomment %}
</td>
<td >
<input type="number" style="width:80%; float:left;" name="add_item_wtg" id="" value="" placeholder="Enter Weightage" />
<input type="button" style="float:right;" class="ui primary button tiny" id="add_item_btn" style="display: flex; justify-content: center;" value="Add">
</td>
</tr>
{% comment %} <tr>
<td>Quiz</td>
<td>
<input type="number" name="quiz_weightage" id="quiz_weightage" value="{{ quiz_weightage }}" />
</td>
</tr>
<tr>
<td>Mid Semester</td>
<td>
<input type="number" name="midsem_weightage" id="midsem_weightage" value="{{ midsem_weightage }}" />
</td>
</tr>
<tr>
<td>Assignment</td>
<td>
<input type="number" name="assignment_weightage" id="assignment_weightage" value="{{ assignment_weightage }}" />
</td>
</tr>
<tr>
<td>End Semester</td>
<td>
<input type="number" name="endsem_weightage" id="endsem_weightage" value="{{ endsem_weightage }}" />
</td>
</tr>
<tr>
<td>Project</td>
<td>
<input type="number" name="project_weightage" id="project_weightage" value="{{ project_weightage }}" />
</td>
</tr> {% endcomment %}

</tbody>
</table>
</div>
<div style="overflow-x:hidden; margin-top:15px; margin-right:0.75em;">
<table class="ui fixed single line sortable celled table">
<thead>
<tr>
<th style="width: 30%;">Grade</th>
<th style="width: 30%;">Lower Bound (%)</th>
<th style="width: 30%;">Upper Bound (%)</th>
</tr>
</thead>
<tbody id="grade_table">
<tr>
<td>O</td>
<td>
<input type="number" name="O_Lower" id="O_Lower" value="{{ gradingscheme_grades.O_Lower }}" />
</td>
<td>
<input type="number" name="O_Upper" id="O_Upper" value="{{ gradingscheme_grades.O_Upper }}" />
</td>
</tr>
<tr>
<td>A+</td>
<td>
<input type="number" name="A_plus_Lower" id="A_plus_Lower" value="{{ gradingscheme_grades.A_plus_Lower }}" />
</td>
<td>
<input type="number" name="A_plus_Upper" id="A_plus_Upper" value="{{ gradingscheme_grades.A_plus_Upper }}" />
</td>
</tr>
<tr>
<td>A</td>
<td>
<input type="number" name="A_Lower" id="A_Lower" value="{{ gradingscheme_grades.A_Lower }}" />
</td>
<td>
<input type="number" name="A_Upper" id="A_Upper" value="{{ gradingscheme_grades.A_Upper }}" />
</td>
</tr>
<tr>
<td>B+</td>
<td>
<input type="number" name="B_plus_Lower" id="B_plus_Lower" value="{{ gradingscheme_grades.B_plus_Lower }}" />
</td>
<td>
<input type="number" name="B_plus_Upper" id="B_plus_Upper" value="{{ gradingscheme_grades.B_plus_Upper }}" />
</td>
</tr>
<tr>
<td>B</td>
<td>
<input type="number" name="B_Lower" id="B_Lower" value="{{ gradingscheme_grades.B_Lower }}" />
</td>
<td>
<input type="number" name="B_Upper" id="B_Upper" value="{{ gradingscheme_grades.B_Upper }}" />
</td>
</tr>
<tr>
<td>C+</td>
<td>
<input type="number" name="C_plus_Lower" id="C_plus_Lower" value="{{ gradingscheme_grades.C_plus_Lower }}" />
</td>
<td>
<input type="number" name="C_plus_Upper" id="C_plus_Upper" value="{{ gradingscheme_grades.C_plus_Upper }}" />
</td>
</tr>
<tr>
<td>C</td>
<td>
<input type="number" name="C_Lower" id="C_Lower" value="{{ gradingscheme_grades.C_Lower }}" />
</td>
<td>
<input type="number" name="C_Upper" id="C_Upper" value="{{ gradingscheme_grades.C_Upper }}" />
</td>
</tr>
<tr>
<td>D+</td>
<td>
<input type="number" name="D_plus_Lower" id="D_plus_Lower" value="{{ gradingscheme_grades.D_plus_Lower }}" />
</td>
<td>
<input type="number" name="D_plus_Upper" id="D_plus_Upper" value="{{ gradingscheme_grades.D_plus_Upper }}" />
</td>
</tr>
<tr>
<td>D</td>
<td>
<input type="number" name="D_Lower" id="D_Lower" value="{{ gradingscheme_grades.D_Lower }}" />
</td>
<td>
<input type="number" name="D_Upper" id="D_Upper" value="{{ gradingscheme_grades.D_Upper }}" />
</td>
</tr>
<tr>
<td>F</td>
<td>
<input type="number" name="F_Lower" id="F_Lower" value="{{ gradingscheme_grades.F_Lower }}" />
</td>
<td>
<input type="number" name="F_Upper" id="F_Upper" value="{{ gradingscheme_grades.F_Upper }}" />
</td>
</tr>

</tbody>
</table>
</div>

<input type="button" class="ui primary button" id="submit_gradingScheme" style="float:right; margin-top:15px; margin-right:0.75em;" value="Upload">

</form>


</div>

<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'globals/js/semantic.min.js' %}"></script>
<script type="text/javascript" src="{% static 'semantic/dist/components/semantic-ui-alerts.js' %}"></script>

<script type="text/javascript">
// Function to handle add_item_btn
//var no_of_items = 0;
add_item_btn.addEventListener('click', function() {
//no_of_items=no_of_items+1;
// Your code to execute when the input is clicked
const add_item_btn = document.getElementById('add_item_btn');
const tbody = document.getElementById('grading_scheme_table');
const addItem_Row = document.getElementById('addItem_Row');

const itemType = document.getElementById('addItem_Row').childNodes[1].childNodes[1] ;
const itemWtg = document.getElementById('addItem_Row').childNodes[3].childNodes[1] ;

if (itemType.value == '') {return}
if (itemWtg.value == '') {return}

const newElement = document.createElement('tr');
newElement.id = 'new_row';
newElement.innerHTML = `<td style="padding-left:28px;"><input value="` + itemType.value + `"></input></td> <td> <input style="width:85%;" type="number" name="`+itemType.value+`" id="`+itemType.value+`" value= `+itemWtg.value+` /> <div class="ui button" style="width:10px; margin-right:5px; float:right;" onclick="const new_row = document.getElementById('new_row'); new_row.parentNode.removeChild(new_row);" > <i style="margin-left:-8px;" class="close icon"></i> </div> </td> `;
//console.log(itemType.value + ` has weightage `+ itemWtg.value +`%`);
//console.log(newElement.innerHTML = `<td>` + itemType.value + `</td> <td> <input type="number" name="`+itemType.value+`_weightage" id="`+itemType.value+`_weightage" value="`+itemWtg.value+`" /> `);
//console.log('Input clicked!');
tbody.insertBefore(newElement, addItem_Row);
itemType.value = ''
itemWtg.value = ''
});

function successAlert(data){
$.suiAlert({
title: 'Success',
description: data,
type: 'success',
time: '3',
position: 'top-center',
});
}


// Function to handle form submission
function submitForm() {
var form = document.getElementById("gradingScheme_submit");
var formData = new FormData(form);

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

document.getElementById("submit_gradingScheme").addEventListener("click", submitForm);

document.getElementById("submit_gradingScheme").addEventListener("click", function() {
setTimeout(function() {
location.reload();
}, 3000);
});
</script>



{% endblock %}
192 changes: 192 additions & 0 deletions FusionIIIT/templates/coursemanagement/manageEval.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'semantic/dist/components/semantic-ui-alerts.css' %}">

{% endblock %}
{% block manageEval %}
<div style="height:45em;overflow:auto;overflow-x:hidden;width:100%;">
<h3 class="ui dividing header">Manage Evaluations</h3>

<form class="ui form" id="manageEval" method="post" action="/ocms/{{ course.code }}/{{course.version}}/submit_marks">
{% csrf_token %}

<div style="overflow-x:hidden; margin-top:15px; margin-right:0.75em;">
<!-- <div class="ui fluid input">
<input type="text" id="usernameSearchInput" placeholder="Search by Roll No." onkeyup="searchByUsername()">
</div> -->
<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%;">
<div style="float:left; margin-top:8px;">Grade</div>
<div class="ui button green" style="float:right;" id="generate_btn"> Generate </div>
</th>
</tr>
</thead>
<tbody id="grade_table">
{% 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>
<td>
<input type="number" name="stu_marks" id="total_marks{{forloop.counter}}" value="{{row.total_marks}}" placeholder="Enter total marks" />
</td>
<td>
<input name="stu_marks" id="grade{{forloop.counter}}" value="{{row.grade}}" placeholder="Add manually" />
</td>
</tr>
{% endfor %}
{% 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" />
</td>
<td>
<input name="stu_marks" id="grade{{forloop.counter}}" value="" placeholder="Add manually" />
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
<input type="button" class="ui primary button" id="submit_grades" style ="float:right;" value="Upload">
</div>
</form>
</div>

<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'globals/js/semantic.min.js' %}"></script>
<script type="text/javascript" src="{% static 'semantic/dist/components/semantic-ui-alerts.js' %}"></script>

<script type="text/javascript">
let O_Lower = {{gradingscheme_grades.O_Lower}};
let O_Upper = {{gradingscheme_grades.O_Upper}};
let A_Lower = {{gradingscheme_grades.A_Lower}};
let A_Upper = {{gradingscheme_grades.A_Upper}};
let A_plus_Lower = {{gradingscheme_grades.A_plus_Lower}};
let A_plus_Upper = {{gradingscheme_grades.A_plus_Upper}};
let B_Lower = {{gradingscheme_grades.B_Lower}};
let B_Upper = {{gradingscheme_grades.B_Upper}};
let B_plus_Lower = {{gradingscheme_grades.B_plus_Lower}};
let B_plus_Upper = {{gradingscheme_grades.B_plus_Upper}};
let C_Lower = {{gradingscheme_grades.C_Lower}};
let C_Upper = {{gradingscheme_grades.C_Upper}};
let C_plus_Lower = {{gradingscheme_grades.C_plus_Lower}};
let C_plus_Upper = {{gradingscheme_grades.C_plus_Upper}};
let D_Lower = {{gradingscheme_grades.D_Lower}};
let D_Upper = {{gradingscheme_grades.D_Upper}};
let D_plus_Lower = {{gradingscheme_grades.D_plus_Lower}};
let D_plus_Upper = {{gradingscheme_grades.D_plus_Upper}};
let F_Lower = {{gradingscheme_grades.F_Lower}};
let F_Upper = {{gradingscheme_grades.F_Upper}};

const generate_btn = document.getElementById('generate_btn');
generate_btn.addEventListener('click', function() {
// Your code to execute when the input is clicked
let num = 1;
while (document.getElementById('total_marks'+num.toString())) {
let marks = document.getElementById('total_marks'+num.toString());
let grade = document.getElementById('grade'+num.toString());
if (marks.value >= O_Lower && marks.value <= O_Upper) {
grade.value = "O";
}
else if (marks.value >= A_plus_Lower && marks.value <= A_plus_Upper) {
grade.value = "A+";
}
else if (marks.value >= A_Lower && marks.value <= A_Upper) {
grade.value = "A";
}
else if (marks.value >= B_plus_Lower && marks.value <= B_plus_Upper) {
grade.value = "B+";
}
else if (marks.value >= B_Lower && marks.value <= B_Upper) {
grade.value = "B";
}
else if (marks.value >= C_plus_Lower && marks.value <= C_plus_Upper) {
grade.value = "C+";
}
else if (marks.value >= C_Lower && marks.value <= C_Upper) {
grade.value = "C";
}
else if (marks.value >= D_plus_Lower && marks.value <= D_plus_Upper) {
grade.value = "D+";
}
else if (marks.value >= D_Lower && marks.value <= D_Upper) {
grade.value = "D";
}
else if (marks.value >= F_Lower && marks.value <= F_Upper) {
grade.value = "F";
}

num = num + 1;
}
});

function successAlert(data){
$.suiAlert({
title: 'Success',
description: data,
type: 'success',
time: '3',
position: 'top-center',
});
}


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";
}
}
}
}

// Function to handle form submission
function submitForm() {
var form = document.getElementById("manageEval");
var formData = new FormData(form);

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

// Attach submitForm function to the click event of the submit button
document.getElementById("submit_grades").addEventListener("click", submitForm);
</script>



{% endblock %}
22 changes: 9 additions & 13 deletions FusionIIIT/templates/coursemanagement/submitassignments.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load static %} {% block submitassignments %}

<link rel="stylesheet" type="text/css" href="{% static 'globals/css/demo.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'globals/css/component.css' %}" />
<!-- <link rel="stylesheet" type="text/css" href="{% static 'globals/css/component.css' %}" /> -->
<script>
(function(e, t, n) {
var r = e.querySelectorAll("html")[0];
@@ -21,7 +21,6 @@
Objective
</a> -->
</div>
<h3>Input</h3>

<div class="ui active tab" data-tab="uploadassignment" id="student_assign_refresh">

@@ -31,7 +30,7 @@ <h4 class="ui dividing header">Submit Assignment</h4>
<div class="field">
<label> Topic</label>
<select class="ui selection dropdown" id="assign_topic">
{% for assign in assignment %}
{% for assign in submitable_assignment %}
<option class="item" name="assign_topic" value="{{assign.pk}}">{{assign.assignment_name}}</option>
{% endfor %}
</select>
@@ -65,7 +64,7 @@ <h4 class="ui dividing header">Submit Assignment</h4>
<a class="ui basic blue left pointing label">Save</a>
</div>
<div class="load" id="load_submit_assign" style="display:none">
<img src="{% static 'globals/img/loading.gif'%}" alt="#loading">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
@@ -74,11 +73,10 @@ <h4 class="ui dividing header">Submit Assignment</h4>
</div>
</form>
<br>
<div style="overflow:scroll;height:20em;overflow-x:hidden;">
<div style="overflow:scroll;height:10em;overflow-x:hidden;">
<table class="ui fixed single line sortable celled table">
<thead>
<tr>
<th class="sorted ascending" style="width: 7%;">Sr.</th>
<th class="" style="width: 83%;">Name</th>
<th class="" style="width:10%">Action</th>
</tr>
@@ -92,9 +90,8 @@ <h4 class="ui dividing header">Submit Assignment</h4>
{% for s in sa %}
{% if request.user.username == s.student_id.id.user.username %}
<tr>
<td></td>
<td>{{assi.assignment_name}}</td>
<td> <a href="#"><i class="trash dustbin outline icon" data-pk="{{s.pk}}" id="dustbin_stuassignment_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a> </td>
<td> <a href="#"><i class="trash icon" data-pk="{{s.pk}}" id="dustbin_stuassignment_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a> </td>
</tr>
{% endif %}
{% endfor %}
@@ -164,7 +161,7 @@ <h4 class="ui dividing header">Create Assignment</h4>
<a class="ui basic blue left pointing label">Save</a>
</div>
<div class="load" id="load_add_assignment" style="display:none">
<img src="{% static 'globals/img/loading.gif'%}" alt="#loading">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
@@ -188,15 +185,14 @@ <h4 class="ui dividing header">Report:</h4>

<tbody>

{% for assi in assignment %}
{% for assi in assignment1 %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{assi.assignment_name}}</td>
<td>{{assi.submit_date}}</td>
<td> <a href="/{{assi.assignment_url}}"> <i class="download icon" style="font-size:1.3vw;color:blue"></i></a><br>
<td> <a href="{{assi.assignment_url}}"> <i class="download icon" style="font-size:1.3vw;color:blue"></i></a><br>
</td>
<td> <a href="#"><i class="trash dustbin outline icon" data-pk="{{assi.pk}}" id="dustbin_lecassignment_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a></td>

<td> <a href="#"><i class="trash icon" data-pk="{{assi.pk}}" id="dustbin_lecassignment_{{forloop.counter}}"style="font-size:1.3vw;color:red;"></i></a></td>

</tr>
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load static %} {% block submitassignments %}

<link rel="stylesheet" type="text/css" href="{% static 'globals/css/demo.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'globals/css/component.css' %}" />
<!-- <link rel="stylesheet" type="text/css" href="{% static 'globals/css/component.css' %}" /> -->
<script>
(function(e, t, n) {
var r = e.querySelectorAll("html")[0];
@@ -92,7 +92,7 @@ <h4 class="ui dividing header">Submit Assignment</h4>
<a class="ui basic blue left pointing label">Save</a>
</div>
<div class="load" id="load_submit_assign" style="display:none">
<img src="{% static 'globals/img/loading.gif'%}" alt="#loading">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
@@ -191,7 +191,7 @@ <h4 class="ui dividing header">Create Assignment</h4>

</div>
<div class="load" id="load_add_assignment" style="display:none">
<img src="{% static 'globals/img/loading.gif'%}" alt="#loading">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>
122 changes: 122 additions & 0 deletions FusionIIIT/templates/coursemanagement/timetable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{% load static %}
{% block timetable %}

<div class="ui pointing secondary menu">
<a class="active item" data-tab="academic">
Academic Time Table
</a>
</div>

<div class="ui active tab segment" data-tab="academic" id="add_timetable_refresh">

<h4 class="ui dividing header">Add Time Table</h4>

<form class="ui form" method="POST" id="form7" enctype="multipart/form-data">
{% csrf_token %}

<div class="field">
<label>Programme</label>
<select name="programme" id="programme" required>
<option value="B.Tech">B.Tech</option>
<option value="B.Des">B.Des</option>
<option value="M.Des">M.Des</option>
<option value="M.Tech">M.Tech</option>
<option value="Phd">PhD</option>
</select>
</div>

<div class="field">
<label>Batch</label>
<input type="number" id="batch" name="batch" required>
</div>

<div class="field">
<label>Branch</label>
<select name="branch" id="branch" required>
<option value="CSE">CSE</option>
<option value="ECE">ECE</option>
<option value="ME">ME</option>
<option value="Design">Design</option>
<option value="Common">Common</option>
</select>
</div>

<div class="field">
<label>Upload Time Table</label>
<input placeholder="Upload Time Table" type="file" id="time_table" name="time_table" required>
</div>

<div class="field">
<div class="ui labeled button" id="add_timetable" tabindex="0">
<div class="ui blue button">
<i class="upload icon"></i>
</div>
<a class="ui basic blue left pointing label">Upload</a>
</div>
<div class="load" id="load_add_timetable" style="display:none">
<!-- <img src="{% static 'globals/img/loading.gif'%}" alt="#loading"> -->
<span >Your file is being uploaded!</span>
</div>
</div>


</form>
{% if timetable %}
<form class="ui form" method="post" enctype="multipart/form-data" action="/ocms/delete_timetable/">
{% csrf_token %}
<table class="ui fixed sortable celled table">
<thead>
<tr>
<th style="width: 20%;">Upload Time</th>
<th style="width: 17%;">Programme</th>
<th style="width: 12%;">Batch</th>
<th style="width: 15%;">Branch</th>
<th style="width: 46%;"> Timetable File</th>
<th style="width:12%">Action</th>

</tr>
</thead>
<tbody>

{% for c in timetable %}
<tr id="visualize_{{forloop.counter}}">
<td>{{ c.upload_date }}</td>
<td>{{c.programme}}</td>
<td>{{ c.batch }}</td>
<td>{{ c.branch }}</td>
<td>
<div class="content">
<a href="../media/{{ c.time_table }}" class="header">Download</a>
</div>
</td>

<!-- <div style="width:100%;height:100%" id='pdf_modal_{{forloop.counter}}' class="ui sixteen wide column fullscreen modal">
<i class="close icon"></i>
<object style="width:100%;height:100%;align-self:center;" data="../media/{{c.time_table}}" type="application/pdf">
</div>
<script type="text/javascript">
$(document).ready(
function () {
$('#visualize_{{forloop.counter}}').click(function () {
$('#pdf_modal_{{forloop.counter}}').modal('show');
});
})
</script> -->

<!-- <td><button type="submit" value="{{ c.time_table }}" name="delete">
<i class="trash icon" style="font-size:1.3vw;color:red;"></i></button></td> -->
<td> <a href="#"><i class="trash icon" data-pk="{{c.pk}}" style="font-size:1.3vw;color:red;"></i></a></td>

</tr>
{% endfor %}


</tbody>
</table>
</form>
{% endif %}
</div>

{% endblock %}
581 changes: 426 additions & 155 deletions FusionIIIT/templates/coursemanagement/viewcourse.html

Large diffs are not rendered by default.

114 changes: 109 additions & 5 deletions FusionIIIT/templates/coursemanagement/viewperformance.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{% load static %} {% block viewperformance %}

<div class="ui pointing secondary menu">
<div class="ui pointing secondary menu" style="margin-top: 14px;">
<a class="item active tab vptab" id="assignmenttab" data-tab="assignment">Assignment</a>

<a class="item tab vptab" id="quiztab" data-tab="quiz">Online Quiz</a>
<!-- <a class="item tab vptab" id="quiztab" data-tab="quiz">Online Quiz</a> -->
<a class="item tab vptab" id="attendancetab" data-tab="attendance">Attendance</a>
<!-- {% if Lecturer == 1 %}
<a class="item tab vptab" id="viewmarkstab" data-tab="viewmarks"> Exams </a>
{% endif %} -->

</div>
<!-- Assignment -->
<div class="ui bottom attached vptabdata active tab segment" id="assignmenttabdata" data-tab="assignment" style="overflow:scroll;overflow-y:hidden ">
<div class="ui bottom attached vptabdata active tab segment" id="assignmenttabdata" data-tab="assignment" {% if Lecturer is 0 %} style="height: 65vh;"{% endif %}>
{% if Lecturer is 0 %}
<h4>Results</h4>
{% if assignment|length %}
<div class="ui top attached tabular menu">
<div class="ui top attached tabular menu" style="overflow:scroll;overflow-y:hidden ">
{% for assi in assignment %}
<a class="{% if forloop.counter is 1 %}active {% endif %}item per" data-tab="{{forloop.counter}}" >{{assi.assignment_name}}</a>
{% endfor %}
@@ -35,7 +36,6 @@ <h4>Results</h4>
<tr>
<td>
<h4 class="ui image header">
<img src="{% static 'globals/img/jenny.jpg' %}" class="ui rounded image">
<div class="content">
<p style="text-align:center">{{request.user.first_name}} {{request.user.last_name}}</p>
</div>
@@ -107,6 +107,7 @@ <h3>No Assignment has been uploaded </h3>
{% endif %}
{% endif %}
</div>

<div class="ui bottom attached tab vptabdata segment" id="quiztabdata" data-tab="quiz">
{% if Lecturer is 0 %}
<h4>Results</h4>
@@ -241,14 +242,117 @@ <h3>No quiz was conducted</h3>
{% endfor %}
</tbody>
</table>

</div>


<div class="ui bottom attached tab vptabdata segment" id="attendancetabdata" data-tab="attendance">
<!-- <p> Total Attendance = {{total_attendance}} </p>
<p> Total Present = {{present_attendance}} </p>
<p> Total Absent = {{absent_attendance}} </p> -->
<div style="display: flex; align-items: center; height: 200px; width: 100%; margin-bottom: 20px;">
<canvas id="attendanceChart" width="200" height="200"></canvas>
<div style="margin-left: 20px;">
<h4> Total Attendance = {{total_attendance}} </h4>
<h4>Attendance % = {{attendance_percent}}</h4>
</div>
</div>

<div style="overflow:scroll;height:20em;overflow-x:hidden;">
<table class="ui fixed single line sortable celled table">
<thead>
<tr>
<th style="width: 30%;">Date.</th>
<th style="width: 30%;">Status</th>

</tr>
</thead>
<tbody>
<!-- {% for roll_no, name in students.items %}
<tr>
<td>{{roll_no}}</td>
<td>{{name}}</td>
<td></td>
</tr>
{% endfor %}
-->

{% for date, present in present_attendance.items %}
<tr>
<td>{{date}}</td>
{% if present == 1%}
<td style="color: green;">Present</td>
{% else %}
<td style="color: rgba(255, 99, 132, 1);">Absent</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

</div>
<div class="ui segment">
<!-- <style>
.item a:hover {
text-decoration: underline;
}
</style> -->
<h4 class="ui dividing header">Attendance Files</h4>
{% if attendance_file %}
<div class="ui list">
{% for attendanceFile in attendance_file %}
<div class="item">
<i class="file icon"></i>
<div class="content">
<a href="{{ attendanceFile.file_url }}" class="header">{{ attendanceFile.file_name }}</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<p>No attendance files.</p>
{% endif %}
</div>
</div>



{% endblock %}

<script type="text/javascript" src="{% static 'globals/js/jquery.min.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script type="text/javascript">
$("#viewmarkstabdata").click(function(){
$("#marks_table").unbind();
});
</script>

<script>
const attendancePercent = {{ attendance_percent }};
const totalAtt = {{ total_attendance}};
const canvas = document.getElementById('attendanceChart');
const ctx = canvas.getContext('2d');
const myChart = new Chart(ctx, {
type: 'pie',
data: {
labels: ['Present', 'Absent'],
datasets: [{
data: [attendancePercent*totalAtt/100, totalAtt-(attendancePercent*totalAtt/100)],
backgroundColor: [
'rgba(75, 192, 192, 0.2)',
'rgba(255, 99, 132, 0.2)',
],
borderColor: [
'rgba(75, 192, 192, 1)',
'rgba(255, 99, 132, 1)',
],
borderWidth: 1
}]
},
options: {
legend: {
display: false,
},
}
});
</script>
5 changes: 1 addition & 4 deletions FusionIIIT/templates/dashboard/sidenavbar.html
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ <h2 class="ui inverted header">{{request.user.first_name}} {{request.user.last_n
</a>
<div class="active content">
<div class="link items">
{% if request.user.extrainfo.user_type == 'faculty' %}
{% if request.user.extrainfo.user_type == 'faculty' or 'student'%}
<a class = "item" href="/ocms">
<h4> Course Management </h4>
</a>
@@ -122,9 +122,6 @@ <h4>Hostel Module</h4>
<a class="item" href="{% url 'filetracking:filetracking' %}">
<h4> File Tracking </h4>
</a>
<a class="item" href="{% url 'hostelmanagement:hostel_view' %}">
<h4>Examination</h4>
</a>
</div>
</div>
</div>
29 changes: 29 additions & 0 deletions FusionIIIT/templates/notifications/sidepanel_ocms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% load static %}
{% block sidepanel %}
{% load notifications_tags %}
{% for notice in notifications %}
{% if notice.unread %}
{% if notice.data.module == 'Course Management' %}
{% if notice.data.course == course.pk %}
<div class="ui icon message">
<i class="inbox icon"></i>
<div class="content">
<div class="header">
<a href="{% url 'notifications:mark_as_read_and_redirect' notice.slug %}">
{{notice.data.cname}}
</a>

</div>
<p>{{ notice.verb }}</p>
</div>
<div class="ui right floated">
<a href="{% url 'notifications:delete' notice.slug %}">
<i class="close icon"></i>
</a>
</div>
</div>
{% endif%}
{% endif%}
{% endif %}
{% endfor %}
{% endblock %}

0 comments on commit 7b3b409

Please sign in to comment.