|
|
@@ -219,87 +219,87 @@ $(document).ready(function() {
|
|
|
});
|
|
|
//Saveaction
|
|
|
var makeCRCTable = function(){
|
|
|
- var c;
|
|
|
- var crcTable = [];
|
|
|
- for(var n =0; n < 256; n++){
|
|
|
- c = n;
|
|
|
- for(var k =0; k < 8; k++){
|
|
|
- c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
|
|
+ var c;
|
|
|
+ var crcTable = [];
|
|
|
+ for (var n = 0; n < 256; n++) {
|
|
|
+ c = n;
|
|
|
+ for (var k = 0; k < 8; k++) {
|
|
|
+ c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
|
|
+ }
|
|
|
+ crcTable[n] = c;
|
|
|
}
|
|
|
- crcTable[n] = c;
|
|
|
+ return crcTable;
|
|
|
}
|
|
|
- return crcTable;
|
|
|
-}
|
|
|
|
|
|
-var crc32 = function(str) {
|
|
|
- var crcTable = window.crcTable || (window.crcTable = makeCRCTable());
|
|
|
- var crc = 0 ^ (-1);
|
|
|
- for (var i = 0; i < str.length; i++ ) {
|
|
|
- crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
|
|
|
- }
|
|
|
- return (crc ^ (-1)) >>> 0;
|
|
|
-};
|
|
|
+ var crc32 = function(str) {
|
|
|
+ var crcTable = window.crcTable || (window.crcTable = makeCRCTable());
|
|
|
+ var crc = 0 ^ (-1);
|
|
|
+ for (var i = 0; i < str.length; i++) {
|
|
|
+ crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
|
|
|
+ }
|
|
|
+ return (crc ^ (-1)) >>> 0;
|
|
|
+ };
|
|
|
|
|
|
$(document).on('click', '#expBtn', function() {
|
|
|
- var exp = {};
|
|
|
- exp["id"] = mainProces_id;
|
|
|
- exp["time"] = moment().format("YYYY-MM-DD HH:mm:ss");
|
|
|
-
|
|
|
- var temp = {};
|
|
|
- temp["state"] = state;
|
|
|
- temp["newSteps"] = newSteps;
|
|
|
- temp["newRes"] = newRes;
|
|
|
- temp["deletedId"] = deletedId;
|
|
|
- temp["deletedRes"] = deletedRes;
|
|
|
- exp["data"] = temp;
|
|
|
- var crc = {};
|
|
|
- crc["crc"] = crc32(JSON.stringify(exp));
|
|
|
- crc["content"] = exp;
|
|
|
- swal({
|
|
|
- title: 'Import/Export',
|
|
|
- text: 'Wybierz czynność:',
|
|
|
- type: 'warning',
|
|
|
- cancelButtonText: 'Import',
|
|
|
- confirmButtonText: 'Export',
|
|
|
- cancelButtonColor: '#d33',
|
|
|
- confirmButtonColor: '#3085d6',
|
|
|
- showCancelButton: true,
|
|
|
- }).then(function (){
|
|
|
+ var exp = {};
|
|
|
+ exp["id"] = mainProces_id;
|
|
|
+ exp["time"] = moment().format("YYYY-MM-DD HH:mm:ss");
|
|
|
+
|
|
|
+ var temp = {};
|
|
|
+ temp["state"] = state;
|
|
|
+ temp["newSteps"] = newSteps;
|
|
|
+ temp["newRes"] = newRes;
|
|
|
+ temp["deletedId"] = deletedId;
|
|
|
+ temp["deletedRes"] = deletedRes;
|
|
|
+ exp["data"] = temp;
|
|
|
+ var crc = {};
|
|
|
+ crc["crc"] = crc32(JSON.stringify(exp));
|
|
|
+ crc["content"] = exp;
|
|
|
swal({
|
|
|
- title: 'Export',
|
|
|
- text: 'Zapisz zawartość pola poniżej:',
|
|
|
- inputValue: JSON.stringify(crc),
|
|
|
- inputClass: 'export',
|
|
|
- input: 'textarea',
|
|
|
- })
|
|
|
- }, function(dismiss){
|
|
|
- if(dismiss === 'cancel'){
|
|
|
- swal({
|
|
|
- title: 'Import',
|
|
|
- text: 'Wklej dane do zaimportowania:',
|
|
|
- inputPlaceholder: "Wklej tutaj dane, które otrzymałeś w trakcie eksportu.",
|
|
|
- input: 'textarea',
|
|
|
- }).then(function (imp){
|
|
|
- var parsed = JSON.parse(imp);
|
|
|
- if(crc32(JSON.stringify(parsed["content"])) === parsed["crc"]){
|
|
|
- parsed = parsed["content"];
|
|
|
- if(parsed["id"] === mainProces_id){
|
|
|
- $.notify("Dane z "+parsed["time"]+" zaimportowane pozytywnie.", "success");
|
|
|
- parsed = parsed["data"];
|
|
|
- state = parsed["state"];
|
|
|
- newRes= parsed["newRes"];
|
|
|
- deletedId= parsed["deletedId"];
|
|
|
- deletedRes= parsed["deletedRes"];
|
|
|
- updateAll();
|
|
|
- }else{
|
|
|
- $.notify("Zły proces. Dane do eksportu dotyczą procesu "+parsed["id"]+".", "error");
|
|
|
- }
|
|
|
- }else{
|
|
|
- $.notify("Suma kontrolna jest nieprawidłowa. Dane uległy uszkodzeniu.", "error");
|
|
|
+ title: 'Import/Export',
|
|
|
+ text: 'Wybierz czynność:',
|
|
|
+ type: 'warning',
|
|
|
+ cancelButtonText: 'Import',
|
|
|
+ confirmButtonText: 'Export',
|
|
|
+ cancelButtonColor: '#d33',
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
+ showCancelButton: true,
|
|
|
+ }).then(function() {
|
|
|
+ swal({
|
|
|
+ title: 'Export',
|
|
|
+ text: 'Zapisz zawartość pola poniżej:',
|
|
|
+ inputValue: JSON.stringify(crc),
|
|
|
+ inputClass: 'export',
|
|
|
+ input: 'textarea',
|
|
|
+ })
|
|
|
+ }, function(dismiss) {
|
|
|
+ if (dismiss === 'cancel') {
|
|
|
+ swal({
|
|
|
+ title: 'Import',
|
|
|
+ text: 'Wklej dane do zaimportowania:',
|
|
|
+ inputPlaceholder: "Wklej tutaj dane, które otrzymałeś w trakcie eksportu.",
|
|
|
+ input: 'textarea',
|
|
|
+ }).then(function(imp) {
|
|
|
+ var parsed = JSON.parse(imp);
|
|
|
+ if (crc32(JSON.stringify(parsed["content"])) === parsed["crc"]) {
|
|
|
+ parsed = parsed["content"];
|
|
|
+ if (parsed["id"] === mainProces_id) {
|
|
|
+ $.notify("Dane z " + parsed["time"] + " zaimportowane pozytywnie.", "success");
|
|
|
+ parsed = parsed["data"];
|
|
|
+ state = parsed["state"];
|
|
|
+ newRes = parsed["newRes"];
|
|
|
+ deletedId = parsed["deletedId"];
|
|
|
+ deletedRes = parsed["deletedRes"];
|
|
|
+ updateAll();
|
|
|
+ } else {
|
|
|
+ $.notify("Zły proces. Dane do eksportu dotyczą procesu " + parsed["id"] + ".", "error");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $.notify("Suma kontrolna jest nieprawidłowa. Dane uległy uszkodzeniu.", "error");
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
$(document).on('click', '#saveBtn', function() {
|
|
|
@@ -357,8 +357,6 @@ var crc32 = function(str) {
|
|
|
xmlns:p5_default_db="` + BASE_WFS_URL + `/default_db"
|
|
|
xmlns:gml="http://www.opengis.net/gml">
|
|
|
`;
|
|
|
- // 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&"
|
|
|
-
|
|
|
$.each(state, function(i, e) {
|
|
|
request += `
|
|
|
<Insert xmlns="http://www.opengis.net/wfs">
|
|
|
@@ -450,22 +448,21 @@ var crc32 = function(str) {
|
|
|
contentType: "text/xml",
|
|
|
dataType: "text",
|
|
|
success: function(data) {
|
|
|
- if($(data).children("serviceException").text() == ""){
|
|
|
- deletedRes = [];
|
|
|
- deletedId = [];
|
|
|
- localStorage.removeItem("state" + mainProces_id);
|
|
|
- showPreview();
|
|
|
- $.notify("Zmiany zostały zapisane na serwerze.", "success");
|
|
|
- }
|
|
|
- else{
|
|
|
- $.notify("Błąd API. Zmiany zostały zapisane wyłącznie w pamięci Twojej przeglądarki. Skontaktuj się z administratorem.", "error");
|
|
|
- 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"));
|
|
|
- }
|
|
|
+ if ($(data).children("serviceException").text() == "") {
|
|
|
+ deletedRes = [];
|
|
|
+ deletedId = [];
|
|
|
+ localStorage.removeItem("state" + mainProces_id);
|
|
|
+ showPreview();
|
|
|
+ $.notify("Zmiany zostały zapisane na serwerze.", "success");
|
|
|
+ } else {
|
|
|
+ $.notify("Błąd API. Zmiany zostały zapisane wyłącznie w pamięci Twojej przeglądarki. Skontaktuj się z administratorem.", "error");
|
|
|
+ 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"));
|
|
|
+ }
|
|
|
$("#saveBtn").prop('disabled', false);
|
|
|
},
|
|
|
error: function(xhr, ajaxOptions, thrownError) {
|
|
|
@@ -572,7 +569,6 @@ var crc32 = function(str) {
|
|
|
});
|
|
|
|
|
|
function arraymove(arr, fromIndex, toIndex) {
|
|
|
- //console.log("move " + fromIndex + " " + toIndex);
|
|
|
var element = [];
|
|
|
var element = arr[fromIndex];
|
|
|
arr.splice(fromIndex, 1);
|
|
|
@@ -724,7 +720,6 @@ var crc32 = function(str) {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
-
|
|
|
$(document).on('dblclick', '.sdesc', function() {
|
|
|
if (selectedArea)
|
|
|
return;
|
|
|
@@ -1110,48 +1105,50 @@ var crc32 = function(str) {
|
|
|
});
|
|
|
|
|
|
$(document).on('change', '#inp', function() {
|
|
|
- if (this.files && this.files[0]) {
|
|
|
- var link = BASE_URL + "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003";
|
|
|
- var name = this.files[0].name;
|
|
|
- var FR = new FileReader();
|
|
|
- FR.onload = function(e) {
|
|
|
- var contentBase64 = e.target.result;
|
|
|
- var xml = `
|
|
|
- <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_WFS_URL + `/default_db"
|
|
|
- xmlns:gml="http://www.opengis.net/gml">
|
|
|
-
|
|
|
- <Insert xmlns="http://www.opengis.net/wfs">
|
|
|
- <CRM_IMAGE xmlns="` + BASE_WFS_URL + `/default_db">
|
|
|
- <NAME xmlns="` + BASE_WFS_URL + `/default_db">`+name+`</NAME>
|
|
|
- <IMAGE xmlns="` + BASE_WFS_URL + `/default_db">`+contentBase64+`</IMAGE>
|
|
|
- <REMOTE_TABLE xmlns="` + BASE_WFS_URL + `/default_db">ADMIN_USERS</REMOTE_TABLE>
|
|
|
- <REMOTE_ID xmlns="` + BASE_WFS_URL + `/default_db">`+USER_ID+`</REMOTE_ID>
|
|
|
- </CRM_IMAGE>
|
|
|
- </Insert>
|
|
|
- </Transaction>`;
|
|
|
- $.ajax({
|
|
|
- url: link,
|
|
|
- data: xml,
|
|
|
- type: 'POST',
|
|
|
- contentType: "text/xml",
|
|
|
- dataType: "xml",
|
|
|
- success: function(data) {
|
|
|
- console.log(data);
|
|
|
- if($(data).find("ServiceException").text() != ""){
|
|
|
- $.notify($(data).find("ServiceException").text() ,"error");
|
|
|
- } else {
|
|
|
- $("#clipboard").append("<li class='list-group-item'><img src='"+contentBase64+"' / width=400></li>");
|
|
|
+ if (this.files && this.files[0]) {
|
|
|
+ var link = BASE_URL + "wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003";
|
|
|
+ var name = this.files[0].name;
|
|
|
+ var size = this.files[0].size;
|
|
|
+ var type = this.files[0].type;
|
|
|
+ var FR = new FileReader();
|
|
|
+ FR.onload = function(e) {
|
|
|
+ var contentBase64 = e.target.result;
|
|
|
+ var xml = `
|
|
|
+ <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_WFS_URL + `/default_db"
|
|
|
+ xmlns:gml="http://www.opengis.net/gml">
|
|
|
+
|
|
|
+ <Insert xmlns="http://www.opengis.net/wfs">
|
|
|
+ <CRM_IMAGE xmlns="` + BASE_WFS_URL + `/default_db">
|
|
|
+ <NAME xmlns="` + BASE_WFS_URL + `/default_db">` + name + `</NAME>
|
|
|
+ <IMAGE xmlns="` + BASE_WFS_URL + `/default_db">` + contentBase64+`</IMAGE>
|
|
|
+ <REMOTE_TABLE xmlns="` + BASE_WFS_URL + `/default_db">ADMIN_USERS</REMOTE_TABLE>
|
|
|
+ <REMOTE_ID xmlns="` + BASE_WFS_URL + `/default_db">` + USER_ID + `</REMOTE_ID>
|
|
|
+ </CRM_IMAGE>
|
|
|
+ </Insert>
|
|
|
+ </Transaction>`;
|
|
|
+ $.ajax({
|
|
|
+ url: link,
|
|
|
+ data: xml,
|
|
|
+ type: 'POST',
|
|
|
+ contentType: "text/xml",
|
|
|
+ dataType: "xml",
|
|
|
+ success: function(data) {
|
|
|
+ if ($(data).find("ServiceException").text() != "") {
|
|
|
+ $.notify($(data).find("ServiceException").text(), "error");
|
|
|
+ } else {
|
|
|
+ $("#clipboard").append("<li class='list-group-item'><img src='"+contentBase64+"' / width=400></li>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
- FR.readAsDataURL( this.files[0] );
|
|
|
- }
|
|
|
+ };
|
|
|
+ FR.readAsDataURL( this.files[0] );
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
function photos() {
|
|
|
@@ -1161,19 +1158,18 @@ var crc32 = function(str) {
|
|
|
<h4>Wrzuć pliki do swojego schowka</h4>
|
|
|
<input id="inp" type='file'>
|
|
|
<h4>Pliki w schowku</h4>`;
|
|
|
- $(side).append(form);
|
|
|
- var schowek = '<ul class="list-group" id=clipboard>';
|
|
|
- schowek += '</ul>';
|
|
|
-
|
|
|
- $(side).append(schowek);
|
|
|
- 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:3003Filter=<ogc:Filter><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_ID</ogc:PropertyName><ogc:Literal>'+USER_ID+'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_TABLE</ogc:PropertyName><ogc:Literal>ADMIN_USERS</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>';
|
|
|
- $.get(link, function(data) {
|
|
|
- $(data).find("featureMember").each(function() {
|
|
|
- });
|
|
|
- });
|
|
|
- schowek += '<li class="list-group-item">';
|
|
|
- schowek += 'Twoje zdjęcia w schowku';
|
|
|
- schowek += '</li>';
|
|
|
+ $(side).append(form);
|
|
|
+ var schowek = '<ul class="list-group" id=clipboard>';
|
|
|
+ schowek += '</ul>';
|
|
|
+ $(side).append(schowek);
|
|
|
+ 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=<ogc:Filter><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_ID</ogc:PropertyName><ogc:Literal>' + USER_ID + '</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>REMOTE_TABLE</ogc:PropertyName><ogc:Literal>ADMIN_USERS</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>';
|
|
|
+ $.get(link, function(data) {
|
|
|
+ $(data).find("featureMember").each(function() {
|
|
|
+ });
|
|
|
+ });
|
|
|
+ schowek += '<li class="list-group-item">';
|
|
|
+ schowek += 'Twoje zdjęcia w schowku';
|
|
|
+ schowek += '</li>';
|
|
|
}
|
|
|
|
|
|
function zasoby() {
|
|
|
@@ -1230,7 +1226,11 @@ var crc32 = function(str) {
|
|
|
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>',
|
|
|
+ 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([
|
|
|
@@ -1419,12 +1419,9 @@ var crc32 = function(str) {
|
|
|
}
|
|
|
|
|
|
/*function logState() {
|
|
|
- //console.log("########");
|
|
|
$.each(state, function(i, e) {
|
|
|
- //console.log(i + ": " + e["id"]);
|
|
|
|
|
|
});
|
|
|
- //console.log("########");
|
|
|
}*/
|
|
|
$(document).on('click', '.stateOff', function() {
|
|
|
$(this).closest(".mx").prev(".tree").show();
|