From: Ben Klang Date: Thu, 14 Jul 2005 05:12:58 +0000 (+0000) Subject: VERY BROKEN X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ff1ab20896833128b5c9284215ac2170e944a636;p=horde.git VERY BROKEN Begin to add data entry forms git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@54 06cd67b6-e706-0410-b29e-9de616bca6e9 --- diff --git a/index.php b/index.php index 2d753d0a6..b377e9a8a 100644 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ require_once SHOUT_BASE . '/lib/base.php'; require_once SHOUT_BASE . '/lib/Shout.php'; $context = Util::getFormData("context"); -$section = Util::getFormData("section"); +$section = "users"; $contexts = $shout->getContexts(); $vars = &Variables::getDefaultVariables(); diff --git a/lib/Driver/ldap.php b/lib/Driver/ldap.php index b630fb719..d0a1d90da 100644 --- a/lib/Driver/ldap.php +++ b/lib/Driver/ldap.php @@ -45,6 +45,11 @@ class Shout_Driver_ldap extends Shout_Driver function getContexts($searchfilters = SHOUT_CONTEXT_ALL, $filterperms = null) { + static $entries = array(); + if (array_key_exists($searchfilters, $entries)) { + return $entries[$searchfilters]; + } + if ($filterperms == null) { $filterperms = PERMS_SHOW|PERMS_READ; } @@ -96,18 +101,18 @@ class Shout_Driver_ldap extends Shout_Driver " matching those search filters"); } - $entries = array(); $res = ldap_get_entries($this->_LDAP, $res); $i = 0; + $entries[$searchfilters] = array(); while ($i < $res['count']) { $context = $res[$i]['context'][0]; if (Shout::checkRights("shout:contexts:$context", $filterperms)) { - $entries[] = $context; + $entries[$searchfilters][] = $context; } $i++; } # return the array - return $entries; + return $entries[$searchfilters]; } // }}} @@ -176,6 +181,11 @@ type"); */ function getUsers($context) { + + static $entries = array(); + if (array_key_exists($context, $entries)) { + return $entries[$context]; + } $search = ldap_search($this->_LDAP, SHOUT_USERS_BRANCH.','.$this->_params['basedn'], '(&(objectClass='.SHOUT_USER_OBJECTCLASS.')(context='.$context.'))', @@ -187,40 +197,40 @@ type"); return PEAR::raiseError("Unable to search directory"); } $res = ldap_get_entries($this->_LDAP, $search); - $entries = array(); + $entries[$context] = array(); $i = 0; while ($i < $res['count']) { $extension = $res[$i]['voicemailbox'][0]; - $entries[$extension] = array(); + $entries[$context][$extension] = array(); - @$entries[$extension]['dialopts'] = + @$entries[$context][$extension]['dialopts'] = $res[$i]['asteriskuserdialoptions']; - @$entries[$extension]['mailboxopts'] = + @$entries[$context][$extension]['mailboxopts'] = $res[$i]['asteriskvoicemailboxoptions']; - @$entries[$extension]['mailboxpin'] = + @$entries[$context][$extension]['mailboxpin'] = $res[$i]['voicemailboxpin'][0]; - @$entries[$extension]['name'] = + @$entries[$context][$extension]['name'] = $res[$i]['cn'][0]; - @$entries[$extension]['phonenumbers'] = + @$entries[$context][$extension]['phonenumbers'] = $res[$i]['telephonenumber']; - @$entries[$extension]['dialtimeout'] = + @$entries[$context][$extension]['dialtimeout'] = $res[$i]['asteriskuserdialtimeout'][0]; - @$entries[$extension]['email'] = + @$entries[$context][$extension]['email'] = $res[$i]['mail'][0]; - @$entries[$extension]['pageremail'] = + @$entries[$context][$extension]['pageremail'] = $res[$i]['asteriskpager'][0]; $i++; } - return $entries; + return $entries[$context]; } // }}} diff --git a/lib/Shout.php b/lib/Shout.php index 1ee50c966..1c976416e 100644 --- a/lib/Shout.php +++ b/lib/Shout.php @@ -31,8 +31,11 @@ class Shout if (isset($context) && isset($section) && $section == "users" && Shout::checkRights("shout:contexts:$context:users", PERMS_EDIT, 1)) { - $menu->add("#", _("Add User"), "add-user.gif", null, null, - "open_adduser_win('context=$context')", null); + $url = Horde::applicationUrl("users/index.php"); + $url = Util::addParameter($url, array('context' => $context, + 'section' => $section, + 'action' => 'add')); + $menu->add($url, _("Add User"), "add-user.gif"); } if ($returnType == 'object') { diff --git a/lib/User.php b/lib/User.php new file mode 100644 index 000000000..3e7552be5 --- /dev/null +++ b/lib/User.php @@ -0,0 +1,21 @@ +preserve($vars); + $users = $shout->getUsers($context); + + $this->addVariable(_("Full Name"), 'name', text, true); + $this->addVariable(_("Extension"), 'name', int, true); + } +} +// }}} \ No newline at end of file diff --git a/shout.webprj b/shout.webprj index 86ec4adb2..ee1ec3f84 100644 --- a/shout.webprj +++ b/shout.webprj @@ -9,47 +9,51 @@ - - - - + + + + - - + + - + - + - - + + + - + - + - + - + - + - - + + - + - - + + + + + @@ -70,20 +74,20 @@ -//w3c//dtd xhtml 1.0 strict//en - - - - + + + + - - + + - - - + + + - - + + Ben Klang ben@alkaloid.net Gubed @@ -94,9 +98,13 @@ - - - + + + + + + + @@ -105,6 +113,7 @@ + diff --git a/users/index.php b/users/index.php new file mode 100644 index 000000000..627ae37b2 --- /dev/null +++ b/users/index.php @@ -0,0 +1,45 @@ + + * + * See the enclosed file COPYING for license information (GPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + */ + +@define('SHOUT_BASE', dirname(__FILE__) . "/.."); +$shout_configured = (@is_readable(SHOUT_BASE . '/config/conf.php'));# && + #@is_readable(SHOUT_BASE . '/config/prefs.php')); +if (!$shout_configured) { + require SHOUT_BASE . '/../lib/Test.php'; + Horde_Test::configFilesMissing('Shout', SHOUT_BASE, + array('conf.php', 'prefs.php')); +} + +require_once SHOUT_BASE . '/lib/base.php'; +require_once SHOUT_BASE . '/lib/Shout.php'; + +$context = Util::getFormData("context"); +$section = "users"; +$action = Util::getFormData("action"); + +$contexts = $shout->getContexts(); +$vars = &Variables::getDefaultVariables(); + +if (!isset($context)) {#FIXME || !Shout::checkContext()) { + $url = Horde::applicationUrl("/shout/index.php"); + header("Location: $url"); + exit(0); +} + +$tabs = &Shout::getTabs($context, $vars); +$tabs->preserve('context', $context); + +switch ($action) { + case "add": + case "edit": + case "delete": + require SHOUT_BASE . "/users/$action.php"; + break; +} \ No newline at end of file