$(document).ready(function(){ _attachTopNavMenu(); _displayMapRead('app'); }); function _attachTopNavMenu () { var adjacentTopNavMenuDOM = "" + "" + ""; var baseObject = document.getElementById('app'); baseObject.insertAdjacentHTML('beforebegin', adjacentTopNavMenuDOM); _attachTopNavMenuFunction(); } function _attachTopNavMenuFunction () { $('#sidebar a.nav-link.flat').on('click', function(e){ e.stopImmediatePropagation(); var menuid = $(this).attr('id'); $('.navbar-collapse').collapse('hide'); switch(menuid){ case 'home': window.location.href = "detail.php"; break; case 'home': case 'leaflet_crud_read': _displayMapRead('app'); break; case 'leaflet_crud_create': _displayMapCreate('app'); break; case 'leaflet_crud_delete': _displayMapDelete('app'); break; default: console.log('__undefined__'); break; } return false; }); $('#sidebar a.dropdown-item').on('click', function(e){ e.stopImmediatePropagation(); var menuid = $(this).attr('id'); $('.navbar-collapse').collapse('hide'); $(this).closest('li.nav-item.dropdown').find('.nav-link.dropdown-toggle').dropdown('toggle'); switch(menuid){ case 'leaflet_crud_update_point': _displayMapUpdatePoint('app'); break; case 'leaflet_crud_update_linestring': _displayMapUpdateLinestring('app'); break; case 'leaflet_crud_update_polygon': _displayMapUpdatePolygon('app'); break; default: console.log('__undefined__'); break; } return false; }); } function _buildDigitiseModalBox (targetmodal,context,geometry) { targetmodal = typeof targetmodal !== 'undefined' ? targetmodal : 'modalbox'; context = typeof context !== 'undefined' ? context : 'POINT'; geometry = typeof geometry !== 'undefined' ? geometry : 'POINT (110.21766 -7.459129)'; var htmlformcomponent = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
Dati indetificativi
Note alla geometria
" + ""; var modalfooter = "" + "" + "" + ""; $("#form_modal_body").empty(); $("#form_modal_footer").empty().html(modalfooter); $("#form_modal_body").removeClass().addClass('modal-body'); $("#form_modal_size").removeClass().addClass('modal-dialog'); $("#form_modal_body").html(htmlformcomponent); $("#form_modal_label").html(" "+context+""); $('#'+targetmodal+'').modal({show:true, backdrop:'static', keyboard:false}); } function _activateFeatureSave () { $("#savegeometrydata").on('click', function(evt){ evt.stopImmediatePropagation(); var commandContext = $('#command').val(); var noteString = $('#notes').val(); var geometry = $('#geometry').val(); if (commandContext == "POINT") { $.ajax({ url: "assets/dataservice/create_point.php", method: "GET", dataType: "json", data: $('#dynamicform').serialize(), success: function (data) { if (data.response=="200") { $("#modalform").modal('hide'); } else { $("#modalform").modal('hide'); console.log('Failed to save.'); } }, username: null, password: null }); } else if (commandContext == "LINESTRING") { $.ajax({ url: "assets/dataservice/create_linestring.php", method: "GET", dataType: "json", data: $('#dynamicform').serialize(), success: function (data) { if (data.response=="200") { $("#modalform").modal('hide'); } else { $("#modalform").modal('hide'); console.log('Failed to save.'); } }, username: null, password: null }); } else if (commandContext == "POLYGON") { $.ajax({ url: "assets/dataservice/create_polygon.php", method: "GET", dataType: "json", data: $('#dynamicform').serialize(), success: function (data) { if (data.response=="200") { $("#modalform").modal('hide'); } else { $("#modalform").modal('hide'); console.log('Failed to save.'); } }, username: null, password: null }); } else { console.log('__undefined__'); } return false; }); }