From: Ben Klang Date: Sat, 3 Apr 2010 01:51:56 +0000 (-0400) Subject: Shout: re-active the wizard. It works! X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=85179dd9e6527c041a1828334b8a2f88e7e71ad4;p=horde.git Shout: re-active the wizard. It works! --- diff --git a/shout/lib/Forms/NumberForm.php b/shout/lib/Forms/NumberForm.php index e6c5d4fd2..fbd3198be 100644 --- a/shout/lib/Forms/NumberForm.php +++ b/shout/lib/Forms/NumberForm.php @@ -50,7 +50,7 @@ class NumberDetailsForm extends Horde_Form { $accountcode = $vars->get('accountcode'); if (!empty($accountcode)) { $menus = $shout->storage->getMenus($accountcode); - $list = array(); + $list = array('' => '-- None --'); foreach ($menus as $id => $info) { $list[$id] = $info['name']; } diff --git a/shout/lib/Shout.php b/shout/lib/Shout.php index 27796cb18..e9d6ab1c2 100644 --- a/shout/lib/Shout.php +++ b/shout/lib/Shout.php @@ -242,19 +242,19 @@ class Shout static public function getAdminTabs() { - $tabname = Horde_Util::getFormData('tabname'); + $tabname = Horde_Util::getFormData('view'); $tabs = new Horde_Ui_Tabs('view', Horde_Variables::getDefaultVariables()); $tabs->addTab(_("Telephone Numbers"), Horde::applicationUrl('admin/numbers.php'), - array('tabname' => 'numbers', id => 'tabnumbers')); + array('view' => 'numbers', id => 'tabnumbers')); $tabs->addTab(_("Accounts"), Horde::applicationUrl('admin/accounts.php'), - array('tabname' => 'accounts', id => 'tabaccounts')); - if ($tabname === null) { - $tabname = 'numbers'; + array('view' => 'accounts', id => 'tabaccounts')); + if ($view === null) { + $view = 'numbers'; } - echo $tabs->render($tabname); + echo $tabs->render($view); } } diff --git a/shout/templates/wizard.inc b/shout/templates/wizard.inc index f1daff70d..d5ef4fedf 100644 --- a/shout/templates/wizard.inc +++ b/shout/templates/wizard.inc @@ -11,7 +11,7 @@

Step 1: Create your company greeting

    -
  1. Call your new number: FIXME
  2. +
  3. Call your new number:
  4. When you hear the default greeting, press the star key, "*".
  5. When prompted, enter your admin PIN: .
  6. Press 1 to manage recordings.
  7. diff --git a/shout/wizard.php b/shout/wizard.php index 4f5250e54..6f7f6e2a2 100644 --- a/shout/wizard.php +++ b/shout/wizard.php @@ -14,38 +14,54 @@ $shout = Horde_Registry::appInit('shout'); require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php'; try { - // Only continue if there is no existing "Main Menu" $curaccount = $_SESSION['shout']['curaccount']; + + // Only continue if there is an assigned phone number + $numbers = $shout->storage->getNumbers($curaccount['code']); + if (empty($numbers)) { + throw new Shout_Exception("No valid numbers on this account."); + } + // Grab the first available number + $number = reset($numbers); + $number = $number['number']; + + // Only continue if there is no existing "Main Menu" $menus = $shout->storage->getMenus($curaccount['code']); -// if (!empty($menus) && !empty($menus[Shout::MAIN_MENU])) { -// header('Location: ' . Horde::applicationUrl('dialplan.php', true)); -// exit; -// } -// -// // Create the default recording for the main menu -// try { -// $recording = $shout->storage->getRecordingByName($curaccount['code'], -// Shout::MAIN_RECORDING); -// } catch (Shout_Exception $e) { -// $shout->storage->addRecording($curaccount['code'], Shout::MAIN_RECORDING); -// $recording = $shout->storage->getRecordingByName($curaccount['code'], -// Shout::MAIN_RECORDING); -// } -// -// // Create a default main menu -// $details = array( -// 'name' => Shout::MAIN_MENU, -// 'description' => _("Main menu: what your callers will hear."), -// 'recording_id' => $recording['id'] -// ); -// $shout->dialplan->saveMenuInfo($curaccount['code'], $details); -// // Populate the default option, granting the ability to log into the admin -// // section. -// $shout->dialplan->saveMenuAction($curaccount['code'], Shout::MAIN_MENU, -// 'star', 'admin_login', array()); + if (!empty($menus) && !empty($menus[Shout::MAIN_MENU])) { + header('Location: ' . Horde::applicationUrl('dialplan.php', true)); + exit; + } + + // Create the default recording for the main menu + try { + $recording = $shout->storage->getRecordingByName($curaccount['code'], + Shout::MAIN_RECORDING); + } catch (Shout_Exception $e) { + $shout->storage->addRecording($curaccount['code'], Shout::MAIN_RECORDING); + $recording = $shout->storage->getRecordingByName($curaccount['code'], + Shout::MAIN_RECORDING); + } + + // Create a default main menu + $details = array( + 'name' => Shout::MAIN_MENU, + 'description' => _("Main menu: what your callers will hear."), + 'recording_id' => $recording['id'] + ); + $shout->dialplan->saveMenuInfo($curaccount['code'], $details); + + // Associate this menu with the first number. + // FIXME: This could be disruptive. + $shout->storage->saveNumber($number, $curaccount['code'], Shout::MAIN_MENU); + + // Populate the default option, granting the ability to log into the admin + // section. + $shout->dialplan->saveMenuAction($curaccount['code'], Shout::MAIN_MENU, + 'star', 'admin_login', array()); $extensions = $shout->extensions->getExtensions($curaccount['code']); } catch (Exception $e) { + print_r($e); $notification->push($e); }