The Course Search Flow:
Google Feature Used:
- Using the PubSub Feature in order to transnit to the other gadgets information.
- Using the user prefs to store information.
- using google remote content fetching to get the course information from the TAU hour table site.
The Course search gadget serves as an interface between the user and the university hour table system.
Trough this gadget, the user issues queries, and is able to select the courses and groups he wants to attend.
The Course search gadget transmits this information to the hourTable and webPages gadgets in for display
This function is called on load of page.
it loads up the saved year and semester options, then it proceeds to load all the already saved courses from the userpref
it also gets the saved courses names , sites and tests using the fetchCourseData function
this function is called to add a new set of search HTML code in the yedion gadget, each of the search items uses
the groupId variable in order to create a unique ID, the fromAdd is a flag that states if updateDiv was called during initGadget
then the follow-up call is to setValues, otherwise the function populateInputs is called
this function creates the select inputs from the stored user prefs on during the load of the gadget
the groupId param is required for the uniqueness of the different input slots
this function is called in order to reload all the input values after the user has clicked on the add new course link
its purpose is to solve an issue in the firefox browser that removes all the values from input tags once an HTML code in a div is refreshed
the function has no effect in explorer
this function is called when a user is searching for a new course, it calls the getPage.php file
the response data is processed at the callbackFunction
params: response, groupId
the function takes the respone text from getPage.php and stores it in the HTML code, using the groupId in order to load the correct
inputs, it also transmits the data to the hourTable
this function is called from the initGadget function it requires the courseNum from the userprefs, and then calls the getCourseData.php
page in order to get the course name, test date and course site url
params: response, courseNum,groupId
This function processes the response from getCourseData.php, it loads the site and test icons, and puts the course name in the title
of the course search input
the groupId is required to effect the correct inputs
This function is called on change event of the select inputs, once a user changes a group
the new data is sent to the hourTable gadget via this function, it knows what data to send
because it gets the select object that was changed
this function returns the current number of courses stored in the gadget
This function checks that there are currently less then 8 courses saved, it returns true if it is ok to add a new course
this function checks with verifyAddCourse if its legal to add a new course, then it checks if the user has not clicked allready
once on the add new course link (we are limiting this in order to pervent abuse and crazy usage of the gadget)
if both of these are ok, it calls the addNewCourse
this function basically calls the updateDiv function, but with the value returned from numCourses. thus printing a new HTML code
to add a completely new course
this function saves in the gadget's userPrefs the data of the course according to the groupId
it also transmits the save message to the hourTable gadget
This function deletes a course from the courses list, and also sends a delete message to the hourTable gadgets
this function sends the date of the test to the hourTable and calendar gadgets
the groupId is used to get the info from a specific course
This function sends the site of the specified course to the webPages gadget
This function sends the semester the user selects to the hourTable gadget
This function sends the year that the user selected to the hourTable gadget