| # Copyright 2011 the Melange authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| """Module for the admin pages.""" |
| |
| from google.appengine.api import taskqueue |
| from google.appengine.ext import db |
| |
| from django import http |
| from django.utils.translation import ugettext |
| |
| from melange.request import access |
| from melange.request import exception |
| |
| from soc.views.dashboard import Dashboard |
| from soc.views.helper import url_patterns |
| |
| from soc.modules.gsoc.models.grading_project_survey import GradingProjectSurvey |
| from soc.modules.gsoc.models.grading_survey_group import GSoCGradingSurveyGroup |
| from soc.modules.gsoc.models.project_survey import ProjectSurvey |
| from soc.modules.gsoc.views import base |
| from soc.modules.gsoc.views.helper import url_names |
| from soc.modules.gsoc.views.helper.url_patterns import url |
| |
| from summerofcode.request import links |
| from summerofcode.templates import project_list |
| from summerofcode.views.helper import urls |
| |
| |
| class DashboardPage(base.GSoCRequestHandler): |
| """Dashboard for admins.""" |
| |
| access_checker = access.PROGRAM_ADMINISTRATOR_ACCESS_CHECKER |
| |
| def djangoURLPatterns(self): |
| return [ |
| url(r'admin/%s$' % url_patterns.PROGRAM, self, |
| name='gsoc_admin_dashboard'), |
| ] |
| |
| def templatePath(self): |
| return 'modules/gsoc/admin/base.html' |
| |
| def context(self, data, check, mutator): |
| """Context for dashboard page.""" |
| dashboards = [] |
| |
| dashboards.append(MainDashboard(data)) |
| dashboards.append(ProgramSettingsDashboard(data)) |
| dashboards.append(ManageOrganizationsDashboard(data)) |
| dashboards.append(EvaluationsDashboard(data)) |
| dashboards.append(MentorEvaluationsDashboard(data)) |
| dashboards.append(StudentEvaluationsDashboard(data)) |
| dashboards.append(EvaluationGroupDashboard(data)) |
| dashboards.append(StudentsDashboard(data)) |
| dashboards.append(ParticipantsDashboard(data)) |
| |
| dashboards.append(ShipmentTrackingDashboard(data)) |
| dashboards.append(ShipmentInfoDashboard(data)) |
| |
| return { |
| 'dashboards': dashboards, |
| 'page_name': 'Admin dashboard', |
| } |
| |
| def post(self, data, check, mutator): |
| """Handles a post request. |
| |
| Do nothing, since toggle button posting to this handler |
| without expecting any response. |
| """ |
| return http.HttpResponse() |
| |
| |
| class MainDashboard(Dashboard): |
| """Dashboard for admin's main-dashboard.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| super(MainDashboard, self).__init__(data) |
| |
| def context(self): |
| """Returns the context of main dashboard.""" |
| # TODO(nathaniel): Eliminate this state-setting call. |
| self.data.redirect.program() |
| |
| manage_orgs = ManageOrganizationsDashboard(self.data) |
| program_settings = ProgramSettingsDashboard(self.data) |
| evaluations = EvaluationsDashboard(self.data) |
| participants = ParticipantsDashboard(self.data) |
| students = StudentsDashboard(self.data) |
| shipment_tracking = ShipmentTrackingDashboard(self.data) |
| |
| subpages = [ |
| { |
| 'name': 'lookup_profile', |
| 'description': ugettext('Lookup profile of mentor or student'), |
| 'title': 'Lookup profile', |
| 'link': links.SOC_LINKER.program( |
| self.data.program, urls.UrlNames.PROFILE_LOOKUP) |
| }, |
| { |
| 'name': 'allocate_slots', |
| 'description': ugettext( |
| 'Allocate slots (number of acceptable projects) per ' |
| 'organization'), |
| 'title': 'Allocate slots', |
| 'link': self.data.redirect.urlOf('gsoc_slots') |
| }, |
| { |
| 'name': 'slots_transfer', |
| 'description': ugettext( |
| 'Transfer slots for organizations'), |
| 'title': 'Slots transfer', |
| 'link': self.data.redirect.urlOf('gsoc_admin_slots_transfer') |
| }, |
| { |
| 'name': 'duplicates', |
| 'description': ugettext( |
| 'Find students who have proposals accepted by more than one ' |
| 'organization.'), |
| 'title': 'Duplicates', |
| 'link': self.data.redirect.urlOf(urls.UrlNames.DUPLICATES) |
| }, |
| { |
| 'name': 'accept_proposals', |
| 'description': ugettext( |
| 'Start proposals into projects conversion'), |
| 'title': 'Bulk accept proposals and send acceptance/rejection ' |
| 'emails', |
| 'link': self.data.redirect.urlOf('gsoc_accept_proposals') |
| }, |
| { |
| 'name': 'manage_proposals', |
| 'description': ugettext( |
| 'Lists all the proposals submitted to the program and lets ' |
| 'accept individual proposals.'), |
| 'title': 'Proposals submitted', |
| 'link': links.SOC_LINKER.program( |
| self.data.program, urls.UrlNames.PROPOSAL_LIST_FOR_HOST) |
| }, |
| { |
| 'name': 'participants', |
| 'description': ugettext( |
| 'List of all participants in this program.'), |
| 'title': 'Participants', |
| 'link': '', |
| 'subpage_links': participants.getSubpagesLink(), |
| }, |
| { |
| 'name': 'students', |
| 'description': ugettext( |
| 'Manage all the Student\'s projects.'), |
| 'title': 'Students', |
| 'link': '', |
| 'subpage_links': students.getSubpagesLink(), |
| }, |
| { |
| 'name': 'manage_organizations', |
| 'description': ugettext( |
| 'Manage organizations from active program. You can allocate ' |
| 'slots for organizations, list mentors and administrators ' |
| 'from various organizations'), |
| 'title': 'Manage organizations', |
| 'link': '', |
| 'subpage_links': manage_orgs.getSubpagesLink(), |
| }, |
| { |
| 'name': 'evaluations', |
| 'description': ugettext( |
| 'Send reminder, evaluation group, create, edit, ' |
| 'view evaluations for mentors and students'), |
| 'title': 'Evaluations', |
| 'link': '', |
| 'subpage_links': evaluations.getSubpagesLink(), |
| }, |
| { |
| 'name': 'program_settings', |
| 'description': ugettext( |
| 'Edit program settings and timeline'), |
| 'title': 'Program settings', |
| 'link': '', |
| 'subpage_links': program_settings.getSubpagesLink(), |
| }, |
| { |
| 'name': 'shipment_tracking', |
| 'description': ugettext( |
| 'Shipment tracking for students'), |
| 'title': 'Tracking Information', |
| 'link': '', |
| 'subpage_links': shipment_tracking.getSubpagesLink(), |
| }, |
| ] |
| |
| return { |
| 'title': 'Admin Dashboard', |
| 'name': 'main', |
| 'subpages': self._divideSubPages(subpages), |
| 'enabled': True |
| } |
| |
| |
| class ProgramSettingsDashboard(Dashboard): |
| """Dashboard for admin's program-settings-dashboard.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'edit_program', |
| 'description': ugettext( |
| 'Edit your program settings such as information, slots, ' |
| 'documents, etc.'), |
| 'title': 'Edit program settings', |
| 'link': data.redirect.urlOf(url_names.GSOC_PROGRAM_EDIT) |
| }, |
| { |
| 'name': 'edit_timeline', |
| 'description': ugettext( |
| 'Edit your program timeline such as program start/end date, ' |
| 'student signup start/end date, etc.'), |
| 'title': 'Edit timeline', |
| 'link': data.redirect.urlOf('edit_gsoc_timeline') |
| }, |
| { |
| 'name': 'edit_program_messages', |
| 'description': ugettext( |
| 'Edit program messages which will be sent in emails ' |
| 'to the specified participants.'), |
| 'title': 'Edit messages', |
| 'link': data.redirect.urlOf(url_names.GSOC_EDIT_PROGRAM_MESSAGES) |
| }, |
| { |
| 'name': 'documents', |
| 'description': ugettext( |
| 'List of documents from various program.'), |
| 'title': 'List of documents', |
| 'link': data.redirect.urlOf('list_gsoc_documents') |
| }, |
| { |
| 'name': 'create_program', |
| 'description': ugettext( |
| 'Create a new program.'), |
| 'title': 'Create a program', |
| 'link': links.SOC_LINKER.sponsor( |
| data.sponsor, url_names.GSOC_PROGRAM_CREATE), |
| }, |
| ] |
| |
| super(ProgramSettingsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of program settings dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Program Settings', |
| 'name': 'program_settings', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class ManageOrganizationsDashboard(Dashboard): |
| """Dashboard for admin's manage-organizations-dashboard.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'edit_org_app', |
| 'description': ugettext( |
| 'Create or edit organization application'), |
| 'title': 'Edit organization application', |
| 'link': data.redirect.urlOf('gsoc_edit_org_app') |
| }, |
| { |
| 'name': 'preview_org_app', |
| 'description': ugettext( |
| 'Preview of the organization application.'), |
| 'title': 'Preview organization application', |
| 'link': data.redirect.urlOf('gsoc_preview_org_app') |
| }, |
| { |
| 'name': 'org_app_records', |
| 'description': ugettext( |
| 'List of organization application that have been ' |
| 'submitted to the program'), |
| 'title': 'Submitted organization applications', |
| 'link': links.SOC_LINKER.program( |
| data.program, urls.UrlNames.ORG_APPLICATION_LIST) |
| }, |
| { |
| 'name': 'org_app_bulk_records', |
| 'description': ugettext( |
| 'Bulk reivew of organization applications.'), |
| 'title': 'Bulk review of organization applications', |
| 'link': links.SOC_LINKER.program( |
| data.program, urls.UrlNames.ORG_APPLICATION_BULK_LIST) |
| }, |
| ] |
| |
| super(ManageOrganizationsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of manage organizations dashboard.""" |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Manage Organizations', |
| 'name': 'manage_organizations', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class EvaluationsDashboard(Dashboard): |
| """Dashboard for admin's evaluations-dashboard.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| mentor_evaluations = MentorEvaluationsDashboard(data) |
| student_evaluations = StudentEvaluationsDashboard(data) |
| evaluation_group = EvaluationGroupDashboard(data) |
| |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'reminder_emails', |
| 'description': ugettext( |
| 'Send reminder emails for evaluations.'), |
| 'title': 'Send reminder', |
| 'link': data.redirect.urlOf('gsoc_survey_reminder_admin') |
| }, |
| { |
| 'name': 'mentor_evaluations', |
| 'description': ugettext( |
| 'Create, edit and view evaluations for mentors'), |
| 'title': 'Mentor Evaluations', |
| 'link': '', |
| 'subpage_links': mentor_evaluations.getSubpagesLink(), |
| }, |
| { |
| 'name': 'student_evaluations', |
| 'description': ugettext( |
| 'Create, edit and view evaluations for students'), |
| 'title': 'Student Evaluations', |
| 'link': '', |
| 'subpage_links': student_evaluations.getSubpagesLink(), |
| }, |
| { |
| 'name': 'evaluation_group', |
| 'description': ugettext('Manage the results of the evaluation'), |
| 'title': 'Evaluation Group', |
| 'link': '', |
| 'subpage_links': evaluation_group.getSubpagesLink(), |
| }, |
| ] |
| |
| super(EvaluationsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of manage organizations dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Evaluations', |
| 'name': 'evaluations', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class MentorEvaluationsDashboard(Dashboard): |
| """Dashboard for mentor's evaluations.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| survey_key = db.Key.from_path( |
| GradingProjectSurvey.kind(), '%s/%s' % ( |
| data.program.key().name(), 'midterm')) |
| subpages = [ |
| { |
| 'name': 'edit_mentor_evaluation', |
| 'description': ugettext('Create or edit midterm evaluation for ' |
| 'mentors in active program'), |
| 'title': 'Create or Edit Midterm', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_edit_mentor_evaluation') |
| }, |
| { |
| 'name': 'preview_mentor_evaluation', |
| 'description': ugettext('Preview midterm evaluation to be ' |
| 'administered mentors.'), |
| 'title': 'Preview Midterm Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_preview_mentor_evaluation') |
| }, |
| { |
| 'name': 'view_mentor_evaluation', |
| 'description': ugettext('View midterm evaluation for mentors'), |
| 'title': 'View Midterm Records', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_list_mentor_eval_records') |
| }, |
| ] |
| |
| survey_key = db.Key.from_path( |
| GradingProjectSurvey.kind(), '%s/%s' % ( |
| data.program.key().name(), 'final')) |
| subpages += [ |
| { |
| 'name': 'edit_mentor_evaluation', |
| 'description': ugettext('Create or edit midterm evaluation for ' |
| 'mentors in active program'), |
| 'title': 'Create or Edit Final Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_edit_mentor_evaluation') |
| }, |
| { |
| 'name': 'preview_mentor_evaluation', |
| 'description': ugettext('Preview final evaluation to be ' |
| 'administered mentors.'), |
| 'title': 'Preview Final Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_preview_mentor_evaluation') |
| }, |
| { |
| |
| 'name': 'view_mentor_evaluation', |
| 'description': ugettext('View final evaluation for mentors'), |
| 'title': 'View Final Evaluation Records', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_list_mentor_eval_records') |
| }, |
| ] |
| |
| super(MentorEvaluationsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of mentor evaluations dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Mentor Evaluations', |
| 'name': 'mentor_evaluations', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| { |
| 'to': 'evaluations', |
| 'title': 'Evaluations' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class StudentEvaluationsDashboard(Dashboard): |
| """Dashboard for student's evaluations.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| survey_key = db.Key.from_path( |
| ProjectSurvey.kind(), '%s/%s' % (data.program.key().name(), 'midterm')) |
| subpages = [ |
| { |
| 'name': 'edit_student_evaluation', |
| 'description': ugettext('Create or edit midterm evaluation for ' |
| 'students in active program'), |
| 'title': 'Create or Edit Midterm Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_edit_student_evaluation') |
| }, |
| { |
| 'name': 'preview_student_evaluation', |
| 'description': ugettext('Preview midterm evaluation to be ' |
| 'administered to the students.'), |
| 'title': 'Preview Midterm Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_preview_student_evaluation') |
| }, |
| { |
| 'name': 'view_student_evaluation', |
| 'description': ugettext('View midterm evaluation for students'), |
| 'title': 'View Midterm Evaluation Records', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_list_student_eval_records') |
| }, |
| ] |
| |
| survey_key = db.Key.from_path( |
| ProjectSurvey.kind(), '%s/%s' % (data.program.key().name(), 'final')) |
| subpages += [ |
| { |
| 'name': 'edit_student_evaluation', |
| 'description': ugettext('Create or edit final evaluation for ' |
| 'students in active program'), |
| 'title': 'Create or Edit Final Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_edit_student_evaluation') |
| }, |
| { |
| 'name': 'preview_student_evaluation', |
| 'description': ugettext('Preview final evaluation to be ' |
| 'administered to the students.'), |
| 'title': 'Preview Final Evaluation', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_preview_student_evaluation') |
| }, |
| { |
| 'name': 'view_student_evaluation', |
| 'description': ugettext('View final evaluation for students'), |
| 'title': 'View Final Evaluation Records', |
| 'link': links.SOC_LINKER.survey( |
| survey_key, 'gsoc_list_student_eval_records') |
| }, |
| ] |
| |
| super(StudentEvaluationsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of student evaluations dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Student Evaluations', |
| 'name': 'student_evaluations', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| { |
| 'to': 'evaluations', |
| 'title': 'Evaluations' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class EvaluationGroupDashboard(Dashboard): |
| """Dashboard for evaluation group.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'edit_evaluation_group', |
| 'description': ugettext('Create evaluation group'), |
| 'title': 'Create', |
| 'link': data.redirect.urlOf('gsoc_grading_group') |
| }, |
| ] |
| |
| q = GSoCGradingSurveyGroup.all() |
| q.filter('program', data.program) |
| |
| for group in q: |
| data.redirect.id(group.key().id()) |
| subpages.append({ |
| 'name': 'view_evaluation_group_%s' % group.key().id(), |
| 'description': ugettext('View this group'), |
| 'title': 'View %s' % group.name, |
| 'link': data.redirect.urlOf('gsoc_grading_record_overview') |
| }) |
| |
| super(EvaluationGroupDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of evaluation group dashboard.""" |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Evaluation Group', |
| 'name': 'evaluation_group', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| { |
| 'to': 'evaluations', |
| 'title': 'Evaluations' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class ParticipantsDashboard(Dashboard): |
| """Dashboard for admin's all participants dashboard |
| """ |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'list_mentors', |
| 'description': ugettext( |
| 'List of all the organization admins and mentors'), |
| 'title': 'List mentors and admins', |
| 'link': data.redirect.urlOf('gsoc_list_mentors') |
| }, |
| { |
| 'name': 'list_students', |
| 'description': ugettext( |
| 'List of all students who have registered into the program'), |
| 'title': 'List all students', |
| 'link': data.redirect.urlOf('gsoc_all_students_list_admin') |
| }, |
| { |
| 'name': 'list_accepted_students', |
| 'description': ugettext( |
| 'List of students with accepted projects for the program.'), |
| 'title': 'List accepted students', |
| 'link': data.redirect.urlOf('gsoc_accepted_students_list_admin'), |
| } |
| ] |
| |
| super(ParticipantsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of participants dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Participants', |
| 'name': 'participants', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class StudentsDashboard(Dashboard): |
| """Dashboard for student related items.""" |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| data: The RequestData object |
| """ |
| # TODO(nathaniel): Eliminate this state-setting call. |
| data.redirect.program() |
| |
| subpages = [ |
| { |
| 'name': 'list_projects', |
| 'description': ugettext( |
| 'List of all the projects who have accepted to the program.'), |
| 'title': 'View All Projects', |
| 'link': data.redirect.urlOf('gsoc_projects_list_admin') |
| }, |
| ] |
| |
| super(StudentsDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of manage students dashboard.""" |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Students', |
| 'name': 'students', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class ShipmentTrackingDashboard(Dashboard): |
| """Dashboard for shipment tracking. |
| """ |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| request: The HTTPRequest object |
| data: The RequestData object |
| """ |
| shipment_info = ShipmentInfoDashboard(data) |
| |
| subpages = [ |
| { |
| 'name': 'shipment_infos', |
| 'description': ugettext('Manage Shipment Information'), |
| 'title': 'Shipment Information', |
| 'link': '', |
| 'subpage_links': shipment_info.getSubpagesLink(), |
| }, |
| { |
| 'name': 'sync_data', |
| 'description': ugettext('Sync Data'), |
| 'title': 'Sync Data', |
| 'link': links.SOC_LINKER.program( |
| data.program, url_names.GSOC_SHIPMENT_LIST), |
| }, |
| ] |
| |
| super(ShipmentTrackingDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of shipment tracking dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Shipment Tracking Information', |
| 'name': 'shipment_tracking', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class ShipmentInfoDashboard(Dashboard): |
| """Dashboard for shipment infos. |
| """ |
| |
| def __init__(self, data): |
| """Initializes the dashboard. |
| |
| Args: |
| request: The HTTPRequest object |
| data: The RequestData object |
| """ |
| subpages = [ |
| { |
| 'name': 'create_shipment_info', |
| 'description': ugettext('Create shipment information'), |
| 'title': 'Create', |
| 'link': links.SOC_LINKER.program( |
| data.program, url_names.GSOC_CREATE_SHIPMENT_INFO), |
| }, |
| { |
| 'name': 'edit_shipment_infos', |
| 'description': ugettext('Edit shipment informations'), |
| 'title': 'Edit', |
| 'link': links.SOC_LINKER.program( |
| data.program, url_names.GSOC_SHIPMENT_INFO_RECORDS), |
| }, |
| ] |
| |
| super(ShipmentInfoDashboard, self).__init__(data, subpages) |
| |
| def context(self): |
| """Returns the context of shipment infos dashboard. |
| """ |
| subpages = self._divideSubPages(self.subpages) |
| |
| return { |
| 'title': 'Shipment Information', |
| 'name': 'shipment_infos', |
| 'backlinks': [ |
| { |
| 'to': 'main', |
| 'title': 'Admin dashboard' |
| }, |
| { |
| 'to': 'shipment_tracking', |
| 'title': 'Shipment Tracking Information' |
| } |
| ], |
| 'subpages': subpages |
| } |
| |
| |
| class SurveyReminderPage(base.GSoCRequestHandler): |
| """Page to send out reminder emails to fill out a Survey.""" |
| |
| access_checker = access.PROGRAM_ADMINISTRATOR_ACCESS_CHECKER |
| |
| def djangoURLPatterns(self): |
| return [ |
| url(r'admin/survey_reminder/%s$' % url_patterns.PROGRAM, self, |
| name='gsoc_survey_reminder_admin'), |
| ] |
| |
| def templatePath(self): |
| return 'modules/gsoc/admin/survey_reminder.html' |
| |
| def post(self, data, check, mutator): |
| post_dict = data.request.POST |
| |
| task_params = { |
| 'program_key': data.program.key().id_or_name(), |
| 'survey_key': post_dict['key'], |
| 'survey_type': post_dict['type'] |
| } |
| |
| task = taskqueue.Task(url=data.redirect.urlOf('spawn_survey_reminders'), |
| params=task_params) |
| task.add() |
| |
| return http.HttpResponseRedirect( |
| data.request.path + '?msg=Reminders are being sent') |
| |
| def context(self, data, check, mutator): |
| q = GradingProjectSurvey.all() |
| q.filter('scope', data.program) |
| mentor_surveys = q.fetch(1000) |
| |
| q = ProjectSurvey.all() |
| q.filter('scope', data.program) |
| student_surveys = q.fetch(1000) |
| |
| return { |
| 'page_name': 'Sending Evaluation Reminders', |
| 'mentor_surveys': mentor_surveys, |
| 'student_surveys': student_surveys, |
| 'msg': data.request.GET.get('msg', '') |
| } |
| |
| |
| class ProjectsListPage(base.GSoCRequestHandler): |
| """View that lists all the projects associated with the program.""" |
| |
| LIST_IDX = 1 |
| |
| access_checker = access.PROGRAM_ADMINISTRATOR_ACCESS_CHECKER |
| |
| def djangoURLPatterns(self): |
| return [ |
| url(r'admin/all_projects/%s$' % url_patterns.PROGRAM, self, |
| name='gsoc_projects_list_admin'), |
| ] |
| |
| def templatePath(self): |
| return 'modules/gsoc/admin/list.html' |
| |
| def jsonContext(self, data, check, mutator): |
| list_content = project_list.getProgramHostProjectList(data).getListData() |
| if list_content: |
| return list_content.content() |
| else: |
| raise exception.Forbidden(message='You do not have access to this data') |
| |
| def context(self, data, check, mutator): |
| return { |
| 'page_name': 'Projects list page', |
| 'list': project_list.getProgramHostProjectList(data), |
| } |