cloud.js 23.2 KB
Newer Older
1 2
var toggleDetails;
$(function() {
3
    toggleDetails = function() {
4 5 6 7
        try {
            if ($(this).parent('.entry').hasClass('opened')) {
                $(this).parent('.entry').removeClass('opened');
                $(this).next('.details').css('height', '0px');
Bence Dányi committed
8
            } else {
9 10 11 12 13 14 15
                $(this).parent('.entry').addClass('opened');
                if ($(this).data('fallback') == 'slide') {
                    $(this).next('.details').css('height', 'auto');
                } else {
                    $(this).next('.details').css('height',
                        $(this).next('.details').find('.details-container')[0].offsetHeight + 15 + 'px');
                }
Bence Dányi committed
16
            }
17 18
        } catch(ex) {
            //make sure we never fail :-)
19
        }
20
    }
21 22
    $('a[href=#]').click(function(e) {
        e.preventDefault();
23
    });
Bence Dányi committed
24
    $('.host-toggle').click(function(e) {
25
        e.preventDefault();
Bence Dányi committed
26
        if ($(this).find('.v4').is(':hidden')) {
27 28 29 30 31 32 33 34 35 36
            $(this).find('.v4').show();
            $(this).find('.v6').hide();
            $(this).parent().next().find('.host').show();
            $(this).parent().next().find('.ipv4host').hide();
        } else {
            $(this).find('.v6').show();
            $(this).find('.v4').hide();
            $(this).parent().next().find('.host').hide();
            $(this).parent().next().find('.ipv4host').show();
        }
37
    });
38 39 40
    $('a[href!=#]').click(function(e) {
        e.stopPropagation();
    });
41 42 43
    $('.delete-template').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
44
        delete_template_confirm($(this).data('url'), $(this).data('id'), $(this).data('name'));
45 46 47 48 49 50 51 52 53
    });
    $('.delete-key').click(function(e) {
        var id = $(this).data('id');
        e.preventDefault();
        e.stopPropagation();
        vm_confirm_popup(gettext('Are you sure deleting key?'), gettext('Delete'), function() {
            $.ajax({
                'type': 'POST',
                'data': 'id=' + id,
54
                'url': $(this).data('url'),
55 56 57 58 59 60
                'success': function() {
                    $('#key-' + id).slideUp(700);
                }
            });
        });
    });
Dányi Bence committed
61 62
    $('#reset-key').click(function(e) {
        vm_confirm_popup(gettext('Are you sure about reseting store credentials?<br /> You will lose your access to your store account on your existing virtual machines!'), gettext('Reset'), function() {
63 64
            $.ajax({
                type: 'POST',
65
                url: $(this).data('url'),
Dányi Bence committed
66
                success: function() {
67 68 69 70 71 72
                    window.location.reload();
                }
            })
        });
    });
    $('.entry .summary').click(toggleDetails);
Dányi Bence committed
73
    if (window.navigator.userAgent.indexOf('cloud-gui') < 0) {
74 75 76 77 78 79 80 81 82 83 84 85 86 87
        $('.connect-vm').click(function(e) {
            e.preventDefault();
            e.stopPropagation();
            get_vm_details($(this).data('id'));
        });
    } else {
        $('.connect-vm').click(function(e) {
            e.stopPropagation();
        });
    }
    $('.rename-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        var id = $(this).data('id');
88
        var handler = arguments.callee;
89
        var oldName = $(this).data('name');
90
        var content = $('#vm-' + id + '-name').html();
Bence Dányi committed
91
        var self = this;
Bence Dányi committed
92
        var url = $(this).data('url');
Bence Dányi committed
93 94
        $('#vm-' + id).addClass('editing');
        $(this).unbind('click').click(function(e) {
95 96 97 98 99
            e.preventDefault();
            e.stopPropagation();
            $(this).unbind('click').click(handler);
            $('#vm-' + id + '-name-details').show();
            $('#vm-' + id + '-name').html(content);
Bence Dányi committed
100
            $('#vm-' + id).removeClass('editing');
101
        })
102 103
        $('#vm-' + id + '-name-details').hide();
        $('#vm-' + id + '-name').html('<input type="text" value="' + oldName + '" />\
Bence Dányi committed
104
<input type="submit" value="' + gettext('Rename') + '" data-url="' + url + '"/>');
105 106 107 108 109 110 111 112 113 114 115 116
        $('#vm-' + id + '-name').find('input[type="text"]').click(function(f) {
            f.preventDefault();
            f.stopPropagation();
        }).focus();
        $('#vm-' + id + '-name').find('input[type=submit]').click(function(f) {
            f.preventDefault();
            f.stopPropagation();
            var newName = $(this).prev().val();
            $.ajax({
                type: 'POST',
                data: 'name=' + newName,
                dataType: 'json',
117
                url: $(this).data('url'),
118 119 120
                success: function(data) {
                    $('#vm-' + id + '-name-details').removeAttr('style');
                    $('#vm-' + id + '-name').text(data.name);
121
                    $(self).click(handler);
122
                    $(self).data('name', newName);
Bence Dányi committed
123
                    $('#vm-' + id).removeClass('editing');
124 125 126 127 128 129 130
                }
            });
        })
    });
    $('.try-template').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
131
        new_vm($(this).data('url'));
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
    });
    $('.stop-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        stop_vm($(this).data('id'), $(this).data('name'));
    });
    $('.resume-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        manage_vm($(this).data('id'), "resume");
    });
    $('.delete-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        delete_vm($(this).data('id'), $(this).data('name'));
    });
    $('.restart-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        restart_vm($(this).data('id'), $(this).data('name'));
    });
153
    $('.entry').on('click', '.renew-suspend-vm', function(e) {
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
        e.preventDefault();
        e.stopPropagation();
        renew_suspend_vm($(this).data('id'))
    });
    $('.renew-delete-vm').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        renew_delete_vm($(this).data('id'))
    });
    $('#new-vm-button').click(function() {
        $('#modal').show();
        $('#modal-container').html($('#new-vm').html());
        $('#modal-container .entry .summary').click(toggleDetails);
    });
    $('#new-template-button').click(function() {
169
        $.get($(this).data('url'), function(data) {
170 171 172 173
            $('#modal-container').html(data);
        })
        $('#modal').show();
    });
Bence Dányi committed
174
    $('.edit-template').click(function(e) {
175 176
        e.preventDefault();
        e.stopPropagation();
Bence Dányi committed
177
        var id = $(this).data('id');
178 179
        $.ajax({
            type: 'GET',
180
            url: $(this).data('url'),
Bence Dányi committed
181
            success: function(data) {
182 183 184 185
                $('#modal').show();
                $('#modal-container').html(data);
            }
        });
186
    });
187 188 189 190 191 192 193 194 195 196 197 198
    $('#shadow').click(function() {
        $('#modal').hide();
        $('#modal-container').html('');
    })
    $('.template-share').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        $.get('/ajax/share/' + $(this).data('id') + '/' + $(this).data('gid'), function(data) {
            $('#modal-container').html(data);
        })
        $('#modal').show();
    });
Dányi Bence committed
199
    $('.template-unshare').click(function(e) {
200 201 202 203 204 205 206 207 208 209 210 211
        e.stopPropagation();
    });
    $('#old-upload').click(function(e) {
        e.preventDefault();
        $(this).parent().parent().hide().parent().find('#old-upload-form').show();
        return false;
    });
    $('.quota .used').each(function() {
        var s = this;
        $(this).css('backgroundColor', function(w) {
            return 'hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 50%, 0.2)';
        }($(this)[0].style.width));
Dányi Bence committed
212
        if (parseInt($(this).css('width')) > 0) $(this).css('borderRight', function(w) {
213 214 215 216 217 218 219 220 221 222 223 224 225
            return '1px solid hsla(' + (120 - parseFloat(w) / 100 * 120).toFixed(0) + ', 100%, 30%, 0.4)';
        }($(this)[0].style.width));
    });
    $('#new-folder').click(function() {
        $('#new-folder-form input')[0].focus();
    });
    $('#new-group').click(function() {
        var content = $('#new-group-wizard').html();
        $('#new-group-wizard').html('');
        $('#modal').show();
        $('#modal-container').html(content);
        $('#shadow').click(function() {
            $('#new-group-wizard').html(content);
226 227 228 229 230
        });
        $('#modal .prev').click(function() {
            $('#modal').hide();
            $('#new-group-wizard').html(content);
        });
231 232 233 234 235 236 237 238 239 240 241 242 243 244

        function updateSummary() {
            $('#new-group-summary-name').html($('#new-group-name').val());
            $('#new-group-summary-count').html(function(text) {
                var m = text.match(/\s*[a-z][0-9a-z]{5}\s*(\r|\n|$)+/gi);
                return m ? m.length : 0;
            }($('#new-group-members').val()));
            $('#new-group-summary-semester').html($('#new-group-semester')[0].options[$('#new-group-semester')[0].selectedIndex].innerHTML)
        }
        $('#new-group-name').change(updateSummary);
        $('#new-group-semester').change(updateSummary);
        $('#new-group-members').change(updateSummary);
    });
    $('.hidden-password').click(function() {
Dányi Bence committed
245
        if ($(this).attr('type') == 'password') {
246 247
            $(this).attr('type', 'text');
            $(this).addClass('shown');
248
            this.select();
Dányi Bence committed
249
        } else if (this.selectionStart - this.selectionEnd == 0) {
250 251 252 253
            $(this).attr('type', 'password');
            $(this).removeClass('shown');
        }
    });
Dányi Bence committed
254 255 256 257 258 259
    $('.shares li').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        e = $(this);
        if (!e.hasClass('description')) {
            if (e.next().is(':hidden')) {
260 261 262 263 264 265 266
                e.next().slideDown(700);
            } else {
                e.next().slideUp(700);
            }
        } else {
            e.slideUp(700);
        }
267
    });
Dányi Bence committed
268 269 270
    $('.shares .edit').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
271 272
        $.ajax({
            type: 'GET',
273
            url: $(this).data('url'),
Dányi Bence committed
274
            success: function(data) {
275 276 277 278
                $('#modal').show();
                $('#modal-container').html(data);
            }
        })
279
    })
280 281 282 283

    // manually open details of the selected vm
    $('.selected-summary').click();

284 285 286 287 288 289 290
    /**
     * Connect button new window
     */

    function get_vm_details(id) {
        $.get('/vm/credentials/' + id, function(data) {
            $('#modal-container').html(data);
Bence Dányi committed
291
            $('#modal-container .host-toggle').click(function(e) {
292
                e.preventDefault();
Bence Dányi committed
293
                if ($(this).find('.v4').is(':hidden')) {
294 295 296 297 298 299 300 301 302 303 304
                    $(this).find('.v4').show();
                    $(this).find('.v6').hide();
                    $(this).parent().next().find('.host').show();
                    $(this).parent().next().find('.ipv4host').hide();
                } else {
                    $(this).find('.v6').show();
                    $(this).find('.v4').hide();
                    $(this).parent().next().find('.host').hide();
                    $(this).parent().next().find('.ipv4host').show();
                }
            });
305
            $('#modal-container .hidden-password').click(function() {
Dányi Bence committed
306
                if ($(this).attr('type') == 'password') {
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
                    $(this).attr('type', 'text');
                    $(this).addClass('shown');
                } else {
                    $(this).attr('type', 'password');
                    $(this).removeClass('shown');
                }
            })
        })
        $('#modal').show();
    };
    /**
     * Confirm pop-up window
     */

    function vm_confirm_popup(confirm_message, button_text, success) {
        $('#modal').show();
        $('#modal-container').html(confirm_message + '<br /><input class="ok" type="button" value="' + button_text + '" style="float: left"/><input class="cancel" type="button" value="' + gettext('Cancel') + '" style="float: right" />');
        $('#modal-container .ok').click(function() {
            $('#modal').hide();
            success();
        });
        $('#modal-container .cancel').click(function() {
            $('#modal').hide();
        });
    }
332

Bence Dányi committed
333
    cloud.confirm = vm_confirm_popup;
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
    /**
     * Manage VM State (STOP)
     */

    function stop_vm(id, name) {
        confirm_message = interpolate(gettext("Are you sure stopping %s?"), ["<strong>" + name + "</strong>"])
        vm_confirm_popup(confirm_message, gettext("Stop"), function() {
            manage_vm(id, "stop")
        });
    }
    /**
     * Manage VM State (DELETE)
     */

    function delete_vm(id, name) {
        confirm_message = interpolate(gettext("Are you sure deleting %s?"), ["<strong>" + name + "</strong>"])
        vm_confirm_popup(confirm_message, gettext("Delete"), function() {
            manage_vm(id, "delete")
        })
    }
    /**
     * Manage VM State (RESET)
     */

    function restart_vm(id, name) {
        confirm_message = interpolate(gettext("Are you sure restarting %s?"), ["<strong>" + name + "</strong>"])
        vm_confirm_popup(confirm_message, gettext("Restart"), function() {
            manage_vm(id, "restart")
        })
    }
    /**
     * Manage VM State (RESUME)
     */

    function resume_vm(id, name) {
        manage_vm(id, "resume")
    }
    /**
     * Renew vm suspend time.
     */

    function renew_suspend_vm(id) {
376 377
        manage_vm(id, "renew/suspend", function(data) {
            //workaround for some strange jquery parse error :o
Bence Dányi committed
378 379
            var foo = $('<div />').append(data);
            $('#vm-' + id + ' .details-container').replaceWith(foo.find('.details-container'));
380
        });
381 382 383 384 385 386 387 388 389 390 391 392
    }
    /**
     * Renew vm deletion time.
     */

    function renew_delete_vm(id) {
        manage_vm(id, "renew/delete")
    }
    /**
     * Manage VM State generic
     */

393
    function manage_vm(id, state, f) {
394 395 396 397
        $.ajax({
            type: 'POST',
            url: '/vm/' + state + '/' + id + '/',
            success: function(data, b, c) {
Bence Dányi committed
398
                if (f) {
399 400
                    f(data);
                } else if (state == "resume") {
401 402 403 404 405 406 407 408 409 410 411
                    window.location.href = '/vm/show/' + id + "/";
                } else {
                    window.location.reload();
                }
            }
        })
    }
    /**
     * New VM
     */

412
    function new_vm(url) {
413 414
        $.ajax({
            type: 'POST',
415
            url: url,
416 417 418 419 420 421 422 423 424 425
            success: function(data, b, xhrRequest) {
                window.location.href = xhrRequest.getResponseHeader("Location");
            }
        })
    }

    /**
     * Template delete
     */

426
    function delete_template_confirm(url, id, name) {
427 428
        confirm_message = interpolate(gettext("Are you sure deleting this %s template?"), ["<strong>" + name + "</strong>"])
        vm_confirm_popup(confirm_message, gettext("Delete"), function() {
429
            delete_template(url, id)
430 431 432 433 434 435
        })
    }
    /**
     * Template delete
     */

436
    function delete_template(url, id) {
437 438
        $.ajax({
            type: 'POST',
439
            url: url,
440 441 442 443 444 445 446
            data: 'id=' + id,
            dataType: 'json',
            statusCode: {
                404: function(data) {
                    alert(data['responseText']);
                },
                200: function(data) {
447 448
                    $("#t" + id).remove();
                    alert(gettext('Template deletion successful!'));
449 450 451 452 453 454 455 456 457
                },

            }
        })
    }

    function hide_group(id) {
        var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
        var hidden_groups_for_user = hidden_groups[current_user] || [];
Dányi Bence committed
458
        for (var i in hidden_groups_for_user) {
459
            var hide = hidden_groups_for_user[i];
Dányi Bence committed
460
            if (hide == id) return false;
461 462 463 464 465 466 467 468 469 470
        }
        hidden_groups_for_user.push(id);
        hidden_groups[current_user] = hidden_groups_for_user;
        window.localStorage.setItem('hidden_groups', JSON.stringify(hidden_groups));
        $('#group-' + id).slideUp(700);
    }

    function hide_groups() {
        var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
        var hidden_groups_for_user = hidden_groups[current_user] || [];
Dányi Bence committed
471
        for (var i in hidden_groups_for_user) {
472 473 474 475 476 477 478 479 480 481 482 483 484 485
            var hide = hidden_groups_for_user[i];
            $('#group-' + hide).hide();
        }
    }

    function show_hidden_groups() {
        var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
        hidden_groups[current_user] = [];
        window.localStorage.setItem('hidden_groups', JSON.stringify(hidden_groups));
    }
    hide_groups();

    function hidden_group_count() {
        var hidden_groups = JSON.parse(window.localStorage.getItem('hidden_groups')) || {};
Dányi Bence committed
486
        return (hidden_groups[current_user] || []).length;
487
    }
Dányi Bence committed
488 489 490 491 492 493 494 495 496 497

    function toggle_box(id) {
        var boxes = JSON.parse(window.localStorage.getItem('hidden_boxes')) || {};
        var user_boxes = boxes[current_user] || [];
        for (var i in user_boxes) {
            var box = user_boxes[i];
            if (box == id) {
                user_boxes.splice(i, 1);
                boxes[current_user] = user_boxes;
                window.localStorage.setItem('hidden_boxes', JSON.stringify(boxes));
Bence Dányi committed
498 499
                $('#toggle-box-' + id).attr('src', '/static/icons/eye-half.png');
                $('#toggle-box-' + id).parent().parent().parent().next().slideDown(700);
Dányi Bence committed
500 501 502 503 504
                return;
            }
        }
        user_boxes.push(id);
        boxes[current_user] = user_boxes;
Bence Dányi committed
505 506 507
        $('#toggle-box-' + id).attr('src', '/static/icons/eye.png');
        $('#toggle-box-' + id).parent().parent().parent().next().slideUp(700);
        console.log($('#toggle-box-' + id).parent().parent().parent().next()[0])
Dányi Bence committed
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
        window.localStorage.setItem('hidden_boxes', JSON.stringify(boxes));
    }

    function box_hidden(id) {
        var boxes = JSON.parse(window.localStorage.getItem('hidden_boxes')) || {};
        var user_boxes = boxes[current_user] || [];
        for (var i in user_boxes) {
            var box = user_boxes[i];
            if (box == id) {
                return true;
            }
        }
        return false;
    }

Bence Dányi committed
523 524 525
    $('.toggle-box').each(function() {
        var id = $(this).data('id');
        $(this).click(function() {
Dányi Bence committed
526 527
            toggle_box(id);
        });
Bence Dányi committed
528 529
        if (box_hidden(id)) {
            $(this).attr('src', '/static/icons/eye.png');
Dányi Bence committed
530 531
            $(this).parent().parent().parent().next().hide();
        } else {
Bence Dányi committed
532
            $(this).attr('src', '/static/icons/eye-half.png');
Dányi Bence committed
533 534 535 536
        }
    })

    if (hidden_group_count() == 0) {
537 538 539 540 541 542 543
        $('#show-hidden-groups').hide();
    }

    $('.hide-group').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        hide_group($(this).data('id'));
Dányi Bence committed
544
        if ($('#show-hidden-groups').is(':hidden')) {
545 546 547 548 549 550 551 552 553 554
            $('#show-hidden-groups').slideDown(700);
        }
        return false;
    });
    $('#show-hidden-groups').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        show_hidden_groups();
        $('#show-hidden-groups').slideUp(700);
        $('#groups > li').each(function() {
Dányi Bence committed
555
            if ($(this).is(':hidden')) {
556 557 558 559 560 561 562 563 564 565 566 567 568 569
                $(this).slideDown(700);
            }
        })
    })
    $('#new-member').click(function() {
        $('#new-member-form').toggle();
    });
    $('#new-member-form input').click(function(e) {
        e.stopPropagation();
    });
    $('#new-member-form input[type=submit]').click(function() {
        var neptun = $(this).prev().val();
        $.ajax({
            type: 'POST',
570
            url: $(this).data('url'),
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
            data: 'neptun=' + neptun,
            dataType: 'json',
            success: function(data) {
                window.location.reload();
            }
        }).error(function(data) {
            //TODO: fancy modal alert
            alert(JSON.parse(data.responseText).status);
        })
    });

    $('#new-owner').click(function() {
        $('#new-owner-form input[type=text]').focus();
    });
    $('#new-owner-form input').click(function(e) {
        e.stopPropagation();
    });
    $('#new-owner-form input').keyup(function() {
        var timer;
Dányi Bence committed
590 591
        return function(e) {
            var val = $(this).val().split(' ')[0];
592
            var that = this;
593
            clearTimeout(timer);
Dányi Bence committed
594 595
            timer = setTimeout(function() {
                if (val.length < 1) return;
596 597
                $.ajax({
                    type: 'POST',
Dányi Bence committed
598
                    data: 'q=' + val,
599
                    url: $(that).data('url'),
600
                    dataType: 'json',
Dányi Bence committed
601
                    success: function(data) {
602
                        console.log(data);
Dányi Bence committed
603 604 605 606 607
                        $('#new-owner-autocomplete')[0].innerHTML = '<ul>';
                        var el = $('#new-owner-autocomplete')[0];
                        for (var i in data) {
                            var d = data[i];
                            el.innerHTML += '<li>' + d.name + ': ' + d.neptun + ' <input type="button" value="' + gettext('Add owner') + '" data-neptun="' + d.neptun + '" />' + '<div class="clear"></div></li>';
608
                        }
Dányi Bence committed
609 610
                        if (data.length == 0) {
                            el.innerHTML += '<li>' + gettext('Unknown') + ': ' + val + ' <input type="button" value="' + gettext('Add owner') + '" data-neptun="' + val + '" />' + '<div class="clear"></div></li>';
611
                        }
Dányi Bence committed
612 613 614 615
                        el.innerHTML += '</ul>';
                        $(el).find('input').each(function() {
                            var self = this;
                            $(this).click(function(e) {
616 617 618
                                e.stopPropagation();
                                $.ajax({
                                    type: 'POST',
Dányi Bence committed
619 620
                                    data: 'neptun=' + $(self).data('neptun'),
                                    url: '/ajax/group/' + $('#new-owner').data('gid') + '/addOwner/',
621
                                    dataType: 'json',
Dányi Bence committed
622
                                    success: function(data) {
623 624 625 626 627 628 629
                                        window.location.reload();
                                    }
                                })
                            })
                        })
                    }
                });
Dányi Bence committed
630
            }, 1000);
631 632 633 634 635 636 637 638 639 640
            e.stopPropagation();
        }
    }());

    $('#group-members .remove').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        var neptun = $(this).data('neptun');
        $.ajax({
            type: 'POST',
641
            url: $(this).data('url'),
642 643 644 645 646 647 648 649 650 651 652
            data: 'neptun=' + neptun,
            success: function(data) {
                $('#member-' + neptun).slideUp(700);
            }
        });
    });
    $('#groups .delete').click(function(e) {
        e.preventDefault();
        e.stopPropagation();
        var gid = $(this).data('id');
        var name = $(this).data('name');
653
        var url = $(this).data('url');
654 655 656 657 658
        vm_confirm_popup(
        interpolate(
        gettext('Are you sure deleting <strong>%s</strong>'), [name]), gettext('Delete'), function() {
            $.ajax({
                type: 'POST',
659
                url: url,
660 661 662 663 664 665 666 667 668 669
                data: 'gid=' + gid,
                success: function() {
                    $('#group-' + gid).slideUp(700);
                }
            }).error(function() {
                window.location.reload();
            })
        })
    })
})