]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Show confirm dialog when deleting an invite (if the user has already entered an email...
authorZach Copley <zach@status.net>
Wed, 11 May 2011 23:00:35 +0000 (16:00 -0700)
committerZach Copley <zach@status.net>
Wed, 11 May 2011 23:00:35 +0000 (16:00 -0700)
plugins/DomainWhitelist/DomainWhitelistPlugin.php
plugins/DomainWhitelist/js/whitelistinvite.js
plugins/DomainWhitelist/lib/whitelistinviteform.php

index e320fb2490731babaab6a6714e0c7e76454dc1df..9e1b31ef34a3445afc7e724ce75c2fb0829e6ef5 100644 (file)
@@ -248,11 +248,25 @@ class DomainWhitelistPlugin extends Plugin
      */
     function onStartShowInviteForm($action)
     {
+        $this->showConfirmDialog($action);
         $form = new WhitelistInviteForm($action, $this->getWhitelist());
         $form->show();
         return false;
     }
 
+    function showConfirmDialog($action)
+    {
+        // For JQuery UI modal dialog
+        $action->elementStart(
+            'div',
+            // TRANS: Title for invitiation deletion dialog.
+            array('id' => 'confirm-dialog', 'title' => _m('Confirmation Required'))
+        );
+        // TRANS: Confirmation text for invitation deletion dialog.
+        $action->text(_m('Really delete this invitation?'));
+        $action->elementEnd('div');
+    }
+
     /**
      * This is a bit of a hack. We take the values from the custom
      * whitelist invite form and reformat them so they look like
index d6a5a29eed95bb8c8246c0cb209f922c5aef4006..9a7193644583d70b237bf962acae4d3d13569f14 100644 (file)
@@ -27,14 +27,41 @@ SN_WHITELIST.addRow = function() {
 };
 
 SN_WHITELIST.removeRow = function() {
-    $(this).closest("li").hide("blind", "slow", function() {
-        $(this).remove();
-        SN_WHITELIST.updateButtons();
+
+    var that = this;
+
+    $("#confirm-dialog").dialog({
+        buttons : {
+            "Confirm" : function() {
+                $(this).dialog("close");
+                $(that).closest("li").hide("blind", "slow", function() {
+                    $(this).remove();
+                    SN_WHITELIST.updateButtons();
+                });
+            },
+            "Cancel" : function() {
+                $(this).dialog("close");
+            }
+        }
     });
+
+    if ($(this).closest('li').find(':input[name^=username]').val()) {
+        $("#confirm-dialog").dialog("open");
+    } else {
+        $(that).closest("li").hide("blind", "slow", function() {
+            $(this).remove();
+            SN_WHITELIST.updateButtons();
+        });
+    }
 };
 
 $(document).ready(function() {
+
+    $("#confirm-dialog").dialog({
+        autoOpen: false,
+        modal: true
+    });
+
     $('.add_row').live('click', SN_WHITELIST.addRow);
     $('.remove_row').live('click', SN_WHITELIST.removeRow);
 });
-
index 4928b88199669e70743896d8fe1c4eab4aa8f3dd..165d708b754886eec7e790811d3fceaece20c74e 100644 (file)
@@ -134,7 +134,7 @@ class WhitelistInviteForm extends Form
         $this->showMultiControls();
         $this->out->elementEnd('li');
     }
-    
+
     function showMultiControls()
     {
         $this->out->element(