Shout: Add cancel button for editActionForm
authorBen Klang <ben@alkaloid.net>
Tue, 9 Mar 2010 04:41:04 +0000 (23:41 -0500)
committerBen Klang <ben@alkaloid.net>
Tue, 9 Mar 2010 04:41:35 +0000 (23:41 -0500)
shout/templates/dialplan/edit.inc
shout/themes/screen.css

index 01712fc..c51ca0d 100644 (file)
@@ -38,7 +38,7 @@ var curDigit = null;
 function editAction(digit)
 {
     if ($('selectActionForm') == null) {
-        curDigit = digit;
+        var curDigit = digit;
         $('digitGraphic').src = '<?php echo Horde_Themes::img() ?>/digit-'+digit+'.png';
 
         // Draw the selectActionForm
@@ -63,6 +63,15 @@ function editAction(digit)
         });
         form.appendChild(select);
         $('selectAction').appendChild(form);
+
+        // Cancel button
+        var span = document.createElement('span');
+        span.id = 'cancelAction';
+        span.setAttribute('onclick', 'cancelEdit()');
+        var text = document.createTextNode('<?php echo _("Cancel"); ?>');
+        span.appendChild(text);
+        $('selectAction').appendChild(span);
+        
     } else {
         var action = null;
         // Draw the options for this action
@@ -94,10 +103,28 @@ function saveAction(digit)
             empty('selectAction');
             empty('editAction');
             $('editActionOverlay').hide();
+            new Ajax.Request(ajax_url + 'getMenuInfo',
+            {
+                method: 'post',
+                parameters: $H({
+                    'menu': menu
+                }),
+                onSuccess: function(r) {
+                    menuInfo = $H(r.responseJSON.response);
+                    refreshMenu();
+                }
+            });
         }
     });
 }
 
+function cancelEdit()
+{
+    empty($('selectAction'));
+    empty($('editAction'));
+    $('editActionOverlay').hide();
+}
+
 function changeSoundfile()
 {
     alert("Changing soundfile");
index 68e770c..c37f150 100644 (file)
@@ -139,6 +139,14 @@ ul {
     background-image: url('graphics/transparency.png');
 }
 
+#cancelAction {
+    position: absolute;
+    bottom: 5px;
+    right: 50px;
+    cursor: pointer;
+    text-decoration: underline;
+}
+
 #digitGraphic {
     float: left;
     margin: 0px 5px 5px 5px;
@@ -157,4 +165,9 @@ ul {
 {
     text-align: right;
     font-style: italic;
+}
+
+.buttonDetail
+{
+    text-align: center;
 }
\ No newline at end of file