/// class PD.Manage.Modules.MailQueueResendAllCommand

PD.Manage.Modules.MailQueueResendAllCommand =
PD.Commands.Command.extend({

    //===================================
    // PUBLIC METHODS
    //===================================

    setDefaults: function () {
        this.props("id", "mail-queue-item/resend-all");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("mail_forward.png"));
        this.props("label", "Resend All");
        this.props("tooltip", "Resend all messages in the queue.");
    },

    execute: function (e) {
        this._super(e);

        var service = new PD.Manage.Services.MailQueueService();

        PD.Web.UI.MessageDialog.warn({
            title: "Resend Queued Messages",
            message: "Resend all the queued messages in the queue?",
            ok: function (e) {

                e.close();

                service.retryAll(function () {
                    PD.context.get_default().get_events().publish("mail-queue-item/resend-all");
                });

            }
        });

    }

});