[Mapbender-commits] r8531 - in trunk/mapbender: conf http/javascripts http/php lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Dec 18 01:35:11 PST 2012


Author: verenadiewald
Date: 2012-12-18 01:35:10 -0800 (Tue, 18 Dec 2012)
New Revision: 8531

Added:
   trunk/mapbender/http/javascripts/user.js
   trunk/mapbender/http/php/user.php
Modified:
   trunk/mapbender/conf/mapbender.conf-dist
   trunk/mapbender/http/php/mod_filteredGroup_User.php
   trunk/mapbender/http/php/mod_filteredGroup_filteredUser.php
   trunk/mapbender/http/php/mod_filteredGui_User.php
   trunk/mapbender/http/php/mod_filteredGui_filteredUser.php
   trunk/mapbender/http/php/mod_filteredUser_Group.php
   trunk/mapbender/http/php/mod_filteredUser_Gui.php
   trunk/mapbender/http/php/mod_filteredUser_filteredGroup.php
   trunk/mapbender/http/php/mod_filteredUser_filteredGui.php
   trunk/mapbender/http/php/mod_group_filteredUser.php
   trunk/mapbender/http/php/mod_group_user.php
   trunk/mapbender/http/php/mod_group_user_role.php
   trunk/mapbender/http/php/mod_gui_filteredUser.php
   trunk/mapbender/http/php/mod_gui_owner.php
   trunk/mapbender/http/php/mod_gui_user.php
   trunk/mapbender/http/php/mod_user_filteredGroup.php
   trunk/mapbender/http/php/mod_user_filteredGui.php
   trunk/mapbender/http/php/mod_user_group.php
   trunk/mapbender/http/php/mod_user_gui.php
   trunk/mapbender/lib/editUser.php
Log:
added an ajax filter method for filling the user select in administration frontends

Modified: trunk/mapbender/conf/mapbender.conf-dist
===================================================================
--- trunk/mapbender/conf/mapbender.conf-dist	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/conf/mapbender.conf-dist	2012-12-18 09:35:10 UTC (rev 8531)
@@ -246,6 +246,12 @@
 #define("WRAPPER_PATH","/portal/karten.html");
 #define("WRAPPER_PATH","");
 
+# --------------------------------------------
+# user autocomplete
+# --------------------------------------------
+define('SEARCH_LIMIT', 50);
+define('SEARCH_COLUMN', 'mb_user_name');
+
 ###HACK for GLOBALS
 $DBSERVER=DBSERVER;
   $DB=DB;

Added: trunk/mapbender/http/javascripts/user.js
===================================================================
--- trunk/mapbender/http/javascripts/user.js	                        (rev 0)
+++ trunk/mapbender/http/javascripts/user.js	2012-12-18 09:35:10 UTC (rev 8531)
@@ -0,0 +1,57 @@
+var timeoutDelay = 250;
+
+$(document).ready(function() {
+    $("input#find_user").keyup(function() {
+        var input = $(this);
+        var target = $('#' + input.attr('data-target'));
+        var targetType = input.attr('data-target-type');
+            
+        if(typeof timeoutId !== 'undefined') {
+            window.clearTimeout(timeoutId);
+        }
+        
+        timeoutId = window.setTimeout(function() {
+            timeoutId = undefined;
+            
+            if(input.val() == "") {
+                return false;
+            }
+
+            $.ajax({
+                url: "../php/user.php",
+                data: {
+                    "searchterm" : input.val()
+                },
+                type: "post",
+                dataType: "json",
+                success: function(data) {
+
+                    
+                    if(targetType === 'select') {
+                        target.children().remove();
+                        
+                        if(input.attr('data-target-new') && input.attr('data-target-new') === 'true') {
+                            target.append(
+                                $('<option>')
+                                    .attr('value', 'new')
+                                    .text('NEW...')
+                            );
+                        }
+                            
+                        for(var i=0; i<data.length; i++) {
+                            target.append(
+                                $('<option>')
+                                    .attr('value', data[i].id)
+                                    .attr('title', data[i].firstname + ' ' + data.lastname)
+                                    .text(data[i].login)
+                            );
+                        }
+                    }
+                }
+                
+            });
+            
+            return true;
+        }, timeoutDelay);
+    });
+});
\ No newline at end of file


Property changes on: trunk/mapbender/http/javascripts/user.js
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/mapbender/http/php/mod_filteredGroup_User.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredGroup_User.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredGroup_User.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -224,7 +224,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -257,6 +258,8 @@
 	echo "There is no group owned by this user."	;
 }
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_group.focus();

Modified: trunk/mapbender/http/php/mod_filteredGroup_filteredUser.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredGroup_filteredUser.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredGroup_filteredUser.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -234,7 +234,8 @@
 	echo "</select>";
 	
 	/*filterbox****************************************************************************************/
-	echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+	echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+	//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 	/*insert all profiles in selectbox*****************************************************************/
 	echo "<div class='text2'>USER:</div>";
 	echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -266,6 +267,8 @@
 	echo "There is no group available for this user.";
 }
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_group.focus();

Modified: trunk/mapbender/http/php/mod_filteredGui_User.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredGui_User.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredGui_User.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -234,7 +234,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -263,6 +264,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_gui.focus();

Modified: trunk/mapbender/http/php/mod_filteredGui_filteredUser.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredGui_filteredUser.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredGui_filteredUser.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -244,7 +244,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -274,6 +275,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_gui.focus();

Modified: trunk/mapbender/http/php/mod_filteredUser_Group.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredUser_Group.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredUser_Group.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -210,7 +210,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -255,6 +256,8 @@
 	echo "There are no other users owned by this user."	;
 }
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_filteredUser_Gui.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredUser_Gui.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredUser_Gui.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -219,7 +219,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -256,6 +257,8 @@
 echo "</select>";
 echo "</form>";
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_filteredUser_filteredGroup.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredUser_filteredGroup.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredUser_filteredGroup.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -217,7 +217,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -259,6 +260,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_filteredUser_filteredGui.php
===================================================================
--- trunk/mapbender/http/php/mod_filteredUser_filteredGui.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_filteredUser_filteredGui.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -258,7 +258,8 @@
 
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -301,7 +302,8 @@
 
 ?>
 
-
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_group_filteredUser.php
===================================================================
--- trunk/mapbender/http/php/mod_group_filteredUser.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_group_filteredUser.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -220,7 +220,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -250,6 +251,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_group.focus();

Modified: trunk/mapbender/http/php/mod_group_user.php
===================================================================
--- trunk/mapbender/http/php/mod_group_user.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_group_user.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -218,7 +218,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -248,6 +249,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_group.focus();

Modified: trunk/mapbender/http/php/mod_group_user_role.php
===================================================================
--- trunk/mapbender/http/php/mod_group_user_role.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_group_user_role.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -295,7 +295,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -336,6 +337,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_group.focus();

Modified: trunk/mapbender/http/php/mod_gui_filteredUser.php
===================================================================
--- trunk/mapbender/http/php/mod_gui_filteredUser.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_gui_filteredUser.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -225,7 +225,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -255,6 +256,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_gui.focus();

Modified: trunk/mapbender/http/php/mod_gui_owner.php
===================================================================
--- trunk/mapbender/http/php/mod_gui_owner.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_gui_owner.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -237,7 +237,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -269,6 +270,8 @@
 		echo "There are no guis available for this user.<br>";
 }
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_gui.focus();

Modified: trunk/mapbender/http/php/mod_gui_user.php
===================================================================
--- trunk/mapbender/http/php/mod_gui_user.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_gui_user.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -215,7 +215,8 @@
 echo "</select>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter2' name='filter2' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter2' id='filter2' name='filter2' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all profiles in selectbox*****************************************************************/
 echo "<div class='text2'>USER:</div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user)' class='select2' multiple='multiple' id='selecteduser' name='selected_user[]' size='$fieldHeight' >";
@@ -245,6 +246,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_gui.focus();

Modified: trunk/mapbender/http/php/mod_user_filteredGroup.php
===================================================================
--- trunk/mapbender/http/php/mod_user_filteredGroup.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_user_filteredGroup.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -209,7 +209,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -251,6 +252,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_user_filteredGui.php
===================================================================
--- trunk/mapbender/http/php/mod_user_filteredGui.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_user_filteredGui.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -254,7 +254,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -295,6 +296,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_user_group.php
===================================================================
--- trunk/mapbender/http/php/mod_user_group.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_user_group.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -201,7 +201,8 @@
 echo "<form name='form1' action='" . $self ."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -243,6 +244,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Modified: trunk/mapbender/http/php/mod_user_gui.php
===================================================================
--- trunk/mapbender/http/php/mod_user_gui.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/http/php/mod_user_gui.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -205,7 +205,8 @@
 echo "<form name='form1' action='" . $self ."&e_id_css=".$_REQUEST["e_id_css"]."' method='post'>";
 
 /*filterbox****************************************************************************************/
-echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+echo "<input type='text' value='' class='filter1' name='filter1' id='find_user' data-target='selecteduser' data-target-type='select' autocomplete='off'/>";
+//echo "<input type='text' value='' class='filter1' id='filter1' name='filter1' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 /*insert all user in selectbox*************************************************************************************/
 echo "<div class='text1'>USER: </div>";
 echo "<select style='background:#ffffff' onchange='updateMail(this, user);submit();' class='select1' id='selecteduser' name='selected_user' size='10'>";
@@ -246,6 +247,8 @@
 echo "</form>";
 
 ?>
+<script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type="text/javascript">
 <!--
 document.forms[0].selected_user.focus();

Added: trunk/mapbender/http/php/user.php
===================================================================
--- trunk/mapbender/http/php/user.php	                        (rev 0)
+++ trunk/mapbender/http/php/user.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -0,0 +1,50 @@
+<?php
+/*******************************************************************************
+ * 
+ *******************************************************************************/
+//$e_id="user";
+require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+require_once dirname(__FILE__) . '/../../conf/mapbender.conf';
+
+$user = (int)Mapbender::session()->get("mb_user_id");
+
+if($user <= 0) {
+    die('Error: No permissions.');
+}
+
+if(!$_POST['searchterm']) {
+    die('Error: Searchterm not found.');
+}
+
+if(!defined('SEARCH_COLUMN') || !defined('SEARCH_LIMIT')) {
+    die('SEARCH_COLUMN or SEARCH_LIMIT not found in mapbender.conf');
+}
+
+$conn = pg_connect('host='.DBSERVER.' port='.PORT.' dbname='.DB.' user='.OWNER.' password='.PW);
+
+if($conn) {
+
+    $result = pg_query($conn, 
+        "SELECT * FROM mb_user WHERE "    
+        . SEARCH_COLUMN . " LIKE '%" 
+        . pg_escape_string($_POST['searchterm'])
+        . "%' AND mb_user_owner = '" . pg_escape_string($user) . "' ORDER BY ". SEARCH_COLUMN ." LIMIT " . SEARCH_LIMIT
+    );
+    
+    if($result) {
+        $userArray = array();
+        
+        while($user = pg_fetch_assoc($result)) {
+            $userArray[] = array(
+                'id' => $user['mb_user_id'],
+                'login' => $user['mb_user_name'],
+                'firstname' => $user['mb_user_firstname'],
+                'lastname' => $user['mb_user_lastname']
+            );
+        }
+        
+        die(json_encode($userArray));
+        
+    } else die('Error: Searchresult.');
+    
+} else die('Error: DB-Connection.');
\ No newline at end of file

Modified: trunk/mapbender/lib/editUser.php
===================================================================
--- trunk/mapbender/lib/editUser.php	2012-12-18 08:06:01 UTC (rev 8530)
+++ trunk/mapbender/lib/editUser.php	2012-12-18 09:35:10 UTC (rev 8531)
@@ -24,6 +24,7 @@
 ?>
 </script>
 <script type='text/javascript' src="../extensions/jquery.js"></script>
+<script type='text/javascript' src="../javascripts/user.js"></script>
 <script type='text/javascript'>
 
 function sendRegisterData() {
@@ -273,7 +274,8 @@
 	      echo _mb("User").": ";
 	   echo "</td>";
 	echo "<td>";
-	   echo "<input type='text' value='' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
+	   echo "<input type='text' value='' id='find_user' data-target='selecteduser' data-target-type='select' data-target-new='true' />";
+//	   echo "<input type='text' value='' onkeyup='filterUser(document.getElementById(\"selecteduser\"),user,this.value);'/>";
 	   echo "<br /><select id='selecteduser' name='selected_user' onchange='submit()'>";
 	   echo "<option value='new'>"._mb("NEW")."...</option>";
 	
@@ -281,6 +283,7 @@
 		if (isset($myUser) && $myUser) {
 			$filter->owner = Mapbender::session()->get("mb_user_id");
 		}
+		/*
 		$userArray = User::getList($filter);
 		foreach ($userArray as $user) {
 			echo "<option value='".htmlentities($user->id, ENT_QUOTES, "UTF-8") . 
@@ -291,6 +294,7 @@
 			}
 			echo ">" . htmlentities($user->name, ENT_QUOTES, "UTF-8") . "</option>";
 		}
+		*/
 		$cnt_user = count($userArray);
 		echo "</select>";
 		echo "</td>";



More information about the Mapbender_commits mailing list