summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/frontend/panel.html
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-18 15:53:07 +0200
committerSimon Rettberg2017-04-18 15:53:07 +0200
commit865db83c68f919d2ecf6fa5c0fed37f70541ba15 (patch)
treec1f10a2d4a8a30edf8881d7b2ac7f093a1f3795e /modules-available/locationinfo/frontend/panel.html
parent[locations] Make Location::getTree() public (diff)
downloadslx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.tar.gz
slx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.tar.xz
slx-admin-865db83c68f919d2ecf6fa5c0fed37f70541ba15.zip
[locationinfo] Use Location helper for getRoomTree, check backend validity in getCalendar
Diffstat (limited to 'modules-available/locationinfo/frontend/panel.html')
-rw-r--r--modules-available/locationinfo/frontend/panel.html64
1 files changed, 6 insertions, 58 deletions
diff --git a/modules-available/locationinfo/frontend/panel.html b/modules-available/locationinfo/frontend/panel.html
index 89d1c144..cd4db81f 100644
--- a/modules-available/locationinfo/frontend/panel.html
+++ b/modules-available/locationinfo/frontend/panel.html
@@ -259,7 +259,7 @@
for (var t = 0; t < ids.length; t++) {
for (var i = 0; i < json.length; i++) {
- if (ids[t] == json[i].id) {
+ if (ids[t] == json[i].locationid) {
var el = generateObject(json[i], ($("#main")), true);
}
@@ -277,13 +277,12 @@
*/
function generateObject(json, myParent, outermost) {
var obj;
- if (json.childs.length == 0) {
- obj = generateChild(myParent, json.id, json.name, outermost);
+ if (!json.children || json.children.length == 0) {
+ obj = generateChild(myParent, json.locationid, json.locationname, outermost);
} else {
- obj = generateParent(myParent, json.id, json.name, outermost);
- for (var i = 0; i < json.childs.length; i++) {
-
- generateObject(json.childs[i], $("#parent_" + json.id));
+ obj = generateParent(myParent, json.locationid, json.locationname, outermost);
+ for (var i = 0; i < json.children.length; i++) {
+ generateObject(json.children[i], $("#parent_" + json.locationid));
}
}
return obj;
@@ -291,57 +290,6 @@
}
/**
- * Retruns the number of childs of the current node (inklusive childs of childs)
- * @param json Json of the room tree
- * @returns number of childs of the current node
- */
- function getAllchildsRekusivly(json) {
- var childs = 0;
- for (var i = 0; i < json.childs.length; i++) {
- childs++;
- if (json.childs[i].childs.length != 0) {
- childs = getAllchildsRekusivly(json.childs[i]);
- }
- }
- return childs;
- }
-
- /**
- * Retruns the number of leaveschilds of the current node (inklusive leaves childs of childs)
- * @param json Json of the room tree
- * @returns number of leaveschilds of the current node
- */
- function getChildsRekusivly(json) {
- var childs = 0;
- for (var i = 0; i < json.childs.length; i++) {
- if (json.childs[i].childs.length == 0) {
- childs++;
- } else {
- childs = getChildsRekusivly(json.childs[i]);
- }
-
- }
- return childs;
- }
-
- /**
- * Retruns the number of leaves childs of the current node
- * @param json Json of the room tree
- * @returns number of leaveschilds of the current node
- */
- function getChilds(json) {
-
- var childs = 0;
- for (var i = 0; i < json.childs.length; i++) {
- if (json.childs[i].childs.length == 0) {
- childs++;
- }
- }
- return childs;
- }
-
-
- /**
* Helper function to generate id string used in query functions
* @param list A string, wicht contains ids or not(for now)
* @param id An ID which should be added to the list