new Kepler()
Constructs an instance of Kepler API object.
The object is a general class that is used to make API calls to the server
side application in all of the modules.
Each module is a specific JavaScript code that is loaded by the HTML pages.
Methods
addNoticeBoardNote(callback)
Adds a new notice board note.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addReservation(callback)
Adds a new reservation for the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addResource(callback)
Adds a new resource to the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addTimeSlot(callback)
Adds a new reservable time slot to the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addUnit(callback)
Adds a new unit to the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addUnitGroup(callback)
Adds a new unit group to the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
addUserGroup(callback)
Creates a new group for the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
clone(obj)
Creates a clone of an object.
Parameters:
Name | Type | Description |
---|---|---|
obj |
The object that has a tree-like structure. |
createLoadElement(elemId, loadFunc)
Replaces the given element in the HTML page temporarily with a new div
that contains a gif animation while the data is being fetched from
the database.
Parameters:
Name | Type | Description |
---|---|---|
elemId |
The id of the HTML element where the animation is placed. | |
loadFunc |
The handler that is called after the request returns. |
Returns:
The original area when a response from the database has
been received.
dateString(date)
Formats a Date object to common Finnish date string representation.
Parameters:
Name | Type | Description |
---|---|---|
date |
The Date object to be formatted. |
datetimeIntervalString(start, end)
Formats two Date objects to a string representation of a time interval.
Parameters:
Name | Type | Description |
---|---|---|
start |
A Date object for the start of the interval. | |
end |
A Date object for the end of the interval. |
Returns:
A formatted string representing the interval.
datetimeString(date)
Formats a Date object to common Finnish time string representation of
hours and minutes (HH:mm).
Parameters:
Name | Type | Description |
---|---|---|
date |
The Date object to be formatted. |
deleteReservation(callback)
Deletes (hides) an existing reservation from the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
deleteResource(callback)
Deletes (hides) an existing resource from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
deleteTimeSlot(callback)
Deletes (hides) an existing reservable time slot to the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
deleteUnit(callback)
Deletes (hides) an existing unit from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
deleteUnitGroup(callback)
Deletes (hides) an existing unit group from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
deleteUserGroup(callback)
Deletes (hides) an existing group of the current user from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
editNoticeBoardNote(callback)
Edits an existing notice board note.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
editResource(callback)
Edits an existing resource in the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
editUnit(callback)
Edits an existing unit in the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
editUnitGroup(callback)
Edits an existing unit group in the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
formatDate(date)
The method is used to format ISO8601 date strings to UI strings.
Parameters:
Name | Type | Description |
---|---|---|
date |
Either a date string or a Date object. |
Returns:
The locale formatted time string.
formatDatetime(date)
The method is used to format ISO8601 date strings to UI strings.
Parameters:
Name | Type | Description |
---|---|---|
date |
Either a date string or a Date object. |
Returns:
The locale formatted time string.
getCalendarEvents(callback)
Gets the calendar events of the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getNoticeBoard(callback)
Gets all notice board notes.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getNoticeBoardNotes(callback)
Gets all notice board notes with additional information.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getQueryParam(name)
Returns the parameter with the specified name from the URL
query parameters.
Parameters:
Name | Type | Description |
---|---|---|
name |
The URL query parameter's name. |
getReservationsUser(callback, err_elem_id)
Gets the reservations of the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. | |
err_elem_id |
The ID of the element in which possible error messages are shown. |
getResources(callback)
Gets the list of all resources and their statuses from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getTimeSlotEditInfo(callback)
Gets the information needed in the time slot adding and editing view.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getTimeSlotEvents(callback)
Gets the list of time slot events optionally filtered by
a time span
and the specified unit.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getTimeSlots(callback)
Gets the list of time slots optionally filtered by a time span
and the study level.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getUnitGroups(callback)
Gets the list of unit groups from the database.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getUnits(callback)
Gets the list of all units from the database.
Additionally, returns the list of all unit types in the system.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getUnitsEditable(callback)
Gets the list of all units from the database with additional information
needed for editing the units.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns.' |
getUserGroups(callback)
Gets all the groups where the current user belongs to.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
getUserInfo(callback)
Gets the information related to the current user.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
hideNoticeBoardNote(callback)
Hides the notice board note.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
searchUser(params, callback)
Searches for the user that matches the search string.
The call returns the user that matches the search string.
If no user or many users are found the call returns null.
Parameters:
Name | Type | Description |
---|---|---|
params |
The email or account name used for searching a user. | |
callback |
The handler that is called after the request returns. |
setLanguage(locale_name)
Sets the session language based on the given locale name.
Parameters:
Name | Type | Description |
---|---|---|
locale_name |
The locale name of the language to be set. |
setUserLanguage(locale_name, callback)
Sets the user default language based on the specified locale name.
Parameters:
Name | Type | Description |
---|---|---|
locale_name |
The locale name of the language to be set. | |
callback |
The handler that is called after the request returns. |
showError(reason, message, elem_id)
Shows an error message in the element specified by the ID.
If no ID is given, the element with ID "#error" is used.
Parameters:
Name | Type | Description |
---|---|---|
reason |
string | The reason of the error. |
message |
string | The error message. |
elem_id |
string | The element ID where the error should be shown. |
showNoticeBoardNote(callback)
Shows the notice board note.
Parameters:
Name | Type | Description |
---|---|---|
callback |
The handler that is called after the request returns. |
showResult(result, elem_id)
Shows the result message in the element specified by the ID.
Parameters:
Name | Type | Description |
---|---|---|
result |
object | The Kepler API result object. |
elem_id |
string | The element ID where the message should be shown. |
stringToDate(date)
Converts a date string to a Date object.
Parameters:
Name | Type | Description |
---|---|---|
date |
The date string to be converted. |
Returns:
The Date object corresponding to given string.
timeString(date)
Formats the given Date object to common Finnish time string
representation.
Parameters:
Name | Type | Description |
---|---|---|
date |
The Date object to be formatted. |
translate(translation_id)
Returns the dynamic translation matching the given translation ID.
Parameters:
Name | Type | Description |
---|---|---|
translation_id |
The translation ID of the translation text. |
(inner) addCallbacksToCall()
Adds done and fail callbacks to the specified AJAX call.
(inner) makeCall(func, data)
The primary utility function that makes Kepler AJAX calls
to the server side application.
Parameters:
Name | Type | Description |
---|---|---|
func |
The name of the API function that will be called. | |
data |
The parameters of the function passed as the body of POST request. |
Returns:
Returns the created jQuery AJAX call.