[Mapbender-commits] r4353 - branches/kmq_dev/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 14 10:47:53 EDT 2009


Author: kmq
Date: 2009-07-14 10:47:53 -0400 (Tue, 14 Jul 2009)
New Revision: 4353

Modified:
   branches/kmq_dev/http/javascripts/ConfEditor.js
   branches/kmq_dev/http/javascripts/ConfObject.js
   branches/kmq_dev/http/javascripts/mod_user.js
   branches/kmq_dev/http/javascripts/user.php
Log:
Added functionality to delete users

Modified: branches/kmq_dev/http/javascripts/ConfEditor.js
===================================================================
--- branches/kmq_dev/http/javascripts/ConfEditor.js	2009-07-14 12:59:05 UTC (rev 4352)
+++ branches/kmq_dev/http/javascripts/ConfEditor.js	2009-07-14 14:47:53 UTC (rev 4353)
@@ -77,8 +77,8 @@
 // refresh configObeject data from server
 
 ConfObjectEditor.prototype.refresh = function() {
-  this.confObject.load();
-  this.list.load();
+  if(this.confObject) { this.confObject.load();} 
+  if(this.list) {  this.list.load(); }
 };
 
 /*
@@ -96,7 +96,7 @@
 // request configObject to delete itself
 ConfObjectEditor.prototype.remove = function(){
   //TODO: ask server to delete the ressource
-  this.configObject.remove();
+  this.confObject.remove();
   // and then, if successfull
   this.clear();
 };

Modified: branches/kmq_dev/http/javascripts/ConfObject.js
===================================================================
--- branches/kmq_dev/http/javascripts/ConfObject.js	2009-07-14 12:59:05 UTC (rev 4352)
+++ branches/kmq_dev/http/javascripts/ConfObject.js	2009-07-14 14:47:53 UTC (rev 4353)
@@ -37,40 +37,23 @@
 
 // send local changes to server
 ConfObject.prototype.update = function(){
-  var me = this;
-  var req  = new Mapbender.Ajax.Request({
-    method: "update",
-    url: "http://mapbender/javascripts/user.php",
-    parameters: { "userinfo": {
-                  "name": me.name,
-                  "password": me.password,
-                  "description": me.description,
-                  "owner": me.owner,
-                  "loginCount": me.loginCount,
-                  "email": me.email,
-                  "phone": me.phone,
-                  "dept": me.dept}
-    },
-    callback: function(){  me.editor.refresh(); }
-
-    
-  });
-  req.send();
-
-
-
-
-
-
+alert("implement me");
 };
 
-
 // ask the server to remove the object,and delete self
 // maybe not delete(me), but something like that
 ConfObject.prototype.remove = function(){
-  //TODO: ask server to redlete the ressource
-  // and then, if successfull
-  me.clear();
+  var me = this;
+  var req = new Mapbender.Ajax.Request({
+    url : "http://mapbender/javascripts/user.php",
+    method: "remove",
+    parameters: { name: me.name },
+    callback: function() {
+      me.editor.clear();
+      me.editor.refresh();
+      }
+  });
+  req.send();
 };
 
 ConfObject.prototype.setEditor = function(newEditor) {

Modified: branches/kmq_dev/http/javascripts/mod_user.js
===================================================================
--- branches/kmq_dev/http/javascripts/mod_user.js	2009-07-14 12:59:05 UTC (rev 4352)
+++ branches/kmq_dev/http/javascripts/mod_user.js	2009-07-14 14:47:53 UTC (rev 4353)
@@ -58,8 +58,30 @@
       
    return true;
 };
+        
+ConfUser.prototype.update = function(){
+  var me = this;
+  var req  = new Mapbender.Ajax.Request({
+    method: "update",
+    url: "http://mapbender/javascripts/user.php",
+    parameters: { "userinfo": {
+                  "name": me.name,
+                  "password": me.password,
+                  "description": me.description,
+                  "owner": me.owner,
+                  "loginCount": me.loginCount,
+                  "email": me.email,
+                  "phone": me.phone,
+                  "dept": me.dept}
+    }, 
+    callback: function(){  me.editor.refresh(); }
+    });
+  req.send();
+};
 
 
+
+
 /* MODULE */
 //load html elements into me
 var data = $('\n\
@@ -82,6 +104,7 @@
 </ul>\n\
 <p>\n\
 <input id="'+options.id +'_Save" type="button" value="save" onclick="Mapbender.modules[\''+ options.id  +'\'].save(); return false;" />\n\
+<input id="'+options.id +'_Delete" type="button" value="delete" onclick="Mapbender.modules[\''+ options.id  +'\'].remove(); return false;" />\n\
 </p>\n\
 </form>\n\
 </div>');
@@ -108,8 +131,7 @@
     var phoneEl =$("#"+options.id+'_Phone').val(this.confObject.phone);
     var deptEl = $("#"+options.id+'_Department').val(this.confObject.dept);
   
-    alert("dear jquery how do I disable a button?");
-    var saveButton = $(options.id + "_Save").enabled("");
+    //FIXME: alert("dear jquery how do I disable a button?");
   };
 
   UserEditor.prototype.update = function() {

Modified: branches/kmq_dev/http/javascripts/user.php
===================================================================
--- branches/kmq_dev/http/javascripts/user.php	2009-07-14 12:59:05 UTC (rev 4352)
+++ branches/kmq_dev/http/javascripts/user.php	2009-07-14 14:47:53 UTC (rev 4353)
@@ -68,7 +68,7 @@
 		}
 		break;
 
-	case 'delete':
+	case 'remove':
         $name = $ajaxResponse->getParameter('name');
         $user = User::ByName($name);
         if($user == null)



More information about the Mapbender_commits mailing list