diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 394381a..5c44246 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -111,6 +111,27 @@ namespace AIAHTML5.ADMIN.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [Route("ManageUserLoginStatus")] + [HttpPost] + public HttpResponseMessage ManageUserLoginStatus(JObject jsonData) + { + bool Status = false; + int userId = jsonData["userId"].Value(); + string tagName = jsonData["tagName"].Value(); + try + { + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName); + + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + [Route("UpdateUserId")] [HttpPost] public HttpResponseMessage UpdateUserId(UserModel userInfo) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index 614ea78..8d91ed6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -4990,5 +4990,18 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); } + + public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag) + { + var userIdParameter = userId.HasValue ? + new ObjectParameter("userId", userId) : + new ObjectParameter("userId", typeof(int)); + + var tagParameter = tag != null ? + new ObjectParameter("tag", tag) : + new ObjectParameter("tag", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter); + } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs index 660d3a3..d216bd6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'E:\AIAProject\400-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. +// T4 code generation is enabled for model 'F:\AIAProject\400-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index f74da8e..dd0e4c6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -1406,6 +1406,10 @@ + + + + @@ -2996,6 +3000,10 @@ + + + + @@ -4318,6 +4326,7 @@ + @@ -6284,6 +6293,7 @@ + @@ -6305,6 +6315,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs index ec11704..0bea143 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs @@ -29,5 +29,6 @@ namespace AIAHTML5.ADMIN.API.Entity public string UserStatus { get; set; } public Nullable UserTypeId { get; set; } public Nullable EditionTypeId { get; set; } + public Nullable LoginStatus { get; set; } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 14b140c..4a15fe3 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -65,6 +65,21 @@ namespace AIAHTML5.ADMIN.API.Models return false; } } + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName) + { + bool loginStatus = false; + try + { + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName).FirstOrDefault()); + + return loginStatus; + } + catch (Exception ex) + { + return false; + } + } + public static string UpdateUserId(AIADatabaseV5Entities dbContext, int id, string userId, string oldUserId) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index 855759f..db51b65 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -41,5 +41,6 @@ namespace AIAHTML5.API.Constants public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage"; public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount"; + public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index ccc309e..040af8b 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -502,6 +502,27 @@ namespace AIAHTML5.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [HttpPost] + [Route("api/ManageUserLoginStatus")] + public HttpResponseMessage ManageUserLoginStatus([FromBody]JObject jsonData) + { + string loginStatus = string.Empty; + try + { + int userId = jsonData["userId"].Value(); + string tagName = jsonData["tagName"].Value(); + + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName); + + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; + } + catch (Exception ex) + { + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 23e314d..78d7571 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -348,6 +348,42 @@ namespace AIAHTML5.API.Models return objUser; } + internal static string GetUserLoginStatus(int userId,string tagName) + { + string status=string.Empty; + DBModel objModel = new DBModel(); + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + SqlDataAdapter adapter; + DataSet ds = new DataSet(); + + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_USER_LOGIN_STATUS; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@userId", userId); + cmd.Parameters.AddWithValue("@tag", tagName); + + adapter = new SqlDataAdapter(cmd); + adapter.Fill(ds); + + if (ds != null && ds.Tables.Count > 0) + { + DataTable dt = ds.Tables[0]; + + if (dt.Rows.Count > 0) + { + foreach (DataRow dr in dt.Rows) + { + status = dr["loginStatus"].ToString(); + + } + } + } + + return status; + } + internal User GetSelectedSettings(int userId) { logger.Debug(" Inside GetSelectedSettings for userId = " + userId); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 085aa1d..08fec49 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -315,6 +315,14 @@ namespace AIAHTML5.API.Models return objUser; } + internal static string GetUserLoginStatus(int userId, string tagName) + { + string status = null; + status = DBModel.GetUserLoginStatus(userId, tagName); + + return status; + } + internal static int SaveUserSelectedSettings(User selectedSettings) { logger.Debug("inside SaveUserSelectedSettings for Image =" + selectedSettings.Id); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index 678f96e..26ba7f8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -179,7 +179,6 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') promise.then( function (result) { - var threeDAnatomyData = new jinqJs() .from(result.root.ThreeDAData) .orderBy([{ field: '_Title', sort: 'asc' }]) @@ -493,7 +492,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location $rootScope.ThreeDWindowLoadComplete = true; } $scope.JsPanelMouseEnter(windowviewid); - + } $scope.JsPanelMouseEnter = function (windowviewid) { @@ -502,6 +501,36 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location //call when module loaded $rootScope.resetMenuOption(); + var timeintval = null; + timeintval = $interval(PointerEventEnableDisable, 5000); + + function PointerEventEnableDisable() { + var pointevents = $("#threedImage_" + windowviewid).css('pointer-events'); + if (pointevents=='auto') { + $scope.stop3drefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 500); + $("#threedImage_" + windowviewid).css('pointer-events', 'none'); + } + else if(pointevents=='none') + { + $("#threedImage_" + windowviewid).css('pointer-events', 'auto'); + $scope.stop3drefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 5000); + } + else + { + //auto clode interval when panel close + $scope.stop3drefresh(timeintval); + } + } + + $scope.stop3drefresh = function (timeintval) { + if (angular.isDefined(timeintval)) { + $interval.cancel(timeintval); + timeintval = undefined; + } + }; + // call from while open module in CB //click event not work on object-tag document @@ -514,7 +543,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location }); - } + } $scope.RemoveJSPanel = function (panelid) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 3b2634b..39d7d82 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -1,7 +1,7 @@ 'use strict'; -AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window", -function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window) { +AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window","Idle", "Keepalive", +function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window,Idle, Keepalive) { //$scope.pageToOpen = { // name: 'MainMenu' @@ -667,8 +667,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if (navigator.cookieEnabled) { $rootScope.isLoading = false; - - + $rootScope.isLoginLoading = false; + //unblock user if (url.indexOf('?unb:') != -1) { @@ -690,6 +690,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if ($scope.currentUserDetails != undefined) { AuthenticateAlreadyLoggedInUser(); } + var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { @@ -718,7 +719,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $scope.helpTopicLink(); }, 2000); - } $rootScope.getConfigurationValues = function () { ConfigurationService.getCofigValue() @@ -730,6 +730,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }); } + $rootScope.LoginEnableUI=function() + { + $rootScope.isLoginLoading = false; + $('#spinnerLogin').css('visibility', 'hidden'); + $('.loginPanel').css('pointer-events', 'auto'); + $('.loginPanel').css('opacity', '1'); + } + $rootScope.LoginDisableUI=function() + { + $rootScope.isLoginLoading = true; + $('#spinnerLogin').css('visibility', 'visible'); + $('.loginPanel').css('pointer-events', 'none'); + $('.loginPanel').css('opacity', '0.7'); + } $rootScope.AuthenticateUser = function (userInfo) { if (navigator.cookieEnabled) { $rootScope.errorMessage = ""; @@ -741,13 +755,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } else { - + $rootScope.LoginDisableUI(); AuthenticationService.authenticateUser(userInfo) .then( function (result) { - if (result == LoginConstants.USER_NOT_FOUND) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.LoginEnableUI(); $rootScope.isVisibleLogin = true; // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; @@ -830,61 +845,70 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else { - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true if (result.LicenseId == 0 && result.IsActive) { @@ -922,6 +946,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $location.path('/'); $timeout(function () { + $rootScope.LoginEnableUI(); $scope.RedirectToModule(); }, 100); @@ -940,11 +965,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.haveRoleAdmin = false; } - // Remove Admin Link for LicenseEditionId 3/4 of student - if (result.EditionId == 3 || result.EditionId == 4) { - $rootScope.haveRoleAdmin = false; - - } if (result.UserTypeId == 6) { $('#modestyDiv').css('pointerEvent', 'none'); @@ -1006,10 +1026,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time localStorage.setItem('isCommingSoonModel', false); - // for reseller type user first need to update profile - // only instructor ,not student - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { - + // for reseller type user first need to update profile + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { + $rootScope.LoginEnableUI(); $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); $("#profileUpdateModal").modal('show'); @@ -1020,6 +1039,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { $location.path('/'); $timeout(function () { + $rootScope.LoginEnableUI(); $scope.RedirectToModule(); }, 100); @@ -1030,6 +1050,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#dvTerms').html(result.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $('#dvTermCondition').fadeIn(); $rootScope.userData = result; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); @@ -1040,6 +1061,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + // set user session time + $rootScope.loadUserSession(); + $rootScope.LoginEnableUI(); } } @@ -1049,6 +1073,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data function (error) { console.log(' Error in authentication = ' + error.statusText); // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.LoginEnableUI(); $rootScope.isVisibleLogin = true; $rootScope.errorMessage = error; $("#messageModal").modal('show'); @@ -1169,6 +1194,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if (isCalsCredantialForSIte == "True") { if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null) { + $rootScope.LoginDisableUI(); AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo) .then( function (result) { @@ -1182,6 +1208,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }), function (error) { console.log(' Error in bypass login = ' + error.statusText); + $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = error; $("#messageModal").modal('show'); } @@ -1190,53 +1218,56 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { console.log(' invalid detail in bypass login'); + $rootScope.isVisibleLogin = true; $rootScope.errorMessage = "authentication is not allowed due to invalid details format .\nPlease pass the correct details again!"; $("#messageModal").modal('show'); } } else { - console.log($rootScope.siteUrlInfo); - + $rootScope.LoginDisableUI(); AuthenticationService.validateClientSite($rootScope.siteUrlInfo) .then( function (result) { - console.log(result); if (result != null) { - - console.log(result); if (result == LoginConstants.INVALID_CLIENT) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; $("#messageModal").modal('show'); } else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } @@ -1367,6 +1398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#dvTerms').html(result.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $('#dvTermCondition').fadeIn(); $rootScope.userData = result; $rootScope.haveRoleAdmin = false; @@ -1374,6 +1406,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $location.path('/'); } } + $rootScope.LoginEnableUI(); + // set user session time + $rootScope.loadUserSession(); + } @@ -1384,15 +1420,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }, - function (error) { + function (error) { - console.log(' Error in authentication = ' + error.statusText); - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = error; - $("#messageModal").modal('show'); + console.log(' Error in authentication = ' + error.statusText); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.LoginEnableUI(); + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); - } + } ) } @@ -1469,8 +1506,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.userModules = userInfo.Modules; // ShowAssignedModulesPopup(userInfo.Modules);; // for reseller type user first need to update profile - // allow popup for instructor ,not for student. - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); @@ -1517,14 +1553,121 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $rootScope.loadUserSession = function () { + Idle.watch();// start the session + $rootScope.isSessionTimeout=false; + $rootScope.isRedirectToAdmin=false; + $rootScope.userStatus = { + userId: null, + tagName: null, + loginStatus: null, + } + console.log('user session start'); + $rootScope.CheckUserSession('insert'); + + $rootScope.$on('IdleStart', function() { + // this event fire when idle time finish and time out start + // config set in AIA.js -:IdleProvider.idle(1*30);; + //alert('start'); + }); + $rootScope.$on('IdleEnd', function() { + // this event fires by user activity during timeout period + // it reset idle time and timeout + // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll'); + // alert('end'); + }); + $rootScope.$on('IdleTimeout', function() { + // this event fire when idle time finished and time out also finished + // config set in AIA.js -:IdleProvider.timeout(15); + $rootScope.isSessionTimeout=true; + console.log('session is timeout'); + $rootScope.CheckUserSession('logout'); + }); + $rootScope.$on('Keepalive', function() { + // it watch the session on perticular time interval during idle time period + // config set in AIA.js -: KeepaliveProvider.interval(10); + //we will use it to recieve request from databse if user logout from admin activity + console.log('ping user session'); + $rootScope.CheckUserSession('update'); + }); + + // $(window).unload(function(event) { + // //var isopenResourceRequest = sessionStorage.getItem('isModuleOpenByOpenResource'); + // if ($rootScope.closetab==true) { + // localStorage.removeItem('loggedInUserDetails'); + // localStorage.clear(); + // $rootScope.CheckUserSession('logout'); + // return "Handler for .unload() called."; + + // } + + // }); + + $window.onbeforeunload = function (e) { + var confirmation = {}; + // if($location.url()!= "/") { + if ($rootScope.isSessionTimeout==false && $rootScope.isRedirectToAdmin==false) { + var event = $rootScope.$broadcast('onBeforeUnload', confirmation); + if (event.defaultPrevented) { + return confirmation.message; + } + } + // } + + }; + } + + $rootScope.$on('onBeforeUnload', function (e, confirmation) { + confirmation.message = "All data willl be lost."; + e.preventDefault(); + }); $rootScope.LogoutUser = function () { + $rootScope.isSessionTimeout=true; + localStorage.removeItem('loggedInUserDetails'); + localStorage.clear(); + $rootScope.CheckUserSession('logout'); + $timeout(function(){ + document.location = '/'; + $rootScope.isVisibleLogin = true; + },50); + + } + $rootScope.LogoutUserSession = function () { + $rootScope.isSessionTimeout=true; localStorage.removeItem('loggedInUserDetails'); localStorage.clear(); document.location = '/'; $rootScope.isVisibleLogin = true; } + $rootScope.CheckUserSession = function (tagName) { + //console.log('user login id: '+$rootScope.userData.Id); + //console.log('user login activity tag: '+tagName); + if($rootScope.userData==undefined) return; + $rootScope.userStatus.userId=$rootScope.userData.Id; + $rootScope.userStatus.tagName=tagName; + AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) + .then( + function (loginStatus) { + if(loginStatus!=null) + { + $rootScope.userStatus.loginStatus = loginStatus; + if(loginStatus=='False') + { + $rootScope.LogoutUserSession(); + } + } + + }), + function (error) { + console.log(' Error in user login status = ' + error.statusText); + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); + } + + } + function AuthenticateAlreadyLoggedInUser() { isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel'); @@ -1919,25 +2062,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); - $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); - - $window.onbeforeunload = function (e) { - var confirmation = {}; - if($location.url()!= "/") { - var event = $rootScope.$broadcast('onBeforeUnload', confirmation); - if (event.defaultPrevented) { - return confirmation.message; - } - } - - }; + $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); }); - $scope.$on('onBeforeUnload', function (e, confirmation) { - confirmation.message = "All data willl be lost."; - e.preventDefault(); - }); - $rootScope.$on("$locationChangeSuccess", function () { $rootScope.HightLightModuleSelection = function (moduleUrl) { @@ -7314,6 +7441,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.reDirectURLToAdmin = function () { $("#profileUpdateModal").modal('hide'); $timeout(function () { + $rootScope.isRedirectToAdmin=true; window.location.href = "Admin"; }, 300) @@ -7450,6 +7578,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.StoreModuleName = function (moduleName) { + // clear UI of external module like encyclopedia,aod + if ($('#siteloader').html() != undefined) { + $('#siteloader').remove(); + } var userid = $rootScope.userData.Id; $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName); @@ -7603,7 +7735,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }; }] -); +) function printImagePreview(event) { var scope = angular.element(document.querySelector('[ng-controller="HomeController"]')).scope(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js index 23c20ab..3fff875 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js @@ -1,7 +1,7 @@ 'use strict'; -AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window", -function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { +AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval", +function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) { //$rootScope.currentActiveModuleTitle = Modules[10].Name; //$rootScope.currentActiveModuleTitle = $routeParams.modname; @@ -59,11 +59,43 @@ function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { } } + $scope.refreshIdleTime(); } } } }); + $scope.refreshIdleTime = function () { + var timeintval = null; + timeintval = $interval(PointerEventEnableDisable, 5000); + + function PointerEventEnableDisable() { + var pointevents = $("#externalLink").css('pointer-events'); + if (pointevents=='auto') { + $scope.stopLinkRefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 500); + $("#externalLink").css('pointer-events', 'none'); + } + else if(pointevents=='none') + { + $("#externalLink").css('pointer-events', 'auto'); + $scope.stopLinkRefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 5000); + } + else + { + //auto clode interval when panel close + $scope.stopLinkRefresh(timeintval); + } + } + + $scope.stopLinkRefresh = function (timeintval) { + if (angular.isDefined(timeintval)) { + $interval.cancel(timeintval); + timeintval = undefined; + } + }; + } $scope.showTabButton = false; $scope.IsVisible = function () { $scope.scroll(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index c6833c5..58484c2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -1,6 +1,6 @@ 'use strict'; -var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap']); +var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap','ngIdle']); @@ -571,4 +571,10 @@ AIA.config(function ($routeProvider, pages, $locationProvider) { } } -}); \ No newline at end of file +}); +AIA.config(function(IdleProvider, KeepaliveProvider) { + IdleProvider.idle(20*60); // 20 minutes idle + IdleProvider.timeout(30); // after 30 seconds idle, time the user out + KeepaliveProvider.interval(10); // 10 seconds keep-alive ping + IdleProvider.interrupt('keydown mousemove wheel mousedown touchstart touchmove scroll'); +}) \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index bb34f4c..2382a2a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -15,6 +15,7 @@ console.log('error') deferred.reject(data); $rootScope.isVisibleLogin = true; + $scope.LoginEnableUI(); $rootScope.errorMessage = data; $("#messageModal").modal('show'); @@ -55,6 +56,29 @@ deferred.resolve(data); }).error(function (data, status, headers, config) { console.log('error') + $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); + deferred.reject(data); + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); + + }); + return deferred.promise; + }, + + ManageUserLoginStatus: function (logindata) { + var deferred = $q.defer();//userId tagName + + $http.post('/API/api/ManageUserLoginStatus', JSON.stringify(logindata), { + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') deferred.reject(data); $rootScope.errorMessage = data; $("#messageModal").modal('show'); @@ -120,6 +144,7 @@ console.log('error') deferred.reject(data); $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = data; $("#messageModal").modal('show'); diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx index 7f1309f..0da1ad4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx @@ -221,6 +221,9 @@
+ @@ -1515,6 +1518,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js b/400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js new file mode 100644 index 0000000..959e5b7 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js @@ -0,0 +1,9 @@ +/*** Directives and services for responding to idle users in AngularJS +* @author Mike Grabski +* @version v1.3.2 +* @link https://github.com/HackedByChinese/ng-idle.git +* @license MIT +*/ + +!function(a,b,c){"use strict";b.module("ngIdle",["ngIdle.keepalive","ngIdle.idle","ngIdle.countdown","ngIdle.title","ngIdle.localStorage"]),b.module("ngIdle.keepalive",[]).provider("Keepalive",function(){var a={http:null,interval:600};this.http=function(c){if(!c)throw new Error("Argument must be a string containing a URL, or an object containing the HTTP request configuration.");b.isString(c)&&(c={url:c,method:"GET"}),c.cache=!1,a.http=c};var c=this.interval=function(b){if(b=parseInt(b),isNaN(b)||0>=b)throw new Error("Interval must be expressed in seconds and be greater than 0.");a.interval=b};this.$get=["$rootScope","$log","$interval","$http",function(d,e,f,g){function h(a){d.$broadcast("KeepaliveResponse",a.data,a.status)}function i(){d.$broadcast("Keepalive"),b.isObject(a.http)&&g(a.http).then(h)["catch"](h)}var j={ping:null};return{_options:function(){return a},setInterval:c,start:function(){return f.cancel(j.ping),j.ping=f(i,1e3*a.interval),j.ping},stop:function(){f.cancel(j.ping)},ping:function(){i()}}}]}),b.module("ngIdle.idle",["ngIdle.keepalive","ngIdle.localStorage"]).provider("Idle",function(){var a={idle:1200,timeout:30,autoResume:"idle",interrupt:"mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll",windowInterrupt:null,keepalive:!0},c=this.timeout=function(c){if(c===!1)a.timeout=0;else{if(!(b.isNumber(c)&&c>=0))throw new Error("Timeout must be zero or false to disable the feature, or a positive integer (in seconds) to enable it.");a.timeout=c}};this.interrupt=function(b){a.interrupt=b},this.windowInterrupt=function(b){a.windowInterrupt=b};var d=this.idle=function(b){if(0>=b)throw new Error("Idle must be a value in seconds, greater than 0.");a.idle=b};this.autoResume=function(b){b===!0?a.autoResume="idle":b===!1?a.autoResume="off":a.autoResume=b},this.keepalive=function(b){a.keepalive=b===!0},this.$get=["$interval","$log","$rootScope","$document","Keepalive","IdleLocalStorage","$window",function(e,f,g,h,i,j,k){function l(){a.keepalive&&(u.running&&i.ping(),i.start())}function m(){a.keepalive&&i.stop()}function n(){u.idling=!u.idling;var b=u.idling?"IdleStart":"IdleEnd";u.idling?(g.$broadcast(b),m(),a.timeout&&(u.countdown=a.timeout,o(),u.timeout=e(o,1e3,a.timeout,!1))):(l(),g.$broadcast(b)),e.cancel(u.idle)}function o(){if(u.idling){if(u.countdown<=0)return void q();g.$broadcast("IdleWarn",u.countdown),u.countdown--}}function p(a){g.$broadcast("IdleInterrupt",a)}function q(){m(),e.cancel(u.idle),e.cancel(u.timeout),u.idling=!0,u.running=!1,u.countdown=0,g.$broadcast("IdleTimeout")}function r(a,b,c){var d=a.running();a.unwatch(),b(c),d&&a.watch()}function s(){var a=j.get("expiry");return a&&a.time?new Date(a.time):null}function t(a){a?j.set("expiry",{id:v,time:a}):j.remove("expiry")}var u={idle:null,timeout:null,idling:!1,running:!1,countdown:null},v=(new Date).getTime(),w={_options:function(){return a},_getNow:function(){return new Date},getIdle:function(){return a.idle},getTimeout:function(){return a.timeout},setIdle:function(a){r(this,d,a)},setTimeout:function(a){r(this,c,a)},isExpired:function(){var a=s();return null!==a&&a<=this._getNow()},running:function(){return u.running},idling:function(){return u.idling},watch:function(b){e.cancel(u.idle),e.cancel(u.timeout);var c=a.timeout?a.timeout:0;b||t(new Date((new Date).getTime()+1e3*(a.idle+c))),u.idling?n():u.running||l(),u.running=!0,u.idle=e(n,1e3*a.idle,0,!1)},unwatch:function(){e.cancel(u.idle),e.cancel(u.timeout),u.idling=!1,u.running=!1,t(null),m()},interrupt:function(b){if(u.running){if(a.timeout&&this.isExpired())return void q();p(b),(b||"idle"===a.autoResume||"notIdle"===a.autoResume&&!u.idling)&&this.watch(b)}}},x={clientX:null,clientY:null,swap:function(a){var b={clientX:this.clientX,clientY:this.clientY};return this.clientX=a.clientX,this.clientY=a.clientY,b},hasMoved:function(a){var b=this.swap(a);return null===this.clientX||a.movementX||a.movementY?!0:b.clientX!=a.clientX||b.clientY!=a.clientY?!0:!1}};if(h.find("html").on(a.interrupt,function(a){"mousemove"===a.type&&a.originalEvent&&0===a.originalEvent.movementX&&0===a.originalEvent.movementY||("mousemove"!==a.type||x.hasMoved(a))&&w.interrupt()}),a.windowInterrupt)for(var y=a.windowInterrupt.split(" "),z=function(){w.interrupt()},A=0;A
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts index b067eb2..ffc6877 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts @@ -58,6 +58,7 @@ export class UsersList implements OnInit, AfterViewChecked { UncheckedRecords: Array; buttonStatus: boolean; EditbuttonStatus: boolean; + logoutUserSession: boolean; //@ViewChild("profileModal") //profileModal: ModalComponent; //errorMessage: any; @@ -127,7 +128,6 @@ export class UsersList implements OnInit, AfterViewChecked { this._loadingService.ShowLoading("global-loading"); this.GetUserType(); this.GetAccountType(); - this._loadingService.HideLoading("global-loading"); this.recordCount = 0; this.pageNo = 1; this.pageLength = 10; @@ -168,8 +168,6 @@ export class UsersList implements OnInit, AfterViewChecked { testScript.setAttribute("type", "text/javascript"); document.body.appendChild(testScript); } - - this._loadingService.HideLoading("global-loading"); //this.GetUserList(); } @@ -234,6 +232,14 @@ export class UsersList implements OnInit, AfterViewChecked { else { this.buttonStatus = null; } + if (item['LoginStatus'] == true) { + this.logoutUserSession=true; + } + else{ + this.logoutUserSession = null; + } + + } public SetClickedRowManageRight(j: number, item: any) { @@ -275,7 +281,6 @@ export class UsersList implements OnInit, AfterViewChecked { var tempArr = evt.split(','); this.pageNo = parseInt(tempArr[0]); this.pageLength = parseInt(tempArr[1]); - this._loadingService.ShowLoading("global-loading"); var UserFilterControl = this.Users.value; this.userservice.GetUserList( @@ -292,6 +297,8 @@ export class UsersList implements OnInit, AfterViewChecked { } SearchRecords() { + this.EditbuttonStatus=undefined; + this.logoutUserSession=undefined; this.buttonStatus = null; this.selectedRow = -1; this.SearchUserList('1, ' + this.pageLength); @@ -309,12 +316,15 @@ export class UsersList implements OnInit, AfterViewChecked { } } CancelEditUser() { - this.SearchUserList('1, ' + this.pageLength); + this.SearchUserList(this.pageNo +','+ this.pageLength); this.Mode = 'Manage'; this.modalTitle = 'LIST USER'; this.topPos = '2000px'; this.divClass = 'col-sm-12'; this.selectedRow = -1; + this.EditbuttonStatus=undefined; + this.buttonStatus=undefined; + this.logoutUserSession=undefined; } EditUser() { if (this.EditbuttonStatus) { @@ -375,7 +385,23 @@ export class UsersList implements OnInit, AfterViewChecked { //this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id); } - + ForceLogoutUser(){ + if (this.logoutUserSession) { + this._loadingService.ShowLoading("global-loading"); + this.userservice.ManageUserLoginStatus({ + userId: this.selectedId, + tagName: 'logout' + }).subscribe(x => { + console.log(x); + this.EditbuttonStatus=undefined; + this.logoutUserSession=undefined; + this.buttonStatus = null; + this.selectedRow = -1; + this.SearchUserList(this.pageNo +','+ this.pageLength); + + },error => console.log(error)); + } + } public UpdateUser() { this.alerts = ''; diff --git a/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css b/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css index 7b06313..d552a44 100644 --- a/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css +++ b/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css @@ -1325,7 +1325,7 @@ pre code { width: 50%; } .col-lg-5 { - width: 41.66666667%; + width: 45.66666667%; } .col-lg-4 { width: 33.33333333%;