aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-07-31 19:30:21 -0300
committerSilvio <silvio@socioambiental.org>2013-07-31 19:30:21 -0300
commit37f64f4025f65e6d91c3ee76a6483fa83aca4efe (patch)
treed3d2606856a7acad975c9d4f730b36cb253b2818
parent381032612f44fbdf3b70649eb01d5de41d919328 (diff)
downloadgmap_arcgis_js-37f64f4025f65e6d91c3ee76a6483fa83aca4efe.tar.gz
gmap_arcgis_js-37f64f4025f65e6d91c3ee76a6483fa83aca4efe.tar.bz2
Implementing block/unblock with a list of block requests
-rw-r--r--gmap_arcgis.js59
1 files changed, 44 insertions, 15 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 11be1c5..315fa08 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -24,6 +24,7 @@ function gmapArcgis(config) {
}
}
+ // TODO: needs debug and fixing
// Return a Gmap ArcGIS object
return {
// Storable properties
@@ -31,17 +32,43 @@ function gmapArcgis(config) {
map: (config.map != undefined) ? config.map : null,
// UI unblocker wrapper
- unblockUI: function() {
- jQuery.unblockUI();
+ unblockUI: function(name) {
+ if (window.blockUI == undefined) {
+ window.blockUI = [ ];
+ }
+
+ if (name == undefined) {
+ name = 'default';
+ }
+
+ if (window.blockUI[name] != undefined && window.blockUI[name] == true) {
+ var index = window.blockUI.indexOf(name);
+ window.blockUI = window.blockUI.splice(index, 1);
+ }
+
+ if (window.blockUI.length == 0) {
+ jQuery.unblockUI();
+ }
},
// UI blocker wrapper
blockUI: function(params) {
- jQuery.blockUI(params);
+ if (window.blockUI == undefined) {
+ window.blockUI = [ ];
+ }
+
+ if (params.name == undefined) {
+ params.name = 'default';
+ }
+
+ if (window.blockUI[params.name] == undefined || window.blockUI[params.name] != true) {
+ window.blockUI[params.name] = true;
+ jQuery.blockUI(params);
+ }
},
// Block the UI and show an overlay
- showOverlay: function(t) {
+ showOverlay: function(name, timeout) {
if (this.config.disableOverlay != undefined && this.config.disableOverlay == true) {
return;
}
@@ -57,14 +84,13 @@ function gmapArcgis(config) {
}
var params = {
+ name: name,
message: message,
css: css,
- onUnblock: this.unBlockUI,
- ignoreIfBlocked: true,
};
- if (t != false) {
- params.timeout = t;
+ if (timeout != false) {
+ params.timeout = timeout;
}
this.blockUI(params);
@@ -77,7 +103,7 @@ function gmapArcgis(config) {
this.showOverlay(this.config[section][element].overlayTime);
}
else if (this.config[section][element].overlayTime != false) {
- this.showOverlay();
+ this.showOverlay(section + '_' + element);
}
},
@@ -128,12 +154,14 @@ function gmapArcgis(config) {
if (params.callback == undefined) {
// Default callback: remove the blockUI once the layer is shown
google.maps.event.addListener(params.overlay, 'drawend', function() {
+ // TODO
self.unblockUI();
});
}
else {
google.maps.event.addListener(params.overlay, 'drawend', function() {
params.callback(this.map, params);
+ // TODO
self.unblockUI();
});
}
@@ -210,7 +238,7 @@ function gmapArcgis(config) {
this.config['kmls'][element].overlay.setMap(this.map);
this.config['kmls'][element].isVisible = true;
- this.unblockUI();
+ this.unblockUI('kmls_' + element);
},
// Add a KML layer into the map
@@ -243,7 +271,7 @@ function gmapArcgis(config) {
}
}
- this.unblockUI();
+ this.unblockUI('layers_' + element);
return;
}
@@ -258,7 +286,7 @@ function gmapArcgis(config) {
if (typeof this.config['sliders'][slider].overlays[layer] != 'undefined') {
this.config['sliders'][slider].overlays[layer].setOpacity(this.config['sliders'][slider].opacity);
- this.unblockUI();
+ this.unblockUI('sliders_' + slider);
}
this.showOverlayIf('sliders', slider);
@@ -342,7 +370,7 @@ function gmapArcgis(config) {
self.config['markers'][element].overlay[i].addListener();
}
- self.unblockUI();
+ self.unblockUI('markers_' + element);
}
},
@@ -576,6 +604,7 @@ function gmapArcgis(config) {
self.setCenter(center, true);
}
+ // TODO
self.unblockUI();
return params.overlay;
});
@@ -619,7 +648,7 @@ function gmapArcgis(config) {
addPanoramio: function() {
if (this.config.panoramio.panoramioLayer == undefined) {
var self = this;
- this.showOverlay();
+ this.showOverlay('panoramio');
var photoDiv = document.createElement('div');
var photoWidgetOptions = this.config.panoramio.photoWidgetOptions;
@@ -663,7 +692,7 @@ function gmapArcgis(config) {
}
}
- this.unblockUI();
+ this.unblockUI('panoramio');
},
// Set the current map center, optionally updating the map