From: Ben Klang Date: Fri, 2 Apr 2010 19:34:04 +0000 (-0400) Subject: Shout: Get rid of actions in favor of AJAX X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ca281d00a2292b79dce6d6781211df9c07b56a00;p=horde.git Shout: Get rid of actions in favor of AJAX --- diff --git a/shout/extensions.php b/shout/extensions.php index 073ebe918..e9b3acf1e 100644 --- a/shout/extensions.php +++ b/shout/extensions.php @@ -14,7 +14,6 @@ $shout = Horde_Registry::appInit('shout'); require_once SHOUT_BASE . '/lib/Forms/ExtensionForm.php'; -$action = Horde_Util::getFormData('action'); $curaccount = $_SESSION['shout']['curaccount']; $RENDERER = new Horde_Form_Renderer(); @@ -22,77 +21,6 @@ $RENDERER = new Horde_Form_Renderer(); $section = 'extensions'; $title = _("Extensions: "); -switch ($action) { -case 'add': -case 'edit': - $vars = Horde_Variables::getDefaultVariables(); - $vars->set('account', $curaccount['code']); - $Form = new ExtensionDetailsForm($vars); - - if ($Form->isSubmitted() && $Form->validate($vars, true)) { - // Form is Valid and Submitted - try { - $Form->execute(); - $notification->push(_("Extension information updated."), - 'horde.success'); - $action = 'list'; - } catch (Exception $e) { - $notification->push($e); - } - break; - } elseif ($Form->isSubmitted()) { - $notification->push(_("Problem processing the form. Please check below and try again."), 'horde.warning'); - } - - // Create a new add/edit form - $extension = Horde_Util::getFormData('extension'); - $extensions = $shout->extensions->getExtensions($curaccount['code']); - $vars = new Horde_Variables($extensions[$extension]); - if ($action == 'edit') { - $vars->set('oldextension', $extension); - } - $vars->set('action', $action); - //$Form = new ExtensionDetailsForm($vars); - // Make sure we get the right template below. - $action = 'edit'; - - break; - -case 'delete': - $title .= sprintf(_("Delete Extension %s"), $extension); - $extension = Horde_Util::getFormData('extension'); - - $vars = Horde_Variables::getDefaultVariables(); - $vars->set('account', $curaccount['code']); - $Form = new ExtensionDeleteForm($vars); - - $FormValid = $Form->validate($vars, true); - - if ($Form->isSubmitted() && $FormValid) { - try { - $Form->execute(); - $notification->push(_("Extension Deleted.")); - $action = 'list'; - } catch (Exception $e) { - $notification->push($e); - } - } elseif ($Form->isSubmitted()) { - // Submitted but not valid - $notification->push(_("Problem processing the form. Please check below and try again."), 'horde.warning'); - } - - $vars = Horde_Variables::getDefaultVariables(array()); - $vars->set('account', $curaccount['code']); - $Form = new ExtensionDeleteForm($vars); - - break; - -case 'list': -default: - $action = 'list'; - $title .= _("List Users"); -} - // Fetch the (possibly updated) list of extensions try { @@ -104,12 +32,13 @@ try { Horde::addScriptFile('stripe.js', 'horde'); Horde::addScriptFile('prototype.js', 'horde'); +Horde::addScriptFile('scriptaculous.js', 'horde'); require SHOUT_TEMPLATES . '/common-header.inc'; require SHOUT_TEMPLATES . '/menu.inc'; $notification->notify(); -require SHOUT_TEMPLATES . '/extensions/' . $action . '.inc'; +require SHOUT_TEMPLATES . '/extensions.inc.php'; require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/shout/templates/extensions.inc.php b/shout/templates/extensions.inc.php new file mode 100644 index 000000000..955827112 --- /dev/null +++ b/shout/templates/extensions.inc.php @@ -0,0 +1,547 @@ +
+ Account: +
+ +
+ + + + + + $info) { + + $url = Horde::applicationUrl("extensions.php"); + $url = Horde_Util::addParameter($url, + array( + 'extension' => $extension, + ) + ); + $editurl = Horde_Util::addParameter($url, 'action', 'edit'); + $deleteurl = Horde_Util::addParameter($url, 'action', 'delete'); + ?> + + + + + +
ExtensionDestinations
+ '; + ?> + + 'showDetail("' . $extension . '");', + 'id' => 'destX' . $extension . 'toggle'); + echo Horde::img('tree/plusonly.png', _("Destinations"), $attrs); + ?> + +
+
+
+ + +
+
+
Add Extension
+ + + + + + + + + + + + + + + + + + +
+ * Full Name + + +
+ * Extension + + +
+ * E-Mail Address + + +
+ * PIN + + +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/shout/templates/extensions/delete.inc b/shout/templates/extensions/delete.inc deleted file mode 100644 index 217ef0607..000000000 --- a/shout/templates/extensions/delete.inc +++ /dev/null @@ -1,3 +0,0 @@ -Extension: get('extension'); ?>
-renderActive($RENDERER, $vars, Horde::applicationUrl('extensions.php'), 'post'); diff --git a/shout/templates/extensions/edit.inc b/shout/templates/extensions/edit.inc deleted file mode 100644 index ce74225d7..000000000 --- a/shout/templates/extensions/edit.inc +++ /dev/null @@ -1,10 +0,0 @@ -renderActive($RENDERER, $vars, Horde::applicationUrl('extensions.php'), 'post'); - -if ($vars->get('action') == 'edit') { - $deleteUrl = Horde::applicationUrl('extensions.php'); - $params = array ('action' => 'delete', - 'extension' => $extension); - $deleteUrl = Horde_Util::addParameter($deleteUrl, $params); - echo 'Delete Extension'; -} diff --git a/shout/templates/extensions/list.inc b/shout/templates/extensions/list.inc deleted file mode 100644 index 920713ee5..000000000 --- a/shout/templates/extensions/list.inc +++ /dev/null @@ -1,526 +0,0 @@ -
- Account: -
- -
- - - - - - $info) { - - $url = Horde::applicationUrl("extensions.php"); - $url = Horde_Util::addParameter($url, - array( - 'extension' => $extension, - ) - ); - $editurl = Horde_Util::addParameter($url, 'action', 'edit'); - $deleteurl = Horde_Util::addParameter($url, 'action', 'delete'); - ?> - - - - - -
ExtensionDestinations
- - - 'showDetail("' . $extension . '");', - 'id' => 'destX' . $extension . 'toggle'); - echo Horde::img('tree/plusonly.png', _("Destinations"), $attrs); - ?> - -
-
- - -
-
Add Extension
- - - - - - - - - - - - - - - - - -
- * Full Name - - -
- * Extension - - -
- * E-Mail Address - - -
- * PIN - - -
-
- -
-
- -