The Controller is a web application that displays pages to the user, handles login and logout, receives responses from the user and performs the operations required using the Model.
The servlet reads configuration from the servlet initialisation parameters and registers all Model Implementations with the relevant factories, then registers all the PageFactory with the correct site names.
When a request is received, it creates a PageContext
object from the
HTTP request and looks up a Page
based on the
PageContext
’s site and page
names. If one isn’t found, it looks up a Page
with site
system
and page
notfound
instead (and if that isn’t found, an exception
is thrown - this is a bug).
Once the servlet has a page, it passes the page context to its internal
rendering function, defined in the Page
object.
A PageContext
object contain methods to discover all information that
a Page may need to know about the current request that has been made,
such as the user session, the help URL for the current page, the current
page’s site name, etc.
It also contains method to render a result, send a file, handle file uploads, or other such operations. It’s a bit monolithic and should be normalised at some point.
Pages in the servlet are provided by PageFactory
objects. The PageFactory
allows registration of
PageFactory
instances under a site name. A static method
in the PageFactory
object allows you to retrieve a Page
object via site name and page name.
Page objects have a template associated with them. This template name maps to a help page template and a HTML template. The HTML template is loaded by the Page object and stored in memory.
When the Servlet renders a Page, it calls an internal function. This first checks privileges, redirecting to a login page if the user is not logged in and is required to me, or to an error page if the user is not an administrator and tried accessing an administration page. It then generates a templating context and puts the page context object into it so that any page template can always access the '$context' object. It then passes the template, the page context and the template context to an abstract function designed to be overriden by page instances that performs the actual logic.
Page Class | Page Identifier | Template | Description |
---|---|---|---|
HomePage | home | system_home | Home page |
LoggedInPage | logged_in | system_logged_in | Logged in with no redirect |
LoginPage | login | system_login | Display login form or perform login |
LogoutPage | logout | system_logout | Log out the user |
NewPasswordPage | new_password | system_new_password | Password request form |
NotAdminPage | not_admin | system_not_admin | User not an admin |
NotFoundPage | not_found | system_404 | Page not found. |
PerformNewPasswordPage | perform_new_password | multi_edited | Generate and email a new password. |
RegisterPage | register | ? | Not used currently. |
Page Class | Page Identifier | Template | Description |
---|---|---|---|
ActivatePage | activate | student_activate | Activate a submission (form) |
AssignmentPage | assignment | student_assignment | Assignment details |
AssignmentsPage | assignments | student_assignments | Assignments to submit to |
AssignmentSubmissionsPage | assignment_submissions | student_assignment_submissions | Submissions for an assignment |
DeletePage | delete | student_delete | Delete a submission (form) |
DetailsPage | details | student_details | Student details |
DownloadAssignmentResourcePage | download_assignment_resource | multi_edited | Download an assignment resource |
DownloadSubmissionPage | download_submission | multi_edited | Download a submission |
ModulePage | module | student_module | Module details |
ModulesPage | modules | student_modules | Modules student can access |
PerformActivatePage | perform_activate | multi_edited | Activate a submission |
PerformChangePasswordPage | perform_change_password | multi_edited | Change login password |
PerformDeletePage | perform_delete | multi_edited | Delete a submission |
PerformSubmitPage | perform_submit | student_submitted | Make a submission |
PerformTestPage | perform_test | multi_testresults | Run tests |
SubmissionsPage | submissions | student_submissions | Assignments previously submitted to |
SubmitPage | submit | student_submit | Make a submission (form) |
TestPage | test | student_test | Run tests (form) |
Page Class | Page Identifier | Template | Description |
---|---|---|---|
AddAssignmentFilePage | add_assignment_file | staff_add_assignment_file | Add required file to assignment (form) |
AssignmentFilesPage | asssignment_files | staff_assignment_files | Required files for an assignment (table) |
AssignmentsPage | assignments | staff_assignments | Assignments for a module (table) |
AutoAssignMarkersPage | auto_assign_markers | staff_auto_assign | Auto-create marking assignments (form) |
DeadlineRevisionsPage | deadlinerevisions | staff_deadlinerevisions | Deadline revisions for an assignment (table) |
DeleteSubmissionsPage | delete_submission | ? | Orphaned/unused page |
DownloadSubmissionPage | download_submission | staff_download_submission | Download a submission |
EditAssignmentPage | edit_assignment | staff_edit_assignment | Edit/Delete assignment (form) |
EditDeadlineRevisionPage | edit_deadlinerevision | staff_edit_deadlinerevision | Edit/Delete deadline revision (form) |
EditMarkingAssignmentPage | edit_markingassignment | staff_edit_markingassignment | Edit/Delete marking assignment (form) |
EditMarkingCategoryPage | edit_markingcategory | staff_edit_markingcategory | Edit/Delete marking category (form) |
EditTestPage | edit_test | staff_edit_test | Edit/Delete test (form) |
EditTestParametersPage | edit_test_parameters | staff_edit_test_parameters | Edit test parameters (form) |
EmailResultsPage | email_results | staff_email_results | Email assignment results (form) |
FindMarkerPage | find_marker | multi_find_person | Add a marker 1 (form) |
FindModeratorPage | ? | ? | Orphaned/unused page |
FindStudentPage | find_student | multi_find_person | Add a student 1 (form) |
MarkersPage | markers | staff_markers | Markers for an assignment (table) |
MarkingAssignmentsPage | markingassignments | staff_markingassignments | Marking assignments for an assignment (table) |
MarkingCategoriesPage | markingcategories | staff_markingcategories | Marking categories for an assignment (table) |
ModulesPage | modules | staff_modules | Modules to administrate (table) |
PerformAddAssignmentFilePage | perform_add_assignment_file | multi_edited | Add a required assignment file |
PerformAddMarkerPage | perform_add_marker | multi_edited | Add an assignment marker |
PerformAddStudentPage | perform_add_student | multi_edited | Add a module student |
PerformAutoAssignMarkersPage | perform_auto_assign_markers | multi_edited | Auto-create marking assignments |
PerformEditAssignmentPage | perform_edit_assignment | multi_edited | Edit/delete an assignment |
PerformEditDeadlineRevisionPage | perform_edit_deadlinerevision | multi_edited | Edit/delete a deadline revision |
PerformEditMarkingAssignmentPage | perform_edit_markingassignment | multi_edited | Edit/delete a marking assignment |
PerformEditMarkingCategoryPage | perform_edit_markingcategory | multi_edited | Edit/delete a marking category |
PerformEditTestPage | perform_edit_test | multi_edited | Edit/delete a test |
PerformEditTestParametersPage | perform_edit_test_parameters | multi_edited | Edit test parameters |
PerformEmailResultsPage | perform_email_results | multi_edited | Email results out to students |
PerformFindMarkerPage | perform_find_marker | multi_found_person | Add a marker 2 (form) |
PerformFindModeratorPage | ? | ? | Orphaned/unused page |
PerformFindStudentPage | perform_find_student | multi_found_person | Add a student 2 (form) |
PerformPublishResultsPage | perform_publish_results | multi_edited | Publish results for an assignment |
PerformRemoveAssignmentFilePage | perform_remove_assignment_file | multi_edited | Remove a required file from an assignment |
PerformRemoveMarkerPage | perform_remove_marker | multi_edited | Remove a marker from an assignment |
PerformRemoveStudentPage | perform_remove_student | multi_edited | Remove a student from a module |
PerformTestHashPage | perform_test_hash | staff_hashed | Hash a submission to generate a security code |
PeformUploadAssignmentResourcePage | perform_upload_assignment_resource | multi_edited | Upload an assignment resource |
PerformUploadTestResourcePage | perform_upload_test_resource | multi_edited | Upload a test resource |
PublishResultsPage | publish_results | staff_publish_results | Publis results for an assignment (form) |
ResultsPage | results | staff_results | Results for an assignment (table) |
StudentsPage | students | staff_students | Students for a module (table) |
SubmissionsPage | submissions | staff_submissions | Submissions for an assignment (table) |
TestHashPage | test_hash | staff_test_hash | Hash a submission to generate a security code (form) |
TestsPage | tests | staff_tests | Tests for an assignment (table) |
UploadAssignmentResourcePage | upload_assignment_resource | staff_upload_assignment_resource | Upload an assignment resource (form) |
UploadTestResourcePage | upload_test_resource | staff_upload_test_resource | Upload a test resource (form) |
Page Class | Page Identifier | Template | Description |
---|---|---|---|
AssignmentsPage | assignments | marker_assignments | Assignments that a marker can mark (table) |
DownloadSubmissionPage | download_submission | multi_edited | Download a submission |
EditMarkPage | edit_mark | marker_edit_mark | Edit/delete a mark (form) |
MarksPage | marks | marker_marks | Marks for a particular marking assignment (table) |
PerformEditMarkPage | perform_edit_mark | multi_edited | Edit/delete a mark |
PerformTestPage | perform_test | multi_testresults | Execute tests on a submission |
StudentsPage | students | marker_students | Students that a marker can mark for an assignment (table) |
SubmissionsPage | submissions | marker_submissions | Submissions a student has submitted to an assignment (table) |
TestPage | test | marker_test | Execute tests on a submission (form) |
Page Class | Page Identifier | Template | Description |
---|---|---|---|
EditModelPage | edit_model | admin_edit_model | Edit/delete a model (form) |
EditModulePage | edit_module | admin_edit_module | Edit/delete a module (form) |
EditPersonPage | edit_person | admin_edit_person | Edit/delete a person (form) |
ExecuteUtilityPage | execute_utility | admin_execute_utility | Execute an administration operation (form) |
FindModuleAdministratorPage | find_module_administrator | multi_find_person | Add module administrator 1 (form) |
ModelsPage | models | admin_models | Models in the database (table) |
ModuleAdministratorsPage | module_administrators | admin_module_administrators | Module adminsitrators (table) |
ModulesPage | modules | admin_modules | Modules for a model (table) |
PeoplePage | people | admin_people | People in the database (table) |
PerformAddModuleAdministratorPage | perform_add_module_administrator | multi_edited | Add module administrator |
PerformEditModelPage | perform_edit_model | multi_edited | Edit/delete a model |
PerformEditModulePage | perform_edit_module | multi_edited | Edit/delete a module |
PerformEditPersonPage | perform_edit_person | multi_edited | Edit/delete a person |
PerformExecuteUtilityPage | perform_execute_utility | admin_executed_utility | Execute an administration operation |
PerformFindModuleAdministratorPage | perform_find_module_administrator | multi_found_person | Add module administrator 2 (form) |
PerformRemoveModuleAdministratorPage | perform_remove_module_administrator | multi_edited | Remove module administrator |
UtilitiesPage | utilities | admin_utilities | List of available admin operations |