From: Ben Klang Date: Fri, 27 Jan 2006 06:21:14 +0000 (+0000) Subject: Stabilizing featureset. User mod form now at least renders correctly. Still need... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0736813c5c46adac2a59259ee462551d24ada9a1;p=horde.git Stabilizing featureset. User mod form now at least renders correctly. Still need to add post-processing git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@267 06cd67b6-e706-0410-b29e-9de616bca6e9 --- diff --git a/TODO b/TODO new file mode 100644 index 000000000..c53e828b7 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +* Convert forms to Beatnik style associative arrays. 2006-01-26 bklang diff --git a/andrew.session b/andrew.session index 263f3d91e..20026bd22 100644 --- a/andrew.session +++ b/andrew.session @@ -60,62 +60,62 @@ - - - + + + - - + + - - + + - - - - - - + + + + + + - + - + - - + + - - + + - + - + - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - + + + + diff --git a/andrew.webprj b/andrew.webprj index d31d03d4e..67f531a5a 100644 --- a/andrew.webprj +++ b/andrew.webprj @@ -1,45 +1,45 @@ - + -//w3c//dtd xhtml 1.0 strict//en - + - + - - - - - - - + + + + + + + - + - + - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + @@ -102,12 +102,11 @@ templates/ toolbars/ - - - + + - - + + @@ -130,14 +129,14 @@ - - - - - - - - - + + + + + + + + + diff --git a/lib/User.php b/lib/User.php index 55d3f2e6f..3085ae37c 100644 --- a/lib/User.php +++ b/lib/User.php @@ -60,13 +60,15 @@ class UserDetailsForm extends Horde_Form { $this->addVariable(_("Explicit Call Acceptance"), 'eca', 'boolean', true, false);#, _("When checked, the called user will be required to press 1 to accept the call. Only turn this off if you really know what you're doing!")); $this->addVariable(_("Call Appearance"), 'callappearance', - 'radio', true, false, null, array('values' => + 'radio', $vars->get('eca'), false, null, array('values' => array('caller' => 'From Calling Party', 'self' => 'From Self', - 'v-office' => 'From V-Office', + 'switch' => 'From V-Office', ) ) ); + + return true; } // {{{ fillUserForm method @@ -95,35 +97,42 @@ class UserDetailsForm extends Horde_Form { $i++; } - if (in_array('m', $userdetails['dialopts'])) { - $vars->set('moh', true); - } else { - $vars->set('moh', false); - } + $vars->set('moh', false); + $vars->set('eca', false); + $vars->set('transfer', false); + $vars->set('callappearance', 'caller'); - if (in_array('t', $userdetails['dialopts'])) { - $vars->set('transfer', true); - } else { - $vars->set('transfer', false); - } - if (in_array('e', $userdetails['dialopts'])) { - $vars->set('eca', true); - } else { - $vars->set('eca', false); - } + foreach ($userdetails['dialopts'] as $opt) { + if ($opt == 'm') { + $vars->set('moh', true); + } + if ($opt == 't') { + $vars->set('transfer', true); + } + if (preg_match('/^e(\(.*\))*/', $opt, $matches)) { + # This matches 'e' and 'e(ARGS)' + $vars->set('eca', true); + if (count($matches) > 1) { + # We must have found an argument + switch($matches[1]) { + case '(${VOFFICENUM})': + $vars->set('callappearance', 'switch'); + break; - if (in_array('e(${VOFFICENUM})', $userdetails['dialopts'])) { - $vars->set('eca', true); - $vars->set('callappearance', 'v-office'); - } elseif (in_array('e(${CALLER})', $userdetails['dialopts'])) { - $vars->set('eca', true); - $vars->set('callappearance', 'caller'); - } elseif (in_array('e(${SELF})', $userdetails['dialopts'])) { - $vars->set('eca', true); - $vars->set('callappearance', 'self'); - } + case '(${CALLERANI})': + $vars->set('callappearance', 'self'); + break; + case '(${CALLERIDNUM})': + default: + $vars->set('callappearance', 'caller'); + break; + + } + } + } + } return true; } // }}} diff --git a/usermgr.php b/usermgr.php index 1af7ee5be..f4029ddec 100644 --- a/usermgr.php +++ b/usermgr.php @@ -28,13 +28,13 @@ switch ($action) { unset($extension); break; case "edit": - $title .= _("Edit User (Extension") . "$extension)"; + $title .= _("Edit User (Extension ") . "$extension)"; break; case "save": - $title .= _("Save User (Extension") . "$extension)"; + $title .= _("Save User (Extension ") . "$extension)"; break; case "delete": - $title .= _("Delete User (Extension") . "$extension)"; + $title .= _("Delete User (Extension ") . "$extension)"; break; case "list": default: diff --git a/usermgr/edit.php b/usermgr/edit.php index 321dbe642..d069872ee 100644 --- a/usermgr/edit.php +++ b/usermgr/edit.php @@ -23,28 +23,34 @@ $wereerrors = 0; $vars = &Variables::getDefaultVariables($empty); $formname = $vars->get('formname'); -$title = _("FIXME " . __FILE__.":".__LINE__); +$Form = &Horde_Form::singleton('UserDetailsForm', $vars); -$UserDetailsForm = &Horde_Form::singleton('UserDetailsForm', $vars); +$FormValid = $Form->validate($vars, true); -$UserDetailsFormValid = $UserDetailsForm->validate($vars, true); +if ($Form->isSubmitted()) { + $notification->push('Submitted.', 'horde.message'); +} +if ($FormValid) { + $notification->push('Valid.', 'horde.message'); +} +$notification->notify(); -if (!$UserDetailsFormValid) { - $UserDetailsForm->open($RENDERER, $vars, 'users.php', 'post'); +if (!$FormValid || !$Form->isSubmitted()) { + # Display the form for editing + $Form->open($RENDERER, $vars, 'usermgr.php', 'post'); $vars->set('section', $section); - $UserDetailsForm->preserveVarByPost($vars, "section"); - // $UserDetailsForm->preserve($vars); - $RENDERER->beginActive($UserDetailsForm->getTitle()); - $RENDERER->renderFormActive($UserDetailsForm, $vars); + $Form->preserveVarByPost($vars, "section"); + // $Form->preserve($vars); + $RENDERER->beginActive($Form->getTitle()); + $RENDERER->renderFormActive($Form, $vars); $RENDERER->submit(); $RENDERER->end(); - $UserDetailsForm->close($RENDERER); + $Form->close($RENDERER); } else { + # Process the Valid and Submitted form -// require WHUPS_TEMPLATES . '/common-header.inc'; -// require WHUPS_TEMPLATES . '/menu.inc'; $info = array(); - $UserDetailsForm->getInfo($vars, $info); + $Form->getInfo($vars, $info); $name = $info['name']; $curextension = $info['curextension'];