From 9d4127ebc56e06905d42a67198b96d6d93bfe9b4 Mon Sep 17 00:00:00 2001 From: Stefan Puraner Date: Thu, 3 Apr 2014 08:26:11 +0000 Subject: [PATCH] =?UTF-8?q?Bugfix=20Studienordnung;=20rekursive=20LVs=20si?= =?UTF-8?q?nd=20nicht=20mehr=20m=C3=B6glich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/lehre/studienordnung.js | 44 +++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/vilesci/lehre/studienordnung.js b/vilesci/lehre/studienordnung.js index 23f5451a1..c905abce9 100644 --- a/vilesci/lehre/studienordnung.js +++ b/vilesci/lehre/studienordnung.js @@ -306,15 +306,32 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung, max_semester) // DIV fuer den Tree neu anlegen damit der alte Tree vollstaendig entfernt wird $("#data").html("
"); - function searchTree(element, matchingId) + function searchChildren(element, matchingId) { if(($("#"+element.attr("id")).find("[lvid='"+matchingId+"']").attr("id") !== undefined) || ($("#"+element.attr("id")).attr("lvid") === matchingId)) { return true; - } + } return false; } + function searchParents(element, matchingId) + { + if((element.parent().parent().attr("lvid") === matchingId) || (element.attr("lvid") === matchingId)) + { + return true; + } + else + { + if(element.parent().parent().attr("lvid") !== undefined) + { + if(searchParents(element.parent().parent(), matchingId)) + return true; + } + return false; + } + } + // Anzeigen des Trees mit den Lehrveranstaltungen $("#treeData").jstree({ ui: { @@ -328,20 +345,22 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung, max_semester) move: { "always_copy": "multitree", "check_move": function(m) { + var text; if(m.ot === m.rt) { - if(searchTree(m.r, m.o.attr("lvid")) === true) + if((searchChildren(m.r, m.o.attr("lvid")) === true) || (searchParents(m.r, m.o.attr("lvid")) === true)) { return false; } } else { - if(searchTree(m.r, m.o.attr("id")) === true) + if((searchChildren(m.r, m.o.attr("id")) === true) || (searchParents(m.r, m.o.attr("id")) === true)) { return false; } } + if(m.o.attr("rel")==="semester") { return false; @@ -350,7 +369,6 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung, max_semester) { return true; } - if(m.p === "inside" || m.p === "last") { return true; @@ -436,13 +454,13 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung, max_semester) plugins: ["themes", "ui", "dnd", "grid", "json_data", "crrm", "types", "sort", "contextmenu"] }).bind("move_node.jstree", function(event, data) { - if(searchTree(data.rslt.r, data.rslt.o.attr("id"))) - { - $("#treeData").jstree("remove", "#"+data.rslt.oc.attr("id")); - alert("Lehrveranstaltung bereits vorhanden"); - } - else - { +// if(searchTree(data.rslt.r, data.rslt.o.attr("id"))) +// { +// $("#treeData").jstree("remove", "#"+data.rslt.oc.attr("id")); +// alert("Lehrveranstaltung bereits vorhanden"); +// } +// else +// { // Verschieben eines Eintrages // Studienplan_lehrveranstaltung_id ermitteln @@ -466,7 +484,7 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung, max_semester) } hideAllTreeColumns(); writeOverallSum(nodes); - } +// } }).bind("loaded.jstree", function(event, data) { // Wenn der Tree geladen wird, die ECTS Summen der einzelnen Semester berechnen