• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Environment Selection Upon Login

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Environment Selection Upon Login

    Good morning CNX Team.

    I would like to know how to provide a dialog box that pops up letting the user request between a test and development library within Valence 4.1. I would also like to know how it is done or if it is the same method within Valence 5.0.

    The CNX Team was more than kind to explain the use of a creation or copy of an instance within the framework, however, I would like to know all available options (Hook.js) that can be used for this inquiry. Thank you for any help you can provide.

  • #2
    Accomplishing this in the 5.0 version of Valence is much simpler than with 4.1 so initially I will provide the code to get it going in 5.0.

    Open the Hook.js file located under your Valence directory at "resources/desktop". Add a call to a new method whenever a login takes place (new code is colored):

    Code:
    lock: function () {
    },
    login : function (user, sid) {
        me.onLogin();
    },
    Next, we must add this new method to the Hook (new code is colored) and that should do it.

    Code:
    constructor            : function () {
            var me  = this,
                ns  = Valence.login.Processor.getNamespace(),
                app = (typeof window[ns].getApplication === 'function') ? window[ns].getApplication() : null;
    
            if (app){
                app.on({
                    scope                : me,
                    activateapp          : function(app){
                    },
                    afterautostart       : function(apps){
                    },
                    appsloaded           : function(appStore){
                        // fired after the "Apps" store has been loaded...
                    },
                    beforeactivateapp    : function(app){
                        // return false to prevent the app from activating...
                    },
                    beforeautostart      : function(){
                        // return false to prevent autostart apps from launching...
                    },
                    beforechangepassword : function(params){
                        // return false to prevent call...
                    },
                    beforecloseapp       : function (app) {
                        // return false to prevent closing the app...
                    },
                    beforeenvironmentset : function (user, env) {
                        // return false to prevent setting of environment...
                    },
                    beforelaunchapp      : function(app){
                        // return false to prevent the app from launching
                    },
                    beforelock           : function(){
                        // return false to prevent the lock attempt
                    },
                    beforelogin          : function (params) {
                        // return false to prevent login attempt...
                    },
                    beforelogout         : function (user,params) {
                        // return false to prevent logout...
                    },
                    beforepoll           : function (params) {
                    },
                    beforesendpassword   : function(params){
                        // return false to prevent call to sendpassword...
                    },
                    beforeshowappcircles : function (apps) {
                        // return false to prevent showing...
                    },
                    beforeshowchangepassword : function(){
                        // return false to prevent showing...
                    },
                    closeapp             : function (app) {
                    },
                    componentrender      : function (cmp) {
                    },
                    environmentset       : function (user, env) {
                    },
                    launchapp            : function (app) {
                        setTimeout(function(){
                            var ga = document.createElement('script');
                            ga.setAttribute('src','/resources/test.js');
                            app.getDoc().head.appendChild(ga);
                        },1000);
    
                    },
                    lock                 : function () {
                    },
                    login                : function (user, sid) {
                        me.onLogin();
                    },
                    loginfailure         : function (parms,response) {
                    },
                    loggedout            : function (user) {
                    },
                    passwordchanged      : function(user,pwd){
                    },
                    poll                 : function (rsp) {
                    },
                    settingsapplied      : function () {
                        var me = this,
                            fnc;
                        for (var i in me.portalSettingOverrides){
                            fnc = 'set' + Ext.util.Format.capitalize(i);
                            if (typeof Valence.login.config.Settings[fnc] === "function"){
                                Valence.login.config.Settings[fnc](me.portalSettingOverrides[i]);
                            } else {
                                Valence.login.config.Settings[i] = me.portalSettingOverrides[i];
                            }
                        }
                    }
                });
            }
        },
        onLogin : function(){
            // only prompt the user if they have access to more than one environment...
            //
            if (Ext.getStore('Login_Environments').getCount() > 1){
                Valence.login.Processor.getAppUmbrella().onChangeEnvironment();
            }
        }

    Comment


    • #3
      Good afternoon Sean.

      Thank you for your most expedient reply. The method prescribed here has worked and is verified.
      You do not have permission to view this gallery.
      This gallery has 1 photos.

      Comment

      Working...
      X