Kepler Client-side Application Source Code Documentation

Software version 1.0.0

Documentation version 1.0.0

Kepler is an application developed for Physics Department of University of Jyväskylä. The application is designed to be used as a lab reservation system for the student laboratory of the department.

Kepler software consists of the server side application (i.e. back-end) written in Python, and the client-side application (i.e. front-end) written in JavaScript. The client-side application is documented here while the server application is documented separately.

© Copyright 2015, Joonas Konki, Anu Koskela, Mikko Kuhno, Henrik Paananen and Atte Räty.

Table of Contents

Classes

Modules


Kepler Client-side Application Source Code Documentation: Class: Kepler

Class: Kepler

Kepler

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.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

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.

Kepler Client-side Application Source Code Documentation: Module: calendar

Module: calendar

Contains the functionality related to the calendar page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

Kepler Client-side Application Source Code Documentation: Module: calendar_util

Module: calendar_util

A general calendar utility object that is used by other modules to perform calendar related tasks.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) defaultEventRender(event, element, view)

Sets the default event rendering callback function for FullCalendar events.
Parameters:
Name Type Description
event Contains the event information.
element Contains information of what kind of element the clicked event is.
view Contains the viewmode in which the element is shown.

(static) initCal(clickCallback, renderCallback)

Initialises the FullCalendar calendar widget.
Parameters:
Name Type Description
clickCallback The click event handler for clicking calendar events.
renderCallback An optional callback to customise calendar events to suit each module's purpose.
Returns:
The jQuery object of the calendar widget.

(static) initDefaultCal(clickCallback, renderCallback, eventFilter)

Initialises the default calendar with the event source of kepler calendar events.
Parameters:
Name Type Description
clickCallback The click event handler for clicking calendar events.
renderCallback An optional callback to customise calendar events.
eventFilter An optional function that can filter out events.
Returns:
The jQuery object of the calendar widget.

(static) makeCalendarEvent(event)

Makes a calendar event from the event received from the Kepler API calls get_calendar_events or get_time_slot_events.
Parameters:
Name Type Description
event The Kepler event that contains the information about the event.

Kepler Client-side Application Source Code Documentation: Module: edit_notice_board

Module: edit_notice_board

Contains the functionalities related to the edit notice board page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addNote()

Shows editable information related to a note and saves it to the database.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) initNoticeBoard(note)

Initialises the notice board with given notes from the database.
Parameters:
Name Type Description
note Contains the information of all of the notes.

(static) make_editNote(note)

Shows information of the editable note, saves the changes to the database and updates the view of the notice board.
Parameters:
Name Type Description
note Contains the information of the note to be edited.

(static) make_hideNote(note)

Makes the given note hidden in the database and updates the view of the notice board.
Parameters:
Name Type Description
note Contains the information of the note to be hidden.

(static) make_showNote(note)

Makes the given hidden note visible again in the database and updates the view of the notice board.
Parameters:
Name Type Description
note Contains the information of the note to be made visible.

(static) reloadEditNoticeBoard()

Reloads all of the notes to the notice board from the database.

Kepler Client-side Application Source Code Documentation: Module: edit_shift

Module: edit_shift

Contains the functionalities related to the edit shift page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) fillFields(timeslot)

Sets the information of the time slot to the correct fields.
Parameters:
Name Type Description
timeslot object The selected time slot.

(static) fillStudentList(reservation, index)

Fills the studentList element with the names of the students related to the reservation. Creates a drop-down menu for each student, which is filled with all the available statuses (present, arrived late etc.).
Parameters:
Name Type Description
reservation object The current time slot.
index number The index of the time slot (not its ID).

(static) setCurrentWork(timeslots)

Parses the ID parameter from the URL and displays the corresponding time slot's information.
Parameters:
Name Type Description
timeslots object A list of all time slots.

Kepler Client-side Application Source Code Documentation: Module: help

Module: help

Contains the functionalities related to the help page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

Kepler Client-side Application Source Code Documentation: Module: login

Module: login

Contains the functionalities related to the login page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

Kepler Client-side Application Source Code Documentation: Module: manage_time_slots

Module: manage_time_slots

Contains the functionalities related to the manage time slots page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addExperimentsInfo(timeslot, index, parent)

Displays the students and additional information related to the time slot in a list element.
Parameters:
Name Type Description
timeslot object The time slot for which the information is related to.
index number The index of the wanted unit.
parent object The element where the information is added.

(static) calendarClick(event, element, view)

Gets the selected calendar timeslot event.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of. element the clicked event is
view Contains the viewmode in which the element is shown.

(static) calendarEventRender(event, element, view)

Renders the selected timeslots to the calendar.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of element the event is.
view Contains the viewmode in which the element is shown.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) getNumberOfReservations(timeslot) → {number}

Returns the number of reservations made to the given time slot.
Parameters:
Name Type Description
timeslot object The current time slot.
Returns:
- The number of reservations the time slot has.
Type
number

(static) getSelectedSupervisors()

Returns a list of the selected supervisors.

(static) initCalendar(timeslot, data)

Initialises the calendar with the given custom attributes.
Parameters:
Name Type Description
timeslot The timeslots to render to the calendar.
data The data to initialise the calendar with.

(static) initTable()

Creates a table that displays all the time slots and a toggleable area for each of the time slot which have reservations. The toggleable area includes the information of the reserved unit groups and of the participants. Adds a button and a listener for each upcoming time slot, which enables cancelling the time slot.

(static) reloadTimeSlots()

Gets the time slots from the database and updates the timeSlotList.

(static) saveTimeSlot()

Gets the information from all editable fields and makes a call to save the new time slot with the gathered information.

(static) updateCalendar()

Initialises and updates the calendar.

(static) updateNewReservationForm()

Empties all of the editable fields related to creating a new reservation. Fetches time slots from the database and updates the study level selection.

(static) updateSupervisors(supervisors, studyTypeId)

Empties the supervisor selector and fills it with those supervisors whose user role matches the selected study level.
Parameters:
Name Type Description
supervisors object A list of all available users who have the user role "supervisor".
studyTypeId string The ID of the selected study level.

(static) updateTable()

Shows the wanted time slots based on which options (past, present, future) are checked and hides the rest. If no time slots match the selected time frame, shows a notification.

(inner) modalButtonYes click()

Makes a call to the database to cancel the current time slot.

(inner) toggleCalendarBtn click()

Toggles between the calendar and list views when the button is clicked.

Kepler Client-side Application Source Code Documentation: Module: new_reservation

Module: new_reservation

Contains the functionalities related to the new reservations page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) calendarClick(event, element, view)

Gets the selected calendar timeslot event.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of element the clicked event is.
view Contains the view in which the element is shown.

(static) calendarEventRender(event, element, view, eventData)

Shows information related to the FullCalendar event. The selection is highlighted if the event selection is active in the calendar view.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of element the clicked event is.
view Contains the view in which the element is shown.
eventData Contains the data that the event has.

(static) checkGroupSize(groups)

Shows a notification if the selected user group is bigger than the defined maximum number of participants for the unit group.
Parameters:
Name Type Description
groups object A list of all user groups.

(static) displayUnitDescription()

Sets the unit's name and other information to the corresponding areas.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) initCalendar()

Initialises the calendar with the given custom attributes.

(static) initList()

Creates a table row element for each available time slot.

(static) selectCalendarTimeslot(timeslot)

Selects the clicked calendar timeslot event.
Parameters:
Name Type Description
timeslot object The selected timeslot.

(static) showPickTimeArea()

Shows the calendar to pick a suitable time for the reservation after the work selection has been made. Initialises the calendar if it is null.

(static) toggleViewButton click()

Changes between the list and calendar views when the button is clicked.

(static) unitDisplayName(unit) → {string}

Pastes the unit group, identified and name of the unit together into one string for better readability.
Parameters:
Name Type Description
unit object The selected unit.
Returns:
- The names of the unit group, qualifier and unit.
Type
string

(static) updateCalendar()

Clears the calendar and refetches the events.

(static) updateUnitList(inputText)

Fills the unitList with the units that match the given string.
Parameters:
Name Type Description
inputText string The string that has to be found in the name of each displayed unit.

(inner) makeReservationBtn click()

Gets the additional information from the extraInfo field and calls the function addReservation at kepler.js to save the reservation with the provided parameters.

(inner) newReservationSelectGroup change()

Displays the members of the selected user group and calls the function checkGroupSize.

(inner) unitList change()

Displays the unit's description, check the size of the selected user group and updates the available time slots shown in the calendar or the list view.

Kepler Client-side Application Source Code Documentation: Module: notice_board

Module: notice_board

Contains the functionalities related to the notice board page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) initNoticeBoard(notes)

Initialises the notice board content with the given notices.
Parameters:
Name Type Description
notes object The notes to be displayed on the notice board.

(static) reloadNoticeBoard()

Updates the notice board view.

Kepler Client-side Application Source Code Documentation: Module: reservations

Module: reservations

Contains the functionalities related to the reservations page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) calendarCancelBtn click()

Checks if the user is on the right view and if correct event is selected. Then deletes the selected event and refreshes the calendar and the list.

(static) calendarClick()

Gets the selected timeslot id and sends it to the reservation.

(static) calendarEventRender()

Calls wanted events to be rendered in the calendar.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) initCalendar()

Initialises the calendar with the wanted parameters.

(static) initReservationTable()

Creates a list element for each reservation. Creates a toggleable list for each reservation, which includes the information of the reservation.

(static) make_cancelReservation(reservationId, reservationInfo)

An utility function that creates a click event to a button. Returns a function that shows a modal with the correct information and can cancel a reservation. If the reservation is canceled, it updates the view.
Parameters:
Name Type Description
reservationId string The ID of the reservation to be canceled.
reservationInfo string The information of the reservation to be canceled.
Returns:
A function that shows a modal with the correct information and can cancel a reservation.

(static) make_listArrowTurn(icon, open)

Returns an event handler for turning the list arrow icon.
Parameters:
Name Type Description
icon The icon jQuery element.
open boolean Specifies if the arrow should be turned to opened or closed position.

(static) reloadReservations()

Fetches the information from the database and updates the list of user's current reservations.

(static) selectReservation()

Stores the reservation ID and reservation information to their own variables.

(static) updateCalendar()

Empties the calendar and refetches the events from all calendar sources.

(static) updateReservationTable()

Shows the wanted reservations based on which options (past, present, future) are checked and hides the rest. If no reservations match the selected time frame, shows a notification.

(inner) calendarCancelBtn click()

Toggles between the calendar and the list view buttons.

(inner) modalButtonYes click()

Makes a call to cancel the selected reservation.

Kepler Client-side Application Source Code Documentation: Module: resources

Module: resources

Contains the functionalities related to the resources page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) fillEditFields()

Displays the information of the current resource in the corresponding fields.

(static) makeUpdateStatuses()

Determines an event for an element. Counts the sum of all status fields.

(static) resetView()

Empties the edit fields and reloads the current list of resources.

(static) setCurrentSelection()

Sets the information of the chosen resource to the corresponding fields. Adds a new label and text input fields for each status that the resource has.

(static) setNewResource()

Makes a new object by cloning the empty resource received from the database.

(static) updateResList(inputText)

Fills the current list of resources with the resources that match the given string.
Parameters:
Name Type Description
inputText string The string that has to be found in the name of every displayed resource.

(static) updateTotalCount()

Calculates the total count for the current resource.

(inner) btnAddNewResource click()

Empties the edit fields and sets placeholders. Initialises the resource status fields.

(inner) btnDeleteResource click()

If a current resource is selected, displays a confirmation dialog and removes the resource from the database if approved by the user.

(inner) btnSaveChanges click()

If the id of the current resource is -1, makes a call to create a new resource with the given parameters. Otherwise makes a call to save changes to the current resource. If any important fields are empty, shows a notification without making a call. Updates the view after the call has been completed.

(inner) modalButtonYes click()

Makes a call to remove the current resource from the database.

(inner) resourceList change()

Makes a clone of the selected resource and fill the edit fields with its information.

Kepler Client-side Application Source Code Documentation: Module: roles

Module: roles

Contains the functionalities related to the roles page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

Kepler Client-side Application Source Code Documentation: Module: supervision_shifts

Module: supervision_shifts

Contains the functionalities related to the supervision shifts page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addExperimentsInfo(timeslot, index, parent)

Creates a list element that includes the information of the reserved unit, the extra information it may have and its participants.
Parameters:
Name Type Description
timeslot object The selected time slot.
index number The index of the wanted unit.
parent object The element where the information is added.

(static) calendarClick(event, element, view)

Selects the event clicked on the calendar.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of element the clicked event is.
view Contains the viewmode in which the element is shown.

(static) calendarEventRender(event, element, view)

Renders the events to the calendar using a default renderer.
Parameters:
Name Type Description
event Contains the event information.
element Contains information what kind of element the clicked event is.
view Contains the viewmode in which the element is shown.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) getNumberOfReservations(timeslot)

Gets the number of reservations for the specific time slot.
Parameters:
Name Type Description
timeslot The time slot for which the information is fetched for.

(static) initCalendar(calendarClick, calendarEventRender)

Initialises the calendar.
Parameters:
Name Type Description
calendarClick The click function to be added to the calendar events.
calendarEventRender The render options to be added to the calendar events.

(static) initTable()

Creates a table which displays all the supervision shifts, and a toggleable area for each shift, which includes the information of the reserved unit groups and of the participants. Adds a "cancel shift" button (and a listener for it) for each upcoming shift.

(static) reloadTimeSlots()

Reloads the information of the time slots from the database, empties and updates the list of the time slots.

(static) updateCalendar()

Initialises and updates the calendar.

(static) updateTable()

Shows the wanted time slots based on which options (past, present, future) are checked and hides the rest. If no time slots match the selected time frame, shows a notification.

(inner) supervisorSelection change()

Updates the view to shows the supervision time slots of the selected user.

(inner) toggleCalendarBtn click()

Toggles between the calendar and list views when the button is clicked.

Kepler Client-side Application Source Code Documentation: Module: unit_groups

Module: unit_groups

Contains the functionalities related to the unit groups page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addUnitToUnitGroupInfo(unit)

Creates a label and an input field for the wanted unit and adds the created fields to shown units.
Parameters:
Name Type Description
unit object The unit for which information is shown.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) fillEditFields()

Displays the information of the current unit group in the corresponding fields.

(static) hideUnit()

Sets hidden to true for the current selected unit in a local copy of the units variable.

(static) initModal()

Sets the current unit null and empties the search field of the modal. Displays all units, that are not yet related to the unit group, and their information in the modal.

(static) makeUpdateUnit(unit)

Sets the qualifier to the selected unit.
Parameters:
Name Type Description
unit object The selected unit.
Returns:
A function that sets the qualifier to the selected unit.

(static) resetView()

Empties the edit fields and reloads the unit group list.

(static) setCurrentSelection()

Sets the information of the current unit group to the corresponding fields.

(static) setNewUnitGroup()

Makes a new object by cloning the empty unit group received from the database.

(static) setUnitCopy()

Copies all of the units in units list and sets the hidden attribute to true for the units that are already related to the current unit group.

(static) setUnitGroupType()

Adds all the unit type options (basic studies, advanced studies etc.) to the current unit group type and adds a listener which updates the type of the current unit group when the option is changed.

(static) updateUnitGroupList(inputText)

Fill the unit groupt list with only the units that match the given string.
Parameters:
Name Type Description
inputText string The string that has to be found in the name of every displayed unit group.

(static) updateUnitInfo()

Displays the information of the current unit and empties the unit qualifier edit field.

(static) updateUnitList(inputText)

Checks units to see if their names include the given string. If the string is found, adds the unit to the list of units. If the string is empty, displays all units.
Parameters:
Name Type Description
inputText string The string that is searched from the unit name.

(static) updateUnits(unitGroup)

Gets all units associated to the wanted unit group and displays them in the edit fields. If no units are found, shows a notification.
Parameters:
Name Type Description
unitGroup object The unit group for which information is to be shown.

(inner) btnAddNewUnitGroup click()

Sets the current unit group to null and updates the contents of the edit fields.

(inner) btnDeleteUnitGroup click()

If the current unit group id is not null, removes it from the database.

(inner) btnSaveChanges click()

If current unit group id is null, makes a call to create a new unit group with the given parameters. Otherwise makes a call to save changes to the current unit group. If important fields are empty, shows a notification without making a call. Updates the view after the call has been completed.

(inner) modalButtonAdd click()

Adds the selected unit to the current unit group's unit list and updates the view.

(inner) modalButtonYes click()

Makes a call to remove the current unit group from the database.

(inner) unitGroupList change()

Makes a clone of the selected unit group and sets its information to the edit fields.

(inner) unitList change()

Displays the information of the selected unit.

Kepler Client-side Application Source Code Documentation: Module: units

Module: units

Contains the functionalities related to the units page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addResourceToUnitInfo(res)

Creates a label and an input field for the resource and fills them with the information of the resource.
Parameters:
Name Type Description
res object The resource to be shown.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) fillEditFields()

Empties the edit fields and fills them with the information of the current unit, if the information can be found. Otherwise shows the placeholders.

(static) hideResource()

Sets hidden to true for the current resource to prevent the resource from being displayed in the module.

(static) initModal()

Initialises the modal where the resources are selected.

(static) makeUpdateResource(res)

Sets the count for the selected resource.
Parameters:
Name Type Description
res object The selected resource.
Returns:
A function which sets the count for the selected resource.

(static) resetView()

Empties the edit fields of the unit and reloads the current unit list.

(static) setCurrentSelection()

Sets the information of the chosen unit to the corresponding fields.

(static) setNewUnit()

Makes a new object by cloning the empty unit received from the database.

(static) setResCopy()

Copies the list of resources and for each resource sets hidden to false if the current unit already uses the resource.

(static) updateResInfo()

If a resource has been selected, sets its information to the corresponding fields. Otherwise shows a notification.

(static) updateResList(inputText)

Displays all the resources in the list of resources that match the search criterion.
Parameters:
Name Type Description
inputText string The string that has to be found in the resource's name.

(static) updateResources()

Displays the current unit's resources and their amounts in the displayed resources area.

(static) updateUnitList(inputText)

Fills the unit list with the units that match the search string.
Parameters:
Name Type Description
inputText string String that has to be found in the name of every displayed unit.

(inner) btnAddNewUnit click()

Empties the edit fields and sets the placeholders. Sets the current unit to null. Initialises the resource area.

(inner) btnDeleteUnit click()

If the current unit id is not null, removes it from the database.

(inner) btnSaveChanges click()

If current unit id is null, makes a call to create a new unit with the given parameters. Otherwise makes a call to save changes to the current unit. If important fields are empty, shows a notification without making a call. Updates the view after the call has been completed.

(inner) modalButtonAdd click()

Adds the selected resource to the list of resources of the current unit and updates the view.

(inner) modalButtonYes click()

Makes a call to remove the current unit from the database.

(inner) resourceList change()

Displays the information of the selected resource.

(inner) unitList change()

Makes a clone of the selected unit and sets its information to the edit fields.

Kepler Client-side Application Source Code Documentation: Module: user_groups

Module: user_groups

Contains the functionalities related to the user groups page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) addToGroup()

Adds the found user to a new group and sets the global variable for the found user to null. If the user has already been added to the new group, displays a notification.

(static) displaySearchResult(searchText)

Shows the found user's name and a button that can be used to add the person to the new group. If no users can be found, displays a notification and hides the button.
Parameters:
Name Type Description
searchText string The string that must be matched.

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) initGroupList(groups)

If there are groups to be shown, empties the group list area and displays the information of all the current user's groups (except the default group).
Parameters:
Name Type Description
groups Object A list object of the user groups of the current user.

(static) initNewGroup(groups)

Initialises the area for creating a new user group. Sets the current user automatically as a member of the new user group.
Parameters:
Name Type Description
groups object A list of the user groups of the current user.

(static) makeRemoveGroup(groupId, groupName)

Creates a click event to a button. Returns a function that shows a modal with correct information and removes a user group. If a group is removed, the view is updated.
Parameters:
Name Type Description
groupId string The ID of the group to be removed.
groupName string The name of the group to be removed.
Returns:
A function that shows a modal with correct information.

(static) makeRemovePerson(groupId, userId, element)

Returns a function that removes a person from the group.
Parameters:
Name Type Description
groupId The ID of the group where the person is to be removed from. If the person is to be removed from an unregistered new group, set to null.
userId The ID of the user to be removed.
element The element (typically a list element) to be removed.
Returns:
A function that removes a person from the group.

(static) reloadGroups()

Empties the groupList area. Fetches the latest user group information from the database. If the user has only the default group, shows a notification that there are no user groups. Otherwise displays the user groups of the current user.

(static) saveNewGroup()

If all the necessary information has been given, saves the new user group and reloads the user group list.

(inner) modalButtonYes click()

Makes a call to remove the selected user group. Reloads the view.

Kepler Client-side Application Source Code Documentation: Module: user_info

Module: user_info

Contains the functionalities related to the user contact info page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.

Methods

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.

(static) saveLangBtn click()

Changes the language preference of the site when the save language button is clicked.

(static) setCurrentLanguage(user)

Checks the radio button that corresponds to the default language of the user.
Parameters:
Name Type Description
user object The current user.

(static) setUserContactInfo(user)

Goes through the contact information and sets the primary email and phone number to the corresponding fields.
Parameters:
Name Type Description
user object The current user.

(static) setUserRoles(user)

Goes through the user roles of the current user and displays the active roles.
Parameters:
Name Type Description
user object The current user.