From 9dd8fa0f293b6efddc668b4a2c061daaca2a7a64 Mon Sep 17 00:00:00 2001 From: birendra.kumar Date: Wed, 11 Sep 2019 11:45:18 +0530 Subject: [PATCH] updated export image count for 3 modules DA,AA and CI. --- 400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs | 2 ++ 400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs | 2 ++ 400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.API/Models/User.cs | 21 +++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.API/Models/Users.cs | 38 ++++++++++++++++++++++++++++++-------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js | 6 ++++++ 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js | 5 +++++ 400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js | 21 +++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html | 4 +--- 400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html | 2 +- 400-SOURCECODE/AIAHTML5.Web/index.aspx | 26 ++++---------------------- 14 files changed, 573 insertions(+), 122 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs index c203cd8..5c3efbf 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs @@ -29,6 +29,8 @@ namespace AIAHTML5.API.Constants public const string LICENSE_TERM_CONDITION_UPDATE_SUCCESS = "License Term Accepted field updated successfully."; public const string LICENSE_TERM_CONDITION_UPDATE_FAILED = "License Term Accepted field update failed."; + public const string EXPORTED_IMAGE_INSERT_FAILED = "Image not Exported."; + public const string KEY_CONTENT = "content"; public const string LICENSE_KEY_ID = "LicenseId"; diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index 429572e..1205101 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -34,5 +34,7 @@ namespace AIAHTML5.API.Constants public const string GET_LICENSE_EDITIONS_FOR_MODESTY = "GetLicenseEditionsForModesty"; public const string GET_PRODUCT_FEATURES = "GetProductFeatures"; public const string GET_MODESTY_FOR_THIS_LICENSE = "usp_GetModestyForThisLicense"; + public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage"; + public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index ad19998..0c3887a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -182,6 +182,57 @@ namespace AIAHTML5.API.Controllers } + [HttpPost] + [Route("api/ExportImage")] + public HttpResponseMessage InserExportImageDetail([FromBody]JObject jsonData) + { + int Status = 0; + dynamic responseData; + LicenseUserInsertImageDetail inserExportImageDetail = new LicenseUserInsertImageDetail(); + + try + { + inserExportImageDetail.LicenseId = jsonData["LicenseId"].Value(); + inserExportImageDetail.UserId = jsonData["UserId"].Value(); + + inserExportImageDetail.ImageName = jsonData["ImageName"].Value(); + inserExportImageDetail.OriginalFileName = jsonData["OriginalFileName"].Value(); + inserExportImageDetail.Title = jsonData["Title"].Value(); + inserExportImageDetail.ModuleName = jsonData["ModuleName"].Value(); + + Status = InsertExportImageDetail(inserExportImageDetail ); + if (Status==-1) + { + if(inserExportImageDetail.LicenseId>0) + { + // for user + var getexportedImagedetail = GetLicenseExportImageDetail(inserExportImageDetail.LicenseId); + responseData = JsonConvert.SerializeObject(getexportedImagedetail); + } + else + { + // for admin + responseData = "ADMIN"; + + } + + + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) }; + + } + else + { + responseData = AIAConstants.EXPORTED_IMAGE_INSERT_FAILED; + return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(responseData) }; + } + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + private static void GetModulesBasedOnUserType(User userInfo) { //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. @@ -208,6 +259,10 @@ namespace AIAHTML5.API.Controllers { GetModulesBasedOnLicense(userInfo, false); } + + // get exported image detail + + userInfo.UserExportImageDetail = GetLicenseExportImageDetail(userInfo.LicenseId); } } @@ -290,7 +345,21 @@ namespace AIAHTML5.API.Controllers } } + private static LicenseUserExportedImageDetail GetLicenseExportImageDetail(int licenseId) + { + LicenseUserExportedImageDetail exportedImageDetail = null; + exportedImageDetail = AIAHTML5.API.Models.Users.getExportedImageDetail(licenseId); + + return exportedImageDetail; + } + private static int InsertExportImageDetail(LicenseUserInsertImageDetail imageDetail) + { + int insertImageResult = 0; + insertImageResult = AIAHTML5.API.Models.Users.InsertExportedImageDetail(imageDetail); + + return insertImageResult; + } // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index ace28ee..9ab9f39 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -465,6 +465,86 @@ namespace AIAHTML5.API.Models return license; } + internal LicenseUserExportedImageDetail GetLicenseUserExportImageDetail(int licenseId) + { + logger.Debug(" inside GetLicenseUserExportImageDetail for LicenseId = " + licenseId); + + LicenseUserExportedImageDetail exportImageDetails = null; + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + SqlDataAdapter adapter; + SqlParameter param; + DataSet ds = new DataSet(); + + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_COUNT_EXPORTED_IMAGE; + cmd.CommandType = CommandType.StoredProcedure; + + param = new SqlParameter("@LicenseId", licenseId); + param.Direction = ParameterDirection.Input; + param.DbType = DbType.Int32; + cmd.Parameters.Add(param); + + adapter = new SqlDataAdapter(cmd); + adapter.Fill(ds); + + if (ds != null && ds.Tables.Count > 0) + { + exportImageDetails = new LicenseUserExportedImageDetail(); + DataTable dt = ds.Tables[0]; + + if (dt.Rows.Count > 0) + { + foreach (DataRow dr in dt.Rows) + { + exportImageDetails.isExportImage = Convert.ToBoolean(dr["isExportImage"]); + exportImageDetails.CountExportedImage = Convert.ToInt32(dr["CountExportedImage"]); + exportImageDetails.ExptImageLimit = Convert.ToInt32(dr["ExptImageLimit"]); + + } + } + } + + return exportImageDetails; + } + + internal int LicenseUserInsertExportedImageDetail(LicenseUserInsertImageDetail imageDetail) + { + logger.Debug(" inside LicenseUserInsertExportedImageDetail for Image= " + imageDetail.ImageName); + + int result = 0; + SqlConnection conn = null; + try + { + conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + conn.Open(); + cmd.Connection = conn; + cmd.CommandText = DBConstants.INSERT_EXPORTED_IMAGE; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@UserId", imageDetail.UserId); + cmd.Parameters.AddWithValue("@LicenseId", imageDetail.LicenseId); + cmd.Parameters.AddWithValue("@ImageName", imageDetail.ImageName); + cmd.Parameters.AddWithValue("@OriginalFileName", imageDetail.OriginalFileName); + cmd.Parameters.AddWithValue("@Title", imageDetail.Title); + cmd.Parameters.AddWithValue("@ModuleName", imageDetail.ModuleName); + + result = cmd.ExecuteNonQuery(); + } + catch (SqlException ex) + { + logger.Fatal("Exception in LicenseUserInsertExportedImageDetail for Image= " + imageDetail.ImageName + ", Exception= " + ex.Message + ", STACKTRACE=" + ex.StackTrace); + throw; + } + finally + { + conn.Dispose(); + } + + return result; + } + internal static int UpdateLicenseTermStatus(string accountNumber) { logger.Debug(" inside UpdateLicenseTermStatus for AccountNumber = " + accountNumber); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index dd3a3d7..0b0de79 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -37,9 +37,12 @@ namespace AIAHTML5.API.Models public Int16 LoginFailureCauseId { get; set; } public bool IsModestyOn { get; set; } public ArrayList Modules { get; set; } + public int siteId { get; set; } public License LicenseInfo { get; set; } public LicenseSubscriptionDetails LicenseSubscriptions { get; set; } + public LicenseUserExportedImageDetail UserExportImageDetail { get; set; } + public bool IsSubscriptionExpired { get; set; } public string SubscriptionExpirationDate { get; set; } public string TermsAndConditionsTitle { get; set; } @@ -108,6 +111,24 @@ namespace AIAHTML5.API.Models public double AmountPending { get; set; } public int NoOfImages { get; set; } } + public class LicenseUserExportedImageDetail + { + public bool isExportImage { get; set; } + public int CountExportedImage { get; set; } + public int ExptImageLimit { get; set; } + } + + public class LicenseUserInsertImageDetail + { + public int LicenseId { get; set; } + public int UserId { get; set; } + public string ImageName { get; set; } + public string OriginalFileName { get; set; } + public string Title { get; set; } + public string ModuleName { get; set; } + + } + public class BlockedUser { diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 652cf45..17ff7aa 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -281,6 +281,32 @@ namespace AIAHTML5.API.Models return userSubscriptionDetail; } + internal static LicenseUserExportedImageDetail getExportedImageDetail(int licenseId) + { + logger.Debug("inside getLicenseDetails for LicenseId =" + licenseId); + + LicenseUserExportedImageDetail imageDetail = null; + + DBModel objModel = new DBModel(); + imageDetail = objModel.GetLicenseUserExportImageDetail(licenseId); + + return imageDetail; + } + + internal static int InsertExportedImageDetail(LicenseUserInsertImageDetail imageDetail) + { + logger.Debug("inside InsertExportedImageDetail for Image =" + imageDetail.ImageName); + + int result = 0; + + DBModel objModel = new DBModel(); + result = objModel.LicenseUserInsertExportedImageDetail(imageDetail); + + return result; + } + + + internal static void isCredentialCorrect(Newtonsoft.Json.Linq.JObject credentials, User userInfo, out bool isCorrectLoginId, out bool isCorrectPassword) { isCorrectLoginId = false; @@ -557,15 +583,11 @@ namespace AIAHTML5.API.Models else userInfo.Modules = getAllModulesList(); - // objResponse.AddData(LoginConst.USER_CONTEXT, objUserContext); - - - // Hashtable arrModuleList = LicenseHelper.GetInstance().GetAllModuleByLicenseId(objLicenseRow.Id); - //if (arrModuleList[9].Equals(true)) { - // SessionManager.GetInstance().AddModSession("ModuleNameIP10", "IP10"); - //} - //logAuthenticationTryForAccountNumber(strAcccountNumber, dtLogDate, 0, strSiteIP, strEdition, strUrlReferer); + // get exported image detail + //note: not tested + userInfo.UserExportImageDetail = getExportedImageDetail(userInfo.LicenseId); + } else { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 226c53b..0315a2b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -603,6 +603,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout .where('_id == ' + $scope.voId) .select('_contentImage'); + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $rootScope.StoreOrgImageName(clickedCIImage[0]._contentImage); + + $scope.clickedCIImage = "~/../content/images/ci/images/" + clickedCIImage[0]._contentImage; var clickedCISummary = []; diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 04cce01..f32faaa 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -6,7 +6,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.genderId = ""; - $scope.BodyViewData; + $rootScope.BodyViewData; $scope.selectedGenderBodyViewData; $scope.imagePath = ""; $rootScope.BodyRegionData; @@ -219,7 +219,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.selectedGenderBodyViewData = new jinqJs() - .from($scope.BodyViewData.BodyViews.view) + .from($rootScope.BodyViewData.BodyViews.view) .where('_gender == ' + $scope.genderId) .select(); @@ -328,7 +328,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l localStorage.setItem("currentViewTitleFromJson", $event.currentTarget.textContent); localStorage.setItem("currentViewTitle", $event.currentTarget.textContent); localStorage.setItem("currentBodyViewId", $event.currentTarget.id); - + var u = $location.url(); $location.url('/da-body-view'); @@ -444,7 +444,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $rootScope.CommonData = result; $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) { - $scope.BodyViewData = data; + $rootScope.BodyViewData = data; $scope.getDAViewList(); @@ -532,6 +532,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); localStorage.setItem("currentViewTitle", tittle); + // store image title for export image + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + + // store image for export + $scope.LoadImageToExport(); + //WILL BE USED WHEN MULTI VIEWOPEN FUNCTIONALITY IS IMPELMNETD //if (openViews != null && openViews != undefined) { // angular.forEach(openViews, function (value, key) { @@ -903,6 +910,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } } + // store image for export + $scope.LoadImageToExport(); //console.log("s" + $rootScope.vocabTermDataArray); //call watch on '$scope.VocabTermTxt and compile
  • and append to
      on first time load @@ -1033,6 +1042,50 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); } + // load image to export + $scope.LoadImageToExport = function() + { + $scope.genderId = $rootScope.getLocalStorageValue("genderId"); + var currentBodyViewId = $rootScope.getLocalStorageValue("currentBodyViewId"); + + var selectBodyViewData = new jinqJs() + .from($rootScope.BodyViewData.BodyViews.view) + .where('_gender == ' + $scope.genderId,'_id == ' + currentBodyViewId) + .select(); + + var userEthnicity; + var userModestysettings; + var curentEthnicity = $rootScope.getLocalStorageValue("globalEthnicity"); + if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) { + userEthnicity = curentEthnicity; + } + else { + userEthnicity = $rootScope.globalSetting.ethnicity; + } + + var curentmodesty = $rootScope.getLocalStorageValue("globalModesty"); + if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) { + userModestysettings = curentmodesty; + } + else { + userModestysettings = $rootScope.globalSetting.modesty; + } + + var viewid=selectBodyViewData[0]._id; + var thumbImage=selectBodyViewData[0]._thumbnailImage; + + var OriginalImage; + if ((viewid == 1) || (viewid == 3) || (viewid== 5) || (viewid == 6) || (viewid== 7) || (viewid == 11)) + { + OriginalImage = ((thumbImage).replace('.jpg', '_' + userEthnicity + userModestysettings)) + '.jpg'; + } + else + { + OriginalImage = ((thumbImage).replace('.jpg', '_' + userEthnicity)) + '.jpg'; + } + + $rootScope.StoreOrgImageName(OriginalImage); + } $scope.LoadDefaultLayerImage = function () { console.log('inside LoadDefaultLayerImage') @@ -7972,7 +8025,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("currentViewTitle").replace('Female', 'Male'); localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("currentViewTitle").replace('Female', 'Male')); - + + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $scope.LoadImageToExport(); $rootScope.isLoading = true; @@ -8005,7 +8062,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("currentViewTitle").replace('Male', 'Female'); localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("currentViewTitle").replace('Male', 'Female')); - + + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $scope.LoadImageToExport(); $rootScope.isLoading = true; @@ -8298,7 +8359,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title; localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title); - + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $scope.LoadImageToExport(); + $rootScope.openViews.push( { "module": $rootScope.currentActiveModuleTitle, "bodyView": $rootScope.getLocalStorageValue("currentViewTitle"), "state": 'max', "BodyViewId": $rootScope.voId, @@ -8423,9 +8488,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.loadNavigatorForSelectedBodyView = function (currentBodyViewId) { - //$rootScope.voId = currentBodyViewId; - //$scope.skinTone = $rootScope.globalSetting.ethnicity; + // store image for export + $scope.LoadImageToExport(); if ($rootScope.NavigatorData != null || $rootScope.NavigatorData != undefined) { var navdtlOrient = new jinqJs() diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 4cfa082..ea0b270 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -42,7 +42,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed. $rootScope.refreshcheck = null; - var isCommingSoonModel = true; + var isCommingSoonModel = true; $rootScope.isCloseSettingClicked = false; @@ -133,7 +133,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } - $rootScope.initializeAIA = function () { if (params != null && params != undefined && params!="") { @@ -227,8 +226,11 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } else { + // birendra// initialize exp img detail object + $rootScope.initializeUserForExportImage(result.Id); + //code for modesty setting - if (result.LicenseInfo != null) { + if (result.LicenseInfo != null) { if (result.IsModestyOn) { $rootScope.isModestyOn = true; $rootScope.isModestyOff = false; @@ -326,6 +328,13 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true if (result.LicenseId == 0 && result.IsActive) { + + // set license id -1 for admin + $scope.UpdateUserExportImageData(result.Id,'LicenseId',-1) + + // set enable export image for admin + $scope.UpdateUserExportImageData(result.Id,'isExportImage',true); + $rootScope.haveRoleAdmin = true; $rootScope.userData = result; @@ -358,26 +367,55 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A else { if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { + + // set license id + $scope.UpdateUserExportImageData(result.Id,'LicenseId',result.LicenseId) + + // set license type :note 5 for demo/test license + $scope.UpdateUserExportImageData(result.Id,'LicenseTypeId',result.LicenseInfo.LicenseTypeId); + + if(result.UserExportImageDetail!=null) + { + // set already export image count + $scope.UpdateUserExportImageData(result.Id,'CountExportImage',result.UserExportImageDetail.CountExportedImage); + + // set Image limit + $scope.UpdateUserExportImageData(result.Id,'ExptImageLimit',result.UserExportImageDetail.ExptImageLimit); + + // set is enable for export image + $scope.UpdateUserExportImageData(result.Id,'isExportImage',result.UserExportImageDetail.isExportImage); + } + + + // disable export image option for demo and for cross the Image limit + if(result.LicenseInfo.LicenseTypeId==5 || result.UserExportImageDetail.isExportImage==false) + { + $rootScope.exportImage = "disableSubMenu"; + } + //0. $rootScope.userData = result; $rootScope.userModules = result.Modules; //1. set haveRoleAdmin = false because LicenseInfo is not null - if (result.LicenseTypeId != 5) { + + if (result.LicenseTypeId != 5 ) { $rootScope.haveRoleAdmin = true; } - if (result.UserTypeId == 8){ + if (result.UserTypeId == 8) + { $rootScope.haveRoleAdmin = false; } - // Remove Admin Link for LicenseEditionId 3/4 of student - if(result.EditionId==3 ||result.EditionId==4) - { - $rootScope.haveRoleAdmin = false; - } + // Remove Admin Link for LicenseEditionId 3/4 of student + if(result.EditionId==3 ||result.EditionId==4) + { + $rootScope.haveRoleAdmin = false; + + } $("#modestyDiv").css("pointer-events", "none"); $("#modestyDiv").css("opacity", 0.5); @@ -452,7 +490,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $scope.ValidateClientSiteUrl = function () { - + $rootScope.isCallFromSite = true; var siteInfo = params.split('&'); @@ -605,97 +643,108 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $rootScope.UpdateAndCloseSetting($rootScope.formsetting) } //code for modesty setting + + $rootscope.siteId = result.siteId; + // birendra// initialize exp img detail object + $rootScope.initializeUserForExportImage(result.Id); - $rootScope.siteId = result.siteId; - - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true - if (result.LicenseId == 0) { - $rootScope.haveRoleAdmin = true; - - $rootScope.userData = result; - $rootScope.userModules = result.Modules; - - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - } - - if (isCommingSoonModel == true) { - - ShowAssignedModulesPopup(result.Modules); - - //if (userInfo.rememberChk) { - - // $scope.saveRemeberMeDetails(result, userInfo); - //} - - sessionStorage.setItem("loginSession", "true"); - localStorage.setItem('isCommingSoonModel', false); - - $rootScope.isVisibleLogin = false; - } - + //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true + if (result.LicenseId == 0) { + $rootScope.haveRoleAdmin = true; - $location.path('/'); + // set license id -1 for admin + $scope.UpdateUserExportImageData(result.Id,'LicenseId',-1) + + // set enable export image for admin + $scope.UpdateUserExportImageData(result.Id,'isExportImage',true); - } - else { - if (result.LicenseInfo != null) { - //0. $rootScope.userData = result; $rootScope.userModules = result.Modules; - //1. set haveRoleAdmin = false because LicenseInfo is not null - $rootScope.haveRoleAdmin = false; - - //2. if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); } - // 3.ShowAssignedModulesPopup - //isCommingSoonModel =true only when user comes first time on application and login - //if (isCommingSoonModel == true) { - - // ShowAssignedModulesPopup(result.Modules); - //} + if (isCommingSoonModel == true) { - //4. - //if ($scope.rememberChk) { + ShowAssignedModulesPopup(result.Modules); - // $scope.saveRemeberMeDetails(result, userInfo); - //} + + sessionStorage.setItem("loginSession", "true"); + localStorage.setItem('isCommingSoonModel', false); - //5. - sessionStorage.setItem("loginSession", "true"); - $rootScope.isVisibleLogin = false; + $rootScope.isVisibleLogin = false; + } - //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time - // localStorage.setItem('isCommingSoonModel', false); $location.path('/'); } else { - if ($('#dvTerms').length > 0) { - $('#dvTerms').html(result.TermsAndConditionsText); + if (result.LicenseInfo != null ) { + + if(result.UserExportImageDetail!=null) + { + // set already export image count + $scope.UpdateUserExportImageData(result.Id,'CountExportImage',result.UserExportImageDetail.CountExportedImage); + + // set Image limit + $scope.UpdateUserExportImageData(result.Id,'ExptImageLimit',result.UserExportImageDetail.ExptImageLimit); + + // set is enable for export image + $scope.UpdateUserExportImageData(result.Id,'isExportImage',result.UserExportImageDetail.isExportImage); + } + + + // disable export image option for demo and for cross the Image limit + if(result.LicenseInfo.LicenseTypeId==5 || result.UserExportImageDetail.isExportImage==false) + { + $rootScope.exportImage = "disableSubMenu"; + } + + $rootScope.userData = result; + $rootScope.userModules = result.Modules; + + //1. set haveRoleAdmin = false because LicenseInfo is not null + $rootScope.haveRoleAdmin = false; + + //2. + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { + + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + } + + + //5. + sessionStorage.setItem("loginSession", "true"); + $rootScope.isVisibleLogin = false; + + //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time + // localStorage.setItem('isCommingSoonModel', false); + + $location.path('/'); + + } + else { + if ($('#dvTerms').length > 0) { + $('#dvTerms').html(result.TermsAndConditionsText); + } + $rootScope.isVisibleLogin = true; + $('#dvTermCondition').fadeIn(); + $rootScope.userData = result; + $rootScope.haveRoleAdmin = false; + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + $location.path('/'); } - $rootScope.isVisibleLogin = true; - $('#dvTermCondition').fadeIn(); - $rootScope.userData = result; - $rootScope.haveRoleAdmin = false; - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - $location.path('/'); } } - } + } } - } - + }, @@ -720,8 +769,6 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } - - $scope.saveRemeberMeDetails = function (result, userInfo) { localStorage.setItem('RememberMeLoginId', result.LoginId); @@ -1241,11 +1288,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $("#optionsListManagerTab").removeClass("disableMenuoption"); $("#optiontSetting").removeClass("disableSubMenu"); - if (($location.url() == "/da-body-view")) { $rootScope.disableMenuannotation = " "; $rootScope.disableMenuoption = " "; - $rootScope.disableSubMenu = "disableSubMenu"; + $rootScope.disableSubMenu = "disableSubMenu"; $rootScope.disableFileMenu = " "; } else if ($location.url() == "/clinical-illustrations-detail") { @@ -1315,6 +1361,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A }, 300); } + $rootScope.openParent = function (slug) { if ($('#jsPanel-1').length > 0) { @@ -5771,6 +5818,137 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A }; + $rootScope.initializeUserForExportImage = function (userloggedInId) { + + $rootScope.UserImageExportData = []; + $rootScope.UserImageExportData.push( + { + 'UserId' : userloggedInId, + 'LicenseId': null, + 'LicenseTypeId': null, + 'isExportImage':false, + 'ExptImageLimit': 0, + 'CountExportImage': 0, + 'Title': null, + 'ModuleName': null, + 'ImageName': null, + 'OriginalFileName': null + + }); + + } + + + $scope.UpdateUserExportImageData=function(userloggedInId,keyname,value) + { + for(var x=0 ;x < $rootScope.UserImageExportData.length;x++){ + + if($rootScope.UserImageExportData[x].UserId==userloggedInId) + { + $rootScope.UserImageExportData[x][keyname]=value; + } + } + } + + $scope.GetUserExportImageData=function(userloggedInId,keyname) + { + for(var x=0 ;x < $rootScope.UserImageExportData.length;x++){ + + if($rootScope.UserImageExportData[x].UserId==userloggedInId) + { + return $rootScope.UserImageExportData[x][keyname]; + } + } + } + + $rootScope.StoreModuleName = function (moduleName) { + + var userid= $rootScope.userData.Id; + $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName); + + } + + $rootScope.StoreTitleName = function (titleName) { + + var userid= $rootScope.userData.Id; + $scope.UpdateUserExportImageData(userid,'Title',titleName); + + } + $rootScope.StoreOrgImageName = function (orgImage) { + + var userid= $rootScope.userData.Id; + $scope.UpdateUserExportImageData(userid,'OriginalFileName',orgImage); + + } + + $rootScope.StoreImageName = function (imageName) { + + var userid= $rootScope.userData.Id; + $scope.UpdateUserExportImageData(userid,'ImageName',imageName); + + } + + + $rootScope.SaveImagefile = function () { + $("#canvasDiv").append(""); + html2canvas($("#canvasDiv"), { + onrendered: function (canvas) { + var fileName = document.getElementById("filename").value + '.jpg'; + if (typeof (fileName) == "undefined" || fileName == ".jpg") + fileName = "Untitled.jpg" + + //store image to export + $rootScope.StoreImageName(fileName); + + if( $rootScope.UserImageExportData.length>0) + { + var imageInfo=$rootScope.UserImageExportData[0]; + + AuthenticationService.UserLicenseExportImage(imageInfo) + .then( + function (result) { + + var dataURL = canvas.toDataURL("image/jpeg"); + var blob = dataURItoBlob(dataURL); + console.log(blob); + saveAs(blob, fileName); + $("#exportlogo").remove(); + $("#filename").val(""); + + if(result!=null && result!="ADMIN" ) + { + var userid= $rootScope.userData.Id; + // set already export image count + $scope.UpdateUserExportImageData(userid,'CountExportImage',result.CountExportedImage); + + // set Image limit + $scope.UpdateUserExportImageData(userid,'ExptImageLimit',result.ExptImageLimit); + + // set is enable for export image + $scope.UpdateUserExportImageData(userid,'isExportImage',result.isExportImage); + + // disable export image option when export Image limit over + if(result.isExportImage==false) + { + $rootScope.exportImage = "disableSubMenu"; + } + } + + }), + function (error) { + console.log(' Error in export Image to databse = ' + error.statusText); + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); + } + + } + + } + }); + $(".export-image").css("display", "none"); + + }; + }] ); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index 51ace75..bf2ba70 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -187,6 +187,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou localStorage.setItem("AAGridViewHighlightThumbnail", $(event.target).parent().parent().parent().attr('id')); } + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $rootScope.StoreOrgImageName($rootScope.imageName); + //3. Navigate to the Module-item-view var u = $location.url(); $location.url('/module-item-view'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index f827bb4..8d36352 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -22,6 +22,27 @@ return deferred.promise; }, + UserLicenseExportImage: function (imageDetails) { + var deferred = $q.defer(); + + $http.post('/API/api/ExportImage', JSON.stringify(imageDetails), { + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(data); + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); + + }); + return deferred.promise; + }, + validateClientSite: function (clientInfo) { var deferred = $q.defer(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html b/400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html index dca711a..ab61140 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html @@ -26,9 +26,7 @@ diff --git a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html index 84602b5..b223dd4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html @@ -15,7 +15,7 @@
    • Open Existing Curriculum
    • Save Curriculum As
    • -
    • Export Image
    • +
    • Export Image
    • Print Active Viewer
    • Print All Open Viewers
    • diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx index 80338bb..aab0230 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx @@ -1083,7 +1083,7 @@
      -
      +
      @@ -1912,27 +1912,9 @@ }); }); - $("#btnSaveEI").click(function () { - $("#canvasDiv").append(""); - html2canvas($("#canvasDiv"), { - onrendered: function (canvas) { - theCanvas = canvas; - var fileName = document.getElementById("filename").value + '.jpg'; - if (typeof (fileName) == "undefined" || fileName == ".jpg") - fileName = "Untitled.jpg" - var dataURL = canvas.toDataURL("image/jpeg"); - var blob = dataURItoBlob(dataURL); - console.log(blob); - saveAs(blob, fileName); - $("#exportlogo").remove(); - $("#filename").val(""); - } - }); - $(".export-image").css("display", "none"); - - }); - }); - function dataURItoBlob(dataURI) { + }); + + function dataURItoBlob(dataURI) { var byteString = atob(dataURI.split(',')[1]); var ab = new ArrayBuffer(byteString.length); var ia = new Uint8Array(ab); -- libgit2 0.21.4