[Mapbender-commits] r4918 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Nov 4 09:47:48 EST 2009


Author: christoph
Date: 2009-11-04 09:47:48 -0500 (Wed, 04 Nov 2009)
New Revision: 4918

Modified:
   trunk/mapbender/http/javascripts/mod_loadwmc.js
Log:


Modified: trunk/mapbender/http/javascripts/mod_loadwmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.js	2009-11-04 14:47:24 UTC (rev 4917)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.js	2009-11-04 14:47:48 UTC (rev 4918)
@@ -37,8 +37,13 @@
  */
 function mod_loadwmc(){
 
-	var initialHtml = "<div id='" + options.id + "_wmclist' >" +
-					"<table id='" + options.id + "_wmclist_table' style='margin:10px 10px 10px 10px' border='1' rules='rows'>" +
+	var initialHtml = "<div id='" + options.id + "_tabs'>" + 
+				"<ul>" + 
+					"<li><a href='#" + options.id + "_wmclist'>List</a></li>" + 
+					"<li><a href='#" + options.id + "_wmcUpload'>Upload</a></li>" + 
+				"</ul>" + 
+				"<div id='" + options.id + "_wmclist' >" +
+					"<table width='100%' id='" + options.id + "_wmclist_table'>" +
 						"<thead><tr>" +
 							"<th>WMC name</td>" +
 							"<th>last update</td>" +
@@ -50,7 +55,10 @@
 							"<th>delete</td>" +
 						"</thead></tr>" +
 					"</table>" +
-				"</div>";
+				"</div>" +
+				"<div id='" + options.id + "_wmcUpload' >" +
+				"</div>" +
+			"</div>";
 
 	// creates a new pop up (if it doesn't already exist)
 	// the pop up allows you to load, append, merge, 
@@ -58,9 +66,9 @@
 	if (wmcPopup === null) {
 		wmcPopup = new mb_popup({
 			title:options.currentTitle,
-			width:700,
+			width:750,
 			height:500,
-			top:100,
+			top:50,
 			left:100,
 			html:initialHtml
 		});
@@ -70,7 +78,6 @@
 	if (!wmcPopup.isVisible()) {
 		wmcPopup.setHtml(initialHtml);
 		wmcPopup.show();
-		
 	}
 /*
 	$(initialHtml).appendTo("body");
@@ -212,26 +219,35 @@
 			$tr.append($openLayersTd);	
 
 			// delete WMC
-			var $deleteTd = appendTableCell({
-				src: "../img/button_gray/del.png",
-				title: "delete this WMC",
-				method: "deleteWmc",
-				callback: executeJavaScript,
-				parameters:{
-					id:currentId
-				}
-			});
-			$tr.append($deleteTd);	
+			(function () {
+				var $deleteTd = appendTableCell({
+					src: "../img/button_gray/del.png",
+					title: "delete this WMC",
+					method: "deleteWmc",
+					callback: function (args) {
+						executeJavaScript(args);
+						var aPos = wmcTable.fnGetPosition($deleteTd.get(0));
+						wmcTable.fnDeleteRow(aPos[0]);
+					},
+					parameters:{
+						id:currentId
+					}
+				});
+				$tr.append($deleteTd);	
+			})();
 		}());
 	}
 
+	$("#" + options.id + "_tabs").tabs();
+	
+	$("#" + options.id + "_wmcUpload").upload({
+		callback: function (filename, success, message) {
+			prompt((success ? "Success." : "Failed!") + " " + message, filename);
+		}
+	});
 	wmcTable = $("#" + options.id + "_wmclist_table").dataTable({
 		"bPaginate": true,
-		"bLengthChange": false,
-		"bFilter": false,
-		"bSort": false,
-		"bInfo": false,
-		"bAutoWidth": false
+		"bJQueryUI": true
 	});
 
 }
@@ -277,8 +293,7 @@
 }
 
 function appendTableCell (args) {
-	var $img = $("<img src='" + args.src + "' style='cursor:pointer' " + 
-		"class='ui-icon' title='" + args.title + "'>");
+	var $img = $("<img src='" + args.src + "' style='cursor:pointer' title='" + args.title + "'>");
 	$img.click(function() {
 		args.callback(args);
 	});



More information about the Mapbender_commits mailing list