committing incremental changes to Halo SE Web

Miriam Melnick [2011-10-28 13:24:27]
committing incremental changes to Halo SE Web
Filename
halo_se_web/halo_admin/urls.py
halo_se_web/halo_admin/views.py
halo_se_web/halo_web/views.py
halo_se_web/login/models.py
halo_se_web/login/views.py
halo_se_web/settings.py
halo_se_web/templates/404.html
halo_se_web/templates/base_site.html
halo_se_web/templates/halo_admin/course_admin.html
halo_se_web/templates/halo_admin/dashboard.html
halo_se_web/templates/halo_web/index.html
halo_se_web/templates/index.html
halo_se_web/urls.py
diff --git a/halo_se_web/halo_admin/urls.py b/halo_se_web/halo_admin/urls.py
index 3da1c90..80e34b4 100644
--- a/halo_se_web/halo_admin/urls.py
+++ b/halo_se_web/halo_admin/urls.py
@@ -2,10 +2,15 @@ from django.conf.urls.defaults import patterns, include, url

 urlpatterns = patterns('halo_admin.views',
     (r'^$', 'dashboard'),
-    (r'^(?P<course_id>\d)/(?P<assignment_id>\d)/(?P<quest_id>\d)/tasks/$', 'task_admin'),
-    (r'^(?P<course_id>\d)/(?P<assignment_id>\d)/quests/$', 'quest_admin'),
-    (r'^(?P<course_id>\d)/(?P<assignment_id>\d)/add_quest/$', 'add_quest'),
-    (r'^(?P<course_id>\d)/(?P<assignment_id>\d)/add_quest/(?P<parent_quest_id>\d)/$', 'add_quest'),
-    (r'^(?P<course_id>\d)/assignments/$', 'assignment_admin'),
-    (r'^(?P<course_id>\d)/$', 'course_admin'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/(?P<quest_id>\d+)/add_task/(?P<parent_task_id>\d+)$', 'add_task'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/(?P<quest_id>\d+)/add_task/$', 'add_task'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/(?P<quest_id>\d+)/tasks/$', 'task_admin'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/quests/$', 'quest_admin'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/add_quest/(?P<parent_quest_id>\d+)/$', 'add_quest'),
+    (r'^(?P<course_id>\d+)/(?P<assignment_id>\d+)/add_quest/$', 'add_quest'),
+    (r'^(?P<course_id>\d+)/add_assignment/$', 'add_assignment'),
+    (r'^(?P<course_id>\d+)/assignments/$', 'assignment_admin'),
+    (r'^(?P<course_id>\d+)/student_list/(?P<focus_id>\d+)/$', 'student_list'),
+    (r'^(?P<course_id>\d+)/student_list/$', 'student_list'),
+    (r'^(?P<course_id>\d+)/$', 'course_admin'),
 )
\ No newline at end of file
diff --git a/halo_se_web/halo_admin/views.py b/halo_se_web/halo_admin/views.py
index 421f305..1d344dd 100644
--- a/halo_se_web/halo_admin/views.py
+++ b/halo_se_web/halo_admin/views.py
@@ -4,6 +4,8 @@ from django import forms
 from django.template.context import RequestContext
 from login.models import HUser, Enrollment, Course, Studentassignment, Quest, Task
 from halo_admin.util import contains_course
+from halo_web.models import Questprogress
+from datetime import date, timedelta

 def dashboard(request):
     user = request.user
@@ -18,8 +20,8 @@ def dashboard(request):
         for enr in admin_enrollment:
             course = Course.objects.get(id=enr.getCourseId())
             admin_courses.append(course)
-            print admin_courses
             for course in admin_courses:
+
                 asmtset = Studentassignment.objects.filter(course_id = course.id)
                 assignment_list.append([course.id, asmtset])

@@ -30,11 +32,12 @@ def dashboard(request):
                     for quest in questset:
                         taskset = Task.objects.filter(quest_id = quest.id)
                         task_list.append([quest.id, taskset])
+

-        print admin_courses
-        print assignment_list
-        print quest_list
-        print task_list
+     #   print admin_courses
+     #   print assignment_list
+     #   print quest_list
+     #   print task_list
   #  course_select = AdminSelectForm(admin_courses)
     else:
         enrollment = None
@@ -43,7 +46,9 @@ def dashboard(request):
         quest_list = None
         task_list = None

-    return render_to_response('halo_admin/dashboard.html', {'user': user, 'enrollment': enrollment, 'admin_courses': admin_courses, 'assignment_list': assignment_list, 'quest_list': quest_list, 'task_list': task_list}, context_instance = RequestContext(request))
+    data1 = (1,2,3)
+
+    return render_to_response('halo_admin/dashboard.html', {'user': user, 'enrollment': enrollment, 'admin_courses': admin_courses, 'assignment_list': assignment_list, 'quest_list': quest_list, 'task_list': task_list, 'data1': data1}, context_instance = RequestContext(request))

 def course_admin(request, course_id):
     user = request.user
@@ -51,18 +56,49 @@ def course_admin(request, course_id):

     if (user.is_authenticated()):
         u_id = user.getUserId()
-        enrollment = Enrollment.objects.filter(user_id=u_id)
-        admin_enrollment = enrollment.filter(type="ADMIN")
+        my_enrollment = Enrollment.objects.filter(user_id=u_id)
+        admin_enrollment = my_enrollment.filter(type="ADMIN")
         admin_courses = []
         for enr in admin_enrollment:
             course = Course.objects.get(id=enr.getCourseId())
             admin_courses.append(course)
         admin_this_course = contains_course(admin_courses, course_id)
+
+        assignments = Studentassignment.objects.filter(course_id=course_id)
+        quests = []
+        for asmt in assignments:
+            asmt_quests = Quest.objects.filter(assignment_id = asmt.id)
+            for q in asmt_quests:
+                quests.append(q)
+        course_enrollment = Enrollment.objects.filter(course_id = course_id).filter(type="STUDENT")
+        tasks = []
+        for q in quests:
+            q_tasks = Task.objects.filter(quest_id = q.id)
+            for qt in q_tasks:
+                tasks.append(qt)
+
+        data = []
+        students = []
+        for enr in course_enrollment:
+            stu_id = enr.user_id
+            enddate = date.today()
+            startdate = enddate - timedelta(days=7)
+            stu_progress = Questprogress.objects.filter(user_id=stu_id).filter(completed=1).filter(updated__range=[startdate, enddate])
+            data.append(len(stu_progress))
+            students.append(HUser.objects.get(id=stu_id).lastname)
+        data_max = max(data)
     else:
-        enrollment = None
+        my_enrollment = None
         admin_courses = None
         admin_this_course = False
-    return render_to_response('halo_admin/course_admin.html', {'user': user, 'enrollment': enrollment, 'this_course': this_course, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course}, context_instance=RequestContext(request))
+        data_max = None
+        tasks = None
+        quests = None
+        students = None
+        data = None
+        course_enrollment = None
+
+    return render_to_response('halo_admin/course_admin.html', {'user': user, 'enrollment': my_enrollment, 'data_max': data_max, 'assignments':assignments, 'tasks': tasks, 'quests': quests,'data': data, 'students': students, 'course_enrollment': course_enrollment, 'this_course': this_course, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course}, context_instance=RequestContext(request))

 #class AdminSelectForm(forms.Form):
 #    course = forms.CharField(max_length=100, choices = admin_courses)
@@ -103,14 +139,15 @@ def quest_admin(request, course_id, assignment_id):
             course = Course.objects.get(id=enr.getCourseId())
             admin_courses.append(course)
         admin_this_course = contains_course(admin_courses, course_id)
-
+        this_assignment = Studentassignment.objects.get(id=assignment_id)
         quest_list = Quest.objects.filter(assignment_id=assignment_id)
+        print quest_list
     else:
         enrollment = None
         admin_courses = None
         admin_this_course = False
         quest_list = None
-    return render_to_response('halo_admin/quest_admin.html', {'user': user, 'enrollment': enrollment, 'this_course': this_course, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course, 'quest_list': quest_list}, context_instance=RequestContext(request))
+    return render_to_response('halo_admin/quest_admin.html', {'user': user, 'enrollment': enrollment, 'this_course': this_course, 'this_assignment': this_assignment, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course, 'quest_list': quest_list}, context_instance=RequestContext(request))

 def task_admin(request, course_id, assignment_id, quest_id):
     user = request.user
@@ -125,14 +162,44 @@ def task_admin(request, course_id, assignment_id, quest_id):
             course = Course.objects.get(id=enr.getCourseId())
             admin_courses.append(course)
         admin_this_course = contains_course(admin_courses, course_id)
-
+        this_assignment = Studentassignment.objects.get(id=assignment_id)
+        this_quest = Quest.objects.get(id=quest_id)
         task_list = Task.objects.filter(quest_id=quest_id)
+        task_list_range = range(len(task_list))
     else:
         enrollment = None
         admin_courses = None
         admin_this_course = False
         task_list = None
-    return render_to_response('halo_admin/quest_admin.html', {'user': user, 'enrollment': enrollment, 'this_course': this_course, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course, 'task_list': task_list}, context_instance=RequestContext(request))
+    return render_to_response('halo_admin/task_admin.html', {'user': user, 'enrollment': enrollment, 'this_course': this_course, 'this_assignment': this_assignment, 'this_quest': this_quest, 'admin_courses': admin_courses, 'admin_this_course': admin_this_course, 'task_list': task_list, 'task_list_range': task_list_range}, context_instance=RequestContext(request))
+
+#def add_quest2(request, course_id=None, assignment_id=None, parent_quest_id=None):
+#    user = request.user
+#    this_course = Course.objects.get(id=course_id)
+#
+#    if (user.is_authenticated()):
+#        u_id = user.getUserId()
+#        enrollment = Enrollment.objects.filter(user_id=u_id)
+#        admin_enrollment = enrollment.filter(type="ADMIN")
+#        admin_courses = []
+#        for enr in admin_enrollment:
+#            course = Course.objects.get(id=enr.getCourseId())
+#            admin_courses.append(course)
+#        admin_this_course = contains_course(admin_courses, course_id)
+#
+#    else:
+#        admin_this_course = False
+#    if request.method == 'POST':
+#        form = AddQuestForm2(request.user, course_id, assignment_id, parent_quest_id, request.POST)
+#        if form.is_valid():
+#            new_quest = Quest(name=form.cleaned_data['name'], description=form.cleaned_data['description'], assignment_id = assignment_id, parent_id = parent_quest_id, experiencepoints = form.cleaned_data['experiencePoints'])
+#            new_quest.save()
+#            print new_quest.id
+#            return HttpResponseRedirect('/admin/add_quest')
+#    else:
+#        form = AddQuestForm2(request.user, courses, assignments, quests)
+#    return render_to_response('halo_admin/add_quest.html', {'user': user, 'admin_this_course': admin_this_course, 'form': form}, context_instance = RequestContext(request))
+

 def add_quest(request,course_id, assignment_id, parent_quest_id=None):
     user = request.user
@@ -158,28 +225,11 @@ def add_quest(request,course_id, assignment_id, parent_quest_id=None):
             new_quest = Quest(name=form.cleaned_data['name'], description=form.cleaned_data['description'], assignment_id = assignment_id, parent_id = parent_quest_id, experiencepoints = form.cleaned_data['experiencePoints'])
             new_quest.save()
             print new_quest.id
-            return HttpResponseRedirect('/admin/'+str(course_id)+'/assignments')
+            return HttpResponseRedirect('/admin/'+str(course_id)+'/'+str(assignment_id)+'/quests')
     else:
         form = AddQuestForm(request.user, course_id, assignment_id, parent_quest_id)
     return render_to_response('halo_admin/add_quest.html', {'user': user, 'admin_this_course': admin_this_course, 'form': form}, context_instance = RequestContext(request))

-#class AddQuestForm(forms.Form):
-#    def __init__(self, user, *args, **kwargs):
-#        super(AddQuestForm, self).__init__(*args, **kwargs)
-#        if (user.is_authenticated()):
-#            u_id = user.getUserId()
-#            enrollment = Enrollment.objects.filter(user_id=u_id)
-#            admin_enrollment = enrollment.filter(type="ADMIN")
-#            admin_courses = []
-#            for enr in admin_enrollment:
-#                course = Course.objects.get(id=enr.getCourseId())
-#                admin_courses.append(course)
-#            self.fields['course'].choices = [('','-- choose a course --'),] + [(c.id, c.name) for c in admin_courses]
-#            self.fields['assignment'].choices = [('','-- choose an assignment --'),] + [(a.id, a.title) for a in Studentassignment.objects.filter(course_id = self.fields['course'].value)]
-#    course = forms.ChoiceField(widget=forms.Select, choices=())
-#    assignment = forms.ChoiceField(widget=forms.Select, choices=())
-#    parent_quest = forms.ChoiceField(widget=forms.Select, choices=())
-
 class AddQuestForm(forms.Form):
     def __init__(self, user, course_id, assignment_id, parent_quest_id, *args, **kwargs):
         super(AddQuestForm, self).__init__(*args, **kwargs)
@@ -188,4 +238,142 @@ class AddQuestForm(forms.Form):
     description = forms.CharField(widget=forms.Textarea)
     experiencePoints = forms.IntegerField()

+#
+#class AddQuestForm2(forms.Form):
+#    def __init__(self, user, courses, assignments, quests, *args, **kwargs):
+#        super(AddQuestForm2, self).__init__(*args, **kwargs)
+#    courses = forms.Select(choices=courses)
+#    assignment = forms.Select(choices = assignments)
+#    name = forms.CharField(max_length=150)
+#    description = forms.CharField(widget=forms.Textarea)
+#    experiencePoints = forms.IntegerField()
+#
+class AddAssignmentForm(forms.Form):
+    def __init__(self, user, course_id, *args, **kwargs):
+        super(AddAssignmentForm, self).__init__(*args, **kwargs)
+    assignedon = forms.DateTimeField(widget=forms.DateTimeInput)
+    description = forms.CharField(widget=forms.Textarea)
+    dueon = forms.DateTimeField(widget=forms.DateTimeInput)
+    title = forms.CharField()
+
+def add_assignment(request, course_id):
+    user = request.user
+    this_course = Course.objects.get(id=course_id)
+
+    if (user.is_authenticated()):
+        u_id = user.getUserId()
+        enrollment = Enrollment.objects.filter(user_id=u_id)
+        admin_enrollment = enrollment.filter(type="ADMIN")
+        admin_courses = []
+        for enr in admin_enrollment:
+            course = Course.objects.get(id=enr.getCourseId())
+            admin_courses.append(course)
+        admin_this_course = contains_course(admin_courses, course_id)
+
+        asmt_list = Studentassignment.objects.filter(course_id=course_id)
+
+    else:
+        admin_this_course = False
+    if request.method == 'POST':
+        form = AddAssignmentForm(request.user, course_id, request.POST)
+        if form.is_valid():
+            new_asmt = Studentassignment(assignedon=form.cleaned_data['assignedon'], description=form.cleaned_data['description'], dueon = form.cleaned_data['dueon'], title = form.cleaned_data['title'], course_id = course_id)
+            new_asmt.save()
+            print new_asmt.id
+            return HttpResponseRedirect('/admin/'+str(course_id))
+    else:
+        form = AddAssignmentForm(request.user, course_id)
+    return render_to_response('halo_admin/add_assignment.html', {'user': user, 'admin_this_course': admin_this_course, 'form': form}, context_instance = RequestContext(request))
+
+def add_task(request,course_id, assignment_id, quest_id, parent_task_id=None):
+    user = request.user
+    this_course = Course.objects.get(id=course_id)
+
+    if (user.is_authenticated()):
+        u_id = user.getUserId()
+        enrollment = Enrollment.objects.filter(user_id=u_id)
+        admin_enrollment = enrollment.filter(type="ADMIN")
+        admin_courses = []
+        for enr in admin_enrollment:
+            course = Course.objects.get(id=enr.getCourseId())
+            admin_courses.append(course)
+        admin_this_course = contains_course(admin_courses, course_id)
+        this_assignment = Studentassignment.objects.get(id=assignment_id)
+        this_quest = Quest.objects.get(id=quest_id)
+
+
+    else:
+        admin_this_course = False
+    if request.method == 'POST':
+        form = AddTaskForm(request.user, course_id, assignment_id, quest_id, parent_task_id, request.POST)
+        if form.is_valid():
+            new_task = Task(name=form.cleaned_data['name'],description=form.cleaned_data['description'], quest_id = quest_id, parent_id = parent_task_id)
+            new_task.save()
+            print new_task.id
+            return HttpResponseRedirect('/admin/'+str(course_id)+'/'+str(assignment_id)+'/'+str(quest_id)+'/tasks')
+    else:
+        form = AddTaskForm(request.user, course_id, assignment_id, quest_id, parent_task_id)
+    return render_to_response('halo_admin/add_task.html', {'user': user, 'admin_this_course': admin_this_course, 'form': form}, context_instance = RequestContext(request))
+
+class AddTaskForm(forms.Form):
+    def __init__(self, user, course_id, assignment_id, quest_id, parent_task_id, *args, **kwargs):
+        super(AddTaskForm, self).__init__(*args, **kwargs)
+
+    name = forms.CharField(max_length=150)
+    description = forms.CharField(widget=forms.Textarea)
+
+def student_list(request, course_id, focus_id = None):
+    user = request.user
+    this_course = Course.objects.get(id=course_id)
+    if (focus_id):
+        focus_user = HUser.objects.get(id=focus_id)
+        focus = {'name': focus_user.getName(), 'email': focus_user.getEmail(), 'id': focus_user.getUserId()}
+        focus_data = []
+        focus_labels = []
+        focus_max = 0
+        for i in range(30):
+            startdate = date.today() - timedelta(days=(31-i))
+            enddate = date.today() - timedelta(days=(30-i))
+            stu_progress = Questprogress.objects.filter(user_id=focus['id']).filter(completed=1).filter(updated__range=[startdate, enddate])
+            focus_max = max(focus_max, len(stu_progress))
+            focus_data.append(len(stu_progress))
+            if (i % 7 == 0):
+                focus_labels.append(enddate)
+
+        print focus_data
+        print focus_max
+
+    else:
+        focus = None
+        focus_data = None
+        focus_max = None
+        focus_labels = None
+    if (user.is_authenticated()):
+        u_id = user.getUserId()
+        my_enrollment = Enrollment.objects.filter(user_id=u_id)
+        admin_enrollment = my_enrollment.filter(type="ADMIN")
+        admin_courses = []
+        for enr in admin_enrollment:
+            course = Course.objects.get(id=enr.getCourseId())
+            admin_courses.append(course)
+        admin_this_course = contains_course(admin_courses, course_id)
+        students = []
+        course_enrollment = Enrollment.objects.filter(course_id = course_id)
+        for enr in course_enrollment:
+            stud = HUser.objects.get(id=enr.user_id)
+            stud_data = {'name': stud.getName(), 'email': stud.getEmail(), 'id': stud.getUserId()}
+            students.append(stud_data)
+    else:
+        my_enrollment = None
+        admin_courses = None
+        admin_this_course = False
+        data_max = None
+        tasks = None
+        quests = None
+        students = None
+        data = None
+        course_enrollment = None
+
+    return render_to_response('halo_admin/student_list.html', {'course_id': course_id, 'user': user, 'focus': focus, 'focus_data': focus_data, 'focus_range': range(focus_max+1), 'focus_labels': focus_labels, 'admin_this_course': admin_this_course,'students': students}, context_instance=RequestContext(request))
+

\ No newline at end of file
diff --git a/halo_se_web/halo_web/views.py b/halo_se_web/halo_web/views.py
index 0d40d99..d8a7d8d 100644
--- a/halo_se_web/halo_web/views.py
+++ b/halo_se_web/halo_web/views.py
@@ -1,14 +1,47 @@
 from django.shortcuts import render_to_response, get_object_or_404
-from halo_web.models import Quest
+from login.models import Quest, Enrollment, Course, HUser
 from django.http import HttpResponse, Http404, HttpResponseRedirect
+from django.template.context import RequestContext

 def index(request):
-    return HttpResponse('Hello, world! You are at the halo_web index.')
+    user = request.user
+    enrollment = Enrollment.objects.filter(user_id = user.id)
+    courses = []
+    for enr in enrollment:
+        courses.append(Course.objects.get(id = enr.course_id))
+    return render_to_response('halo_web/index.html', {'courses': courses}, context_instance = RequestContext(request))

 def quests(request):
     quest_list = Quest.objects.all()
-    return render_to_response('halo_web/quests.html', {'quest_list': quest_list})
+    return render_to_response('halo_web/quests.html', {'quest_list': quest_list}, context_instance = RequestContext(request))

 def home(request):
-    print request
-    return HttpResponse("Hello world")
\ No newline at end of file
+    user = request.user
+    admin_courses = []
+
+    if (user.is_authenticated()):
+        u_id = user.getUserId()
+        my_enrollment = Enrollment.objects.filter(user_id=u_id)
+        admin_enrollment = my_enrollment.filter(type="ADMIN")
+        for enr in admin_enrollment:
+            course = Course.objects.get(id=enr.getCourseId())
+            admin_courses.append(course)
+        if (len(admin_courses)>0):
+            return HttpResponseRedirect('/admin')
+        else:
+            return HttpResponseRedirect('/halo_web')
+    return HttpResponseRedirect('/login')
+
+def leaderboard(request, course_id):
+    this_course = Course.objects.get(id=course_id)
+    course_enrollment = Enrollment.objects.filter(course_id=course_id)
+    enr_this_course = course_enrollment.get(user_id = request.user.id)
+    students = []
+    leaders = []
+    for enrstud in course_enrollment:
+        student = HUser.objects.get(id = enrstud.user_id)
+        students.append(student)
+    students.sort(key=lambda student: student.getXP(), reverse = True)
+    for i in range(5):
+        leaders.append(students[i])
+    return render_to_response('halo_web/leaderboard.html', {'enr_this_course': enr_this_course, 'leaders': leaders}, context_instance = RequestContext(request))
\ No newline at end of file
diff --git a/halo_se_web/login/models.py b/halo_se_web/login/models.py
index 101f318..a7d7f3c 100644
--- a/halo_se_web/login/models.py
+++ b/halo_se_web/login/models.py
@@ -20,6 +20,8 @@ class HUser(models.Model):
         db_table = u'h_user'
     def __unicode__(self):
         return self.firstname + " " + self.lastname
+    def getName(self):
+        return self.firstname + " " + self.lastname
     def getPassword(self):
         return self.password
     def getEmail(self):
@@ -28,6 +30,8 @@ class HUser(models.Model):
         if (hashlib.sha1(typedPassword).hexdigest()==self.getPassword()):
             return True
         return False
+    def getXP(self):
+        return self.xp
     def getUserId(self):
         return self.id
     def is_active(self):
diff --git a/halo_se_web/login/views.py b/halo_se_web/login/views.py
index cd403c6..23af5bb 100644
--- a/halo_se_web/login/views.py
+++ b/halo_se_web/login/views.py
@@ -1,4 +1,5 @@
 from django.contrib.auth import authenticate, login, logout
+from django.contrib.auth.models import AnonymousUser
 from django.http import HttpResponse, Http404, HttpResponseRedirect
 from django import forms
 from django.shortcuts import render_to_response
@@ -7,7 +8,7 @@ from login.models import HUser
 import hashlib

 class LoginForm(forms.Form):
-    email = forms.CharField(max_length=100)
+    uni = forms.CharField(max_length=100)
     password = forms.CharField(widget=forms.PasswordInput(render_value=False),max_length=100)

 def doLogin(request):
@@ -22,18 +23,14 @@ def doLogin(request):
     if request.method == 'POST': # If the form has been submitted...
         form = LoginForm(request.POST) # A form bound to the POST data
         if form.is_valid(): # All validation rules pass
-            email = request.POST['email']
+            email = request.POST['uni']
             password = request.POST['password']
             user = authenticate(username=email, password=password)
             if user is not None:
                 if user.is_active:
                     # Redirect to a success page.
                     login(request, user)
-                    print "user.is_active and logged in"
-                    return render_to_response('login/success.html', {
-                        'email': email,
-                        'user': user,
-                    }, context_instance = RequestContext(request))
+                    return HttpResponseRedirect('/')
                 else:
                     # Return a 'disabled account' error message
                     error = u'account disabled'
@@ -57,9 +54,12 @@ def doLogout(request):
     return HttpResponseRedirect('/')

 def showCredentials(request):
-    user = HUser.objects.all()
-    password = HUser.objects.all()[0].getPassword()
-    email = HUser.objects.all()[0].getEmail()
-    return render_to_response('login/credentials.html', {'dump': user, 'password': password, 'email': email})
+    user = request.user
+    if not user.is_authenticated():
+        return render_to_response('login/notloggedin.html', {'dump': user}, context_instance = RequestContext(request))
+    else:
+        password = user.getPassword()
+        email = user.getEmail()
+        return render_to_response('login/credentials.html', {'dump': user, 'password': password, 'email': email}, context_instance = RequestContext(request))


diff --git a/halo_se_web/settings.py b/halo_se_web/settings.py
index 45eb215..8c498e0 100644
--- a/halo_se_web/settings.py
+++ b/halo_se_web/settings.py
@@ -117,11 +117,12 @@ INSTALLED_APPS = (
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'googlecharts',
     'halo_web',
     'halo_admin',
     'login',
     # Uncomment the next line to enable the admin:
-    'django.contrib.admin',
+    #'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
 )
diff --git a/halo_se_web/templates/404.html b/halo_se_web/templates/404.html
deleted file mode 100644
index fd1b549..0000000
--- a/halo_se_web/templates/404.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% load i18n %}
-
-{% block title %}{{ title }} | {% trans 'HALO Django Test: 404' %}{% endblock %}
-
-{% block branding %}
-<h1 id="site-name">{% trans 'HALO Django Test' %}</h1>
-{% endblock %}
-
-<h2>Sorry, we couldn't find that page. Please try a different URL.</h2>
diff --git a/halo_se_web/templates/base_site.html b/halo_se_web/templates/base_site.html
deleted file mode 100644
index ab67243..0000000
--- a/halo_se_web/templates/base_site.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% extends "admin/base.html" %}
-{% load i18n %}
-
-{% block title %}{{ title }} | {% trans 'HALO Django Test' %}{% endblock %}
-
-{% block branding %}
-<h1 id="site-name">{% trans 'HALO Django Test Administration' %}</h1>
-{% endblock %}
-
-{% block nav-global %}{% endblock %}
diff --git a/halo_se_web/templates/halo_admin/course_admin.html b/halo_se_web/templates/halo_admin/course_admin.html
index 1e003cf..866eedf 100644
--- a/halo_se_web/templates/halo_admin/course_admin.html
+++ b/halo_se_web/templates/halo_admin/course_admin.html
@@ -15,38 +15,36 @@
 	<div class="header">
 		<div class="title">HALO SE Administration</div> <div class="welcome" >Welcome, {{ user }}. <a href="/logout">Logout</a></div>
 	</div>
-
 	<ul class="admin-course-list">
 		{% for course in admin_courses %}
 			<li> <a href="/admin/{{ course.id }}">{{ course.name }} </a></li>
+			<ul>
+				<li><a href="/admin/{{course.id}}/add_assignment">(+) Add New Assignment</a></li>
+			{% for assignment in assignments %}
+				<li><a href="/admin/{{course.id}}/{{assignment.id}}/quests">{{assignment.title}}</a></li>
+			{% endfor %}
+			</ul>
 		{% endfor %}
 	</ul>

-	<div class="crud-wrapper">
-		<table id="crud-table">
-			<tr>
-				<td class="crud-item crud-assignments"><a href="/admin/{{ this_course.id }}/assignments">Assignments</a></td>
-				<td class="crud-add crud-assignments">Add</td>
-				<td class="crud-change crud-assignments">Change</td>
-			</tr>
-			<tr>
-				<td class="crud-item crud-quests"><a href="/admin/{{ this_course.id }}/quests">Quests</a></td>
-				<td class="crud-add crud-quests">Add</td>
-				<td class="crud-change crud-quests">Change</td>
-			</tr>
-			<tr>
-				<td class="crud-item crud-tasks">Tasks</td>
-				<td class="crud-add crud-tasks">Add</td>
-				<td class="crud-change crud-tasks">Change</td>
-			</tr>
-		</table>
-	</div>
-
+	{% load charts %}
+	{% chart %}
+		{% chart-title "Tasks Completed This Week" %}
+		{% chart-data data %}
+		{% chart-type "bar" %}
+		{% chart-size "300x1000" %}
+		{% axis "left" %}
+			{% axis-labels students %}
+		{% endaxis %}
+		{% axis "bottom" %}
+			{% axis-range 0 data_max %}
+		{% endaxis %}
+	{% endchart %}

 </body>
 </html>

 {% else %}
-Sorry, you do not have permission to see this page.
+Sorry, you do not have permission to see this page. Please <a href="/login">log in</a> to administer a course.

 {% endif %}
\ No newline at end of file
diff --git a/halo_se_web/templates/halo_admin/dashboard.html b/halo_se_web/templates/halo_admin/dashboard.html
index 328d19b..43c76ab 100644
--- a/halo_se_web/templates/halo_admin/dashboard.html
+++ b/halo_se_web/templates/halo_admin/dashboard.html
@@ -5,6 +5,9 @@
 <head>
 	<title>HALO SE Admin</title>
 	<link rel="stylesheet" href="{{ STATIC_URL }}css/dashboard.css" type="text/css" />
+<!--	<script src="{{ STATIC_URL }}js/jquery-1.6.4.js"></script>
+	<script src="{{ STATIC_URL }}js/jquery.jstree.js"></script>
+	<script src="{{ STATIC_URL }}js/dashboard.js"></script> -->
 </head>
 <body class="admin-dashboard">
 	<div class="header">
@@ -43,6 +46,14 @@ Please select a class to administer.
 			</ul>
 		{% endfor %}
 	</ul>
+	{% load charts %}
+	{% chart %}
+		{% chart-data data1 %}
+		{% chart-size "300x200" %}
+		{% chart-type "pie" %}
+		{% chart-labels "One" "Two" "Three" %}
+		{% chart-alt "It worked!" %}
+	{% endchart %}

 </body>
 </html>
diff --git a/halo_se_web/templates/halo_web/index.html b/halo_se_web/templates/halo_web/index.html
index 96b9ffe..201ace2 100644
--- a/halo_se_web/templates/halo_web/index.html
+++ b/halo_se_web/templates/halo_web/index.html
@@ -1,9 +1,10 @@
-{% if quest_list %}
+{% if courses %}
+	My Courses
 	<ul>
-	{% for quest in quest_list %}
-		<li>{{ quest }}</li>
+	{% for course in courses %}
+		<li><a href="/halo_web/{{course.id}}/leaderboard">{{ course.name }}</a></li>
 	{% endfor %}
 	</ul>
 {% else %}
-	<p>No quests are available.</p>
+	<p>You are not enrolled in any courses.</p>
 {% endif %}
\ No newline at end of file
diff --git a/halo_se_web/templates/index.html b/halo_se_web/templates/index.html
deleted file mode 100644
index d392f07..0000000
--- a/halo_se_web/templates/index.html
+++ /dev/null
@@ -1,80 +0,0 @@
-{% extends "admin/base_site.html" %}
-{% load i18n %}
-
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css" />{% endblock %}
-
-{% block coltype %}colMS{% endblock %}
-
-{% block bodyclass %}dashboard{% endblock %}
-
-{% block breadcrumbs %}{% endblock %}
-
-{% block content %}
-<div id="content-main">
-
-{% if app_list %}
-    {% for app in app_list %}
-        <div class="module">
-        <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
-        <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption>
-        {% for model in app.models %}
-            <tr>
-            {% if model.perms.change %}
-                <th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
-            {% else %}
-                <th scope="row">{{ model.name }}</th>
-            {% endif %}
-
-            {% if model.perms.add %}
-                <td><a href="{{ model.admin_url }}add/" class="addlink">{% trans 'Add' %}</a></td>
-            {% else %}
-                <td>&nbsp;</td>
-            {% endif %}
-
-            {% if model.perms.change %}
-                <td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
-            {% else %}
-                <td>&nbsp;</td>
-            {% endif %}
-            </tr>
-        {% endfor %}
-        </table>
-        </div>
-    {% endfor %}
-{% else %}
-    <p>{% trans "You don't have permission to edit anything." %}</p>
-{% endif %}
-</div>
-{% endblock %}
-
-{% block sidebar %}
-<div id="content-related">
-    <div class="module" id="recent-actions-module">
-        <h2>{% trans 'Recent Actions' %}</h2>
-        <h3>{% trans 'My Actions' %}</h3>
-            {% load log %}
-            {% get_admin_log 10 as admin_log for_user user %}
-            {% if not admin_log %}
-            <p>{% trans 'None available' %}</p>
-            {% else %}
-            <ul class="actionlist">
-            {% for entry in admin_log %}
-            <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
-                {% if entry.is_deletion or not entry.get_admin_url %}
-                    {{ entry.object_repr }}
-                {% else %}
-                    <a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
-                {% endif %}
-                <br/>
-                {% if entry.content_type %}
-                    <span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span>
-                {% else %}
-                    <span class="mini quiet">{% trans 'Unknown content' %}</span>
-                {% endif %}
-            </li>
-            {% endfor %}
-            </ul>
-            {% endif %}
-    </div>
-</div>
-{% endblock %}
diff --git a/halo_se_web/urls.py b/halo_se_web/urls.py
index 6b7fb93..bee72df 100644
--- a/halo_se_web/urls.py
+++ b/halo_se_web/urls.py
@@ -22,6 +22,7 @@ urlpatterns = patterns('',
     url(r'^admin/', include('halo_admin.urls')),

     url(r'^halo_web/$', 'halo_web.views.index'),
+    url(r'^halo_web/(?P<course_id>\d+)/leaderboard/$', 'halo_web.views.leaderboard'),
     url(r'^halo_web/quests/$', 'halo_web.views.quests'),
     # Uncomment the next line to enable the admin:
 #    url(r'^admin/', include(admin.site.urls)),