diff --git a/app/main/model/basicmodel.php b/app/main/model/basicmodel.php index 1e14d974..fa4e2566 100644 --- a/app/main/model/basicmodel.php +++ b/app/main/model/basicmodel.php @@ -411,6 +411,9 @@ abstract class BasicModel extends \DB\Cortex { * return false will stop any further action */ public function beforeInsertEvent(){ + if($this->exists('updated')){ + $this->touch('updated'); + } return true; } diff --git a/app/main/model/connectionmodel.php b/app/main/model/connectionmodel.php index c24ee762..df02fed3 100644 --- a/app/main/model/connectionmodel.php +++ b/app/main/model/connectionmodel.php @@ -120,7 +120,7 @@ class ConnectionModel extends BasicModel{ $this->eolUpdated = null; }elseif( in_array('wh_eol', $newTypes) && - !in_array('wh_eol', $this->type) + !in_array('wh_eol', (array)$this->type) // $this->type == null for new connection! (e.g. map import) ){ // connection EOL status change $this->touch('eolUpdated'); @@ -196,14 +196,17 @@ class ConnectionModel extends BasicModel{ */ public function beforeInsertEvent(){ // check for "default" connection type and add them if missing + // -> get() with "true" returns RAW data! important for JSON table column check! + $types = (array)json_decode( $this->get('type', true) ); + if( !$this->scope || - !$this->type + empty($types) ){ $this->setDefaultTypeData(); } - return true; + return parent::beforeInsertEvent(); } /** diff --git a/js/app/map/map.js b/js/app/map/map.js index 369aebbe..80bee5bc 100644 --- a/js/app/map/map.js +++ b/js/app/map/map.js @@ -3029,6 +3029,7 @@ define([ // check if system data should be added var addSystemData = true; if( + options.getAll !== true && options.checkForChange === true && !tempSystem.hasChanged() ){ @@ -3056,6 +3057,7 @@ define([ // check if connection data should be added var addConnectionData = true; if( + options.getAll !== true && options.checkForChange === true && !$(tempConnection).hasChanged() ){ diff --git a/js/app/ui/dialog/map_settings.js b/js/app/ui/dialog/map_settings.js index 594a905a..14ec79a5 100644 --- a/js/app/ui/dialog/map_settings.js +++ b/js/app/ui/dialog/map_settings.js @@ -340,8 +340,25 @@ define([ var validExportForm = exportForm.isValidForm(); if(validExportForm){ - // set map data right before download - $(this).setExportMapData(e.data.mapData); + var mapElement = Util.getMapModule().getActiveMap(); + + if(mapElement){ + // IMPORTANT: Get map data from client (NOT from global mapData which is available in here) + // -> This excludes some data (e.g. wh statics) + // -> Bring export inline with main map toggle requests + var exportMapData = mapElement.getMapDataFromClient({ + forceData: true, + getAll: true + }); + + // set map data right before download + $(this).setExportMapData(exportMapData); + + // disable button + $(this).attr('disabled', true); + }else{ + console.error('Map not found'); + } }else{ e.preventDefault(); } @@ -514,21 +531,7 @@ define([ filename = fieldExport.val(); if(filename.length > 0){ - // remove object properties that should not be included in export - // -> e.g. jsPlumb object,... - var allowedKeys = ['config', 'data']; - - var replace = function(obj, keys) { - var dup = {}; - for (var key in obj) { - if (keys.indexOf(key) !== -1) { - dup[key] = obj[key]; - } - } - return dup; - }; - - mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( replace(mapData, allowedKeys) )); + mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( mapData )); } } diff --git a/public/js/v1.1.3/app/map/map.js b/public/js/v1.1.3/app/map/map.js index 369aebbe..80bee5bc 100644 --- a/public/js/v1.1.3/app/map/map.js +++ b/public/js/v1.1.3/app/map/map.js @@ -3029,6 +3029,7 @@ define([ // check if system data should be added var addSystemData = true; if( + options.getAll !== true && options.checkForChange === true && !tempSystem.hasChanged() ){ @@ -3056,6 +3057,7 @@ define([ // check if connection data should be added var addConnectionData = true; if( + options.getAll !== true && options.checkForChange === true && !$(tempConnection).hasChanged() ){ diff --git a/public/js/v1.1.3/app/ui/dialog/map_settings.js b/public/js/v1.1.3/app/ui/dialog/map_settings.js index 594a905a..14ec79a5 100644 --- a/public/js/v1.1.3/app/ui/dialog/map_settings.js +++ b/public/js/v1.1.3/app/ui/dialog/map_settings.js @@ -340,8 +340,25 @@ define([ var validExportForm = exportForm.isValidForm(); if(validExportForm){ - // set map data right before download - $(this).setExportMapData(e.data.mapData); + var mapElement = Util.getMapModule().getActiveMap(); + + if(mapElement){ + // IMPORTANT: Get map data from client (NOT from global mapData which is available in here) + // -> This excludes some data (e.g. wh statics) + // -> Bring export inline with main map toggle requests + var exportMapData = mapElement.getMapDataFromClient({ + forceData: true, + getAll: true + }); + + // set map data right before download + $(this).setExportMapData(exportMapData); + + // disable button + $(this).attr('disabled', true); + }else{ + console.error('Map not found'); + } }else{ e.preventDefault(); } @@ -514,21 +531,7 @@ define([ filename = fieldExport.val(); if(filename.length > 0){ - // remove object properties that should not be included in export - // -> e.g. jsPlumb object,... - var allowedKeys = ['config', 'data']; - - var replace = function(obj, keys) { - var dup = {}; - for (var key in obj) { - if (keys.indexOf(key) !== -1) { - dup[key] = obj[key]; - } - } - return dup; - }; - - mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( replace(mapData, allowedKeys) )); + mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( mapData )); } }