Snippets

Piotr Szrajber Geospatial Portal SDK - Default saving credentials when creating user maps and workspaces

You are viewing an old version of this snippet. View the current version.
Revised by Piotr Szrajber 303c47c
/**
 * Default saving credentials when creating user maps and workspaces
 *
 * The code snippet below, when appended to MapConfig.js will check 
 * "Save credentials of connected data sources" by default
 *
 * Please note that this code snippet uses internal API and it may not work in future versions
 * (although it is rather unlikely :)). It has been tested on GSP 2016 SDK EP04
 *
 * 2018-01-04 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>
 */
Sys.Application.add_init(function() {
    var mscp = Intergraph.WebSolutions.Core.WebClient.Controls.MapStorageControl.prototype;
    var orig_showWorkspacesMenu = mscp._showWorkspacesMenu,
        orig_showWorkspaceMenu = mscp._showWorkspaceMenu,
        orig_showMapsMenu = mscp._showMapsMenu;

    // user workspaces checkbox
    mscp._showWorkspacesMenu = function(icon) {
        orig_showWorkspacesMenu.call(this, icon);
        this._includeCredentialsWorkspaces.setValue(true);
    };

    mscp._showWorkspaceMenu = function(workspace, icon) {
        orig_showWorkspaceMenu.call(this, workspace, icon);
        this._includeCredentialsWorkspaces.setValue(true);
    };

    // user maps checkbox
    mscp._showMapsMenu = function(icon) {
        orig_showMapsMenu.call(this, icon);
        this._includeCredentialsMaps.setValue(true);
    };
});
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.