[Mapbender-commits] r4466 - in branches/kmq_dev: core http/classes http/css http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 3 11:39:51 EDT 2009


Author: kmq
Date: 2009-08-03 11:39:50 -0400 (Mon, 03 Aug 2009)
New Revision: 4466

Added:
   branches/kmq_dev/http/css/mod_AdminTabs.css
   branches/kmq_dev/http/javascripts/gui.php
   branches/kmq_dev/http/javascripts/mod_gui.js
Removed:
   branches/kmq_dev/http/javascripts/mod_gui.php
   branches/kmq_dev/http/javascripts/mod_user.php
Modified:
   branches/kmq_dev/core/system.php
   branches/kmq_dev/http/classes/class_RPCEndpoint.php
   branches/kmq_dev/http/classes/class_group.php
   branches/kmq_dev/http/classes/class_gui.php
   branches/kmq_dev/http/classes/class_user.php
   branches/kmq_dev/http/css/gsoc09.css
   branches/kmq_dev/http/javascripts/ConfEditor.js
   branches/kmq_dev/http/javascripts/ConfObject.js
   branches/kmq_dev/http/javascripts/group.php
   branches/kmq_dev/http/javascripts/map.php
   branches/kmq_dev/http/javascripts/mod_AdminTabs.js
   branches/kmq_dev/http/javascripts/mod_group.js
   branches/kmq_dev/http/javascripts/mod_user.js
   branches/kmq_dev/http/javascripts/user.php
Log:
working user, group and gui editor

Modified: branches/kmq_dev/core/system.php
===================================================================
--- branches/kmq_dev/core/system.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/core/system.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -41,5 +41,5 @@
 	"zoomOut1,selArea1,pan1,copyright,dependentDiv,dragMapSize," .
 	"dynamicOverview,FeatureInfoRedirect,highlightPOI,navFrame,sandclock," .
 	"scaleBar,scaleSelect,setBBOX,setPOI2Scale,reload,overview,addWMS," . 
-	"repaint,changeEPSG"
+	"repaint,changeEPSG,User,AdminTabs,GroupEditor,GuiEditor,UserEditor"
 );

Modified: branches/kmq_dev/http/classes/class_RPCEndpoint.php
===================================================================
--- branches/kmq_dev/http/classes/class_RPCEndpoint.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/classes/class_RPCEndpoint.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -1,7 +1,5 @@
 <?php
 
-require_once(dirname(__FILE__)."/../classes/class_user.php");
-
 interface RPCObject{
 
   public function create();
@@ -35,13 +33,15 @@
   public function RPCObjectByName($name){
 
     switch($this->ObjectConf['ClassName']){
-
       case 'User':
         return User::byName($name);
 
       case 'Group':
         return Group::byName($name);
       
+      case 'gui':
+        return gui::byName($name);
+      
       default:
         // or throw exception ?
         return null;
@@ -59,6 +59,9 @@
       case 'Group':
         return Group::getList("");
 
+      case 'gui':
+        return gui::getList("");
+
       default:
         return null;
     }
@@ -85,9 +88,9 @@
           
         break;
 
-      case 'delete':
+      case 'remove':
         try{
-          $this->rpc_delete($this->ajaxResponse->getParameter('name'));
+          $this->rpc_remove($this->ajaxResponse->getParameter('name'));
         }catch(Exception $E){
           $this->ajaxResponse->setMessage("Delete failed. Error: " . $E);
         }
@@ -120,7 +123,28 @@
   }
 
   public function rpc_create($fields){
-    $instance = new $this->Object(null);
+    // test if an obect of that name already exists
+    $instance = $this->RPCObjectByName($fields->name);
+    if($instance){
+
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Already Exists "). $this->ObjectConf['internalName'] . "  Error: " . $E);
+      return;
+    }
+
+    // create an empty one
+    $instance = $this->RPCObjectByName(null);
+    $instance->name = $fields->name;
+    
+    try{
+        $instance->create();
+    }
+    catch(Exception $E)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Could not create instance "). $this->ObjectConf['internalName'] . " Error: ". $E );
+    }
+    
     try {
         $instance->change($fields);
     }
@@ -130,15 +154,15 @@
       $this->ajaxResponse->setMessage(_mb("Could not create "). $this->ObjectConf['internalName'] . "  Error: " . $E);
     }
     
+  
     try{
-        $instance->create();
+        $instance->commit();
     }
     catch(Exception $E)
     {
       $this->ajaxResponse->setSuccess(false);
-      $this->ajaxResponse->setMessage(_mb("Could not create instance "). $this->ObjectConf['internalName'] . " Error: ". $E );
+      $this->ajaxResponse->setMessage(_mb("Could not change "). $this->ObjectConf['internalName'] . " Error: " . $E);
     }
-  
   }
 
   public function rpc_update($name,$fields){
@@ -146,7 +170,8 @@
     if($instance == null)
     {
       $this->ajaxResponse->setSuccess(false);
-      $this->ajaxResponse->setMessage(_mb($this->ObjectConf['internalName'] . _mb(" does not exist: ". $name)));
+      $this->ajaxResponse->setMessage($this->ObjectConf['internalName'] . _mb(" does not exist: ". $name));
+      return;
     }
     try{
         $instance->change($fields);
@@ -165,10 +190,12 @@
       $this->ajaxResponse->setSuccess(false);
       $this->ajaxResponse->setMessage(_mb("Could not change "). $this->ObjectConf['internalName'] . " Error: " . $E);
     }
+    $this->ajaxResponse->setResult('name',$instance->name);
 
   }
 
-  public function rpc_delete($name){
+
+  public function rpc_remove($name){
     $instance = $this->RPCObjectByName($name);
     if($instance == null)
     {
@@ -182,7 +209,7 @@
     catch(Exception $E)
     {
       $this->ajaxResponse->setSuccess(false);
-      $this->ajaxResponse->setMessage(_mb("Could not delete "). $this->ObjectConf['internalName'] . " Error: ". $E);
+      $this->ajaxResponse->setMessage(_mb("Could not remove "). $this->ObjectConf['internalName'] . " Error: ". $E);
     }
 
   }
@@ -193,8 +220,8 @@
     {
       $this->ajaxResponse->setSuccess(true);
       $this->ajaxResponse->setMessage(_mb("No such ". $this->ObjectConf['internalName'] .": $name"));
-      $this->ajaxResponse->setResult("error",true);
-      break;
+      $this->ajaxResponse->setResult("data",array("error"=>true ));
+      return;
     }
   try{
     $instance->load();
@@ -226,8 +253,8 @@
       $result[] = array("name" =>  $instance->name, "value" => $instance->name);
     }
     $this->ajaxResponse->setResult("list",$result);
-    $this->ajaxResponse->setResult("type", array("display" => $this->ObjectConf['displayName'], 
-                                           "internal" => $this->ObjectConf['internalName']));
+    $this->ajaxResponse->setResult("type", array("display" => $this->ObjectConf['DisplayName'], 
+                                           "internal" => $this->ObjectConf['InternalName']));
 
   }
 

Modified: branches/kmq_dev/http/classes/class_group.php
===================================================================
--- branches/kmq_dev/http/classes/class_group.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/classes/class_group.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -37,13 +37,18 @@
 	
 	/**
 	 * Constructor
-	 * @param $groupId Integer 	the ID of the group that is represented by 
-	 * 							this object.
+	 * @param groupId Integer 	the ID of the group that is represented by 
+	 * 							this object. If null, create an empty object
 	 */
 	public function __construct ($groupId) {
-		$this->id = $groupId;
+		
+        if($groupId == null){
+          // new group
+          return;
+        }
+        $this->id = $groupId;
 		try{
-			if($groupId) {$this->load();}
+			$this->load();
 		}
 		catch(Exception $E)
 		{	
@@ -60,28 +65,17 @@
 		return (string) $this->id;	
 	}
 
-	/*
-	* @return JSON serialization of this group
-	*/
-    //This is useless, the Ajaxode does this for me
-	public function toJSON() {
-			
-		$result = '{"name":"'. 				$this->name .'",'
-							.'"owner":"'. 			$this->owner .'",'
-							.'"description":"'. 			$this->description .'"}';
 
-		return $result;
-	}
-
     /*
     * @return Assoc Array containing the fields to send to the user
     */
     public function getFields() {
-      return array(
+      $result = array(
         "name" => $this->name,
         "owner" => $this->owner,
         "description" => $this->description
       );
+      return $result;
     }
 
 	public function  create() {
@@ -130,11 +124,11 @@
 	*	@param	$changes JSON  keys and their values of what to change in the object
 	*/
 	public function change($changes) {
-
+        //FIXME: validate input
 		$this->name = $changes->name ? $changes->name : $this->name;
 		$this->owner = $changes->owner ? $changes->owner : $this->owner;
 		$this->description = $changes->description ? $changes->description : $this->description;
-		$this->id = $changes->id ? $changes->id : $this->id;
+		$this->id = $changes->id ? $changes->id->value : $this->id;
 
         return true;
 	}
@@ -144,8 +138,8 @@
 		$sql_update = "UPDATE mb_group SET ".
 			"mb_group_name = $1, ".
 			"mb_group_owner = $2, ".
-			"mb_group_description = $3, ".
-			"WHERE mb_group_id = $17;";
+			"mb_group_description = $3 ".
+			"WHERE mb_group_id = $4;";
 
 
 			$v = array($this->name,
@@ -190,24 +184,24 @@
 			$this->description	= $row['mb_group_description'];
 
 		}else{
-			 throw new Exception("no such group");
+			 throw new Exception("no such Group");
 		}
 		return true;
 	}
 
     /*
-    * @return Array of groups
+    * @return Array of Groups
     * @param $filter UNUSED! string that must be contained in the username
     */
     public static function getList($filter) {
-      $users = Array();
+      $groups = Array();
       $sql_grouplist = "SELECT mb_group_id FROM mb_group";
       $res_groups = db_query($sql_grouplist);
 
       while($row = db_fetch_array($res_groups))
       {
         try{
-          $users[] = new Group($row['mb_group_id']);
+          $groups[] = new Group($row['mb_group_id']);
         }
         catch(Exception $E)
         {
@@ -215,7 +209,7 @@
           //FIXME: should catch some errors here
         }
       }
-      return $users;
+      return $groups;
       
     }
 
@@ -226,6 +220,9 @@
     */
 
     public static function byName($name) {
+    
+      if($name == null) { return new Group(null); }
+
       $sql_group = "SELECT mb_group_id FROM mb_group WHERE mb_group_name = '$name'";
       $res_group = db_query($sql_group);
       if($row = db_fetch_array($res_group))

Modified: branches/kmq_dev/http/classes/class_gui.php
===================================================================
--- branches/kmq_dev/http/classes/class_gui.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/classes/class_gui.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -19,26 +19,203 @@
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_element.php");
+require_once(dirname(__FILE__)."/../classes/class_RPCEndpoint.php");
 
 /**
  * GUI is a set of GUI elements and services. 
  */
-class gui {
+class gui implements RPCObject{
 
 	var $id;
+    var $name = "";
+    var $description = "";
+    var $public = 1;
 	var $elementArray = array();
+    
+    static $displayName = "Gui";
+    static $internalName = "gui";
 	
-	public function __construct () {
+	public function __construct ($guiId) {
+        $this->id = $guiId;
 		if (func_num_args() == 1) {
 			$id = func_get_arg(0);
 			if ($this->guiExists($id))	{
 				$this->id = $id;
 				$this->elementArray = $this->selectElements();
 			}
+            //FIXME: is this a good compromise between the two constructors?
+            try{
+              $this->load();
+            }
+            catch(Exception $E)
+            {
+              new mb_exception($E->getMessage()); 
+            }
 		}
 	}
+    
+    /*
+    * @return Assoc Array containing the fields to send to the user
+    */
+    public function getFields() {
+        $result = array(
+                            "name" => $this->name,
+							"description" => $this->description, 
+                            "public" => $this->public
 
+        );
+		return $result;
+	}
+
+	public function  create() {
+		if($this->name == ""){ $e = new Exception("Can't create user  without name");}
+	    
+        //NOTE: gui_id, is not autocrated in the database
+		$sql_gui_create = "INSERT INTO gui (gui_id,gui_name) VALUES ($1,$2);";
+		$v = array($this->name,$this->name);
+		$t = array("s","s");
 	
+		db_begin();
+		
+		$insert_result = db_prep_query($sql_gui_create,$v,$t);
+		if($insert_result == false)
+		{
+			db_rollback();
+			$e = new Exception("Could not insert new gui");
+		}
+
+		$id = db_insertid($insert_result,'gui','gui_id');
+		if($id != 0)
+		{
+			$this->id = $id;
+		}
+	
+		$commit_result = $this->commit();
+		if($commit_result == false)
+		{
+			try {
+				db_rollback();
+			}
+			catch(Exception $E)
+			{
+				$newE = new Exception("Could not set inital values of new gui");
+				throw $newE;
+			}
+		}
+
+
+		db_commit();
+
+
+	}
+
+    /*
+	*	@param	$changes JSON  keys and their values of what to change in the object
+	*/
+	public function change($changes) {
+        //FIXME: validate input
+		$this->name = $changes->name ? $changes->name : $this->name;
+		$this->description = $changes->description ? $changes->description : $this->description;
+		$this->id = $changes->id ? $changes->id : $this->id;
+		$this->public = $changes->public ? $changes->public : $this->public;
+
+        return true;
+	}
+	
+    public function commit() {
+
+		$sql_update = "UPDATE gui SET ".
+			"gui_name = $1, ".
+			"gui_description = $2, ".
+			"gui_public = $3 ".
+			"WHERE gui_id = $4;";
+
+
+			$v = array($this->name,
+									$this->description,
+									$this->public,
+									$this->id);
+
+			$t = array("s", "s", "i", "s");
+
+			$update_result = db_prep_query($sql_update,$v,$t);
+			if(!$update_result)
+			{
+				throw new Exception("Database error updating User");
+			}
+
+		return true;
+	}
+
+    public function remove(){
+      // this functions exists, in a sliglty differnt form, so we 
+      // can reuse it
+      $this->deleteGui($this->id);
+    }
+    
+	public function load() {
+		$sql_gui = "SELECT * FROM gui WHERE gui_id = $1; ";
+		$v = array($this->id);
+		$t = array("s");
+		$res_gui = db_prep_query($sql_gui,$v,$t);
+		if($row = db_fetch_array($res_gui)){
+
+			$this->name = $row['gui_name'];
+			$this->description	= $row['gui_description'];
+			$this->public = $row['gui_public'];
+
+		}else{
+			 throw new Exception("no such GUI");
+		}
+		return true;
+	}
+
+    /*
+    * @return Array of GUIs
+    * @param $filter UNUSED! string that must be contained in the guiname 
+    */
+    public static function getList($filter) {
+    //FIXME: optimize
+      $guis = Array();
+      $sql_guilist = "SELECT gui_id FROM gui ORDER BY gui_name";
+      $res_guis = db_query($sql_guilist);
+
+      while($row = db_fetch_array($res_guis))
+      {
+        try{
+          $guis[] = new gui($row['gui_id']);
+        }
+        catch(Exception $E)
+        {
+          //FIXME: should catch some errors here
+          throw($E);
+        }
+      }
+      return $guis;
+      
+    }
+
+    /*
+    * tries to initialize a guiobject by Name
+    * @return A gui Object
+    * @param $name the name of the gui to find
+    */
+
+    public static function byName($name) {
+    
+      if($name == null) { return new gui(null); }
+
+      $sql_gui = "SELECT gui_id FROM gui WHERE gui_name = '$name'";
+      $res_gui = db_query($sql_gui);
+      if($row = db_fetch_array($res_gui))
+      {
+        return  new gui($row['gui_id']);
+      }
+      return null;
+
+    }
+
+	
 	public function addWfs ($aWfs) {
 		$sql ="INSERT INTO gui_wfs (fkey_gui_id, fkey_wfs_id)";
 		$sql .= "VALUES ($1, $2);";

Modified: branches/kmq_dev/http/classes/class_user.php
===================================================================
--- branches/kmq_dev/http/classes/class_user.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/classes/class_user.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -18,20 +18,20 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/..//classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE__)."/../classes/class_RPCEndpoint.php");
 
 /**
  * A Mapbender user as described in the table mb_user.
  */
 class User implements RPCObject{
 	/**
-	 * @var Integer The user ID
+	 * @var Integer The User ID
 	 */
 	var $id;
-	var $name;
+	var $name = "";
 	// var $password = ""; // password is readonly, 
 	var $owner = 0;  
-	var $descr ="";
+	var $description ="";
 	var $loginCount;
 	var $email = "";
 	var $phone ="";
@@ -47,6 +47,8 @@
 	var $country ="";
 	var $url ="";
 
+    static $displayName = "User";
+    static $internalName = "user";
 	
 	/**
 	 * Constructor
@@ -54,9 +56,14 @@
 	 * 							this object.
 	 */
 	public function __construct ($userId) {
-		$this->id = $userId;
+		
+        if($userId == null){
+          // new user
+          return;
+        }
+        $this->id = $userId;
 		try{
-			if($userId) {$this->load();}
+			$this->load();
 		}
 		catch(Exception $E)
 		{	
@@ -73,43 +80,16 @@
 		return (string) $this->id;	
 	}
 
-	/*
-	* @return JSON serialization of this user
-	*/
 
-	public function toJSON() {
-			
-        $result = array(
-                            "name" => $this->name,
-							"password" =>  "*************",
-							"owner" => $this->owner, 
-							"description" => $this->descr, 
-							"loginCount" => $this->loginCount, 
-							"email" => $this->email, 
-							"phone" => $this->phone, 
-							"department" => $this->department, 
-							"resolution" => $this->resolution, 
-							"organization" => $this->organizatin, 
-							"position" => $this->position, 
-							"phone1" => $this->phone1,	
-							"fax" => $this->fax,	
-							"deliveryPoint" => $this->deliveryPoint,	
-							"city" => $this->city,	
-							"postalCode" => $this->postalCode,	
-							"country" => $this->country,	
-							"url" => $this->url	
-
-        );
-		return $result;
-	}
-	
+    /*
+    * @return Assoc Array containing the fields to send to the user
+    */
     public function getFields() {
-			
         $result = array(
                             "name" => $this->name,
 							"password" =>  "*************",
 							"owner" => $this->owner, 
-							"description" => $this->descr, 
+							"description" => $this->description, 
 							"loginCount" => $this->loginCount, 
 							"email" => $this->email, 
 							"phone" => $this->phone, 
@@ -130,17 +110,14 @@
 	}
 
 	public function  create() {
-		//FIXME: can users exist that have the same name? I think not, but the db does not enforce it
 		if($this->name == ""){ $e = new Exception("Can' t create user without name");}
 		
-		//$sql_user_create = "INSERT INTO mb_user (mb_user_name) VALUES ($1) ; ";
 		$sql_user_create = "INSERT INTO mb_user (mb_user_name) VALUES ('". $this->name ."');";
 		$v = array($this->name);
 		$t = array("s");
 	
 		db_begin();
 		
-		//$insert_result =  db_prep_query($sql_user_create,$v,$t);
 		$insert_result = db_query($sql_user_create);
 		if($insert_result == false)
 		{
@@ -201,7 +178,6 @@
 	}
 
 	public function commit() {
-    //FIXME: fail well
 
 		$sql_update = "UPDATE mb_user SET ".
 			"mb_user_name = $1, ".
@@ -246,7 +222,7 @@
 			$update_result = db_prep_query($sql_update,$v,$t);
 			if(!$update_result)
 			{
-				throw new Exception("Database error updating user");
+				throw new Exception("Database error updating User");
 			}
 
 		return true;
@@ -275,7 +251,7 @@
 
 			$this->name = $row['mb_user_name'];
 			$this->owner = $row['mb_user_owner'];
-			$this->descr	= $row['mb_user_description'];
+			$this->description	= $row['mb_user_description'];
 			$this->loginCount = $row['mb_user_login_count'];
 			$this->email = $row['mb_user_email'];
 			$this->phone = $row['mb_user_phone'];
@@ -292,8 +268,7 @@
 			$this->url = $row['mb_user_online_resource'];
 
 		}else{
-			//no such user
-			 throw new Exception("no such user");
+			 throw new Exception("no such User");
 		}
 		return true;
 	}
@@ -336,6 +311,9 @@
     */
 
     public static function byName($name) {
+    
+      if($name == null) { return new User(null); }
+
       $sql_user = "SELECT mb_user_id FROM mb_user WHERE mb_user_name = '$name'";
       $res_user = db_query($sql_user);
       if($row = db_fetch_array($res_user))

Modified: branches/kmq_dev/http/css/gsoc09.css
===================================================================
--- branches/kmq_dev/http/css/gsoc09.css	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/css/gsoc09.css	2009-08-03 15:39:50 UTC (rev 4466)
@@ -70,7 +70,7 @@
   width: 15em;
   margin-top: 0.5em;
   float: left;
-  position: absolute;
+  /*FIXME: position: absolute*/;
   top: 1em;
   left: 1em;
 
@@ -100,6 +100,7 @@
   padding-top: 1em;
   margin-top: 0.5em;
   min-height: 30em;
+  float:left;
 }
 
 div.formContainer ul
@@ -153,9 +154,9 @@
   border: none;
 }
 
-.UserEditor
+.ConfEditor
 {
-  position: absolute;
+  position: relative;
   top: 1em;
   width: 40em;
 

Added: branches/kmq_dev/http/css/mod_AdminTabs.css
===================================================================
--- branches/kmq_dev/http/css/mod_AdminTabs.css	                        (rev 0)
+++ branches/kmq_dev/http/css/mod_AdminTabs.css	2009-08-03 15:39:50 UTC (rev 4466)
@@ -0,0 +1,95 @@
+.mbFrame
+{
+  border: 1px solid black;
+}
+
+ul
+{
+  list-style-type: none;
+}
+
+
+/* left menu */
+
+.mbList
+{
+  padding-left: 1em;
+  padding-top: 1em;
+  margin-top: 2em;
+  width: 15em;
+  min-height: 20em;
+  float:left;
+}
+
+.mbList li
+{
+  cursor: pointer;
+}
+
+.mbList li.listCommand
+{
+  font-style: italic;
+}
+
+.mbList li#listFilter
+{
+  margin-bottom: 1em;
+}
+
+/* content area */
+
+div.formContainer
+{
+  margin-top: 2em;
+  min-height: 30em;
+  float:left;
+  width:50em;
+
+}
+
+div.formContainer ul
+{
+  margin-right: auto;
+}
+div.formContainer form ul li
+{
+  padding-top: 0.2em;
+  border-bottom: 1px dotted gray;
+  vertical-align: top;
+}
+
+div.formContainer form ul > li>label
+{
+  width: 11em;
+  display: block;
+
+}
+div.formContainer form ul > li>label:after
+{
+  content: ' : ';
+}
+
+div.formContainer form ul > li>select, div.formContainer form >ul>li>input
+{
+  width: 12em;
+}
+div.formContainer form ul > li>select
+{
+  border: none;
+  margin-top: 0px;
+  margin-bottom: auto;
+}
+
+div.formContainer form input[type=submit]
+{
+  margin-left: 26em;
+}
+
+
+
+
+input[type="checkbox"]
+{
+  border: none;
+}
+


Property changes on: branches/kmq_dev/http/css/mod_AdminTabs.css
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/kmq_dev/http/javascripts/ConfEditor.js
===================================================================
--- branches/kmq_dev/http/javascripts/ConfEditor.js	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/ConfEditor.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -2,19 +2,27 @@
 };
 
 ConfEditor.prototype.load = function(key){
-  var objectParams = {options: this.options, fields: this.fields, url: this.rpcEndpoint};
+  var objectParams = {options: this.options,
+                      fields: this.defaultFields,
+                      url: this.rpcEndpoint,
+                      name: key};
   this.confObject = new ConfObject(objectParams);
   this.confObject.setEditor(this);
+  
+  // if key is not specified the default values are used
+  // and the save method is set to be an alias for create
   if(!key)
   {
-    //FIXME: i18n
-    this.confObject.fields.name.value = this.confObject.fields.name.defaultValue;
-    this.clear();
+    for(field in this.confObject.fields)
+    {
+      this.confObject.fields[field].value = this.confObject.fields[field].defaultValue;
+    }
+    ConfEditor.prototype.save = ConfEditor.prototype.create;
     this.display();
-    //FIXME: set something that would make "save" redirect to "create"\n\
+    return;
   }
   
-  //TODO: do something nicer
+  //else we try to load the object by the specified key
   try{
     this.confObject.load(key);
   }catch(E){
@@ -37,9 +45,41 @@
   }
 };
 
-ConfEditor.prototype.save = function(){
-  if(this.confObject){
+ConfEditor.prototype.commit = function(){
 
+  if(this.confObject.name){
+  try{
+    
+    for(field in this.confObject.fields)
+    {
+      switch(this.confObject.fields[field].type)
+      {
+        case 'text':
+          try{
+            this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name ).val();
+          }catch(E){
+            alert("Error trying to set " +E);
+          }
+          break;
+
+        case 'bool':
+          var selector = '#' + this.options.id + this.confObject.fields[field].name + ':checked '
+          var el =  $(selector);
+          //FIXME: need the value of the checkbox
+          this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name ).is('checked');
+
+          break;
+      }
+    }
+    
+    
+    this.confObject.update();
+
+
+
+  }catch(E){
+    alert("ConfEditor: unable to Commit : ("+ E +")"); 
+  }
   }else{
     //TODO: notify user
     alert("cant save : no user loaded");
@@ -48,19 +88,25 @@
 
 ConfEditor.prototype.create = function(){
   //see comments in display 
-  for(var c = 0;c<this.fields.length;c++)
+  for(field in this.confObject.fields)
   {
     try{
-      this.fields[c].value = $('#' + options.id + this.fields[c].name);
+      this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name).val();
     }catch(E){
       alert("Error trying to read fieldvalue " +E);
     }
   }
-  this.confObject.fields = this.fields;
-  this.confObject.create();
+  try{
+    this.confObject.create();
+  }catch(E){
+    alert("ConfEditor: unable to Create: ("+ E +")");
+  }
   this.refresh();
+  ConfEditor.prototype.save = ConfEditor.prototype.commit;
 };
 
+ConfEditor.prototype.save = ConfEditor.prototype.commit;
+
 ConfEditor.prototype.refresh = function() {
   if(this.confObject){
     this.confObject.load(this.confObject.name);
@@ -70,27 +116,42 @@
 };
 
 ConfEditor.prototype.display = function(){
-  //form is a jQuery Object
+  
+  $('#' + this.options.id + 'nameheader').text(this.confObject.name);
+  
   //FIXME: this needs to differentiate between the different possible fieldtypes
   for(field in this.confObject.fields)
   {
-    try{
-      $('#' + this.options.id + this.confObject.fields[field].name).val(this.confObject.fields[field].value);
-    }catch(E){
-      alert("Error trying to set " +E);
+    switch(this.confObject.fields[field].type)
+    {
+      case 'text':
+        try{
+            $('#' + this.options.id + this.confObject.fields[field].name).val(this.confObject.fields[field].value);
+        }catch(E){
+          alert("Error trying to set " +E);
+        }
+        break;
+
+      case 'bool':
+        if(this.confObject.fields[field].value === true)
+        {
+          $('#' + this.options.id + this.confObject.fields[field].name).val(true);
+        }else{
+          $('#' + this.options.id + this.confObject.fields[field].name).val(false);
+
+        }
     }
   }
 };
 
 ConfEditor.prototype.reset = function(){
   //see comments in display();
-  var objectParams = {options: this.options, fields: this.fields, url: this.rpcEndpoint};
-  this.confObject = new ConfObject(objectParams);
-  this.confObject = this.ConfObject || new ConfObject(objectParams);
-  for(var c = 0;c<this.confObject.fields.length;c++)
+  var objectParams = {options: this.options, fields: this.defaultFields,  url: this.rpcEndpoint};
+  this.confObject = this.confObject || new ConfObject(objectParams);
+  for(field in this.confObject.fields)
   {
     try{
-      $('#' + this.options.id + this.confObject.fields[c].name).val(this.confObject.fields[c].defaultValue);
+      $('#' + this.options.id + this.confObject.fields[field].name).val(this.confObject.fields[field].defaultValue);
     }catch(E){
       alert("Error trying to set " +E);
     }

Modified: branches/kmq_dev/http/javascripts/ConfObject.js
===================================================================
--- branches/kmq_dev/http/javascripts/ConfObject.js	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/ConfObject.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -3,19 +3,20 @@
   this.options = params.options || null;
   this.fields = params.fields || {};
   this.url = params.url || "";
+  this.name = params.name || null;
 };
 
 ConfObject.prototype.load = function(key) {
   var me = this; 
-  var req = Mapbender.Ajax.Request({
+  var options = {
     url           :  me.url,
     method        : "load",
     parameters    : {
       name    : key
       },
-    callback: function(result,success,message){
+    callback:(function(result,success,message){
       if(result.data.error){
-        alert("Could not load ConfObject, server said: " + message);
+        throw("Could not load ConfObject, server said: " + message);
         return;
       }
       for(key in result.data)
@@ -23,21 +24,22 @@
         me.fields[key].value = result.data[key];
       }
       me.editor.display();
-    }
-});
+    })
+}
+  var req = Mapbender.Ajax.Request(options);
   req.send();
 };
 
 ConfObject.prototype.remove = function(){
   var me = this; 
   var req = Mapbender.Ajax.Request({
-    url           :  me.options.url,
+    url           :  me.url,
     method        : "remove",
     parameters    : {
-      name    : me.field.name
+      name    : me.name
       },
-    callback      : function(){
-      throw("remove needs a callback");
+    callback      : function(result,success,message){
+      me.editor.list.load();
     }
   });
   req.send();
@@ -45,36 +47,62 @@
 
 ConfObject.prototype.update = function(){
   var me = this;
-  var req =  Mapbender.Ajax.Request({
-    url           :  me.options.url,
+  var lightFields = {};
+  for(field in me.fields)
+  {
+    lightFields[field] = me.fields[field].value;
+  }
+  var options = {
+    url           :  me.url,
     method        : "update",
     parameters    : {
-      name    : me.fields.name,
-      fields  : me.fields
+      name    : me.name,
+      fields  : lightFields
       },
-    callback      : function(){
-      throw("update needs a callback");
-    }
-  });
+    callback      : function(result,success,message){
+      if(result.error){
+        alert("Could not load ConfObject, server said: " + message);
+        return;
+      }
+      me.name = result.name ||me.name;
+      me.editor.list.load();
+      me.editor.display();
+     }
+    };
+  var req =  Mapbender.Ajax.Request(options);
   req.send();
 };
 
 ConfObject.prototype.create = function(){
   var me = this;
-  var req = Mapbender.Ajax.Request({
-    url           :  me.options.url,
-    method        : "update",
+
+  var lightfields = {}
+  for(field in me.fields)
+  {
+    lightfields[field] = me.fields[field].value;
+  }
+
+  me.name = me.fields.name.value;
+  var options = {
+    url           :  me.url,
+    method        : "create",
     parameters    : {
-      name    : me.fields.name,
-      fields  : me.fields
+      name    : me.name,
+      fields  : lightfields
       },
-    callback      : function(){
-      throw("create needs a callback");
-    }
-  });
+    callback      : function(result,success,message){
+      me.editor.list.load();
+      if(result.error){
+        alert("Could not create ConfObject, server said: " + message);
+        return;
+      }
+     }
+    };
+  var req = Mapbender.Ajax.Request(options);
   req.send();
 };
 
 ConfObject.prototype.setEditor = function(newEditor) {
   this.editor = newEditor || null;
 };
+

Modified: branches/kmq_dev/http/javascripts/group.php
===================================================================
--- branches/kmq_dev/http/javascripts/group.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/group.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -7,11 +7,10 @@
 $ajaxResponse  = new AjaxResponse($_REQUEST);
 
 $ObjectConf = array("DisplayName"   => "Group",
-                    "internalname"  => "group",
+                    "internalName"  => "group",
                     "ClassName"     => "Group");
 
 $rpc = new RPCEndpoint($ObjectConf,$ajaxResponse);
 $rpc->run();
 
-
 ?>

Added: branches/kmq_dev/http/javascripts/gui.php
===================================================================
--- branches/kmq_dev/http/javascripts/gui.php	                        (rev 0)
+++ branches/kmq_dev/http/javascripts/gui.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -0,0 +1,16 @@
+<?php
+require_once(dirname(__FILE___)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE___)."/../classes/class_gui.php");
+require_once(dirname(__FILE___)."/../classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE___)."/../classes/class_json.php");
+
+$ajaxResponse  = new AjaxResponse($_REQUEST);
+
+$ObjectConf = array("DisplayName"   => "Gui",
+                    "internalName"  => "gui",
+                    "ClassName"     => "gui");
+
+$rpc = new RPCEndpoint($ObjectConf,$ajaxResponse);
+$rpc->run();
+
+?>

Modified: branches/kmq_dev/http/javascripts/map.php
===================================================================
--- branches/kmq_dev/http/javascripts/map.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/map.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -76,7 +76,7 @@
 // Load external JavaScript libraries
 //
 $extPath = dirname(__FILE__) . "/../extensions/";
-$extFileArray = array(  "jquery-1.2.6.min.js", 
+$extFileArray = array(  "jquery-1.3.2.min.js", 
 						"jqjson.js", 
 						"jquery.mousewheel.min.js",
 						"jquery.form.js");
@@ -253,4 +253,4 @@
 echo "function initModules () {";
 echo implode("\n", $executeJsPluginsArray);
 echo "}\n";
-?>
\ No newline at end of file
+?>

Modified: branches/kmq_dev/http/javascripts/mod_AdminTabs.js
===================================================================
--- branches/kmq_dev/http/javascripts/mod_AdminTabs.js	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/mod_AdminTabs.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -116,19 +116,15 @@
 
 var me = this;
 
-/*var list = $("<ul></ul>");
-list.css("position","absolute");
-list.css("top","1em");
-list.css("left","1em");
-var Tabs = $(me).replaceWith(list);
-*/
+var Tabs = $('<ul><li>The Admintabs</li></ul>');
+Tabs.css("position","absolute");
+Tabs.css("top","1em");
+Tabs.css("left","1em");
+var h = $(me).append(Tabs);
+
 var AdminTabs = function() {
-  for(module in Mapbender.modules){
-    if(Mapbender.modules[module].MB_ADMIN_MODULE)
-    {
-    }
-  }
 
+  
   var adminModules = [];
   this.register = function(moduleId) {
     for(var c = 0; c < adminModules.length;c++) 
@@ -136,24 +132,41 @@
       if(adminModules[c] == moduleId) { return; }
     }
     adminModules.push(moduleId);
-    init();
+    
+    initmodule(moduleId); 
   };
 
-  var init = function() {
-    for(module in adminModules)
-    {
-      //append ul element to body and make it a list
+  /*  moduleId
+   *  param @moduleId the Id of the module that should be initialized (same as the modules options.id)
+   */
+  var initmodule = function(moduleId) {
+
+      var tab = $('<li><a href="#'+moduleId+'container">'+ Mapbender.modules[moduleId].caption +'</a></li>');
+      Tabs.append(tab);
+      
+      var container = $("<div></div>");
+      container.attr("id",moduleId + 'container');
+      $(me).append(container);
+      
+      // append ul element to AdminArea and make it a list
       var listElement = $("<ul></ul>");
       listElement.addClass("mbList");
-      $("body").append(listElement);
-      var userList = new MBconfObjectList('http://mapbender/javascripts/'+Mapbender.modules[adminModules[module]].rpcEndpoint ,listElement);
-      userList.setEditor(Mapbender.modules[adminModules[module]]);
-      userList.editor.setList(userList);
-      userList.load();
+      container.append(listElement);
+      var List = new MBconfObjectList('http://mapbender/javascripts/'+Mapbender.modules[moduleId].rpcEndpoint ,listElement);
+      List.setEditor(Mapbender.modules[moduleId]);
+      List.editor.setList(List);
+      List.load();
+      
+      // make module a child of AdminArea
+      $(container).append($('#' + moduleId+'frame'));
 
-    }
-  };
 
-};
+    };
 
+  $.getScript("../extensions/jquery-ui-1.7.1.w.o.effects.min.js",(function(){
+    $('#' + options.id).tabs();
+  }));
+
+ };
+
 Mapbender.modules[options.id] = new AdminTabs();

Modified: branches/kmq_dev/http/javascripts/mod_group.js
===================================================================
--- branches/kmq_dev/http/javascripts/mod_group.js	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/mod_group.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -2,32 +2,33 @@
 
 
 var GroupEditor = function(){
-  
   // chose the id to be of the form: options.id + <fieldname>
   this.form = $('\n\
-      <div class="mbFrame formContainer UserEditor">\n\
-      <h2>GroupNameGoesHere</h2>\n\
-      <form method="post" id="'+ options.id +'_Form" >\n\
+      <div id="'+options.id +'frame" class="mbFrame formContainer ConfEditor">\n\
+      <h2 id="'+ options.id +'nameheader">GroupNameGoesHere</h2>\n\
+      <form method="post" id="'+ options.id +'form" >\n\
       <ul>\n\
-        <li><label for="'+ options.id +'Name">Name</label><input id="'+ options.id +'name" type="text" /></li>\n\
-        <li><label for="'+ options.id +'_Description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
-        <li><label for="'+ options.id +'_Owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
+        <li><label for="'+ options.id +'name">Name</label><input id="'+ options.id +'name" type="text" /></li>\n\
+        <li><label for="'+ options.id +'description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
+        <li><label for="'+ options.id +'owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
       </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\
+      <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>');
 
-  this.fields = [];
-  this.fields.name  = { name: "name", defaultValue : "New Group", value: "", display: "Group Name",  type: "text"};
-  this.fields.owner = { name: "owner",       defaultValue : "", value:"", display: "Owner",       type: "text"};
-  this.fields.description = { name: "description",       defaultValue : "", value:"", display: "Description",  type: "text"};
-  this.name = this.fields.name.value;
-  this.name = this.fields.name.value;
+  this.defaultFields = {};
+  this.defaultFields.name  = { name: "name", defaultValue : "New Group", value: "", display: "Group Name",  type: "text"};
+  this.defaultFields.owner = { name: "owner",       defaultValue : "", value:"", display: "Owner",       type: "text"};
+  this.defaultFields.description = { name: "description",       defaultValue : "", value:"", display: "Description",  type: "text"};
+  
+  this.name = this.defaultFields.name.value;
   this.rpcEndpoint = "../javascripts/group.php"; 
   this.options = options;
+
+  this.caption = "Groups";
   
   $(me).replaceWith(this.form);
   me = this.form;
@@ -38,7 +39,6 @@
 GroupEditor.prototype = new ConfEditor();
 GroupEditor.prototype.constructor = GroupEditor;
 
-
 Mapbender.modules[options.id] = new GroupEditor();
 if(Mapbender.modules['AdminTabs'])
 {

Added: branches/kmq_dev/http/javascripts/mod_gui.js
===================================================================
--- branches/kmq_dev/http/javascripts/mod_gui.js	                        (rev 0)
+++ branches/kmq_dev/http/javascripts/mod_gui.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -0,0 +1,47 @@
+var me = this;
+
+
+var GuiEditor = function(){
+  // chose the id to be of the form: options.id + <fieldname>
+this.form = $('\n\
+      <div id="'+options.id +'frame" class="mbFrame formContainer ConfEditor">\n\
+      <h2 id="'+ options.id +'nameheader">GuiNameGoesHere</h2>\n\
+      <form method="post" id="'+ options.id +'form" >\n\
+      <ul>\n\
+        <li><label for="'+ options.id +'name">Name</label><input id="'+ options.id +'name" type="text" /></li>\n\
+        <li><label for="'+ options.id +'description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
+        <li><label for="'+ options.id +'public">Public</label><input id="'+ options.id +'public" name="public"  type="checkbox" /></li>\n\
+    </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>');
+
+  this.defaultFields = {};
+  this.defaultFields.name =         { name: "name",         defaultValue: "New Gui", value: "", display: "User Name", type: "text"};
+  this.defaultFields.description =  { name: "description",  defaultValue: "", value: "", display: "Description", type: "text"};
+  this.defaultFields.public=        { name: "public",        defaultValue: true, value: "", display: "Public", type: "bool"};
+
+  
+  this.name = this.defaultFields.name.value;
+  this.rpcEndpoint = "../javascripts/gui.php"; 
+  this.options = options;
+  
+  this.caption = "GUI";
+  
+  $(me).replaceWith(this.form);
+  me = this.form;
+  this.reset();
+
+};
+
+GuiEditor.prototype = new ConfEditor();
+GuiEditor.prototype.constructor = GuiEditor;
+
+Mapbender.modules[options.id] = new GuiEditor();
+if(Mapbender.modules['AdminTabs'])
+{
+    Mapbender.modules['AdminTabs'].register(options.id);
+}

Deleted: branches/kmq_dev/http/javascripts/mod_gui.php
===================================================================
--- branches/kmq_dev/http/javascripts/mod_gui.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/mod_gui.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -1,44 +0,0 @@
-<?php
-
-
-Class Mod_User()
-{
-
-
-public $javascript = <<<JAVASCRIPT
-//<![CDATA[
-
-
-//]]>
-JAVASCRIPT;
-
-public $html = <<<HTML
-
-<div class="mbFrame formContainer MBGUIEditor">
-<h2>GUINameGoesHere</h2>
-<form action="post">
-
-<ul>
- <li>UserEditor (class MBUserEditor)</li>
- <li>Group (class MBGroupEditor)</li>
- <li>GUIEdit (class MBGUIEditor)</li>
-</ul>
-
-<input type="submit" value="save" />
-</form>
-</div>
-HTML;
-};
-
-if($_SERVER['QUERY_STRING'] == 'html')
-{
-  echo Mod_User->html;
-}
-elseif($_SERVER['QUERY_STRING'] == 'javascript')
-{
-  header("Content-Type: text/javascript");
-  echo Mod_User->javascript;
-}
-
-?>
-

Modified: branches/kmq_dev/http/javascripts/mod_user.js
===================================================================
--- branches/kmq_dev/http/javascripts/mod_user.js	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/mod_user.js	2009-08-03 15:39:50 UTC (rev 4466)
@@ -2,50 +2,65 @@
 
 
 var UserEditor = function(){
-var form = $('\n\
-<div class="mbFrame formContainer UserEditor">\n\
-<h2>UserNameGoesHere</h2>\n\
-<ul class="tabList">\n\
-<li class="active">core data</li>\n\
-<li>rights</li>\n\
-</ul>\n\
-<form method="post" id="'+ options.id +'_Form" >\n\
-<ul>\n\
-  <li><label for="'+ options.id +'Name">Username</label><input id="'+ options.id +'name" type="text" /></li>\n\
-  <li><label for="'+ options.id +'Password">Password</label><input id="'+ options.id +'password" type="password" /></li>\n\
-  <li><label for="'+ options.id +'Description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
-  <li><label for="'+ options.id +'Owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
-  <li><label for="'+ options.id +'LoginCount">Number of Logins</label><input id="'+ options.id +'loginCount" type="text" /></li>\n\
-  <li><label for="'+ options.id +'Email">Email</label><input id="'+ options.id +'email" type="text" /></li>\n\
-  <li><label for="'+ options.id +'Phone">Phone</label><input id="'+ options.id +'phone" type="text" /></li>\n\
-  <li><label for="'+ options.id +'Department">Department</label><input id="'+ options.id +'department" type="text" /></li>\n\
-</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\
+  // chose the id to be of the form: options.id + <fieldname>
+this.form = $('\n\
+      <div id="'+options.id +'frame" class="mbFrame formContainer ConfEditor">\n\
+      <h2 id="'+ options.id +'nameheader">UserNameGoesHere</h2>\n\
+      <form method="post" id="'+ options.id +'form" >\n\
+      <ul>\n\
+        <li><label for="'+ options.id +'Name">Username</label><input id="'+ options.id +'name" type="text" /></li>\n\
+        <li><label for="'+ options.id +'Password">Password</label><input id="'+ options.id +'password" type="password" /></li>\n\
+        <li><label for="'+ options.id +'Description">Description</label><input id="'+ options.id +'description" type="text" /></li>\n\
+        <li><label for="'+ options.id +'Owner">Owner</label><input id="'+ options.id +'owner" type="text" /></li>\n\
+        <li><label for="'+ options.id +'LoginCount">Number of Logins</label><input id="'+ options.id +'loginCount" type="text" /></li>\n\
+        <li><label for="'+ options.id +'Email">Email</label><input id="'+ options.id +'email" type="text" /></li>\n\
+        <li><label for="'+ options.id +'Phone">Phone</label><input id="'+ options.id +'phone" type="text" /></li>\n\
+        <li><label for="'+ options.id +'Department">Department</label><input id="'+ options.id +'department" type="text" /></li>\n\
+    </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>');
 
-  this.fields = [];
-  this.fields.name = { name: "name", defaultValue: "New User", value: "", display: "User Name", type: "text"};
+  this.defaultFields = {};
+  this.defaultFields.name =         { name: "name",         defaultValue: "New User", value: "", display: "User Name", type: "text"};
+  this.defaultFields.password =     { name: "password",     defaultValue: "********", value: "", display: "Password", type: "text"};
+  this.defaultFields.description =  { name: "description",  defaultValue: "", value: "", display: "Description", type: "text"};
+  this.defaultFields.owner =        { name: "owner",        defaultValue: "", value: "", display: "Owner", type: "text"};
+  this.defaultFields.loginCount =   { name: "loginCount",   defaultValue: "", value: "", display: "Login Count", type: "text"};
+  this.defaultFields.email=         { name: "email",        defaultValue: "", value: "", display: "Email", type: "text"};
+  this.defaultFields.phone=         { name: "phone",        defaultValue: "", value: "", display: "Phone", type: "text"};
+  this.defaultFields.department=    { name: "department",   defaultValue: "", value: "", display: "Department", type: "text"};
+  this.defaultFields.resolution=    { name: "resolution",   defaultValue: "", value: "", display: "Resolution", type: "text"};
+  this.defaultFields.organization=  { name: "organization", defaultValue: "", value: "", display: "Organization", type: "text"};
+  this.defaultFields.position=      { name: "position",     defaultValue: "", value: "", display: "position", type: "text"};
+  this.defaultFields.phone1=        { name: "phone1",       defaultValue: "", value: "", display: "Phone Extra", type: "text"};
+  this.defaultFields.fax=           { name: "fax",          defaultValue: "", value: "", display: "Fax", type: "text"};
+  this.defaultFields.deliveryPoint= { name: "deliveryPoint",defaultValue: "", value: "", display: "Delivery Point", type: "text"};
+  this.defaultFields.city=          { name: "city",         defaultValue: "", value: "", display: "City", type: "text"};
+  this.defaultFields.postalCode=    { name: "postalCode",   defaultValue: "", value: "", display: "Postal Code", type: "text"};
+  this.defaultFields.country=       { name: "country",      defaultValue: "", value: "", display: "Country", type: "text"};
+  this.defaultFields.url=           { name: "url",          defaultValue: "", value: "", display: "URL", type: "text"};
 
-  this.name = this.fields.name.value;
+  
+  this.name = this.defaultFields.name.value;
   this.rpcEndpoint = "../javascripts/user.php"; 
   this.options = options;
+  this.caption = "Users";
   
-  
-  $(me).replaceWith(form);
-  me = form;
+  $(me).replaceWith(this.form);
+  me = this.form;
   this.reset();
-  
+
 };
+
 UserEditor.prototype = new ConfEditor();
 UserEditor.prototype.constructor = UserEditor;
 
-//Mapbender.modules[options.id] = new UserEditor();
+Mapbender.modules[options.id] = new UserEditor();
 if(Mapbender.modules['AdminTabs'])
 {
-   // Mapbender.modules['AdminTabs'].register(options.id);
+    Mapbender.modules['AdminTabs'].register(options.id);
 }
-

Deleted: branches/kmq_dev/http/javascripts/mod_user.php
===================================================================
--- branches/kmq_dev/http/javascripts/mod_user.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/mod_user.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -1,31 +0,0 @@
-<?php
-
-$mod_user_html = <<<HTML
-
-<div class="mbFrame formContainer UserEditor">
-<h2>UserNameGoesHere</h2>
-<ul class="tabList">
-<li class="active">core data</li>
-<li>rights</li>
-</ul>
-<form action="post">
-<ul>
-  <li><label for="mbe_editor_user_Name">Username</label><input id="mbe_editor_user_Name" type="text" /></li>
-  <li><label for="mbe_editor_user_Password">Password</label><input id="mbe_editor_user_Password" type="password" /></li>
-  <li><label for="mbe_editor_user_Description">Description</label><input id="mbe_editor_user_Description" type="text" /></li>
-  <li><label for="mbe_editor_user_Owner">Owner</label><input id="mbe_editor_user_Owner" type="text" /></li>
-  <li><label for="mbe_editor_user_LoginCount">Number of Logins</label><input id="mbe_editor_user_LoginCount" type="text" /></li>
-  <li><label for="mbe_editor_user_Email">Email</label><input id="mbe_editor_user_Email" type="text" /></li>
-  <li><label for="mbe_editor_user_Phone">Phone</label><input id="mbe_editor_user_Phone" type="text" /></li>
-  <li><label for="mbe_editor_user_Department">Department</label><input id="mbe_editor_user_Department" type="text" /></li>
-</ul>
-<p>
-<input type="submit" value="save" />
-</p>
-</form>
-</div>
-HTML;
-
-echo $mod_user_html;
-
-?>

Modified: branches/kmq_dev/http/javascripts/user.php
===================================================================
--- branches/kmq_dev/http/javascripts/user.php	2009-08-03 14:50:43 UTC (rev 4465)
+++ branches/kmq_dev/http/javascripts/user.php	2009-08-03 15:39:50 UTC (rev 4466)
@@ -4,6 +4,7 @@
 require_once(dirname(__FILE___)."/../classes/class_RPCEndpoint.php");
 require_once(dirname(__FILE___)."/../classes/class_json.php");
 
+
 $ajaxResponse  = new AjaxResponse($_REQUEST);
 
 $ObjectConf = array("DisplayName"   => "User",



More information about the Mapbender_commits mailing list