Plugins.ThreeGiG.ProspectDirector.BuiltIn.OpenGlobalViewAction =
PD.Actions.ActionDefinition.extend({

    init: function (options) {

        this._super({
            id: "open-global-view",
            pluginId: "builtin",
            name: "Open Global View",
            description: "Opens the specified global view.",
            parameters: [
                new PD.Actions.ActionParameterDefinition({
                    name: "View ID",
                    type: PD.Actions.ActionParameterType.STRING,
                    description: "The Custom ID of the view to be opened."
                }),
                new PD.Actions.ActionParameterDefinition({
                    name: "New Window?",
                    type: PD.Actions.ActionParameterType.INTEGER,
                    optional: true,
                    description: "A value of '1' will open the global view in a new window."
                })
            ]
        });

    },

    method: function (viewId, newWindow) {

        if (viewId == null) {
            this._showErrorDialog();
        }

        if (newWindow === 1) {
            window.open(PD.Path.resolve("~/viewbrowser?viewId=" + viewId));
        }
        else {
            window.location = PD.Path.resolve("~/viewbrowser?viewId=" + viewId);
        }

    },

    _showErrorDialog: function () {

        ProspectDirector.Web.UI.MessageDialog.warn({
            message: "Cannot complete the Open Global Action because no VIew ID has been specified."
        });

    }

});