(****** * This file defines objects and operation in the FILE menu of the main interface * *) module File; from Gradesheet import GradeSheet; from Grader import Class; from Grader import GraderTool; export all; object FileSpace is File* description: (* A FileSpace is an abstract model of a file space in the operating environment in which the Grader tool is run. The FileSpace is simply a collection of zero or more Files, with no other properties modeled here. *); end FileSpace; object File is components: name:FileName and permissions:FilePermissions and file_type:FileType and data:FileData; description: (* A File is an abstraction of a file stored in the file space. It has a name, permissions, type, and data. These are the components sufficient to specify the behavior of Grader Tool file operations. *); end File; object FileName is string description: (* The name of a file. The string representation here is an abstraction of file names used in specific operating environments. Implementations may obey any syntactic or semantic constraints imposed by a particular environment. *); end; object FilePermissions is is_readable:IsReadable and is_writable:IsWritable description: (* FilePermissions indicate whether a file is readable and/or writable. *); end; object IsReadable is boolean description: (* Flag indicating whether a file is readable, which is required to be true by the OpenBackupFile operation. *); end; object IsWritable is boolean description: (* Flag indicating whether a file is writable, which is required to be true by the SaveBackupFile operation. *); end; object FileType is Grader_type:GraderType or other_type:OtherType description: (* The type of file data is either GraderType data (which we care about) or any other type of data that can be stored in a file, which we don't care about. *); end FileType; object GraderType description: (* File data typing tag indicating that a file contains grade data created by the Grader Tool *); end GraderType; object OtherType description: (* File data typing tag indicating that a file contains data other than grader data created by the Grader Tool *); end OtherType; object FileData is UserGrader description: (* The abstract representation of grader-type FileData is a UserGrader object. Grader Tool implementors may use any concrete file data representation that accurately holds all UserGrader components. *); end FileData; object UserGrader; object ServerInfo is ServerAddress and ProfID and ProfPassword description: (* Contains server address, username, and password needed post grades to SIS *); end ServerName; object ServerAddress is string description: (* Standard FTP style server address of the SIS server being posted to *); end ServerAddress; object ProfID is string description: (* Professor ID for the SIS server *); end ProfID; object ProfPassword is string description: (* Professor password for the SIS server *); end ProfPassword; object ServerData description: (* General representation of the SIS server data. This is outside the scope of Grader *); end ServerData; object PrinterSpecifications; operation NewClass is inputs: c:Class; outputs: g:GradeSheet, c':Class; precondition: ; postcondition: ; description: (* Enables a professor to create a new blank Gradesheet for a class. All cells are initially empty and there are no assignment columns defined. The file >> new feature is usually used for circumstances where SIS initial setup is unable to fully describe the classes a professor is working on. The new class appears in the left hand navigation menu. *); end NewClass; operation OpenBackupFile is inputs: fs:FileSpace, fn:FileName, c:Class; outputs: fs':FileSpace, c':Class, g:GradeSheet; precondition: ; postcondition: ; description: (* If a backup file from a previously defined class is available, it can be opened as the current Gradesheet being viewed. The gradesheet will appear with all grades and assignments that it contained when it was previously saved. The opened Gradesheet will appear in the left hand navigation menu. *); end OpenBackupFile; operation SaveBackupFile is inputs: fs:FileSpace, c:Class, g:GradeSheet; outputs: fs':FileSpace, c':Class, g':GradeSheet; precondition: ; postcondition: ; description: (* Saves all current grades and assignments to a backup file. This file contains all information visible on the spreadsheet for a class including student names, student scores, and assignment names. The backup file is saved to the original file it was opened from without an additional dialog. The Gradesheet remains open for additional use. *); end SaveBackupFile; operation SaveBackupFileAs is inputs: fs:FileSpace, fn:FileName, c:Class, g:GradeSheet; outputs: fs':FileSpace, c':Class, g':GradeSheet; precondition: ; postcondition: ; description: (* Saves all current grades and assignments to a backup file. This file contains all information visible on the spreadsheet for a class including student names, student scores, and assignment names. The backup file is saved to the location specified in the standard Save As dialog. The Gradesheet remains open for additional use. *); end SaveBackupFileAs; operation CloseBackupFile is inputs: fs:FileSpace, c:Class, g:GradeSheet; outputs: fs':FileSpace, c':Class, g':GradeSheet; precondition: ; postcondition: ; description: (* Closes the current working Gradesheet. If the Gradesheet has not been saved, a prompt will ask the user to save before closing. Other Gradesheets open will be left open according to the standard multi-document model. *); end CloseBackupFile; operation ImportFromSIS is inputs: c:Class, g:GradeSheet, si:ServerInfo; outputs: g':GradeSheet; precondition: ; postcondition: ; description: (* Opens the Importing from SIS dialog described in Section 2.2.1 of the requirements document. This operation contacts the university record's office server to download the official university records for people registered in classes associated with the professor's UserID specified. From the university record, classes are automatically built to reflect the students enrolled. These classes are displayed in the left hand navigation menu for easy access. For More detail see section 2.2.1 of the requirements document. *); end ImportFromSIS; operation ExportToSIS is inputs: gr:GraderTool, si:ServerInfo, ; outputs: si':ServerInfo; precondition: ; postcondition: ; description: (* *); end ExportToSIS; operation SetupPageToPrint is inputs: p:PrinterSpecifications, g:GraderTool; outputs: g':GraderTool; precondition: ; postcondition: ; description: (* Standard Page Setup menu for configuring printing preferences. Configurable options include printing margins, printing quality, and printing orientation. *); end SetupPageToPrint; operation PreviewPageToPrint is inputs: p:PrinterSpecifications, g:GraderTool; outputs: g':GraderTool; precondition: ; postcondition: ; description: (* Standard Print Preview functionality. A temporary image is generated to display how the document will look if it is printed. User may print directly from this preview if it is acceptable, or press close to go back and make changes without printing. *); end PreviewPageToPrint; operation SendToPrinter is inputs: p:PrinterSpecifications, g:GraderTool; outputs: ; outputs: ; precondition: ; postcondition: ; description: (* Standard Print function. Sends document to the printer using PrinterSpecifications defined above. *); end SendToPrinter; operation CloseProgram is inputs: g:GraderTool; outputs: ; precondition: ; postcondition: ; description: (* Closes the program entirely including all gradesheets open. If there are unsaved changes have occurred, the user will be prompted to save changes before exiting in standard dialog. *); end CloseProgram; end File;