AnatTestController.js 3.45 KB
AIA.controller("AnatTestController", ["$scope", "$rootScope", "pages", "$log", "$location",
function ($scope, $rootScope, pages, log, $location) {
    $scope.showTabButton = false;
    $scope.IsVisible = function () {
        $scope.scroll();

    }

    $scope.scroll = function () {
        // $window.scrollTo(0, 0);
        $("html,body").scrollTop(0);
        //alert("scroll");
    }
   $scope.openAIAFlexAnatomyTest = function () {
        var userInfo;
        var encryptedUserName;
        var encryptedPassword
        var urlPrams;

        var key = CryptoJS.enc.Base64.parse("MTIzNDU2NzgxMjM0NTY3OAXUD");
        var iv = CryptoJS.enc.Base64.parse("EBESExQVFhcYGRobHB0eHwXUD");

        if ($rootScope.isCallFromSite) {

            if ($rootScope.IsCalsCred) {
                encryptedUserName = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.username, key, { iv: iv });
                encryptedPassword = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.password, key, { iv: iv });

                $location.url('/');

                window.open('http://qa.interactiveanatomy.com/Default.aspx?un=' + encryptedUserName + '&up=' + encryptedPassword + 'mod=8');

            }
            else {

                $location.url('/');

                var encryptedSiteIP = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.siteIP, key, { iv: iv });
                var encryptedAccountNumber = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.accountNumber, key, { iv: iv });
                var encryptedEdition = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.edition, key, { iv: iv });
                var encryptedUrlReferer = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.urlReferer, key, { iv: iv });
                var encryptedRemoteIPAddress = CryptoJS.AES.encrypt($rootScope.siteUrlInfo.remoteIPAddress, key, { iv: iv });
                var encryptedSiteId = CryptoJS.AES.encrypt($rootscope.siteId, key, { iv: iv });


                window.open('http://qa.interactiveanatomy.com/Default.aspx?si=' + encryptedSiteIP + '&ac=' + encryptedAccountNumber + '&ed=' + encryptedEdition + '&rf=' + encryptedUrlReferer + '&rm=' + encryptedRemoteIPAddress + 'mod=7' + '&s=' + encryptedSiteId);



                //window.open('http://qa.interactiveanatomy.com/Default.aspx?si=' + encryptedSiteIP + '&ac=' + encryptedAccountNumber + '&ed=' + encryptedEdition + '&rf=' + encryptedUrlReferer + '&rm=' + encryptedRemoteIPAddress + 'mod=8');

            }
        }
        else {
            userInfo = ($rootScope.userData);
            var encryptedUserName = CryptoJS.AES.encrypt(userInfo.LoginId, key, { iv: iv });
            var encryptedPassword = CryptoJS.AES.encrypt(userInfo.Password, key, { iv: iv });

            $location.url('/');

            window.open('http://qa.interactiveanatomy.com/Default.aspx?un=' + encryptedUserName + '&up=' + encryptedPassword + 'mod=8');

        }
    }
    $scope.$on('$viewContentLoaded', function (event) {
        
        // code that will be executed ... 
        // every time this view is loaded

        //get current path
        var currentURL = $location.path();
        var selectedModuleName = '';
        //set module title
        angular.forEach($rootScope.userModules, function (value, key) {
            if (value.slug === currentURL.replace('/', '')) {
                selectedModuleName = value.name;
            }
            $rootScope.currentActiveModuleTitle = selectedModuleName;
        })
    })

   // $rootScope.currentActiveModuleTitle = pages[7].name;
}]

);