(*View defines the object and operations need to view lessons and records in the CSTUTOR*) module View; from LessonDB import Lesson, ClassTitle, InstructorTitle, SectionTitle, LessonTitle, Node, NodeItem, NodeTitle, NodeProperties, NodePosition, NextNode, FillIn, QuizNode; from Messaging import ChatRoom; export IsVisible; (*--- OBJECTS --*) object LessonExplorer is components: Level*, isVisible:IsVisible; description: (* A lesson explorer contains many Levels. Each level is broken into seperate catergories. It is a tree like structure. *); end LessonExplorer; object Level is components: ViewDepartment*; description: (* A level is one of the levels of the heiracrcy used for browsing the tutorial in CSTutor. Level 0 is department, Level 1 is Class etc. *); end Level; object ViewDepartment is components: DeptTitle* and ViewClass*; description: (* Department is the top level branch of the heiracry of the lesson explorer. It describes the department which contains the tutorial. In the real world the department would be the participanting departments that provides tutorials for their students. Example of possible departments will be the CSC(computer science) and the BUS(business) department. *); end ViewDepartment; object ViewClass is components: ClassTitle* and ViewInstructor*; description: (* Class describe which class within a department in which a tutorial is offered. As an example will be CSC 101 and CSC 102. Used for easy navigation. *); end ViewClass; object ViewInstructor is components: InstructorTitle* and ViewSection*; description:(* Instructor describe the instructors within a class that offers a tutorial. An example will be CSC 205 will have Professor Fisher and Professor Dalbely listed *); end ViewInstructor; object ViewSection is components: SectionTitle* and ViewLesson*; description: (* Section describes the different section that a instructor might have. *); end ViewSection; object ViewLesson is components: LessonTitle* and ViewNodeItem*; description: (* Lesson describes the different lessons that the instructor has available in that section. *); end ViewLesson; object ViewNodeItem is components: NodeTitle* and Link*; description: (* A link to a node within the lesson chosen in the lesson explorer. *); end ViewNodeItem; object LevelPosition is components: integer; description: (* LevelPosition is an integer that represent the position in the LessonExplorer. An example is the top of the heirarchy will be 0 then next level down 1 etc, *); end LevelPosition; object DeptTitle is components: string; description: (* The name of a department. Example of possible departments will be the CSC(computer science) and the BUS(business) department. *); end Deptitle; object CurrentLevel is components: LevelPosition; description: (* CurrentLevel is the current level active in the lesson explorer *); end CurrentLevel; object NextLevel is components: next_level: LevelPosition; description: (* NextLevel is the next level active in the lesson explorer. The next level will be one step inward. If the current level is within Class the next level will be Instructors *); end NextLevel; object PrevLevel is components: prev_level:LevelPosition; description: (* PrevLevel is the previous level in the lesson explorer. The previous level will be one step outward. If the current level is within Class the next level will be Department *); end PrevLevel; object LevelCount is components: integer; description: (* integer reprenstation of the maximum levels in the lesson explorer *); end LevelCount; object CurrentNode is components: NodePosition; description: (* The position of the current node. NodePosition is the created in lessonDB *); end CurrentNode; object Roadmap is components: ThumbNailNode*, Link*, isVisible: IsVisible; description: (* A Roadmap is a visible representation of the Lesson. It contains InfoNodes and Quiznodes and Nodelinks between all nodes. Each node contains information about the prevNode and NextNode etc. *); end Roadmap; object IsVisible is components: boolean; description: (* IsVisible is a boolean value to check if the current object isVisible in the applications *); end IsVisible; object Link is components: CurrentNode*, NextNode*; description: (* A link connects the currentNode to the nextNode *); end Link; object ThumbNailNode inherits from Node is components: (* none *); description: (* ThumbNailNode has all the features of a Node but is a thumbnail size *); end ThumbNailNode; object NodeEditor is components: NodeItem, isVisible: IsVisible; description: (* Opens a Node that is editable *); end NodeEditor; object MyRecord is components: ClassTitle*, LessonTitle*, Done*, Right*, Wrong*, Score*, Rank*; description: (* MyRecord is a Student Record that contains the information on Quizes taken by a student *); end MyRecord; object StudentStatistics is components: StudentName*, StudentID*, LessonTitle*, QuizTitle*, QuizPercent*, QuizDate* FillIn, FindByName, FindByID; description:(* Student statistics allows the instructors to view student quiz statistic. It allows shows the student name, student id, the result of the quiz. The quiz name, score and date the score was done. *); end StudentStatistics; object StudentName is components: string; description: (* StudentName is the name of the student *); end StudentName; object StudentID is components: string; description: (* StudentID is the login name of the student. It would be the unix id name of the student. Such as ttsan. *); end StudentID; object QuizPercent is components: string; description: (* The result of the quiz related to that quiz. *); end QuizPrecent; object FindByName is components: boolean; description: (* Search condition. The condition is the name of the student *); end FindByName; object FindByID is components: boolean; description: (* Search condition. The condition is the ID of the student *); end FindByID; -- operation Find cannot be done because UserDB is missing was assign to messaging.rsl object QuizDate is components: string; description: (* QuizDate is the date of the student took the quiz *); end QuizDate; object QuizTitle is components: string; description: (* QuizTitle is the name of the quiz *); end QuizTitle; object Done is components: string; description: (* string to show if the quiz has been done or not *); end Done; object Right is components: integer; description: (* number of question correct *); end Right; object Wrong is components: integer; description: (* number of question wrong *); end Wrong; object Score is components: string; description: (* The score for the quiz *); end Score; object Rank is components: integer; description: (* The rank of the score compare to other students *); end Rank; object QuizView is components: QuizNode, IsDone; description: (* *); end QuizView; object IsDone is components: boolean; description: (* boolean value to see if the quiz is done *); end IsDone; object NodeTools is components: TextTool, LineTool, FreeFormTool, ImageTool, RectangleTool, OvalTool, MoveTool, NavLinkTool, CodeTool, ColorTool, QuestionTool, ScoreTool; description:(* Tool palette to hold the tools*); end NodeTools; object TextTool; object LineTool; object FreeFormTool; object ImageTool; object RectangleTool; object OvalTool; object MoveTool; object NavLinkTool; object CodeTool; object ColorTool; object QuestionTool; object ScoreTool; object QuizResult is components: QuizTitle, ResultMessage, QuizNode; description: (* Shows the title and the path located in the score table which is part of QuizNode *); end QuizResult; object ResultMessage is components: string; description: (* Message that shows the quiz result *); end ResultMessage; operation GradeQuiz inputs: quiz: QuizNode, done:IsDone; output: result: QuizResult; preconditions:(* quiz is done *) (done) ; postconditions:(* none*); description: (* operation to grade a quiz. It takes a quizNode and a answerNodecompare it. It returns a dialog box with the result. *); end GradeQuiz; -- Missing recordgrade because the userRecords is not Messaging.rsl operation ViewChat is inputs: chatroom: ChatRoom; outputs: chatroom': ChatRoom; preconditions: (* The chatroom must not be active *) not(chatroom.isVisible); postconditions: (*Chat room is within the current window *) (chatroom'.isVisible); description: (* Open up a chatroom window. *); end ViewChat; operation ViewRoadMap is inputs: road_map: Roadmap; outputs: road_map': Roadmap; preconditions: (* The road map must not be active in the current application * Student must be in a lesson. RoadMap connected with a lesson *) not(road_map.isVisible); postconditions: (*RoadMap is within the current window *) (road_map'.isVisible); description: (* Loads up the lesson's road map if it is not already in the workspace. *); end ViewRoadMap; operation ViewLessonExplorer is inputs: lesson_explorer: LessonExplorer; outputs: lesson_explorer': LessonExplorer; preconditions: (* The lesson explorer must not be active in the current application * Lesson Explorer connected with a lesson *) not(lesson_explorer.isVisible); postconditions: (*RoadMap is within the current window *) (lesson_explorer'.isVisible); description: (* Loads up the lesson explorer if it is not already in the workspace. *); end ViewLessonExplorer; operation ViewNodeEditor is inputs: node_editor: NodeEditor; outputs: node_editor': NodeEditor; preconditions: (* The NodeEditor is not currently active*) not(node_editor.isVisible); postconditions:(* The NodeEditor is currently visible*) (node_editor.isVisible); end ViewNodeEditor; operation UpLevel is inputs: lessonexplorer: LessonExplorer, level: CurrentLevel, level_count: LevelCount; outputs: lessonexploer' : LessonExplorer, level': PrevLevel; preconditions: (*It is not the top level. Must be able to move up one level*) (level> 0 ); postconditions: (*Is a valid level within the LessonExplorer. The currentLevel is one level up from the previous state*) (level' < level_count); description: (* Moves the current level of the LessonExplorer to the higher level(the previous level) within the LessonExplorer unless it has reach the highest level in the hierarchy. An example of UpLevel is moving from the Section level to the Instructor level. *); end UpLevel; operation DownLevel is inputs: lessonexplorer: LessonExplorer, level: CurrentLevel, level_count: LevelCount; outputs: lessonexplorer' : LessonExplorer, level': NextLevel; preconditions: (* Is not the lowest level. Must be able to move down one level *) (level < level_count ); postconditions:(*Is a valid level within the LessonExplorer. The currentLevel is one level down from the previous state*) (level' > 0) and (level' <= level_count); description: (* Moves the current level of the LessonExplorer to the lower level(the next level) within the LessonExplorer unless there is no lower level to move to. An example of DownLevel is moving from the Section level to the Instructor level. *); end DownLevel; operation GetNextNode is inputs: lesson:Lesson, node:Node; outputs: lesson':Lesson, node':Node; preconditions: (* same as above but syntax different *) -- the nodes position is less then the max allowed -- the 'properties' of a node contains its position in the lesson. (node'.properties.pos < lesson.node_limit); postconditions: (node'.properties.pos <= lesson.node_limit) and (node'.properties.pos >0); end GetNextNode; operation PreviousNode is inputs: lesson: Lesson, node: Node; outputs: lesson': Lesson, node': Node; preconditions: (* Not the first node of the lesson. There is a node to go back to*) (node.properties.pos > 1); postconditions:(* current node is a valid node in the lesson the current node is one node before the current node of the previous state *) (node'.properties.pos >= 1) and (node'.properties.pos < lesson.node_limit) ; description: (* Change the view of the current view of the tutorial to the previous node of the lesson. *); end PreviousNode; end View;