From 871b688d3cd1fb718da3ebbdb2dabfb4bf9eb6e3 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Mon, 12 Dec 2005 00:39:51 +0000 Subject: [PATCH] Working toward better compatibility with Congregation git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@159 06cd67b6-e706-0410-b29e-9de616bca6e9 --- andrew.webprj | 99 +++++++++++++++++++++++++++++----------------------------- lib/User.php | 2 +- lib/base.php | 14 +++++++-- users.php | 17 +++++----- users/edit.php | 66 ++++++++++++++++++++++++++++++++------- 5 files changed, 127 insertions(+), 71 deletions(-) diff --git a/andrew.webprj b/andrew.webprj index 3e4f4a22f..47c8598b9 100644 --- a/andrew.webprj +++ b/andrew.webprj @@ -4,51 +4,51 @@ -//w3c//dtd xhtml 1.0 strict//en - + - + - - - - - - - + + + + + + + - - - - + + + + - + - - - - + + + + - - - - - - + + + + + + - - - + + + - - - - - - - + + + + + + + @@ -111,22 +111,12 @@ templates/ toolbars/ - - - + + + - - - Ben Klang - ben@alkaloid.net - No Debugger - *~;CVS;.*~; - - - - - - + + @@ -138,5 +128,16 @@ + + Ben Klang + ben@alkaloid.net + No Debugger + *~;CVS;.*~; + + + + + + diff --git a/lib/User.php b/lib/User.php index d41f7fbdd..1b5e08a40 100644 --- a/lib/User.php +++ b/lib/User.php @@ -36,7 +36,7 @@ class UserDetailsForm extends Horde_Form { $this->addHidden('', 'curextension', 'text', true); $vars->set('curextension', $extension); $this->addHidden('', 'action', 'text', true); - $vars->set('action', 'save'); + $vars->set('action', 'edit'); $this->addVariable(_("Full Name"), 'name', 'text', true); $this->addVariable(_("Extension"), 'newextension', 'int', true); $this->addVariable(_("E-Mail Address"), 'email', 'text', true); diff --git a/lib/base.php b/lib/base.php index 182dfdba3..2b085d7ba 100644 --- a/lib/base.php +++ b/lib/base.php @@ -8,6 +8,7 @@ * script will need and sets up objects that all scripts use. */ + // Check for a prior definition of HORDE_BASE (perhaps by an // auto_prepend_file definition for site customization). if (!defined('HORDE_BASE')) { @@ -31,6 +32,15 @@ $conf = &$GLOBALS['conf']; // Find the base file path of Shout. @define('SHOUT_BASE', dirname(__FILE__) . '/..'); +// Ensure Shout is properly configured before use +$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' */)); +} + // Notification system. $notification = &Notification::singleton(); $notification->attach('status'); @@ -40,8 +50,8 @@ require_once SHOUT_BASE . '/lib/Shout.php'; require_once SHOUT_BASE . '/lib/Driver.php'; // Form libraries. -require_once 'Horde/Form.php'; -require_once 'Horde/Form/Renderer.php'; +// require_once 'Horde/Form.php'; +// require_once 'Horde/Form/Renderer.php'; // Variable handling libraries require_once 'Horde/Variables.php'; diff --git a/users.php b/users.php index ea902d7fc..ac25d917d 100644 --- a/users.php +++ b/users.php @@ -9,17 +9,18 @@ */ @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'; +// Form libraries. +require_once 'Horde/Form.php'; +require_once 'Horde/Form/Renderer.php'; + +// Variable handling libraries +require_once 'Horde/Variables.php'; +require_once 'Horde/Text/Filter.php'; + + $context = Util::getFormData("context"); $section = "users"; $action = Util::getFormData("action"); diff --git a/users/edit.php b/users/edit.php index 0d920ea17..cee202230 100644 --- a/users/edit.php +++ b/users/edit.php @@ -8,27 +8,71 @@ * did not receive this file, see http://www.horde.org/licenses/gpl.php. */ @define('SHOUT_BASE', dirname(__FILE__) . '/..'); +require_once SHOUT_BASE . '/lib/base.php'; require_once SHOUT_BASE . '/lib/User.php'; require_once 'Horde/Variables.php'; $RENDERER = &new Horde_Form_Renderer(); $empty = ''; +$beendone = 0; +$wereerrors = 0; $vars = &Variables::getDefaultVariables($empty); $formname = $vars->get('formname'); +$title = _("FIXME " . __FILE__.":".__LINE__); + $UserDetailsForm = &Horde_Form::singleton('UserDetailsForm', $vars); + $UserDetailsFormValid = $UserDetailsForm->validate($vars, true); -$UserDetailsForm->open($RENDERER, $vars, 'users.php', 'post'); -$vars->set('section', $section); -$UserDetailsForm->preserveVarByPost($vars, "section"); -// $UserDetailsForm->preserve($vars); -require SHOUT_TEMPLATES . '/table-limiter-begin.inc'; -$RENDERER->beginActive($UserDetailsForm->getTitle()); -$RENDERER->renderFormActive($UserDetailsForm, $vars); -$RENDERER->submit(); -$RENDERER->end(); -$UserDetailsForm->close($RENDERER); -require SHOUT_TEMPLATES . '/table-limiter-end.inc'; \ No newline at end of file +if (!$UserDetailsFormValid) { + $UserDetailsForm->open($RENDERER, $vars, 'users.php', 'post'); + $vars->set('section', $section); + $UserDetailsForm->preserveVarByPost($vars, "section"); + // $UserDetailsForm->preserve($vars); + $RENDERER->beginActive($UserDetailsForm->getTitle()); + $RENDERER->renderFormActive($UserDetailsForm, $vars); + $RENDERER->submit(); + $RENDERER->end(); + $UserDetailsForm->close($RENDERER); +} else { + +// require WHUPS_TEMPLATES . '/common-header.inc'; +// require WHUPS_TEMPLATES . '/menu.inc'; + $info = array(); + $UserDetailsForm->getInfo($vars, $info); + + $name = $info['name']; + $curextension = $info['curextension']; + $newextension = $info['newextension']; + $email = $info['email']; + $pin = $info['pin']; + + + $limits = $shout->getLimits($context, $curextension); + + $userdetails = array("newextension" => $newextension, + "name" => $name, + "pin" => $pin, + "email" => $email); + + $i = 1; + $userdetails['telephonenumbers'] = array(); + while ($i <= $limits['telephonenumbersmax']) { + $tmp = $info['telephone'.$i]; + if (!empty($tmp)) { + $userdetails['telephonenumbers'][] = $tmp; + } + $i++; + } + + $userdetails['dialopts'] = array(); + if ($info['moh']) { + $userdetails['dialopts'][] = 'm'; + } + if ($info['transfer']) { + $userdetails['dialopts'][] = 't'; + } +} \ No newline at end of file -- 2.11.0