The init file is only invoked once at start-up, not at each file open which means no init file gets loaded when other user's lessons get opened.
There are two ways to launch the CSTutor application. One way loads the authoring application which contains the full functionality of the tool while the other way loads the viewer application which is simply a subset of the authoring version. Users of the viewer application cannot use any of the authoring tools.
Only one lesson can be edited at any given time. Similarly, only one lesson can be viewed as any given time. The name of the currently opened file is listed in the banner of the main menubar. When no lesson is open (either to be edited or to be viewed), the file name in the banner is listed as "none."
File -> New is only available in the authoring version of the tool. When the user selects File -> New, the system responds in one of two ways: if there is no currently open lesson, the system loads a blank lesson template that the user can use to create their new lesson. If however, there is a lesson currently open, one of two things happens. If the open lesson is owned by the user (meaning if they created it) and if the lesson is in a changed/unsaved state, the user will be asked to choose between saving their lesson or discarding current changes before they can open the new lesson. If the currently open lesson is theirs, and it is in a saved state then that lesson gets closed automatically so that the system can then open the new, blank lesson. Alternately, if the currently open lesson is not owned by the user (meaning they did not create it) then it simply closes without saving changes because we do not want to allow users to change other peoples lessons. Once the currently open lesson is closed, the system can open up the new, blank lesson.
File -> Open has the same constraints as File -> new in regards to what happens when a file is already open. The only difference is what gets opened after a currently open lesson gets closed. When the user selects File -> Open and after any currently lesson gets closed, the system responds by asking the user which lesson they would like to open. It should be noted that a user can open up any lesson, but can only make changes to and save lessons which they have created. Once the user selects a file they wish to open, the system responds by attempting to open that file. If the file is of the correct type, the system loads the lesson and the user can then start working on that lesson. If the file was of an incorrect type, the system respons by informing the user that the file was not of the right type and prompts them to either cancel or select another file.
File -> Close will close the currently open lesson. If the file is unsaved, the user will be promted to save the file or to discard changes if the file is theirs. Otherwise the file will be closed without saving. No new lesson is loaded after a File -> Close operation.
First, the user will be asked which host they wish to save their lesson on. Then the user will see the typical save dialog in which they can tell the system where on that host they want their file to be saved. As far as heirarchy goes, they can only see the folders that they have access to. For example, if an instructor teaches only 101 and 102, then, the base folders they have access to are '101' and '102'. The user may then select which class they wish to save the lesson to and then which section (if appropriate). The `Save' and `Save As' commands are disabled when the current lesson that is open is not theirs.
File -> Save saves the current lesson to its existing file if there is one. If the lesson does not have a file yet, the Save As dialog gets displayed so that the user can select the file they want the lesson to be saved as.
File -> Save As will always prompt the user for a filename even if the file they are working on already exists.
When a user saves a lesson, there are many things that are saved. All the lesson content gets saved. Lesson content is defined as all the nodes associated with the lesson and all the elements within those nodes. Every node has properties contained in the Node Summary which are also saved. The lesson itself also has properties contained in Lesson Properties and those are also saved. In other words, all data that is necessary to exactly reproduce the lesson in it's current state so that it can be viewed or edited later are saved, and nothing else.
The preview command simply loads the lesson that is currently being edited into the viewer portion of the application. It should be noted that for recent changes made to be seen in the viewer, the user must first save the lesson. This is because the viewer will load the most recently saved version of the lesson being edited at the time. If no lesson is being edited, then the Preview command is greyed out.