Merged
Merge Request #1022 · created by Birendra Kumar


Prod timeout

merge user session to production


From ProdTimeout into AIA_Production

Merged by Birendra Kumar

1 participants





400-SOURCECODE/AIAHTML5.ADMIN.API/Constants/AdminConstant.cs
... ... @@ -15,5 +15,6 @@ namespace AIAHTML5.Server.Constants
15 15  
16 16 public const string SUCCESS = "Success";
17 17 public const string FAILED = "Failed";
  18 + public const string SQL_CONNECTION_ERROR = "We are unable to connect with database. Please contact customer support.";
18 19 }
19 20 }
20 21 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... ... @@ -111,6 +111,28 @@ namespace AIAHTML5.ADMIN.API.Controllers
111 111 return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
112 112 }
113 113 }
  114 +
  115 + [Route("ManageUserLoginStatus")]
  116 + [HttpPost]
  117 + public HttpResponseMessage ManageUserLoginStatus(JObject jsonData)
  118 + {
  119 + bool Status = false;
  120 + int userId = jsonData["userId"].Value<Int32>();
  121 + string tagName = jsonData["tagName"].Value<string>();
  122 + bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>();
  123 + try
  124 + {
  125 + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, isAlreadyLoggedIn);
  126 +
  127 + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString());
  128 + }
  129 + catch (Exception ex)
  130 + {
  131 + // Log exception code goes here
  132 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, AdminConstant.SQL_CONNECTION_ERROR);
  133 + }
  134 + }
  135 +
114 136 [Route("UpdateUserId")]
115 137 [HttpPost]
116 138 public HttpResponseMessage UpdateUserId(UserModel userInfo)
... ... @@ -162,19 +184,20 @@ namespace AIAHTML5.ADMIN.API.Controllers
162 184  
163 185 [Route("Users")]
164 186 [HttpGet]
165   - public IHttpActionResult UserList(string firstname, string lastname, string emailid, string accountnumber, string usertypeid, string accounttypeid,
  187 + public IHttpActionResult UserList(string firstname, string lastname, string emailid, string accountnumber, string usertypeid, string accounttypeid, string userLoginStatus,
166 188 int pageNo, int pageLength, int iLoginUserType,string loggedIn="")
167 189 {
168 190 try
169 191 {
170 192 int UserTypeId = (!string.IsNullOrEmpty(usertypeid) ? Convert.ToInt32(usertypeid) : 0);
171 193 int AccountTypeId = (!string.IsNullOrEmpty(accounttypeid) ? Convert.ToInt32(accounttypeid) : 0);
  194 + bool loginStatus = Convert.ToBoolean(userLoginStatus);
172 195 int recordCount = 0;
173 196 dbContext.Configuration.ProxyCreationEnabled = false;
174 197 //var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
175 198 var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0);
176 199 //recordCount = (int)spRecordCount.Value;
177   - List<usp_GetUsersList_Result> Users = dbContext.usp_GetUsersList(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, iLoginUserType, pageNo, pageLength, spRecordCount).ToList();
  200 + List<usp_GetUsersList_Result> Users = dbContext.usp_GetUsersList(firstname, lastname, emailid, accountnumber, UserTypeId, AccountTypeId, iLoginUserType, loginStatus, pageNo, pageLength, spRecordCount).ToList();
178 201 if (!string.IsNullOrEmpty(loggedIn))
179 202 {
180 203 if (Users.Where(s => s.LoginId == loggedIn).Count() > 0)
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... ... @@ -4399,7 +4399,7 @@ namespace AIAHTML5.ADMIN.API.Entity
4399 4399 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<string>("usp_GetUserList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount);
4400 4400 }
4401 4401  
4402   - public virtual ObjectResult<usp_GetUsersList_Result> usp_GetUsersList(string sFirstName, string sLastName, string sEmailId, string sAccoutNumber, Nullable<int> iUserTypeId, Nullable<int> iAccountTypeId, Nullable<int> iLoginUserType, Nullable<int> pageNo, Nullable<int> pageLength, ObjectParameter recordCount)
  4402 + public virtual ObjectResult<usp_GetUsersList_Result> usp_GetUsersList(string sFirstName, string sLastName, string sEmailId, string sAccoutNumber, Nullable<int> iUserTypeId, Nullable<int> iAccountTypeId, Nullable<int> iLoginUserType, Nullable<bool> iLoginStatus, Nullable<int> pageNo, Nullable<int> pageLength, ObjectParameter recordCount)
4403 4403 {
4404 4404 var sFirstNameParameter = sFirstName != null ?
4405 4405 new ObjectParameter("sFirstName", sFirstName) :
... ... @@ -4429,6 +4429,10 @@ namespace AIAHTML5.ADMIN.API.Entity
4429 4429 new ObjectParameter("iLoginUserType", iLoginUserType) :
4430 4430 new ObjectParameter("iLoginUserType", typeof(int));
4431 4431  
  4432 + var iLoginStatusParameter = iLoginStatus.HasValue ?
  4433 + new ObjectParameter("iLoginStatus", iLoginStatus) :
  4434 + new ObjectParameter("iLoginStatus", typeof(bool));
  4435 +
4432 4436 var pageNoParameter = pageNo.HasValue ?
4433 4437 new ObjectParameter("pageNo", pageNo) :
4434 4438 new ObjectParameter("pageNo", typeof(int));
... ... @@ -4437,7 +4441,7 @@ namespace AIAHTML5.ADMIN.API.Entity
4437 4441 new ObjectParameter("pageLength", pageLength) :
4438 4442 new ObjectParameter("pageLength", typeof(int));
4439 4443  
4440   - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetUsersList_Result>("usp_GetUsersList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, pageNoParameter, pageLengthParameter, recordCount);
  4444 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<usp_GetUsersList_Result>("usp_GetUsersList", sFirstNameParameter, sLastNameParameter, sEmailIdParameter, sAccoutNumberParameter, iUserTypeIdParameter, iAccountTypeIdParameter, iLoginUserTypeParameter, iLoginStatusParameter, pageNoParameter, pageLengthParameter, recordCount);
4441 4445 }
4442 4446  
4443 4447 public virtual ObjectResult<usp_GetUserTyeByAccountNumber_Result> usp_GetUserTyeByAccountNumber(Nullable<byte> iUserTypeId, Nullable<int> iLicenseId)
... ... @@ -4990,5 +4994,22 @@ namespace AIAHTML5.ADMIN.API.Entity
4990 4994  
4991 4995 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status);
4992 4996 }
  4997 +
  4998 + public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<bool> isAlreadyLogin)
  4999 + {
  5000 + var userIdParameter = userId.HasValue ?
  5001 + new ObjectParameter("userId", userId) :
  5002 + new ObjectParameter("userId", typeof(int));
  5003 +
  5004 + var tagParameter = tag != null ?
  5005 + new ObjectParameter("tag", tag) :
  5006 + new ObjectParameter("tag", typeof(string));
  5007 +
  5008 + var isAlreadyLoginParameter = isAlreadyLogin.HasValue ?
  5009 + new ObjectParameter("isAlreadyLogin", isAlreadyLogin) :
  5010 + new ObjectParameter("isAlreadyLogin", typeof(bool));
  5011 +
  5012 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, isAlreadyLoginParameter);
  5013 + }
4993 5014 }
4994 5015 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs
1   -// T4 code generation is enabled for model 'E:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
  1 +// T4 code generation is enabled for model 'F:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
2 2 // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
3 3 // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
4 4 // is open in the designer.
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... ... @@ -1228,6 +1228,7 @@
1228 1228 <Parameter Name="iUserTypeId" Type="int" Mode="In" />
1229 1229 <Parameter Name="iAccountTypeId" Type="int" Mode="In" />
1230 1230 <Parameter Name="iLoginUserType" Type="int" Mode="In" />
  1231 + <Parameter Name="iLoginStatus" Type="bit" Mode="In" />
1231 1232 <Parameter Name="pageNo" Type="int" Mode="In" />
1232 1233 <Parameter Name="pageLength" Type="int" Mode="In" />
1233 1234 <Parameter Name="recordCount" Type="int" Mode="InOut" />
... ... @@ -1406,6 +1407,11 @@
1406 1407 <Parameter Name="SiteEditionIds" Type="varchar" Mode="In" />
1407 1408 <Parameter Name="Status" Type="int" Mode="InOut" />
1408 1409 </Function>
  1410 + <Function Name="usp_ManageUserLoginStatus" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  1411 + <Parameter Name="userId" Type="int" Mode="In" />
  1412 + <Parameter Name="tag" Type="varchar" Mode="In" />
  1413 + <Parameter Name="isAlreadyLogin" Type="bit" Mode="In" />
  1414 + </Function>
1409 1415 <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
1410 1416 <Parameter Name="UserId" Type="int" Mode="In" />
1411 1417 <Parameter Name="LabExerciseIdentifier" Type="nchar" Mode="In" />
... ... @@ -2843,6 +2849,7 @@
2843 2849 <Parameter Name="iUserTypeId" Mode="In" Type="Int32" />
2844 2850 <Parameter Name="iAccountTypeId" Mode="In" Type="Int32" />
2845 2851 <Parameter Name="iLoginUserType" Mode="In" Type="Int32" />
  2852 + <Parameter Name="iLoginStatus" Mode="In" Type="Boolean" />
2846 2853 <Parameter Name="pageNo" Mode="In" Type="Int32" />
2847 2854 <Parameter Name="pageLength" Mode="In" Type="Int32" />
2848 2855 <Parameter Name="recordCount" Mode="InOut" Type="Int32" />
... ... @@ -2996,6 +3003,11 @@
2996 3003 <Parameter Name="iEditionId" Mode="In" Type="Byte" />
2997 3004 <Parameter Name="Status" Mode="InOut" Type="Int32" />
2998 3005 </FunctionImport>
  3006 + <FunctionImport Name="usp_ManageUserLoginStatus" ReturnType="Collection(Boolean)">
  3007 + <Parameter Name="userId" Mode="In" Type="Int32" />
  3008 + <Parameter Name="tag" Mode="In" Type="String" />
  3009 + <Parameter Name="isAlreadyLogin" Mode="In" Type="Boolean" />
  3010 + </FunctionImport>
2999 3011 </EntityContainer>
3000 3012 <ComplexType Name="DA_GetBaseLayer_Result">
3001 3013 <Property Type="Int32" Name="Id" Nullable="false" />
... ... @@ -4318,6 +4330,8 @@
4318 4330 <Property Type="String" Name="UserStatus" Nullable="true" MaxLength="8" />
4319 4331 <Property Type="Int32" Name="UserTypeId" Nullable="true" />
4320 4332 <Property Type="Int32" Name="EditionTypeId" Nullable="true" />
  4333 + <Property Type="Boolean" Name="LoginStatus" Nullable="true" />
  4334 + <Property Type="String" Name="TotalLogin" Nullable="true" MaxLength="50" />
4321 4335 </ComplexType>
4322 4336 <ComplexType Name="usp_GetUserTyeByAccountNumber_Result">
4323 4337 <Property Type="Byte" Name="Id" Nullable="true" />
... ... @@ -6284,6 +6298,8 @@
6284 6298 <ScalarProperty Name="UserStatus" ColumnName="UserStatus" />
6285 6299 <ScalarProperty Name="UserTypeId" ColumnName="UserTypeId" />
6286 6300 <ScalarProperty Name="EditionTypeId" ColumnName="EditionTypeId" />
  6301 + <ScalarProperty Name="LoginStatus" ColumnName="LoginStatus" />
  6302 + <ScalarProperty Name="TotalLogin" ColumnName="TotalLogin" />
6287 6303 </ComplexTypeMapping>
6288 6304 </ResultMapping>
6289 6305 </FunctionImportMapping>
... ... @@ -6305,6 +6321,7 @@
6305 6321 <FunctionImportMapping FunctionImportName="usp_UpdateLicenseAccount" FunctionName="AIADatabaseV5Model.Store.usp_UpdateLicenseAccount" />
6306 6322 <FunctionImportMapping FunctionImportName="usp_UpdateUserProfile" FunctionName="AIADatabaseV5Model.Store.usp_UpdateUserProfile" />
6307 6323 <FunctionImportMapping FunctionImportName="usp_InsertAIAUser" FunctionName="AIADatabaseV5Model.Store.usp_InsertAIAUser" />
  6324 + <FunctionImportMapping FunctionImportName="usp_ManageUserLoginStatus" FunctionName="AIADatabaseV5Model.Store.usp_ManageUserLoginStatus" />
6308 6325 </EntityContainerMapping>
6309 6326 </Mapping>
6310 6327 </edmx:Mappings>
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs
... ... @@ -29,5 +29,7 @@ namespace AIAHTML5.ADMIN.API.Entity
29 29 public string UserStatus { get; set; }
30 30 public Nullable<int> UserTypeId { get; set; }
31 31 public Nullable<int> EditionTypeId { get; set; }
  32 + public Nullable<bool> LoginStatus { get; set; }
  33 + public string TotalLogin { get; set; }
32 34 }
33 35 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... ... @@ -65,6 +65,21 @@ namespace AIAHTML5.ADMIN.API.Models
65 65 return false;
66 66 }
67 67 }
  68 + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, bool isAlreadyLoggedIn)
  69 + {
  70 + bool loginStatus = false;
  71 + try
  72 + {
  73 + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, isAlreadyLoggedIn).FirstOrDefault());
  74 +
  75 + return loginStatus;
  76 + }
  77 + catch (Exception ex)
  78 + {
  79 + throw new Exception();
  80 + }
  81 + }
  82 +
68 83 public static string UpdateUserId(AIADatabaseV5Entities dbContext, int id, string userId, string oldUserId)
69 84 {
70 85 var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
... ...
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... ... @@ -36,5 +36,6 @@ namespace AIAHTML5.API.Constants
36 36 public const string GET_MODESTY_FOR_THIS_LICENSE = "usp_GetModestyForThisLicense";
37 37 public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage";
38 38 public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage";
  39 + public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus";
39 40 }
40 41 }
41 42 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -361,6 +361,27 @@ namespace AIAHTML5.API.Controllers
361 361 return insertImageResult;
362 362 }
363 363  
  364 + [HttpPost]
  365 + [Route("api/ManageUserLoginStatus")]
  366 + public HttpResponseMessage ManageUserLoginStatus([FromBody]JObject jsonData)
  367 + {
  368 + string loginStatus = string.Empty;
  369 + try
  370 + {
  371 + int userId = jsonData["userId"].Value<int>();
  372 + string tagName = jsonData["tagName"].Value<string>();
  373 + bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>();
  374 +
  375 + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn);
  376 +
  377 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) };
  378 + }
  379 + catch (Exception ex)
  380 + {
  381 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
  382 + }
  383 + }
  384 +
364 385 // PUT api/authenticate/5
365 386 public void Put(int id, [FromBody]string value)
366 387 {
... ... @@ -371,4 +392,6 @@ namespace AIAHTML5.API.Controllers
371 392 {
372 393 }
373 394 }
  395 +
  396 +
374 397 }
375 398 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs
1   -using System;
  1 +using System;
2 2 using System.Collections.Generic;
3 3 using System.Linq;
4 4 using System.Net;
5 5 using System.Net.Http;
6 6 using System.Web.Http;
7 7 using System.Configuration;
  8 +using Newtonsoft.Json;
  9 +
8 10 namespace AIAHTML5.API.Controllers
9 11 {
10 12 public class ConfigurationController : ApiController
... ... @@ -13,12 +15,24 @@ namespace AIAHTML5.API.Controllers
13 15 [HttpGet]
14 16 public HttpResponseMessage GetConfigurationvalues()
15 17 {
16   - // int current_year = Int32.Parse(ConfigurationManager.AppSettings["Copyrightyear"]);
  18 + dynamic responseData;
  19 + MyConfig mconfig = new MyConfig();
  20 + mconfig.current_year= DateTime.Now.Year;
  21 + mconfig.idleTime = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME"]);
  22 + mconfig.idelTimeOut = Int32.Parse(ConfigurationManager.AppSettings["IDLE_TIME_OUT"]);
  23 + mconfig.pingInterval = Int32.Parse(ConfigurationManager.AppSettings["PING_INTERVAL"]);
17 24  
18   - int current_year = DateTime.Now.Year;
19 25  
20   - HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, current_year);
21   - return response;
  26 + responseData = JsonConvert.SerializeObject(mconfig);
  27 +
  28 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) };
22 29 }
23 30 }
  31 +}
  32 +public class MyConfig
  33 +{
  34 + public int current_year { get; set; }
  35 + public int idleTime { get; set; }
  36 + public int idelTimeOut { get; set; }
  37 + public int pingInterval { get; set; }
24 38 }
25 39 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -310,6 +310,41 @@ namespace AIAHTML5.API.Models
310 310 return objUser;
311 311 }
312 312  
  313 + internal static string GetUserLoginStatus(int userId,string tagName,bool isAlreadyLoggedIn)
  314 + {
  315 + string status=string.Empty;
  316 + DBModel objModel = new DBModel();
  317 +
  318 + SqlConnection conn = new SqlConnection(dbConnectionString);
  319 + SqlCommand cmd = new SqlCommand();
  320 + SqlDataAdapter adapter;
  321 + DataSet ds = new DataSet();
  322 +
  323 + cmd.Connection = conn;
  324 + cmd.CommandText = DBConstants.GET_USER_LOGIN_STATUS;
  325 + cmd.CommandType = CommandType.StoredProcedure;
  326 + cmd.Parameters.AddWithValue("@userId", userId);
  327 + cmd.Parameters.AddWithValue("@tag", tagName);
  328 + cmd.Parameters.AddWithValue("@isAlreadyLogin", isAlreadyLoggedIn);
  329 + adapter = new SqlDataAdapter(cmd);
  330 + adapter.Fill(ds);
  331 +
  332 + if (ds != null && ds.Tables.Count > 0)
  333 + {
  334 + DataTable dt = ds.Tables[0];
  335 +
  336 + if (dt.Rows.Count > 0)
  337 + {
  338 + foreach (DataRow dr in dt.Rows)
  339 + {
  340 + status = dr["loginStatus"].ToString();
  341 +
  342 + }
  343 + }
  344 + }
  345 +
  346 + return status;
  347 + }
313 348 internal static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId)
314 349 {
315 350 logger.Debug(" Inside UpdateUserPassword for LoginId: " + loginId + ", EmailId: " + emailId);
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -306,6 +306,17 @@ namespace AIAHTML5.API.Models
306 306 }
307 307  
308 308  
  309 + internal static string GetUserLoginStatus(int userId, string tagName,bool isAlreadyLoggedIn)
  310 + {
  311 + string status = null;
  312 + status = DBModel.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn);
  313 +
  314 + return status;
  315 + }
  316 +
  317 +
  318 +
  319 +
309 320  
310 321 internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword)
311 322 {
... ...
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -31,6 +31,12 @@
31 31 </log4net>
32 32  
33 33 <appSettings>
  34 + <!-- set Idel time 20 minute -->
  35 + <add key="IDLE_TIME" value="1200" />
  36 + <!-- set idle timeout 30 seconds -->
  37 + <add key="IDLE_TIME_OUT" value="30" />
  38 + <!-- set ping time interval 30 seconds -->
  39 + <add key="PING_INTERVAL" value="10" />
34 40 <add key="Copyrightyear" value="2018" />
35 41  
36 42 <add key="SenderEmailAddress" value="support@interactiveanatomy.com" />
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js
1   -AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile",
2   -function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) {
  1 +AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile","$interval",
  2 +function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile,$interval) {
3 3  
4 4  
5 5 $scope.showTabButton = false;
... ... @@ -167,7 +167,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
167 167 currentController: '3dAController',
168 168 parentSlug: '3d-anatomy-list',
169 169 content: '<div class="col-sm-12" style="height: 590px;overflow: auto;">' +
170   - '<object data="' + $scope.Selected3DImagePath + '" width="100%" height="600px" type="image/svg+xml"></object>' +
  170 + '<object data="' + $scope.Selected3DImagePath + '" width="100%" height="600px" type="image/svg+xml" id="threedImage" onload="AnimationOnLoad(event)"></object>' +
171 171 '</div><script>$(document).ready(function(){var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {var threeDivWidth = $("#ThreeDView").css("width");$("#ThreeDView").css({"left":"0px","width":"100%","min-idth": threeDivWidth}); var jspanelContainerWidth = $(".jsPanel-content").css("width"); $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth}); $("#3DImagePanel").css("width", "100%"); }});</script>',
172 172 title: $rootScope.getLocalStorageValue("currentViewTitle"),
173 173 position: {
... ... @@ -204,10 +204,56 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
204 204  
205 205 }
206 206  
207   -
  207 + $scope.AnimationOnLoad = function () {
  208 +
  209 + $scope.JsPanelMouseEnter();
208 210  
209   -}]
  211 + }
210 212  
  213 + $scope.JsPanelMouseEnter = function () {
  214 +
  215 + var timeintval = null;
  216 + timeintval = $interval(PointerEventEnableDisable, 5000);
  217 +
  218 + function PointerEventEnableDisable() {
  219 + var pointevents = $("#threedImage").css('pointer-events');
  220 + if (pointevents=='auto') {
  221 + $scope.stop3drefresh(timeintval);
  222 + timeintval = $interval(PointerEventEnableDisable, 500);
  223 + $("#threedImage").css('pointer-events', 'none');
  224 + }
  225 + else if(pointevents=='none')
  226 + {
  227 + $("#threedImage").css('pointer-events', 'auto');
  228 + $scope.stop3drefresh(timeintval);
  229 + timeintval = $interval(PointerEventEnableDisable, 5000);
  230 + }
  231 + else
  232 + {
  233 + //auto clode interval when panel close
  234 + $scope.stop3drefresh(timeintval);
  235 + }
  236 + }
211 237  
  238 + $scope.stop3drefresh = function (timeintval) {
  239 + if (angular.isDefined(timeintval)) {
  240 + $interval.cancel(timeintval);
  241 + timeintval = undefined;
  242 + }
  243 + };
  244 +
  245 + }
212 246  
213   -);
214 247 \ No newline at end of file
  248 +
  249 +
  250 +}]);
  251 +
  252 +function AnimationOnLoad(event) {
  253 +
  254 + console.log('animation loaded')
  255 + var scope = angular.element(document.getElementById("ThreeDView")).scope();
  256 +
  257 + scope.$apply(function () {
  258 + scope.AnimationOnLoad();
  259 + });
  260 +}
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
1 1 'use strict';
2 2  
3   -AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService","ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants",
4   -function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, AuthenticationService,ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants,AIAConstants) {
  3 +AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService","ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","$window","Idle", "Keepalive",
  4 +function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, AuthenticationService,ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants,AIAConstants,$window,Idle, Keepalive) {
5 5  
6 6 //$scope.pageToOpen = {
7 7 // name: 'MainMenu'
... ... @@ -143,9 +143,9 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
143 143 if (navigator.cookieEnabled) {
144 144  
145 145 $rootScope.isLoading = false;
146   -
  146 + $rootScope.isLoginLoading = false;
147 147 var url = $location.url();
148   -
  148 +
149 149 //unblock user
150 150 if (url.indexOf('?unb:') != -1) {
151 151  
... ... @@ -165,8 +165,55 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
165 165 //get user is already loggedin or not
166 166 $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
167 167 if ($scope.currentUserDetails != undefined) {
168   - AuthenticateAlreadyLoggedInUser();
  168 + $rootScope.isVisibleLogin = false;
  169 + ConfigurationService.getCofigValue()
  170 + .then(
  171 + function (configresult) {
  172 + $rootScope.current_year = configresult.current_year;
  173 + $rootScope.aiaIdleTime = configresult.idleTime;
  174 + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut;
  175 + $rootScope.aiaPingInterval = configresult.pingInterval;
  176 +
  177 + var loggedInUser = JSON.parse($scope.currentUserDetails);
  178 + //incase site user login userid is 0 so then using license id
  179 + //logout site user while reload url without parameter
  180 + var userId=loggedInUser.Id==0?loggedInUser.LicenseId:loggedInUser.Id;
  181 + $scope.checkuserstatus = {
  182 + userId: userId,
  183 + tagName: loggedInUser.Id==0?'logout':'update',
  184 + isAlreadyLoggedIn:true
  185 + }
  186 +
  187 + // this case found when browser closed by user after login. after long time (after 20 min) open site again
  188 + // loggedInUserDetails contain user detail so user auto login but it is logout by
  189 + // 1.by agent job 2. or by admin section from db
  190 + // so check user session again before auto login
  191 + AuthenticationService.ManageUserLoginStatus($scope.checkuserstatus)
  192 + .then(
  193 + function (loginStatus) {
  194 + if(loginStatus!=null)
  195 + {
  196 + if(loginStatus=='False')
  197 + {
  198 + $rootScope.LogoutUserSession();
  199 + }
  200 + else
  201 + {
  202 + AuthenticateAlreadyLoggedInUser();
  203 + }
  204 + }
  205 +
  206 + }),
  207 + function (error) {
  208 + console.log(' Error in user login status = ' + error.statusText);
  209 + $rootScope.errorMessage = error;
  210 + $("#messageModal").modal('show');
  211 + }
  212 +
  213 + });
  214 +
169 215 }
  216 +
170 217 var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked');
171 218  
172 219 if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) {
... ... @@ -188,20 +235,39 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
188 235 $rootScope.promptUserForCookies();
189 236 }
190 237  
  238 + $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
  239 + if ($scope.currentUserDetails == undefined) {
191 240 $rootScope.getConfigurationValues();
  241 + }
192 242 }
193 243 }
194 244 $rootScope.getConfigurationValues = function ()
195 245 {
196 246 ConfigurationService.getCofigValue()
197 247 .then(
198   - function (configresult) {
199   - $rootScope.current_year = configresult;
  248 + function (configresult) {
  249 + $rootScope.current_year = configresult.current_year;
  250 + $rootScope.aiaIdleTime = configresult.idleTime;
  251 + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut;
  252 + $rootScope.aiaPingInterval = configresult.pingInterval;
200 253  
201 254 });
202 255 }
203   - $rootScope.AuthenticateUser = function (userInfo)
204   - {
  256 + $rootScope.LoginEnableUI=function()
  257 + {
  258 + $rootScope.isLoginLoading = false;
  259 + $('#spinnerLogin').css('visibility', 'hidden');
  260 + $('.loginPanel').css('pointer-events', 'auto');
  261 + $('.loginPanel').css('opacity', '1');
  262 + }
  263 + $rootScope.LoginDisableUI=function()
  264 + {
  265 + $rootScope.isLoginLoading = true;
  266 + $('#spinnerLogin').css('visibility', 'visible');
  267 + $('.loginPanel').css('pointer-events', 'none');
  268 + $('.loginPanel').css('opacity', '0.7');
  269 + }
  270 + $rootScope.AuthenticateUser = function (userInfo,isAlreadyLoggedIn) {
205 271 if (navigator.cookieEnabled) {
206 272 $rootScope.errorMessage = "";
207 273 if (userInfo.username == "" || userInfo.username == null || userInfo.username == undefined || userInfo.password == "" || userInfo.password == null || userInfo.password == undefined) {
... ... @@ -211,14 +277,15 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
211 277 $("#messageModal").modal('show');
212 278 }
213 279 else {
214   -
215   -
  280 +
  281 + $rootScope.LoginDisableUI();
216 282 AuthenticationService.authenticateUser(userInfo)
217 283 .then(
218 284  
219 285 function (result) {
220 286  
221 287 if (result == LoginConstants.USER_NOT_FOUND) {
  288 + $rootScope.LoginEnableUI();
222 289 $rootScope.isVisibleLogin = true;
223 290 // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
224 291 $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
... ... @@ -226,8 +293,15 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
226 293 }
227 294 else {
228 295  
229   - // birendra// initialize exp img detail object
230   - $rootScope.initializeUserForExportImage(result.Id);
  296 + // birendra// initialize exp img detail object
  297 + $rootScope.initializeUserForExportImage(result.Id);
  298 + // update result with session detail
  299 + result.aiaIdleTime=$rootScope.aiaIdleTime;
  300 + result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut;
  301 + result.aiaPingInterval=$rootScope.aiaPingInterval;
  302 + $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn;
  303 + //display user name
  304 + $rootScope.userName=result.FirstName+" "+result.LastName;
231 305  
232 306 //code for modesty setting
233 307 if (result.LicenseInfo != null) {
... ... @@ -274,55 +348,65 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
274 348 }
275 349 if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) {
276 350 $rootScope.isVisibleLogin = true;
  351 + $rootScope.LoginEnableUI();
277 352 $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD;
278 353 $("#messageModal").modal('show');
279 354 }
280 355 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) {
281 356 $rootScope.isVisibleLogin = true;
  357 + $rootScope.LoginEnableUI();
282 358 $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;
283 359 $("#messageModal").modal('show');
284 360 }
285 361 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
286 362 $rootScope.isVisibleLogin = true;
  363 + $rootScope.LoginEnableUI();
287 364 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
288 365 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
289 366 $("#messageModal").modal('show');
290 367 }
291 368 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
292 369 $rootScope.isVisibleLogin = true;
  370 + $rootScope.LoginEnableUI();
293 371 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
294 372 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
295 373 $("#messageModal").modal('show');
296 374 }
297 375 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
298 376 $rootScope.isVisibleLogin = true;
  377 + $rootScope.LoginEnableUI();
299 378 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
300 379 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
301 380 $("#messageModal").modal('show');
302 381 }
303 382 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
304 383 $rootScope.isVisibleLogin = true;
  384 + $rootScope.LoginEnableUI();
305 385 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
306 386 $("#messageModal").modal('show');
307 387 }
308 388 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) {
309 389 $rootScope.isVisibleLogin = true;
  390 + $rootScope.LoginEnableUI();
310 391 $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
311 392 $("#messageModal").modal('show');
312 393 }
313 394 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
314 395 $rootScope.isVisibleLogin = true;
  396 + $rootScope.LoginEnableUI();
315 397 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
316 398 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
317 399 $("#messageModal").modal('show');
318 400 }
319 401 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
320 402 $rootScope.isVisibleLogin = true;
  403 + $rootScope.LoginEnableUI();
321 404 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
322 405 $("#messageModal").modal('show');
323 406 }
324 407 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
325 408 $rootScope.isVisibleLogin = true;
  409 + $rootScope.LoginEnableUI();
326 410 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
327 411 $("#messageModal").modal('show');
328 412 }
... ... @@ -343,14 +427,11 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
343 427 $rootScope.userData = result;
344 428 $rootScope.userModules = result.Modules;
345 429  
346   - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
347   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
348   - }
349   -
350   - if (isCommingSoonModel == true)
351   - {
352   -
353   - // ShowAssignedModulesPopup(result.Modules);
  430 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  431 +
  432 + if (isCommingSoonModel == true) {
  433 +
  434 + // ShowAssignedModulesPopup(result.Modules);
354 435  
355 436 if (userInfo.rememberChk) {
356 437  
... ... @@ -365,6 +446,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
365 446  
366 447  
367 448 $location.path('/');
  449 +
  450 + $timeout(function () {
  451 + $rootScope.LoginEnableUI();
  452 + }, 100);
368 453  
369 454 }
370 455 else
... ... @@ -381,11 +466,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
381 466 $rootScope.haveRoleAdmin = false;
382 467 }
383 468  
384   - // Remove Admin Link for LicenseEditionId 3/4 of student
385   - if (result.EditionId == 3 || result.EditionId == 4) {
386   - $rootScope.haveRoleAdmin = false;
387   -
388   - }
389 469  
390 470 if (result.LicenseInfo != null) {
391 471  
... ... @@ -419,14 +499,17 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
419 499 $rootScope.userData = result;
420 500 $rootScope.userModules = result.Modules;
421 501  
422   - $("#modestyDiv").css("pointer-events", "none");
423   - $("#modestyDiv").css("opacity", 0.5);
424   - //2.
425   - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
426   -
427   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
428   - }
429   -
  502 + //only instructor allowed to change modesty
  503 + //concurrent user of non-instructor
  504 + if( result.UserTypeId == 6 && result.EditionId!=1 && result.EditionId!=2)
  505 + {
  506 + $("#modestyDiv").css("pointer-events", "none");
  507 + $("#modestyDiv").css("opacity", 0.5);
  508 + $("#modestyDiv").find("*").prop('disabled', true);
  509 + }
  510 +
  511 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  512 +
430 513 // 3.ShowAssignedModulesPopup
431 514 //isCommingSoonModel =true only when user comes first time on application and login
432 515 if (isCommingSoonModel == true) {
... ... @@ -446,11 +529,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
446 529  
447 530 //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
448 531 localStorage.setItem('isCommingSoonModel', false);
449   -
450   - // for reseller type user first need to update profile
451   - // only instructor ,not student
452   - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
453 532  
  533 + // for reseller type user first need to update profile
  534 + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
  535 + $rootScope.LoginEnableUI();
454 536 $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
455 537  
456 538 $("#profileUpdateModal").modal('show');
... ... @@ -460,6 +542,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
460 542 }
461 543 else {
462 544 $location.path('/');
  545 + $timeout(function () {
  546 + $rootScope.LoginEnableUI();
  547 +
  548 + }, 100);
463 549 }
464 550 }
465 551 else {
... ... @@ -467,6 +553,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
467 553 $('#dvTerms').html(result.TermsAndConditionsText);
468 554 }
469 555 $rootScope.isVisibleLogin = true;
  556 + $rootScope.LoginEnableUI();
470 557 $('#dvTermCondition').fadeIn();
471 558 $rootScope.userData = result;
472 559 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
... ... @@ -477,6 +564,9 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
477 564  
478 565 }
479 566  
  567 + // set user session time
  568 + $rootScope.loadUserSession();
  569 + $rootScope.LoginEnableUI();
480 570 }
481 571  
482 572 }
... ... @@ -486,6 +576,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
486 576 function (error) {
487 577 console.log(' Error in authentication = ' + error.statusText);
488 578 // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  579 + $rootScope.LoginEnableUI();
489 580 $rootScope.isVisibleLogin = true;
490 581 $rootScope.errorMessage = error;
491 582 $("#messageModal").modal('show');
... ... @@ -572,54 +663,91 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
572 663 $rootScope.AuthenticateUser($rootScope.userInfo);
573 664 }
574 665 else {
  666 +
  667 + console.log($rootScope.siteUrlInfo);
  668 +
  669 + $rootScope.LoginDisableUI();
  670 + $scope.currentUserDetails = $rootScope.getLocalStorageValue('loggedInUserDetails');
  671 + var sitedetail=$rootScope.siteUrlInfo;
  672 + ConfigurationService.getCofigValue()
  673 + .then(
  674 + function (configresult) {
  675 + $rootScope.current_year = configresult.current_year;
  676 + $rootScope.aiaIdleTime = configresult.idleTime;
  677 + $rootScope.aiaIdleTimeOut = configresult.idelTimeOut;
  678 + $rootScope.aiaPingInterval = configresult.pingInterval;
  679 + $rootScope.aiaAnimationPath = configresult.serverPath;
  680 + $rootScope.MaxOneFileSize = configresult.fileSize;
  681 +
  682 + var loggedInUser = JSON.parse($scope.currentUserDetails);
  683 + //check already login by account number bcz no login id for site login
  684 + //maintain user session by licenseid of site login
  685 + if(loggedInUser!==null && loggedInUser.AccountNumber==sitedetail.accountNumber)
  686 + {
  687 + $rootScope.AuthenticateClientSiteUser(sitedetail,true);
  688 + }
  689 + else
  690 + {
  691 + $rootScope.AuthenticateClientSiteUser(sitedetail,false);
  692 + }
  693 + });
  694 + }
  695 + }
575 696  
576   -
577   - console.log($rootScope.siteUrlInfo);
578   -
579   - AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
  697 + $rootScope.AuthenticateClientSiteUser = function (siteInfo,isAlreadyLoggedIn) {
  698 + AuthenticationService.validateClientSite(siteInfo)
580 699 .then(
581   -
582 700 function (result) {
583   -
584   - console.log(result);
  701 + console.log(result);
585 702 if (result != null) {
586   -
587   -
588 703 console.log(result);
589 704 if (result == LoginConstants.INVALID_CLIENT) {
590 705 $rootScope.isVisibleLogin = true;
  706 + $rootScope.LoginEnableUI();
591 707 $rootScope.errorMessage = LoginConstants.INVALID_CLIENT;
592 708 $("#messageModal").modal('show');
593 709 }
594 710 else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) {
595 711 $rootScope.isVisibleLogin = true;
  712 + $rootScope.LoginEnableUI();
596 713 $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER;
597 714 $("#messageModal").modal('show');
598 715 }
599 716  
600 717 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) {
601 718 $rootScope.isVisibleLogin = true;
  719 + $rootScope.LoginEnableUI();
602 720 $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL;
603 721 $("#messageModal").modal('show');
604 722 }
605 723 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) {
606 724 $rootScope.isVisibleLogin = true;
  725 + $rootScope.LoginEnableUI();
607 726 $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL;
608 727 $("#messageModal").modal('show');
609 728 }
610 729 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) {
611 730 $rootScope.isVisibleLogin = true;
  731 + $rootScope.LoginEnableUI();
612 732 $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE;
613 733 $("#messageModal").modal('show');
614 734 }
615 735 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) {
616 736 $rootScope.isVisibleLogin = true;
  737 + $rootScope.LoginEnableUI();
617 738 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
618 739 $("#messageModal").modal('show');
619 740 }
620 741  
621 742  
622 743 else {
  744 + // update result with session detail
  745 + result.aiaIdleTime=$rootScope.aiaIdleTime;
  746 + result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut;
  747 + result.aiaPingInterval=$rootScope.aiaPingInterval;
  748 + $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn;
  749 + //display user name
  750 + $rootScope.userName=result.FirstName+" "+result.LastName;
623 751 if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) {
624 752 //code for modesty setting
625 753 if (result.LicenseInfo != null) {
... ... @@ -675,10 +803,8 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
675 803 $rootScope.userData = result;
676 804 $rootScope.userModules = result.Modules;
677 805  
678   - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
679   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
680   - }
681   -
  806 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  807 +
682 808 if (isCommingSoonModel == true) {
683 809  
684 810 ShowAssignedModulesPopup(result.Modules);
... ... @@ -697,6 +823,14 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
697 823 else {
698 824 if (result.LicenseInfo != null) {
699 825  
  826 + //only site instructor allowed to change modesty
  827 + if(result.EditionId!=1 && result.EditionId!=2)
  828 + {
  829 + $("#modestyDiv").css("pointer-events", "none");
  830 + $("#modestyDiv").css("opacity", 0.5);
  831 + $("#modestyDiv").find("*").prop('disabled', true);
  832 + }
  833 +
700 834 // set license id
701 835 $scope.UpdateUserExportImageData(result.Id, 'LicenseId', result.LicenseId)
702 836  
... ... @@ -729,10 +863,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
729 863 $rootScope.haveRoleAdmin = false;
730 864  
731 865 //2.
732   - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
733   -
734   - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
735   - }
  866 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
736 867  
737 868  
738 869 //5.
... ... @@ -750,6 +881,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
750 881 $('#dvTerms').html(result.TermsAndConditionsText);
751 882 }
752 883 $rootScope.isVisibleLogin = true;
  884 + $rootScope.LoginEnableUI();
753 885 $('#dvTermCondition').fadeIn();
754 886 $rootScope.userData = result;
755 887 $rootScope.haveRoleAdmin = false;
... ... @@ -757,6 +889,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
757 889 $location.path('/');
758 890 }
759 891 }
  892 + $rootScope.LoginEnableUI();
  893 + // set user session time
  894 + $rootScope.loadUserSession();
  895 +
760 896 }
761 897  
762 898  
... ... @@ -771,6 +907,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
771 907  
772 908 console.log(' Error in authentication = ' + error.statusText);
773 909 // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  910 + $rootScope.LoginEnableUI();
774 911 $rootScope.isVisibleLogin = true;
775 912 $rootScope.errorMessage = error;
776 913 $("#messageModal").modal('show');
... ... @@ -778,14 +915,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
778 915 }
779 916 )
780 917  
781   - }
782   - //$rootScope.siteUrlInfo.siteIP = siteInfo[0];
783   - //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1];
784   - //$rootScope.siteUrlInfo.accountNumber = siteInfo[2];
785   - //$rootScope.siteUrlInfo.edition = siteInfo[3];
786   - //$rootScope.siteUrlInfo.urlReferer = siteInfo[4];
787   -
788   -
789 918 }
790 919  
791 920 $scope.saveRemeberMeDetails = function (result, userInfo) {
... ... @@ -857,8 +986,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
857 986 $rootScope.userModules = userInfo.Modules;
858 987  
859 988 // for reseller type user first need to update profile
860   - // allow popup for instructor ,not for student.
861   - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) {
  989 + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) {
862 990  
863 991 $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
864 992  
... ... @@ -906,15 +1034,120 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
906 1034 }
907 1035  
908 1036 }
  1037 +
  1038 + $rootScope.loadUserSession = function () {
  1039 + //update session config from API
  1040 + Idle.setIdle($rootScope.aiaIdleTime);
  1041 + Idle.setTimeout($rootScope.aiaIdleTimeOut);
  1042 + Keepalive.setInterval($rootScope.aiaPingInterval);
  1043 +
  1044 + Idle.watch();// start the session
  1045 + $rootScope.isSessionTimeout=false;
  1046 + $rootScope.isRedirectToAdmin=false;
  1047 + $rootScope.userStatus = {
  1048 + userId: null,
  1049 + tagName: null,
  1050 + loginStatus: null,
  1051 + isAlreadyLoggedIn:null
  1052 + }
  1053 + console.log('user session start');
  1054 + $rootScope.CheckUserSession('insert',$rootScope.isAlreadyLoggedIn);
  1055 +
  1056 + $rootScope.$on('IdleStart', function() {
  1057 + // this event fire when idle time finish and time out start
  1058 + // config set in AIA.js -:IdleProvider.idle(1*30);;
  1059 + //alert('start');
  1060 + });
  1061 + $rootScope.$on('IdleEnd', function() {
  1062 + // this event fires by user activity during timeout period
  1063 + // it reset idle time and timeout
  1064 + // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll');
  1065 + // alert('end');
  1066 + });
  1067 + $rootScope.$on('IdleTimeout', function() {
  1068 + // this event fire when idle time finished and time out also finished
  1069 + // config set in AIA.js -:IdleProvider.timeout(15);
  1070 + $rootScope.isSessionTimeout=true;
  1071 + console.log('session is timeout');
  1072 + $rootScope.CheckUserSession('logout',true);
  1073 + });
  1074 + $rootScope.$on('Keepalive', function() {
  1075 + // it watch the session on perticular time interval during idle time period
  1076 + // config set in AIA.js -: KeepaliveProvider.interval(10);
  1077 + //we will use it to recieve request from databse if user logout from admin activity
  1078 + console.log('ping user session');
  1079 + $rootScope.CheckUserSession('update',true);
  1080 + });
  1081 +
  1082 +
  1083 + $window.onbeforeunload = function (e) {
  1084 + var confirmation = {};
  1085 + // if($location.url()!= "/") {
  1086 + if ($rootScope.isSessionTimeout==false && $rootScope.isRedirectToAdmin==false) {
  1087 + var event = $rootScope.$broadcast('onBeforeUnload', confirmation);
  1088 + if (event.defaultPrevented) {
  1089 + return confirmation.message;
  1090 + }
  1091 + }
  1092 + // }
  1093 +
  1094 + };
  1095 + }
909 1096  
  1097 + $rootScope.$on('onBeforeUnload', function (e, confirmation) {
  1098 + confirmation.message = "All data willl be lost.";
  1099 + e.preventDefault();
  1100 + });
910 1101  
911 1102 $rootScope.LogoutUser = function () {
  1103 + $rootScope.isSessionTimeout=true;
  1104 + localStorage.removeItem('loggedInUserDetails');
  1105 + localStorage.clear();
  1106 + $rootScope.CheckUserSession('logout',true);
  1107 + $timeout(function(){
  1108 + document.location = '/';
  1109 + $rootScope.isVisibleLogin = true;
  1110 + },50);
  1111 +
  1112 + }
  1113 + $rootScope.LogoutUserSession = function () {
  1114 + $rootScope.isSessionTimeout=true;
912 1115 localStorage.removeItem('loggedInUserDetails');
913 1116 localStorage.clear();
914 1117 document.location = '/';
915 1118 $rootScope.isVisibleLogin = true;
916 1119 }
917 1120  
  1121 + $rootScope.CheckUserSession = function (tagName,isAlreadyLoggedIn) {
  1122 + //console.log('user login id: '+$rootScope.userData.Id);
  1123 + //console.log('user login activity tag: '+tagName);
  1124 + if($rootScope.userData==undefined) return;
  1125 + //incase site user login userid is 0 so then using license id
  1126 + $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id;
  1127 + $rootScope.userStatus.tagName=tagName;
  1128 + $rootScope.userStatus.isAlreadyLoggedIn=isAlreadyLoggedIn;
  1129 + $rootScope.isAlreadyLoggedIn=true;
  1130 + AuthenticationService.ManageUserLoginStatus($rootScope.userStatus)
  1131 + .then(
  1132 + function (loginStatus) {
  1133 + if(loginStatus!=null)
  1134 + {
  1135 + if(loginStatus=='False')
  1136 + {
  1137 + $rootScope.LogoutUserSession();
  1138 + }
  1139 + }
  1140 +
  1141 + }),
  1142 + function (error) {
  1143 + console.log(' Error in user login status = ' + error.statusText);
  1144 + $rootScope.errorMessage = error;
  1145 + $("#messageModal").modal('show');
  1146 + }
  1147 +
  1148 + }
  1149 +
  1150 +
918 1151 function AuthenticateAlreadyLoggedInUser()
919 1152 {
920 1153  
... ... @@ -928,29 +1161,29 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
928 1161 userInfo["username"] = userInfo.LoginId;
929 1162 userInfo["password"] = userInfo.Password;
930 1163  
931   -
932   - $rootScope.AuthenticateUser(userInfo);
933   -
934   - if ($rootScope.refreshcheck == null) {
935 1164  
936   - if ($location.path() == "/lab-exercises-detail") {
  1165 + $rootScope.AuthenticateUser(userInfo,true);
937 1166  
938   - $location.url('/');
939   - }
940   - else {
  1167 + if ($rootScope.refreshcheck == null) {
941 1168  
942   - $location.path('/');
943   - }
944   - $rootScope.isVisibleLogin = false;
  1169 + if ($location.path() == "/lab-exercises-detail") {
  1170 +
  1171 + $location.url('/');
  1172 + }
  1173 + else {
  1174 +
  1175 + $location.url('/');
945 1176 }
  1177 + $rootScope.isVisibleLogin = false;
946 1178 }
947   -
  1179 + }
  1180 +
948 1181  
949 1182 }
950   - catch (e) {
951   - localStorage.removeItem('loggedInUserDetails');
952   - }
953   -
  1183 + catch (e) {
  1184 + localStorage.removeItem('loggedInUserDetails');
  1185 + }
  1186 +
954 1187 }
955 1188  
956 1189 $rootScope.SendMailToUser = function (userInfo, isMailForForgotPassword) {
... ... @@ -5770,6 +6003,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
5770 6003 $rootScope.reDirectURLToAdmin = function () {
5771 6004 $("#profileUpdateModal").modal('hide');
5772 6005 $timeout(function () {
  6006 + $rootScope.isRedirectToAdmin=true;
5773 6007 window.location.href = "Admin";
5774 6008 }, 300)
5775 6009  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js
1 1 'use strict';
2 2  
3   -AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams",
4   -function ($scope, $rootScope, log, $location, pages, $routeParams) {
  3 +AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval",
  4 +function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) {
5 5  
6 6 //$rootScope.currentActiveModuleTitle = Modules[10].Name;
7 7 //$rootScope.currentActiveModuleTitle = $routeParams.modname;
... ... @@ -18,7 +18,6 @@ function ($scope, $rootScope, log, $location, pages, $routeParams) {
18 18  
19 19 $scope.$on('$viewContentLoaded', function (event) {
20 20  
21   -
22 21 if ($rootScope.refreshcheck == null) {
23 22 $location.path('/');
24 23 }
... ... @@ -28,44 +27,76 @@ function ($scope, $rootScope, log, $location, pages, $routeParams) {
28 27 var $uaAOD = navigator.userAgent;
29 28 for (var i = 0; i < $scope.links.length; i++) {
30 29 if ($scope.links[i].modname == $routeParams.modname) {
31   - $rootScope.currentActiveModuleTitle = $scope.links[i].title;
32   - if ($rootScope.currentActiveModuleTitle == "IP 10" )
33   - {
34   - // document.getElementById('externalLink').style.height = "1024px";
35   - document.getElementById('externalLink').style.height = $(window).outerHeight() - 41 + "px";
36   -
37   -
  30 + $rootScope.currentActiveModuleTitle = $scope.links[i].title;
  31 + if ($rootScope.currentActiveModuleTitle == "IP 10" )
  32 + {
  33 + // document.getElementById('externalLink').style.height = "1024px";
  34 + document.getElementById('externalLink').style.height = $(window).outerHeight() - 41 + "px";
38 35  
39   - }
40   - $scope.objdata = $scope.links[i].objurl;
41   - $scope.myObj = $scope.links[i].objstyle;
42   - if ($('#externalLink').css('display') === 'none')
43   - {
44   - document.getElementById('externalLink').style.display = "block";
45   - document.getElementById('externalLinkiframe').style.display = "none";
46   -
47   - }
  36 + }
  37 + $scope.objdata = $scope.links[i].objurl;
  38 + $scope.myObj = $scope.links[i].objstyle;
  39 + if ($('#externalLink').css('display') === 'none')
  40 + {
  41 + document.getElementById('externalLink').style.display = "block";
  42 + document.getElementById('externalLinkiframe').style.display = "none";
48 43  
49   - if ($rootScope.currentActiveModuleTitle == "A.D.A.M OnDemand") {
50   - if ($uaAOD.match(/(iPod|iPhone|iPad)/i))
51   - {
52   - document.getElementById('externalLink').style.display = "none";
53   - document.getElementById('externalLinkiframe').style.display = "block";
54   - document.getElementById('externalLinkiframe').style.height = $(window).outerHeight() - 128 + "px";
55   - document.getElementById("externalLinkiframe").src = $scope.objdata;
56   -
57   - }
58   -
59   - else {
60   - document.getElementById('externalLink').style.height = $(window).outerHeight() - 128 + "px";
61   -
62   - }
63   -
64   - }
65   - }
  44 + }
  45 +
  46 + if ($rootScope.currentActiveModuleTitle == "A.D.A.M OnDemand") {
  47 + if ($uaAOD.match(/(iPod|iPhone|iPad)/i))
  48 + {
  49 + document.getElementById('externalLink').style.display = "none";
  50 + document.getElementById('externalLinkiframe').style.display = "block";
  51 + document.getElementById('externalLinkiframe').style.height = $(window).outerHeight() - 128 + "px";
  52 + document.getElementById("externalLinkiframe").src = $scope.objdata;
  53 +
  54 + }
  55 +
  56 + else {
  57 + document.getElementById('externalLink').style.height = $(window).outerHeight() - 128 + "px";
  58 +
  59 + }
  60 +
  61 + }
  62 +
  63 + $scope.refreshIdleTime();
  64 + }
66 65 }
67 66 });
68 67  
  68 + $scope.refreshIdleTime = function () {
  69 + var timeintval = null;
  70 + timeintval = $interval(PointerEventEnableDisable, 5000);
  71 +
  72 + function PointerEventEnableDisable() {
  73 + var pointevents = $("#externalLink").css('pointer-events');
  74 + if (pointevents=='auto') {
  75 + $scope.stopLinkRefresh(timeintval);
  76 + timeintval = $interval(PointerEventEnableDisable, 500);
  77 + $("#externalLink").css('pointer-events', 'none');
  78 + }
  79 + else if(pointevents=='none')
  80 + {
  81 + $("#externalLink").css('pointer-events', 'auto');
  82 + $scope.stopLinkRefresh(timeintval);
  83 + timeintval = $interval(PointerEventEnableDisable, 5000);
  84 + }
  85 + else
  86 + {
  87 + //auto clode interval when panel close
  88 + $scope.stopLinkRefresh(timeintval);
  89 + }
  90 + }
  91 +
  92 + $scope.stopLinkRefresh = function (timeintval) {
  93 + if (angular.isDefined(timeintval)) {
  94 + $interval.cancel(timeintval);
  95 + timeintval = undefined;
  96 + }
  97 + };
  98 + }
  99 +
69 100 $scope.showTabButton = false;
70 101 $scope.IsVisible = function () {
71 102 $scope.scroll();
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
1 1 'use strict';
2 2  
3   -var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage']);
  3 +var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage','ngIdle']);
4 4  
5 5  
6 6  
... ... @@ -367,7 +367,7 @@ AIA.constant(&quot;LoginConstants&quot;, {
367 367 });
368 368  
369 369 AIA.constant("LoginMessageConstants", {
370   - "USER_UPDATE_PROFILE":"Please update your profile first",
  370 + "USER_UPDATE_PROFILE":"Please update your profile first.",
371 371 "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.",
372 372 "RESET_PASSWORD": "Please check you email and reset your password.",
373 373 "USERID_SENT_IN_EMAIL": "We have sent you userId in email.",
... ... @@ -532,4 +532,10 @@ AIA.config(function ($routeProvider, pages, $locationProvider) {
532 532  
533 533 }
534 534 }
535   -});
536 535 \ No newline at end of file
  536 +});
  537 +AIA.config(function(IdleProvider, KeepaliveProvider) {
  538 + IdleProvider.idle(20*60); // 20 minutes idle
  539 + IdleProvider.timeout(30); // after 30 seconds idle, time the user out
  540 + KeepaliveProvider.interval(10); // 10 seconds keep-alive ping
  541 + IdleProvider.interrupt('keydown mousemove wheel mousedown touchstart touchmove scroll');
  542 +})
537 543 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -15,6 +15,7 @@
15 15 console.log('error')
16 16 deferred.reject(data);
17 17 $rootScope.isVisibleLogin = true;
  18 + $rootScope.LoginEnableUI();
18 19 $rootScope.errorMessage = data;
19 20 $("#messageModal").modal('show');
20 21  
... ... @@ -42,6 +43,26 @@
42 43 });
43 44 return deferred.promise;
44 45 },
  46 + ManageUserLoginStatus: function (logindata) {
  47 + var deferred = $q.defer();//userId tagName
  48 +
  49 + $http.post('/API/api/ManageUserLoginStatus', JSON.stringify(logindata), {
  50 + headers: {
  51 + 'Content-Type': 'application/json'
  52 + }
  53 + })
  54 + .success(function (data, status, headers, config) {
  55 + console.log('success')
  56 + deferred.resolve(data);
  57 + }).error(function (data, status, headers, config) {
  58 + console.log('error')
  59 + deferred.reject(data);
  60 + $rootScope.errorMessage = data;
  61 + $("#messageModal").modal('show');
  62 +
  63 + });
  64 + return deferred.promise;
  65 + },
45 66  
46 67 validateClientSite: function (clientInfo) {
47 68 var deferred = $q.defer();
... ... @@ -58,6 +79,7 @@
58 79 console.log('error')
59 80 deferred.reject(data);
60 81 $rootScope.isVisibleLogin = true;
  82 + $rootScope.LoginEnableUI();
61 83 $rootScope.errorMessage = data;
62 84 $("#messageModal").modal('show');
63 85  
... ...
400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html
... ... @@ -54,7 +54,7 @@
54 54 <li class ="navbarItem"><a ng-click="reDirectURLToAdmin()" ng-show="haveRoleAdmin" style="cursor: pointer;">Admin</a></li>
55 55 </ul>
56 56 <ul class="nav navbar-nav navbar-right">
57   - <li class="visible-xs"><a href="" ng-click="LogoutUser()">Logout</a></li>
  57 + <li class="navbarItem" style="pointer-events:none ;"><a href="#">{{userName}}</a></li>
58 58 <li class="hidden-xs marginR5 logOut" data-toggle="tooltip" data-placement="top" title="Logout"><a href="" ng-click="LogoutUser()"><i class="fa fa-power-off"></i></a></li>
59 59 </ul>
60 60 <div id="imaginary_container" style="visibility:hidden">
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -220,6 +220,9 @@
220 220 <div class="form-group">
221 221 <button class="btn btn-primary pull-right" ng-click="AuthenticateUser(userInfo)">Log In</button>
222 222 </div>
  223 + <div id="spinnerLogin" class="spinner" ng-show="isLoginLoading" style="visibility:hidden">
  224 + <img id="img-spinner" src="content/images/common/loading.gif" alt="Loading" />
  225 + </div>
223 226 </form>
224 227 </div>
225 228 </div>
... ... @@ -1450,6 +1453,7 @@
1450 1453 <script src="libs/angular/1.4.9/angular-route.min.js"></script>
1451 1454 <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script>
1452 1455 <script src="libs/angular/1.4.9/ngStorage.js"></script>
  1456 + <script src="libs/angular/1.4.9/angular-idle.min.js"></script>
1453 1457 <script src="content/js/custom/custom.js"></script>
1454 1458 <!--Annotation Toolbar : jcanvas Library-->
1455 1459  
... ...
400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js 0 → 100644
  1 +/*** Directives and services for responding to idle users in AngularJS
  2 +* @author Mike Grabski <me@mikegrabski.com>
  3 +* @version v1.3.2
  4 +* @link https://github.com/HackedByChinese/ng-idle.git
  5 +* @license MIT
  6 +*/
  7 +
  8 +!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<y.length;A++)k.addEventListener?(k.addEventListener(y[A],z,!1),g.$on("$destroy",function(){k.removeEventListener(y[A],z,!1)})):(k.attachEvent(y[A],z),g.$on("$destroy",function(){k.detachEvent(y[A],z)}));var B=function(a){if("ngIdle.expiry"===a.key&&a.newValue&&a.newValue!==a.oldValue){var c=b.fromJson(a.newValue);if(c.id===v)return;w.interrupt(!0)}};return k.addEventListener?(k.addEventListener("storage",B,!1),g.$on("$destroy",function(){k.removeEventListener("storage",B,!1)})):k.attachEvent&&(k.attachEvent("onstorage",B),g.$on("$destroy",function(){k.detachEvent("onstorage",B)})),w}]}),b.module("ngIdle.countdown",["ngIdle.idle"]).directive("idleCountdown",["Idle",function(a){return{restrict:"A",scope:{value:"=idleCountdown"},link:function(b){b.value=a.getTimeout(),b.$on("IdleWarn",function(a,c){b.$evalAsync(function(){b.value=c})}),b.$on("IdleTimeout",function(){b.$evalAsync(function(){b.value=0})})}}}]),b.module("ngIdle.title",[]).provider("Title",function(){function a(a,b,c){return new Array(b-String(a).length+1).join(c||"0")+a}var c={enabled:!0},d=this.enabled=function(a){c.enabled=a===!0};this.$get=["$document","$interpolate",function(e,f){var g={original:null,idle:"{{minutes}}:{{seconds}} until your session times out!",timedout:"Your session has expired."};return{setEnabled:d,isEnabled:function(){return c.enabled},original:function(a){return b.isUndefined(a)?g.original:void(g.original=a)},store:function(a){(a||!g.original)&&(g.original=this.value())},value:function(a){return b.isUndefined(a)?e[0].title:void(e[0].title=a)},idleMessage:function(a){return b.isUndefined(a)?g.idle:void(g.idle=a)},timedOutMessage:function(a){return b.isUndefined(a)?g.timedout:void(g.timedout=a)},setAsIdle:function(b){this.store();var c={totalSeconds:b};c.minutes=Math.floor(b/60),c.seconds=a(b-60*c.minutes,2),this.value(f(this.idleMessage())(c))},setAsTimedOut:function(){this.store(),this.value(this.timedOutMessage())},restore:function(){this.original()&&this.value(this.original())}}}]}).directive("title",["Title",function(a){return{restrict:"E",link:function(b,c,d){a.isEnabled()&&!d.idleDisabled&&(a.store(!0),b.$on("IdleStart",function(){a.original(c[0].innerText)}),b.$on("IdleWarn",function(b,c){a.setAsIdle(c)}),b.$on("IdleEnd",function(){a.restore()}),b.$on("IdleTimeout",function(){a.setAsTimedOut()}))}}}]),b.module("ngIdle.localStorage",[]).service("IdleStorageAccessor",["$window",function(a){return{get:function(){return a.localStorage}}}]).service("IdleLocalStorage",["IdleStorageAccessor",function(a){function d(){var a={};this.setItem=function(b,c){a[b]=c},this.getItem=function(b){return"undefined"!=typeof a[b]?a[b]:null},this.removeItem=function(b){a[b]=c}}function e(){try{var b=a.get();return b.setItem("ngIdleStorage",""),b.removeItem("ngIdleStorage"),b}catch(c){return new d}}var f=e();return{set:function(a,c){f.setItem("ngIdle."+a,b.toJson(c))},get:function(a){return b.fromJson(f.getItem("ngIdle."+a))},remove:function(a){f.removeItem("ngIdle."+a)},_wrapped:function(){return f}}}])}(window,window.angular);
  9 +//# sourceMappingURL=angular-idle.map
0 10 \ No newline at end of file
... ...
400-SOURCECODE/Admin/package-lock.json
... ... @@ -276,6 +276,16 @@
276 276 "tsickle": "^0.21.0"
277 277 }
278 278 },
  279 + "@ng-idle/core": {
  280 + "version": "2.0.0-beta.9",
  281 + "resolved": "https://registry.npmjs.org/@ng-idle/core/-/core-2.0.0-beta.9.tgz",
  282 + "integrity": "sha1-+ZsIF0kc2lTAh9bNhs7SMQ//5qQ="
  283 + },
  284 + "@ng-idle/keepalive": {
  285 + "version": "2.0.0-beta.9",
  286 + "resolved": "https://registry.npmjs.org/@ng-idle/keepalive/-/keepalive-2.0.0-beta.9.tgz",
  287 + "integrity": "sha1-f3HkrIcG042pZl04JWDPv72IEh8="
  288 + },
279 289 "@ng-select/ng-select": {
280 290 "version": "2.20.5",
281 291 "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-2.20.5.tgz",
... ... @@ -485,6 +495,14 @@
485 495 "resolved": "https://registry.npmjs.org/angular2-json2csv/-/angular2-json2csv-1.1.2.tgz",
486 496 "integrity": "sha1-ETRWynbEyZiLU44jAUHCwT4DxpI="
487 497 },
  498 + "angular2-moment": {
  499 + "version": "1.9.0",
  500 + "resolved": "https://registry.npmjs.org/angular2-moment/-/angular2-moment-1.9.0.tgz",
  501 + "integrity": "sha512-ybPjYizpKVWAI2Z4AqxAS6s3FMkF3+zRpfvxX1wIdSJUFjl83XxQ5f2yn7retX68NSYZZ/JTK9KGnvOzZfrIZw==",
  502 + "requires": {
  503 + "moment": "^2.19.3"
  504 + }
  505 + },
488 506 "angular4-slimscroll": {
489 507 "version": "1.0.5",
490 508 "resolved": "https://registry.npmjs.org/angular4-slimscroll/-/angular4-slimscroll-1.0.5.tgz",
... ... @@ -7001,6 +7019,11 @@
7001 7019 "minimist": "0.0.8"
7002 7020 }
7003 7021 },
  7022 + "moment": {
  7023 + "version": "2.28.0",
  7024 + "resolved": "https://registry.npmjs.org/moment/-/moment-2.28.0.tgz",
  7025 + "integrity": "sha512-Z5KOjYmnHyd/ukynmFd/WwyXHd7L4J9vTI/nn5Ap9AVUgaAE15VvQ9MOGmJJygEUklupqIrFnor/tjTwRU+tQw=="
  7026 + },
7004 7027 "move-concurrently": {
7005 7028 "version": "1.0.1",
7006 7029 "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
... ...
400-SOURCECODE/Admin/package.json
... ... @@ -23,9 +23,12 @@
23 23 "@angular/platform-browser": "^4.2.4",
24 24 "@angular/platform-browser-dynamic": "^4.2.4",
25 25 "@angular/router": "^4.2.4",
  26 + "@ng-idle/core": "^2.0.0-beta.9",
  27 + "@ng-idle/keepalive": "^2.0.0-beta.9",
26 28 "@ng-select/ng-select": "^2.1.2",
27 29 "@types/node": "^6.0.102",
28 30 "angular2-json2csv": "^1.1.2",
  31 + "angular2-moment": "^1.9.0",
29 32 "angular4-slimscroll": "^1.0.5",
30 33 "classlist.js": "1.1.20150312",
31 34 "core-js": "^2.5.3",
... ...
400-SOURCECODE/Admin/src/app/app.component.html
... ... @@ -106,7 +106,7 @@
106 106 <div class="wel-brog">
107 107 <div class="btn-group pull-right mob1">
108 108 <ul class="nav navbar-nav navbar-right hidden-sm">
109   - <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off"></i></a></li>
  109 + <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off" style="cursor:pointer"></i></a></li>
110 110 </ul>
111 111 </div>
112 112 <div class="btn-group pull-right hidden-sm mar-top17 mob2">
... ...
400-SOURCECODE/Admin/src/app/app.component.ts
... ... @@ -8,6 +8,12 @@ import { UserManageRightsModel } from &#39;./components/userentity/datamodel&#39;;
8 8 //import { MyAuthService } from './shared/my-auth.service';
9 9 import { GlobalService } from './shared/global';
10 10 import { Router, NavigationEnd } from '@angular/router';
  11 +import { LoadingService } from './shared/loading.service';
  12 +import {Idle, DEFAULT_INTERRUPTSOURCES} from '@ng-idle/core';
  13 +import {Keepalive} from '@ng-idle/keepalive';
  14 +import { Title } from '@angular/platform-browser';
  15 +import { ConfirmService } from './shared/confirm/confirm.service';
  16 +import { timeout } from 'rxjs/operator/timeout';
11 17  
12 18 //import { HttpClient } from '@angular/common/http';
13 19 //import { HttpErrorResponse } from '@angular/common/http';
... ... @@ -28,8 +34,57 @@ export class AppComponent implements OnInit {
28 34 public UpdateProfileVisible: boolean;
29 35 public UserManageRightsList: Array<UserManageRightsModel>;
30 36  
31   - constructor(private userservice: UserService, public global: GlobalService, private router: Router,
32   - ) { }
  37 + constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private _confirmService: ConfirmService,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) {
  38 + const projectTitle= this.titleService.getTitle();
  39 +
  40 + console.log("idleTime: "+this.global.aiaIdleTime+" aiaIdleTimeOut: "+this.global.aiaIdleTimeOut+" Interval: "+this.global.aiaPingInterval);
  41 + // sets an idle timeout of 20 minutes.
  42 + this.idle.setIdle(this.global.aiaIdleTime);
  43 +
  44 + // sets a timeout period of 30 seconds. after 30 seconds of inactivity, the user will be considered timed out.
  45 + this.idle.setTimeout(this.global.aiaIdleTimeOut);
  46 +
  47 + // sets the ping interval to 10 seconds
  48 + this.keepalive.interval(this.global.aiaPingInterval);
  49 +
  50 + // sets the default interrupts, in this case, things like clicks, scrolls,mousemove touches to the document
  51 + this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
  52 +
  53 + this.idle.onInterrupt.subscribe(() => {
  54 + this.titleService.setTitle(projectTitle);
  55 + })
  56 +
  57 + this.idle.onTimeout.subscribe(() => {
  58 + //console.log("Timed out!");
  59 + this.titleService.setTitle('Your session has expired!');
  60 + this._loadingService.ShowLoading("global-loading");
  61 + this.loginManageStatus('logout');
  62 + });
  63 +
  64 + this.idle.onTimeoutWarning.subscribe((countdown) => {
  65 + // console.log("You will time out in "+countdown);
  66 + var minute=Math.floor(countdown/60);
  67 + var remaining = minute+':'+(("00" + (countdown - minute * 60)).slice(-2) );
  68 + this.titleService.setTitle(remaining+' until your session times out!');
  69 + });
  70 +
  71 + this.keepalive.onPing.subscribe(() =>{
  72 + // this.lastPing = new Date();
  73 + // console.log("last ping: "+this.lastPing);
  74 + this.loginManageStatus('update');
  75 + });
  76 +
  77 + // this.idle.onIdleEnd.subscribe(() => {
  78 + // console.log("No longer idle. ");
  79 + // });
  80 + // this.idle.onIdleStart.subscribe(() =>{
  81 + // console.log("You\'ve gone idle!");
  82 + // });
  83 +
  84 + this.idle.watch();
  85 +
  86 + }
  87 +
33 88 ngOnInit(): void {
34 89 this.menustaus = "True";
35 90 this.global.getJSON().subscribe(data => {
... ... @@ -69,17 +124,50 @@ export class AppComponent implements OnInit {
69 124 }
70 125 }
71 126 }, error => console.log(error));
72   -
73   -
74 127 }
  128 +
75 129 logout() {
76   - localStorage.removeItem('loggedInUserDetails');
77   - //window.location.href = this.global.LiveURL;
78   - window.location.href = window.location.origin;
  130 + this._loadingService.ShowLoading("global-loading");
  131 + this.loginManageStatus('logout');
79 132 }
  133 + loginManageStatus(tagname:string) {
  134 + this.userservice.ManageUserLoginStatus({
  135 + userId: this.global.UserId,
  136 + tagName: tagname,
  137 + isAlreadyLoggedIn:true
  138 + }).subscribe(status => {
  139 + console.log(status);
  140 + if(status=='False')
  141 + {
  142 + if(tagname=='logout')
  143 + {
  144 + this._loadingService.HideLoading("global-loading");
  145 + }
  146 +
  147 + if(window.location.hostname!="localhost")
  148 + {
  149 + localStorage.removeItem('loggedInUserDetails');
  150 + window.location.href = window.location.origin;
  151 +
  152 + }
  153 +
  154 + }
  155 +
  156 + },error =>{
  157 + console.log(error);
  158 + this.idle.stop();
  159 + this._confirmService.activate(error, "alertMsg");
  160 + this._loadingService.HideLoading("global-loading");
  161 + setTimeout(function(){
  162 + window.location.href = window.location.origin;
  163 + },5000);
  164 + })
  165 + }
  166 +
80 167 Product() {
81 168 //window.location.href = this.global.LiveURL;
82 169 window.location.href = window.location.origin;
83 170 //this.router.navigate([this.global.LiveURL]);
84 171 }
  172 +
85 173 }
... ...
400-SOURCECODE/Admin/src/app/app.module.ts
1 1 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
2   -import { BrowserModule } from '@angular/platform-browser';
  2 +import { BrowserModule,Title } from '@angular/platform-browser';
3 3 import { NgModule } from '@angular/core';
4 4 import { RouterModule, Routes } from '@angular/router';
5 5 import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
... ... @@ -8,6 +8,10 @@ import { HttpModule } from &#39;@angular/http&#39;;
8 8 //import { Ng2SmartTableModule } from 'ng2-smart-table';
9 9 import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal';
10 10 import { CsvService } from "angular2-json2csv";
  11 +
  12 +import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';
  13 +import { MomentModule } from 'angular2-moment';
  14 +
11 15 import { BsDatepickerModule, ModalModule } from 'ngx-bootstrap';
12 16 import { BsModalService } from 'ngx-bootstrap/modal';
13 17 import { BsDropdownModule } from 'ngx-bootstrap';
... ... @@ -83,11 +87,11 @@ import { MyFilterPipe } from &#39;./shared/my-filter.pipe&#39;;
83 87 ],
84 88 imports: [
85 89 BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule,
86   - BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule
  90 + BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule,MomentModule,NgIdleKeepaliveModule.forRoot()
87 91 //ModalModule.forRoot()
88 92 // , AngularFireModule.initializeApp(firebaseConfig),
89 93 ],
90   - providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,
  94 + providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,Title,
91 95 // MyAuthService, AngularFireAuth, FirebaseApp, AngularFireModule,
92 96  
93 97 //AuthService,
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts
... ... @@ -91,7 +91,6 @@ export class UpdateUserProfile implements OnInit {
91 91  
92 92 this.userservice.GetUserById()
93 93 .subscribe(x => { console.log(x); this.bindUsers(x) }, error => this.error = <any>error);
94   - this._loadingService.HideLoading("global-loading");
95 94 }
96 95 UpdateUserProfile() {
97 96 this.alerts = '';
... ... @@ -114,7 +113,7 @@ export class UpdateUserProfile implements OnInit {
114 113  
115 114 if (this.userFrm.valid && this.alerts == '') {
116 115 var obj = this.userFrm.value;
117   -
  116 + this._loadingService.ShowLoading("global-loading");
118 117 return this.userservice.UpdateUserProfileById(obj)
119 118 .subscribe(
120 119 n => (this.AfterInsertData(n)),
... ... @@ -122,7 +121,8 @@ export class UpdateUserProfile implements OnInit {
122 121 }
123 122 }
124 123 AfterInsertData(data) {
125   - if (data.Status == "False") {
  124 + if (data.Status == "False") {
  125 + this._loadingService.HideLoading("global-loading");
126 126 return false;
127 127 } else {
128 128 this.status = true;
... ... @@ -132,6 +132,7 @@ export class UpdateUserProfile implements OnInit {
132 132 loggedInUser.LastName = this.userFrm.value.lastName;
133 133 localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser));
134 134 this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName;
  135 + this._loadingService.HideLoading("global-loading");
135 136 this._confirmService.activate("User Profile Updated Successfully.", "alertMsg");
136 137  
137 138 }
... ... @@ -147,7 +148,8 @@ export class UpdateUserProfile implements OnInit {
147 148 this.userFrm.controls['id'].setValue(this.user.Id)
148 149 this.userFrm.controls['firstName'].setValue(this.user.FirstName)
149 150 this.userFrm.controls['lastName'].setValue(this.user.LastName)
150   - this.userFrm.controls['emailId'].setValue(this.user.EmailId)
  151 + this.userFrm.controls['emailId'].setValue(this.user.EmailId);
  152 + this._loadingService.HideLoading("global-loading");
151 153 }
152 154  
153 155 validationMessages = {
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
... ... @@ -54,6 +54,20 @@ export class UserService {
54 54 }
55 55 //////////// End /////////////////////
56 56  
  57 + //////////Manage UserLogin Status///////////
  58 + ManageUserLoginStatus(obj: any) {
  59 + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'isAlreadyLoggedIn': obj.isAlreadyLoggedIn };
  60 + console.log(obj);
  61 + var headers = new Headers({
  62 + 'Content-Type': 'application/json'
  63 + });
  64 + return this.http.post(this.commonService.resourceBaseUrl + "User/ManageUserLoginStatus",
  65 + JSON.stringify(jsonData), { headers: headers })
  66 + .map(this.extractData)
  67 + .catch((res: Response) => this.handleError(res));
  68 + }
  69 + //////////// End /////////////////////
  70 +
57 71  
58 72  
59 73 //////////Update User Userid///////////////
... ... @@ -86,6 +100,7 @@ export class UserService {
86 100 "&accountnumber=" + obj.AccountNumber +
87 101 "&usertypeid=" + obj.UserTypeId +
88 102 "&accounttypeid=" + obj.AccountTypeId +
  103 + "&userLoginStatus=" + obj.LoginStatus +
89 104 "&pageNo=" + pageNo +
90 105 "&pageLength=" + pageLength +
91 106 "&iLoginUserType=" + this.commonService.UserType +
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
... ... @@ -28,7 +28,7 @@
28 28 <input type="text" class="form-control input-sm" id="LastNames" placeholder="Last Name" formControlName="LastName">
29 29 </div>
30 30 </div>
31   - </div>
  31 + </div>
32 32 </div>
33 33 </div>
34 34 <div class="col-lg-3 col-sm-3">
... ... @@ -80,6 +80,15 @@
80 80 </div>
81 81 </div>
82 82 </div>
  83 +
  84 + <div class="col-sm-12">
  85 + <div class="form-group marginTop5">
  86 + <label for="LoginStatus" class="col-sm-12 col-lg-6 control-label text-right-lg paddTop7 padd-left0">Logged-In Status :</label>
  87 + <div>
  88 + <input type="checkbox" class="radio-inline" style="height: 25px;width: 20px" id="LoginStatus" formControlName="LoginStatus">
  89 + </div>
  90 + </div>
  91 + </div>
83 92 </div>
84 93 </div>
85 94  
... ... @@ -119,6 +128,7 @@
119 128 <th>Account Number</th>
120 129 <th>Product Edition</th>
121 130 <th>Status</th>
  131 + <th>Login Status</th>
122 132 </tr>
123 133 </thead>
124 134  
... ... @@ -143,6 +153,10 @@
143 153 <span *ngIf="UserEntity.UserStatus=='Active'" class="label label-success">Active</span>
144 154 <span *ngIf="UserEntity.UserStatus!='Active'" class="label label-default">Inactive</span>
145 155 </td>
  156 + <td>
  157 + <span *ngIf="UserEntity.LoginStatus==true" class="label label-success">Logged-In (Active Session: {{UserEntity.TotalLogin}})</span>
  158 + <span *ngIf="UserEntity.LoginStatus==false" class="label label-default">Logged-Out</span>
  159 + </td>
146 160 </tr>
147 161  
148 162  
... ... @@ -156,9 +170,11 @@
156 170 <div [style.display]="(global.UserTypeName=='Super Admin') ? 'block' : 'none'">
157 171 <button class="btn btn-primary btn-sm" (click)="EditManageUserRights()" [ngClass]="{disabled : !buttonStatus}"><i class="fa fa-thumbs-up"></i> Manage Rights</button>
158 172 <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button>
  173 + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button>
159 174 </div>
160 175 <div [style.display]="(global.UserTypeName!='Super Admin') ? 'block' : 'none'">
161 176 <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button>
  177 + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button>
162 178 </div>
163 179 </div>
164 180 </div>
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... ... @@ -58,6 +58,7 @@ export class UsersList implements OnInit, AfterViewChecked {
58 58 UncheckedRecords: Array<number>;
59 59 buttonStatus: boolean;
60 60 EditbuttonStatus: boolean;
  61 + logoutUserSession: boolean;
61 62 //@ViewChild("profileModal")
62 63 //profileModal: ModalComponent;
63 64 //errorMessage: any;
... ... @@ -81,7 +82,8 @@ export class UsersList implements OnInit, AfterViewChecked {
81 82 EmailId: [''],
82 83 AccountNumber: [''],
83 84 UserTypeId: [0],
84   - AccountTypeId:[0]
  85 + AccountTypeId:[0],
  86 + LoginStatus:[false]
85 87 // Gender: ['', Validators.required],
86 88 // Email: ['']
87 89  
... ... @@ -127,7 +129,6 @@ export class UsersList implements OnInit, AfterViewChecked {
127 129 this._loadingService.ShowLoading("global-loading");
128 130 this.GetUserType();
129 131 this.GetAccountType();
130   - this._loadingService.HideLoading("global-loading");
131 132 this.recordCount = 0;
132 133 this.pageNo = 1;
133 134 this.pageLength = 10;
... ... @@ -168,8 +169,6 @@ export class UsersList implements OnInit, AfterViewChecked {
168 169 testScript.setAttribute("type", "text/javascript");
169 170 document.body.appendChild(testScript);
170 171 }
171   -
172   - this._loadingService.HideLoading("global-loading");
173 172  
174 173 //this.GetUserList();
175 174 }
... ... @@ -234,6 +233,14 @@ export class UsersList implements OnInit, AfterViewChecked {
234 233 else {
235 234 this.buttonStatus = null;
236 235 }
  236 + if (item['LoginStatus'] == true) {
  237 + this.logoutUserSession=true;
  238 + }
  239 + else{
  240 + this.logoutUserSession = null;
  241 + }
  242 +
  243 +
237 244 }
238 245 public SetClickedRowManageRight(j: number, item: any) {
239 246  
... ... @@ -275,7 +282,6 @@ export class UsersList implements OnInit, AfterViewChecked {
275 282 var tempArr = evt.split(',');
276 283 this.pageNo = parseInt(tempArr[0]);
277 284 this.pageLength = parseInt(tempArr[1]);
278   - this._loadingService.ShowLoading("global-loading");
279 285 var UserFilterControl = this.Users.value;
280 286  
281 287 this.userservice.GetUserList(
... ... @@ -285,13 +291,16 @@ export class UsersList implements OnInit, AfterViewChecked {
285 291 EmailId: this.Users.controls['EmailId'].value,
286 292 AccountNumber: this.Users.controls['AccountNumber'].value,
287 293 UserTypeId: (this.Users.controls['UserTypeId'].value != null && this.Users.controls['UserTypeId'].value !='' ? this.Users.controls['UserTypeId'].value:0),
288   - AccountTypeId: (this.Users.controls['AccountTypeId'].value != null && this.Users.controls['AccountTypeId'].value != ''? this.Users.controls['AccountTypeId'].value : 0),
  294 + AccountTypeId: (this.Users.controls['AccountTypeId'].value != null && this.Users.controls['AccountTypeId'].value != ''? this.Users.controls['AccountTypeId'].value : 0),
  295 + LoginStatus: this.Users.controls['LoginStatus'].value,
289 296 },this.pageNo, this.pageLength
290 297 )
291 298 .subscribe(x => { this.BindFormFields(x) }, error => this.error = <any>error);
292 299  
293 300 }
294 301 SearchRecords() {
  302 + this.EditbuttonStatus=undefined;
  303 + this.logoutUserSession=undefined;
295 304 this.buttonStatus = null;
296 305 this.selectedRow = -1;
297 306 this.SearchUserList('1, ' + this.pageLength);
... ... @@ -309,12 +318,15 @@ export class UsersList implements OnInit, AfterViewChecked {
309 318 }
310 319 }
311 320 CancelEditUser() {
312   - this.SearchUserList('1, ' + this.pageLength);
  321 + this.SearchUserList(this.pageNo +','+ this.pageLength);
313 322 this.Mode = 'Manage';
314 323 this.modalTitle = 'LIST USER';
315 324 this.topPos = '2000px';
316 325 this.divClass = 'col-sm-12';
317 326 this.selectedRow = -1;
  327 + this.EditbuttonStatus=undefined;
  328 + this.buttonStatus=undefined;
  329 + this.logoutUserSession=undefined;
318 330 }
319 331 EditUser() {
320 332 if (this.EditbuttonStatus) {
... ... @@ -375,7 +387,24 @@ export class UsersList implements OnInit, AfterViewChecked {
375 387 //this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id);
376 388  
377 389 }
378   -
  390 + ForceLogoutUser(){
  391 + if (this.logoutUserSession) {
  392 + this._loadingService.ShowLoading("global-loading");
  393 + this.userservice.ManageUserLoginStatus({
  394 + userId: this.selectedId,
  395 + tagName: 'logout',
  396 + isAlreadyLoggedIn:true
  397 + }).subscribe(x => {
  398 + console.log(x);
  399 + this.EditbuttonStatus=undefined;
  400 + this.logoutUserSession=undefined;
  401 + this.buttonStatus = null;
  402 + this.selectedRow = -1;
  403 + this.SearchUserList(this.pageNo +','+ this.pageLength);
  404 +
  405 + },error => console.log(error));
  406 + }
  407 + }
379 408  
380 409 public UpdateUser() {
381 410 this.alerts = '';
... ...
400-SOURCECODE/Admin/src/app/shared/global.ts
... ... @@ -24,6 +24,9 @@ export class GlobalService {
24 24 AccLicId: number = 0;
25 25 LoginId:string="";
26 26 ProtocolType:string="";
  27 + aiaIdleTime:number=0;
  28 + aiaIdleTimeOut:number=0;
  29 + aiaPingInterval:number=0;
27 30 RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"]
28 31 error;
29 32 public href: string = "";
... ... @@ -35,11 +38,15 @@ export class GlobalService {
35 38 this.UserTypeName = this.loggedInUser.UserType;
36 39 this.DisplayName = this.loggedInUser.FirstName + " " + this.loggedInUser.LastName;
37 40 this.LoginId=this.loggedInUser.LoginId;
  41 + this.aiaIdleTime=this.loggedInUser.aiaIdleTime;
  42 + this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut;
  43 + this.aiaPingInterval=this.loggedInUser.aiaPingInterval;
  44 +
38 45 }
39 46  
40 47 this.NoRecords = 'No Record Found.';
41 48  
42   - this.hostURL = "http://192.168.81.63:92/API/Adminapi/";//Birendra Machine IP
  49 + this.hostURL = "http://192.168.43.9/API/Adminapi/";//Birendra Machine IP
43 50 this.LiveAPIURL = "http://interactiveanatomy.com/API/Adminapi/";
44 51 this.QAAPIURL = "http://qa.beta.interactiveanatomy.com/API/Adminapi/";
45 52 this.LocalURL = "http://localhost:4200";
... ... @@ -49,6 +56,7 @@ export class GlobalService {
49 56  
50 57 if(window.location.hostname=="localhost")
51 58 {
  59 + // for 'ng serve --open' command
52 60 //**** for localhost:4200 *****//
53 61 this.resourceBaseUrl = this.hostURL;
54 62 }
... ... @@ -59,13 +67,14 @@ export class GlobalService {
59 67  
60 68 }
61 69  
62   - if (this.resourceBaseUrl == this.ProtocolType+"192.168.81.63:92/API/Adminapi/") {
  70 + if (this.resourceBaseUrl == this.ProtocolType+"192.168.43.9/API/Adminapi/") {
63 71 if(window.location.hostname=="localhost")
64 72 {
  73 + // for 'ng serve --open' command
65 74 //**** for localhost:4200 *****//
66 75 localStorage.setItem('loggedInUserDetails', JSON.stringify(
67 76 {
68   - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016", "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null
  77 + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null
69 78 }));
70 79 }
71 80  
... ...
400-SOURCECODE/Admin/src/assets/styles/bootstrap.css
... ... @@ -1325,13 +1325,13 @@ pre code {
1325 1325 width: 50%;
1326 1326 }
1327 1327 .col-lg-5 {
1328   - width: 41.66666667%;
  1328 + width: 50.66666667%;
1329 1329 }
1330 1330 .col-lg-4 {
1331 1331 width: 33.33333333%;
1332 1332 }
1333 1333 .col-lg-3 {
1334   - width: 25%;
  1334 + width: 27%;
1335 1335 }
1336 1336 .col-lg-2 {
1337 1337 width: 16.66666667%;
... ...