diff options
| author | sostler <sbostler@gmail.com> | 2010-04-13 07:30:34 -0400 |
|---|---|---|
| committer | sostler <sbostler@gmail.com> | 2010-04-13 07:30:34 -0400 |
| commit | d0bd678ff36fed7cf492b89542588b82efafb938 (patch) | |
| tree | 4906c63e6cc0775768bdfb2df43fa2f7477afaeb /static/js | |
| parent | 24531004162e9acfb9acd5c8800bf0ca075099b8 (diff) | |
Added initial muting
Diffstat (limited to 'static/js')
| -rw-r--r-- | static/js/admin.js | 37 | ||||
| -rw-r--r-- | static/js/pichat.js | 2 |
2 files changed, 21 insertions, 18 deletions
diff --git a/static/js/admin.js b/static/js/admin.js index a5a5f71..e6bef70 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -26,7 +26,7 @@ Admin.mute = function(nick) { .append(reason) .appendTo($(Admin._dialogHtml)); var title = 'Mute ' + nick; - var cancel = function() { html.dialog('close'); } + var close = function() { html.dialog('close'); } var submit = function() { html.find('[name]').removeClass('ui-state-error'); @@ -34,26 +34,29 @@ Admin.mute = function(nick) { var u = unit.val(); var r = reason.val(); - if (!t) { - time.addClass('ui-state-error'); - } + if (!t) { time.addClass('ui-state-error'); } + if (!u) { reason.addClass('ui-state-error'); } + if (!r) { reason.addClass('ui-state-error'); } + if (!t || !u || !r) { return; } - if (!u) { - reason.addClass('ui-state-error'); - } - - if (!r) { - reason.addClass('ui-state-error'); - } - - if (!t || !u || !r) { - return; - } + $.ajax({ + type: 'POST', + timeout: 5000, + url: '/mute', + cache: false, + data: { 'time': t, 'unit': u, + 'reason': r, 'nick': nick }, + success: close, + error: function(s) { + alert("Error muting user: " + s.responseText); + } + }); }; html.dialog({ - modal: true, + modal: false, title: title, width: 400, - buttons: { 'OK': submit , 'Cancel': cancel } + buttons: { 'OK': submit , 'Cancel': close } }); + html.dialog('open'); };
\ No newline at end of file diff --git a/static/js/pichat.js b/static/js/pichat.js index d6af36f..d52212d 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -221,7 +221,7 @@ function handleMsgError(resp) { if (respText == 'MUST_LOGIN') { alert("Can't send message! Please login."); } else if (respText) { - alert("Can't send message! (" + respText + ")"); + alert("Can't send message! " + respText); } else { alert("Can't send message!"); } |
