[fusion-commits] r2049 - sandbox/jxlib-3.0/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Feb 1 14:56:38 EST 2010
Author: madair
Date: 2010-02-01 14:56:37 -0500 (Mon, 01 Feb 2010)
New Revision: 2049
Modified:
sandbox/jxlib-3.0/widgets/MapMenu.js
Log:
adjust MapMenu to use new listpublishedmaps platform API
Modified: sandbox/jxlib-3.0/widgets/MapMenu.js
===================================================================
--- sandbox/jxlib-3.0/widgets/MapMenu.js 2010-02-01 02:21:35 UTC (rev 2048)
+++ sandbox/jxlib-3.0/widgets/MapMenu.js 2010-02-01 19:56:37 UTC (rev 2049)
@@ -83,12 +83,11 @@
} else if (this.arch == 'MapServer' && json.Folder) {
this.rootFolder = json.Folder ? json.Folder[0] : '/';
//var s = 'layers/' + this.arch + '/' + Fusion.getScriptLanguage() + '/MapMenu.' + Fusion.getScriptLanguage();
- var s = '/platform/api/mapsherpa.php';
+ var s = json.ListURL ? json.ListURL[0] : '/platform/api/mapsherpa.php';
var options = {
parameters: {
- request: 'listresources',
+ request: 'listpublishedmaps',
depth: -1,
- resourceType: 'map',
folder: this.rootFolder
},
method: 'GET',
@@ -102,28 +101,27 @@
if (r.status == 200) {
var o;
eval("o="+r.responseText);
- //var testData = '{"success":true,"errorMessages":[],"values":{"resources":[{"sResourceId":"/topLevel","sType":"Map"},{"sResourceId":"/Premium","sType":"Folder"},{"sResourceId":"/Premium/San Francisco","sType":"Map"},{"sResourceId":"/Premium/secondo","sType":"Folder"},{"sResourceId":"/Premium/secondo/deep","sType":"Map"}]}}';
+ //var testData = '{"success":true,"errorMessages":[],"values":[{"sPath":"/Users/zak/Sites/Documents/platform/trunk/data/home/root/Published SF.map","sResourceId":"/Premium2/Published SF","sMapResource":"/Premium2/level2/San Francisco"},{"sPath":"/Users/zak/Sites/Documents/platform/trunk/data/home/root/output.map","sResourceId":"/Premium2/output","sMapResource":"/Premium2/San Francisco"},{"sPath":"/Users/zak/Sites/Documents/platform/trunk/data/home/root/CanadaPub.map","sResourceId":"/Canada/CanadaPub","sMapResource":"/Canada/Canada"},{"sPath":"/Users/zak/Sites/Documents/platform/trunk/data/home/root/Pau.map","sResourceId":"/gmap2/publishedmap","sMapResource":"/gmap2/gmap2"}],"request":"listpublishedmaps","version":1}';
//eval("o="+testData);
this.menus = {};
- var list = o.values.resources;
- for (var i=0; i<list.length; i++) {
- var resource = list[i];
- var mapId = resource.sResourceId;
- mapId = mapId.replace(this.rootFolder, '');
- if (resource.sType == "Folder") {
- this.createFolders(mapId);
- } else {
+ var list = o.values;
+ if (o.values) {
+ for (var i=0; i<list.length; i++) {
+ var resource = list[i];
+ var mapId = resource.sMapResource;
+ mapId = mapId.replace(this.rootFolder, '');
var folders = mapId.split('/');
var label = folders.pop();
var path = folders.join('/');
-
+ this.createFolders(path);
+
// check for mapgroup data and if there is none,
// create a maptag that will be passed to the map
// widget constructor
- data = {maps:[{'resourceId': label,
+ data = {maps:[{'resourceId': resource.sResourceId,
'singleTile':true,
'type': this.arch,
- 'extension':{'ResourceId': [label]}
+ 'extension':{'MapFile': [resource.sPath]}
}]};
//set up needed accessor
data.getInitialView = function() {
@@ -139,7 +137,7 @@
}else {
this.menus[path].add(menuItem);
}
- }
+ }
}
}
},
More information about the fusion-commits
mailing list