From 8419cab3353b0755528584f0df24696b656f9856 Mon Sep 17 00:00:00 2001 From: Birendra Date: Wed, 17 Jun 2020 17:01:34 +0530 Subject: [PATCH] add my animation complete and fix other bugs --- .gitignore | 7 ++++--- 400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs | 23 +++++++++++++++++------ 400-SOURCECODE/AIAHTML5.API/Web.config | 11 +++++++---- 400-SOURCECODE/AIAHTML5.Web/Web.config | 5 ++--- 400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js | 6 +++--- 400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js | 5 +++-- 400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js | 6 +++--- 400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 5 +++-- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js | 5 +++-- 400-SOURCECODE/AIAHTML5.Web/app/controllers/MyAnimationController.js | 424 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js | 39 ++++++++++++++++++++++++++++++++++++--- 400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/app/directives/AIADirectives.js | 7 +++++++ 400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js | 10 +++++++++- 400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js | 19 ++++++++++++++++++- 400-SOURCECODE/AIAHTML5.Web/app/services/ModuleService.js | 24 ++++++++++++++++++++++++ 400-SOURCECODE/AIAHTML5.Web/app/views/MyAnimation/MyAnimation.html | 9 +++++++++ 400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html | 8 +++++--- 400-SOURCECODE/AIAHTML5.Web/content/data/AnimationMp4/.gitkeep.txt | 5 +++++ 400-SOURCECODE/AIAHTML5.Web/index.aspx | 2 +- 400-SOURCECODE/AIAHTML5.Web/libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js | 4 +++- 25 files changed, 951 insertions(+), 102 deletions(-) create mode 100644 400-SOURCECODE/AIAHTML5.Web/app/controllers/MyAnimationController.js create mode 100644 400-SOURCECODE/AIAHTML5.Web/app/views/MyAnimation/MyAnimation.html create mode 100644 400-SOURCECODE/AIAHTML5.Web/content/data/AnimationMp4/.gitkeep.txt diff --git a/.gitignore b/.gitignore index 9725b84..0c93485 100644 --- a/.gitignore +++ b/.gitignore @@ -43,8 +43,9 @@ $tf*/ 400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html.orig 400-SOURCECODE/.vs/config/applicationhost.config 400-SOURCECODE/.vs/config/applicationhost.config -400-SOURCECODE/AIAHTML5.ADMIN.Web 400-SOURCECODE/AIAHTML5.ADMIN.API/LogDetailsFile/LicenseCreation/LicenseCreation-30-11-18.txt 400-SOURCECODE/AIAHTML5.Web/Web.config -400-SOURCECODE/AIAHTML5.Web/Web.config -400-SOURCECODE/AIAHTML5.Web/Web.config \ No newline at end of file +# exclude everything +400-SOURCECODE/AIAHTML5.Web/content/data/AnimationMp4/* +# exception to the rule +!400-SOURCECODE/AIAHTML5.Web/content/data/AnimationMp4/.gitkeep.txt diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 83ddbbb..320ff7b 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -12,6 +12,10 @@ using AIAHTML5.API.Models; using System.Collections; using System.Data.SqlClient; +using System.IO; +using System.Web.Hosting; +using System.Configuration; + namespace AIAHTML5.API.Controllers { public class AuthenticateController : ApiController @@ -376,6 +380,32 @@ namespace AIAHTML5.API.Controllers return insertImageResult; } + private static int SaveAnimationFile(JArray JsonvidData) + { + int result = 0; + string Path = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"]; + foreach (JObject item in JsonvidData) + { + string data = item.GetValue("Data").ToString(); + // string folderName = item.GetValue("folderNo").ToString(); + string fileName = item.GetValue("FileName").ToString(); + + //Convert Base64 Encoded string to Byte Array. + byte[] imageBytes = Convert.FromBase64String(data); + + //Save the Byte Array as Image File. + // string Path = HostingEnvironment.MapPath("~/../content/data/AnimationMp4/"+ folderName); + + // DirectoryInfo di = Directory.CreateDirectory(Path); + string filePath = HostingEnvironment.MapPath(Path + fileName + ".mp4"); + + File.WriteAllBytes(filePath, imageBytes); + + } + result = 1; + + return result; + } [HttpPost] @@ -413,6 +443,32 @@ namespace AIAHTML5.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [HttpPost] + [Route("api/saveAnimationVideo")] + public HttpResponseMessage saveAnimationVideo([FromBody]JArray JsonvidData) + { + int Status = 0; + + try + { + Status= SaveAnimationFile(JsonvidData); + + if (Status == 1) + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("Save Sccuessful") }; + } + else + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent("file not saved") }; + } + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs index 892bbab..ededf08 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ConfigurationController.cs @@ -1,10 +1,12 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using System.Configuration; +using Newtonsoft.Json; + namespace AIAHTML5.API.Controllers { public class ConfigurationController : ApiController @@ -13,12 +15,21 @@ namespace AIAHTML5.API.Controllers [HttpGet] public HttpResponseMessage GetConfigurationvalues() { - // int current_year = Int32.Parse(ConfigurationManager.AppSettings["Copyrightyear"]); - - int current_year = DateTime.Now.Year; + dynamic responseData; + MyConfig mconfig = new MyConfig(); + mconfig.current_year= DateTime.Now.Year; + mconfig.serverPath = ConfigurationManager.AppSettings["ANIMATION_HOSTING_SERVER"]; + mconfig.fileSize = Int32.Parse(ConfigurationManager.AppSettings["UploadMaxFileSize"]); - HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, current_year); - return response; + responseData = JsonConvert.SerializeObject(mconfig); + + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) }; } } +} +public class MyConfig +{ + public int current_year { get; set; } + public string serverPath { get; set; } + public int fileSize { get; set; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index a6a60fe..cf6ce66 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -31,7 +31,9 @@ - + + + @@ -45,7 +47,6 @@ - @@ -53,13 +54,15 @@ - + - + + + diff --git a/400-SOURCECODE/AIAHTML5.Web/Web.config b/400-SOURCECODE/AIAHTML5.Web/Web.config index ce5f978..9a37b41 100644 --- a/400-SOURCECODE/AIAHTML5.Web/Web.config +++ b/400-SOURCECODE/AIAHTML5.Web/Web.config @@ -21,7 +21,7 @@ - + @@ -44,7 +44,6 @@ - diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index 0e03f3d..fded121 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -271,7 +271,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location } $rootScope.Open3DModelBodyMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.ThreeDModuleData = ModuleService.getModuleData("THREE_D_ANATOMY"); $scope.readyToLoad = true; @@ -528,7 +528,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location if (index != -1) { // remove module which one is loaded - $scope.TheeDWindowData.splice(index, 1); + $rootScope.TheeDWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index cb9be70..81bd5ce 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -195,7 +195,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (index != -1) { // remove module which one is loaded - $scope.AIWindowData.splice(index, 1); + $rootScope.AIWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); @@ -993,7 +993,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $rootScope.OpenAdamImageViewMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.AIModuleData = ModuleService.getModuleData("ADAM_IMAGES"); $scope.readyToLoad = true; @@ -1169,7 +1169,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }); $('#canvasDivAI_' + windowviewid + ' img').load(function () { - + $scope.EnableUI(); $scope.JsPanelclick(windowviewid); var canvas = document.getElementById("canvasAI_" + windowviewid); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js index 5a19802..6b818ed 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js @@ -650,7 +650,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $rootScope.openCABodyViewMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.CAModuleData = ModuleService.getModuleData("CLINICAL_ANIMATIONS"); $scope.readyToLoad = true; @@ -928,6 +928,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.videoOnLoad = function (windowviewid) { + $scope.EnableUI(); $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); @@ -1036,7 +1037,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (index != -1) { // remove module which one is loaded - $scope.CAWindowData.splice(index, 1); + $rootScope.CAWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index bca1005..02d74e0 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -712,7 +712,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $rootScope.openCIBodyViewMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.CIModuleData = ModuleService.getModuleData("CLINICAL_ILLUSTRATIONS"); $scope.readyToLoad = true; @@ -945,7 +945,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#canvasDivCI_' + windowviewid + ' img').load(function () { - + $scope.EnableUI(); $rootScope.isLoading = false; $('#spinner').css('visibility', 'hidden'); @@ -1085,7 +1085,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (index != -1) { // remove module which one is loaded - $scope.CIWindowData.splice(index, 1); + $rootScope.CIWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index 6d2cb4f..0ed7c50 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -1,5 +1,5 @@ -AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location", "$timeout", "ModuleService", "$interval","$window", -function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $timeout, ModuleService, $interval, $window) { +AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location", "$timeout", "ModuleService", "$interval","$window","AuthenticationService","AIAConstants", +function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $timeout, ModuleService, $interval, $window, AuthenticationService, AIAConstants) { $scope.showTabButton = false; $scope.listCurriculumBuilder = null; @@ -12,6 +12,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $rootScope.contentNotesForSaveCB = []; $rootScope.dynamicUpdatedJsonForSaveCB = ""; $scope.isChangeFromDropDown=false; + $rootScope.collectAnimationSource = []; $scope.IsVisible = function () { $scope.scroll(); } @@ -46,10 +47,16 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ tinymce.execCommand('mceRemoveEditor', true, 'CBTextArea'); tinymce.execCommand('mceAddEditor', true, 'CBTextArea'); - if ($('#' + id).html() != undefined) { - - $('#' + id).remove(); + //remove minized module + if ($('#jsPanel-min-container').html() != undefined) { + $('#jsPanel-min-container').remove(); + + } + //clear if animation data exist + $rootScope.collectAnimationSource=[]; + if ($('#' + id).html() != undefined) { + $('#' + id).remove(); } } @@ -428,6 +435,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $rootScope.contentNotesForSaveCB = []; $rootScope.dynamicUpdatedJsonForSaveCB = ""; $scope.isChangeFromDropDown=false; + $rootScope.collectAnimationSource = []; if (($location.url() == "/curriculum-builder")) { $location.url("/curriculum-builder-detail"); @@ -545,6 +553,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $("#AddSection").addClass("cbAddSection"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $("#export_btn").addClass("importExportSection"); $("#import_btn").addClass("importExportSection"); } @@ -555,6 +564,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $("#AddSection").removeClass("cbAddSection"); $("#openResourceId").addClass("openResources"); $("#openPictureId").addClass("OpenPitures"); + $("#openAnimationId").addClass("OpenPitures"); $("#export_btn").removeClass("importExportSection"); $("#import_btn").removeClass("importExportSection"); } @@ -576,7 +586,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('#cbparentcustomDiv').empty(); } - if ($scope.SelectedNotes != "" && $scope.SelectedNotes != undefined) { + if (($scope.SelectedNotes != "" && $scope.SelectedNotes != undefined)|| + ($scope.selectedNodeSingleObj.windows != "" && $scope.selectedNodeSingleObj.windows != undefined)) { tinymce.get("CBTextArea").setContent($scope.SelectedNotes); $scope.LoadModuleName = []; $scope.Slidenumber = $scope.selectedNodeSingleObj._id; @@ -1163,14 +1174,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } $scope.ExportCurriculum =function() - { + { var filename = document.getElementById("filename").value; if (filename == "" ||filename == " ") { alert("Curriculum name is empty!"); return; } - + $scope.CBDisableUI(); var strFromParent=$scope.selectedNodeSingleObj['structure']; var parentLevel=$scope.selectedNodeSingleObj._label; var parentId=$scope.selectedNodeSingleObj._id ; @@ -1200,8 +1211,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ if(childId!=undefined) { for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) { - if (($rootScope.contentNotesForSaveCB[k]._id == childId)) { - $scope.SectionContentForExportCB.push($rootScope.contentNotesForSaveCB[k]); + if (($rootScope.contentNotesForSaveCB[k]._id == childId)) { + $scope.SectionContentForExportCB.push($rootScope.contentNotesForSaveCB[k]); break; } } @@ -1238,27 +1249,87 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ }; - //add extension - filename += '.json'; - var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForExportCB, true)], { type: 'text/text' }); - if (window.navigator && window.navigator.msSaveOrOpenBlob) { - window.navigator.msSaveOrOpenBlob(blob, filename); - } - else { - document.execCommand("SaveAs", true, filename); - - var event = document.createEvent('MouseEvents'), - saveElement = document.createElement('a'); - saveElement.download = filename; - saveElement.href = window.URL.createObjectURL(blob); - saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); - event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); - saveElement.dispatchEvent(event); - + $scope.saveCBwithAnimation("exportcb",filename); + } + + $scope.saveCBwithAnimation=function(downloadtype,filename) + { + if($rootScope.collectAnimationSource.length>0) + { + var AnimationData=[]; + function getBase64Image(base64string) { + return base64string.replace(/^data:video\/(mp4);base64,/, ""); + } + + for (var k = 0; k < $rootScope.collectAnimationSource.length; k++) { + AnimationData.push({ + "Data":getBase64Image($rootScope.collectAnimationSource[k].Source), + //"folderNo":$rootScope.collectAnimationSource[k].imageId, + "FileName":$rootScope.collectAnimationSource[k].windowTitle, + + }); + + } + + AuthenticationService.saveAnimationVideo(AnimationData) + .then( + function (result) { + if(result!=null) + { + $scope.downloadCurriculum(downloadtype,filename); + $rootScope.collectAnimationSource = []; + //clear video source after save on server + // next time it load from server + for (var i = 0; i < $rootScope.VideoWindowData.length; i++) { + $rootScope.VideoWindowData[i].videoSource=""; + } + } + }, + function (error) { + console.log(' Error in Saving video = ' + error.statusText); + $scope.CBEnableUI(); + $rootScope.errorMessage = AIAConstants.SAVE_ANIMATION_ERROR+"\n"+error.ExceptionMessage;; + $("#messageModal").css('zIndex', 80000000000); + $("#messageModal").modal('show'); + }) } + else + { + $scope.downloadCurriculum(downloadtype,filename); + } + } + $scope.downloadCurriculum=function(downloadtype,filename) + { + //add extension + filename += '.json'; + if(downloadtype=="exportcb") + { + var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForExportCB, true)], { type: 'text/text' }); + } + else + { + var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' }); + } + + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveOrOpenBlob(blob, filename); + } + else { + document.execCommand("SaveAs", true, filename); + + var event = document.createEvent('MouseEvents'), + saveElement = document.createElement('a'); + saveElement.download = filename; + saveElement.href = window.URL.createObjectURL(blob); + saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); + event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + saveElement.dispatchEvent(event); + + } $rootScope.dynamicUpdatedJsonForExportCB = ""; - $("#filename").val(""); - + $rootScope.dynamicUpdatedJsonForSaveCB = ""; + $("#filename").val(""); + $scope.CBEnableUI(); } $rootScope.DeleteSlideSection = function () { @@ -1637,7 +1708,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ alert("Curriculum name is empty!"); return; } - + $scope.CBDisableUI(); var cbCurrentId = document.getElementById('cbSelect').value; if ($rootScope.structureObjForSaveCB.length == 0) { $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; @@ -1672,27 +1743,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ }; - //add extension - filename += '.json'; - - var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' }); - if (window.navigator && window.navigator.msSaveOrOpenBlob) { - window.navigator.msSaveOrOpenBlob(blob, filename); - } - else { - document.execCommand("SaveAs", true, filename); - - var event = document.createEvent('MouseEvents'), - saveElement = document.createElement('a'); - saveElement.download = filename; - saveElement.href = window.URL.createObjectURL(blob); - saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); - event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); - saveElement.dispatchEvent(event); - //window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource - } - $rootScope.dynamicUpdatedJsonForSaveCB = ""; - $("#filename").val(""); + $scope.saveCBwithAnimation("savecb",filename); + } $rootScope.updatedContentFromEditor = function (cbCurrentId) { @@ -1850,6 +1902,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ var ADAMIMGWindowId = 0; var LabWindowId = 0; var PicWindowId = 0; + var AniWindowId = 0; //check for multiple windows, if Array.isArray==true if (allwindowData != undefined) { @@ -1864,6 +1917,21 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $scope.LoadModuleName.push(windowData.mType); } } + else if (windowData.mType == "MY_ANIMATIONS") { + for (var k = 0; k < $rootScope.collectAnimationSource.length; k++) { + if($rootScope.collectAnimationSource[k].SlideId==id && $rootScope.collectAnimationSource[k].imageId==windowData.imageId) + { + windowData.videoSource=$rootScope.collectAnimationSource[k].Source; + } + } + ModuleService.setModuleData(windowData, AniWindowId); + AniWindowId = AniWindowId + 1; + + var isFound = jQuery.inArray(windowData.mType, $scope.LoadModuleName) + if (isFound == -1) { + $scope.LoadModuleName.push(windowData.mType); + } + } else if (windowData.mType == "DISSECTIBLE_ANATOMY") { ModuleService.setModuleData(windowData, DawindowId); DawindowId = DawindowId + 1; @@ -2009,6 +2077,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ case "MY_PICTURES": $scope.loadMyPictureModule(moduleName); break; + case "MY_ANIMATIONS": + $scope.loadMyAnimationModule(moduleName); + break; } } @@ -2035,6 +2106,28 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } } + $scope.loadMyAnimationModule = function (moduleName) { + + var aniData = ModuleService.getModuleData(moduleName); + + if (aniData != undefined && aniData.length > 0) { + $rootScope.isCallFromOtherModule = true; + + var vidSectionExist = document.getElementById('vidCustomModuleDiv'); + + if (vidSectionExist == null) { + $('#cbparentcustomDiv').append($('
')); + $e = $('#vidCustomModuleDiv').append(""); + $compile($e)($scope); + } + else { + // open lab panel on same slide by open resource + $rootScope.OpenMyAnimationViewMain(); + } + + } + } + $scope.loadLabExerciseModule = function (moduleName) { var labData = ModuleService.getModuleData(moduleName); @@ -2078,6 +2171,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } } + $scope.load3DAnatomyModule = function (moduleName) { var ThreeDData = ModuleService.getModuleData(moduleName); @@ -2099,6 +2193,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } } + $scope.loadClinicalAnimationModule = function (moduleName) { var CAData = ModuleService.getModuleData(moduleName); @@ -2349,6 +2444,57 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } } + //Save My-Animation activity for CB + $scope.saveMyAnimationWindowActivity = function (isNotSaved,slideId) { + if ($rootScope.VideoWindowData != undefined && $rootScope.VideoWindowData.length > 0) { + for (var i = 0; i < $rootScope.VideoWindowData.length; i++) { + var isSourceExist = $rootScope.VideoWindowData[i].isSourceExist; + if(isSourceExist==true) + { + var imageId = $rootScope.VideoWindowData[i].imageId; + var exist = new jinqJs() + .from($rootScope.collectAnimationSource) + .where('imageId == ' + imageId) + .select(); + if(exist.length<=0) + { + $rootScope.collectAnimationSource.push( + { + "SlideId": slideId, + "Source": $rootScope.VideoWindowData[i].videoSource, + "imageId": $rootScope.VideoWindowData[i].imageId,//use for other purpose until save or export cb + "windowTitle": $rootScope.VideoWindowData[i].currentViewTitle + }); + } + } + $scope.updatedWindowListForSaveCB.push({ + + containsCapturedContent: true, + contextMenu: { lockResize: false, hideToolBar: false, hideTitleBar: false }, + position: { + top: $rootScope.VideoWindowData[i].top, + left: $rootScope.VideoWindowData[i].left, + }, + size: { + height: $rootScope.VideoWindowData[i].height, + width: $rootScope.VideoWindowData[i].width + }, + imageId: $rootScope.VideoWindowData[i].imageId, + minimised: $rootScope.VideoWindowData[i].minimised, + windowTitle: $rootScope.VideoWindowData[i].currentViewTitle, + maximised: $rootScope.VideoWindowData[i].maximised, + mType: $rootScope.VideoWindowData[i].moduleName, + id: $rootScope.VideoWindowData[i].imageId, + scrollFlvPosition: { vertical: 0, horizontal: 0 }, + windowListId: 0, + videoSource: ""//keeping source in $scope.collectAnimationSource + }); + + } + if(isNotSaved) + $rootScope.VideoWindowData = []; + } + } //Save ATLAS_ANATOMY activity for CB $scope.saveAAWindowActivity = function (isNotSaved) { @@ -2479,6 +2625,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $scope.updateWindowsContentForSaveCB = function (currentId,isNotSaved) { $scope.saveMyPictureWindowActivity(isNotSaved); + $scope.saveMyAnimationWindowActivity(isNotSaved,currentId); $scope.saveDAWindowActivity(isNotSaved); $scope.saveAAWindowActivity(isNotSaved); $scope.saveCIWindowActivity(isNotSaved); @@ -2529,7 +2676,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } - }] ); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 5dc0833..2040caf 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -610,6 +610,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $rootScope.openDABodyViewMain = function () { $scope.ScopeVariablesDeclare(); + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.DAModuleData = ModuleService.getModuleData("DISSECTIBLE_ANATOMY"); $scope.readyToLoad=true; @@ -1136,7 +1137,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l rootScope.$apply(function () { rootScope.isLoading = true; }) - var scope = angular.element(document.geSideBarToggleDAtElementsByClassName("daBodyView")).scope(); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); scope.$apply(function () { if ($scope.GetwindowStoreData(windviewid,'isTransparencyActivated')) { @@ -12187,7 +12188,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if (index != -1) { // remove module which one is loaded - $scope.DaWindowData.splice(index, 1); + $rootScope.DaWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index ebd470e..0fbafcc 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -177,6 +177,80 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $rootScope.OpenMyAnimation = function () { + $rootScope.CloseListManager(); + $rootScope.CloseAnnotationTool(); + + // close list if opened in DA + var searchedTermListPopUp = $("#HomeContainerDiv").find("div[id*='searchedTermListPopUp']"); + for (var i = 0 ; i < searchedTermListPopUp.length; i++) { + var windowviewid = (searchedTermListPopUp[i].id).split('_')[1]; + $('#searchedTermListPopUp_' + windowviewid).css('display', 'none'); + $('#searchedTermListPopUp_' + windowviewid).css("visibility", "hidden"); + $('#searchTermListUl_' + windowviewid).empty(); + } + + var fileupload = document.getElementById("myAnimationFile"); + $timeout(function () { + $(fileupload).trigger('click'); + }, 300); + + $(fileupload).val('');//old file path + fileupload.onchange = function (e) { + + var fileId, file, objFileRead; + if (typeof window.FileReader !== 'function') { + alert("The file API isn't supported on this browser yet."); + return; + } + fileId = document.getElementById('myAnimationFile'); + if (!fileId) { + alert("File couldn't find the element."); + } + else if (!fileId.files) { + alert("This browser doesn't seem to support the `files` property of file inputs."); + } + else if (!fileId.files[0]) { + alert("Please select a file before clicking 'Load'"); + } + else { + file = fileId.files[0]; + var extension = file.name.split(".")[1]; + if (extension == "mp4" && file.type=="video/mp4") { + if (file.size <= $rootScope.MaxOneFileSize) { + var reader = new FileReader(); + reader.onloadend = function () { + var date = new Date(); + var animationId = date.getTime(); + //set default module data + var AniOpenData = { + "mType": 'MY_ANIMATIONS', + "id":animationId,//user for identify resource until save or export cb + "videoSource":reader.result, + "windowTitle": file.name.split(".")[0], + "size": { height: 500, width: 800 } + }; + AIAModuleOpenResourceInfo(AniOpenData); + } + if (file) { + reader.readAsDataURL(file); + } + } + else + { + alert("File size not allow more than 10MB.Please try again"); + } + } + else + { + alert("Please select a file in mp4 format.Please try again"); + } + + } + }; + + } + $rootScope.openResource = function () { $rootScope.CloseListManager(); @@ -504,6 +578,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } break; + case "MY_ANIMATIONS": + var vidSectionExist = document.getElementById('vidCustomModuleDiv'); + + if (vidSectionExist == null ||vidSectionExist==undefined) { + $(BasemoduleDivId).append($('
')); + var html = $('#vidCustomModuleDiv').append(""); + $compile(html)($scope); + } + else { + // open another Animation + $rootScope.OpenMyAnimationViewMain(); + } + + break; } } @@ -628,10 +716,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.getConfigurationValues = function () { ConfigurationService.getCofigValue() .then( - function (configresult) { - $rootScope.current_year = configresult; + function (configresult) { + $rootScope.current_year = configresult.current_year; + $rootScope.aiaAnimationPath = configresult.serverPath; + $rootScope.MaxOneFileSize = configresult.fileSize; - }); + }); } $rootScope.AuthenticateUser = function (userInfo) { if (navigator.cookieEnabled) { @@ -1777,6 +1867,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1797,6 +1888,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1815,6 +1907,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1833,6 +1926,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1853,6 +1947,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#labExPdfOption").addClass("disableSubMenu"); $("#openPictureId").addClass("OpenPitures"); + $("#openAnimationId").addClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#printAVAnchor").addClass("PrintViewer"); @@ -1871,7 +1966,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.openCurriculum = ""; $rootScope.saveCurriculam = ""; $("#openResourceId").removeClass("openResources"); - $("#openPictureId").removeClass("OpenPitures"); + $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $("#printAVAnchor").addClass("PrintViewer"); $("#printAllAVAnchor").addClass("PrintViewer"); @@ -1888,6 +1984,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1907,6 +2004,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1925,6 +2023,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#fileMenuAnchor").removeClass("disableFileMenu"); $("#openResourceId").removeClass("openResources"); $("#openPictureId").removeClass("OpenPitures"); + $("#openAnimationId").removeClass("OpenPitures"); $rootScope.disableMenuoption = "disableMenuoption"; $rootScope.newCurriculum = "newCurriculum"; $rootScope.openCurriculum = "openCurriculum"; @@ -1984,7 +2083,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } else { // first panel - paneltopPosition = 680; + paneltopPosition = 610; } return paneltopPosition; @@ -5980,7 +6079,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#bodySystems').empty(); $('#termList').empty(); $('#viewName').empty(); - var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='picImagePanel']"); + var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='picImagePanel']").not("div[id*='vidImagePanel']"); if (modulePanel != undefined && modulePanel.length>0) { for (var i = 0 ; i < modulePanel.length; i++) { var paneld = modulePanel[i].id; @@ -6006,7 +6105,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#bodySystems').empty(); $('#termList').empty(); $('#viewName').empty(); - var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='labImagePanel']").not("div[id*='picImagePanel']"); + var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='labImagePanel']").not("div[id*='picImagePanel']").not("div[id*='vidImagePanel']"); if (modulePanel != undefined && modulePanel.length>0) { for (var index = 0 ; index < modulePanel.length; index++) { var paneld = modulePanel[index].id; @@ -6660,7 +6759,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var pageno = 0; // select all open module div. - var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='labImagePanel']"); + var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='labImagePanel']").not("div[id*='vidImagePanel']"); for (var i = 0 ; i < modulePanel.length; i++) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js index 953250a..2642f96 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js @@ -244,7 +244,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, } $rootScope.InitializeLabExerciseMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.LEModuleData = ModuleService.getModuleData("LAB_EXERCISE"); $scope.readyToLoad = true; @@ -431,6 +431,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, else { $scope.GetQuizByTopic(windowviewid); } + $scope.DisableUI(); }, function (error) { @@ -571,7 +572,7 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter, if (index != -1) { // remove module which one is loaded - $scope.LEWindowData.splice(index, 1); + $rootScope.LEWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyAnimationController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyAnimationController.js new file mode 100644 index 0000000..f9ad51f --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyAnimationController.js @@ -0,0 +1,424 @@ +'use strict'; + +AIA.controller("MyAnimationController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "ModuleService", "$interval", "AIAConstants", +function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, ModuleService, $interval, AIAConstants) { + $scope.ObjectAttribute=function(windowviewid) + { + var windata={ + 'multiwinid': windowviewid, + 'videoSource': "", + 'moduleName': '', + 'currentViewTitle': '', + 'parentSlugName': '', + 'currentSlug': '', + 'imageId': '', + 'top': 0, + 'left': 0, + 'width': 0, + 'height': 0, + 'minimised': false, + 'maximised': false, + 'isSourceExist':true + }; + return windata; + } + + $scope.initializeVideoWindowData = function (windowviewid, isOpenWithExistsModule, openPanelNo) { + if (isOpenWithExistsModule || openPanelNo == 0) { + if ($rootScope.VideoWindowData != undefined) { + $rootScope.VideoWindowData.length = 0; + } + else { + $rootScope.VideoWindowData = []; + } + + $rootScope.VideoWindowData.push($scope.ObjectAttribute(windowviewid)); + + } + else { + var isNewWindow = true; + for (var k = 0; k < $rootScope.VideoWindowData.length; k++) { + if ($rootScope.VideoWindowData[k].multiwinid == windowviewid) { + isNewWindow = false; + break; + } + } + + if (isNewWindow) { + $rootScope.VideoWindowData.push($scope.ObjectAttribute(windowviewid)); + } + } + } + + $scope.GetVideowindowStoreData = function (windowviewid, keyname) { + for (var x = 0 ; x < $rootScope.VideoWindowData.length; x++) { + + if ($rootScope.VideoWindowData[x].multiwinid == windowviewid) { + return $rootScope.VideoWindowData[x][keyname]; + } + } + } + + $scope.SetVideowindowStoreData = function (windowviewid, keyname, value) { + for (var x = 0 ; x < $rootScope.VideoWindowData.length; x++) { + + if ($rootScope.VideoWindowData[x].multiwinid == windowviewid) { + $rootScope.VideoWindowData[x][keyname] = value; + } + } + } + + $scope.DisableUI = function () { + + var aniImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < aniImagePanelConetent.length; i++) { + aniImagePanelConetent[i].style.pointerEvents = "none"; + aniImagePanelConetent[i].style.opacity = "0.7"; + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + + // CB module disable all + $('#CBDetailPageDiv').css('pointer-events', 'none'); + $('#CBDetailPageDiv').css('opacity', '0.7'); + } + + $scope.EnableUI = function () { + + var aniImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < aniImagePanelConetent.length; i++) { + aniImagePanelConetent[i].style.pointerEvents = "auto"; + aniImagePanelConetent[i].style.opacity = "1"; + } + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + // CB module enable all + $('#CBDetailPageDiv').css('pointer-events', 'auto'); + $('#CBDetailPageDiv').css('opacity', '1'); + + } + + $scope.RemoveJSPanel = function (panelid) { + + var len = (panelid).split("_").length; + var windowviewid = (panelid).split("_")[len - 1]; + + // remove old stored data after close panel + for (var index = 0 ; index < $rootScope.VideoWindowData.length; index++) { + + if ($rootScope.VideoWindowData[index].multiwinid == windowviewid) { + + if (index != -1) { + // remove module which one is loaded + var reffid=$rootScope.VideoWindowData[index].imageId; + $rootScope.VideoWindowData.splice(index, 1); + //remove also stream/source video from close panel from cb + if($rootScope.collectAnimationSource !=undefined) + { + for (var vdx = 0 ; vdx < $rootScope.collectAnimationSource.length; vdx++) { + if(reffid==$rootScope.collectAnimationSource[vdx].imageId) + $rootScope.collectAnimationSource.splice(vdx, 1); + } + } + if ($('#' + panelid).html() != undefined) { + + $('#' + panelid).remove(); + + } + $rootScope.resetjsPanelTop(panelid); + } + } + } + } + $scope.PanelActivity = function () { + + $("#" + $scope.jsPanelID).resizable({ + stop: function (event, ui) { + var len = (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len - 1]; + $scope.SetVideowindowStoreData(windowviewid, 'width', ui.size.width); + $scope.SetVideowindowStoreData(windowviewid, 'height', ui.size.height); + } + }); + + $("#" + $scope.jsPanelID).draggable({ + stop: function (event, ui) { + var len = (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len - 1]; + //var offSets = $(this).offset(); var postions = (this).position(); (this).offsetTop (this).offsetLeft + $scope.SetVideowindowStoreData(windowviewid, 'top', ui.position.top); + $scope.SetVideowindowStoreData(windowviewid, 'left', ui.position.left); + } + }); + // close panel + $(document).on("click", "#" + $scope.jsPanelID + " .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () { + + var panelid = $(event.target).parent().parent().parent().parent().attr('id'); + + $scope.RemoveJSPanel(panelid); + + }); + } + + $rootScope.OpenMyAnimationViewMain = function () { + if ($rootScope.isCallFromOtherModule) { + $scope.DisableUI(); + $scope.VideoModuleData = ModuleService.getModuleData("MY_ANIMATIONS"); + $scope.readyToLoad = true; + $rootScope.VideoLoadComplete = false; + $scope.wincount = 1; + var winlen = $scope.VideoModuleData.length; + var timeint = null; + timeint = $interval(function () { + + if ($scope.readyToLoad == true) { + var windata = $scope.VideoModuleData[$scope.wincount - 1]; + $scope.OpenAnimationView(windata); + + } + $scope.readyToLoad = false; + if ($scope.wincount < winlen && $rootScope.VideoLoadComplete == true) { + $scope.wincount = $scope.wincount + 1; + $rootScope.VideoLoadComplete = false; + $scope.readyToLoad = true; + } + + if ($scope.wincount == winlen && $rootScope.VideoLoadComplete == true) { + $scope.stopInterval(); + $scope.$emit("LoadModuleComplete", "MY_ANIMATIONS"); + } + + + }, 100); + + $scope.stopInterval = function () { + if (angular.isDefined(timeint)) { + $interval.cancel(timeint); + timeint = undefined; + } + + }; + + } + + } + + $scope.OpenAnimationView = function (vidModuleData) { + $scope.VidOpenInOtherModules = vidModuleData; + $rootScope.MULTI_VIEW_ID += 1; + var windowviewid = $rootScope.MULTI_VIEW_ID; + + $scope.initializeVideoWindowData(windowviewid, false, $scope.VidOpenInOtherModules.currentWindowId); + + var moduleName = $scope.VidOpenInOtherModules.mType; + $scope.SetVideowindowStoreData(windowviewid, 'moduleName', moduleName); + // serial no of imageid + var imageId = $scope.VidOpenInOtherModules.id; + + $scope.SetVideowindowStoreData(windowviewid, 'imageId', imageId); + + var videoSource=$scope.VidOpenInOtherModules.videoSource; + + $scope.SetVideowindowStoreData(windowviewid, 'videoSource', videoSource); + + if(videoSource=="" ||videoSource==undefined) + { + $scope.SetVideowindowStoreData(windowviewid, 'isSourceExist', false); + } + + var aiTitle = $scope.VidOpenInOtherModules.anatomyTitle; + $scope.SetVideowindowStoreData(windowviewid, 'currentViewTitle', aiTitle); + localStorage.setItem("currentViewTitle", aiTitle); + var isMaximize = $scope.VidOpenInOtherModules.maximised; + var isMinimize = $scope.VidOpenInOtherModules.minimised; + $scope.SetVideowindowStoreData(windowviewid, 'maximised', isMaximize); + $scope.SetVideowindowStoreData(windowviewid, 'minimised', isMinimize); + + if($location.url()== "/curriculum-builder-detail") { + $scope.SetVideowindowStoreData(windowviewid,'parentSlugName',($location.url()).replace('/', '')); + } + else + { + $scope.SetVideowindowStoreData(windowviewid,'parentSlugName','');//back to home screen + } + + $scope.loadMyAnimation(windowviewid); + + } + + $scope.loadMyAnimation = function (windowviewid) { + $scope.DisableUI(); + $scope.jsPanelID = 'vidImagePanel' + '_' + windowviewid; + var tittle = $scope.GetVideowindowStoreData(windowviewid, 'currentViewTitle'); + var animationSource = $scope.GetVideowindowStoreData(windowviewid, 'videoSource'); + var isSourceExist = $scope.GetVideowindowStoreData(windowviewid, 'isSourceExist'); + + if(isSourceExist==true) + { + // get animation from uploaded stream + if (animationSource.indexOf('base64') == -1) { + animationSource="data:video/mp4;base64,"+animationSource; + } + } + else + { + // get animation from server + animationSource=$scope.aiaAnimationPath+ tittle + ".mp4"; + } + + var playerScript = "~/../libs/video_4_12_11/video_4_12_11.js"; + + if ($rootScope.isCallFromOtherModule) { + // open JS panel for curriculum with define cornonate in CB jason + $scope.jsPanelWidth = $scope.VidOpenInOtherModules.size.width;//1000; + if ($scope.VidOpenInOtherModules.size.width < 800) + $scope.jsPanelWidth = 800; + + $scope.jsPanelHeight = $scope.VidOpenInOtherModules.size.height; + if ($scope.VidOpenInOtherModules.size.height > 360) + $scope.jsPanelHeight = 360; + $scope.jsPanelLeft = 320; + $scope.jsPanelTop = $rootScope.cBModulejsPanelTop(); + if($location.url()!= "/curriculum-builder-detail") { + $scope.jsPanelLeft = 1; + } + + } + else { + $scope.jsPanelWidth = $(window).outerWidth() - 20; + $scope.jsPanelHeight = $(window).outerHeight() - 105; + $scope.jsPanelLeft = 1; + $scope.jsPanelTop = 70; + } + + + if (animationSource.length > 0 ) { + $scope.jsPanelVideo = $.jsPanel({ + id: $scope.jsPanelID, + selector: '.videoView', + theme: 'success', + currentController: 'MyAnimationController', + parentSlug: $scope.GetVideowindowStoreData(windowviewid, 'parentSlugName'), + content: '' + + '
', + + title: tittle, + position: { + top: $scope.jsPanelTop, + left: $scope.jsPanelLeft + }, + + size: { + width: $scope.jsPanelWidth, + height: $scope.jsPanelHeight + }, + + + }); + + var isMaximize = $scope.GetVideowindowStoreData(windowviewid, 'maximised'); + var isMinimize = $scope.GetVideowindowStoreData(windowviewid, 'minimised'); + if (isMaximize) { + $scope.jsPanelVideo.maximize(); + } + else if (isMinimize) { + $scope.jsPanelVideo.minimize(); + } + else { + $scope.jsPanelVideo.normalize(); + } + $scope.SetVideowindowStoreData(windowviewid, 'top', $scope.jsPanelTop); + $scope.SetVideowindowStoreData(windowviewid, 'left', $scope.jsPanelLeft); + $scope.SetVideowindowStoreData(windowviewid, 'width', $scope.jsPanelWidth); + $scope.SetVideowindowStoreData(windowviewid, 'height', $scope.jsPanelHeight); + + $scope.SetVideowindowStoreData(windowviewid, 'currentSlug', 'clinical-animations-detail'); + $('html, body').animate({ scrollTop: 0 }); + $rootScope.openViews.push( + { + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, + "slug": $scope.GetVideowindowStoreData(windowviewid, 'currentSlug') + }); + + + var jspContentHeight = $('.jsPanel-content').height(); + var videoHeight = $('#divplayerinlineVideo_'+ windowviewid +' div').height(); + if (videoHeight <= 0) + videoHeight = 360; + var textH = $('.video-subtitle').height(); + textH = textH + 40; + var blackBorderHeight = jspContentHeight - (videoHeight + textH); + + if ($('.jsPanel-content').length > 0) { + $('.video-subtitle').css('margin-bottom', blackBorderHeight); + $('#divplayerinlineVideo_'+ windowviewid ).css('background', '#fff'); + //Android > Clinical Animations > The animation does not fit to the screen in the Landscape mode. + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { $('.jsPanel-content').css("width", "100%"); } + } + + } + + if (!$rootScope.isCallFromOtherModule) { + $('#VideoView').css("height", $(window).outerHeight() - 20); + + $('#VideoView').css("width", $(window).outerWidth() - 30); + + } + //Calling methode for save Js Panel Activity for SaveCB + $scope.PanelActivity(); + } + + $scope.videoOnLoad = function (windowviewid) + { + $scope.EnableUI(); + if ($rootScope.isCallFromOtherModule) { + $rootScope.VideoLoadComplete = true; + } + $scope.JsPanelclick(windowviewid); + + } + + $scope.JsPanelclick = function (windowviewid) { + + //reset option list manager and annotation + //call when module loaded + $rootScope.resetMenuOption(); + // call from while open module in CB + $("#vidImagePanel_" + windowviewid).on('click', function (event) { + var pnlName = event.currentTarget.id; + $rootScope.resetMenuOptionOnClick(pnlName); + + }); + } + + }]); + + function videoOnLoad(event) { + + console.log('video loaded') + var scope = angular.element(document.getElementById("VideoView")).scope(); + // var len = (event.target.id).split("_").length; + var windowviewid = (event.target.id).split("_")[1]; + + scope.$apply(function () { + scope.videoOnLoad(windowviewid); + }); + } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js index 65e856f..04aabb5 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js @@ -91,6 +91,38 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } } } + + $scope.DisableUI = function () { + + var myImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < myImagePanelConetent.length; i++) { + myImagePanelConetent[i].style.pointerEvents = "none"; + myImagePanelConetent[i].style.opacity = "0.7"; + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + + // CB module disable all + $('#CBDetailPageDiv').css('pointer-events', 'none'); + $('#CBDetailPageDiv').css('opacity', '0.7'); + } + + $scope.EnableUI = function () { + + var myImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < myImagePanelConetent.length; i++) { + myImagePanelConetent[i].style.pointerEvents = "auto"; + myImagePanelConetent[i].style.opacity = "1"; + } + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + // CB module enable all + $('#CBDetailPageDiv').css('pointer-events', 'auto'); + $('#CBDetailPageDiv').css('opacity', '1'); + + } $scope.RemoveJSPanel = function (panelid) { @@ -104,7 +136,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (index != -1) { // remove module which one is loaded - $scope.PICWindowData.splice(index, 1); + $rootScope.PICWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); @@ -145,7 +177,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }); } - $rootScope.OpenMyPictureViewMain = function () { + $rootScope.OpenMyPictureViewMain = function () { + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.PicModuleData = ModuleService.getModuleData("MY_PICTURES"); $scope.readyToLoad = true; @@ -314,7 +347,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.LoadCBSavedAnnotation("canvasPIC_"+windowviewid,"canvasPaintPIC_"+windowviewid,annotationData); } } - + $scope.EnableUI(); $rootScope.PicLoadComplete = true; }); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index b277bf6..7e7ee6d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -415,7 +415,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou } $rootScope.openAAModuleItemMain = function () { - + $scope.DisableUI(); if ($rootScope.isCallFromOtherModule) { $scope.AAModuleData = ModuleService.getModuleData("ATLAS_ANATOMY"); $scope.readyToLoad=true; @@ -3294,7 +3294,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou if (index != -1) { // remove module which one is loaded - $scope.AAWindowData.splice(index, 1); + $rootScope.AAWindowData.splice(index, 1); if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/directives/AIADirectives.js b/400-SOURCECODE/AIAHTML5.Web/app/directives/AIADirectives.js index 5cd45d8..f5dac73 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/directives/AIADirectives.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/directives/AIADirectives.js @@ -53,4 +53,11 @@ AIA.directive('myPictureDirective', function (ModuleService) { templateUrl: 'app/views/MyPicture/MyPicture.html', } +}); +AIA.directive('myAnimationDirective', function (ModuleService) { + return { + //restrict: 'E', + templateUrl: 'app/views/MyAnimation/MyAnimation.html', + + } }); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 67ec89c..c6833c5 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -216,6 +216,13 @@ AIA.constant('pages', [ pageController: 'MyPictureController' }, + { //added for myanimation + name: 'MyAnimation', + pageSlug: 'my-animation', + pageUrl: 'app/views/MyAnimation/MyAnimation.html', + pageController: 'MyAnimationController' + + }, ]); @@ -535,7 +542,8 @@ AIA.constant("AIAConstants", { "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", "PLEASE_ENTER_SEARCH_TEXT": "Please enter the text to search.", "SETTINGS_SAVED": "Your current settings has been saved.", - "SETTING_SAVE_ERROR":"There is some error in saving your current settings. Please try after sometime." + "SETTING_SAVE_ERROR":"There is some error in saving your current settings. Please try after sometime.", + "SAVE_ANIMATION_ERROR":"There is some error while saving your animation. Please try after sometime." }) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index d803100..8e40571 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -1,4 +1,4 @@ -AIA.factory('AuthenticationService', function ($http, $q, $rootScope, LoginConstants) { +AIA.factory('AuthenticationService', function ($http, $q, $rootScope, LoginConstants, AIAConstants) { return { authenticateUser: function (userInfo) { var deferred = $q.defer(); @@ -64,7 +64,24 @@ }); return deferred.promise; }, + + saveAnimationVideo: function (vidData) { + var deferred = $q.defer(); + $http.post('/API/api/saveAnimationVideo', JSON.stringify(vidData), { + 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); + }); + return deferred.promise; + }, validateClientSite: function (clientInfo) { var deferred = $q.defer(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/ModuleService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/ModuleService.js index bf5a397..c999929 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/ModuleService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/ModuleService.js @@ -16,6 +16,7 @@ moduleDataObj.ThreeDData = []; moduleDataObj.AIData = []; moduleDataObj.LabData = []; moduleDataObj.PICData = []; +moduleDataObj.VideoData = []; AIA.service('ModuleService', function ($http, DataService) { return { @@ -153,6 +154,8 @@ AIA.service('ModuleService', function ($http, DataService) { return moduleDataObj.LabData; else if (moduleName == "MY_PICTURES") return moduleDataObj.PICData; + else if (moduleName == "MY_ANIMATIONS") + return moduleDataObj.VideoData; }, @@ -176,6 +179,23 @@ AIA.service('ModuleService', function ($http, DataService) { annotationData: windowData.annotationData }); } + else if (windowData.mType == "MY_ANIMATIONS") { + moduleDataObj.VideoData.push({ + currentWindowId: windowId, + mType: windowData.mType, + containsCapturedContent: windowData.containsCapturedContent, + anatomyTitle: windowData.windowTitle, + scrollPosition: windowData.scrollPosition, + imageId: windowData.imageId, + videoSource: windowData.videoSource, + maximised: windowData.maximised, + minimised: windowData.minimised, + id: windowData.id, + position: windowData.position, + size: windowData.size, + contextMenu: windowData.contextMenu + }); + } else if (windowData.mType == "LAB_EXERCISE") { moduleDataObj.LabData.push({ currentWindowId: windowId, @@ -350,6 +370,7 @@ AIA.service('ModuleService', function ($http, DataService) { moduleDataObj.AIData = []; moduleDataObj.LabData = []; moduleDataObj.PICData = []; + moduleDataObj.VideoData = []; }, ClearWinDataByModule: function (moduleName) { @@ -382,6 +403,9 @@ AIA.service('ModuleService', function ($http, DataService) { else if (moduleName == "MY_PICTURES") { moduleDataObj.PICData = []; } + else if (moduleName == "MY_ANIMATIONS") { + moduleDataObj.VideoData = []; + } }, diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/MyAnimation/MyAnimation.html b/400-SOURCECODE/AIAHTML5.Web/app/views/MyAnimation/MyAnimation.html new file mode 100644 index 0000000..596786a --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/MyAnimation/MyAnimation.html @@ -0,0 +1,9 @@ +
+
+
+ +
\ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html index 9135ce0..5bd4e09 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/widget/TopMenu.html @@ -5,7 +5,7 @@