[Mapbender-commits] r6390 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jun 22 10:18:36 EDT 2010


Author: christoph
Date: 2010-06-22 14:18:35 +0000 (Tue, 22 Jun 2010)
New Revision: 6390

Modified:
   trunk/mapbender/lib/wizard.js
Log:


Modified: trunk/mapbender/lib/wizard.js
===================================================================
--- trunk/mapbender/lib/wizard.js	2010-06-22 14:00:26 UTC (rev 6389)
+++ trunk/mapbender/lib/wizard.js	2010-06-22 14:18:35 UTC (rev 6390)
@@ -4,21 +4,6 @@
  */
 $.fn.wizard = function (options) {
 	return this.each(function () {
-
-		var wizardInstance = this;
-		var $wiz = $(wizardInstance);
-		$wiz.data("isWizard", true);
-
-		var o = $.extend({
-			fade: false,
-			onClickLink: function () {
-				return true;
-			},
-			onBeforeClickLink: function () {
-				return true;
-			}
-		}, options || {});
-		
 		var getPath = function ($t) {
 			var m = $t.metadata({
 				type: "attr",
@@ -46,14 +31,12 @@
 		var clickHandler = function (e, $t) {
 			getPath($t);
 			navigate($t);
-			e.preventDefault();
+			if (e !== null) {
+				e.preventDefault();
+			}
 		};
 	
-		if (o.startWith) {
-			getPath(o.startWith);
-		}
-
-		$("a.wizard").live("click", function (e) {
+		var to = function (e) {
 			var href = $(this).attr("href");
 			var $target = $(href);
 			var found = false;
@@ -86,6 +69,38 @@
 			
 			new Mapbender.Warning("Clicked link " + href + " in wizard " + wizardInstance.id);
 			clickHandler(e, $target);
+		};
+
+		if (typeof options === "string") {
+			if (!$(this).data("isWizard")) {
+				return;
+			}
+			if (options === "to" && arguments.length === 2) {
+				to.apply(this, null);
+			}
+			return;
+		}
+
+		var wizardInstance = this;
+		var $wiz = $(wizardInstance);
+		$wiz.data("isWizard", true);
+
+		var o = $.extend({
+			fade: false,
+			onClickLink: function () {
+				return true;
+			},
+			onBeforeClickLink: function () {
+				return true;
+			}
+		}, options || {});
+		
+		if (o.startWith) {
+			getPath(o.startWith);
+		}
+
+		$("a.wizard").live("click", function (e) {
+			to.apply(this, [e]);
 		});
 	});
 };
\ No newline at end of file



More information about the Mapbender_commits mailing list