|
POST
|
Hi Michael, setting the allowedReferers and mustMatch as you specified gives the same result - login box. Yes, the folder is on the web server. mor_js_dev contains the html files etc. for the site, and in it is the DotNet folder with all the proxy files. We haven't got any other HTML5/JavaScript apps running off this web server. I've been using Chrome Developer tools, but it's not given me much clarity. I check the console but is there anything else I should be looking at? I'm a GIS person first and not much of a developer. If I type the proxy url that's being sent directly into the browser (DotNet/proxy.ashx?http://cop-gis4.corp.portvancouver.com/arcgis/rest/services/MOR_Printing/GPServer/Export%20Web%20Map?f=json) I still get a login box and when I cancel that out, a 401 unauthorized error.
... View more
08-27-2015
10:39 AM
|
0
|
0
|
1698
|
|
POST
|
Hi Michael, My proxy.config contains: <?xml version="1.0" encoding="utf-8" ?> <ProxyConfig allowedReferers="http://mor" mustMatch="true"> <serverUrls> <serverUrl url="http://cop-gis4.corp.portvancouver.com/arcgis/rest/services/MOR_Printing/GPServer/Export%20Web%20Map" matchAll="true"/> </serverUrls> </ProxyConfig> http://mor is the server hosting the application, whereas http://cop-gis4.corp.portvancouver.com hosts all the map's services. I only need the print service to go through the proxy (and if I change the server url to just http://cop-gis4.corp.portvancouver.com, and matchall="false", I still get a 403 forbidden error). The rest of the services show up on the map just fine, and did so before I tried to use a proxy. In my site's javascript, I have the line: esriConfig.defaults.io.proxyUrl = "http://mor/mor_js_dev/DotNet/proxy.ashx";
... View more
08-27-2015
10:05 AM
|
0
|
3
|
1698
|
|
POST
|
Hi All, I'm struggling a bit to figure out how to set up the .NET proxy so I can use my print service. I believe I've set things up as they should be, but when I run my map I get an "Authentication Required" popup asking for a username and password. I don't know what u/p it's expecting as neither my Windows or ArcGIS server u/p seem to be satisfactory. My print service is not secured, nor are any other layers on the map. Does anyone know why this may be happening?
... View more
08-27-2015
08:42 AM
|
0
|
5
|
4822
|
|
POST
|
Update: I found my error was that in the switch statement, the event.srcElement.className being returned was, of course, the class name of the aSelectAll href. It was not in the end any problem with the changed event being triggered. I changed the switch statement to the following, which works: switch(event.srcElement.className) {
case "cadastral_list_item":
var inputs = query(".cadastral_list_item");
var serviceLayer = layerCadastral;
break;
case "enviro_list_item":
var inputs = query(".enviro_list_item");
var serviceLayer = layerEnvironment;
break;
case "aSelectAll":
switch(event.srcElement.id){
case "aBIEAPSelectAll":
case "aFREMPSelectAll":
var inputs = query(".enviro_list_item");
var serviceLayer = layerEnvironment;
}
}
... View more
07-29-2015
01:36 PM
|
0
|
0
|
276
|
|
POST
|
No worries, I appreciate your help very much. If I comment out line 14, the code never reaches the updateLayerVisibility function. That is if using either the .trigger('change') or .change(), as I specified above. So this leads me to believe neither of these methods are actually triggering the change event?
... View more
07-24-2015
09:37 AM
|
0
|
1
|
2240
|
|
POST
|
var targetSelectAll = ((event.srcElement.id).replace("SelectAll", '')).slice(1); the .slice(1) part is cutting off the 'a' at the beginning, the result does end up as just BIEAP or FREMP If I throw in an alert box showing targetSelectAll, the result shows correctly See this jsfiddle, which doesn't work very well ("on(document.body, ".enviro_list_item:change", updateLayerVisibility);" doesn't seem to be working, though it does in my map).
... View more
07-24-2015
08:53 AM
|
0
|
3
|
2240
|
|
POST
|
Thanks Thejus, you are correct - I thought I had checked that it was reaching the intended case in the switch statement but now that I check again, it is not. I've tried adding into the jquery something to trigger the change event but it doesn't seem to be working. See line 12 below, do you see any reason this does not work? I've also tried changing lines 10 and 11 (see bottom codeblock) to: $(targetSelectMenu).find(':checkbox').prop('checked', !checked).change();
$(this).data('checked', !checked).change(); But these don't work either. I can change things so that "inputs" gets populated in the jquery, but it would be more efficient if I could trigger the change event somehow. My jquery: $(".aSelectAll").click(function(){
//cut off the "a" and "SelectAll" from the clicked link's id
//example id would be 'aBIEAPSelectAll'
var targetSelectAll = ((event.srcElement.id).replace("SelectAll", '')).slice(1);
//piece together the id of the menu targeted
//example result would be "#divMenuBIEAP
var targetSelectMenu = "#divMenu" + targetSelectAll;
//find all the checkboxes in the divMenu and toggle them
var checked = $(this).data('checked');
$(targetSelectMenu).find(':checkbox').prop('checked', !checked);
$(this).data('checked', !checked);
$(targetSelectMenu).find(':checkbox').trigger('change');
//run the function to update the visibility of layers
updateLayerVisibility();
});
... View more
07-24-2015
08:26 AM
|
0
|
5
|
2240
|
|
POST
|
Hi Thejus, thanks for answering. I'm not using query anywhere else in my code, is that what you meant? So if query(".enviro_list_item") is polling that class, do you know why it seems to be failing when using the "Select All" link to turn checkboxes on/off, but not when checking checkboxes directly? I'm confused because the code seems to know the checkboxes were changed, as it passes the switch statement successfully. If it gets to that point, from my understanding, all that has to happen next is to look at the enviro_list_item class, which doesn't require any further check or change event? switch(event.srcElement.className) {
case "cadastral_list_item":
var inputs = query(".cadastral_list_item");
var serviceLayer = layerCadastral;
break;
case "enviro_list_item":
var inputs = query(".enviro_list_item");
var serviceLayer = layerEnvironment;
break;
}
... View more
07-23-2015
03:31 PM
|
0
|
7
|
2240
|
|
POST
|
Sorry, I've tried to format the syntax-highlighting twice, but it seems it's unformatting itself.
... View more
07-23-2015
01:55 PM
|
0
|
9
|
2240
|
|
POST
|
Hi everyone, I'm using the ESRI sample for turning my layers on and off: Toggle layer visibility | ArcGIS API for JavaScript I've tried to modify things because I have some checkboxes that I'd like to be able to turn on and off as a group. As I've written the code, turning these on and off using the "Select All" link does seem to work fine, until it gets to this line (line 29 in the codeblock below): var inputs = query(".enviro_list_item") At this point it's passed the case test, but it seems that the variable "inputs" is empty. I get an 'Uncaught TypeError: Cannot read property of 'length' of undefined' in my NetBeans Console, and the layers within the div (everything that just got checked) are not drawn. However if I check a checkbox with the same class, outside or inside the div (as long as I'm not using "Select All"), all the checked layers do get drawn. I tried to look up exactly what this query(".enviro_list_item") does but I can't find any information on query(). I'm guessing it polls the values of the checkboxes within the specified class and puts them in an array. But why would it not work because these are being turned on/off via the html link? It must be to do with the click or change event not being fired? I tried adding this jquery (line 13 below) but it didn't make a difference: $(targetSelectMenu).find(':checkbox').trigger('change'); If I could get the above working, I think I would not need line 15 then? Here is my code HTML: <div id="divMenuEnvironment" class='divMenu'> <label id="lblBIEAP" class="lblSubMenuItem"><img id="imgBIEAP" src="Images\plus.png" width="13"/>BIEAP</label><a class="aSelectAll" id="aBIEAPSelectAll"> Select All</a></br> <div id='divMenuBIEAP' class='divSubMenu'> <div id='txtBIEAPHighTide' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPHighTide' value=26 />High Tide Line</div> <div id='txtBIEAPLowTide' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPLowTide' value=38 />Low Tide Line</div> <div id='txtBIEAPShoreSeg' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPShoreSeg' value=37 />Shoreline Segments</div> <div id='txtBIEAPOverVeg' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPOverVeg' value=36 />Overhanging Vegetation</div> <div id='txtBIEAPShoreEros' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPShoreEros' value=35 />Shoreline Erosion</div> <div id='txtBIEAPOutfalls' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPOutfalls' value=34 />Outfalls</div> <div id='txtBIEAPIntFeat' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPIntFeat' value=33 />Interesting Features</div> <div id='txtBIEAPBirdNest' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPBirdNest' value=32 />Bird Nests</div> <div id='txtBIEAPIntPlant' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPIntPlant' value=31 />Introduced Plants</div> <div id='txtBIEAPIntVegFeat' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPIntVegFeat' value=30 />Intertidal Vegetation Features</div> <div id='txtBIEAPIntVegAreas' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPIntVegAreas' value=29 />Intertidal Vegetation Areas</div> <div id='txtBIEAPIntSubs' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBIEAPIntSubs' value=28 />Intertidal Substrates</div> </div> <label id="lblFREMP" class="lblSubMenuItem"><img id="imgFREMP" src="Images\plus.png" width="13"/>FREMP</label><a class="aSelectAll" id="aFREMPSelectAll"> Select All</a></br> <div id='divMenuFREMP' class='divSubMenu'> <div id='txtFREMPColCode' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkFREMPColCode' value=43 />Colour Codes</div> <div id='txtFREMPAreaDes' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkFREMPAreaDes' value=42 />Area Designation</div> <div id='txtFREMPHabComp' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkFREMPHabComp' value=41 />Habitat Compensation</div> <div id='txtFREMPHabOrd' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkFREMPHabOrd' value=40 />Habitat Order</div> </div> <div id='txtBoreholes' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkBoreholes' value=0 />Boreholes</div> <img id='imgContSitesLock' src='Images\lock.png' height='0' style='float:left;' title='You do not have access to this layer'/> <div id='txtContSites' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkContSites' value=45 />Contaminated Sites</div> <img id='imgEnvLibLock' src='Images\lock.png' height='0' style='float:left;' title='You do not have access to this layer'/> <div id='txtEnviroLib' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkEnvLib' value= />Enviro Library</div> <div id='txtHabComp' class='divMenuItem'><input type='checkbox' class='enviro_list_item' id='chkHabComp' value=17 />Habitat Compensation Sites</div> </div> Javascript: //The following fires when a "Select All" link is clicked to turn all layers in a subgroup on/off $(".aSelectAll").click(function(){ //cut off the "a" and "SelectAll" from the clicked link's id //example id would be 'aBIEAPSelectAll' var targetSelectAll = ((event.srcElement.id).replace("SelectAll", '')).slice(1); //piece together the id of the menu targeted //example result would be "#divMenuBIEAP var targetSelectMenu = "#divMenu" + targetSelectAll; //find all the checkboxes in the divMenu and toggle them var checked = $(this).data('checked'); $(targetSelectMenu).find(':checkbox').prop('checked', !checked); $(this).data('checked', !checked); $(targetSelectMenu).find(':checkbox').trigger('change'); //run the function to update the visibility of layers updateLayerVisibility(); }); on(document.body, ".cadastral_list_item:change", updateLayerVisibility); on(document.body, ".enviro_list_item:change", updateLayerVisibility); function updateLayerVisibility () { switch(event.srcElement.className) { case "cadastral_list_item": var inputs = query(".cadastral_list_item"); var serviceLayer = layerCadastral; break; case "enviro_list_item": var inputs = query(".enviro_list_item"); var serviceLayer = layerEnvironment; break; } var inputCount = inputs.length; visibleLayerIds = [1001]; for (var i = 0; i < inputCount; i++) { if (inputs.checked) { visibleLayerIds.push(inputs.value); } } if (visibleCadastralLayerIds.length === 0) { visibleLayerIds.push(-1); } serviceLayer.setVisibleLayers(visibleLayerIds); // run the identify task setup every time the layer visibility is updated identifyTaskSetup(); //refresh the legend legendDijit.refresh(); }
... View more
07-23-2015
01:51 PM
|
0
|
10
|
5945
|
|
POST
|
Hi All, I'm using the following from the ESRI JS samples to toggle my layers on and off, and it works well enough: Toggle layer visibility | ArcGIS API for JavaScript However, getting each checkbox by its id seems a rather bloated way of doing things when you're working with ~100 layers. I'm pretty new to javascript so I'm not sure of the syntax to get the checkboxes by class, or if this can even work? I've tried multiple id's: on(dom.byId("chkVFPABoundary", "chkMunicipalBoundaries"), "change", updateCadastralLayerVisibility); Which didn't work. Also: on(document.getElementsByClassName(".cadastral_list_item"), "change", updateCadastralLayerVisibility); //Anything in my cadastral service has this class name Which didn't work. I'm pretty sure I can't use 'on' with document.getElementsByClassName? Is there something comparable? I tried jquery: $('.cadastral_list_item').change(function() {
if(this.checked) {
updateCadastralLayerVisibility()
}
}); This didn't work either, nothing happens at all when the checkbox is clicked. I've been scouring the internet all day, but can't find any clues. Thanks in advance.
... View more
07-16-2015
03:12 PM
|
0
|
2
|
3229
|
|
POST
|
Hi Chris, thank you for your suggestions. The solution you provided does work in IE but not in Chrome - I'm not sure what happened to the lock icon but it's not visible in Chrome anymore. However the map goes behind the menu when I would prefer it to be be beside. I'd like to keep the CSS as it was, it was functioning as I wanted it to, it was just the map itself that wasn't stretching to fill the white space. Robert's suggestion of using map.resize() did work also, but only resizes the map to fill about 1/2 the space left when rightPanel slides...I wonder if this is because map.resize() and rightPanel's animation are happening simultaneously? I'm not sure how I should get around this?
... View more
07-09-2015
12:39 PM
|
1
|
2
|
1218
|
|
POST
|
Hi Robert, thanks for quick reply. I added map.resize() and map.reposition() but it seems to be having a strange effect. About half of the space vacated by rightPanel now gets filled, but not all of it? Updated jsfiddle
... View more
07-09-2015
12:11 PM
|
0
|
0
|
1218
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-09-2016 10:46 AM | |
| 1 | 01-21-2016 10:04 AM | |
| 1 | 06-23-2015 10:58 AM | |
| 1 | 01-19-2016 11:19 AM | |
| 1 | 08-10-2016 02:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|