From 8d48d9e0ce01bc5f06e802e61258eb36ead0c025 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Thu, 14 Jul 2005 22:06:23 +0000 Subject: [PATCH] Code fixed to a working state. Remove unnecessary javascript. Added elements to the new user form. git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@56 06cd67b6-e706-0410-b29e-9de616bca6e9 --- index.php | 2 +- lib/User.php | 26 +++++++++--- shout.webprj | 79 +++++++++++++++++++------------------ templates/dialplan/dialplanlist.inc | 12 +++++- templates/menu.inc | 57 -------------------------- templates/users/userlist.inc | 75 ++++++++++------------------------- users/add.php | 6 +-- users/index.php | 6 +++ 8 files changed, 103 insertions(+), 160 deletions(-) diff --git a/index.php b/index.php index b377e9a8a..2d753d0a6 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 = "users"; +$section = Util::getFormData("section"); $contexts = $shout->getContexts(); $vars = &Variables::getDefaultVariables(); diff --git a/lib/User.php b/lib/User.php index 3e7552be5..d11b2d1d8 100644 --- a/lib/User.php +++ b/lib/User.php @@ -8,14 +8,30 @@ class UserDetailsForm extends Horde_Form { function UserDetailsForm(&$vars) { global $shout; + $context = $vars->get("context"); + + parent::Horde_Form($vars, _("Add User - Context: $context")); - parent::Horde_Form($vars, _("Add User")); - $this->preserve($vars); $users = $shout->getUsers($context); - - $this->addVariable(_("Full Name"), 'name', text, true); - $this->addVariable(_("Extension"), 'name', int, true); + + $this->addVariable(_("Full Name"), 'name', 'text', true); + $this->addVariable(_("Extension"), 'extension', 'int', true); + $this->addVariable(_("E-Mail Address"), 'email', 'text', false); + # TODO: Integrate with To-Be-Written user manager and possibly make this + # TODO: new user also an email account. + $this->addVariable(_("PIN"), 'pin', 'int', true); + $this->addVariable(_("Telephone Number 1:"), 'telephone1', 'text', + false); + $this->addVariable(_("Telephone Number 2:"), 'telephone2', 'text', + false); + $this->addVariable(_("Telephone Number 3:"), 'telephone3', 'text', + false); + $this->addVariable(_("Telephone Number 4:"), 'telephone4', 'text', + false); + $this->addVariable(_("Music on Hold while transferring"), 'moh', + 'radio', true, false, null, + array('values' => array(true => 'Yes', false => 'No'))); } } // }}} \ No newline at end of file diff --git a/shout.webprj b/shout.webprj index ee1ec3f84..ae3c79cfd 100644 --- a/shout.webprj +++ b/shout.webprj @@ -9,51 +9,51 @@ - - - - + + + + - - + + - + - + - - - + + + - + - + - + - + - + - - + + - + - - + + - - + + @@ -74,20 +74,20 @@ -//w3c//dtd xhtml 1.0 strict//en - - - - + + + + - - + + - - - + + + - - + + Ben Klang ben@alkaloid.net Gubed @@ -100,16 +100,17 @@ - - - - - + + + + + + diff --git a/templates/dialplan/dialplanlist.inc b/templates/dialplan/dialplanlist.inc index a630d0d77..227c7f476 100644 --- a/templates/dialplan/dialplanlist.inc +++ b/templates/dialplan/dialplanlist.inc @@ -1,9 +1,19 @@ + + + + + + + +
+   +
 Context:
getDialplan($context); - if (isset($dialplan['extensions']) && + if (isset($dialplan['extensions']) && (count($dialplan['extensions']) > 0)) { foreach ($dialplan['extensions'] as $extension => $priorities) { foreach ($priorities as $priority => $application) { diff --git a/templates/menu.inc b/templates/menu.inc index a34f44e47..ae483d23e 100644 --- a/templates/menu.inc +++ b/templates/menu.inc @@ -51,62 +51,5 @@ function contextSubmit(clear) } } } - - -var last_adduser_win; - -function open_adduser_win(args) -{ - var url = "applicationWebPath('%application%/users/add.php' , 'shout')) ?>"; - if (url.indexOf('?') == -1) { - var glue = '?'; - } else { - var glue = '&'; - } - var now = new Date(); - var name = "adduser_windows_" + now.getTime(); - if (args != "") { - url = url + glue + args + "&uniq=" + now.getTime(); - } else { - url = url + glue + "uniq=" + now.getTime(); - } - var width = screen.width; - if (width > 775) { - width = 700; - } else { - width -= 75; - } - var height = screen.height; - if (height > 725) { - height = 650; - } else { - height -= 75; - } - param = "toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",left=0,top=0"; - name = window.open(url, name, param); - if (!name) { - alert(""); - } else { - if (!eval("name.opener")) { - name.opener = self; - } - - last_adduser_win = name; - } -} - -function focus_adduser_win(adduser_win) -{ - if (!adduser_win) { - adduser_win = last_adduser_win; - } - - if (!adduser_win) { - return; - } - - adduser_win.focus(); -} - // --> diff --git a/templates/users/userlist.inc b/templates/users/userlist.inc index d4baf8833..0e0f8d544 100644 --- a/templates/users/userlist.inc +++ b/templates/users/userlist.inc @@ -1,46 +1,3 @@ - - -
- - diff --git a/users/add.php b/users/add.php index 2e6c4bec4..a314106a2 100644 --- a/users/add.php +++ b/users/add.php @@ -27,8 +27,8 @@ $UserDetailsFormValid = $UserDetailsForm->validate($vars, true); $UserDetailsForm->open($RENDERER, $vars, 'index.php', 'post'); $UserDetailsForm->preserveVarByPost($vars, "section"); $UserDetailsForm->preserve($vars); -$RENDERER->beginActive($ContextForm->getTitle()); -$RENDERER->renderFormActive($ContextForm, $vars); +$RENDERER->beginActive($UserDetailsForm->getTitle()); +$RENDERER->renderFormActive($UserDetailsForm, $vars); $RENDERER->submit(); $RENDERER->end(); -$ContextForm->close($RENDERER); \ No newline at end of file +$UserDetailsForm->close($RENDERER); \ No newline at end of file diff --git a/users/index.php b/users/index.php index 627ae37b2..46fb92a0a 100644 --- a/users/index.php +++ b/users/index.php @@ -33,8 +33,14 @@ if (!isset($context)) {#FIXME || !Shout::checkContext()) { exit(0); } +require SHOUT_TEMPLATES . '/common-header.inc'; +require SHOUT_TEMPLATES . '/menu.inc'; + +echo "
"; + $tabs = &Shout::getTabs($context, $vars); $tabs->preserve('context', $context); +echo $tabs->render($section); switch ($action) { case "add": -- 2.11.0
@@ -68,26 +25,36 @@ function open_user_win(args, useraction) $line++; ?>
+ +
edit + $url = Horde::applicationUrl("users/edit.php"); + $url = Util::addParameter($url, "context=$context"); + $url = Util::addParameter($url, "extension=$extension"); + echo Horde::link($url); ?> + edit   |   delete +$url = Horde::applicationUrl("users/delete.php"); + $url = Util::addParameter($url, "context=$context"); + $url = Util::addParameter($url, "extension=$extension"); + echo Horde::link($url); ?> + delete