| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743 |
- var changes = false;
- $(document).ready(function() {
- $("#main").after('<div class="col-xs-1 col-xs-offset-7" id="buttons"></div>');
- $("#buttons").after("<button type=button id=saveBtn class='btn btn-primary text-center' style=margin-left:5px;>Opublikuj zmiany</button>");
- $("#buttons").after("<button type=button id=clearBtn style=display:none; class='btn btn-danger text-center' >Cofnij zmiany</button>");
- var deletedId = new Array();
- var generatedId = new Array();
- var deletedRes = new Array();
- var dialog = 0;
- 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 tab = new Array(); //tablica kolejnosci
- //var mainProces_id = 1; //id procesu glownego. Potem bedzie przypisywane z linku
- var actSite = "none";
- showPreview();
- var filtr = 0;
- var selectedArea = false;
- var sZasoby;
- var sProcesy;
- var lastSearch = "";
- var newSteps = 0;
- var newRes = 0;
- function loadResources() {
- $("#main").html("<center>Pobieranie danych o zasobach.</center>");
- //console.log("res!");
- var res = new Array();
- var sFiltr = "";
- var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:CRM_WSKAZNIK&SRSNAME=EPSG:3003&sortBy=SORT_PRIO+A,ID';
- //console.log("link "+link);
- sFiltr += `
- <GetFeature xmlns="http://www.opengis.net/wfs/2.0"
- xmlns:p5_default_db="` + BASE_URL + `wfs/default_db"
- xmlns:ogc="http://www.opengis.net/ogc"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- service="WFS"
- version="2.0.2"
- xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
- <ogc:Filter>
- <ogc:And>
- <ogc:Or>`;
- $.each(state, function(i, e) {
- var id = e["id"];
- sFiltr += '<ogc:PropertyIsEqualTo><ogc:PropertyName>ID_PROCES</ogc:PropertyName><ogc:Literal>' + id + '</ogc:Literal></ogc:PropertyIsEqualTo>';
- });
- sFiltr += '</ogc:Or><ogc:Not><ogc:PropertyIsEqualTo><ogc:PropertyName>A_STATUS</ogc:PropertyName><ogc:Literal>DELETED</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Not></ogc:And></ogc:Filter></GetFeature>';
- //console.log("x "+sFiltr);
- $.ajax({
- url: link,
- data: sFiltr,
- type: 'POST',
- contentType: "text/xml",
- dataType: "xml",
- success: function(data) {
- //console.log(data);
- $.each($(data).find("featureMember"), function() {
- if ($(this).find("ID").text() == 0)
- return;
- var result = new Array();
- result["ID"] = $(this).find("ID").text();
- result["ID_ZASOB"] = $(this).find("ID_ZASOB").text();
- result["ID_PROCES"] = $(this).find("ID_PROCES").text();
- result["SORT_PRIO"] = $(this).find("SORT_PRIO").text();
- result["ID_PRZYPADEK"] = $(this).find("ID_PRZYPADEK").text();
- result["OPIS_ZASOB"] = $(this).find("OPIS_ZASOB").text();
- res.push(result);
- });
- //console.log(res);
- var sFiltr2 = "";
- var link2 = 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&sortBy=SORT_PRIO+A,ID';
- sFiltr2 += `
- <GetFeature xmlns="http://www.opengis.net/wfs/2.0"
- xmlns:p5_default_db="` + BASE_URL + `wfs/default_db"
- xmlns:ogc="http://www.opengis.net/ogc"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- service="WFS"
- version="2.0.2"
- xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
- <ogc:Filter>
- <ogc:Or>`;
- $.each(res, function(index, value) {
- var id = res[index]["ID_ZASOB"];
- sFiltr2 += `
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>ID</ogc:PropertyName>
- <ogc:Literal>` + id + `</ogc:Literal>
- </ogc:PropertyIsEqualTo>`;
- });
- sFiltr2 += `
- </ogc:Or>
- </ogc:Filter>
- </GetFeature>`;
- //console.log(sFiltr2);
- //console.log(link2);
- var zasobInfo = new Array();
- $.ajax({
- url: link2,
- data: sFiltr2,
- type: 'POST',
- contentType: "text/xml",
- dataType: "xml",
- success: function(data2) {
- //console.log("data");
- //console.log(data2);
- $.each($(data2).find("featureMember"), function() {
- //console.log();
- zasobInfo[$(this).find("ID").text()] = new Array();
- zasobInfo[$(this).find("ID").text()]["DESC"] = $(this).find("DESC").text();
- zasobInfo[$(this).find("ID").text()]["OPIS"] = $(this).find("OPIS").text();
- zasobInfo[$(this).find("ID").text()]["TYPE"] = $(this).find("TYPE").text();
- });
- //console.log(res);
- $.each(res, function(index, value) {
- var type;
- if (zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "DZIAL" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "STANOWISKO" || zasobInfo[res[index]["ID_ZASOB"]]["TYPE"] == "PODMIOT") {
- type = "prof";
- } else {
- type = "res";
- }
- var id = res[index]["ID_PROCES"];
- var temp = {};
- temp["id_zasob"] = res[index]["ID_ZASOB"]
- temp["id"] = res[index]["ID"];
- temp["id_przypadek"] = res[index]["ID_PRZYPADEK"];
- temp["komentarz"] = res[index]["OPIS_ZASOB"];
- temp["desc"] = zasobInfo[res[index]["ID_ZASOB"]]["DESC"];
- temp["opis"] = zasobInfo[res[index]["ID_ZASOB"]]["OPIS"];
- //console.log(temp);
- state[getIndexById(id)][type].push(temp);
- });
- $("#main").html("<center>Generowanie widoku.</center>");
- render(state, $("#main"));
- }
- });
- }
- });
- }
- $(document).ajaxStop(function() {
- if (loaded)
- return;
- //alert("OK");
- loaded = true;
- //$(".drop").find("dl").hide();
- loadResources();
- });
- $(document).on('click', '#clearBtn', function() {
- swal({
- title: 'Cofnij zmiany',
- text: "Czy chcesz cofnąć wszystkie niezapisane zmiany?",
- type: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- cancelButtonText: "Anuluj",
- confirmButtonText: 'Cofnij zmiany'
- }).then(function() {
- localStorage.removeItem("state" + mainProces_id);
- $.notify("Niezapisane zmiany zostały wycofane.", "success");
- showPreview();
- //Parent_id = -1,
- }).catch(function(e) {})
- });
- //Saveaction
- $(document).on('click', '#saveBtn', function() {
- $("#saveBtn").prop('disabled', true);
- $.notify("Rozpoczęto zapisywanie. Nie zamykaj tego okna", "info");
- //console.log("Saving has been started");
- var genReq = `
- <Transaction
- xmlns="http://www.opengis.net/wfs"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- version="1.0.0"
- service="WFS"
- xmlns:p5_default_db="` + BASE_URL + `wfs/default_db/CRM_PROCES"
- xsi:schemaLocation="` + BASE_URL + `wfs/default_db/CRM_PROCES ` + BASE_URL + `dev-pl/se-feature-api/wfs.php/xml/wfs/default_db/CRM_PROCES/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=p5_default_db:CRM_PROCES&SRSNAME=EPSG:4326&"
- xmlns:gml="http://www.opengis.net/gml">
- `;
- $.each(state, function(i, e) {
- if (e['id'] < 0) {
- genReq += `
- <Insert xmlns="http://www.opengis.net/wfs">
- <CRM_PROCES xmlns="` + BASE_URL + `wfs/default_db/CRM_PROCES">
- <PARENT_ID xmlns="` + BASE_URL + `wfs/default_db/CRM_PROCES">-1</PARENT_ID>
- </CRM_PROCES>
- </Insert>`;
- }
- });
- genReq += '</Transaction>';
- //console.log("genReq: " + genReq)
- var link = BASE_URL + 'wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003&';
- //console.log(link);
- $.ajax({
- url: link,
- data: genReq,
- type: 'POST',
- contentType: "text/xml",
- dataType: "text",
- success: function(data) {
- //console.log("x: " + data);
- $(data).find("[fid]").each(function(i, e) {
- var newId = $(e).attr("fid").substr($(e).attr("fid").indexOf('.') + 1);
- generatedId.push(newId);
- });
- var i = 0;
- var newIdTab = Array();
- //console.log(generatedId);
- $.each(state, function(z, e) {
- if (e["id"] < 0) {
- newIdTab[e["id"]] = generatedId[i];
- //console.log("he:" + generatedId[i]);
- i++;
- }
- });
- //console.log(newIdTab);
- var request = `
- <Transaction
- xmlns="http://www.opengis.net/wfs"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- version="1.0.0"
- service="WFS"
- xmlns:p5_default_db="` + BASE_URL + `wfs/default_db/CRM_PROCES"
- xsi:schemaLocation="` + BASE_URL + `wfs/default_db/CRM_PROCES ` + BASE_URL + `dev-pl/se-feature-api/wfs.php/xml/wfs/default_db/CRM_PROCES/?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=p5_default_db:CRM_PROCES&SRSNAME=EPSG:4326&"
- xmlns:gml="http://www.opengis.net/gml">
- `;
- $.each(state, function(i, e) {
- request += `
- <Insert xmlns="http://www.opengis.net/wfs">
- <CRM_PROCES xmlns="` + BASE_URL + `wfs/default_db/CRM_PROCES">
- `;
- if (e["id"] >= 0)
- request += '<ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["id"] + '</ID>';
- else
- request += '<ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + newIdTab[e["id"]] + '</ID>';
- if (e["parent_id"] != false) {
- if (e["parent_id"] >= 0)
- request += '<PARENT_ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["parent_id"] + '</PARENT_ID>';
- else
- request += '<PARENT_ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + newIdTab[e["parent_id"]] + '</PARENT_ID>';
- request += '<SORT_PRIO xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["SORT_PRIO"] + '</SORT_PRIO>';
- }
- if (typeof e["goto"] !== typeof undefined && e["goto"]["id"] !== null && e["goto"]["id"] !== 0 && e["goto"]["id"] !== "") {
- request += '<IF_TRUE_GOTO xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["goto"]["id"] + '</IF_TRUE_GOTO>';
- request += '<IF_TRUE_GOTO_FLAG xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["goto"]["flag"] + '</IF_TRUE_GOTO_FLAG>';
- } else {
- request += '<IF_TRUE_GOTO xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">0</IF_TRUE_GOTO>';
- request += '<IF_TRUE_GOTO_FLAG xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES"></IF_TRUE_GOTO_FLAG>';
- }
- request += '<DESC xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["desc"] + '</DESC>';
- request += '<OPIS xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + e["opis"] + '</OPIS>';
- request += `
- </CRM_PROCES>
- </Insert>
- `;
- var id;
- if (e["id"] >= 0)
- id = e["id"];
- else
- id = newIdTab[e["id"]];
- var sort_prio = 0;
- $.each(e["prof"].concat(e["res"]), function(iR, eR) {
- sort_prio++;
- request += `
- <Insert xmlns="http://www.opengis.net/wfs">
- <CRM_WSKAZNIK xmlns="` + BASE_URL + `wfs/default_db/CRM_WSKAZNIK">
- `;
- if (eR["id"] >= 0) {
- request += '<ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + eR["id"] + '</ID>';
- }
- request += '<ID_ZASOB xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + eR["id_zasob"] + '</ID_ZASOB>';
- request += '<ID_PROCES xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + id + '</ID_PROCES>';
- request += '<ID_PRZYPADEK xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + eR["id_przypadek"] + '</ID_PRZYPADEK>';
- var opis = eR["komentarz"];
- opis = opis.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
- request += '<SORT_PRIO xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + sort_prio + '</SORT_PRIO>';
- request += '<OPIS_ZASOB xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + opis + '</OPIS_ZASOB>';
- request += `
- </CRM_WSKAZNIK>
- </Insert>
- `;
- });
- });
- $.each(deletedId, function(key, value) {
- request += `
- <Insert xmlns="http://www.opengis.net/wfs">
- <CRM_PROCES xmlns="` + BASE_URL + `wfs/default_db/CRM_PROCES">
- `;
- request += '<ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">' + value + '</ID>';
- request += '<PARENT_ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">-1</PARENT_ID>';
- request += '<A_STATUS xmlns="' + BASE_URL + 'wfs/default_db/CRM_PROCES">DELETED</A_STATUS>';
- request += `
- </CRM_PROCES>
- </Insert>
- `;
- });
- $.each(deletedRes, function(key, value) {
- request += `
- <Insert xmlns="http://www.opengis.net/wfs">
- <CRM_WSKAZNIK xmlns="` + BASE_URL + `wfs/default_db/CRM_WSKAZNIK">
- `;
- request += '<ID xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">' + value + '</ID>';
- request += '<A_STATUS xmlns="' + BASE_URL + 'wfs/default_db/CRM_WSKAZNIK">DELETED</A_STATUS>';
- request += `
- </CRM_WSKAZNIK>
- </Insert>
- `;
- });
- request += '</Transaction>';
- //console.log(request);
- $.ajax({
- url: link,
- data: request,
- type: 'POST',
- contentType: "text/xml",
- dataType: "text",
- success: function(data) {
- //console.log(data);
- deletedRes = [];
- deletedId = [];
- //console.log(data);
- localStorage.removeItem("state" + mainProces_id);
- showPreview();
- $.notify("Zmiany zostały zapisane na serwerze.", "success");
- $("#saveBtn").prop('disabled', false);
- },
- error: function(xhr, ajaxOptions, thrownError) {
- $.notify("Brak połączenia z bazą danych", "error");
- }
- });
- },
- error: function(xhr, ajaxOptions, thrownError) {
- $.notify("Brak połączenia z bazą danych", "error");
- }
- });
- });
- $(document).on('click', '.btnEdit', function() {
- var parentIndex = getIndexById($(this).parents(".drop").data("id"));
- var type;
- if ($(this).parents("li").closest(".professions").length > 0)
- type = "prof";
- else
- type = "res";
- var zasobIndex = getResById(parentIndex, $(this).parents("li").data("id"), type);
- //console.log(zasobIndex);
- var permsOpt = "";
- $.each(perms, function(key, value) {
- if (state[parentIndex][type][zasobIndex]["id_przypadek"] == value[0])
- permsOpt = permsOpt + "<option value=" + value[0] + " selected=selected>[" + value[2] + "] " + value[1] + "</option>";
- else
- permsOpt = permsOpt + "<option value=" + value[0] + ">[" + value[2] + "] " + value[1] + "</option>";
- })
- swal({
- showCancelButton: true,
- title: 'Uprawnienia',
- html: 'Uprawnienia<br><select class=form-control id="swal-input1">' + permsOpt + '</select>' +
- 'Komentarz<br><input class=form-control id="swal-input2" class="swal2-input" value="' + state[parentIndex][type][zasobIndex]["komentarz"] + '">',
- preConfirm: function() {
- return new Promise(function(resolve) {
- resolve([
- $('#swal-input1').val(),
- $('#swal-input2').val()
- ]);
- });
- }
- }).then(function(result) {
- state[parentIndex][type][zasobIndex]["id_przypadek"] = result[0];
- state[parentIndex][type][zasobIndex]["komentarz"] = result[1];
- state[parentIndex][type][zasobIndex]["changed"] = true;
- updateAll();
- }).catch(function(e) {})
- });
- //Buttony i ich zadania
- $(document).on('click', '.step', function() {
- newSteps--;
- var main = false;
- var temp = {};
- if ($(this).parents(".drop").data("id") === mainProces_id)
- main = true;
- $(this).parents(".drop").after("<div class='drop container-fluid' id='proc" + newSteps + "'></div>");
- temp["id"] = newSteps;
- temp["desc"] = "";
- temp["opis"] = "";
- var index = getIndexById($(this).parents(".drop").data("id"));
- //console.log(state[index]["depth"]);
- temp["step"] = 0;
- temp["prof"] = new Array();
- temp["res"] = new Array();
- temp["C-desc"] = true;
- temp["C-opis"] = true;
- temp["stepDesc"] = "";
- if (!main) {
- temp["parent_id"] = state[index]["parent_id"];
- temp["depth"] = state[index]["depth"];
- } else {
- temp["parent_id"] = mainProces_id;
- temp["depth"] = 1;
- }
- state.splice(index + 1, 0, temp);
- stepsGenerator();
- updateAll();
- });
- $(document).on('keyup', '#sProcesy', function() {
- if ($(this).val() != lastSearch) {
- lastSearch = $(this).val();
- clearTimeout(sProcesy);
- sProcesy = setTimeout(function() {
- if (lastSearch == "")
- procesy();
- else
- searchProc();
- }, 300);
- }
- });
- $(document).on('keyup', '#sZasoby', function() {
- if ($(this).val() != lastSearch) {
- lastSearch = $(this).val();
- clearTimeout(sZasoby);
- sZasoby = setTimeout(function() {
- if (filtr === 0 && lastSearch == "")
- zasoby();
- else
- searchRes();
- }, 300);
- }
- });
- function arraymove(arr, fromIndex, toIndex) {
- //console.log("move " + fromIndex + " " + toIndex);
- var element = [];
- var element = arr[fromIndex];
- arr.splice(fromIndex, 1);
- arr.splice(toIndex, 0, element);
- }
- $(document).on('click', '.uArrowRes', function() {
- var parent = getIndexById(($(this).parents(".drop").data("id")));
- //alert(parent);
- if ($(this).closest(".professions").length > 0)
- type = "prof";
- else
- type = "res";
- var id = getResById(parent, $(this).closest("li").data("id"), type);
- //alert(id);
- //console.log(state);
- arraymove(state[parent][type], id, id - 1);
- updateAll();
- });
- $(document).on('click', '.dArrowRes', function() {
- var parent = getIndexById(($(this).parents(".drop").data("id")));
- //alert(parent);
- if ($(this).closest(".professions").length > 0)
- type = "prof";
- else
- type = "res";
- var id = getResById(parent, $(this).closest("li").data("id"), type);
- //alert(id);
- arraymove(state[parent][type], id, id + 1);
- updateAll();
- });
- $(document).on('click', '.uArrow', function() {
- var id = $(this).parents(".drop").data("id");
- var index = getIndexById(id);
- arraymove(state, index, index - 1);
- updateAll();
- });
- $(document).on('click', '.dArrow', function() {
- var id = $(this).parents(".drop").data("id");
- var index = getIndexById(id);
- //console.log("id " + id + " index" + index);
- arraymove(state, index, index + 1);
- updateAll();
- });
- $(document).on('click', '.rArrow', function() {
- var id = $(this).parents(".drop").data("id");
- state[getIndexById(id)]["depth"]++;
- //var depthWidth = 20 * $(node).data("depth");
- // $(node).css("padding-left", depthWidth + "px");
- updateAll();
- });
- $(document).on('click', '.lArrow', function() {
- var id = $(this).parents(".drop").data("id");
- state[getIndexById(id)]["depth"]--;
- //var depthWidth = 20 * $(node).data("depth");
- // $(node).css("padding-left", depthWidth + "px");
- updateAll();
- });
- $(document).on('click', '#btnZasoby', function(e) {
- e.preventDefault();
- $(".lButton").removeClass("btn-primary");
- if (dialog == 0) {
- zasoby();
- $(this).addClass("btn-primary");
- $("#wrapper").removeClass("toggled");
- dialog = 1;
- } else if (dialog == 1) {
- $("#wrapper").addClass("toggled");
- dialog = 0;
- } else {
- $("#wrapper").addClass("toggled");
- $(this).addClass("btn-primary");
- setTimeout(function() {
- zasoby();
- $("#wrapper").removeClass("toggled");
- }, 500);
- dialog = 1;
- }
- });
- $(document).on('click', '#btnProcesy', function(e) {
- e.preventDefault();
- $(".lButton").removeClass("btn-primary");
- if (dialog == 0) {
- procesy();
- $("#wrapper").removeClass("toggled");
- $(this).addClass("btn-primary");
- dialog = 2;
- } else if (dialog == 2) {
- $("#wrapper").addClass("toggled");
- dialog = 0;
- } else {
- $("#wrapper").addClass("toggled");
- $(this).addClass("btn-primary");
- setTimeout(function() {
- procesy();
- $("#wrapper").removeClass("toggled");
- }, 500);
- dialog = 2;
- }
- });
- $(document).on('click', 'body', function() {
- if (selectedArea != false) {
- var content = $(selectedArea).val();
- var id = (selectedArea).parents(".drop").data("id");
- if ($(selectedArea).parent().hasClass("hdesc")) {
- state[getIndexById(id)]["desc"] = content;
- state[getIndexById(id)]["C-desc"] = true;
- }
- if ($(selectedArea).parent().hasClass("sdesc")) {
- state[getIndexById(id)]["opis"] = content;
- state[getIndexById(id)]["C-opis"] = true;
- }
- selectedArea = false;
- updateAll();
- }
- });
- $(document).on('click', '.hdesc', function() {
- if ($(this).find("textarea").is(selectedArea))
- return false;
- });
- $(document).on('click', '.sdesc', function() {
- if ($(this).find("textarea").is(selectedArea))
- return false;
- });
- $(document).on('dblclick', '.sdesc', function() {
- if (selectedArea)
- return;
- if ($(this).find("textarea").length == 0) {
- var content = $(this).html();
- $(this).empty();
- $(this).append("<textarea>" + content + "</textarea>");
- selectedArea = $(this).find("textarea");
- }
- });
- $(document).on('click', '.sDescAdd', function() {
- if (selectedArea)
- return;
- var action = $(this).parents(".drop").find(".sdesc");
- if ($(action).find("textarea").length == 0) {
- //alert($(action).text());
- $(action).html("<textarea placeholder='Opis kroku'>"+$(action).text()+"</textarea>");
- selectedArea = $(action).find("textarea");
- return false;
- }
- });
- $(document).on('click', '.hDescAdd', function() {
- if (selectedArea)
- return;
- var action = $(this).parents(".drop").find(".hdesc");
- console.log(action);
- if ($(action).find("textarea").length == 0) {
- //alert($(action).text());
- $(action).html("<textarea placeholder='Tytuł kroku'>"+$(action).text()+"</textarea>");
- selectedArea = $(action).find("textarea");
- return false;
- }
- });
- $(document).on('dblclick', '.hdesc', function() {
- if ($(this).find("textarea").length == 0) {
- var content = $(this).html();
- $(this).empty();
- $(this).append("<textarea>" + content + "</textarea>");
- selectedArea = $(this).find("textarea");
- }
- });
- $(document).on('click', '.del', function() {
- var id = $(this).parents(".drop").data("id");
- var index = getIndexById(id);
- swal({
- title: 'Usuwanie kroku',
- text: "Czy napewno chcesz usunąć ten krok?",
- type: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- cancelButtonText: "Anuluj",
- confirmButtonText: 'Tak, usuń ten krok'
- }).then(function() {
- state.splice(index, 1);
- deletedId.push(id);
- updateAll();
- //Parent_id = -1,
- }).catch(function(e) {})
- });
- $(document).on('click', '.delGoto', function() {
- //var parent = $(this).parents(".drop");
- var id = $(this).parents("li").data("id");
- var parent = getIndexById($(this).parents(".drop").data("id"));
- swal({
- title: 'Usuwanie bramki',
- text: "Czy napewno chcesz usunąć tę bramkę?",
- type: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- cancelButtonText: "Anuluj",
- confirmButtonText: 'Tak, usuń tę bramkę'
- }).then(function() {
- state[parent]["goto"] = {
- id: "",
- flag: ""
- };
- updateAll();
- //Parent_id = -1,
- }).catch(function(e) {})
- });
- $(document).on('click', '.delRes', function() {
- //var parent = $(this).parents(".drop");
- var id = $(this).parents("li").data("id");
- var parent = getIndexById($(this).parents(".drop").data("id"));
- var type;
- if ($(this).closest(".professions").length > 0)
- type = "prof";
- else
- type = "res";
- var index = getResById(parent, id, type);
- swal({
- title: 'Usuwanie wskaźnika',
- text: "Czy napewno chcesz usunąć ten wskaźnik?",
- type: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#3085d6',
- cancelButtonColor: '#d33',
- cancelButtonText: "Anuluj",
- confirmButtonText: 'Tak, usuń ten wskaźnik'
- }).then(function() {
- deletedRes.push(id);
- state[parent][type].splice(index, 1);
- updateAll();
- //Parent_id = -1,
- }).catch(function(e) {})
- });
- //
- $(document).on('click', '.fbutton', function(e) {
- e.preventDefault();
- $(".fbutton").removeClass("btn-success");
- if ($(this).data("type") == filtr) {
- filtr = 0;
- //console.log("Odznaczono");
- } else {
- filtr = $(this).data("type");
- $(this).addClass("btn-success");
- }
- if (filtr === 0)
- $("#xBtn").prop("disabled", true);
- else
- $("#xBtn").prop("disabled", false);
- if (filtr === 0) {
- zasoby();
- } else
- searchRes();
- });
- $(document).on('click', '.showMore', function() {
- var target = $(this).parent().find(".more");
- var id = $(this).data("id");
- if ($(target).parent().hasClass("resSelected")) {
- $(".more").empty();
- $(target).parent().removeClass("resSelected");
- $(target).parent().find(".gIco").addClass("glyphicon-chevron-down");
- $(target).parent().find(".gIco").removeClass("glyphicon-chevron-up");
- } else {
- $(".more").parent().removeClass("resSelected");
- $(".more").parent().find(".gIco").addClass("glyphicon-chevron-down");
- $(".more").parent().find(".gIco").removeClass("glyphicon-chevron-up");
- $(".more").empty();
- $(target).parent().addClass("resSelected");
- $(target).parent().find(".gIco").removeClass("glyphicon-chevron-down");
- $(target).parent().find(".gIco").addClass("glyphicon-chevron-up");
- 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=<ogc:Filter><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>' + id + '</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>KOMORKA</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>&sortBy=SORT_PRIO+A,ID';
- //console.log(link);
- $.get(link, function(data) {
- $.each($(data).find("featureMember"), function() {
- if ($(this).find("ID").text() != 0) {
- var type = 0;
- $(target).append("<div class='dragStyle drag dragStyle hov' data-id=" + $(this).find("ID").text() + " data-type=" + type + " data-desc='" + $(this).find("DESC").text() + "' data-opis='" + $(this).find("OPIS").text() + "'>" + $(this).find("DESC").text() + " [" + $(this).find("ID").text() + "]</div>");
- $('.drag').draggable({
- appendTo: 'body',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- }
- });
- });
- }
- });
- function searchProc() {
- var id = lastSearch;
- var link;
- //console.log("Szukam");
- 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=<ogc:Filter><ogc:Or><ogc:PropertyIsLike wildCard="*" singleChar="^" escapeChar="!"><ogc:PropertyName>ID</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!"><ogc:PropertyName>DESC</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike></ogc:Or></ogc:Filter>&maxFeatures=100';
- $.get(link, function(data) {
- var side = $("#side");
- //console.log(data);
- $(side).find("#ulproc").empty();
- $.each($(data).find("featureMember"), function() {
- if ($(this).find("ID").text() * 1 == 0) {
- $(side).find("#ulcon").append("<div><center>Brak wyników wyszukiwania</center></div>");
- return;
- }
- $(side).find("#ulproc").append("<div class='dragStyle drag dragStyle hov' data-droptype=1 data-id=" + $(this).find("ID").text() + " > " + $(this).find("DESC").text() + " [" + $(this).find("ID").text() + "]</div>");
- $('.drag').draggable({
- appendTo: 'body',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- });
- });
- }
- function searchRes() {
- var id = lastSearch;
- var link;
- //console.log("Szukam");
- switch (filtr) {
- case 0:
- 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=<ogc:Filter><ogc:Or><ogc:PropertyIsLike wildCard="*" singleChar="^" escapeChar="!"><ogc:PropertyName>ID</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!"><ogc:PropertyName>DESC</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike></ogc:Or></ogc:Filter>&maxFeatures=100';
- break;
- case 1:
- 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=<ogc:Filter><ogc:And><ogc:Or><ogc:PropertyIsLike wildCard="*" singleChar="^" escapeChar="!"><ogc:PropertyName>ID</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!"><ogc:PropertyName>DESC</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike></ogc:Or><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>STANOWISKO</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>PODMIOT</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>DZIAL</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:And></ogc:Filter>&maxFeatures=100';
- break;
- case 2:
- 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=<ogc:Filter><ogc:And><ogc:Or><ogc:PropertyIsLike wildCard="*" singleChar="^" escapeChar="!"><ogc:PropertyName>ID</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike wildCard="*" singleChar="%23" escapeChar="!"><ogc:PropertyName>DESC</ogc:PropertyName><ogc:Literal>*' + id + '*</ogc:Literal></ogc:PropertyIsLike></ogc:Or><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>KOMORKA</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>TYPE</ogc:PropertyName><ogc:Literal>TABELA</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:And></ogc:Filter>&maxFeatures=100&sortBy=TYPE+A';
- //console.log(link);
- break;
- default:
- link = "";
- }
- $.get(link, function(data) {
- var side = $("#side");
- //console.log(data);
- $(side).find("#ulcon").empty();
- $.each($(data).find("featureMember"), function() {
- if ($(this).find("ID").text() * 1 == 0) {
- $(side).find("#ulcon").append("<div><center>Brak wyników wyszukiwania</center></div>");
- return;
- }
- var type = 0;
- if ($(this).find("TYPE").text() == "DZIAL" || $(this).find("TYPE").text() == "PODMIOT" || $(this).find("TYPE").text() == "STANOWISKO")
- type = 1;
- if (filtr != 2 || $(this).find("TYPE").text() != "TABELA")
- $(side).find("#ulcon").append("<div class='drag dragStyle hov' data-id=" + $(this).find("ID").text() + " data-type=" + type + " data-desc='" + $(this).find("DESC").text() + "' data-opis='" + $(this).find("OPIS").text() + "'>" + $(this).find("DESC").text() + " [" + $(this).find("ID").text() + "]</div>");
- else {
- $(side).find("#ulcon").append("<div ><span class='drag dragStyle click' data-id=" + $(this).find("ID").text() + " data-type=" + type + " data-desc='" + $(this).find("DESC").text() + "' data-opis='" + $(this).find("OPIS").text() + "'> # </span> <div style=width:80%;float:left; data-id=" + $(this).find("ID").text() + " class=showMore><span class=tabelaName>" + $(this).find("DESC").text() + "</span> [" + $(this).find("ID").text() + "]</div><span class='gIco glyphicon glyphicon-chevron-down' style:float:left;></span><div style=clear:both;></div><div class=more ></div></div>");
- }
- });
- $('.drag').draggable({
- appendTo: 'body',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- $(".drop").droppable({
- tolerance: 'pointer',
- accept: '.drag',
- hoverClass: "activeDrop",
- drop: function(event, ui) {
- if (ui.draggable.data("dropType") == 1)
- addProces(ui, this);
- else
- addResource(ui, this);
- }
- });
- });
- }
- $(document).on('click', '.liProc', function() {
- $(this).parents(".singleAdv").nextAll(".singleAdv").remove();
- $(this).parents(".singleAdv").find(".active").removeClass("active");
- $(this).find(".glyphicon").removeClass("glyphicon-triangle-right");
- $(this).find(".glyphicon").addClass("glyphicon-refresh");
- $(this).find(".glyphicon").addClass("anim-refresh");
- $(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_PROCES&SRSNAME=EPSG:3003&Filter=<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>' + parent_id + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>';
- var result = "";
- var depth = $(this).parents(".singleAdv").data("depth") + 1;
- $("#procCon").css("width", depth * 290 + 290);
- $(this).parents(".singleAdv").after("<div class='singleAdv list-group' data-depth=" + depth + " id=depth" + depth + "></div>");
- //console.log(link);
- var childs = true;
- $.get(link, function(data) {
- $(data).find("featureMember").each(function() {
- if ($(this).find("ID").text() == 0) {
- childs = false;
- return;
- }
- var type = 0;
- result += "<div class='list-group-item drag liProc' data-opis='" + $(this).find("OPIS").text() + "' data-desc='" + $(this).find("DESC").text() + "' data-droptype=1 data-id=" + $(this).find("ID").text() + " ><div class=textTable><span class=handle> # </span>" + $(this).find("DESC").text() + "</div><div class=detailsTable>[" + $(this).find("ID").text() + "]</div><div class='glyphicon glyphicon-triangle-right' style=opacity:0.4;float:right;></div><div class=clearfix></div></div>";
- });
- if (!childs) {
- result += '<div class="panel panel-primary">';
- result += '<div class="panel-heading"><h3 class="panel-title">[' + $(parent).data('id') + '] ' + $(parent).data("desc") + '</h3></div>';
- result += '<div class="panel-body pbody">';
- result += '<b>Opis: </b>' + $(parent).data("opis");
- result += '</div>';
- result += '</div>'
- }
- $("#depth" + depth).html(result);
- $('.drag').draggable({
- appendTo: 'body',
- handle: '.handle',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- $(parent).find(".glyphicon").addClass("glyphicon-triangle-right");
- $(parent).find(".glyphicon").removeClass("glyphicon-refresh");
- $(parent).find(".glyphicon").removeClass("anim-refresh");
- $("#ulproc").scrollLeft(depth * 290 + 290);
- $("#ulproc").scrollTop(0);
- });
- });
- function procesy() {
- var side = $("#side");
- $(side).empty();
- $("#sidebar-wrapper").css("width", "600px");
- $("#wrapper").css("padding-left", "600px");
- //$(side).append("<h3>Zarządzaj zasobami<h3>");
- $(side).append("<div class='form-group' ><input type='text' class=form-control id=sProcesy placeholder='Szukaj procesów'></div>");
- $(side).append("<div id=ulproc><div id=procCon></div></div>");
- $(side).find("#procCon").append("<div class='singleAdv list-group' data-depth=0 id=depth0></div>");
- $(side).find("#procCon").append("<div class=clearfix></div>");
- 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=<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>0</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>&sortBy=SORT_PRIO+A,ID';
- var result = "";
- $.get(link, function(data) {
- //console.log(data);
- $(data).find("featureMember").each(function() {
- var type = 0;
- result += "<div class='drag list-group-item liProc' data-droptype=1 data-opis='" + $(this).find("OPIS").text() + "' data-desc='" + $(this).find("DESC").text() + "' data-id=" + $(this).find("ID").text() + " ><div class=textTable><span class=handle> # </span>" + $(this).find("DESC").text() + "</div><div class=detailsTable> [" + $(this).find("ID").text() + "]</div><div class='glyphicon glyphicon-triangle-right' style=opacity:0.4;float:right;></div><div class=clearfix></div></div>";
- });
- $("#depth0").html(result);
- $('.drag').draggable({
- appendTo: 'body',
- handle: '.handle',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- });
- }
- $(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=<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>' + parent_id + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>&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("<div class='singleAdv list-group' data-depth=" + depth + " id=depth" + depth + "></div>");
- //console.log(link);
- 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 += "<div class='list-group-item drag liAdv' data-typename='" + $(this).find("TYPE").text() + "' data-id=" + $(this).find("ID").text() + " data-type=" + type + " data-desc='" + $(this).find("DESC").text() + "' data-opis='" + $(this).find("OPIS").text() + "' title='" + $(this).find("DESC").text() + "'><div class=textTable2><span class=handle> # </span>" + $(this).find("DESC").text() + "</div><div class='glyphicon glyphicon-triangle-right' style=opacity:0.4;float:right;></div><div class=clearfix></div><div class=detailsTable2>[" + $(this).find("ID").text() + "] " + $(this).find("TYPE").text() + "</div></div>";
- });
- if (!childs) {
- result += '<div class="panel panel-primary">';
- result += '<div class="panel-heading"><h3 class="panel-title">[' + $(parent).data('id') + '] ' + $(parent).data("desc") + '</h3></div>';
- result += '<div class="panel-body pbody">';
- result += '<b>Opis: </b>' + $(parent).data("opis");
- result += '<br><b>Typ: </b>' + $(parent).data("typename");
- result += '</div>';
- result += '</div>'
- }
- $("#depth" + depth).html(result);
- $('.drag').draggable({
- appendTo: 'body',
- handle: '.handle',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- $(parent).find(".glyphicon").addClass("glyphicon-triangle-right");
- $(parent).find(".glyphicon").removeClass("glyphicon-refresh");
- $("#ulcon").scrollLeft(depth * 290 + 290);
- $("#ulcon").scrollTop(0);
- });
- });
- function zasoby() {
- var side = $("#side");
- $(side).empty();
- $("#sidebar-wrapper").css("width", "600px");
- $("#wrapper").css("padding-left", "600px");
- //$(side).append("<h3>Zarządzaj zasobami<h3>");
- $(side).append("<div class='form-group' ><input type='text' class=form-control id=sZasoby placeholder='Szukaj zasobów'></div>");
- $(side).append("<div class='btn-group' style=width:100% id=filtry></div>");
- $("#filtry").append("<button type='button' data-type=1 class='fbutton btn btn-default input-block-level ' style=width:40%>Stanowiska</button>");
- $("#filtry").append("<button type='button' data-type=2 class='fbutton btn btn-default input-block-level ' style=width:40%>Komórki</button>");
- $("#filtry").append("<button type='button' data-type=0 class='fbutton btn btn-danger input-block-level' id=xBtn style=width:20% disabled>X</button>");
- $(side).append("<div id=ulcon><div id=advCon></div></div>");
- $(side).find("#advCon").append("<div class='singleAdv list-group' data-depth=0 id=depth0></div>");
- $(side).find("#advCon").append("<div class=clearfix></div>");
- 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=<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>0</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>&sortBy=SORT_PRIO+A,ID';
- var result = "";
- $.get(link, function(data) {
- //console.log(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 += "<div class='drag list-group-item liAdv' data-typename='" + $(this).find("TYPE").text() + "' data-id=" + $(this).find("ID").text() + " data-type=" + type + " data-desc='" + $(this).find("DESC").text() + "' data-opis='" + $(this).find("OPIS").text() + "' title='" + $(this).find("DESC").text() + "'><div class=textTable2><span class=handle> # </span>" + $(this).find("DESC").text() + "</div><div class='glyphicon glyphicon-triangle-right' style=opacity:0.4;float:right; style=float:left;></div><div class=clearfix></div><div class=detailsTable2>[" + $(this).find("ID").text() + "] " + $(this).find("TYPE").text() + "</div></div>";
- });
- $("#depth0").html(result);
- $('.drag').draggable({
- appendTo: 'body',
- handle: '.handle',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- });
- //$(side).find("#ulcon").append("<div class='drag' data-id=1 data-type=1 >[STANOWISKO] Ulotkarz</div>");
- //$(side).find("#ulcon").append("<div class='drag' data-id=2 data-type=1 >[STANOWISKO] Programista PHP</div>");
- //$(side).find("#ulcon").append("<div class='drag' data-id=3 data-type=2 >[ZASÓB] Komputer</div>");
- }
- function addProces(ui, target) {
- var id = $(target).data("id");
- var gotoOpt = "";
- $.each(gotoType, function(key, value) {
- gotoOpt += "<option value=" + value[0] + ">" + value[1] + "</option>";
- })
- 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 ? '<span class=class="alert alert-warning"><strong>Uwaga!</strong> Nowe łącze nadpisze już istniejące łącze.</span><br>' : "") + '<br><select class=form-control id="swal-input1">' + gotoOpt + '</select>',
- preConfirm: function() {
- return new Promise(function(resolve) {
- resolve([
- $('#swal-input1').val()
- ]);
- });
- }
- }).then(function(result) {
- //console.log("Dodaj zasob " + ui.draggable.data("id") + " do " + $(target).data("id") + " i uprawnienia id " + result[0] + " komentarz: " + result[1]); //
- newRes--;
- var temp = {};
- temp["flag"] = result[0];
- temp["id"] = ui.draggable.data("id");
- //console.log(temp);
- //console.log(state[getIndexById(id)]);
- state[getIndexById(id)]["goto"] = temp;
- updateAll();
- }).catch(function(e) {})
- }
- function addResource(ui, target) {
- var permsOpt = "";
- $.each(perms, function(key, value) {
- permsOpt = permsOpt + "<option value=" + value[0] + ">[" + value[2] + "] " + value[1] + "</option>";
- })
- swal({
- showCancelButton: true,
- cancelButtonText: "Anuluj",
- title: 'Uprawnienia',
- html: 'Uprawnienia<br><select class=form-control id="swal-input1">' + permsOpt + '</select>' +
- 'Komentarz<br><input class=form-control id="swal-input2" class="swal2-input">',
- preConfirm: function() {
- return new Promise(function(resolve) {
- resolve([
- $('#swal-input1').val(),
- $('#swal-input2').val()
- ]);
- });
- }
- }).then(function(result) {
- //console.log("Dodaj zasob " + ui.draggable.data("id") + " do " + $(target).data("id") + " i uprawnienia id " + result[0] + " komentarz: " + result[1]); //
- 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");
- 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;
- //console.log("Ustawiono nowe parent_id na " + e["parent_id"] + " dla " + e["id"]); //
- } else if (pid === false) {
- e["depth"]--;
- //var depthWidth = 20 * $(node).data("depth");
- //$(node).css("padding-left", depthWidth + "px");
- updateAll();
- return;
- }
- if (checkParentNode(e["id"], "right") === false) {
- $(this).find(".rArrow").hide();
- } else {
- $(this).find(".rArrow").show();
- }
- if (checkParentNode(e["id"], "left") === false) {
- $(this).find(".lArrow").hide();
- } else {
- $(this).find(".lArrow").show();
- }
- if (i == 1)
- $(this).find(".uArrow").hide();
- else
- $(this).find(".uArrow").show();
- if (i == state.length - 1) {
- $(this).find(".dArrow").hide();
- } else {
- $(this).find(".dArrow").show();
- }
- });
- //console.log(JSON.stringify(state));
- 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"]);
- //console.log("Generowanie step dla "+e["id"]);
- //console.log("iParent "+iParent);
- state[iParent]["step"] += 1;
- //console.log(state[iParent]["step"]);
- 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;
- //console.log(tab);
- 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) {
- //console.log(e["id"]);
- //console.log(id);
- if (e["id"] == id) {
- //console.log("Zwraca "+i);
- result = i;
- return false;
- }
- });
- return result;
- }
- function getIndexById(id) {
- //console.log("Szuka"+id);
- var result = state.length - 1;
- $.each(state, function(i, e) {
- //console.log(e["id"]);
- //console.log(id);
- if (e["id"] == id) {
- //console.log("Zwraca "+i);
- result = i;
- return false;
- }
- });
- return result;
- }
- /*function logState() {
- //console.log("########");
- $.each(state, function(i, e) {
- //console.log(i + ": " + e["id"]);
- });
- //console.log("########");
- }*/
- function render(arr, target) {
- stepsGenerator();
- var result = "";
- console.log(arr);
- $.each(arr, function(i, e) {
- result += "<div class='drop container-fluid' data-id=" + e["id"] + " id='proc" + e["id"] + "'>";
- result += "<div class='col-xs-1 options' style=text-align:right;padding-top:2px; id=opt" + e["id"] + ">";
- if (i > 0) {
- result += "<span class='glyphicon glyphicon-remove-sign ico del' title='Usuń krok' aria-hidden='true'></span>";
- //Arrows
- if (checkParentNode(e["id"], "right") !== false)
- result += "<span class='glyphicon glyphicon-arrow-right ico rArrow' aria-hidden='true' title='Przesuń krok w prawo'></span>";
- if (checkParentNode(e["id"], "left") !== false)
- result += "<span class='glyphicon glyphicon-arrow-left ico lArrow' aria-hidden='true' title='Przesuń krok w lewo'></span>";
- if (i != 1)
- result += "<span class='glyphicon glyphicon-arrow-up ico uArrow' aria-hidden='true' title='Przesuń krok w górę'></span>";
- if (i != state.length - 1)
- result += "<span class='glyphicon glyphicon-arrow-down ico dArrow' aria-hidden='true' title='Przesuń krok w dół'></span>";
- } else {
- }
- result += "<span class='hDescAdd glyphicon glyphicon-edit ico' title='Edytuj tytuł'></span>";
- result += "<div class='clearfix'></div>";
- if (e["opis"] == "")
- result += "<span class=sDescAdd>Dodaj opis</span>";
- else
- result += "<span class=sDescAdd>Edytuj opis</span>";
- result += "</div>";
- result += "<div class='col-xs-10 desc' id='desc" + e["id"] + "' ><h4 class='changable " + (e["C-desc"] ? "changed" : "") + "'><span class='stepDesc'>" + e["stepDesc"] + "</span><span class=hdesc>" + e["desc"] + "</span> <span class=ids>{" + (e["id"] >= 0 ? e["id"] : "?") + "}</span></h4><span class='sdesc changable " + (e["C-opis"] ? "changed" : "") + "'>" + e["opis"] + "</span>";
- // }
- // if ($(this).find("OPIS").text() == "") {
- // $("#proc" + $(this).find("ID").text()).find(".sdesc").after("<span class=sDescAdd>Dodaj opis</span>");
- // }
- result += "<div class='clearfix'></div>";
- var anyProf = false;
- $.each(e["prof"], function(i2, e2) {
- if (!anyProf) {
- result += "<div class=row><div class=col-sm-2 style=font-size:1.2em;text-align:right;opacity:1>Stanowiska</div></div><ul class=professions style=padding:0;>";
- anyProf = true;
- }
- result += "<li style=padding-top:5px;paddig-bottom:5px; class='liRes' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><div class=row>";
- result += "<div class=col-sm-2 style=text-align:right;>";
- if (i2 != 0)
- result += "<span class='glyphicon glyphicon-arrow-up uArrowRes' title='Przesuń wskaźnik w górę' aria-hidden='true'></span>";
- if (i2 != e["prof"].length - 1)
- result += "<span class='glyphicon glyphicon-arrow-down dArrowRes' title='Przesuń wskaźnik w dół' aria-hidden='true'></span>";
- result += "<span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span><span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
- result += "</div>";
- result += "<div class='col-sm-10 changable " + (e2["changed"] ? "changed" : "") + " '><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] </div>";
- result += "</div></li>";
- });
- if (anyProf) {
- result += "</ul>";
- }
- var anyRes = false;
- $.each(e["res"], function(i2, e2) {
- if (!anyRes) {
- result += "<div class=row><div class=col-sm-2 style=font-size:1.2em;text-align:right;opacity:1>Użyte zasoby</div></div><ul class=resources style=padding:0;>";
- anyRes = true;
- }
- result += "<li style=padding-top:5px;paddig-bottom:5px; class='liRes' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><div class=row>";
- result += "<div class=col-sm-2 style=text-align:right;>";
- if (i2 != 0)
- result += "<span class='glyphicon glyphicon-arrow-up uArrowRes' title='Przesuń wskaźnik w górę' aria-hidden='true'></span>";
- if (i2 != e["prof"].length - 1)
- result += "<span class='glyphicon glyphicon-arrow-down dArrowRes' title='Przesuń wskaźnik w dół' aria-hidden='true'></span>";
- result += "<span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span><span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
- result += "</div>";
- result += "<div class='col-sm-10 changable " + (e2["changed"] ? "changed" : "") + " '><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] </div>";
- result += "</div></li>";
- });
- if (anyRes) {
- result += "</ul>";
- }
- 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 += "<span style=color:grey; class=goto>— " + name + "</span> <span class='glyphicon glyphicon-remove-sign delGoto' title='Usuń GOTO' style=font-size:12px; aria-hidden='true' ></span>";
- }
- result += "<br><span class=step>Dodaj nowy krok</span>";
- result += "</div>"
- result += "</div>";
- });
- //console.log(result);
- $(target).html(result);
- $('.drag').draggable({
- appendTo: 'body',
- helper: 'clone',
- stack: "div",
- distance: 0,
- cursor: "copy"
- });
- $(".drop").droppable({
- tolerance: 'pointer',
- accept: '.drag',
- zIndex: 0,
- hoverClass: "activeDrop",
- drop: function(event, ui) {
- if (ui.draggable.data("droptype") == 1)
- addProces(ui, this);
- else
- addResource(ui, this);
- }
- });
- }
- function genTree(parent_id) {
- //logState();
- 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=<ogc:Filter><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>PARENT_ID</ogc:PropertyName><ogc:Literal>' + parent_id + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter>&sortBy=SORT_PRIO+A,ID';
- //console.log(link);
- $.ajax({
- url: link,
- success: function(data) {
- //console.log(data);
- var i = 0;
- $.each($(data).find("featureMember"), function() {
- var temp = {};
- if ($(this).find("ID").text() == "0")
- return;
- var parentIndex = getIndexById(parent_id);
- temp["id"] = $(this).find("ID").text();
- temp["desc"] = $(this).find("DESC").text();
- temp["opis"] = $(this).find("OPIS").text();
- temp["parent_id"] = $(this).find("PARENT_ID").text();
- temp["depth"] = state[parentIndex]["depth"] + 1;
- temp["step"] = 0;
- temp["changes"] = {};
- temp["prof"] = new Array();
- temp["res"] = new Array();
- temp["goto"] = {};
- temp["goto"]["id"] = $(this).find("IF_TRUE_GOTO").text();
- temp["goto"]["flag"] = $(this).find("IF_TRUE_GOTO_FLAG").text();
- temp["stepDesc"] = "";
- i++;
- state.splice(parentIndex + i, 0, temp);
- genTree($(this).find("ID").text());
- });
- }
- });
- }
- //Pierwszy render, tworzy potrzebna strukture
- function showPreview() {
- changes = false;
- $("#clearBtn").hide();
- lastSearch = "";
- filtr = 0;
- selectedArea = false;
- state = [];
- if (false && localStorage.getItem("state" + mainProces_id) !== null) {
- state = JSON.parse(localStorage.getItem("state" + mainProces_id));
- newSteps = localStorage.getItem("newStep" + mainProces_id);
- newRes = localStorage.getItem("newRes" + mainProces_id);
- deletedId = JSON.parse(localStorage.getItem("deletedId" + mainProces_id));
- deletedRes = JSON.parse(localStorage.getItem("deletedRes" + mainProces_id));
- //console.log("z");
- //console.log(localStorage.getItem("state" + mainProces_id));
- $.notify("Wczytano niezapisany stan z " + localStorage.getItem("date" + mainProces_id), "info");
- //console.log(state);
- render(state, $("#main"));
- loaded = true;
- } else {
- $("#main").html("<center>Synchronizowanie danych z serwerem.</center>");
- newSteps = 0;
- newRes = 0;
- deletedId = [];
- deletedRes = [];
- var id = mainProces_id;
- 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=<ogc:Filter><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>ID</ogc:PropertyName><ogc:Literal>' + id + '</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter>';
- //console.log(link);
- $.get(link, function(data) {
- var temp = {};
- loaded = false;
- temp["id"] = mainProces_id;
- temp["depth"] = 0;
- temp["parent_id"] = false;
- temp["step"] = 0;
- temp["goto"] = {};
- temp["goto"]["id"] = $(data).find("featureMember").find("IF_TRUE_GOTO").text();
- temp["goto"]["flag"] = $(data).find("featureMember").find("IF_TRUE_GOTO_FLAG").text();
- temp["changes"] = {};
- temp["stepDesc"] = "";
- temp["prof"] = new Array();
- temp["res"] = new Array();
- temp["desc"] = $(data).find("featureMember").find("DESC").text();
- temp["opis"] = $(data).find("featureMember").find("OPIS").text()
- tab.push(mainProces_id);
- state[0] = temp;
- genTree(mainProces_id);
- });
- actSite = "preview";
- }
- }
- });
- function unloadPage() {
- if (changes)
- return "";
- }
- window.onbeforeunload = unloadPage;
|