diff --git a/lms/djangoapps/dashboard/decisions/0001-sysadmin-dashboard.rst b/lms/djangoapps/dashboard/decisions/0001-sysadmin-dashboard.rst index a8e76e09d4..a622386903 100644 --- a/lms/djangoapps/dashboard/decisions/0001-sysadmin-dashboard.rst +++ b/lms/djangoapps/dashboard/decisions/0001-sysadmin-dashboard.rst @@ -30,8 +30,7 @@ edX installations using Shibboleth and certificate-based authentication. The courses tabs manages adding/updating courses from git, deleting courses, and provides course listing information, including commit hash, date and author for course imported from git. -The Staffing tab provides a view of staffing and enrollment in courses that include an option to download the data -as a csv. +The Staffing tab provides a view of staffing and enrollment in courses. The Gitlogs tab provides a view into the import log of courses from git repositories. It is convenient for allowing course teams to see what may be wrong wit their xml. This is the only view that allows permits access by course diff --git a/lms/djangoapps/dashboard/decisions/0002-deprecate-sysadmin-dashboard-adr.rst b/lms/djangoapps/dashboard/decisions/0002-deprecate-sysadmin-dashboard-adr.rst index 320c9d6c49..bb6a33cb2c 100644 --- a/lms/djangoapps/dashboard/decisions/0002-deprecate-sysadmin-dashboard-adr.rst +++ b/lms/djangoapps/dashboard/decisions/0002-deprecate-sysadmin-dashboard-adr.rst @@ -31,7 +31,7 @@ would need to be added and/or moved into the cms application 3. Delete a course - https://github.com/edx/edx-platform/blob/master/lms/djangoapps/dashboard/sysadmin.py#L383-L408 + https://github.com/edx/edx-platform/blob/b4556a4bec/lms/djangoapps/dashboard/sysadmin.py#L344-L369 These APIs can be removed entirely, as they are adequately covered by existing functionality: @@ -43,7 +43,7 @@ These APIs can be removed entirely, as they are adequately covered by existing f 2. Staffing and Enrollment - https://github.com/edx/edx-platform/blob/master/lms/djangoapps/dashboard/sysadmin.py#L419-L477 + https://github.com/edx/edx-platform/blob/b4556a4bec/lms/djangoapps/dashboard/sysadmin.py#L380-L413 This functionality may be redundant to features in the Insights application. diff --git a/lms/djangoapps/dashboard/sysadmin.py b/lms/djangoapps/dashboard/sysadmin.py index b92f29edcc..38bd6a97e6 100644 --- a/lms/djangoapps/dashboard/sysadmin.py +++ b/lms/djangoapps/dashboard/sysadmin.py @@ -10,13 +10,12 @@ import os import subprocess import mongoengine -import unicodecsv as csv from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator from django.db import IntegrityError -from django.http import Http404, HttpResponse +from django.http import Http404 from django.utils.decorators import method_decorator from django.utils.html import escape from django.utils.translation import ugettext as _ @@ -71,38 +70,6 @@ class SysadminDashboardView(TemplateView): return self.def_ms.get_courses() - def return_csv(self, filename, header, data): - """ - Convenient function for handling the http response of a csv. - data should be iterable and is used to stream object over http - """ - - csv_file = StringIO() - writer = csv.writer(csv_file, dialect='excel', quotechar='"', - quoting=csv.QUOTE_ALL) - - writer.writerow(header) - - # Setup streaming of the data - def read_and_flush(): - """Read and clear buffer for optimization""" - csv_file.seek(0) - csv_data = csv_file.read() - csv_file.seek(0) - csv_file.truncate() - return csv_data - - def csv_data(): - """Generator for handling potentially large CSVs""" - for row in data: - writer.writerow(row) - csv_data = read_and_flush() - yield csv_data - response = HttpResponse(csv_data(), content_type='text/csv') - response['Content-Disposition'] = u'attachment; filename={0}'.format( - filename) - return response - class Users(SysadminDashboardView): """ @@ -211,13 +178,7 @@ class Users(SysadminDashboardView): action = request.POST.get('action', '') track.views.server_track(request, action, {}, page='user_sysdashboard') - if action == 'download_users': - header = [_('username'), _('email'), ] - data = ([u.username, u.email] for u in - (User.objects.all().iterator())) - return self.return_csv('users_{0}.csv'.format( - request.META['SERVER_NAME']), header, data) - elif action == 'create_user': + if action == 'create_user': uname = request.POST.get('student_uname', '').strip() name = request.POST.get('student_fullname', '').strip() password = request.POST.get('student_password', '').strip() @@ -419,7 +380,7 @@ class Courses(SysadminDashboardView): class Staffing(SysadminDashboardView): """ The status view provides a view of staffing and enrollment in - courses that include an option to download the data as a csv. + courses. """ def get(self, request): @@ -451,31 +412,6 @@ class Staffing(SysadminDashboardView): } return render_to_response(self.template_name, context) - def post(self, request): - """Handle all actions from staffing and enrollment view""" - - action = request.POST.get('action', '') - track.views.server_track(request, action, {}, - page='staffing_sysdashboard') - - if action == 'get_staff_csv': - data = [] - roles = [CourseInstructorRole, CourseStaffRole, ] - - for course in self.get_courses(): - for role in roles: - for user in role(course.id).users_with_role(): - datum = [course.id, role, user.username, user.email, - user.profile.name.encode('utf-8')] - data.append(datum) - header = [_('course_id'), - _('role'), _('username'), - _('email'), _('full_name'), ] - return self.return_csv('staff_{0}.csv'.format( - request.META['SERVER_NAME']), header, data) - - return self.get(request) - class GitLogs(TemplateView): """ diff --git a/lms/templates/sysadmin_dashboard.html b/lms/templates/sysadmin_dashboard.html index a92dd0c13c..a4fe6cf36f 100644 --- a/lms/templates/sysadmin_dashboard.html +++ b/lms/templates/sysadmin_dashboard.html @@ -102,11 +102,6 @@ textarea {
-

- -

- - %endif %if modeflag.get('courses'):