From 672a1e70bb4936f9fda78e819b64137aa49d5f2f Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 24 Dec 2019 12:01:06 +0530 Subject: [PATCH] Fixed bugs of ADAM Images --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js | 370 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------ 400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js | 18 +++++++++++++++--- 2 files changed, 331 insertions(+), 57 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index ec7bb71..63cba73 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -125,6 +125,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.showItem(selectedImageId); $scope.filterstring = true; } + //$scope.ReloadListViewImageDiv(curSelectedRowId, ImageCount); } } else if (SearchByAlphabet != "" && SearchByAlphabet != null && SearchByAlphabet != undefined) { @@ -139,6 +140,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.showItem(selectedImageId); $scope.filterstring = true; } + //$scope.ReloadListViewImageDiv(curSelectedRowId, ImageCount); } } else { @@ -155,9 +157,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.filterstring = false; $scope.showItem(selectedImageId); } + //$scope.ReloadListViewImageDiv(curSelectedRowId, ImageCount); } } $scope.query.SelectedDiv = tabToSet; + //Method call for set position for selected title Bug-57978 + //$scope.ReloadListViewImageDiv(curSelectedRowId, ImageCount); + $('#grid-view').css("display", "none"); + $('#list-view').css("display", "block"); } else { $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); @@ -175,12 +182,69 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.loadAllAI(ImageCount); } + $('#grid-view').css("display", "block"); + $('#list-view').css("display", "none"); } + + setTimeout(function () { + $scope.setImgPosition(); + }, 100); + }; - $scope.loadAIModuleById = function (moduleId) { + //$scope.loadAIModuleById = function (moduleId) { + // var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); + + // if ($rootScope.refreshcheck == null) { + // $location.path('/'); + // } + + // // code that will be executed ... + // // every time this view is loaded + + // //get current path + // var currentURL = $location.path(); + // var selectedModuleName = ''; + // //set module title + // angular.forEach($rootScope.userModules, function (value, key) { + // if (value.slug === currentURL.replace('/', '')) { + // selectedModuleName = value.name; + // } + // $rootScope.currentActiveModuleTitle = selectedModuleName; + // }) + + // $scope.LoadAIJsonData(ImageCount); + // $scope.scroll(); + // //push the details of open module in array $rootScope.openModules + // $rootScope.openModules.push({ "ModuleId": 13 }); + + // //set the local storage + // var curtab = $rootScope.getLocalStorageValue("currentAITabView"); + // var inderectCall = true; + // if (curtab == 2) { + // $scope.setActiveTab(2, inderectCall); + // var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); + // if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { + // $scope.reRunSearchOnLoad(); + // $scope.idSelected = curSelectedRowId; + // $scope.ReloadListViewImageDiv($scope.idSelected, ImageCount); + // } + // else { + // $scope.reRunSearchOnLoad() + // $scope.idSelected = ''; + // } + // } + // else { + // $scope.setActiveTab(1, inderectCall); + // $scope.reRunSearchOnLoad(); + + // } + //} + + $scope.loadAIModuleById = function (moduleId) { + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); if ($rootScope.refreshcheck == null) { @@ -207,7 +271,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.openModules.push({ "ModuleId": 13 }); //set the local storage - var curtab = $rootScope.getLocalStorageValue("currentAITabView"); + var curtab = $rootScope.getLocalStorageValue("currentAITabView"); var inderectCall = true; if (curtab == 2) { $scope.setActiveTab(2, inderectCall); @@ -220,13 +284,47 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout else { $scope.reRunSearchOnLoad() $scope.idSelected = ''; - } + } } else { $scope.setActiveTab(1, inderectCall); $scope.reRunSearchOnLoad(); - } + + //setTimeout(function () { + // $scope.setImgPosition(); + //}, 100); + + + //setTimeout(function () { + // if ($('#grid-view').css("display") == "block") { + // if ($rootScope.getLocalStorageValue('AIGridViewHighlightThumbnail') !== null) { + // $('#' + $rootScope.getLocalStorageValue("AIGridViewHighlightThumbnail")).find('.thumbnail').addClass('HightLightThumbnail'); + // } + // if ($rootScope.getLocalStorageValue('AIGridViewScroll') !== null && $location.url() == "/tile-view-list") { + + // $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }, 'slow'); + + // } + // } + // if ($('#list-view').css("display") == "block") { + // var AIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScroll"); + // if (typeof (AIListViewScroll) !== "undefined" && AIListViewScroll !== null && AIListViewScroll !== '' && $location.url() == "/tile-view-list") { + // if (typeof InstallTrigger !== 'undefined') { + + // $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue('AIListViewScroll') }, 'slow'); + // } + // else { + + // $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue('AIListViewScroll') }, 'slow'); + // } + // $("#list-view table tbody tr").removeClass("active"); + // $("#list-view table tbody #" + $rootScope.getLocalStorageValue("listViewSelectedID")).addClass("active"); + // } + // } + //}, 100); + + //$('#list-view').css('display', 'none'); } $scope.reRunSearchOnLoad = function () { @@ -307,6 +405,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if ($rootScope.getLocalStorageValue('AIGridViewScroll') !== null && $location.url() == "/ADAM-images" && $scope.query.SelectedDiv == 1) { $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }); } + }, 100); $rootScope.isLoading = false; @@ -507,6 +606,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } setTimeout(function () { + //$scope.setImgPosition(); $scope.EnableUI(); }, 10); @@ -514,14 +614,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.isLoading = false; $('#aiSpinner').css('visibility', 'hidden'); - //Added code by sandeep for fixed bug-40273 - var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId"); - $rootScope.getLocalStorageValue("currentAIImageId") - if (_currentImgId != "null" && _currentImgId != null) { - $('#' + _currentImgId).find('.thumbnail').addClass('HightLightThumbnail'); - $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); - $scope.hiderow = true; - } + //Added code by sandeep for fixed bug-40273 + //setTimeout(function () { + // $scope.setImgPosition(); + //}, 10); + }, function (error) { @@ -530,6 +627,38 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } ); } + + //Added method by sandeep for fixed Bug-57978 to selected Image + $scope.setImgPosition = function () { + var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId"); + if (_currentImgId != "null" && _currentImgId != null) { + $('#' + _currentImgId).find('.thumbnail').addClass('HightLightThumbnail'); + //$('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); + $scope.hiderow = true; + } + if ($('#grid-view').css("display") == "block") { + var aiGridViewScroll = $rootScope.getLocalStorageValue('AIGridViewScroll'); + if (aiGridViewScroll !== null && $location.url() == "/ADAM-images" && aiGridViewScroll != "0") { + + $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }, 'slow'); + } + else if (_currentImgId != "null" && _currentImgId != null) { + $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); + } + } + if ($('#list-view').css("display") == "block") { + var AIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScrollPosition"); + if (AIListViewScroll !== null && $location.url() == "/ADAM-images" && AIListViewScroll != "0") { + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue('AIListViewScrollPosition') }, 'slow'); + } + else if (_currentImgId != "null" && _currentImgId != null) { + $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); + } + //$("#list-view table tbody tr").removeClass("active"); + //$("#list-view table tbody #" + $rootScope.getLocalStorageValue("listViewSelectedID")).addClass("active"); + } + } + $scope.DisableUI = function () { $('#imgParent').css('z-index', '1'); @@ -624,18 +753,16 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } setTimeout(function () { + //$scope.setImgPosition(); $scope.EnableUI(); }, 10); $rootScope.isLoading = false; $('#aiSpinner').css('visibility', 'hidden'); //Added code by sandeep for fixed bug-40273 - var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId"); - if (_currentImgId != "null" && _currentImgId != null) { - $('#' + _currentImgId).find('.thumbnail').addClass('HightLightThumbnail'); - $('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); - hiderow = true; - } + //setTimeout(function () { + // $scope.setImgPosition(); + //}, 10); }, function (error) { console.log(' $scope.IllustrationData = ' + error.statusText); @@ -671,13 +798,135 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout localStorage.setItem("currentImageTitleFromJson", $rootScope.ViewTitle); localStorage.setItem("currentAIImageId", $event.currentTarget.id); + var moduleItemDataToBeSavedID = $event.currentTarget.id; + $("#list-view table tbody tr").removeClass("active"); + localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID); + $("#list-view table tbody #" + moduleItemDataToBeSavedID).addClass("active"); + localStorage.setItem("AIListViewScrollPosition", $("#list-view table tbody").scrollTop()); + //Set the vertical scroll value of the Grid-View. var y = $($window).scrollTop(); localStorage.setItem("AIGridViewScroll", y); + localStorage.setItem("AIGridViewHighlightThumbnail", $(event.target).parent().parent().parent().attr('id')); var u = $location.url(); $location.url('/adam-images-detail'); } + //$scope.OpenAdamImageView = function () { + + // // $rootScope.currentActiveModuleTitle = "A.D.A.M. Images"; + + // if ($rootScope.refreshcheck == null) { + // $location.path('/'); + // } + // $rootScope.isLoading = true; + // $('#aiSpinner').css('visibility', 'visible'); + // //$scope.DisableUI(); + // $scope.voId = $rootScope.getLocalStorageValue("currentAIImageId"); + + // var counter = 1; + // var tittle = $rootScope.getLocalStorageValue("currentImageTitleFromJson"); + // localStorage.setItem("currentViewTitle", tittle); + + // var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') + // promise.then( + // function (result) { + // $scope.AIllustrationData = result; + // $scope.AIlistViewData = $scope.AIllustrationData.root.AIData; + + // var clickedAIImage = []; + // clickedAIImage = new jinqJs() + // .from($scope.AIlistViewData) + // .where('_id == ' + $scope.voId) + // .select('_contentImage'); + + // $scope.clickedAIImage = "~/../content/images/ai/images/" + clickedAIImage[0]._contentImage; + + // // store image for export + // var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + // $rootScope.StoreTitleName(tittle); + // $rootScope.StoreOrgImageName(clickedAIImage[0]._contentImage); + + // if (clickedAIImage.length > 0) { + + // $.jsPanel({ + // id: 'aiImagePanel', + // selector: '.aiView', + // theme: 'success', + // currentController: 'AIController', + // parentSlug: 'ADAM-images', + // content: '
' + + + // '' + + // '
' + + // '
', + // //ajax: { + // // url: 'app/views/ci/ci-view-detail.html' + // //}, + // title: $rootScope.getLocalStorageValue("currentViewTitle"), + // position: { + // top: 70, + // left: 15, + // }, + + // size: { width: $(window).outerWidth() - 30, height: $(window).outerHeight() - 125 }, + + // }); + + // $('#canvasDiv img').load(function () { + + // $rootScope.isLoading = false; + // $('#aiSpinner').css('visibility', 'hidden'); + // var canvas = document.getElementById("canvas"); + // var canvasPaint = document.getElementById("canvasPaint"); + + // var imageheight = $("#aimage").height(); + // var canvasDivheight = $(window).outerHeight() - 150; + + // if (canvasDivheight > imageheight) + // { + // canvas.height = canvasDivheight; + // canvasPaint.height = canvasDivheight; + // } + // else + // { + // canvas.height = imageheight; + // canvasPaint.height = imageheight; + // } + + // canvas.width = $(window).outerWidth() - 81; + // canvasPaint.width = $(window).outerWidth() - 81; + + // }); + // $rootScope.currentSlug = 'adam-images-detail'; + // $rootScope.openViews.push( + // { + // "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentAIImageId, + // "slug": $rootScope.currentSlug + // }); + + // $("#aiImagePanel .img-thumbnail").css("min-height", $("#aiImagePanel .jsPanel-content").height()); + // $('.jsPanel-content .jsPanel-theme-success').css('overflow-y', 'auto !important') + // var jspContentHeight = $('.jsPanel-content').height(); + + // // console.log($rootScope.OpenAdamImages); + // $('#AIView').css("height", $(window).outerHeight() - 65); + + // $('#AIView').css("width", $(window).outerWidth() - 15); + + // var canvasDIvHeight = parseInt($('#aiImagePanel').outerHeight()) - 90; + + // $('#canvasDiv').css('height', canvasDIvHeight); + // } + // }, + // function (error) { + // // handle errors here + // console.log(' $scope.AIllustrationData = ' + error.statusText); + // } + // ); + + //} + $scope.OpenAdamImageView = function () { // $rootScope.currentActiveModuleTitle = "A.D.A.M. Images"; @@ -721,11 +970,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout theme: 'success', currentController: 'AIController', parentSlug: 'ADAM-images', - content: '
' + - - '' + - '
' + - '
', + content: '
' + + '
' + + '' + + + '
', //ajax: { // url: 'app/views/ci/ci-view-detail.html' //}, @@ -739,30 +988,37 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }); - $('#canvasDiv img').load(function () { + //$('#canvasDiv img').load(function () { - $rootScope.isLoading = false; - $('#aiSpinner').css('visibility', 'hidden'); - var canvas = document.getElementById("canvas"); - var canvasPaint = document.getElementById("canvasPaint"); + // $rootScope.isLoading = false; + // $('#aiSpinner').css('visibility', 'hidden'); + // var canvas = document.getElementById("canvas"); + // var canvasPaint = document.getElementById("canvasPaint"); - var imageheight = $("#aimage").height(); - var canvasDivheight = $(window).outerHeight() - 150; - - if (canvasDivheight > imageheight) - { - canvas.height = canvasDivheight; - canvasPaint.height = canvasDivheight; - } - else - { - canvas.height = imageheight; - canvasPaint.height = imageheight; - } + // var imageheight = $("#aimage").height(); + // var canvasDivheight = $(window).outerHeight() - 150; - canvas.width = $(window).outerWidth() - 81; - canvasPaint.width = $(window).outerWidth() - 81; - + // if (canvasDivheight > imageheight) { + // canvas.height = canvasDivheight; + // canvasPaint.height = canvasDivheight; + // } + // else { + // canvas.height = imageheight; + // canvasPaint.height = imageheight; + // } + + // canvas.width = $(window).outerWidth() - 81; + // canvasPaint.width = $(window).outerWidth() - 81; + + //}); + $('#canvasDiv img').load(function () { + $rootScope.isLoading = false; + $('#aiSpinner').css('visibility', 'hidden'); + var canvas = document.getElementById("canvas"); + var canvasPaint = document.getElementById("canvasPaint"); + + canvas.height = $("#aiImagePanel .jsPanel-content").height(); + canvasPaint.height = $("#aiImagePanel .jsPanel-content").height(); }); $rootScope.currentSlug = 'adam-images-detail'; $rootScope.openViews.push( @@ -780,7 +1036,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#AIView').css("width", $(window).outerWidth() - 15); - var canvasDIvHeight = parseInt($('#aiImagePanel').outerHeight()) - 90; + //var canvasDIvHeight = parseInt($('#aiImagePanel').outerHeight()) - 30; + var canvasDIvHeight = $("#aiImagePanel .jsPanel-content").height(); $('#canvasDiv').css('height', canvasDIvHeight); } @@ -835,15 +1092,20 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //Set the scroll position of the tablebody to show selected row. - var curAIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScroll"); - if (typeof (curAIListViewScroll) !== "undefined" && curAIListViewScroll !== null && curAIListViewScroll !== '') { - if (typeof InstallTrigger !== 'undefined') { - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("AIListViewScroll") }); - } - else { - $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("AIListViewScroll")); - } - } + //var curAIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScrollPosition"); + ////var _currentImgId = $rootScope.getLocalStorageValue("currentAIImageId"); + //if (typeof (curAIListViewScroll) !== "undefined" && curAIListViewScroll !== null && curAIListViewScroll !== "null") { + + // $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue('AIListViewScrollPosition') }, 'slow'); + // //$('html, body').animate({ scrollTop: $('#' + _currentImgId).position().top }, 100); + //} + //else { + // //$('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("currentImageTitleFromJson")); + // $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue('AIListViewScrollPosition') }, 'slow'); + //} + $scope.setImgPosition(); + + $rootScope.isLoading = false; $('#aiSpinner').css('visibility', 'hidden'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index 6445b97..ec61131 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -45,9 +45,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('#' + id).remove(); // remove panel name from dropdown - $('#viwerSelect option[value="'+id+'"]').remove(); + $('#viwerSelect option[value="' + id + '"]').remove(); + + } + //Added code by sandeep for fixed Bug-58066 + var ddlViewerLen = $("#viwerSelect option").length; + if (ddlViewerLen == 1) { + $('#viwerSelect').hide(); } - }); @@ -599,7 +604,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('#CBSourceImagePanel').remove(); $("#viwerSelect").empty(); - + $("#viwerSelect").hide(); if ($('#parentcustomDiv').html() != "") { $('#parentcustomDiv').empty(); } @@ -1329,6 +1334,13 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']"); if (modulePanel != undefined && modulePanel != null) { $('#viwerSelect').append(''); + //Added code by sandeep for fixed Bug-58066 + if (modulePanel.length > 0) { + $('#viwerSelect').show(); + } + } + else { + $('#viwerSelect').hide(); } for (var i = 0 ; i < modulePanel.length; i++) { var paneld = modulePanel[i].id; -- libgit2 0.21.4