From 9ac687a1c0c411d9384bf886ededd58c358dcadc Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Sun, 17 Jul 2005 06:02:57 +0000 Subject: [PATCH] Intermediate commit to fix oopsed filename. Highlights to this commit include more UI tweaks, work on dialplan editing. git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@64 06cd67b6-e706-0410-b29e-9de616bca6e9 --- dialplan.php | 71 ++++++++++++++++++++++++++++++++++++ index.php | 16 +++++++- lib/Shout.php | 21 +++++++++++ shout.webprj | 33 +++++++++-------- templates/dialplan/dialplanlist.inc | 2 +- themes/graphics/add-dialplan.gif | Bin 0 -> 83 bytes users.php | 36 +++++++++++++----- users/save.php | 7 +++- 8 files changed, 156 insertions(+), 30 deletions(-) create mode 100644 dialplan.php create mode 100644 themes/graphics/add-dialplan.gif diff --git a/dialplan.php b/dialplan.php new file mode 100644 index 000000000..dc1b5745a --- /dev/null +++ b/dialplan.php @@ -0,0 +1,71 @@ + + * + * 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 = "dialplan"; +$action = Util::getFormData("action"); +$extension = Util::getFormData("extension"); + +$contexts = $shout->getContexts(); +$vars = &Variables::getDefaultVariables(); + +if (!isset($context)) {#FIXME || !Shout::checkContext()) { + $url = Horde::applicationUrl("index.php"); + header("Location: $url"); + exit(0); +} + + +switch ($action) { + case "add": + $title = _("Add User"); + # Treat adds just like an empty edit + unset($extension); + $action = 'edit'; + break; + case "edit": + $title = _("Edit User (Extension") . "$extension)"; + break; + case "save": + $title = _("Save User (Extension") . "$extension)"; + break; + case "delete": + $title = _("Delete User (Extension") . "$extension)"; + break; + default: + $url = Horde::applicationUrl('/'); + header("Location: $url"); + exit(); +} + +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); + +require SHOUT_BASE . "/users/$action.php"; + +require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file diff --git a/index.php b/index.php index 5dbddfa4a..77088cea2 100644 --- a/index.php +++ b/index.php @@ -57,17 +57,29 @@ echo "
"; echo $tabs->render($section); switch ($section) { case "conference": + $title = _('Conferences'); + break; case "dialplan": + $title = _('Dial Plan'); + break; case "security": + $title = _('Security/Access Control'); + break; case "system": + $title = _('System Settings'); + break; case "users": + $title = _('Users'); + break; case "moh": - require "main/$section.php"; + $title = _('Music on Hold'); break; default: + require SHOUT_TEMPLATES . '/common-footer.inc'; + exit(); break; } - +require "main/$section.php"; require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file diff --git a/lib/Shout.php b/lib/Shout.php index c77182478..2b229fd64 100644 --- a/lib/Shout.php +++ b/lib/Shout.php @@ -49,6 +49,27 @@ class Shout $menu->add($url, _("$icontitle User"), "add-user.gif"); } + if (isset($context) && isset($section) && $section == "dialplan" && + Shout::checkRights("shout:contexts:$context:dialplan", + PERMS_EDIT, 1)) { + $url = Horde::applicationUrl("dialplan.php"); + $url = Util::addParameter($url, array('context' => $context, + 'section' => $section, + 'action' => 'add')); + + # Goofy hack to make the icon make a little sense + # when editing/deleting users + if (!isset($action)) { + $icontitle = "Add"; + } else { + $icontitle = $action; + $icontitle[0] = strtoupper($action[0]); + } + # End goofy hack + + $menu->add($url, _("$icontitle Extension"), "add-extension.gif"); + } + if ($returnType == 'object') { return $menu; } else { diff --git a/shout.webprj b/shout.webprj index 92f418811..d2c1d4f6a 100644 --- a/shout.webprj +++ b/shout.webprj @@ -12,14 +12,14 @@ - + - - + + @@ -28,7 +28,7 @@ - + @@ -48,22 +48,23 @@ - + - - + + + - + - + @@ -84,14 +85,14 @@ -//w3c//dtd xhtml 1.0 strict//en - + - + Ben Klang @@ -114,12 +115,14 @@ - - + + - - + + + + diff --git a/templates/dialplan/dialplanlist.inc b/templates/dialplan/dialplanlist.inc index ed09b0c87..a8ac3f8a3 100644 --- a/templates/dialplan/dialplanlist.inc +++ b/templates/dialplan/dialplanlist.inc @@ -47,7 +47,7 @@ $editurl = Util::addParameter($editurl, "section=dialplan"); $editurl = Util::addParameter($editurl, "extension=$extension"); ?> edit diff --git a/themes/graphics/add-dialplan.gif b/themes/graphics/add-dialplan.gif new file mode 100644 index 0000000000000000000000000000000000000000..c343e4b8e39393ab8cf15602c80776b26e54194a GIT binary patch literal 83 zcmZ?wbhEHb6k!lyXkcW30L7myKqe!D4u}hqVPMkY>02qjcRkM>ksZ7A{Hly!)+%0d eJlnY}^3=5c?t@c(E>6yEO5Ph?A)>*+U=0B13m4Y_ literal 0 HcmV?d00001 diff --git a/users.php b/users.php index d746f465b..0c6cbbf45 100644 --- a/users.php +++ b/users.php @@ -23,6 +23,7 @@ require_once SHOUT_BASE . '/lib/Shout.php'; $context = Util::getFormData("context"); $section = "users"; $action = Util::getFormData("action"); +$extension = Util::getFormData("extension"); $contexts = $shout->getContexts(); $vars = &Variables::getDefaultVariables(); @@ -33,23 +34,38 @@ 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": + $title = _("Add User"); # Treat adds just like an empty edit unset($extension); $action = 'edit'; + break; case "edit": + $title = _("Edit User (Extension") . "$extension)"; + break; case "save": + $title = _("Save User (Extension") . "$extension)"; + break; case "delete": - require SHOUT_BASE . "/users/$action.php"; + $title = _("Delete User (Extension") . "$extension)"; break; -} \ No newline at end of file + default: + $url = Horde::applicationUrl('/'); + header("Location: $url"); + exit(); +} + +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); + +require SHOUT_BASE . "/users/$action.php"; + +require $registry->get('templates', 'horde') . '/common-footer.inc'; \ No newline at end of file diff --git a/users/save.php b/users/save.php index 36c04bbc7..b2abc9786 100644 --- a/users/save.php +++ b/users/save.php @@ -18,7 +18,10 @@ $wereerrors = 0; $vars = &Variables::getDefaultVariables(); $formname = $vars->get('formname'); print_r($vars); -$title = _("System Settings"); $UserDetailsForm = &Horde_Form::singleton('UserDetailsForm', $vars); -$UserDetailsFormValid = $UserDetailsForm->validate($vars, true); \ No newline at end of file +$UserDetailsFormValid = $UserDetailsForm->validate($vars, true); +if (!$UserDetailsFormValid) { + # FIXME Handle invalid forms gracefully +} + -- 2.11.0