From 0e02647cba084855ff1c670a5f734c19f6d24383 Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 12 Sep 2018 14:27:32 +0530 Subject: [PATCH] files came after QA pull --- 400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs | 48 ++++++++++++++++++++++++------------------------ 400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs | 586 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js | 420 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- 4 files changed, 616 insertions(+), 616 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs b/400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs index 8c03032..fa90bbe 100644 --- a/400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs +++ b/400-SOURCECODE/AIAHTML5.API/App_Start/WebApiConfig.cs @@ -1,24 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Http; - -namespace AIAHTML5.API -{ - public static class WebApiConfig - { - public static void Register(HttpConfiguration config) - { - // Web API configuration and services - - // Web API routes - config.MapHttpAttributeRoutes(); - - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web.Http; + +namespace AIAHTML5.API +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Web API configuration and services + + // Web API routes + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 2d7d218..2ceb681 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -1,294 +1,294 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; -using log4net; -using AIAHTML5.API.Constants; -using AIAHTML5.API.Models; -using System.Collections; - -using System.Data.SqlClient;namespace AIAHTML5.API.Controllers -{ - public class AuthenticateController : ApiController - { - // GET api/authenticate - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/authenticate/5 - public string Get(int id) - { - return "value"; - } - - // POST api/authenticate - public HttpResponseMessage Post([FromBody]JObject credentials) - { - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); - logger.Debug("inside POST"); - - dynamic authenticationRepsonse; - DateTime blockTime; - bool isUserBlocked; - - try - { - - //01.get the user detail to autheticate the user - User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); - - if (userInfo != null) - { - // 02 Check user is authenticated or not by login credential match - bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo); - - if (isUserAuthenticated) - { - if (userInfo.IsActive) - { - //03. check if user is blocked - isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime); - - if (!isUserBlocked) - { - //04.delete past wrong login attempts of user - int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); - if (wrongAttemptDeteledCount < 0) - { - logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); - } - //05. - GetModulesBasedOnUserType(userInfo); - - // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); - } - - else - { - - //compare block time of user with current time if user is blocked - DateTime blockDuration = blockTime.AddDays(1); - var difference = DateTime.Compare(DateTime.Now, blockDuration); - - //check if credentials are valid credentials - //bool isCorrectLoginId, isCorrectPassword; - //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword); - - if (difference >= 0) - { - //means 24 hours block time is finished - userInfo.IsBlocked = false; - - int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); - if (wrongAttemptDeteledCount < 0) - { - logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); - } - - //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads - GetModulesBasedOnUserType(userInfo); - - } - else - { - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; - } - } - } - else - { - //CODE REVIW: validate that is this tarnslated by UI because we need to show message to user if he is inactive - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE; - - //05.4 check the License expiration irespective of either user is active - //or not because on AIA, we shows the License expiration message - //for inactive users too - - CheckLicenseStatus(userInfo); - - } - } - - else - { - //this come in picture when user input wrong passowrd - - //get wrong attempt count of user - int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id); - userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1; - userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH; - - //01. insert wrong attempt in dtabase - int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts); - - if (updateCount < 0) - { - //Put the log in log file - logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id); - } - //else - //{ - if (userInfo.IncorrectLoginAttemptCount > 4) - { - userInfo.IsBlocked = true; - userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; - } - - - } - - authenticationRepsonse = JsonConvert.SerializeObject(userInfo); - - } - - else - { - authenticationRepsonse = AIAConstants.USER_NOT_FOUND; - } - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; - } - catch(SqlException e){ - - logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); - - ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; - UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; - } - catch (Exception e) - { - - logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); - - ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; - UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; - - } - - } - - private static void GetModulesBasedOnUserType(User userInfo) - { - //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. - //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin - int licenseId, editionId; - AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); - - userInfo.LicenseId = licenseId; - userInfo.EditionId = editionId; - - //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN) - if(userInfo.LicenseId == 0) - { - userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - else - { - CheckLicenseStatus(userInfo); - - if(!userInfo.IsSubscriptionExpired){ - GetModulesBasedOnLicense(userInfo,false); - } - } - } - - private static void CheckLicenseStatus(User userInfo) - { - //05.1 For normal user need to get the license details, get the license id for authenticated user - //int licenseId, editionId; - //AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); - - //userInfo.LicenseId = licenseId; - //userInfo.EditionId = editionId; - - //05.2 get license details - userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); - - if (userInfo.LicenseInfo != null) - { - //05.3 get licenseSubscription details - userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); - - //05.4 check the License expiration irespective of either user is active or not because on AIA - //we shows the License expiration message for inactive users too - string expirationDate = null; - bool isLicenseExpired = false; - - if (userInfo.LicenseSubscriptions != null) - { - isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); - } - - if (isLicenseExpired) - { - userInfo.IsSubscriptionExpired = isLicenseExpired; - userInfo.SubscriptionExpirationDate = expirationDate; - } - } - - else - { - ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); - logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId); - } - } - - private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired) - { - - //05.6.1 - if (userInfo.LicenseInfo.IsActive) - { - if (!userInfo.LicenseInfo.IsTermAccepted) - { - ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); - foreach (Hashtable item in termsList) - { - userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); - userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); - } - } - else - { - userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); - - //Insert user login detail - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); - } - } - else - { - userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; - - } - } - - - - // PUT api/authenticate/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/authenticate/5 - public void Delete(int id) - { - } - } +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using log4net; +using AIAHTML5.API.Constants; +using AIAHTML5.API.Models; +using System.Collections; + +using System.Data.SqlClient;namespace AIAHTML5.API.Controllers +{ + public class AuthenticateController : ApiController + { + // GET api/authenticate + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/authenticate/5 + public string Get(int id) + { + return "value"; + } + + // POST api/authenticate + public HttpResponseMessage Post([FromBody]JObject credentials) + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("inside POST"); + + dynamic authenticationRepsonse; + DateTime blockTime; + bool isUserBlocked; + + try + { + + //01.get the user detail to autheticate the user + User userInfo = AIAHTML5.API.Models.Users.getUserDetails(credentials); + + if (userInfo != null) + { + // 02 Check user is authenticated or not by login credential match + bool isUserAuthenticated = AIAHTML5.API.Models.Users.checkUserAuthenticity(credentials, userInfo); + + if (isUserAuthenticated) + { + if (userInfo.IsActive) + { + //03. check if user is blocked + isUserBlocked = AIAHTML5.API.Models.Users.checkUserBlockStatus(userInfo.Id, out blockTime); + + if (!isUserBlocked) + { + //04.delete past wrong login attempts of user + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); + if (wrongAttemptDeteledCount < 0) + { + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); + } + //05. + GetModulesBasedOnUserType(userInfo); + + // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); + } + + else + { + + //compare block time of user with current time if user is blocked + DateTime blockDuration = blockTime.AddDays(1); + var difference = DateTime.Compare(DateTime.Now, blockDuration); + + //check if credentials are valid credentials + //bool isCorrectLoginId, isCorrectPassword; + //AIAHTML5.API.Models.Users.isCredentialCorrect(credentials, userInfo, out isCorrectLoginId, out isCorrectPassword); + + if (difference >= 0) + { + //means 24 hours block time is finished + userInfo.IsBlocked = false; + + int wrongAttemptDeteledCount = AIAHTML5.API.Models.Users.deletePastWrongAttempts(userInfo.Id); + if (wrongAttemptDeteledCount < 0) + { + logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); + } + + //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads + GetModulesBasedOnUserType(userInfo); + + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; + } + } + } + else + { + //CODE REVIW: validate that is this tarnslated by UI because we need to show message to user if he is inactive + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_NOT_ACTIVE; + + //05.4 check the License expiration irespective of either user is active + //or not because on AIA, we shows the License expiration message + //for inactive users too + + CheckLicenseStatus(userInfo); + + } + } + + else + { + //this come in picture when user input wrong passowrd + + //get wrong attempt count of user + int previousIncorrectLoginAttempts = AIAHTML5.API.Models.Users.checkNoOfWrongAttempts(userInfo.Id); + userInfo.IncorrectLoginAttemptCount = previousIncorrectLoginAttempts + 1; + userInfo.LoginFailureCauseId = ErrorHelper.E_PASSWORD_NOT_MATCH; + + //01. insert wrong attempt in dtabase + int updateCount = AIAHTML5.API.Models.Users.saveWrongAttemptOfUser(userInfo.Id, previousIncorrectLoginAttempts); + + if (updateCount < 0) + { + //Put the log in log file + logger.Fatal("Unable to Update past wrong login attempts for userId= " + userInfo.Id); + } + //else + //{ + if (userInfo.IncorrectLoginAttemptCount > 4) + { + userInfo.IsBlocked = true; + userInfo.LoginFailureCauseId = ErrorHelper.E_USER_ID_BLOCKED_24_HRS; + } + + + } + + authenticationRepsonse = JsonConvert.SerializeObject(userInfo); + + } + + else + { + authenticationRepsonse = AIAConstants.USER_NOT_FOUND; + } + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; + } + catch(SqlException e){ + + logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); + + ArrayList supportMailList = UserUtility.GetSupportMailList(); + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); + + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) }; + } + catch (Exception e) + { + + logger.Fatal("Exception occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); + + ArrayList supportMailList = UserUtility.GetSupportMailList(); + string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; + UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); + + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; + + } + + } + + private static void GetModulesBasedOnUserType(User userInfo) + { + //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. + //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin + int licenseId, editionId; + AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); + + userInfo.LicenseId = licenseId; + userInfo.EditionId = editionId; + + //if (userInfo.UserType == AIAHTML5.API.Models.User.SUPER_ADMIN) + if(userInfo.LicenseId == 0) + { + userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + else + { + CheckLicenseStatus(userInfo); + + if(!userInfo.IsSubscriptionExpired){ + GetModulesBasedOnLicense(userInfo,false); + } + } + } + + private static void CheckLicenseStatus(User userInfo) + { + //05.1 For normal user need to get the license details, get the license id for authenticated user + //int licenseId, editionId; + //AIAHTML5.API.Models.Users.getLicenseIdForThisUser(userInfo.Id, out licenseId, out editionId); + + //userInfo.LicenseId = licenseId; + //userInfo.EditionId = editionId; + + //05.2 get license details + userInfo.LicenseInfo = AIAHTML5.API.Models.Users.getLicenseDetails(userInfo.LicenseId); + + if (userInfo.LicenseInfo != null) + { + //05.3 get licenseSubscription details + userInfo.LicenseSubscriptions = AIAHTML5.API.Models.Users.getLicenseSubscriptionDetails(userInfo.LicenseId); + + //05.4 check the License expiration irespective of either user is active or not because on AIA + //we shows the License expiration message for inactive users too + string expirationDate = null; + bool isLicenseExpired = false; + + if (userInfo.LicenseSubscriptions != null) + { + isLicenseExpired = AIAHTML5.API.Models.Users.checkIfLicenseExpired(userInfo.LicenseSubscriptions, out expirationDate); + } + + if (isLicenseExpired) + { + userInfo.IsSubscriptionExpired = isLicenseExpired; + userInfo.SubscriptionExpirationDate = expirationDate; + } + } + + else + { + ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); + logger.Debug("userInfo.LicenseInfo is null for userInfo.LicenseId= "+userInfo.LicenseId); + } + } + + private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired) + { + + //05.6.1 + if (userInfo.LicenseInfo.IsActive) + { + if (!userInfo.LicenseInfo.IsTermAccepted) + { + ArrayList termsList = AIAHTML5.API.Models.Users.getTermsAndConditions(); + foreach (Hashtable item in termsList) + { + userInfo.TermsAndConditionsTitle = item[AIAConstants.KEY_TITLE].ToString(); + userInfo.TermsAndConditionsText = item[AIAConstants.KEY_CONTENT].ToString(); + } + } + else + { + userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); + + //Insert user login detail + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id); + } + } + else + { + userInfo.LoginFailureCauseId = ErrorHelper.E_LICENCE_IS_INACTIVE; + + } + } + + + + // PUT api/authenticate/5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api/authenticate/5 + public void Delete(int id) + { + } + } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index b6d5265..3d6f8f7 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -1,211 +1,211 @@ -AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", -function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) { - - - $scope.showTabButton = false; - $scope.threeDAnatomyData; - $scope.Id; - $scope.$on('$viewContentLoaded', function (event) { - var currentURL = $location.path(); - var selectedModuleName = ''; - //set module title - angular.forEach($rootScope.userModules, function (value, key) { - if (value.slug === currentURL.replace('/', '')) { - selectedModuleName = value.name; - } - $rootScope.currentActiveModuleTitle = selectedModuleName; - }) - if ($rootScope.refreshcheck == null) { - $location.path('/'); - } - $scope.scroll(); - var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') - promise.then( - function (result) { - $scope.threeDAnatomyData = result; - - // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData; - - $scope.selectedThreeDAdata = new jinqJs() - .from($scope.threeDAnatomyData.root.ThreeDAData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); - - // console.log($scope.selectedCIListViewData); - $('#grid-view').empty(); - angular.forEach($scope.selectedThreeDAdata, function (value, key) { - $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage; - - var $el = $('
' - + '
' - + '' - + '

' + value._Title + '

').appendTo('#grid-view'); - - - $compile($el)($scope); - - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - }); - - }, - function (error) { - // handle errors here - console.log(' $scope.threeDAnatomyData = ' + error.statusText); - } - ); - - }); - $scope.scroll = function () { - // $window.scrollTo(0, 0); - $("html,body").scrollTop(0); - //alert("scroll"); - } - $scope.IsVisible = function () { - //$scope.scroll(); - - $location.url("/3dAnatomy"); - - } - - - $scope.Open3DModel = function ($event) { - $rootScope.currentBodyViewId = $event.currentTarget.id; - if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { - var ThreeDTitle = []; - ThreeDTitle = new jinqJs() - .from($scope.selectedThreeDAdata) - .where('_id = ' + $event.currentTarget.id) - .select('_Title'); - - $rootScope.ViewTitle = ThreeDTitle[0]._Title; - } - else { - $rootScope.ViewTitle = $event.currentTarget.textContent; - - } - - - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); - localStorage.setItem("currentBodyViewId", $event.currentTarget.id); - - var u = $location.url(); - $location.url('/3d-anatomy-details'); - - } - - $scope.Open3DModelBody = function () { - - if ($rootScope.refreshcheck == null) { - $location.path('/'); - - } - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - //alert($rootScope.getLocalStorageValue("currentBodyViewId")); - $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId"); - - //alert($scope.voId3D); - - - //once you get id in scope push detail in jspanel content - - var openViews; - if ($rootScope.openViews.length > 0) { - openViews = new jinqJs() - .from($rootScope.openViews) - .where("BodyViewId==" + $scope.voId3D) - .select(); - } - var counter = 1; - var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); - - if (openViews != null && openViews.length > 0) { - angular.forEach(openViews, function (value, key) { - - if (value.body - views == tittle) { - tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; - $rootScope.currentActiveViewTitle = tittle; - localStorage.setItem("currentViewTitle", tittle); - } - - }); - } - else { - localStorage.setItem("currentViewTitle", tittle); - - } - - // alert($rootScope.getLocalStorageValue("currentViewTitle")); - - var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') - promise.then( - function (result) { - $scope.threeDAnatomyData = result; - - var clicked3dAview = []; - clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData) - .where('_id == ' + $scope.voId3D) - .select('_Title', '_3dimagepath'); - $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath; - $scope.threeDBodySystemTitle = clicked3dAview[0]._Title; - - if (clicked3dAview.length > 0) { - - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); - - $.jsPanel({ - id: '3DImagePanel', - selector: '.threeDView', - theme: 'success', - currentController: '3dAController', - parentSlug: '3d-anatomy-list', - content: '
' + - '' + - '
', - title: $rootScope.getLocalStorageValue("currentViewTitle"), - position: { - top: 70, - left: 1, - }, - - size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 }, - - }); - - $rootScope.currentSlug = '3d-anatomy-details'; - - $rootScope.openViews.push( - { - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, - "slug": $rootScope.currentSlug - }); - - - } - - - }, - function (error) { - // handle errors here - console.log(' $scope.CIllustrationData = ' + error.statusText); - } - - ); - $('#ThreeDView').css("height", $(window).outerHeight()); - - $('#ThreeDView').css("width", $(window).outerWidth()); - - } - - - -}] - - - +AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", +function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) { + + + $scope.showTabButton = false; + $scope.threeDAnatomyData; + $scope.Id; + $scope.$on('$viewContentLoaded', function (event) { + var currentURL = $location.path(); + var selectedModuleName = ''; + //set module title + angular.forEach($rootScope.userModules, function (value, key) { + if (value.slug === currentURL.replace('/', '')) { + selectedModuleName = value.name; + } + $rootScope.currentActiveModuleTitle = selectedModuleName; + }) + if ($rootScope.refreshcheck == null) { + $location.path('/'); + } + $scope.scroll(); + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData; + + $scope.selectedThreeDAdata = new jinqJs() + .from($scope.threeDAnatomyData.root.ThreeDAData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); + + // console.log($scope.selectedCIListViewData); + $('#grid-view').empty(); + angular.forEach($scope.selectedThreeDAdata, function (value, key) { + $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage; + + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); + + + $compile($el)($scope); + + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); + + }); + + }, + function (error) { + // handle errors here + console.log(' $scope.threeDAnatomyData = ' + error.statusText); + } + ); + + }); + $scope.scroll = function () { + // $window.scrollTo(0, 0); + $("html,body").scrollTop(0); + //alert("scroll"); + } + $scope.IsVisible = function () { + //$scope.scroll(); + + $location.url("/3dAnatomy"); + + } + + + $scope.Open3DModel = function ($event) { + $rootScope.currentBodyViewId = $event.currentTarget.id; + if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { + var ThreeDTitle = []; + ThreeDTitle = new jinqJs() + .from($scope.selectedThreeDAdata) + .where('_id = ' + $event.currentTarget.id) + .select('_Title'); + + $rootScope.ViewTitle = ThreeDTitle[0]._Title; + } + else { + $rootScope.ViewTitle = $event.currentTarget.textContent; + + } + + + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); + localStorage.setItem("currentBodyViewId", $event.currentTarget.id); + + var u = $location.url(); + $location.url('/3d-anatomy-details'); + + } + + $scope.Open3DModelBody = function () { + + if ($rootScope.refreshcheck == null) { + $location.path('/'); + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + //alert($rootScope.getLocalStorageValue("currentBodyViewId")); + $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId"); + + //alert($scope.voId3D); + + + //once you get id in scope push detail in jspanel content + + var openViews; + if ($rootScope.openViews.length > 0) { + openViews = new jinqJs() + .from($rootScope.openViews) + .where("BodyViewId==" + $scope.voId3D) + .select(); + } + var counter = 1; + var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); + + if (openViews != null && openViews.length > 0) { + angular.forEach(openViews, function (value, key) { + + if (value.body - views == tittle) { + tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; + $rootScope.currentActiveViewTitle = tittle; + localStorage.setItem("currentViewTitle", tittle); + } + + }); + } + else { + localStorage.setItem("currentViewTitle", tittle); + + } + + // alert($rootScope.getLocalStorageValue("currentViewTitle")); + + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + var clicked3dAview = []; + clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData) + .where('_id == ' + $scope.voId3D) + .select('_Title', '_3dimagepath'); + $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath; + $scope.threeDBodySystemTitle = clicked3dAview[0]._Title; + + if (clicked3dAview.length > 0) { + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + $.jsPanel({ + id: '3DImagePanel', + selector: '.threeDView', + theme: 'success', + currentController: '3dAController', + parentSlug: '3d-anatomy-list', + content: '
' + + '' + + '
', + title: $rootScope.getLocalStorageValue("currentViewTitle"), + position: { + top: 70, + left: 1, + }, + + size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 }, + + }); + + $rootScope.currentSlug = '3d-anatomy-details'; + + $rootScope.openViews.push( + { + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, + "slug": $rootScope.currentSlug + }); + + + } + + + }, + function (error) { + // handle errors here + console.log(' $scope.CIllustrationData = ' + error.statusText); + } + + ); + $('#ThreeDView').css("height", $(window).outerHeight()); + + $('#ThreeDView').css("width", $(window).outerWidth()); + + } + + + +}] + + + ); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js b/400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js index fe2760d..3a8c504 100644 --- a/400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js +++ b/400-SOURCECODE/AIAHTML5.Web/term-number-wp1.js @@ -1,89 +1,89 @@ -var UpdatedGrayImageDataList = []; -var doneBRID = []; -var abc = 'hello'; - -getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) { - var matchedRGBLocationInBodyRegion = []; - var matched; - - for (var x = 0; x < maskCanvasData.length; x++) - { - - matched = false; - var bodyRegionId = maskCanvasData[x].bodyRegionId; - var canvasId = maskCanvasData[x].canvasId; - var maskData = maskCanvasData[x].maskData; - - var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1]; - var grayImageDataVar// = grayImageDataList[bodyRegionId - 1]; - - console.log('canvasId =' + canvasId) - //if (canvasId.match('_MR')) { - // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId]; - // grayImageDataVar = grayImageMRDataList[bodyRegionId]; - //} - //else { - coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1]; - grayImageDataVar = grayImageDataList[bodyRegionId-1]; - //} - console.log('grayImageDataVar= ' + grayImageDataVar) - - var counter = 0; - - var imageDataVar = maskData.data; - - var machLocationWP = new Worker('match-pixel-wp.js'); - - - machLocationWP.postMessage({ - - 'termList': termList, - 'maskCanvasData': maskData, - 'coloreImageData': coloredImageDataVar, - 'grayImageData': grayImageDataVar, - 'grayImageMRDataList': grayImageMRDataList, - 'bodyRegionId': bodyRegionId, - 'canvasId': canvasId - - }); - - machLocationWP.onmessage = function (e) { - - - - doneBRID.push(e.data.bodyRegionId); - var canvasID = (e.data.canvasId).replace('_mci', ''); - - UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value }); - - //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value - - - if (doneBRID.length==9) { - - self.postMessage({ - 'value': UpdatedGrayImageDataList, - - }) - } - - }; - machLocationWP.onerror = function (e) { - console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); - }; - - - } - - - - -} - -self.onmessage = function (e) { - getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList, - e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList); - -} - - +var UpdatedGrayImageDataList = []; +var doneBRID = []; +var abc = 'hello'; + +getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageCanvasList, coloredImageMRCanvasList, grayImageDataList, grayImageMRDataList) { + var matchedRGBLocationInBodyRegion = []; + var matched; + + for (var x = 0; x < maskCanvasData.length; x++) + { + + matched = false; + var bodyRegionId = maskCanvasData[x].bodyRegionId; + var canvasId = maskCanvasData[x].canvasId; + var maskData = maskCanvasData[x].maskData; + + var coloredImageDataVar//= coloredImageCanvasList[bodyRegionId - 1]; + var grayImageDataVar// = grayImageDataList[bodyRegionId - 1]; + + console.log('canvasId =' + canvasId) + //if (canvasId.match('_MR')) { + // coloredImageDataVar = coloredImageMRCanvasList[bodyRegionId]; + // grayImageDataVar = grayImageMRDataList[bodyRegionId]; + //} + //else { + coloredImageDataVar = coloredImageCanvasList[bodyRegionId - 1]; + grayImageDataVar = grayImageDataList[bodyRegionId-1]; + //} + console.log('grayImageDataVar= ' + grayImageDataVar) + + var counter = 0; + + var imageDataVar = maskData.data; + + var machLocationWP = new Worker('match-pixel-wp.js'); + + + machLocationWP.postMessage({ + + 'termList': termList, + 'maskCanvasData': maskData, + 'coloreImageData': coloredImageDataVar, + 'grayImageData': grayImageDataVar, + 'grayImageMRDataList': grayImageMRDataList, + 'bodyRegionId': bodyRegionId, + 'canvasId': canvasId + + }); + + machLocationWP.onmessage = function (e) { + + + + doneBRID.push(e.data.bodyRegionId); + var canvasID = (e.data.canvasId).replace('_mci', ''); + + UpdatedGrayImageDataList.push({ 'canvasID': canvasID, 'imageData': e.data.value }); + + //UpdatedGrayImageDataList[e.data.bodyRegionId] = e.data.value + + + if (doneBRID.length==9) { + + self.postMessage({ + 'value': UpdatedGrayImageDataList, + + }) + } + + }; + machLocationWP.onerror = function (e) { + console.log('Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message); + }; + + + } + + + + +} + +self.onmessage = function (e) { + getLocationForMatchedTermsInWholeBody(e.data.termList, e.data.maskCanvasData, e.data.coloredImageCanvasList, + e.data.coloredImageMRCanvasList, e.data.grayImageDataList, e.data.grayImageMRDataList); + +} + + -- libgit2 0.21.4