Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
557 commits
Select commit Hold shift + click to select a range
ef8c691
update
Feb 10, 2019
e878895
update
Feb 10, 2019
5b3f8fb
update
Feb 10, 2019
56277a6
update
Feb 10, 2019
8377fae
update
Feb 10, 2019
7f728cd
update
Feb 10, 2019
d368082
update
Feb 10, 2019
f8f2947
update
Feb 10, 2019
e06628a
update
Feb 10, 2019
c0e62f8
update
Feb 10, 2019
a968518
update
Feb 10, 2019
fa7324c
update
Feb 10, 2019
eecf048
update
Feb 10, 2019
ce6b9ff
update
Feb 10, 2019
1873307
update
Feb 10, 2019
3a8edc0
update
Feb 10, 2019
b9de480
update
Feb 10, 2019
ca267f1
update
Feb 10, 2019
3d75575
update
Feb 10, 2019
a08ad9b
update
Feb 10, 2019
792b363
update
Feb 10, 2019
ed951ee
update
Feb 10, 2019
0563539
update
Feb 10, 2019
0afb707
update
Feb 10, 2019
4c7ed63
update
Feb 10, 2019
5ce2719
update
Feb 10, 2019
cb47359
update
Feb 10, 2019
a8f765d
update
Feb 10, 2019
96701fb
update
Feb 10, 2019
36d2933
update
Feb 10, 2019
a693a46
update
Feb 10, 2019
15398ed
update
Feb 10, 2019
a5a464f
update
Feb 10, 2019
857dbda
update
Feb 11, 2019
e52cb3b
update
Feb 11, 2019
beeed72
update
Feb 11, 2019
fc66c91
update
Feb 11, 2019
573b7a1
update
Feb 11, 2019
b5cc7bc
update
Feb 11, 2019
84596b2
update
Feb 11, 2019
5db1d2f
update
Feb 11, 2019
31bec77
update
Feb 11, 2019
2106e12
update
Feb 11, 2019
086acce
update
Feb 11, 2019
3523494
update
Feb 11, 2019
bc93569
update
Feb 11, 2019
d7b607f
update
Feb 11, 2019
e8d5f99
update
Feb 11, 2019
82be17c
update
Feb 11, 2019
99c68c6
update
Feb 11, 2019
94da672
update
Feb 11, 2019
33ba039
update
Feb 11, 2019
a4d5553
update
Feb 11, 2019
f0bd241
update
Feb 11, 2019
0fd9c6b
update
Feb 11, 2019
3f9a468
update
Feb 11, 2019
22b3161
update
Feb 11, 2019
6aeeb21
update
Feb 11, 2019
8934eda
update
Feb 11, 2019
137c430
update
Feb 11, 2019
988f5a7
update
Feb 11, 2019
19e31df
update
Feb 11, 2019
e5020e6
update
Feb 11, 2019
3cfcf2d
update
Feb 11, 2019
d3f9004
update
Feb 11, 2019
1f8bb76
update
Feb 11, 2019
543bb25
update
Feb 11, 2019
e273f5f
update
Feb 13, 2019
4c8878e
update
Feb 18, 2019
0a16076
update
Feb 18, 2019
cb76629
update
Feb 18, 2019
9088883
update
Feb 18, 2019
df48048
update
Feb 18, 2019
63c6a6a
update
Feb 18, 2019
6ecb97a
update
Feb 18, 2019
e598912
update
Feb 18, 2019
c2ea49c
update
Feb 18, 2019
18d3c18
update
Feb 18, 2019
a2388ff
update
Feb 19, 2019
3f3d214
update
Feb 19, 2019
3425961
update
Feb 19, 2019
66383c6
update
Feb 19, 2019
76e7ecf
update
Feb 19, 2019
3497573
update
Feb 19, 2019
ea25810
update
Feb 19, 2019
c1b0014
update
Feb 19, 2019
fcad341
update
Feb 19, 2019
7afecfa
update
Feb 19, 2019
f610d4c
update
Feb 19, 2019
0964aa2
update
Feb 19, 2019
b0a63b7
update
Feb 19, 2019
8e2fd51
update
Feb 19, 2019
4b4cb35
update
Feb 19, 2019
aa4b4fb
update
Feb 19, 2019
166a43b
update
Feb 19, 2019
73a627e
update
Feb 19, 2019
2b2525d
update
Feb 19, 2019
59b6b4f
update
Feb 19, 2019
e86cebb
update
Feb 19, 2019
b58adbe
update
Feb 19, 2019
1d25b1f
update
Feb 19, 2019
f5b4722
update
Feb 19, 2019
a59801b
update
Feb 19, 2019
5db5ad5
update
Feb 19, 2019
4d73c0f
update
Feb 19, 2019
fb86a37
update
Feb 19, 2019
19f09b4
update
Feb 19, 2019
6ef395d
update
Feb 19, 2019
2137f86
update
Feb 19, 2019
f7b2b9d
update
Feb 19, 2019
d2ae782
update
Feb 19, 2019
1636eb1
update
Feb 19, 2019
9b48ab3
update
Feb 19, 2019
98e3582
update
Feb 19, 2019
34c41cd
update
Feb 19, 2019
09c4745
update
Feb 19, 2019
a0900a0
update
Feb 19, 2019
ca0abde
update
Feb 19, 2019
8e98e36
update
Feb 19, 2019
3f18bda
update
Feb 19, 2019
547523a
update
Feb 19, 2019
e9689e9
update
Feb 19, 2019
4452bfa
update
Feb 19, 2019
a365a6f
update
Feb 19, 2019
5db91bf
update
Feb 19, 2019
e46f7d8
update
Feb 19, 2019
6a9209d
update
Feb 19, 2019
fe7ba44
update
Feb 19, 2019
c3e7406
update
Feb 19, 2019
ea20eb1
update
Feb 19, 2019
c8aeb49
update
Feb 19, 2019
ca96833
update
Feb 19, 2019
f231d8c
update
Feb 19, 2019
de98767
update
Feb 19, 2019
658de51
update
Feb 19, 2019
2486bbf
update
Feb 19, 2019
db56419
update
Feb 19, 2019
ae78048
update
Feb 19, 2019
96e3dba
update
Feb 19, 2019
11553d7
update
Feb 19, 2019
8f69041
update
Feb 19, 2019
cd4c2c8
update
Feb 19, 2019
3f99478
update
Feb 19, 2019
f08c57b
update
Feb 19, 2019
cd75074
update
Feb 19, 2019
95fb9d4
update
Feb 19, 2019
330222a
update
Feb 19, 2019
0a98652
update
Feb 19, 2019
b88fc4b
update
Feb 19, 2019
fad21ca
update
Feb 19, 2019
02e923f
update
Feb 19, 2019
8554ca7
update
Feb 19, 2019
40760b0
update
Feb 19, 2019
456ab3c
update
Feb 19, 2019
a27fceb
update
Feb 19, 2019
e24a4b3
New feature branch
tmgreenside Mar 25, 2019
acaa2d6
Added Google Speech start script
tmgreenside Apr 1, 2019
abcdef3
Demo ready for alternative that does not use Google
tmgreenside Apr 1, 2019
a0fdab3
update
drichard2 Apr 1, 2019
293a378
setup
drichard2 Apr 1, 2019
f3fcb0e
update april 1
drichard2 Apr 1, 2019
92eb010
completed walkthrough:go to class page
drichard2 Apr 1, 2019
581f501
completed walkthrough:create attempt
drichard2 Apr 1, 2019
c67a02a
Speech to text is demo ready
tmgreenside Apr 3, 2019
e1e5abc
Holdover approved by Dr Hunter
tmgreenside Apr 11, 2019
6527448
update
Apr 14, 2019
9eb9319
update
Apr 14, 2019
68ac6e3
update
Apr 14, 2019
9e6e2ca
updagte
Apr 14, 2019
eecd452
udpate
Apr 14, 2019
5107140
udpate
Apr 14, 2019
55ecb22
udpate
Apr 14, 2019
eb1f50b
udpate
Apr 14, 2019
19fa9a7
udpate
Apr 14, 2019
7852da9
udpate
Apr 14, 2019
e73c628
update
Apr 14, 2019
6f47374
update
Apr 14, 2019
982d413
update
Apr 14, 2019
8c17c01
update
Apr 15, 2019
5ad05e0
Web speech works for teacher creating worksheet as well as student
tmgreenside Apr 17, 2019
e0f0b15
Fixed a jQuery typo in expression_form.html
tmgreenside Apr 17, 2019
b000470
Merge branch 'poster' into csv-upload
drichard2 Apr 23, 2019
b2f3065
Merge pull request #28 from drichard2/csv-upload
drichard2 Apr 23, 2019
09fd274
Merge pull request #29 from drichard2/student-dashboard
drichard2 Apr 23, 2019
d78b966
Merge branch 'poster' into teacher-dashboard
drichard2 Apr 23, 2019
bd4d0f5
update
drichard2 Apr 23, 2019
b94a850
Merge pull request #31 from tmgreenside/SpeechText
drichard2 Apr 24, 2019
6034f96
Merge pull request #32 from tmgreenside/corpus
drichard2 Apr 24, 2019
281d453
finished all help walkthrough, only a couple bugs issues
drichard2 Apr 24, 2019
44f04bb
Merge pull request #30 from drichard2/teacher-dashboard
drichard2 Apr 24, 2019
86b191f
update
drichard2 Apr 25, 2019
237d9ac
update
drichard2 Apr 25, 2019
b81de66
update
drichard2 Apr 25, 2019
d0e6881
update
drichard2 Apr 26, 2019
8760b76
update
drichard2 Apr 26, 2019
b319099
update
drichard2 Apr 26, 2019
343459d
update
drichard2 Apr 26, 2019
b24bfa6
update
drichard2 Apr 26, 2019
77f879c
update
drichard2 Apr 26, 2019
594cc0d
update
drichard2 Apr 26, 2019
9620763
finished all student guides
drichard2 Apr 26, 2019
4656607
completed all teacher guides
drichard2 Apr 26, 2019
2449415
update
Apr 28, 2019
f337c2e
Merge branch 'poster' into helpfeature
drichard2 Apr 28, 2019
6195c9e
Merge pull request #33 from drichard2/helpfeature
drichard2 Apr 28, 2019
d4a8dfc
Merge branch 'poster' into worksheetgen
drichard2 Apr 28, 2019
c8cceaf
Merge pull request #34 from drichard2/worksheetgen
drichard2 Apr 28, 2019
6bf44f8
update
Apr 28, 2019
d64d091
update
Apr 28, 2019
6483725
update
Apr 28, 2019
929321d
update
Apr 28, 2019
c1758e0
update
Apr 28, 2019
d52294d
update
Apr 28, 2019
c6753de
update
Apr 28, 2019
41d3d14
update
Apr 28, 2019
2da1adb
update
Apr 28, 2019
9e2db70
update
Apr 28, 2019
80c3e10
update
Apr 28, 2019
78f4d50
update
Apr 28, 2019
d1ab284
update
Apr 28, 2019
dad2b99
update
Apr 28, 2019
c149696
update
Apr 28, 2019
7bb7bb9
update
Apr 28, 2019
f0edd5c
update
Apr 28, 2019
171d6c2
Merge pull request #36 from drichard2/worksheetgen
drichard2 Apr 28, 2019
a277c1d
update
Apr 28, 2019
7e425b4
Merge pull request #37 from drichard2/worksheetgen
drichard2 Apr 28, 2019
87e8614
update
Apr 28, 2019
b537f2b
update
Apr 28, 2019
3b36608
update
Apr 28, 2019
c64271f
update
Apr 28, 2019
b943cd6
fixed urls
Apr 29, 2019
c7889e1
f
Apr 29, 2019
811e83a
Merge branch 'posterdb' of https://github.com/drichard2/Communication…
Apr 29, 2019
4ba907e
update
Apr 29, 2019
9963380
update
Apr 29, 2019
389a1c1
update
Apr 29, 2019
f54d502
update
Apr 29, 2019
66fab39
Upload fonts
10den11 Apr 30, 2019
5a6031c
updated base
10den11 Apr 30, 2019
508ef1e
updated sidebar
10den11 Apr 30, 2019
87caa02
Merge pull request #42 from 10den11/fontfinal
drichard2 Apr 30, 2019
d599c5c
Merge branch 'fontf' into posterfinal
Apr 30, 2019
104850a
update
May 1, 2019
172d50f
update
May 3, 2019
3f17a89
update
May 3, 2019
214f099
update
May 3, 2019
ef01443
update
May 3, 2019
a32e142
rstrip
May 3, 2019
0321f5f
rstrip
May 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ efs/*
app-messages/*

CommunicationSeminar-7d*
# local dev settings module
local_dev.py
15 changes: 14 additions & 1 deletion ComSemApp/administrator/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django_select2.forms import Select2MultipleWidget

from django.contrib.auth.models import User
from ComSemApp.models import Course, CourseType, Session, SessionType, Teacher, Student, Institution
from ComSemApp.models import *



Expand Down Expand Up @@ -86,3 +86,16 @@ class StudentForm(ModelForm):
class Meta:
model = Student
fields = ['country', 'language']

class ReplyForm(ModelForm):
message = forms.CharField( widget=forms.Textarea(attrs={'style': "width:100%", 'placeholder': 'Enter reply here.'}))
class Meta:
model = Reply
fields = ["message"]

class TopicForm(ModelForm):
message = forms.CharField( widget=forms.Textarea(attrs={'style': "width:100%"}))
title = forms.CharField(widget=forms.TextInput(attrs={'style': "width:100%"}))
class Meta:
model = Reply
fields = ["title", "message"]
5 changes: 5 additions & 0 deletions ComSemApp/administrator/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from ComSemApp.administrator import views
from ComSemApp.corpus import views as corpus_views

from ComSemApp.discussionBoard import view as discussion_views

app_name = 'admin'
urlpatterns = [
url(r'^$', views.TeacherListView.as_view(), name='home'),
Expand Down Expand Up @@ -37,5 +39,8 @@
url(r'^session_type/(?P<pk>[0-9]+)/delete/$', views.SessionTypeDeleteView.as_view(), name='delete_session_type'),

url(r'^corpus/search$', corpus_views.corpus_search, name='corpus_search'),
url(r'^discussion_board$', discussion_views.TopicListView.as_view(), name='admin_discussion_board'),
url(r'^topic/(?P<topic_id>[0-9]+)/$', discussion_views.ReplyView.as_view(), name='admin_topic'),
url(r'^newtopic/$', discussion_views.CreateThreadView.as_view(),name='admin_create_topic')
]

134 changes: 133 additions & 1 deletion ComSemApp/administrator/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@
from django.views import View

from django.core.mail import send_mail
from django.core.validators import validate_email
from django.contrib import messages
import csv
import io
import re



from ComSemApp.models import *
from django.contrib.auth.models import User
from ComSemApp.administrator.forms import CourseForm, CourseTypeForm, SessionForm, SessionTypeForm, TeacherForm, StudentForm, UserForm
from ComSemApp.libs.mixins import RoleViewMixin
from django.core.exceptions import ValidationError



class AdminViewMixin(RoleViewMixin):
Expand Down Expand Up @@ -53,10 +60,135 @@ def get_queryset(self):
class StudentListView(AdminViewMixin, ListView):
model = Student
template_name = 'ComSemApp/admin/student_list.html'
success_url = reverse_lazy("administrator:students")

def _send_email(self, user, password):
link = "https://www.comsem.net"
message = ("You have been invited to join Communication Seminar by an administrator for " + self.institution.name + ".\n"
"In order to log in, go to " + link + " and use \n"
"\tusername: " + user.username + "\n\tpassword: " + password + "\n"
"from there you can change your password.")

send_mail(
'Invitation to Communication Seminar',
message,
'signup@comsem.net',
[user.email],
fail_silently=False,
)


def db_create_user(self, **kwargs):
user = User.objects.create(**kwargs)
password = User.objects.make_random_password()
user.set_password(password)
user.save()
self._send_email(user, password)
return user

def db_create_student(self, **kwargs):
institution = self.institution
user = self.db_create_user(**kwargs)
return Student.objects.create(user=user, institution=institution)

#handle CSV upload
def post(self, request, *args, **kwargs):
if (len(request.FILES) > 0): #check to make sure file was uploaded
csv_file = request.FILES['file']
file_data = csv_file.read().decode("utf-8")
lines = file_data.split("\n")
rejectedLines = []
message_content = [""]
linecount = 0
rejectcount = 0
for line in lines:
if len(line): #make sure line isnt empty
fields = line.split(",")
okToCreate = True
rejected = False
linecount += 1
first = fields[0].rstrip()
last = fields[1].rstrip()
email = fields[2].rstrip()
username = fields[3].rstrip()
if (first == "" or first == ""):
#end of file
break
if (len(fields) < 4):
message = "!!! Missing columns, please make sure you have columns as follows: firstname,lastname,email,username"
message_content.append(message)
rejected = True
rejectcount += 1
break
if (first.isalpha() == False or last.isalpha() == False):
message = (str(linecount) + " " + first + " " + last + " " + email + " " + username + " Invalid First or Last Name \n")
message_content.append(message)
rejectcount += 1
rejected = True
okToCreate = False
for user in Student.objects.filter(institution=self.institution):
if(user.user.email== email):
okToCreate = False
if (rejected == False): ##if rejected is false, we need to increment the number of rejects, if its already false, dont increment it but still log error
rejectcount += 1
rejected = True
message = (str(linecount) + " " + first + " " + last + " " + email + " " + username + " Duplicate Email Address \n")
message_content.append(message)

if(user.user.username== username):
okToCreate = False
if (rejected == False): ##if rejected is false, we need to increment the number of rejects, if its already false, dont increment it but still log error
rejectcount += 1
rejected = True
message = (str(linecount) + " " + first + " " + last + " " + email + " " + username + " Duplicate Username \n")
message_content.append(message)
if(okToCreate == False):
break

# Check if a valid email address
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email.lower())

if (match == None):
if(rejected == False):
rejectcount += 1
rejected = True
okToCreate = False
message = (str(linecount) + " " + first + " " + last + " " + email + " " + username + " Invalid Email Address \n")
message_content.append(message)

# Check for valid username
usernameCheck = re.match('^[\w.@+-]+$', username.rstrip())
print(usernameCheck)
if (usernameCheck == None):
if(rejected == False):
rejectcount += 1
rejected = True
okToCreate = False
message = (str(linecount) + " " + first + " " + last + " " + email + " " + username + " Invalid Username \n")
message_content.append(message)

if (okToCreate == True):
user = {
"first_name": first,
"last_name": last,
"email": email,
"username": username,
}
self.db_create_student(**user)
print("student made")
message_content.insert(0, ("" + str((linecount - rejectcount)) + "/" + str(linecount)+ " Accounts created sucessfully\n" + "The below users were not added, Their line numbers are listed to the left,\nLines with multiple errors will be listed multiple times \n \n"))
message_disp = "".join(message_content)
messages.add_message(request, messages.ERROR, message_disp)
request.FILES.pop('file', None) #delete the csv file from memory
return HttpResponseRedirect(self.success_url)


def get_queryset(self):

return Student.objects.filter(institution=self.institution)




class CourseListView(AdminViewMixin, ListView):
model = Course
Expand Down Expand Up @@ -106,6 +238,7 @@ def form_invalid(self, user_form, obj_form, **kwargs):
return self.render_to_response(self.get_context_data(form=user_form, obj_form=obj_form))

def _send_email(self, user, password):
print("EMAIL SENT")
link = "https://www.comsem.net"
message = ("You have been invited to join Communication Seminar by an administrator for " + self.institution.name + ".\n"
"In order to log in, go to " + link + " and use \n"
Expand Down Expand Up @@ -133,7 +266,6 @@ def get(self, request, *args, **kwargs):
def post(self, request, *args, **kwargs):
user_form = UserForm(self.request.POST, prefix='user_form')
obj_form = self.get_obj_form()

if user_form.is_valid() and obj_form.is_valid():
# create the user object with random password
user = user_form.save()
Expand Down
1 change: 1 addition & 0 deletions ComSemApp/discussionBoard/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

32 changes: 32 additions & 0 deletions ComSemApp/discussionBoard/test/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from django.urls import reverse
from django.core import mail

from ComSemApp.libs.factories import BaseTestCase
from ComSemApp.models import *

class TestCredentials(BaseTestCase):

# only students and teachers should be able to access students views.

discussion_board_url = reverse("discussion_board:topics")
loggin_url = reverse("login")

def setUp(self):
super(TestCredentials, self).setUp()
self.password = "password123"
self.teacher = self.db_create_teacher(password=self.password)
self.student = self.db_create_student(password=self.password)

def test_not_logged_in_fail(self):
response = self.client.get(self.discussion_board_url)
self.assertRedirects(response, '%s?next=%s' % (self.login_url, self.discussion_board_url))

def test_logged_in_teacher_success(self):
self.client.login(username=self.teacher.user.username, password=self.password)
response = self.client.get(self.discussion_board_url)
self.assertEqual(response.status_code, 200)

def test_logged_in_student_success(self):
self.client.login(username=self.student.user.username, password=self.password)
response = self.client.get(self.discussion_board_url)
self.assertEqual(response.status_code, 200)
9 changes: 9 additions & 0 deletions ComSemApp/discussionBoard/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.conf.urls import url
from ComSemApp.discussionBoard import view

app_name = 'discussion_board'
urlpatterns = [
url(r'^$', view.TopicListView.as_view(), name='topics'),
url(r'^topic/(?P<topic_id>[0-9]+)/$', view.ReplyView.as_view(), name='topic'),
url(r'^newtopic/$', view.CreateThreadView.as_view(),name='create_topic')
]
Loading