/// class PD.Manage.Modules.UsersContextMenuSegment
// using PD.Web.UI.Controls.ContextMenuSegment

PD.Manage.Modules.UsersContextMenuSegment =
PD.Web.UI.Controls.ContextMenuSegment.extend({

    //===================================
    // EVENT HANDLERS
    //===================================

    onRegisterItems: function (e) {

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/users:user/edit-dialog"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/users:user/delete"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/users:user/bulk-edit"
        }));

        if (PD.ENVIRONMENT.AUTH_MODE !== 1) {
            return;
        }

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/users:sync/user"
        }));

    },

    onOpen: function (e) {

        var grid = this.get_context().viewGrid;

        if (grid) {
            PD.context.get_default().get_commands().setState({
                "pd/users/context-menu": {
                    users: grid.getSelections().toArray()
                }
            });
        }

    }
});