From 4cc1ba3354b8eacd3789ee97e4b90e687206920f Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 11 Dec 2007 18:52:07 +0000 Subject: [PATCH] moved profile and reset button to top --- lam/lib/modules.inc | 112 ++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 55 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index c52e126e..408f4bfb 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -975,6 +975,37 @@ class accountContainer { } } } + echo "type."list\" style=\"border-width:0px;\" width=\"100%\">"; + echo ""; + echo ""; + echo "
"; + // reset button + if ($this->dn_orig!='') { + echo "subpage == 'finish') echo " disabled"; + echo ">\n"; + } + echo ""; + // profile selection + $profilelist = getAccountProfiles($this->type); + if (sizeof($profilelist) > 0) { + sort($profilelist); + echo " \n"; + echo "  \n"; + echo ""; + echo "\"""; + echo "\n"; + } + echo "
"; + echo "
\n"; // create module menu echo "type."list\" border=0 width=\"100%\" style=\"border-collapse: collapse;\">\n"; echo "type."list\" valign=\"top\">
"; @@ -1034,42 +1065,13 @@ class accountContainer { echo " 
\n"; // content header echo "type . "list\">\n"; - echo "\n"; + echo "\n"; $this->printContentHeader(); echo "\n"; echo "\n"; echo "type . "list\">\n"; - // left controls - echo "\n"; - // reset button - if ($this->dn_orig!='') { - echo "subpage == 'finish') echo " disabled"; - echo ">\n"; - echo "

\n"; - } - // profile selection - $profilelist = getAccountProfiles($this->type); - if (sizeof($profilelist) > 0) { - sort($profilelist); - echo "

\n"; - echo " \n"; - echo "  \n"; - echo ""; - echo "\"""; - echo "\n"; - echo "

\n"; - } // content area - echo ""; + echo ""; // display html-code from modules $return = array(); if ($this->current_page == 0) { @@ -1168,7 +1170,6 @@ class accountContainer { echo "\n"; // separator line echo '
'; - echo '
'; } /** @@ -1419,6 +1420,7 @@ class accountContainer { * @return array list of status messages if any errors occured */ function save_account() { + $finalDN = $this->dn; $errors = array(); $ldapUser = $_SESSION['ldap']->decrypt_login(); $ldapUser = $ldapUser[0]; @@ -1446,38 +1448,38 @@ class accountContainer { $added = false; foreach ($attributes as $DN) { if (isset($DN['modify'][$search][0]) && !$added) { - $attributes[$search.'='.$DN['modify'][$search][0].','.$this->dn] = $attributes[$this->dn]; - unset ($attributes[$this->dn]); - $this->dn = $search.'='.$DN['modify'][$search][0].','.$this->dn; + $attributes[$search.'='.$DN['modify'][$search][0].','.$finalDN] = $attributes[$finalDN]; + unset ($attributes[$finalDN]); + $finalDN = $search.'='.$DN['modify'][$search][0].','.$finalDN; $added = true; } if (isset($DN['add'][$search][0]) && !$added) { - $attributes[$search.'='.$DN['add'][$search][0].','.$this->dn] = $attributes[$this->dn]; - unset ($attributes[$this->dn]); - $this->dn = $search.'='.$DN['add'][$search][0].','.$this->dn; + $attributes[$search.'='.$DN['add'][$search][0].','.$finalDN] = $attributes[$finalDN]; + unset ($attributes[$finalDN]); + $finalDN = $search.'='.$DN['add'][$search][0].','.$finalDN; $added = true; } if (isset($DN['notchanged'][$search][0]) && !$added) { - $attributes[$search.'='.$DN['notchanged'][$search][0].','.$this->dn] = $attributes[$this->dn]; - unset ($attributes[$this->dn]); - $this->dn = $search.'='.$DN['notchanged'][$search][0].','.$this->dn; + $attributes[$search.'='.$DN['notchanged'][$search][0].','.$finalDN] = $attributes[$finalDN]; + unset ($attributes[$finalDN]); + $finalDN = $search.'='.$DN['notchanged'][$search][0].','.$finalDN; $added = true; } } // Add old dn if dn hasn't changed if (!$added) { - $attributes[$this->dn_orig] = $attributes[$this->dn]; - unset ($attributes[$this->dn]); - $this->dn = $this->dn_orig; + $attributes[$this->dn_orig] = $attributes[$finalDN]; + unset ($attributes[$finalDN]); + $finalDN = $this->dn_orig; } // Set to true if an real error has happened $stopprocessing = false; - if (strtolower($this->dn) != strtolower($this->dn_orig)) { + if (strtolower($finalDN) != strtolower($this->dn_orig)) { // move existing DN if ($this->dn_orig!='') { - $success = ldap_rename($_SESSION['ldap']->server(), $this->dn_orig, $this->getRDN($this->dn), $this->getParentDN($this->dn), false); + $success = ldap_rename($_SESSION['ldap']->server(), $this->dn_orig, $this->getRDN($finalDN), $this->getParentDN($finalDN), false); if ($success) { - logNewMessage(LOG_NOTICE, '[' . $ldapUser .'] Renamed DN ' . $this->dn_orig . " to " . $this->dn); + logNewMessage(LOG_NOTICE, '[' . $ldapUser .'] Renamed DN ' . $this->dn_orig . " to " . $finalDN); } else { logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to rename DN: ' . $this->dn_orig . ' (' . ldap_error($_SESSION['ldap']->server()) . ').'); @@ -1488,19 +1490,19 @@ class accountContainer { // create complete new dn else { $attr = array(); - if (is_array($attributes[$this->dn]['add'])) $attr = array_merge_recursive($attr, $attributes[$this->dn]['add']); - if (is_array($attributes[$this->dn]['notchanged'])) $attr = array_merge_recursive($attr, $attributes[$this->dn]['notchanged']); - if (is_array($attributes[$this->dn]['modify'])) $attr = array_merge_recursive($attr, $attributes[$this->dn]['modify']); - $success = ldap_add($_SESSION['ldap']->server(), $this->dn, $attr); + if (is_array($attributes[$finalDN]['add'])) $attr = array_merge_recursive($attr, $attributes[$finalDN]['add']); + if (is_array($attributes[$finalDN]['notchanged'])) $attr = array_merge_recursive($attr, $attributes[$finalDN]['notchanged']); + if (is_array($attributes[$finalDN]['modify'])) $attr = array_merge_recursive($attr, $attributes[$finalDN]['modify']); + $success = ldap_add($_SESSION['ldap']->server(), $finalDN, $attr); if (!$success) { - logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to create DN: ' . $this->dn . ' (' . ldap_err2str(ldap_errno($_SESSION['ldap']->server())) . ').'); - $errors[] = array('ERROR', sprintf(_('Was unable to create DN: %s.'), $this->dn), ldap_error($_SESSION['ldap']->server())); + logNewMessage(LOG_ERR, '[' . $ldapUser .'] Unable to create DN: ' . $finalDN . ' (' . ldap_err2str(ldap_errno($_SESSION['ldap']->server())) . ').'); + $errors[] = array('ERROR', sprintf(_('Was unable to create DN: %s.'), $finalDN), ldap_error($_SESSION['ldap']->server())); $stopprocessing = true; } else { - logNewMessage(LOG_NOTICE, '[' . $ldapUser .'] Created DN: ' . $this->dn); + logNewMessage(LOG_NOTICE, '[' . $ldapUser .'] Created DN: ' . $finalDN); } - unset($attributes[$this->dn]); + unset($attributes[$finalDN]); } } $DNs = array_keys($attributes);