0

I have a problem with the reference of some JS files for Configurable Map Viewer (ver 1.3.4).

I have a file called index.html which load certain config file depending on the option chosen. I call my index file by writing : http://local_add/sonar/app/index.html?config=all. When config = ALL is chosen, it will load notauth.js. In this index.html, i make sure that it goes to the line Controller.startup(notauth); (i put an alert just before Controller.startup and the alert shows up) The map wont show up. I debug using chrome and i find out that some of the JS files are incorrectly called. See my error here and another error here.

I have set my init.js and dojo.js to point to correct address.

Where in the codes / files that call those JS incorrectly ?

Not all of them are incorrect, some are correct.

How can I correct this ?

What files should i fix ?

Here is my index.html







    <script type="text/javascript">
        var dojoConfig = {
            async: true,
            packages: [{
                name: 'viewer',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/viewer'
            },{
                name: 'config',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/config'
            },{
                name: 'gis',
                location: location.pathname.replace(/[^\/]+$/, '') + 'js/gis'
            }]
        };


    </script>

            <script type="text/javascript" src="http://10.255.1.77/sonar/arcgis_js_api/library/3.15/3.15/init.js"></script>
            <script type="text/javascript">             
            //Get app ID from url 
            var file = 'config/viewer', s = window.location.search, q = s.match(/config=([^&]*)/i);
            //alert ('var file ORI (config/viewer) : ' + file);
            //alert ('nilainya Q : ' + q);
            if (q && q.length > 0) {
                file = q[1];
                //alert ('Q1 : ' + file);
                //alert ('S : ' + s);
                if(file.indexOf('/') < 0) {
                        configfile = 'config/' + file;
                }
                //alert ('CONFIG-FILE : ' + configfile);
            }

if (configfile == 'config/all') 
            {

                //alert ('config == ALL');
                //alert ('configfile is ' + configfile + ' -- strpathfile  : ' + strpathfile);


                if (ImgStatus && checkfileimg_js(strpathfile)) {
                    require(['viewer/Controller', configfile + '_imagery'], function(Controller, config){
                    Controller.startup(config);
                    });
                    }
                    else 
                    {
                    alert (' controller.startup(notauth) Hellow NOAUTH ');
                    require(['viewer/Controller', 'config/all'], function(Controller, notauth)
                        {
                        Controller.startup(notauth);
                        });
                    }   
            }               
                else    //IF configfile <> ALL (env,pims,clear dll)

            { 
                Controller.startup(auth);
            }

Here is my notauth.js

define([

'esri/units', 'esri/geometry/Extent', 'esri/config', 'esri/tasks/GeometryService', 'esri/layers/ImageParameters' ], function (units, Extent, esriConfig, GeometryService, ImageParameters) {

// url to your proxy page, must be on same machine hosting you app. See proxy folder for readme.
esriConfig.defaults.io.proxyUrl = 'proxy/proxy.ashx';
esriConfig.defaults.io.alwaysUseProxy = false;
// url to your geometry server.
esriConfig.defaults.geometryService = new GeometryService('http://LOCAL_ADDRESS/arcgis/rest/services/Utilities/Geometry/GeometryServer');

//image parameters for dynamic services, set to png32 for higher quality exports.
var imageParameters = new ImageParameters();
imageParameters.format = 'png32';
    //appHeader.headerTitle.color:'#ff1919';
    //var idBody = document.getElementById('headerTitle');
    //idBody.style.color = '#FF1919';
    document.getElementById('headerTitleSpan').style.color = '#0000a0'; //#B30000
    document.getElementById('subHeaderTitleSpan').style.color = '#FF1919'; //#0000a0(Blue)  //#FF1919(Red)
    document.getElementById('headerTitleSpanAccess').style.color = '#FF1919';   //#FF1919(Red)
return {
    // used for debugging your app
    isDebug: true,

    //default mapClick mode, mapClickMode lets widgets know what mode the map is in to avoid multipult map click actions from taking place (ie identify while drawing).
    defaultMapClickMode: 'identify',
    // map options, passed to map constructor. see: https://developers.arcgis.com/javascript/jsapi/map-amd.html#map1
    mapOptions: {
        basemap: 'streets',
        center: [151.059179687466666, 1.90196293111110],
        zoom: 5,
        sliderStyle: 'small'
    },

    //collapseButtonsPane: 'center', //center or outer

    // operationalLayers: Array of Layers to load on top of the basemap: valid 'type' options: 'dynamic', 'tiled', 'feature'.
    // The 'options' object is passed as the layers options for constructor. Title will be used in the legend only. id's must be unique and have no spaces.
    // 3 'mode' options: MODE_SNAPSHOT = 0, MODE_ONDEMAND = 1, MODE_SELECTION = 2
    operationalLayers: [],
    // set include:true to load. For titlePane type set position the the desired order in the sidebar
    widgets: {
        growler: {
            include: true,
            id: 'growler',
            type: 'domNode',
            path: 'gis/dijit/Growler',
            srcNodeRef: 'growlerDijit',
                            loading: false,
                            results: false,
            options: {}
        },
                    growl: {
                        // should the "loading" growl be displayed?
                        loading: false,
                        // should the "Results" growl be displayed?
                        results: false
                    },                  
        geocoder: {
            include: true,
            id: 'geocoder',
            type: 'domNode',
            path: 'gis/dijit/Geocoder',
            srcNodeRef: 'geocodeDijit',
            options: {
                map: true,
                mapRightClickMenu: false,
                geocoderOptions: {
                    autoComplete: true,
                    arcgisGeocoder: {
                        placeholder: 'Enter an address or place'
                    }
                }
            }
        },
        basemaps: {
            include: true,
            id: 'basemaps',
            type: 'domNode',
            path: 'gis/dijit/Basemaps',
            srcNodeRef: 'basemapsDijit',
            options: 'config/_common/basemaps'
        },
        mapInfo: {
            include: false,
            id: 'mapInfo',
            type: 'domNode',
            path: 'gis/dijit/MapInfo',
            srcNodeRef: 'mapInfoDijit',
            options: {
                map: true,
                mode: 'dms',
                firstCoord: 'y',
                unitScale: 3,
                showScale: true,
                xLabel: '',
                yLabel: '',
                minWidth: 286
            }
        },
        scalebar: {
            include: true,
            id: 'scalebar',
            type: 'map',
            path: 'esri/dijit/Scalebar',
            options: {
                map: true,
                attachTo: 'bottom-left',
                scalebarStyle: 'line',
                scalebarUnit: 'dual'
            }
        },
        overviewMap: {
            include: true,
            id: 'overviewMap',
            type: 'map',
            path: 'esri/dijit/OverviewMap',
            options: {
                map: true,
                attachTo: 'bottom-right',
                color: '#0000CC',
                height: 100,
                width: 125,
                opacity: 0.30,
                visible: false
            }
        },
        homeButton: {
            include: true,
            id: 'homeButton',
            type: 'domNode',
            path: 'esri/dijit/HomeButton',
            srcNodeRef: 'homeButton',
            options: {
                map: true,
                extent: new Extent({
                    xmin: 93.7,
                    ymin: -17.8,
                    xmax: 141.2,
                    ymax: 18.2,
                    spatialReference: {
                        wkid: 4326
                    }
                })
            }
        },                          
        layerControl: {
            include: true,
            id: 'layerControl',
            type: 'titlePane',
            path: 'gis/dijit/LayerControl',
            title: 'Layers',
            open: false,
            position: 0,
            options: {
                map: true,
                layerControlLayerInfos: true,
                separated: true,
                vectorReorder: true,
                overlayReorder: true
            }
        },
                    bookmarks: {
            include: true,
            id: 'bookmarks',
            type: 'titlePane',
            path: 'gis/dijit/Bookmarks',
            title: 'Bookmarks',
            open: true,
            position: 1,
            options: 'config/_common/bookmarks'
        },
                    gotocoord: {
                        include: true,
                        id: 'gotocoord',
                        type: 'titlePane',
                        canFloat: false, 
                        position: 2,
                        path: 'gis/dijit/Goto',
                        title: 'Go To Coordinate',
                        options: {
                        map: true
                                }
                    },            
        measure: {
            include: true,
            id: 'measurement',
            type: 'titlePane',
            canFloat: false,
            path: 'gis/dijit/Measurement',
            title: 'Measurement',
            open: false,
            position: 4,
            options: {
                map: true,
                mapClickMode: true,
                defaultAreaUnit: units.SQUARE_METERS,
                defaultLengthUnit: units.METERS
            }
        },
        help: {
            include: true,
            id: 'help',
            type: 'floating',
            path: 'gis/dijit/Help',
            title: 'Help',
            options: {}
        }

    }
};

});

Here is my basemaps.js :

    define([
    'esri/dijit/Basemap',
    'esri/dijit/BasemapLayer',
    'esri/layers/osm'
], function (  Basemap, BasemapLayer, osm  ) {
    return {
        map: true, // needs a refrence to the map
        mode: 'custom', //must be either 'agol' or 'custom'
        title: 'Basemaps', 
        mapStartBasemap: 'osm', //'streets', //'googleHybrid', //local_OSM
        // TODO Is this array necessary when the same keys are explicitly included/excluded below?          
                //for ogol use this script below                            
                //basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'lightGray', 'gray', 'national-geographic', 'osm', 'oceans'],  
                //for custom use this script below                      
                basemapsToShow: ['streets'],                        
                basemaps: {
            streets: {
                title: 'Streets',
                basemap: new Basemap({
                    id: 'streets',
                    layers: [new BasemapLayer({
                        url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
                    })]
                })
            }

        }
    };
});
  • it turns out that the problem is caused by incorect init.js and dojo.js configuration. Instead of typing (somewhere in line 32) "10.255.1.77/sonar/arcgis_js_api/library/3.15/3.15/dojo/", i type "10.255.1.77/sonar/arcgis_js_api/library/3.15/3.15/". Now all the JS are loaded correctly. Still, the map won't show up. Any idea where i should check ? Thanks – padjee Jan 7 at 8:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.