Skip to Content
0
Sep 26, 2016 at 09:55 AM

Issue calling ds_generateMimeURL in SCN Community Component SDK

27 Views

Hi,

I'm in the process of trying to enhance Mike Howles' SCN Community excellent Choropleth map component, so that it can upload and use a geoJSON file (functionality that currently exists in the Leaflet Map component).

I'm new to the development of the SCN Community components, however after a long and steep learning cure 😕, I have finally got to the point where I have managed to upload a geoJSON file into the Design Studio repository - this was achieved through the use of the custom aps control "special-url", which I inserted into the code in VizMap.js as follows:

function VizMap(options){

var that = this;

var properties = {

mapData : {

value : "",

opts : {

desc : "GeoJSON File",

cat : "Mapping-Map Data",

apsControl : "special-url",

kind: "GeoJSON"

},

onChange : function(value){

var file = value;

if(file){

var url = "/aad/" + ds_generateMimeUrl(file);

}

}

},



However, I am now getting the following error message when trying to call the ds_generateMimeURL() function (which returns the full path to the file in the DS repository):


'A JavaScript error occurred. 'ds_generateMimeUrl' is undefined ReferenceError: 'ds_generateMimeUrl' is undefined at properties.mapData.onChange (http://localhost:55016/aad/zen/mimes/sdk_include/org.scn.community.shared/os/viz-modules/VizMap.js?version=20160803120544&hash=undefined:27:7) at Anonymous function (http://localhost:55016/aad/zen/mimes/sdk_include/org.scn.community.shared/os/viz-modules/SDKCore.js?version=20160803120544&hash=undefined:51:8) at updateProperty (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/component.js?version=20160803120544:41:5) at dispatchProperties (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/component.js?version=20160803120544:53:6) at dispatchProperties (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/sdkcontrol.js?version=20160803120544:37:4) at update (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/sdk_handler.js?version=20160803120544:72:4) at updateComponent (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=20160803120544:2469:3) at dispatchUpdateControl (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=20160803120544:1216:5) at dispatchDelta (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=20160803120544:104:5) at dispatch (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=20160803120544:2103:4)'



This function call works just fine in the LeafletMap component (where the call to ds_generateMimeURL is invoked in the layereditor.js code).


I have checked that I am passing a valid file name (floor3.geojson) into the ds_generateMimeUrl() function, but I am obviously missing something fairly fundamental here.


I am hoping that someone can point me in the right direction as to what I am missing here, as I appear to have reached the limit of my expertise at the moment!


Additionally, I am finding it very difficult to find where the various function definitions are made within the various modules - am I missing something in my Eclipse Setup which will help me navigate the SCN Community code structure?


Kind Regards,


Colin