Course Search Dev

back to main page back to last page

HLD

The Course Search Flow:

yedionHLD.JPG

LLD

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.

General Description:

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

Functions Description:

initGadget

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

updateDiv

params: groupId,fromAdd

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

setValues

params: groupId

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

populateValues

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

fetch

params: groupId

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

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

fetchCourseData

params :courseNum,groupId

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

courseDataCBF

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

transmit

params: selectObj

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

numCourses

this function returns the current number of courses stored in the gadget

verifyAddCourse

This function checks that there are currently less then 8 courses saved, it returns true if it is ok to add a new course
false otherwise

add

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

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

save

params: groupId

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

doDelete

params: groupId

This function deletes a course from the courses list, and also sends a delete message to the hourTable gadgets

sendTest

params: groupId

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

sendSite

parameters: groupId

This function sends the site of the specified course to the webPages gadget

sendSemester

This function sends the semester the user selects to the hourTable gadget

sendDate

This function sends the year that the user selected to the hourTable gadget

if this is not enough feal free to look at the source Code:

source code

back to main page back to last page

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License