From a5572581dfe25dfa93edda8d2bba1c2c4c0fdad2 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Sat, 2 Jan 2010 23:59:39 -0500 Subject: [PATCH] Shout: Continue working on destination edit form This won't work until ajax.php is fully implemented and the remaining JS bugs are quashed. But this is close to working.... --- shout/ajax.php | 44 ++++++++++++++ shout/templates/extensions/list.inc | 116 +++++++++++++++++++++++++++++++----- 2 files changed, 144 insertions(+), 16 deletions(-) create mode 100644 shout/ajax.php diff --git a/shout/ajax.php b/shout/ajax.php new file mode 100644 index 000000000..27b93f9ba --- /dev/null +++ b/shout/ajax.php @@ -0,0 +1,44 @@ + + * @since Shout 0.1 + * @package Shout + */ + +// Need to load Horde_Util:: to give us access to Horde_Util::getPathInfo(). +require_once dirname(__FILE__) . '/lib/Application.php'; +$action = basename(Horde_Util::getPathInfo()); +if (empty($action)) { + // This is the only case where we really don't return anything, since + // the frontend can be presumed not to make this request on purpose. + // Other missing data cases we return a response of boolean false. + exit; +} + +try { + new Shout_Application(); +} catch (Horde_Exception $e) { + /* Handle session timeouts when they come from an AJAX request. */ + if (($e->getCode() == Horde_Registry::AUTH_FAILURE) && + ($action != 'LogOut')) { + //FIXME: The below is certain to break since it relies on classes I did + // not yet copy from IMP. + $notification = Horde_Notification::singleton(); + $shout_notify = $notification->attach('status', array('viewmode' => 'dimp'), 'Shout_Notification_Listener_Status'); + $notification->push(str_replace('&', '&', Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'shout.timeout', array('content.raw')); + Horde::sendHTTPResponse(Horde::prepareResponse(null, $shout_notify), 'json'); + exit; + } + + Horde_Auth::authenticateFailure('shout', $e); +} + diff --git a/shout/templates/extensions/list.inc b/shout/templates/extensions/list.inc index 0915a5379..5ac07edd5 100644 --- a/shout/templates/extensions/list.inc +++ b/shout/templates/extensions/list.inc @@ -37,7 +37,7 @@ 'javascript:destinations("' . $extension . '");', + $attrs = array('onclick' => 'javascript:destinfo("' . $extension . '");', 'id' => 'destX' . $extension . 'toggle'); echo Horde::img('tree/plusonly.png', _("Destinations"), $attrs, $registry->getImageDir('horde')); @@ -54,21 +54,27 @@ } ?> - -
-
- +
\n"; + echo Horde::img('shout.png') . + " " . $device . "
\n"; } foreach ($info['numbers'] as $number) { - echo Horde::img('telephone-pole.png') . " " . $number . "
\n"; + echo Horde::img('telephone-pole.png') . + " " . $number . "
\n"; } ?> + + + + Add more destinations... +
- @@ -83,17 +89,77 @@ -- 2.11.0