Commit 1a5fc065 by Victor Shnayder Committed by Victor Shnayder

Add beta test group management view to instructor dashboard

* still needs to support uploading a list
* also want to clean up and refactor the code a bit
parent 58a9fded
...@@ -329,7 +329,7 @@ def _course_staff_group_name(location): ...@@ -329,7 +329,7 @@ def _course_staff_group_name(location):
""" """
return 'staff_%s' % Location(location).course return 'staff_%s' % Location(location).course
def _course_beta_test_group_name(location): def course_beta_test_group_name(location):
""" """
Get the name of the beta tester group for a location. Right now, that's Get the name of the beta tester group for a location. Right now, that's
beta_testers_COURSE. beta_testers_COURSE.
...@@ -388,7 +388,7 @@ def _adjust_start_date_for_beta_testers(user, descriptor): ...@@ -388,7 +388,7 @@ def _adjust_start_date_for_beta_testers(user, descriptor):
user_groups = [g.name for g in user.groups.all()] user_groups = [g.name for g in user.groups.all()]
beta_group = _course_beta_test_group_name(descriptor.location) beta_group = course_beta_test_group_name(descriptor.location)
if beta_group in user_groups: if beta_group in user_groups:
debug("Adjust start time: user in group %s", beta_group) debug("Adjust start time: user in group %s", beta_group)
# time_structs don't support subtraction, so convert to datetimes, # time_structs don't support subtraction, so convert to datetimes,
......
...@@ -18,7 +18,7 @@ import xmodule.modulestore.django ...@@ -18,7 +18,7 @@ import xmodule.modulestore.django
# Need access to internal func to put users in the right group # Need access to internal func to put users in the right group
from courseware import grades from courseware import grades
from courseware.access import (has_access, _course_staff_group_name, from courseware.access import (has_access, _course_staff_group_name,
_course_beta_test_group_name) course_beta_test_group_name)
from courseware.models import StudentModuleCache from courseware.models import StudentModuleCache
from student.models import Registration from student.models import Registration
...@@ -645,7 +645,7 @@ class TestViewAuth(PageLoader): ...@@ -645,7 +645,7 @@ class TestViewAuth(PageLoader):
self.assertFalse(has_access(student_user, self.toy, 'load')) self.assertFalse(has_access(student_user, self.toy, 'load'))
# now add the student to the beta test group # now add the student to the beta test group
group_name = _course_beta_test_group_name(self.toy.location) group_name = course_beta_test_group_name(self.toy.location)
g = Group.objects.create(name=group_name) g = Group.objects.create(name=group_name)
g.user_set.add(student_user) g.user_set.add(student_user)
......
...@@ -179,7 +179,7 @@ class TestInstructorDashboardForumAdmin(ct.PageLoader): ...@@ -179,7 +179,7 @@ class TestInstructorDashboardForumAdmin(ct.PageLoader):
self.assertTrue(response.content.find('Removed "{0}" from "{1}" forum role = "{2}"'.format(username, course.id, rolename))>=0) self.assertTrue(response.content.find('Removed "{0}" from "{1}" forum role = "{2}"'.format(username, course.id, rolename))>=0)
self.assertFalse(has_forum_access(username, course.id, rolename)) self.assertFalse(has_forum_access(username, course.id, rolename))
def test_add_and_readd_forum_admin_users(self): def test_add_and_read_forum_admin_users(self):
course = self.toy course = self.toy
self.initialize_roles(course.id) self.initialize_roles(course.id)
url = reverse('instructor_dashboard', kwargs={'course_id': course.id}) url = reverse('instructor_dashboard', kwargs={'course_id': course.id})
......
...@@ -59,7 +59,7 @@ function goto( mode) ...@@ -59,7 +59,7 @@ function goto( mode)
<a href="#" onclick="goto('Admin');" class="${modeflag.get('Admin')}">Admin</a> | <a href="#" onclick="goto('Admin');" class="${modeflag.get('Admin')}">Admin</a> |
<a href="#" onclick="goto('Forum Admin');" class="${modeflag.get('Forum Admin')}">Forum Admin</a> | <a href="#" onclick="goto('Forum Admin');" class="${modeflag.get('Forum Admin')}">Forum Admin</a> |
<a href="#" onclick="goto('Enrollment');" class="${modeflag.get('Enrollment')}">Enrollment</a> <a href="#" onclick="goto('Enrollment');" class="${modeflag.get('Enrollment')}">Enrollment</a>
] <a href="#" onclick="goto('Manage Groups');" class="${modeflag.get('Manage Groups')}">Manage Groups</a> ]
</h2> </h2>
<div style="text-align:right"><span id="djangopid">${djangopid}</span> <div style="text-align:right"><span id="djangopid">${djangopid}</span>
...@@ -168,7 +168,8 @@ function goto( mode) ...@@ -168,7 +168,8 @@ function goto( mode)
<p> <p>
<input type="submit" name="action" value="List course staff members"> <input type="submit" name="action" value="List course staff members">
<p> <p>
<input type="text" name="staffuser"> <input type="submit" name="action" value="Remove course staff"> <input type="text" name="staffuser">
<input type="submit" name="action" value="Remove course staff">
<input type="submit" name="action" value="Add course staff"> <input type="submit" name="action" value="Add course staff">
<hr width="40%" style="align:left"> <hr width="40%" style="align:left">
%endif %endif
...@@ -258,6 +259,21 @@ function goto( mode) ...@@ -258,6 +259,21 @@ function goto( mode)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
%if modeflag.get('Manage Groups'):
%if instructor_access:
<hr width="40%" style="align:left">
<p>
<input type="submit" name="action" value="List beta testers">
<p>
Enter usernames or emails for students who should be beta-testers. They will get to see course materials early, as configured via the <tt>days_early_for_beta</tt> option in the course policy.
</p>
<input type="textarea" name="betausers">
<input type="submit" name="action" value="Add beta testers">
<input type="submit" name="action" value="Remove beta testers">
<hr width="40%" style="align:left">
%endif
%endif
</form> </form>
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment