//Request-URI Too Long
$(document).ready(function() {
function cData(text) {
var nowy = ""
return nowy;
}
var changes = false;
$("#main").after('
');
$("#buttons").after("");
$("#buttons").after("");
//$("#buttons").after("");
var deletedId = new Array();
var generatedId = new Array();
var deletedRes = new Array();
var usedImg = {};
var dialog = 0;
$("#SE-menu").hide();
$("#SE-menu-sub").hide();
var menuShow = false
var zasobTree = new Array();
var perms = [
[1, "Kto wykonuje", "X"],
[2, "Tylko do odczytu", "R"],
[3, "Odczyt, zapis, wykonanie", "R,W,X"],
[4, "Odczyt, zapis, wykonanie, tworzenie", "R,W,X,C"],
[5, "Odczyt i wykonanie", "R,X"],
[6, "Tylko do odczytu", "R"],
[7, "MAPA PROCESU - opis mapy procesu", ""],
[9, "Tylko do tworzenia rekordu", "C"],
[10, "Tylko tworzenie i czytanie rekordów bez edycji", "R,X,C"],
[11, "Tylko edycja rekordu - ustalanie nowej wartosci", "W"],
[12, "Tylko edycja i dodanie rekordu - ustalanie nowej wartosci", "W,C"],
[13, "Nowy rekord i edycja z pominieciem A_ADM_COMPANY", "R,W,X,C,S"],
[14, "Widok tylko swoich danych z rekordu", "W,O"],
[15, "Edycja rekordów dla super admina", "R,W,C,S"],
[16, "Widok i dodawanie rekordów tylko dla swojego ADM_COMPANY", "C,O"],
[17, "Super widok wszystkich rekordow niezaleznie od uprawnien rekordu", "R,V"],
[18, "Administracja Edycja i widok wszystkich rekordow z pominieciem A", "R,W,X,S,V"],
[19, "Administracja Edycja Tworzenie i widok wszystkich rekordow z pom", "R,W,X,C,S,V"],
[20, "Export", "R,X,E"],
[21, "Widzenie tylko swoich rekordów", "O"]
];
var gotoType = [
["GOTO", "Przejdź do procesu"],
["GOTO_AND_RETURN", "Przejdź do procesu i wróć"],
["FORK", "FORK"]
];
var state = [];
var loaded = true;
var actSite = "none";
var filtr = 0;
var selectedArea = false;
var sZasoby;
var sProcesy;
var lastSearch = "";
var newSteps;
var newRes = 0;
showPreview();
var XML_NAMESPACE = "default_db__x3A__";
$(document).on('click', '#toggleMenu', function(e) {
e.preventDefault();
if (!menuShow) {
$("#SE-menu").show();
$("#SE-menu-sub").show();
menuShow = true;
} else {
menuShow = false;
$("#SE-menu").hide();
$("#SE-menu-sub").hide();
}
});
function showPath(parent, target, hideEdit, renderTree) {
var target = target || $(".path")
var hideEdit = hideEdit || false
var showEdit = ! hideEdit
var renderTree = renderTree || false
var link = BASE_URL + "index.php?_route=UrlAction_ProcesEditor&_task=getPathAjax&id=" + parent;
$.get(link, function(data) {
var result = "";
result += '';
$.each(data, function(i, e) {
result += '
' + e["DESC"] + " {" + e["ID"] + "}" + '
'
})
result += '
' + state[0]["desc"] + " {" + (state[0]["id"] < 0 ? "?" : state[0]["id"]) + "}"
if (showEdit)
result += ''
result += '
'
result += '';
$(target).html(result);
if (renderTree)
renderProcesTree(data);
});
}
function loadResources() {
showPath(state[0]["parent_id"]);
$("#main").html("
Pobieranie danych o zasobach.
");
var sFiltr = "";
sFiltr += `
`;
sFiltr += ' ';
sFiltr += ' ';
sFiltr += ' ';
$.each(state, function(idx, procesItem) {
sFiltr += ' ID_PROCES' + procesItem["id"] + '';
});
sFiltr += ' ';
sFiltr += ' ';
sFiltr += ' A_STATUSDELETED';
sFiltr += ' ';
sFiltr += ' ';
sFiltr += ' ';
sFiltr += '';
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003';
link += '&REQUEST=GetFeature';
link += '&TYPENAME=p5_default_db:CRM_WSKAZNIK';
link += '&sortBy=SORT_PRIO+A,ID';
var wskazniki = new Array();
$.ajax({
url: link,
data: sFiltr,
type: 'POST',
contentType: "text/xml",
dataType: "xml",
success: function(data) {
$.each($(data).find("featureMember"), function() {
if ($(this).find("ID").text() == 0) return;
var wsk = new Array();
wsk["ID"] = $(this).find("ID").text();
wsk["ID_ZASOB"] = $(this).find("ID_ZASOB").text();
wsk["ID_PROCES"] = $(this).find("ID_PROCES").text();
wsk["SORT_PRIO"] = $(this).find("SORT_PRIO").text();
wsk["ID_PRZYPADEK"] = $(this).find("ID_PRZYPADEK").text();
wsk["OPIS_ZASOB"] = $(this).find("OPIS_ZASOB").text();
wskazniki.push(wsk);
});
var idsZasobyToFetch = [];
$.each(wskazniki, function(index, wsk) {
idsZasobyToFetch.push(wsk["ID_ZASOB"]);
});
if (idsZasobyToFetch.length > 0) {
var zasobInfo = new Array();
$.ajax({
type: 'POST',
url: BASE_URL + "index.php?_route=UrlAction_ProcesEditor&_task=getSingleResAjax",
data: {
data: idsZasobyToFetch
},
dataType: 'json'
})
.done(function(jsonZasobyTree) {
$.each(jsonZasobyTree, function(idx, zasob) {
zasobInfo[zasob["ID"]] = new Array();
zasobInfo[zasob["ID"]]["DESC"] = zasob["DESC"];
zasobInfo[zasob["ID"]]["OPIS"] = zasob["OPIS"];
zasobInfo[zasob["ID"]]["TYPE"] = zasob["TYPE"];
zasobInfo[zasob["ID"]]["TREE"] = [];
for (var i = 3; i > 0; i--) {
if (zasob["p" + i + "_ID"] != null) {
var temp = {};
temp["ID"] = zasob["p" + i + "_ID"];
temp["DESC"] = zasob["p" + i + "_DESC"];
zasobInfo[zasob["ID"]]["TREE"].push(temp);
}
}
});
$.each(wskazniki, function(index, wsk) {
var type,
idZasob = wsk["ID_ZASOB"];
if (!zasobInfo[idZasob]) {
$("#main").html("
");
$(side).find("#procCon").append("");
$(side).find("#procCon").append("");
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_PROCES&SRSNAME=EPSG:3003&Filter=PARENT_ID0&sortBy=SORT_PRIO+A,ID';
var result = "";
$.get(link, function(data) {
$(data).find("featureMember").each(function() {
var type = 0;
result += "
";
result += "
# ";
result += $(this).find("DESC").text()
result += "
[" + $(this).find("ID").text() + "]
";
result += "
";
});
$("#depth0").html(result);
$('.drag').draggable({
appendTo: 'body',
handle: '.handle',
helper: 'clone',
stack: "div",
distance: 0,
cursor: "copy",
start: function(event, ui) {
$(this).data("startingScrollTop", $(this).parent().scrollTop());
},
drag: function(event, ui) {
var st = parseInt($(this).data("startingScrollTop"));
ui.position.top -= $(document).scrollTop() - st;
ui.helper.css('z-index', 1000);
}
});
});
}
$(document).on('click', '.liAdv', function() {
$(this).find(".glyphicon").removeClass("glyphicon-triangle-right");
$(this).find(".glyphicon").addClass("glyphicon-refresh");
$(this).parents(".singleAdv").nextAll(".singleAdv").remove();
$(this).parents(".singleAdv").find(".active").removeClass("active");
$(this).addClass("active");
var parent = this;
var parent_id = $(this).data("id");
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_LISTA_ZASOBOW&SRSNAME=EPSG:3003&Filter=PARENT_ID' + parent_id + '&sortBy=SORT_PRIO+A,ID';
var result = "";
var depth = $(this).parents(".singleAdv").data("depth") + 1;
$("#advCon").css("width", depth * 290 + 290);
$(this).parents(".singleAdv").after("");
var childs = true;
$.get(link, function(data) {
$(data).find("featureMember").each(function() {
if ($(this).find("ID").text() == 0) {
childs = false;
return;
}
var type = 0;
if ($(this).find("TYPE").text() == "DZIAL" || $(this).find("TYPE").text() == "PODMIOT" || $(this).find("TYPE").text() == "STANOWISKO")
type = 1;
result += "
';
$(side).append(schowek);
loadClipboard();
}
function showVideo(data) {
var el = ""
return el;
}
function showMediaElement(data, type) {
var el = ""
if (!data || undefined === data['ID']) return '';
if ('video' === type && undefined === data['VIDEO_ID']) return '';
if ('img' === type && undefined === data['IMAGE']) return '';
if (type == "video") {
//el += "
X
"
el += "
"
el += data["NAME"]
el += "
"
el += "
"
el += "
"
el += ""
el += "
"
el += "
"
el += "
"
} else if (type == "img") {
el += "
"
el += "
"
el += ""
el += data["NAME"] + "
"
el += ""
el += "
"
}
return el;
}
function loadClipboard() {
$("#clipboard").empty();
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_IMAGE&SRSNAME=EPSG:3003&Filter=REMOTE_ID' + USER_ID + 'REMOTE_TABLEADMIN_USERS';
$.get(link, function(data) {
var list = "";
$(data).find("featureMember").each(function() {
if (typeof usedImg[$(this).find("ID").text()] == "undefined") {
var opts = {};
opts["ID"] = $(this).find("ID").text();
opts["IMAGE"] = base64_decode($(this).find("IMAGE").text());
opts["NAME"] = $(this).find("NAME").text();
list += showMediaElement(opts, "img");
}
});
$("#clipboard").append(list);
$('.attImg').draggable({
appendTo: 'body',
//revert: true,
zIndex: 100,
helper: "clone",
stack: "div",
distance: 0,
handle: '.imgTitle',
scroll: true,
start: function(event, ui) {
$(this).data("startingScrollTop", $(this).parent().scrollTop());
},
drag: function(event, ui) {
var st = parseInt($(this).data("startingScrollTop"));
ui.position.top -= $(document).scrollTop() - st;
ui.helper.css('z-index', 1000);
}
});
});
link = BASE_URL + "index.php?_route=UrlAction_ProcesEditor&_task=getVideosClipboardAjax"
$.get(link, function(data) {
var list = "";
$.each(data, function(i, e) {
list += showMediaElement(e, "video");
})
$("#clipboard").prepend(list);
$('.attVid').draggable({
appendTo: 'body',
//revert: true,
zIndex: 100,
helper: "clone",
stack: "div",
distance: 0,
handle: '.imgTitle',
scroll: true,
start: function(event, ui) {
$(this).data("startingScrollTop", $(this).parent().scrollTop());
},
drag: function(event, ui) {
var st = parseInt($(this).data("startingScrollTop"));
ui.position.top -= $(document).scrollTop() - st;
ui.helper.css('z-index', 1000);
}
});
});
}
function zasoby() {
var side = $("#side");
$(side).empty();
$(side).append("");
$(side).append("");
$("#filtry").append("");
$("#filtry").append("");
$("#filtry").append("");
$(side).append("
");
$(side).find("#advCon").append("");
$(side).find("#advCon").append("");
var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_LISTA_ZASOBOW&SRSNAME=EPSG:3003&Filter=PARENT_ID0&sortBy=SORT_PRIO+A,ID';
var result = "";
$.get(link, function(data) {
$(data).find("featureMember").each(function() {
var type = 0;
if ($(this).find("TYPE").text() == "DZIAL" || $(this).find("TYPE").text() == "PODMIOT" || $(this).find("TYPE").text() == "STANOWISKO")
type = 1;
result += "
"
result += "
"
result += " # " + $(this).find("DESC").text() + "
");
}
function removeImg(content, id) {
$.each(content, function(i, e) {
if (e["id"] == id) {
content.splice(i, 1);
return;
}
})
}
function dropVid(ui, target) {
var id = $(target).closest(".drop").data("id");
var proces = id;
var idBefore = $(ui.draggable).closest(".drop").data("id");
var procesBefore = idBefore;
var type = "CRM_PROCES";
var typeName = "proces";
var typeNameBefore = "proces";
if ($(target).closest(".professions").length) {
id = $(target).closest("li").data("id");
type = "CRM_WSKAZNIK";
typeName = "prof";
} else if ($(target).closest(".resources").length) {
id = $(target).closest("li").data("id");
typeNameBefore = "res";
type = "CRM_WSKAZNIK";
typeName = "res";
}
if ($(ui.draggable).closest(".professions").length) {
typeNameBefore = "prof";
idBefore = $(ui.draggable).closest("li").data("id");
} else if ($(ui.draggable).closest(".resources").length) {
typeNameBefore = "res";
idBefore = $(ui.draggable).closest("li").data("id");
}
var temp = {};
temp["THUMBNAIL"] = {};
temp["THUMBNAIL"]["IMAGE"] = $(ui.draggable).find("img").attr("src");
temp["NAME"] = $(ui.draggable).find(".imgTitle").text();
temp["VIDEO_ID"] = $(ui.draggable).find(".p5VideoPlayer").data("videoid");
usedImg[temp["id"]] = {
type: type,
targetID: id,
action: "ATTACH"
};
if (typeName != "proces" && typeof state[getIndexById(proces)][typeName][
[getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]
]["vid"] == "undefined") {
state[getIndexById(proces)][typeName][getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]["vid"] = Array();
} else if (typeName == "proces" && typeof state[getIndexById(id)]["img"] == "undefined") {
state[getIndexById(proces)]["vid"] = Array();
}
if (typeof idBefore != "undefined")
if (typeNameBefore == "proces") {
removeImg(state[getIndexById(procesBefore)]["vid"], temp["id"]);
} else {
removeImg(state[getIndexById(procesBefore)][typeNameBefore][getResById(getIndexById(procesBefore), $(ui.draggable).closest("li").data("id"), typeNameBefore)]["img"], temp["id"]);
}
if (typeName == "proces") {
state[getIndexById(id)]["vid"].push(temp);
} else {
state[getIndexById(proces)][typeName][getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]["img"].push(temp);
}
$(ui.draggable).remove();
console.log(state);
updateAll();
}
function dropImg(ui, target) {
var id = $(target).closest(".drop").data("id");
var proces = id;
var idBefore = $(ui.draggable).closest(".drop").data("id");
var procesBefore = idBefore;
var type = "CRM_PROCES";
var typeName = "proces";
var typeNameBefore = "proces";
if ($(target).closest(".professions").length) {
id = $(target).closest("li").data("id");
type = "CRM_WSKAZNIK";
typeName = "prof";
} else if ($(target).closest(".resources").length) {
id = $(target).closest("li").data("id");
typeNameBefore = "res";
type = "CRM_WSKAZNIK";
typeName = "res";
}
if ($(ui.draggable).closest(".professions").length) {
typeNameBefore = "prof";
idBefore = $(ui.draggable).closest("li").data("id");
} else if ($(ui.draggable).closest(".resources").length) {
typeNameBefore = "res";
idBefore = $(ui.draggable).closest("li").data("id");
}
var temp = {};
temp["src"] = $(ui.draggable).find("img").attr("src");
temp["title"] = $(ui.draggable).find(".imgTitle").text();
temp["id"] = $(ui.draggable).data("id");
usedImg[temp["id"]] = {
type: type,
targetID: id,
action: "ATTACH"
};
if (typeName != "proces" && typeof state[getIndexById(proces)][typeName][
[getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]
]["img"] == "undefined") {
state[getIndexById(proces)][typeName][getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]["img"] = Array();
} else if (typeName == "proces" && typeof state[getIndexById(id)]["img"] == "undefined") {
state[getIndexById(proces)]["img"] = Array();
}
if (typeof idBefore != "undefined")
if (typeNameBefore == "proces") {
removeImg(state[getIndexById(procesBefore)]["img"], temp["id"]);
} else {
removeImg(state[getIndexById(procesBefore)][typeNameBefore][getResById(getIndexById(procesBefore), $(ui.draggable).closest("li").data("id"), typeNameBefore)]["img"], temp["id"]);
}
if (typeName == "proces")
state[getIndexById(id)]["img"].push(temp);
else {
state[getIndexById(proces)][typeName][getResById(getIndexById(proces), $(target).closest("li").data("id"), typeName)]["img"].push(temp);
}
$(ui.draggable).remove();
updateAll();
}
function addProces(ui, target) {
var id = $(target).data("id");
var gotoOpt = "";
$.each(gotoType, function(key, value) {
gotoOpt += "";
})
swal({
showCancelButton: true,
cancelButtonText: "Anuluj",
title: 'Typ łącza',
html: (
typeof state[getIndexById(id)]["goto"] !== typeof undefined && state[getIndexById(id)]["goto"]["id"] != null && state[getIndexById(id)]["goto"]["id"] != 0 ?
'Uwaga! Nowe łącze nadpisze już istniejące łącze. ' :
""
) + ' ',
preConfirm: function() {
return new Promise(function(resolve) {
resolve([
$('#swal-input1').val()
]);
});
}
}).then(function(result) {
newRes--;
var temp = {};
temp["flag"] = result[0];
temp["id"] = ui.draggable.data("id");
state[getIndexById(id)]["goto"] = temp;
updateAll();
}).catch(function(e) {})
}
function addResource(ui, target) {
var permsOpt = "";
$.each(perms, function(key, value) {
permsOpt = permsOpt + "";
})
swal({
showCancelButton: true,
cancelButtonText: "Anuluj",
title: 'Uprawnienia',
html: 'Uprawnienia ' +
'Komentarz ',
preConfirm: function() {
return new Promise(function(resolve) {
resolve([
$('#swal-input1').val(),
$('#swal-input2').val()
]);
});
}
}).then(function(result) {
newRes--;
var temp = {};
temp["id_zasob"] = ui.draggable.data("id");
temp["id"] = newRes;
temp["id_przypadek"] = result[0];
temp["komentarz"] = result[1];
temp["changed"] = true;
temp["opis"] = ui.draggable.data("opis");
temp["desc"] = ui.draggable.data("desc");
temp["tree"] = zasobTree[temp["id_zasob"]];
var id = $(target).data("id");
if (ui.draggable.data("type") == 1) {
state[getIndexById(id)]["prof"].push(temp);
} else {
state[getIndexById(id)]["res"].push(temp);
}
updateAll();
}).catch(function(e) {})
}
//Najwazniejsza funkcja odpalana po kazdej zmianie. Sprawdza, czy wszystkie funkcje maja rodzica,
//jezeli nie to przesuwa w lewo obiekt
//Odpowiada tez za ukrywanie guzikow i wywowalanie funkcji generacji krokow
function updateAll() {
$.each(state, function(i, e) {
var pid = getParentNode(e["id"]);
if (pid != "NONE" && pid != false && pid != e["parent_id"]) {
e["parent_id"] = pid;
} else if (pid === false) {
e["depth"]--;
//var depthWidth = 20 * $(node).data("depth");
//$(node).css("padding-left", depthWidth + "px");
updateAll();
return;
}
});
changes = true;
$("#clearBtn").show();
/*
localStorage.setItem("state" + mainProces_id, JSON.stringify(state));
localStorage.setItem("newStep" + mainProces_id, newSteps);
localStorage.setItem("newRes" + mainProces_id, newRes);
localStorage.setItem("deletedId" + mainProces_id, JSON.stringify(deletedId));
localStorage.setItem("deletedRes" + mainProces_id, JSON.stringify(deletedRes));
localStorage.setItem("date" + mainProces_id, moment().format("YYYY-MM-DD HH:mm:ss"));
*/
render(state, $("#main"));
}
//Generuje kroki, sprawdza tez czy kolejnosc krokow w danym rodzicow zostala zmieniona
//Jezeli tak to mozna wyslac ajaxem zmiane kolejnosci dla sort_prio
function stepsGenerator() {
$.each(state, function(i, e) {
e["step"] = 0;
if (i == 0)
e["stepDesc"] = "";
else {
var iParent = getIndexById(e["parent_id"]);
state[iParent]["step"] += 1;
e["SORT_PRIO"] = state[iParent]["step"];
e["stepDesc"] = state[iParent]["stepDesc"] + state[iParent]["step"] + ". ";
}
});
}
//Na potrzeby guzikow dorobilem funkcje sprawdzajaca id rodzica po przesunieciu (przewidywanie).
//Jezeli nie znajdzie zwraca false, a wtedy blokuje sie odpowiednia strzalka
function checkParentNode(id, check) {
var x = getIndexById(id);
var y = x;
var result = false;
while (x > 0) {
x--;
if (check == "right")
if (state[x]["depth"] == state[y]["depth"]) {
result = state[x]["id"];
break;
}
if (check == "left")
if (state[x]["depth"] == state[y]["depth"] - 2) {
result = state[x]["id"];
break;
}
if (check == "right" && state[x]["depth"] < state[y]["depth"])
break;
}
return result;
}
//Zwraca id rodzica, jezeli nie ma zwraca false
function getParentNode(id) {
var x = getIndexById(id);
var y = x;
if (x == 0)
return "NONE";
var result = false;
while (x > 0) {
x--;
if (state[x]["depth"] == state[y]["depth"] - 1) {
result = state[x]["id"];
break;
}
if (state[x]["depth"] - state[y]["depth"] == -2)
break;
}
return result;
}
function getResById(index, id, type) {
var result = state[index][type].length - 1;
$.each(state[index][type], function(i, e) {
if (e["id"] == id) {
result = i;
return false;
}
});
return result;
}
function getIndexById(id, arr, label) {
var arr = arr || state
var label = label || "id"
var result = arr.length - 1;
if (label == "ID")
result = -1;
$.each(arr, function(i, e) {
if (e[label] == id) {
result = i;
return false;
}
});
return result;
}
$(".remImg").on('click', function() {
var obj = $(this).closest(".attImg");
var id = $(this).closest(".drop").data("id");
var typeName = "proces";
if ($(obj).closest(".professions").length) {
typeName = "prof";
} else if ($(obj).closest(".resources").length) {
typeName = "res";
}
//if(typeof idBefore != "undefined")
if (typeName == "proces")
removeImg(state[getIndexById(id)]["img"], $(obj).data("id"));
else {
removeImg(state[getIndexById(id)][typeName][getResById(getIndexById(id), $(obj).closest("li").data("id"), typeName)]["img"], $(obj).data("id"));
}
$(ui.draggable).remove();
usedImg[$(obj).data("id")] = {
type: "",
targetID: -1,
action: "DELETED"
};
updateAll();
return false;
});
$(document).on('click', '.stateOff', function() {
$(this).closest(".mx").prev(".tree").show();
$(this).closest(".mx").remove();
});
$(document).on('click', '.tree', function() {
var type;
if ($(this).closest("ul").hasClass("resources")) {
type = "res";
} else {
type = "prof"
}
var id = getIndexById($(this).closest(".drop").data("id"));
var resId = getResById(id, $(this).closest(".liRes").data("id"), type);
$(this).hide();
showTree(state[id][type][resId]["tree"], $(this));
});
function showTree(arr, target) {
result = "";
$.each(arr, function(i, x) {
result += "
" + x["DESC"] + "
";
});
$(target).after("
" + result + "
");
}
function render(arr, target) {
stepsGenerator();
var result = "";
$.each(arr, function(i, e) {
result += "
";
result += "
";
if (i > 0) {
result += "";
//Arrows
if (checkParentNode(e["id"], "right") !== false)
result += "";
if (checkParentNode(e["id"], "left") !== false)
result += "";
if (i != 1)
result += "";
if (i != state.length - 1)
result += "";
} else {}
result += "";
result += "";
if (e["opis"] == "")
result += "Dodaj opis";
else
result += "Edytuj opis";
result += "
";
if (typeof e["img"] !== "undefined") {
//console.log(e["img"])
$.each(e["img"], function(key, eImg) {
var img = showMediaElement({
"ID": eImg["id"],
"IMAGE": eImg["src"],
"NAME": eImg["title"]
}, "img")
result += img;
})
}
if (typeof e["vid"] !== "undefined") {
//console.log(e["img"])
$.each(e["vid"], function(key, eVid) {
var vid = showMediaElement(eVid, "video")
result += vid;
})
}
result += "
";
var anyProf = false;
$.each(e["prof"], function(i2, e2) {
if (!anyProf) {
result += "
Stanowiska
";
anyProf = true;
}
result += "
";
result += "
";
if (i2 != 0)
result += "";
if (i2 != e["prof"].length - 1)
result += "";
result += "";
result += "
";
result += "
" + e2["desc"] + " " + e2["opis"] + " [" + e2["id_zasob"] + "] ";
if(typeof e2["tree"] !== "undefined" && e2["tree"].length > 0){ //TO DO DOWNLOAD TREE WHEN NOT EXISTS
result += " ";
$.each(e2["tree"], function(i, x) {
result += x["DESC"] + (i < e2["tree"].length - 1 ? " " : "");
});
}
result += "
";
if (typeof e2["img"] !== "undefined") {
//console.log(e["img"])
$.each(e2["img"], function(key, eImg) {
var img = showMediaElement({
"ID": eImg["id"],
"IMAGE": eImg["src"],
"NAME": eImg["title"]
}, "img")
result += img;
})
}
result += "
";
});
if (anyProf) {
result += "
";
}
var anyRes = false;
$.each(e["res"], function(i2, e2) {
if (!anyRes) {
result += "
Użyte zasoby
";
anyRes = true;
}
result += "
";
result += "
";
if (i2 != 0)
result += "";
if (i2 != e["res"].length - 1)
result += "";
result += "";
result += "
";
result += "
" + e2["desc"] + " " + e2["opis"] + " [" + e2["id_zasob"] + "] ";
if(typeof e2["tree"] !== "undefined" && e2["tree"].length > 0){ //TO DO DOWNLOAD TREE WHEN NOT EXISTS
result += " ";
$.each(e2["tree"], function(i, x) {
result += x["DESC"] + (i < e2["tree"].length - 1 ? " " : "");
});
}
result += "
";
if (typeof e2["img"] !== "undefined") {
//console.log(e["img"])
$.each(e2["img"], function(key, eImg) {
var img = showMediaElement({
"ID": eImg["id"],
"IMAGE": eImg["src"],
"NAME": eImg["title"]
}, "img")
result += img;
})
}
result += "
";
});
if (anyRes) {
result += "
";
}
if (typeof e["goto"] !== typeof undefined && e["goto"]["id"] != null && e["goto"]["id"] != 0) {
var name;
switch (e["goto"]["flag"]) {
case "GOTO":
name = "Przejdź do procesu " + e["goto"]["id"] + ".";
break;
case "GOTO_AND_RETURN":
name = "Przejdź do procesu " + e["goto"]["id"] + ", a następnie wróć.";
break;
case "FORK":
name = "— FORK" + e["goto"]["id"];
break;
default:
name = e["goto"]["id"];
}
result += "— " + name + " ";
}
result += " Dodaj nowy krok";
result += "