/*** Summary: Patch removal of selected features so that it must be confirmed by the user before actual removal.* Installation method: append to MapConfig.js* Target: Geospatial Portal EP04+* Created: 2016-11-16* Author: Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>*/Sys.Application.add_init(function(){varorig=Intergraph.WebSolutions.Core.WebClient.Platform.ClientScript.Edit.InsertFeature.prototype.removeSelectedFeatures;Intergraph.WebSolutions.Core.WebClient.Platform.ClientScript.Edit.InsertFeature.prototype.removeSelectedFeatures=function(){varargs=Array.prototype.slice.call(arguments);$GP.selectedFeatures.find({},function(ret){// ret.featureClassIds is array of feature class Ids// ret.featureIds and ret.features are multidimensional arrays with array of features for each featureClassId from ret.featureClassIdsif(ret.featureClassIds.join(",").indexOf("UndeletableFeatureClass1")>-1){$GP.ui.info("You cannot delete objects from this feature class!");$event.notify("cancelMapOperation",{mapStateId:"map"},this);return;}// Examine feature classes and features using $GP.selectedFeatures methods and decide what to dovarconfirmation=window.confirm("Are you sure?");if(confirmation){orig.apply(args);}else{$GP.ui.info("Features saved");$event.notify("cancelMapOperation",{mapStateId:"map"},this);}});};});
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.