Module: velpSelection

The directive retrieves all the data from the server including velps, labels, velp groups and annotations. The directive also handles majority of the functionality that is relevant in handling velps, labels and velp groups.

Author:
  • Joonas Lattu
  • Petteri Palojärvi
  • Seppo Tarvainen
Source:

Methods

(inner) addLabel(velp)

Adds new label tp the specified velp.

Parameters:
Name Type Description
velp

Velp where the label is to be added.

Source:

(inner) addNewVelpToDatabase()

Adds a new velp to the database. Requires values in $scope.newVelp variable.

Source:

(inner) addVelp(form)

Adds a new velp on form submit event.

Parameters:
Name Type Description
form

Form information

Source:

(inner) addVelpGroup(form)

Adds a velp group on form submit event.

Parameters:
Name Type Description
form

Velp group form

Source:

(inner) changeAllVelpGroupSelections(type)

Changes all velp group selections (defaults and shows).

Parameters:
Name Type Description
type

"show" or "default"

Source:

(inner) changeVelpGroupSelection(group, type)

Changes velp group (default or show) selection in the current element or in the document.

Parameters:
Name Type Description
group

Velp group

type

"show" or "default"

Source:

(inner) checkCheckBoxes(type) → {boolean}

Changes default and show checkboxes according to selected element or document.

Parameters:
Name Type Description
type

Paragraph ID or "0" for the document

Source:
Returns:

Whether all velp groups are used in the selected element or document

Type
boolean

(inner) checkCollectionForSelected(groupId, paragraphId, collection) → {boolean|null}

Checks whether the collection is selected or not.

Parameters:
Name Type Description
groupId

Velp group ID

paragraphId

Paragraph ID or document "0".

collection

Shows or defaults

Source:
Returns:

Whether the collection is selected or not. Null if paragraph is not found.

Type
boolean | null

(inner) deselectLabels()

Deselects all the labels.

Source:

(inner) editLabel()

Edits the label according to the $scope.labelToedit variable. All required data exists in the $scope.labelToedit variable, including the ID of the label.

Source:

(inner) editVelp(form)

Edits velp according to the $scope.velpToEdit variable. All required data exists in the $scope.velpToedit variable, including the ID of the velp.

Parameters:
Name Type Description
form

Velp form

Source:

(inner) generateDefaultVelpGroup(method)

Generates the default velp group and runs the custom method.

Parameters:
Name Type Description
method

Method to be run after this mehtod.

Source:

(inner) getColor(index) → {string}

Get color for the object from colorPalette variable.

Parameters:
Name Type Description
index

Index of the color in the colorPalette variable (modulo by lenght of color palette)

Source:
Returns:

String representation of the color

Type
string

(inner) getVelpsVelpGroups(velp) → {Array}

Gets all the velp groups of the specific velp.

Parameters:
Name Type Description
velp

Velp whose velp groups are retrieved

Source:
Returns:

Array of the velp's velp groups

Type
Array

(inner) isGroupInVelp(velp, group) → {boolean}

Checks whether the velp contains the velp group.

Parameters:
Name Type Description
velp

Velp to check

group

Velp group to check

Source:
Returns:

Whether the velp contains the velp group or not

Type
boolean

(inner) isLabelInVelp(velp, label) → {boolean}

Returns whether the velp contains the label or not.

Parameters:
Name Type Description
velp

Velp to check

label

Label to check

Source:
Returns:

Whether the velp contains the label or not

Type
boolean

(inner) isSomeVelpGroupSelected(velp) → {boolean}

Checks if the velp has any velp groups selected.

Parameters:
Name Type Description
velp

Velp whose velp groups are checked

Source:
Returns:

Whether velp has any groups selected or not

Type
boolean

(inner) isVelpGroupDefaultFallBack(groupId) → {boolean}

Checks whether the given velp group is either personal default or document default group. Personal default group and the document default group have always default, unless the user has specified otherwise.

Parameters:
Name Type Description
groupId

Velp group ID

Source:
Returns:

Whether the group is personal default or document default group or not

Type
boolean

(inner) isVelpGroupDefaultHere(groupId, paragraphId) → {boolean}

Returns whether the velp group is default in specified paragraph (or document) or not.

Parameters:
Name Type Description
groupId

Velp group ID

paragraphId

Paragraph ID or "0" for the document

Source:
Returns:

Whether the velp group is default here or not

Type
boolean

(inner) isVelpGroupShownHere(groupId, paragraphId) → {boolean}

Return whether the group is shown based on the various selected and default values.

Parameters:
Name Type Description
groupId

VelpGroup ID

paragraphId

Paragraph ID or "0" for the document

Source:
Returns:

Whether the velp group is shown here or not

Type
boolean

(inner) isVelpValid(velp) → {boolean}

Checks if the velp can be added or modified. The velp has to have a name and it has to be included in at least one velp group.

Parameters:
Name Type Description
velp

Velp to check

Source:
Returns:

Whether the added or modified velp is valid or not.

Type
boolean

(inner) lazyIsVelpGroupDefaultInParagraph(groupId, paragraphId) → {boolean|null}

Helper function for checking if the velp group is default in the paragraph or not. Despite the name, can check document selections as well.

Parameters:
Name Type Description
groupId

Velp group ID

paragraphId

Paragraph ID or "0" for the document

Source:
Returns:

true/false/null

Type
boolean | null

(inner) lazyIsVelpGroupSelectedInParagraph(groupId, paragraphId) → {boolean|null}

Helper function for checking if the velp group is shown in the paragraph or not. Despite the name, can check document selections as well.

Parameters:
Name Type Description
groupId

Velp group ID

paragraphId

Paragraph ID or "0" for the document

Source:
Returns:

true/false/null

Type
boolean | null

(inner) releaseClicked()

Releases select tab.

Source:

(inner) resetAllShowsToDefaults()

Sets all the show-checkbox values according to the default-checkboxes.

Source:

(inner) resetCurrentShowsToDefaults()

Sets all velp group show selections to defaults in the current element or in the document.

Source:

(inner) resetEditVelp()

Resets $scope.velpToEdit variable to the initial (empty) state.

Source:

(inner) resetNewLabel()

Reset new label information to the initial (empty) state.

Source:

(inner) resetNewVelp()

Reset new velp information to the initial (empty) state.

Source:

(inner) selectLabelToEdit(label)

Selects the label for editing.

Parameters:
Name Type Description
label

Label to edit

Source:

(inner) selectVelpToEdit(velp)

Selects velp to edit

Parameters:
Name Type Description
velp

Velp to edit

Source:

(inner) toggleLabel(label)

Toggles the label's selected attribute.

Parameters:
Name Type Description
label

Label to toggle

Source:

(inner) toggleLabelToEdit(label)

Toggles the label's edit attribute.

Parameters:
Name Type Description
label

Label to edit

Source:

(inner) updateVelpGroups(velp, group)

Updates velp groups of the specified velp.

Parameters:
Name Type Description
velp

Velp to update

group

Group to be added or removed from the velp

Source:

(inner) updateVelpLabels(velp, label)

Updates the labels of the velp.

Parameters:
Name Type Description
velp

Velp to update

label

Label to be added or removed from the velp

Source:

(inner) updateVelpList()

Updates the velp list according to how the velp groups are selected in the area.

Source: