Shout: catch and log some additional possible errors
authorBen Klang <ben@alkaloid.net>
Mon, 29 Mar 2010 02:32:47 +0000 (22:32 -0400)
committerBen Klang <ben@alkaloid.net>
Mon, 29 Mar 2010 02:32:47 +0000 (22:32 -0400)
shout/dialplan.php
shout/lib/Ajax/Application.php
shout/templates/dialplan/edit.inc

index f5d7c6f..9524a2d 100644 (file)
@@ -56,7 +56,8 @@ default:
         $conferences = $shout->storage->getConferences($curaccount);
         $soundfiles = $shout->getRecordings();
     } catch (Exception $e) {
-        $notification->push(_("Problem getting destination information."));
+        Horde::logMessage($e, 'ERR');
+        $notification->push(_("Problem getting menu information."));
     }
 
     break;
index bac80d1..b1ef8ba 100644 (file)
@@ -108,6 +108,9 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base
             $shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
             $account = $_SESSION['shout']['curaccount'];
             $menus = $shout->storage->getMenus($account);
+            if (empty($menus)) {
+                return false;
+            }
             foreach ($menus as $menu => $info) {
                 // Fill in the actions for each menu
                 $menus[$menu]['actions'] = $shout->dialplan->getMenuActions($account, $menu);
index 85c7436..d41551b 100644 (file)
@@ -336,11 +336,6 @@ function refreshMenu()
 {
     $('menuWorking').show();
     $('dialpadWorking').show();
-    curmenu = $('menu.select').value;
-    if (!curmenu || !menuInfo.get(curmenu)) {
-        // TODO Show an error of some kind
-        return false;
-    }
 
     $A(['1','2','3','4','5','6','7','8','9','0','star','octo']).each(function (digit){
         empty('digit_' + digit);
@@ -362,6 +357,14 @@ function refreshMenu()
         $('digit_' + digit).appendChild(span);
     })
 
+    if (!(menuInfo.size())) {
+        $('menuWorking').hide();
+        $('dialpadWorking').hide();
+        return true;
+    }
+
+    curmenu = $('menu.select').value;
+
     var text = document.createTextNode(menuInfo.get(curmenu).description);
     empty('menu.description');
     $('menu.description').appendChild(text);