Commit c904bcc44df321f9ad62c1fe6448cb9fdc1b71d5
1 parent
46605f7b
added select user functionality
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1408 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
77 additions
and
83 deletions
presentation/lookAndFeel/knowledgeTree/administration/usermanagement/addUserBL.php
| ... | ... | @@ -10,90 +10,84 @@ |
| 10 | 10 | require_once("../../../../../config/dmsDefaults.php"); |
| 11 | 11 | |
| 12 | 12 | if (checkSession()) { |
| 13 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 14 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 15 | - require_once("addUserUI.inc"); | |
| 16 | - require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 17 | - require_once("$default->fileSystemRoot/lib/security/permission.inc"); | |
| 18 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 19 | - require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 20 | - require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 21 | - require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 22 | - require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 23 | - | |
| 24 | - $oPatternCustom = & new PatternCustom(); | |
| 25 | - //create db object | |
| 26 | - $oDbAuth = new $default->authenticationClass; | |
| 27 | - | |
| 28 | - if (isset($fSearch)) { | |
| 29 | - | |
| 30 | - //get user name | |
| 31 | - $sSearch = $fName; | |
| 32 | - | |
| 33 | - // user attributes to search for | |
| 34 | - if ($default->authenticationClass == "DBAuthenticator") { | |
| 35 | - $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); | |
| 36 | - $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 37 | - $bLdap = false; | |
| 38 | - }else{ | |
| 39 | - //if its using LDAP get these attributes | |
| 40 | - $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); | |
| 41 | - $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 42 | - $bLdap = true; | |
| 43 | - } | |
| 44 | - //post array to page | |
| 45 | - if(isset($aResults)) | |
| 46 | - { | |
| 47 | - if(count($aResults)== 0){ | |
| 48 | - | |
| 49 | - $oPatternCustom->setHtml(getPageUsernameNotFound()); | |
| 50 | - } | |
| 51 | - else{ | |
| 52 | - | |
| 53 | - if($bLdap == false){ | |
| 54 | - $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); | |
| 55 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1"); | |
| 56 | - }else{ | |
| 57 | - $oPatternCustom->setHtml(getDetailsLDAPPage($sSearch,$aResults)); | |
| 58 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); | |
| 59 | - } | |
| 60 | - } | |
| 61 | - | |
| 62 | - }else{ | |
| 63 | - $oPatternCustom->setHtml(getAddPageFail()); | |
| 64 | - $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 65 | - } | |
| 66 | - | |
| 67 | - | |
| 68 | - }else { | |
| 69 | - // if nothing happens...just reload edit page | |
| 70 | - $oPatternCustom->setHtml(getAddPage(null)); | |
| 71 | - $main->setFormAction($_SERVER["PHP_SELF"]. "?fSearch=1"); | |
| 72 | - | |
| 73 | - } | |
| 13 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | |
| 14 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCreate.inc"); | |
| 15 | + require_once("addUserUI.inc"); | |
| 16 | + require_once("$default->fileSystemRoot/lib/users/User.inc"); | |
| 17 | + require_once("$default->fileSystemRoot/lib/security/permission.inc"); | |
| 18 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 19 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | |
| 20 | + require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | |
| 21 | + require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 22 | + require_once("$default->fileSystemRoot/presentation/Html.inc"); | |
| 74 | 23 | |
| 24 | + $oPatternCustom = & new PatternCustom(); | |
| 25 | + //create db object | |
| 26 | + $oDbAuth = new $default->authenticationClass; | |
| 75 | 27 | |
| 76 | - if(isset($fAddToDb)) | |
| 77 | - { //if db authentication | |
| 78 | - if(isset($fFromDb)){ | |
| 79 | - | |
| 80 | - //User($sNewUserName, $sNewName, $sNewPassword, $iNewQuotaMax, $sNewEmail, $sNewMobile, $bNewEmailNotification, $bNewSmsNotification, $sNewLdapDn, $iNewMaxSessions, $iNewLanguageID) | |
| 81 | - $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,$fEmailNotification,$fSmsNotification,0,0,0); | |
| 82 | - | |
| 83 | - }else{ | |
| 84 | - $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,0,0,$fLdap,0,0); | |
| 85 | - } | |
| 86 | - | |
| 87 | - if($oUser->create()){ | |
| 88 | - $oPatternCustom->setHtml(getPageSuccess()); | |
| 89 | - } | |
| 90 | - else{ | |
| 91 | - $oPatternCustom->setHtml(getPageFail()); | |
| 92 | - } | |
| 93 | - } | |
| 94 | - | |
| 95 | - //$main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addUnitSuccess&fUnit")); | |
| 96 | - $main->setCentralPayload($oPatternCustom); | |
| 97 | - $main->render(); | |
| 28 | + if (isset($fSearch)) { | |
| 29 | + //get user name | |
| 30 | + $sSearch = $fName; | |
| 31 | + | |
| 32 | + // user attributes to search for | |
| 33 | + if ($default->authenticationClass == "DBAuthenticator") { | |
| 34 | + $aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification"); | |
| 35 | + $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 36 | + $bLdap = false; | |
| 37 | + } else { | |
| 38 | + //if its using LDAP get these attributes | |
| 39 | + $aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile"); | |
| 40 | + $aResults = $oDbAuth->searchUsers($sSearch, $aAttributes); | |
| 41 | + $bLdap = true; | |
| 42 | + } | |
| 43 | + //post array to page | |
| 44 | + if(isset($aResults)) { | |
| 45 | + if(count($aResults) == 0) { | |
| 46 | + $oPatternCustom->setHtml(getPageUsernameNotFound()); | |
| 47 | + } else { | |
| 48 | + if (count($aResults) > 1) { | |
| 49 | + // display results in a listbox | |
| 50 | + $oPatternCustom->setHtml(getSelectUserPage($aResults)); | |
| 51 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1&fSearch=1"); | |
| 52 | + } else { | |
| 53 | + if($bLdap == false) { | |
| 54 | + $oPatternCustom->setHtml(getDetailsDBPage($sSearch,$aResults)); | |
| 55 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1&fFromDb=1"); | |
| 56 | + } else { | |
| 57 | + $oPatternCustom->setHtml(getDetailsLDAPPage($sSearch,$aResults)); | |
| 58 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fAddToDb=1"); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + } else { | |
| 64 | + $oPatternCustom->setHtml(getAddPageFail()); | |
| 65 | + $main->setFormAction($_SERVER["PHP_SELF"]); | |
| 66 | + } | |
| 67 | + } else if(isset($fAddToDb)) { //if db authentication | |
| 68 | + if(isset($fFromDb)) { | |
| 69 | + | |
| 70 | + //User($sNewUserName, $sNewName, $sNewPassword, $iNewQuotaMax, $sNewEmail, $sNewMobile, $bNewEmailNotification, $bNewSmsNotification, $sNewLdapDn, $iNewMaxSessions, $iNewLanguageID) | |
| 71 | + $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,$fEmailNotification,$fSmsNotification,0,1,0); | |
| 72 | + | |
| 73 | + } else { | |
| 74 | + $oUser = new User($fUsername,$fName,0,0,$fEmail,$fMobile,1,0,$fLdap,1,0); | |
| 75 | + } | |
| 76 | + | |
| 77 | + if($oUser->create()) { | |
| 78 | + $oPatternCustom->setHtml(getPageSuccess()); | |
| 79 | + } else { | |
| 80 | + $oPatternCustom->setHtml(getPageFail()); | |
| 81 | + } | |
| 82 | + } else { | |
| 83 | + // if nothing happens...just reload edit page | |
| 84 | + $oPatternCustom->setHtml(getAddPage(null)); | |
| 85 | + $main->setFormAction($_SERVER["PHP_SELF"]. "?fSearch=1"); | |
| 86 | + | |
| 87 | + } | |
| 88 | + | |
| 89 | + //$main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/create.php?fRedirectURL=".urlencode("$default->rootUrl/control.php?action=addUnitSuccess&fUnit")); | |
| 90 | + $main->setCentralPayload($oPatternCustom); | |
| 91 | + $main->render(); | |
| 98 | 92 | } |
| 99 | 93 | ?> | ... | ... |