[Mapbender-commits] r4488 - in trunk/mapbender: . core http/classes http/css http/javascripts lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 5 08:48:24 EDT 2009


Author: kmq
Date: 2009-08-05 08:48:24 -0400 (Wed, 05 Aug 2009)
New Revision: 4488

Added:
   trunk/mapbender/http/classes/class_RPCEndpoint.php
   trunk/mapbender/http/classes/class_group.php
   trunk/mapbender/http/css/gsoc09.css
   trunk/mapbender/http/css/mod_AdminTabs.css
   trunk/mapbender/http/javascripts/ConfEditor.js
   trunk/mapbender/http/javascripts/ConfObject.js
   trunk/mapbender/http/javascripts/group.php
   trunk/mapbender/http/javascripts/gui.php
   trunk/mapbender/http/javascripts/mod_AdminTabs.js
   trunk/mapbender/http/javascripts/mod_admin.js
   trunk/mapbender/http/javascripts/mod_admin.php
   trunk/mapbender/http/javascripts/mod_group.js
   trunk/mapbender/http/javascripts/mod_gui.js
   trunk/mapbender/http/javascripts/mod_user.js
   trunk/mapbender/http/javascripts/user.php
Modified:
   trunk/mapbender/
   trunk/mapbender/core/system.php
   trunk/mapbender/http/classes/class_gui.php
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/lib/ajax.js
   trunk/mapbender/lib/core.js
Log:
merge  kmq_dev to trunk


Property changes on: trunk/mapbender
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/kmq_dev:4021-4487

Modified: trunk/mapbender/core/system.php
===================================================================
--- trunk/mapbender/core/system.php	2009-08-05 09:11:12 UTC (rev 4487)
+++ trunk/mapbender/core/system.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -39,6 +39,6 @@
 	"zoomOut1,selArea1,pan1,copyright,dependentDiv,dragMapSize," .
 	"dynamicOverview,FeatureInfoRedirect,highlightPOI,navFrame,sandclock," .
 	"scaleBar,scaleSelect,setBBOX,setPOI2Scale,reload,overview,addWMS," . 
-	"repaint,changeEPSG,mousewheelZoom,doubleclickZoom,resizeMapsize," . 
+	"repaint,changeEPSG,User,AdminTabs,GroupEditor,GuiEditor,UserEditor,".
 	"scalebar,dialogManager"
 );

Copied: trunk/mapbender/http/classes/class_RPCEndpoint.php (from rev 4487, branches/kmq_dev/http/classes/class_RPCEndpoint.php)
===================================================================
--- trunk/mapbender/http/classes/class_RPCEndpoint.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_RPCEndpoint.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,262 @@
+<?php
+
+interface RPCObject{
+
+  public function create();
+  public function change($changes);
+  public function commit();
+  public function remove();
+  public function load();
+  public function getFields();
+  public static function getList($filter);
+  public static function byName($name);
+
+}
+
+class RPCEndpoint {
+  
+  var $ObjectConf;
+  var $ajaxResponse;
+
+  var $method;
+
+  public function __construct ($ObjectConf,$ajaxResponse){
+    $this->ObjectConf = $ObjectConf;
+    $this->ajaxResponse = $ajaxResponse;
+    $this->method = $this->ajaxResponse->getMethod();
+  }
+
+  // When we upgrade to 5.3.0 this needs to desperately upgraded to
+  // "Added support for dynamic access of static members using $foo::myFunc(). (Etienne Kneuss)"
+  // from http://php.net/ChangeLog-5.php
+  // so we can get rid of this sillyness here
+  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;
+    }
+
+  }
+
+  public function RPCObjectGetList(){
+    
+    switch($this->ObjectConf['ClassName']){
+
+      case 'User':
+        return User::getList("");
+
+      case 'Group':
+        return Group::getList("");
+
+      case 'gui':
+        return gui::getList("");
+
+      default:
+        return null;
+    }
+  }
+
+  public function run(){
+
+    switch($this->method)
+    {
+      case 'create':
+        try{
+          $this->rpc_create($this->ajaxResponse->getParameter('fields'));
+        }catch(Exception $E){
+          $this->ajaxResponse->setMessage("Create failed. Error: " . $E);
+        }
+        break;
+
+      case 'update':
+        try{
+          $this->rpc_update($this->ajaxResponse->getParameter('name'),$this->ajaxResponse->getParameter('fields'));
+        }catch(Exception $E){
+          $this->ajaxResponse->setMessage("Update failed. Error: " . $E);
+        }
+          
+        break;
+
+      case 'remove':
+        try{
+          $this->rpc_remove($this->ajaxResponse->getParameter('name'));
+        }catch(Exception $E){
+          $this->ajaxResponse->setMessage("Delete failed. Error: " . $E);
+        }
+        break;
+
+      case 'load':
+        try{
+          $this->rpc_load($this->ajaxResponse->getParameter('name'));
+        }catch(Exception $E){
+          $this->ajaxResponse->setMessage("Load failed. Error: " . $E);
+        }
+        break;
+
+      case 'list':
+        try{
+          $this->rpc_list();
+        }catch(Exception $E){
+          $this->ajaxResponse->setMessage("List failed. Error: " + $E);
+        }
+        break;
+
+      default:
+          $this->ajaxResponse->setSuccess(false);
+          $this->ajaxResponse->setMessage(_mb("invalid method"));
+    }
+
+    $this->ajaxResponse->send();
+  
+    
+  }
+
+  public function rpc_create($fields){
+    // 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);
+    }
+    catch (Exception $E)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Could not create "). $this->ObjectConf['internalName'] . "  Error: " . $E);
+    }
+    
+  
+    try{
+        $instance->commit();
+    }
+    catch(Exception $E)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Could not change "). $this->ObjectConf['internalName'] . " Error: " . $E);
+    }
+  }
+
+  public function rpc_update($name,$fields){
+    $instance = $this->RPCObjectByName($name);
+    if($instance == null)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage($this->ObjectConf['internalName'] . _mb(" does not exist: ". $name));
+      return;
+    }
+    try{
+        $instance->change($fields);
+    }
+    catch(Exception $E)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Could not change "). $this->ObjectConf['internalName'] . " Error: " .$E);
+    }
+
+    try{
+        $instance->commit();
+    }
+    catch(Exception $E)
+    {
+      $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_remove($name){
+    $instance = $this->RPCObjectByName($name);
+    if($instance == null)
+    {
+      $this->ajaxResponse->setSuccess(true);
+      $this->ajaxResponse->setMessage(_mb("No such "). $this->ObjectConf['internalName']);
+      break;
+    }
+    try{
+        $instance->remove();
+    }
+    catch(Exception $E)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Could not remove "). $this->ObjectConf['internalName'] . " Error: ". $E);
+    }
+
+  }
+
+  public function rpc_load($name){
+    $instance = $this->RPCObjectByName($name);
+    if($instance == null)
+    {
+      $this->ajaxResponse->setSuccess(true);
+      $this->ajaxResponse->setMessage(_mb("No such ". $this->ObjectConf['internalName'] .": $name"));
+      $this->ajaxResponse->setResult("data",array("error"=>true ));
+      return;
+    }
+  try{
+    $instance->load();
+    $result = $instance->getFields();
+  }
+  catch(Exception $E)
+  {
+      $this->ajaxResponse->setSuccess(true);
+      $this->ajaxResponse->setMessage(_mb("Could not load data: "). $this->ObjectConf['internalName'] ." Error: " . $E);
+      $this->ajaxResponse->setResult("error",true);
+  }
+  $this->ajaxResponse->setResult("data",$result);
+
+  }
+
+  public function rpc_list(){
+    $result = array();
+    $instances = array();
+    $instances = $this->RPCObjectGetList('');
+    if(!$instances)
+    {
+      $this->ajaxResponse->setSuccess(false);
+      $this->ajaxResponse->setMessage(_mb("Error fetching list of "). $this->ObjectConf['internalName']);
+      return;
+    }
+    
+    foreach( $instances as $instance)
+    {
+      $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']));
+
+  }
+
+}
+?>

Copied: trunk/mapbender/http/classes/class_group.php (from rev 4487, branches/kmq_dev/http/classes/class_group.php)
===================================================================
--- trunk/mapbender/http/classes/class_group.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_group.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,236 @@
+<?php
+# $Id: class_kml_geometry.php 1966 2008-01-15 08:25:15Z christoph $
+# http://www.mapbender.org/index.php/class_wmc.php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# 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");
+
+/**
+ * A Mapbender user as described in the table mb_group.
+ */
+class Group implements RPCObject {
+	/**
+	 * @var Integer The Group ID
+	 */
+	var $id;
+	var $name;
+	var $owner = 0;  
+	var $description ="";
+
+    static $displayName = "Group";
+    static $internalName = "group";
+	
+	/**
+	 * Constructor
+	 * @param groupId Integer 	the ID of the group that is represented by 
+	 * 							this object. If null, create an empty object
+	 */
+	public function __construct ($groupId) {
+		
+        if($groupId == null){
+          // new group
+          return;
+        }
+        $this->id = $groupId;
+		try{
+			$this->load();
+		}
+		catch(Exception $E)
+		{	
+			new mb_exception($E->getMessage());
+		}
+
+	}	
+
+	
+	/**
+	 * @return String the ID of this group
+	 */
+	public function __toString () {
+		return (string) $this->id;	
+	}
+
+
+    /*
+    * @return Assoc Array containing the fields to send to the user
+    */
+    public function getFields() {
+      $result = array(
+        "name" => $this->name,
+        "owner" => $this->owner,
+        "description" => $this->description
+      );
+      return $result;
+    }
+
+	public function  create() {
+		if($this->name == ""){ $e = new Exception("Can' t create group without name");}
+		
+		$sql_group_create = "INSERT INTO mb_group (mb_group_name) VALUES ('". $this->name ."');";
+		$v = array($this->name);
+		$t = array("s");
+	
+		db_begin();
+		
+		$insert_result = db_query($sql_group_create);
+		if($insert_result == false)
+		{
+			db_rollback();
+			$e = new Exception("Could not insert new group");
+		}
+
+		$id = db_insertid($insert_result,'mb_group','mb_group_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 group");
+				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->owner = $changes->owner ? $changes->owner : $this->owner;
+		$this->description = $changes->description ? $changes->description : $this->description;
+		$this->id = $changes->id ? $changes->id->value : $this->id;
+
+        return true;
+	}
+
+	public function commit() {
+
+		$sql_update = "UPDATE mb_group SET ".
+			"mb_group_name = $1, ".
+			"mb_group_owner = $2, ".
+			"mb_group_description = $3 ".
+			"WHERE mb_group_id = $4;";
+
+
+			$v = array($this->name,
+									$this->owner,
+									$this->description,
+									$this->id);
+
+			$t = array("s", "i", "s", "i");
+
+			$update_result = db_prep_query($sql_update,$v,$t);
+			if(!$update_result)
+			{
+				throw new Exception("Database error updating Group");
+			}
+
+		return true;
+	}
+
+	public function remove() {
+
+		$sql_group_remove = "DELETE FROM mb_group WHERE mb_group_id = $1";
+		$v = array($this->id);
+		$t = array("i");
+		$result = db_prep_query($sql_group_remove,$v,$t);
+		
+		if($result == false)
+		{
+			$e = new mb_exception("Database error deleting group");
+		}
+		return true;
+	}
+
+	public function load() {
+		$sql_group = "SELECT * from mb_group WHERE mb_group_id = $1; ";
+		$v = array($this->id);
+		$t = array("i");
+		$res_group = db_prep_query($sql_group,$v,$t);
+		if($row = db_fetch_array($res_group)){
+
+			$this->name = $row['mb_group_name'];
+			$this->owner = $row['mb_group_owner'];
+			$this->description	= $row['mb_group_description'];
+
+		}else{
+			 throw new Exception("no such Group");
+		}
+		return true;
+	}
+
+    /*
+    * @return Array of Groups
+    * @param $filter UNUSED! string that must be contained in the username
+    */
+    public static function getList($filter) {
+      $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{
+          $groups[] = new Group($row['mb_group_id']);
+        }
+        catch(Exception $E)
+        {
+          continue;
+          //FIXME: should catch some errors here
+        }
+      }
+      return $groups;
+      
+    }
+
+    /*
+    * tries to initialize a Groupobject by Name
+    * @return A group Object
+    * @param $name the name of the group to find
+    */
+
+    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))
+      {
+        return  new Group($row['mb_group_id']);
+      }
+      return null;
+
+    }
+	}
+?>

Modified: trunk/mapbender/http/classes/class_gui.php
===================================================================
--- trunk/mapbender/http/classes/class_gui.php	2009-08-05 09:11:12 UTC (rev 4487)
+++ trunk/mapbender/http/classes/class_gui.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -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: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2009-08-05 09:11:12 UTC (rev 4487)
+++ trunk/mapbender/http/classes/class_user.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -18,15 +18,37 @@
 # 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");
 
 /**
  * A Mapbender user as described in the table mb_user.
  */
-class User {
+class User implements RPCObject{
 	/**
-	 * @var Integer The user ID
+	 * @var Integer The User ID
 	 */
 	var $id;
+	var $name = "";
+	// var $password = ""; // password is readonly, 
+	var $owner = 0;  
+	var $description ="";
+	var $loginCount;
+	var $email = "";
+	var $phone ="";
+	var $department ="";
+	var $resolution = 72;
+	var $organization ="";
+	var $position = "";
+	var $phone1 = "";
+	var $fax = "";
+	var $deliveryPoint ="";
+	var $city ="";
+	var $postalCode;
+	var $country ="";
+	var $url ="";
+
+    static $displayName = "User";
+    static $internalName = "user";
 	
 	/**
 	 * Constructor
@@ -34,8 +56,22 @@
 	 * 							this object.
 	 */
 	public function __construct ($userId) {
-		$this->id = $userId;
+		
+        if($userId == null){
+          // new user
+          return;
+        }
+        $this->id = $userId;
+		try{
+			$this->load();
+		}
+		catch(Exception $E)
+		{	
+			new mb_exception($E->getMessage());
+		}
+
 	}	
+
 	
 	/**
 	 * @return String the ID of this user
@@ -43,8 +79,252 @@
 	public function __toString () {
 		return (string) $this->id;	
 	}
+
+
+    /*
+    * @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->description, 
+							"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;
+	}
+
+	public function  create() {
+		if($this->name == ""){ $e = new Exception("Can' t create user without name");}
+		
+		$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_query($sql_user_create);
+		if($insert_result == false)
+		{
+			db_rollback();
+			$e = new Exception("Could not insert new user");
+		}
+
+		$id = db_insertid($insert_result,'mb_user','mb_user_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 user");
+				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->owner = $changes->owner ? $changes->owner : $this->owner;
+		$this->description = $changes->description ? $changes->description : $this->description;
+		$this->email = $changes->email ? $changes->email : $this->email;
+		$this->phone = $changes->phone ? $changes->phone : $this->phone;
+		$this->department = $changes->department ? $changes->department : $this->department;
+		$this->resolution = $changes->resolution ? $changes->resolution : $this->resolution;
+		$this->organization = $changes->organization ? $changes->organization : $this->organization;
+		$this->position = $changes->position ? $changes->position : $this->position;
+		$this->phone1 = $changes->phone1 ? $changes->phone1 : $this->phone1;
+		$this->facsimile = $changes->facsimile ? $changes->facsimile : $this->facsimile;
+		$this->deliveryPoint = $changes->deliveryPoint ? $changes->deliveryPoint : $this->deliveryPoint;
+		$this->city = $changes->city ? $changes->city : $this->city;
+		$this->postalCode = $changes->postalCode ? $changes->postalCode : $this->postalCode;
+		$this->country = $changes->country ? $changes->country : $this->country;
+		$this->url = $changes->url ? $changes->url : $this->url;
+		$this->id = $changes->id ? $changes->id : $this->id;
+
+        return true;
+	}
+
+	public function commit() {
+
+		$sql_update = "UPDATE mb_user SET ".
+			"mb_user_name = $1, ".
+			"mb_user_owner = $2, ".
+			"mb_user_description = $3, ".
+			"mb_user_email = $4, ".
+			"mb_user_phone = $5, ".
+			"mb_user_department = $6, ".
+			"mb_user_resolution = $7, ".
+			"mb_user_organisation_name = $8, ".
+			"mb_user_position_name = $9, ".
+			"mb_user_phone1 = $10, ".
+			"mb_user_facsimile = $11, ".
+			"mb_user_delivery_point = $12, ".
+			"mb_user_city = $13, ".
+			"mb_user_postal_code = $14, ".
+			"mb_user_country = $15, ".
+			"mb_user_online_resource = $16 ".
+			"WHERE mb_user_id = $17;";
+
+
+			$v = array($this->name,
+									$this->owner,
+									$this->description,
+									$this->email,
+									$this->phone,
+									$this->department,
+									$this->resolution,
+									$this->organization,
+									$this->position,
+									$this->phone1,
+									$this->facsimile,
+									$this->deliveryPoint,
+									$this->city,
+									$this->postalCode,
+									$this->country,
+									$this->url,
+									$this->id);
+
+			$t = array("s", "i", "s", "s", "s", "s", "i",  "s", "s",  "s", "s", "s",  "s", "i",  "s", "s", "i");
+
+			$update_result = db_prep_query($sql_update,$v,$t);
+			if(!$update_result)
+			{
+				throw new Exception("Database error updating User");
+			}
+
+		return true;
+	}
+
+	public function remove() {
+
+		$sql_user_remove = "DELETE FROM mb_user WHERE mb_user_id = $1";
+		$v = array($this->id);
+		$t = array("i");
+		$result = db_prep_query($sql_user_remove,$v,$t);
+		
+		if($result == false)
+		{
+			$e = new mb_exception("Database error deleting userr");
+		}
+		return true;
+	}
+
+	public function load() {
+		$sql_user = "SELECT * from mb_user WHERE mb_user_id = $1; ";
+		$v = array($this->id);
+		$t = array("i");
+		$res_user = db_prep_query($sql_user,$v,$t);
+		if($row = db_fetch_array($res_user)){
+
+			$this->name = $row['mb_user_name'];
+			$this->owner = $row['mb_user_owner'];
+			$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'];
+			$this->department = $row['mb_user_department'];
+			$this->resolution = $row['mb_user_resolution'];
+			$this->organization = $row['mb_user_organizationName'];
+			$this->position = $row['mb_user_position_name'];
+			$this->phone1 = $row['mb_user_phone1'];
+			$this->fax = $row['mb_user_facsimile'];
+			$this->deliveryPoint = $row['mb_user_delivery_point'];
+			$this->city = $row['mb_user_user_city'];
+			$this->postalCode = $row['mb_user_postal_code'];
+			$this->country = $row['mb_user_country'];
+			$this->url = $row['mb_user_online_resource'];
+
+		}else{
+			 throw new Exception("no such User");
+		}
+		return true;
+	}
+
+	public function setPassword($newPassword)
+	{
+		//
+		return false;
+	}
+  
+    /*
+    * @return Array of Users
+    * @param $filter UNUSED! string that must be contained in the username
+    */
+    public static function getList($filter) {
+    //FIXME: optimize
+      $users = Array();
+      $sql_userlist = "SELECT mb_user_id FROM mb_user ORDER BY mb_user_name";
+      $res_users = db_query($sql_userlist);
+
+      while($row = db_fetch_array($res_users))
+      {
+        try{
+          $users[] = new User($row['mb_user_id']);
+        }
+        catch(Exception $E)
+        {
+          continue;
+          //FIXME: should catch some errors here
+        }
+      }
+      return $users;
+      
+    }
+
+    /*
+    * tries to initialize a userobject by Name
+    * @return A user Object
+    * @param $name the name of the user to find
+    */
+
+    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))
+      {
+        return  new User($row['mb_user_id']);
+      }
+      return null;
+
+    }
+	
+		/**
 	 * Returns an array of application IDs that the user is allowed to access.
 	 * 
 	 * @return Array an array of application IDs

Copied: trunk/mapbender/http/css/gsoc09.css (from rev 4487, branches/kmq_dev/http/css/gsoc09.css)
===================================================================
--- trunk/mapbender/http/css/gsoc09.css	                        (rev 0)
+++ trunk/mapbender/http/css/gsoc09.css	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,163 @@
+html,body
+{
+  background-color: #f0f0f0;
+  height: 100%;
+  padding: 0px;
+}
+
+#log
+{
+  display: block;
+  position: fixed;  
+  top: 500px;
+  left:100px;
+  color:red;
+}
+
+h1.mbLogo
+{
+  font-size: larger;
+  font-stretch: extra-expanded;
+  font-weight: bold;
+}
+
+.mbFrame
+{
+  border: 1px solid black;
+  /* fugly
+  -moz-border-radius: 1em;
+  */
+  background-color: white;
+}
+
+ul
+{
+  list-style-type: none;
+}
+
+/*  top menu */
+.tabList > li
+{
+  display: inline;
+  background-color: #aaaaaa;
+  margin: 0em;
+  padding: 0em;
+  cursor: pointer;
+}
+.tabList > li:after
+{
+/*   content: " - "; */
+}
+.tabList > li:last-child:after
+{
+  /* content: ""; */
+}
+
+.tabList li.active
+{
+  background-color: transparent;
+  border: 1px gray solid;
+}
+
+
+/* left menu */
+
+.mbList
+{
+  margin-left: 0px;
+  padding-left: 1em;
+  padding-top: 1em;
+  width: 15em;
+  margin-top: 0.5em;
+  float: left;
+  /*FIXME: position: absolute*/;
+  top: 1em;
+  left: 1em;
+
+  min-height: 20em;
+}
+
+.mbList li
+{
+  cursor: pointer;
+}
+
+.mbList li.listCommand
+{
+  font-style: italic;
+}
+
+.mbList li#listFilter
+{
+  margin-bottom: 1em;
+}
+
+/* content area */
+
+div.formContainer
+{
+  margin-left: 16.5em;
+  padding-top: 1em;
+  margin-top: 0.5em;
+  min-height: 30em;
+  float:left;
+}
+
+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;
+  float: left;
+
+}
+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;
+}
+
+
+.hidden
+{
+  display: none;
+}
+
+
+input[type="checkbox"]
+{
+  border: none;
+}
+
+.ConfEditor
+{
+  position: relative;
+  top: 1em;
+  width: 40em;
+
+}

Copied: trunk/mapbender/http/css/mod_AdminTabs.css (from rev 4487, branches/kmq_dev/http/css/mod_AdminTabs.css)
===================================================================
--- trunk/mapbender/http/css/mod_AdminTabs.css	                        (rev 0)
+++ trunk/mapbender/http/css/mod_AdminTabs.css	2009-08-05 12:48:24 UTC (rev 4488)
@@ -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;
+}
+

Copied: trunk/mapbender/http/javascripts/ConfEditor.js (from rev 4487, branches/kmq_dev/http/javascripts/ConfEditor.js)
===================================================================
--- trunk/mapbender/http/javascripts/ConfEditor.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/ConfEditor.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,163 @@
+var ConfEditor = function(){
+};
+
+ConfEditor.prototype.load = function(key){
+  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)
+  {
+    for(field in this.confObject.fields)
+    {
+      this.confObject.fields[field].value = this.confObject.fields[field].defaultValue;
+    }
+    ConfEditor.prototype.save = ConfEditor.prototype.create;
+    this.display();
+    return;
+  }
+  
+  //else we try to load the object by the specified key
+  try{
+    this.confObject.load(key);
+  }catch(E){
+    alert("ConfEditor: unable to Load : "+ key +". ("+ E +")"); 
+  }
+};
+
+ConfEditor.prototype.remove = function(){
+  if(this.confObject)
+  {
+    //TODO: do something nicer
+    try{
+      this.confObject.remove();
+    }catch(E){
+      alert(E);
+    }
+  }else{
+    //TODO: notify user
+    alert("can't remove: no user loaded");
+  }
+};
+
+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");
+  }
+};
+
+ConfEditor.prototype.create = function(){
+  //see comments in display 
+  for(field in this.confObject.fields)
+  {
+    try{
+      this.confObject.fields[field].value = $('#' + this.options.id + this.confObject.fields[field].name).val();
+    }catch(E){
+      alert("Error trying to read fieldvalue " +E);
+    }
+  }
+  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);
+  }else{
+    alert("can't refresh :  no user loaded");
+  }
+};
+
+ConfEditor.prototype.display = function(){
+  
+  $('#' + this.options.id + 'nameheader').text(this.confObject.name);
+  
+  //FIXME: this needs to differentiate between the different possible fieldtypes
+  for(field in this.confObject.fields)
+  {
+    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.defaultFields,  url: this.rpcEndpoint};
+  this.confObject = this.confObject || new ConfObject(objectParams);
+  for(field in this.confObject.fields)
+  {
+    try{
+      $('#' + this.options.id + this.confObject.fields[field].name).val(this.confObject.fields[field].defaultValue);
+    }catch(E){
+      alert("Error trying to set " +E);
+    }
+  }
+};
+
+ConfEditor.prototype.setList = function(newList) {
+  this.list = newList || null;
+};

Copied: trunk/mapbender/http/javascripts/ConfObject.js (from rev 4487, branches/kmq_dev/http/javascripts/ConfObject.js)
===================================================================
--- trunk/mapbender/http/javascripts/ConfObject.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/ConfObject.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,108 @@
+
+var ConfObject = function(params) {
+  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 options = {
+    url           :  me.url,
+    method        : "load",
+    parameters    : {
+      name    : key
+      },
+    callback:(function(result,success,message){
+      if(result.data.error){
+        throw("Could not load ConfObject, server said: " + message);
+        return;
+      }
+      for(key in result.data)
+      {
+        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.url,
+    method        : "remove",
+    parameters    : {
+      name    : me.name
+      },
+    callback      : function(result,success,message){
+      me.editor.list.load();
+    }
+  });
+  req.send();
+};
+
+ConfObject.prototype.update = function(){
+  var me = this;
+  var lightFields = {};
+  for(field in me.fields)
+  {
+    lightFields[field] = me.fields[field].value;
+  }
+  var options = {
+    url           :  me.url,
+    method        : "update",
+    parameters    : {
+      name    : me.name,
+      fields  : lightFields
+      },
+    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 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.name,
+      fields  : lightfields
+      },
+    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;
+};
+

Copied: trunk/mapbender/http/javascripts/group.php (from rev 4487, branches/kmq_dev/http/javascripts/group.php)
===================================================================
--- trunk/mapbender/http/javascripts/group.php	                        (rev 0)
+++ trunk/mapbender/http/javascripts/group.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,16 @@
+<?php
+require_once(dirname(__FILE___)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE___)."/../classes/class_group.php");
+require_once(dirname(__FILE___)."/../classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE___)."/../classes/class_json.php");
+
+$ajaxResponse  = new AjaxResponse($_REQUEST);
+
+$ObjectConf = array("DisplayName"   => "Group",
+                    "internalName"  => "group",
+                    "ClassName"     => "Group");
+
+$rpc = new RPCEndpoint($ObjectConf,$ajaxResponse);
+$rpc->run();
+
+?>

Copied: trunk/mapbender/http/javascripts/gui.php (from rev 4487, branches/kmq_dev/http/javascripts/gui.php)
===================================================================
--- trunk/mapbender/http/javascripts/gui.php	                        (rev 0)
+++ trunk/mapbender/http/javascripts/gui.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -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();
+
+?>

Copied: trunk/mapbender/http/javascripts/mod_AdminTabs.js (from rev 4487, branches/kmq_dev/http/javascripts/mod_AdminTabs.js)
===================================================================
--- trunk/mapbender/http/javascripts/mod_AdminTabs.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_AdminTabs.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,172 @@
+//FIXME: "type"  shoudl be set by the dataobject recieved form the server
+var MBconfObjectList = function(url,element){
+
+// This Object displays availabe Configuration Objects in a given
+// category in a HTML ul element
+// and updates a corresponding editor with the Objects configuration 
+// Options
+
+
+var me = this;
+this.type = "ObjectType";
+this.element = element;
+this.allEntries = {};
+this.displayEntries = {};
+this.editor = null;
+this.url = url; //RPC endpoint for getting objects
+
+};
+
+MBconfObjectList.prototype.load = function(){
+  var that = this;
+  var options = {
+    url: that.url, 
+    method: "list",
+    callback :(function(result,success,message){
+      var users = result.list;
+      that.type = result.type.display || that.type;
+      that.allEntries = users;
+      that.displayEntries = that.allEntries;
+      that.display();
+    })
+    }
+
+  var request = new Mapbender.Ajax.Request(options);
+  request.send();
+ 
+};
+
+
+MBconfObjectList.prototype.display = function(search){
+  if(!search) {search = "";}
+  while(this.element.firstChild)
+  {
+      this.element.removeChild(this.element.firstChild);
+  }
+  $(this.element).html("");
+
+  var listEntry = $("<li></li>");
+  listEntry.addClass("listFilter");;
+
+  var listFilter = $('<input type="text" >');
+  listFilter.attr('title','filter users by name');
+  listFilter.attr('value',search);
+  listFilter.bind('change keyup',this.addOnFilterChangeHandler());
+
+  
+  //listEntry.appendChild(listFilter);
+  listEntry.append(listFilter);
+  $(this.element).append(listEntry);
+
+  for(entry in this.displayEntries)
+  {
+    var name = this.displayEntries[entry].name;
+    var value = this.displayEntries[entry].value;
+    listEntry = $("<li></li>");
+    listEntry.html(name);
+    listEntry.bind('click', this.addOnClickHandler(this.displayEntries[entry]));
+    $(this.element).append(listEntry);
+  
+  }
+  listEntry = $('<li></li>');
+  listEntry.addClass('listCommand');
+  listEntry.html('Add ' + this.type);
+  listEntry.bind('click',this.addOnClickHandler(value));
+  $(this.element).append(listEntry);
+  listFilter.focus();
+};
+
+MBconfObjectList.prototype.setEditor = function(newEditor){
+  //TODO: check newEditor for validity
+  this.editor = newEditor;
+  //TODO: assuming the editor.setList also tries to set the
+  // lists editor to itself, would cause some silly recursion.
+  // how do I deal with this
+  this.editor.setList(this);
+};
+
+MBconfObjectList.prototype.addOnClickHandler = function(key){
+ if(this.editor === null || this.editor === undefined) { return (function(){});}
+ var editor = this.editor;
+ var handler =  (function(){
+    editor.load(key.value);
+ });
+ return handler;
+};
+
+MBconfObjectList.prototype.addOnFilterChangeHandler = function(){
+  var list = this;
+  return (function(evt) {
+    var e = evt;
+    var needle = e.target.value;
+    list.displayEntries = {};
+    //TODO: optimize
+    for(entry in list.allEntries)
+    {
+      if(list.allEntries[entry].value.indexOf(needle) != -1)
+      {
+        list.displayEntries[entry] = list.allEntries[entry]; 
+      }
+    }
+    list.display(needle);
+  });
+
+};
+
+
+var me = this;
+
+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() {
+
+  
+  var adminModules = [];
+  this.register = function(moduleId) {
+    for(var c = 0; c < adminModules.length;c++) 
+    {
+      if(adminModules[c] == moduleId) { return; }
+    }
+    adminModules.push(moduleId);
+    
+    initmodule(moduleId); 
+  };
+
+  /*  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");
+      container.append(listElement);
+      var List = new MBconfObjectList('../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();

Copied: trunk/mapbender/http/javascripts/mod_admin.js (from rev 4487, branches/kmq_dev/http/javascripts/mod_admin.js)
===================================================================
--- trunk/mapbender/http/javascripts/mod_admin.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_admin.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,89 @@
+var Mapbender = Mapbender || {};
+
+function object(o){
+  function F() {}
+  F.prototype = o;
+  return new F();
+}
+
+Mapbender.Admin = {};
+
+ /*
+  * Alist of  registered modules
+ */
+Mapbender.Admin.modules = {};
+
+/*
+ *  Represents a Configuration Module. All Available Modules have to be registered here 
+ */
+Mapbender.Admin.Module = function(options){
+  
+  options = options || {};
+
+  /*
+   * The title displayed to the user
+  */
+  this.title = options.title || "";
+
+  /*
+   * The relative path to the File that contains the
+   * derived MBconfigObject, and MBConfigObjectEditor
+  */
+  this.path = options.path || "";
+
+  /*
+   * The path where to send RPCs
+  */
+  this.endpoint = options.endpoint || "";
+
+  /*
+   * wether the Module should active in the current page
+  */
+  this.active = options.active || false;
+
+  this.class = options.class || "";
+
+  this.load = function()
+  {
+
+  };
+
+};
+Mapbender.Admin.Module.prototype.constructor = Mapbender.Admin.Module;
+
+
+//TODO: move these into their respective files
+Mapbender.Admin.modules.User   = new  Mapbender.Admin.Module({title: "User",
+                          path: "mod_user.php", 
+                          endpoint : "user.php",
+                          class: "MBUserEditor",
+                          confObject: Mapbender.Admin.confUser});
+
+Mapbender.Admin.modules.Group  =   new  Mapbender.Admin.Module({title: "Groups",
+                          path: "mod_group.php", 
+                          endpoint: "group.php",
+                          class: "MBGroupEditor"});
+
+
+
+
+/*
+ * Scans the current Page for any modules to be activated
+*/
+Mapbender.Admin.scan = function(){
+  
+  for(module in Mapbender.Admin.modules)
+  {
+    if(!Mapbender.Admin.modules.hasOwnProperty(module)) { continue; }
+    var selector = "." + Mapbender.Admin.modules[module].class;
+    var elements = $(selector);
+    for(var i =0; i < elements.length; i++)
+    {
+     elements[i].style.backgroundColor = "red";
+
+    }
+    
+  }
+
+};
+

Copied: trunk/mapbender/http/javascripts/mod_admin.php (from rev 4487, branches/kmq_dev/http/javascripts/mod_admin.php)
===================================================================
--- trunk/mapbender/http/javascripts/mod_admin.php	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_admin.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,73 @@
+
+<!-- TODO: Need my header! -->
+<html>
+<head>
+
+
+<script src="../extensions/jquery-1.3.2.min.js" type="text/javascript"></script>
+<script src="../extensions/jquery-ui-1.7.1.w.o.effects.min.js" type="text/javascript"></script>
+<script src="../extensions/jqjson.js" type="text/javascript"></script>
+<script src="mod_admin.js" type="text/javascript"></script>
+<script src="Object.js" type="text/javascript"></script>
+<script src="Editor.js" type="text/javascript"></script>
+<script src="List.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+//<![CDATA[
+var Mapbender = {};
+
+<?php
+echo "var global_mb_log_js = '".LOG_JS."';";
+echo "var global_mb_log_level = '".LOG_LEVEL."';";
+echo "var global_log_levels = '".LOG_LEVEL_LIST."';";
+
+require_once "../../lib/ajax.js";
+require_once "../../lib/exception.js";
+require_once "../../lib/event.js";
+
+?>
+//]]>
+</script>
+<script src="mod_admin.js" type="text/javascript" ></script>
+<script type="text/javascript" >
+//<![CDATA[
+
+function body_onload(evt){
+  Mapbender.Admin.scan();
+}
+//]]>
+</script>
+</head>
+<body onload="body_onload(event)">
+<!--
+
+Check which adminGUI elements are defined for this GUI and put them on the page
+like this:
+
+require_once("mod_user.php");
+
+echo mod_user_editor();
+
+which would output something like this:
+bla
+<div class="MBUserEditor">
+</div>
+
+The javascript on the clientside then scans for each of these modules, loads
+their javascript executes:
+
+$(".MBUserEditor").Mapbender.Admin.UserEditor();
+
+
+-->
+
+<?php
+
+include_once("mod_user.php");
+echo $mod_user_html;
+
+?>
+
+
+</body>
+</html>

Copied: trunk/mapbender/http/javascripts/mod_group.js (from rev 4487, branches/kmq_dev/http/javascripts/mod_group.js)
===================================================================
--- trunk/mapbender/http/javascripts/mod_group.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_group.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,46 @@
+var me = this;
+
+
+var GroupEditor = 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">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\
+      </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 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;
+  this.reset();
+
+};
+
+GroupEditor.prototype = new ConfEditor();
+GroupEditor.prototype.constructor = GroupEditor;
+
+Mapbender.modules[options.id] = new GroupEditor();
+if(Mapbender.modules['AdminTabs'])
+{
+  Mapbender.modules['AdminTabs'].register(options.id);
+}

Copied: trunk/mapbender/http/javascripts/mod_gui.js (from rev 4487, branches/kmq_dev/http/javascripts/mod_gui.js)
===================================================================
--- trunk/mapbender/http/javascripts/mod_gui.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_gui.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -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);
+}

Copied: trunk/mapbender/http/javascripts/mod_user.js (from rev 4487, branches/kmq_dev/http/javascripts/mod_user.js)
===================================================================
--- trunk/mapbender/http/javascripts/mod_user.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/mod_user.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,66 @@
+var me = this;
+
+
+var UserEditor = 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">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.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.defaultFields.name.value;
+  this.rpcEndpoint = "../javascripts/user.php"; 
+  this.options = options;
+  this.caption = "Users";
+  
+  $(me).replaceWith(this.form);
+  me = this.form;
+  this.reset();
+
+};
+
+UserEditor.prototype = new ConfEditor();
+UserEditor.prototype.constructor = UserEditor;
+
+Mapbender.modules[options.id] = new UserEditor();
+if(Mapbender.modules['AdminTabs'])
+{
+    Mapbender.modules['AdminTabs'].register(options.id);
+}

Copied: trunk/mapbender/http/javascripts/user.php (from rev 4487, branches/kmq_dev/http/javascripts/user.php)
===================================================================
--- trunk/mapbender/http/javascripts/user.php	                        (rev 0)
+++ trunk/mapbender/http/javascripts/user.php	2009-08-05 12:48:24 UTC (rev 4488)
@@ -0,0 +1,18 @@
+<?php
+require_once(dirname(__FILE___)."/../classes/class_mb_exception.php");
+require_once(dirname(__FILE___)."/../classes/class_user.php");
+require_once(dirname(__FILE___)."/../classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE___)."/../classes/class_json.php");
+
+
+$ajaxResponse  = new AjaxResponse($_REQUEST);
+
+$ObjectConf = array("DisplayName"   => "User",
+                    "internalname"  => "user",
+                    "ClassName"     => "User");
+
+$rpc = new RPCEndpoint($ObjectConf,$ajaxResponse);
+$rpc->run();
+
+
+?>

Modified: trunk/mapbender/lib/ajax.js
===================================================================
--- trunk/mapbender/lib/ajax.js	2009-08-05 09:11:12 UTC (rev 4487)
+++ trunk/mapbender/lib/ajax.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -268,5 +268,6 @@
 			"id": id
 		};
 	}
+    return this;
 };
 Mapbender.Ajax.Request.prototype = new Mapbender.Ajax.Notification();

Modified: trunk/mapbender/lib/core.js
===================================================================
--- trunk/mapbender/lib/core.js	2009-08-05 09:11:12 UTC (rev 4487)
+++ trunk/mapbender/lib/core.js	2009-08-05 12:48:24 UTC (rev 4488)
@@ -60,7 +60,7 @@
 Mapbender.events.init.register(function() {
 	$lm = $("#loading_mapbender");
 	$cm = $("#complete_mapbender");
-	$lm.empty();
+	$lm.remove();
 	$cm.show();
 });
 



More information about the Mapbender_commits mailing list