Commit 104046b417fa51b6bdae10397caf5c601f97887c

Authored by andrew
1 parent 4b735f6d

Type: Functionality change.

Description:		Added user filtering in the user admin section.
Credit:			This patch was supplied by Stefano Ciancio.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2827 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersBL.php
... ... @@ -48,10 +48,10 @@ if (checkSession()) {
48 48 } else {
49 49 $default->log->info("fGroupID=$fGroupID");
50 50 }
51   - $oPatternCustom->setHtml(getPage($fGroupID));
  51 + $oPatternCustom->setHtml(getPage($fGroupID, $fName));
52 52 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
53 53 $main->setCentralPayload($oPatternCustom);
54 54 $main->setFormAction($_SERVER['PHP_SELF']);
55 55 $main->render();
56 56 }
57   -?>
58 57 \ No newline at end of file
  58 +?>
... ...
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/listUsersUI.inc
... ... @@ -47,7 +47,11 @@ function getGroupDisplay($iGroupID) {
47 47 return "<table><tr><td><b>Filter By Group </b></td><td>" . $oPatternListBox->render() . "</td></tr></table>";
48 48 }
49 49  
50   -function getUsers($fGroupID) {
  50 +function getNameDisplay($sName) {
  51 + return "<table><tr><td><b>Filter By Name </b></td><td><input type=\"text\" size=\"20\" name=\"fName\" value=\"$sName\" /> <input type=\"button\" value=\"Go\" onCLick=\"document.MainForm.submit()\"></td></tr></table>";
  52 +}
  53 +
  54 +function getUsers($fGroupID, $sName) {
51 55 global $default;
52 56 // changed from inner to outer joins to include users that aren't in any groups (Stefano Ciancio [s.ciancio@pisa.iol.it])
53 57 $sQuery = "SELECT DISTINCT U.id as userID, U.name as name, U.username, " .
... ... @@ -59,6 +63,10 @@ function getUsers($fGroupID) {
59 63 if ($fGroupID) {
60 64 $sWhereClause = "WHERE UGL.group_id = $fGroupID ";
61 65 }
  66 + // filter by name
  67 + if ($sName) {
  68 + $sWhereClause = "WHERE U.name like '%$sName%' ";
  69 + }
62 70 // #2978 don't display sys admin accounts if you're not a sysadmin
63 71 if (!Permission::userIsSystemAdministrator()) {
64 72 $sRestrictUsers = " GL.is_sys_admin = 0 ";
... ... @@ -85,7 +93,7 @@ function getUsers($fGroupID) {
85 93 return $oSearchResults->render() ;
86 94 }
87 95  
88   -function getPage($fGroupID) {
  96 +function getPage($fGroupID, $sName) {
89 97 global $default;
90 98 $sToRender .= renderHeading("User Management");
91 99  
... ... @@ -94,7 +102,8 @@ function getPage($fGroupID) {
94 102 $sToRender .= getAddLink("addUser", "Add A User");
95 103 }
96 104 $sToRender .= getGroupDisplay($fGroupID);
97   - $sToRender .= getUsers($fGroupID);
  105 + $sToRender .= getNameDisplay($sName);
  106 + $sToRender .= getUsers($fGroupID, $sName);
98 107 return $sToRender;
99 108 }
100   -?>
101 109 \ No newline at end of file
  110 +?>
... ...