[fusion-commits] r2046 - sandbox/jxlib-3.0/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Jan 28 14:13:58 EST 2010
Author: madair
Date: 2010-01-28 14:13:58 -0500 (Thu, 28 Jan 2010)
New Revision: 2046
Modified:
sandbox/jxlib-3.0/widgets/MapMenu.js
Log:
add platform support for MapServer to the MapMenu
Modified: sandbox/jxlib-3.0/widgets/MapMenu.js
===================================================================
--- sandbox/jxlib-3.0/widgets/MapMenu.js 2010-01-28 19:13:21 UTC (rev 2045)
+++ sandbox/jxlib-3.0/widgets/MapMenu.js 2010-01-28 19:13:58 UTC (rev 2046)
@@ -80,9 +80,70 @@
var params = {parameters: {'folder': this.rootFolder},
onComplete: OpenLayers.Function.bind(this.processMapMenu, this)};
Fusion.ajaxRequest(s, params);
+ } 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 options = {
+ parameters: {
+ request: 'listresources',
+ depth: -1,
+ resourceType: 'map',
+ folder: this.rootFolder
+ },
+ method: 'GET',
+ onComplete: OpenLayers.Function.bind(this.processMSMapMenu, this)
+ };
+ var temp = new OpenLayers.Ajax.Request( s, options);
};
},
-
+
+ processMSMapMenu: function(r) {
+ 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"}]}}';
+ //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 folders = mapId.split('/');
+ var label = folders.pop();
+ var path = folders.join('/');
+
+ // 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,
+ 'singleTile':true,
+ 'type': this.arch,
+ 'extension':{'ResourceId': [label]}
+ }]};
+ //set up needed accessor
+ data.getInitialView = function() {
+ return this.initialView;
+ };
+ var menuItem = new Jx.Menu.Item({
+ label: label,
+ onClick: OpenLayers.Function.bind(this.switchMap, this, data)
+ });
+
+ if (path == '') {
+ this.uiObj.add(menuItem);
+ }else {
+ this.menus[path].add(menuItem);
+ }
+ }
+ }
+ }
+ },
+
processMapMenu: function(r) {
if (r.status == 200) {
var o;
More information about the fusion-commits
mailing list