[Mapbender-commits] r2723 - in branches/dev_lenkne: http/classes http/css http/php lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jul 25 15:44:34 EDT 2008


Author: lenkne
Date: 2008-07-25 15:44:34 -0400 (Fri, 25 Jul 2008)
New Revision: 2723

Added:
   branches/dev_lenkne/http/css/screen.css
   branches/dev_lenkne/http/php/mod_adminEditFilteredGroup.php
Modified:
   branches/dev_lenkne/http/classes/class_administration.php
   branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php
   branches/dev_lenkne/lib/mb_admin_functions.js
Log:


Modified: branches/dev_lenkne/http/classes/class_administration.php
===================================================================
--- branches/dev_lenkne/http/classes/class_administration.php	2008-07-25 13:56:52 UTC (rev 2722)
+++ branches/dev_lenkne/http/classes/class_administration.php	2008-07-25 19:44:34 UTC (rev 2723)
@@ -604,7 +604,26 @@
 
 		header("Content-type:text/plain; charset=utf-8");
 		return $output;
+	}
 
+	function getSearchResults($owner, $searchText) {
+		$allUsers = array();
+		$searchLikeText = "%" . $searchText . "%";
+		$sql = "SELECT mb_user_id,mb_user_name,mb_user_email FROM mb_user ";
+		$sql .= " WHERE mb_user_owner = $1 AND UPPER(mb_user_name) LIKE UPPER($2) ORDER BY mb_user_name ";
+		$v = array($owner,$searchLikeText);
+		$t = array('i','s'); 
+		$res = db_prep_query($sql, $v, $t);
+		while ($row = db_fetch_array($res)) {
+			array_push($allUsers, array("mb_user_id" => $row["mb_user_id"], "mb_user_name" => $row["mb_user_name"], "mb_user_email" => $row["mb_user_email"]));
+		}
+		$json = new Mapbender_JSON();
+		$output = $json->encode($allUsers);
+
+		header("Content-type:text/plain; charset=utf-8");
+//echo $sql;
+//print_r($v);
+		return $output;
 	}
 
 	function getAllUserColumns($userId) {

Added: branches/dev_lenkne/http/css/screen.css
===================================================================
--- branches/dev_lenkne/http/css/screen.css	                        (rev 0)
+++ branches/dev_lenkne/http/css/screen.css	2008-07-25 19:44:34 UTC (rev 2723)
@@ -0,0 +1,338 @@
+* {
+	font: 12px/1em normal "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
+}
+
+#adminFrame {
+	width: 86em;
+	margin: 0 auto;
+	background-color: #FFF;
+	min-height: 65em;
+}
+
+#content {
+	float: left;
+	padding: 1em;
+}
+
+#header {
+	padding: 1em;
+	background-color: #666;
+	width: 84em;
+}
+
+#sidebar {
+	float: left;
+	width: 20em;
+	padding: 1em;
+}
+
+#main {
+	float: left;
+	width: 60em;
+}
+
+#options {
+	float: left;
+	width: 20em;
+	margin-left: -20em;
+}
+
+#footer {
+	float: none;
+	clear: both;
+	padding: 1em;
+	background-color: #666;
+	width: 84em;
+}
+
+#info {
+	margin: 1em 0;
+}
+
+body {
+	margin: 0;
+	padding: 0;
+	color: #000;
+	background-color: #CCC;
+}
+
+body {
+	width: 84em;
+}
+
+body {
+	width: auto;
+	min-width: 84em;
+}
+
+h1 {
+	margin: 0;
+	padding: 0;
+	font-size: 2em;
+	font-weight: bold;
+	color: #FFF;
+}
+
+h1 em {
+	font-size: 1em;
+	font-weight: normal;color: #CCC;
+}
+
+h2 {
+	margin: 0;
+	margin-bottom: .5em;
+	padding-bottom: .5em;
+	font-size: 1.5em;
+	font-weight: bold;
+	color: #666;
+	border-bottom: 1px dotted #F60;
+}
+
+h3 {
+	font-size: 1em;
+	text-transform: uppercase;
+	color: #666;
+}
+
+h3:before {
+	content: "\2B0A\0020";
+	color: #F60;
+}
+
+hr {
+	visibility: hidden;
+	display: none;
+}
+
+a {
+	color: #69F;
+}
+
+input[type=text],
+input[type=password],
+textarea,
+select	{
+	width: 20em;
+	padding: .25em;
+	color: #666;
+	border: 1px solid #CCC;
+}
+
+input[type=text]:focus,
+input[type=password]:focus,
+textarea:focus,
+select:focus	{
+	color: #000;
+	border-color: #000;
+}
+
+textarea {
+	height: 5em;
+}
+
+select {
+	width: auto;
+}
+
+input[type=button] {
+	color: #FFF;
+	background-color: #69F;
+	border: 1px outset #FFF;
+}
+
+input[type=button]:hover {
+	background-color: #666;
+}
+
+input[disabled] {
+	color: #999;
+	background-color: #EEE;
+}
+
+input[type=text].numeric {
+	width: 5em;
+	text-align: right;
+}
+
+a:hover {
+	text-decoration: none;
+}
+
+#content p.hint {
+	width: 30em;
+	margin: 0;
+	font-size: 2em;
+	text-align: center;
+	color: #CCC;
+}
+
+#sidebar ul {
+	padding: 0;
+	list-style: none;
+}
+
+#sidebar ul li, li {
+	margin: 0;
+	margin-top: .25em;
+	margin-bottom: .25em;
+	border: 1px solid #CCC;
+	cursor: pointer;
+}
+
+#sidebar ul li:hover, li:hover {
+	color: #FFF;
+	background-color: #F60;
+	border: 1px outset #F60;
+}
+
+#sidebar ul li:hover a, li:hover {
+	color: #FFF;
+}
+
+#sidebar ul li.active, li.active,
+#sidebar ul li.active:hover {
+	color: #FFF;
+	background-color: #F60;
+	border: 1px inset #F60;
+}
+
+#sidebar ul li.active a,
+#sidebar ul li.active:hover a, li.active {
+	color: #FFF;
+}
+
+#sidebar ul li a, li {
+	display:block;
+	padding: .25em;
+	text-decoration: none;
+	color: #000;
+}
+
+#main form fieldset {
+	margin: 0;
+	margin-bottom: 1em;
+	padding: 0;
+	border: 0;
+}
+
+#main form fieldset legend {
+	margin: 0;
+	margin-bottom: .5em;
+	padding: 0;
+	text-transform: uppercase;
+	color: #F60;
+	border: 0;
+}
+
+#main form fieldset p {
+	margin: 0;
+	margin-top: .25em;
+}
+
+#main form fieldset p label {
+	float: left;
+	width: 10em;
+	padding: 3px 0;
+}
+
+#main form fieldset p label.inline {
+	float: none;
+	width: auto;
+	padding: 0;
+}
+
+#options ul {
+	padding: 0;
+	list-style: none;
+}
+
+#options ul li {
+	margin: 0;
+	margin-bottom: .25em;
+	padding: .25em;
+	white-space: nowrap;
+	border: 1px solid #CCC;
+}
+
+#options ul li.disabled {
+	background-color: #EEE;
+}
+
+#options ul li.disabled a {
+	color: #999;
+}
+
+#options ul li.disabled input[type=button] {
+	background-color: #999;
+}
+
+#options ul.hints {
+	width: 75%;
+	margin-left: 25%;
+}
+
+#options ul.hints li {
+	margin: 0;
+	margin-bottom: .5em;
+	padding: 0;
+	text-align: right;
+	white-space: normal;
+	color: #CCC;
+	border: none;
+}
+
+#options ul.hints:hover li {
+	color: #999;
+}
+
+#options ul.hints strong {
+	font-weight: bold;
+}
+
+#options ul.hints:hover strong {
+	color: #F60;
+}
+
+#footer ul {
+	margin:  0;
+	padding: 0;
+	list-style: none;
+	text-align: right;
+	color: #FFF;
+}
+
+#footer ul li {
+	display: inline;
+	text-transform: uppercase;
+}
+
+#footer ul li:hover {
+	color: #666;
+	background-color: #FFF;
+}
+
+#footer ul li a {
+	padding-right: .5em;
+	padding-left: .5em;
+	text-decoration: none;
+	color: #FFF;
+	border: 1px solid #FFF;
+}
+
+#footer ul li:hover a {
+	color: #666;
+}
+
+#info p {
+	margin: 0;
+	text-align: center;
+	color: #666;
+}
+
+#info p a {
+	color: #666;
+}
+
+.optionButton {
+	width:	110;
+} 
\ No newline at end of file

Added: branches/dev_lenkne/http/php/mod_adminEditFilteredGroup.php
===================================================================
--- branches/dev_lenkne/http/php/mod_adminEditFilteredGroup.php	                        (rev 0)
+++ branches/dev_lenkne/http/php/mod_adminEditFilteredGroup.php	2008-07-25 19:44:34 UTC (rev 2723)
@@ -0,0 +1,97 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/<wiki modul page name>
+# 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__)."/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_json.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+$admin = new administration();
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+//$e = new mb_exception("command: " . $queryObj->command);
+
+function sendOutput($out){
+    global $json;
+    $output = $json->encode($out);
+    header("Content-Type: text/x-json");
+    echo $output;
+}
+
+switch ($queryObj->command) {
+
+
+default:
+
+header("Content-type: text/html;");
+
+?>
+<div id="main">
+	<h2>Create or edit a group</h2>
+	<form id="form" name="form" action="" method="post">
+	<fieldset>
+		<p>
+			<input type="button" id="insert" name="insert" value="Create" onclick="')" /> 
+			<input type="button" id="update" name="update" value="Update" onclick="" /> 
+			<input type="button" id="delete" name="delete" value="Delete" onclick="" /> 
+			<input type="button" id="cancel" name="cancel" value="Cancel" onclick="" /> 
+		</p>
+	</fieldset>
+
+	<fieldset>
+		<p>
+			<label for="mb_user_id">Group ID:</label> 
+			<input type="text" id="mb_user_id" name="mb_user_id" value="" disabled="disabled" /> 
+		</p>
+		<p>
+			<label for="mb_user_name">Name:</label> 
+			<input type="text" id="mb_user_name" name="mb_user_name" value=""  /> 
+		</p>
+	</fieldset>
+
+	<fieldset style="visibility:show">
+		<p>
+			<label for="mb_user_description">Description:</label> 
+			<input type="text" id="mb_user_description" name="mb_user_description" value="" /> 
+		</p>
+		<p>
+			<label for="mb_user_owner">Owner:</label> 
+			<input type="text" id="mb_user_owner" name="mb_user_owner" value="31" /> 
+		</p>
+	</fieldset>
+	</form>
+</div>
+
+<div id="options">
+<h2>Current groups</h2>
+
+<h3>Search For A Group</h3>
+<input type="text" id="searchText" name="searchText" value="" style="width:110" /> 
+<input type="button" id="search" name="search" value="Filter" onclick="" />
+<input type="button" id="allUsers" name="allUsers" value="All Users" onclick="" />
+
+<div id="groupList"></div>
+</div>
+<?php
+
+break; //for default case
+} // end switch
+
+sendOutput($resultObj);
+?>
\ No newline at end of file

Modified: branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php
===================================================================
--- branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php	2008-07-25 13:56:52 UTC (rev 2722)
+++ branches/dev_lenkne/http/php/mod_adminEditFilteredUser.php	2008-07-25 19:44:34 UTC (rev 2723)
@@ -68,6 +68,22 @@
 
 break;
 
+case "searchUsers":
+
+	$searchResults = $admin->getSearchResults($_SESSION["mb_user_id"], $queryObj->parameters->searchText);
+
+	if ($searchResults) {
+		$resultObj["success"] = true;
+		$resultObj["data"] = $searchResults;
+		$resultObj["command"] = "refreshFilteredUsers";
+	}
+	else {
+		$resultObj["success"] = false;
+		$resultObj["message"] = "No matches found.";
+	}
+
+break;
+
 case "updateUser":
 
 	$dbUserId = $admin->getUserIdByUserName($queryObj->parameters->mb_user_name);
@@ -213,9 +229,10 @@
 default:
 
 header("Content-type: text/html;");
+?>
 
-?>
 <div id="main">
+
 	<h2>Create or edit user</h2>
 	<form id="form" name="form" action="" method="post">
 	<fieldset>
@@ -237,22 +254,18 @@
 			<input type="text" id="mb_user_name" name="mb_user_name" value=""  /> 
 		</p>
 		<p>
+			<label for="mb_user_description">Description:</label> 
+			<input type="text" id="mb_user_description" name="mb_user_description" value="" /> 
+		</p>
+		<p>
 			<label for="mb_user_password">Password:</label> 
 			<input type="password" id="mb_user_password" name="mb_user_password" value="" /> 
 		</p>
-		<p>
-			<label for="confirm_password">Confirm password:</label> 
-			<input type="password" id="confirm_password" name="confirm_password" value="" /> 
-		</p>
 
 	</fieldset>
 
-	<fieldset style="visibility:show">
+	<fieldset id="details" style="visibility:hidden">
 		<p>
-			<label for="mb_user_description">Description:</label> 
-			<input type="text" id="mb_user_description" name="mb_user_description" value="" /> 
-		</p>
-		<p>
 			<label for="mb_user_email">E-mail:</label> 
 			<input type="text" id="mb_user_email" name="mb_user_email" value="" /> 
 		</p>
@@ -300,9 +313,6 @@
 			<label for="mb_user_online_resource">Web site:</label> 
 			<input type="text" id="mb_user_online_resource" name="mb_user_online_resource" value="" /> 
 		</p>
-	</fieldset>
-
-	<fieldset>
 		<p>
 			<label for="mb_user_resolution">Resolution:</label> 
 			<input type="text" id="mb_user_resolution" name="mb_user_resolution" value="" /> 
@@ -313,7 +323,7 @@
 		</p>
 		<p>
 			<label for="mb_user_owner">Owner:</label> 
-			<input type="text" id="mb_user_owner" name="mb_user_owner" value="1" /> 
+			<input type="text" id="mb_user_owner" name="mb_user_owner" value="31" /> 
 		</p>
 	</fieldset>
 	</form>
@@ -323,10 +333,16 @@
 <h2>Current users</h2>
 
 <h3>Search by name</h3>
-<input type="text" id="searchText" name="searchText" value="" style="width:200" /> 
-<input type="button" id="search" name="search" value="Go" onclick="showFilteredUsers('mod_adminEditFilteredUser')" />
-<h3>Current users</h3>
+<input type="text" id="searchText" name="searchText" value="" style="width:110" /> 
+<input type="button" id="search" name="search" value="Filter" onclick="searchUsers('mod_adminEditFilteredUser')" />
+<input type="button" id="allUsers" name="allUsers" value="All Users" onclick="showFilteredUsers('mod_adminEditFilteredUser')" />
 <div id="usersList"></div>
+
+<br><br><h2>Options</h2>
+<input type="button" id="showDetails" name="showDetails" value="Details" class="optionButton" onclick="switchVisibility('details');activeButton(this)" /><br>
+<input type="button" id="manageGroups" name="manageGroups" value="Groups" class="optionButton" onclick="" /><br>
+<input type="button" id="manageApps" name="manageApps" value="Applications" class="optionButton" onclick="" />
+
 </div>
 <?php
 

Modified: branches/dev_lenkne/lib/mb_admin_functions.js
===================================================================
--- branches/dev_lenkne/lib/mb_admin_functions.js	2008-07-25 13:56:52 UTC (rev 2722)
+++ branches/dev_lenkne/lib/mb_admin_functions.js	2008-07-25 19:44:34 UTC (rev 2723)
@@ -1,4 +1,4 @@
-<script type="text/javascript" src="form.js"></script> 
+
  
 var fullscreenProgressIndicator;
 var wrapperContainer;
@@ -66,6 +66,24 @@
 	}
 }
 
+function switchVisibility(id) {
+
+	var temp = document.getElementById(id).style.visibility;
+
+      	if( temp == "visible" ) {
+       	document.getElementById(id).style.visibility = "hidden";
+       }
+       else {
+       	document.getElementById(id).style.visibility = "visible";
+	}
+}
+
+function activeButton(id) {
+
+//TODO Look at button switching in mb
+
+}
+
 function buildFullscreenProgressIndicator() {
 	fullscreenProgressIndicator = document.createElement('div');
 	
@@ -226,8 +244,29 @@
 	});
 }
 
+function searchUsers(module) {
+	showFullscreenProgressIndicator();
+	var parameters = new Object();
+	parameters['searchText'] = document.getElementById('searchText').value;
+
+	var queryObj = {module: module, 
+			command:"searchUsers", 
+			parameters: parameters
+	};
+	$.post('../php/' + module + '.php',{queryObj: $.toJSON(queryObj)}, function(result, status) {
+  		if (result && status == "success") {
+			processAjax(result);
+		}
+		else {
+			alert("Error.");
+		}
+	document.getElementById("userListHeading").innerHTML="Filtered Users";
+	hideFullscreenProgressIndicator();
+	});
+}
+
 function refreshFilteredUsers(resultObj) {
-	var user = '';
+	var user = '<h3 id="userListHeading">All users</h3>';
 	showFullscreenProgressIndicator();
 	for(var i=0;i<resultObj.length;i++){
 		user += "<li onclick=\"showUser('mod_adminEditFilteredUser'," + resultObj[i].mb_user_id + ")\">";



More information about the Mapbender_commits mailing list