diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index 38990b7..28bcf8f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -17,16 +17,103 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout SearchTextByAlphabet: '', }; + $(document).ready(function () { + $timeout(function () { + var Count = 200; + localStorage.setItem("ImageCount", Count); + var searchByText = $rootScope.getLocalStorageValue("SearchText"); + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); + $("#ListViewDiv").on('scroll', function () { + if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) { + Count += 100; + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { + $scope.query.SearchText = searchByText; + } + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { + $scope.query.SearchTextByAlphabet = searchTextByAlphabet; + } + else { + $scope.query.SearchTextByAlphabet = ""; + } + + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { + + $scope.LoadAIJsonData(Count); + $scope.loadAllAI(Count); + } + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); + } + else { + $scope.ApplySearch($scope.query); + } + } + }); + }, 10); + }); + + $(document).ready(function () { + var Count = 200; + localStorage.setItem("ImageCount", Count); + var searchByText = $rootScope.getLocalStorageValue("SearchText"); + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); + $(window).scroll(function () { + if ($(window).scrollTop() == $(document).height() - $(window).height()) { + Count += 100; + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { + $scope.query.SearchText = searchByText; + } + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { + $scope.query.SearchTextByAlphabet = searchTextByAlphabet; + } + else { + $scope.query.SearchTextByAlphabet = ""; + } + + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { + + $scope.LoadAIJsonData(Count); + $scope.loadAllAI(Count); + } + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet ); + } + else { + $scope.ApplySearch($scope.query); + } + } + }); + + }); + $scope.setActiveTab = function (tabToSet) { $scope.activeTab = tabToSet; localStorage.setItem("currentAITabView", $scope.activeTab); + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); + if (tabToSet == 2) { + var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); + $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).addClass("selected"); + $scope.idSelected = $rootScope.getLocalStorageValue("currentAIImageId"); + var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId"); + $scope.ReloadListViewImageDiv(selectedImageId, ImageCount); + } + else { + $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); + $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).removeClass('selected'); + $scope.loadAllAI(ImageCount); + } }; $scope.$on('$viewContentLoaded', function (event) { + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); + if ($rootScope.refreshcheck == null) { $location.path('/'); } + // code that will be executed ... // every time this view is loaded @@ -41,7 +128,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.currentActiveModuleTitle = selectedModuleName; }) - $scope.LoadAIJsonData(); + $scope.LoadAIJsonData(ImageCount); $scope.scroll(); //push the details of open module in array $rootScope.openModules $rootScope.openModules.push({ "ModuleId": 13 }); @@ -49,13 +136,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //set the local storage var curtab = $rootScope.getLocalStorageValue("currentAITabView"); - if (curtab == 2) { + if (curtab == 2) { $scope.setActiveTab(2); var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { $scope.reRunSearchOnLoad(); $scope.idSelected = curSelectedRowId; - $scope.ReloadListViewImageDiv($scope.idSelected); + $scope.ReloadListViewImageDiv($scope.idSelected, ImageCount); } else { $scope.reRunSearchOnLoad() @@ -73,6 +160,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var searchByText = $rootScope.getLocalStorageValue("SearchText"); var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { $scope.query.SearchText = searchByText; @@ -86,7 +174,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { - $scope.loadAllAI(); + $scope.loadAllAI(ImageCount); } else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); @@ -97,8 +185,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } - $scope.LoadAIJsonData = function () { - $('ul li a').removeAttr("style"); + $scope.LoadAIJsonData = function (ImageCount) { + $('ul li span').removeAttr("style"); var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') promise.then( function (result) { @@ -106,7 +194,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.selectedAIListViewData = new jinqJs() .from($scope.IllustrationData.root.AIData) .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); + .select().slice(0, ImageCount); }, function (error) { @@ -118,13 +206,17 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }; - $scope.loadAllAI = function () { + $scope.loadAllAI = function (ImageCount) { $rootScope.isLoading = true; localStorage.setItem("SearchText", ''); localStorage.setItem("SearchByAlphabet", ''); - $('ul li a').removeAttr("style"); + $('ul li span').removeAttr("style"); $('#aiSpinner').css('visibility', 'visible'); $('#aiSpinner').css('zIndex', '20000'); + if ($location.url() == "/ADAM-images") + { + $scope.DisableUI(); + } var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') promise.then( function (result) { @@ -133,7 +225,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.selectedAIListViewData = new jinqJs() .from($scope.IllustrationData.root.AIData) .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); + .select().slice(0,ImageCount); //console.log($scope.selectedAIListViewData); @@ -149,12 +241,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $timeout(function () { $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); if ($rootScope.getLocalStorageValue('AIGridViewScroll') !== null && $location.url() == "/ADAM-images") { - $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }); + //$('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AIGridViewScroll') }); } }, 100); $rootScope.isLoading = false; $('#aiSpinner').css('visibility', 'hidden'); + if ($location.url() == "/ADAM-images") { + setTimeout(function () { + $scope.EnableUI(); + }, 10); + } + }, function (error) { @@ -177,7 +275,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //Set the vertical scroll value of the table. var y = $('#ListViewDiv').scrollTop(); localStorage.setItem("AIListViewScroll", y); - + //$('#' + id).find('.thumbnail').addClass('HightLightThumbnail'); + localStorage.setItem("currentAIImageId", id); $scope.hiderow = true; if ($scope.filterstring == false) { @@ -206,20 +305,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title; } + } }; $scope.Reset = function (query) { - $('ul li a').removeAttr("style"); + $('ul li span').removeAttr("style"); query.SearchText = ""; - - - //set localstorage values localStorage.setItem("SearchText", ''); localStorage.setItem("SearchByAlphabet", ''); localStorage.setItem("AIListViewScroll", ''); - + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } $('#ListViewDiv').scrollTop(0); @@ -230,11 +327,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout while ($scope.searchAIListViewData.length) { $scope.searchAIListViewData.pop(); } - $scope.loadAllAI(); + $scope.loadAllAI(ImageCount); } $scope.ApplySearch = function (query) { - $('ul li a').removeAttr("style"); + $('ul li span').removeAttr("style"); var currentSearchtext = $rootScope.getLocalStorageValue("SearchText"); localStorage.setItem("SearchText", ''); if (currentSearchtext == "undefined" || (currentSearchtext == null || currentSearchtext == "")) { @@ -247,29 +344,22 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - + $('#aiSpinner').css('visibility', 'visible'); + $scope.DisableUI(); $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); - $scope.filterstring = true; - while ($scope.searchAIListViewData.length) { - $scope.searchAIListViewData.pop(); - } - - - + //while ($scope.searchAIListViewData.length) { + // $scope.searchAIListViewData.pop(); + //} if (typeof (query.SearchText) !== "undefined" && (query.SearchText !== null && query.SearchText !== "")) { - localStorage.setItem("SearchText", query.SearchText); - } else { localStorage.setItem("SearchText", ''); - } var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') @@ -294,13 +384,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (posbodyregion > -1) { selectimg = true; //count = count + 1; - } else { selectimg = false; //count = count - 1; } - } if (selectimg === true) { @@ -421,12 +509,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $compile($el)($scope); - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - + //$(".sidebar").mCustomScrollbar({ + // autoHideScrollbar: true, + // //theme:"rounded" + //}); $scope.searchAIListViewData.push( { "_id": value._id, @@ -434,8 +520,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout "_Title": value._Title, "_contentImage": value._contentImage, "_ThumbnailImage": value._ThumbnailImage, - - }); } }); @@ -447,9 +531,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('table > #ListViewDiv > #searchItem').remove(); $('#ListViewDiv').append('No illustration found for the selected search criteria!'); + localStorage.setItem("SearchText", ''); } $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + $('#aiSpinner').css('visibility', 'hidden'); + setTimeout(function () { + $scope.EnableUI(); + }, 10); }, function (error) { @@ -458,25 +546,27 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } ); } + $scope.DisableUI = function () { + + $('#imgParent').css('z-index', '1'); + document.getElementById("imgParent").style.pointerEvents = "none"; + document.getElementById("imgParent").style.opacity = "0.5"; + } + $scope.EnableUI = function () { + document.getElementById("imgParent").style.pointerEvents = "auto"; + document.getElementById("imgParent").style.opacity = "1.0"; + } - + $scope.counter = 1; $scope.ApplySearchByAlphabet = function (SearchTextByAlphabet) { - $rootScope.SearchTextByAlphabet = SearchTextByAlphabet $rootScope.isLoading = true; - $('ul li a').removeAttr("style"); - $('#spinner').css('visibility', 'visible'); + $('#aiSpinner').css('visibility', 'visible'); + $scope.DisableUI(); + $('ul li span').removeAttr("style"); $('#' + $rootScope.SearchTextByAlphabet).css({ "color": "white", "background-color": "#1B92D0" }); - - //color: #0095da; - //background-color: #ffffff; - $scope.filterstring = true; - - while ($scope.searchAIListViewData.length) { - $scope.searchAIListViewData.pop(); - } if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { localStorage.setItem("SearchByAlphabet", SearchTextByAlphabet); } @@ -491,8 +581,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.selectedAIListViewData = new jinqJs() .from($scope.IllustrationData.root.AIData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); + .orderBy([{ field: '_Title', sort: 'asc' }]).select(); $('#grid-view').empty(); @@ -512,20 +601,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (selectimg === true) { $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; - var $el = $('
' + var $el = $('
' + '
' + '' + '

' + value._Title + '

').appendTo('#grid-view'); $compile($el)($scope); - - - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - $scope.searchAIListViewData.push( { "_id": value._id, @@ -533,10 +614,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout "_Title": value._Title, "_contentImage": value._contentImage, "_ThumbnailImage": value._ThumbnailImage, - - }); } + }); $('table > #ListViewDiv > #searchItem').remove(); //Show Error Message in case of gridview if no data is found @@ -548,18 +628,23 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#ListViewDiv').append('No illustration found for the selected search criteria!'); } $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + setTimeout(function () { + $scope.EnableUI(); + }, 10); }, function (error) { console.log(' $scope.IllustrationData = ' + error.statusText); } + ); + + } $scope.scroll = function () { - $("html,body").scrollTop(0); + //$("html,body").scrollTop(0); } @@ -597,9 +682,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if ($rootScope.refreshcheck == null) { $location.path('/'); } - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); + $('#aiSpinner').css('visibility', 'visible'); + //$scope.DisableUI(); $scope.voId = $rootScope.getLocalStorageValue("currentAIImageId"); var counter = 1; @@ -619,17 +704,19 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout .select('_contentImage'); $scope.clickedAIImage = "~/../content/images/ai/images/" + clickedAIImage[0]._contentImage; + if (clickedAIImage.length > 0) { + $.jsPanel({ id: 'aiImagePanel', selector: '.aiView', theme: 'success', currentController: 'AIController', parentSlug: 'ADAM-images', - content: '
' + + content: '
' + '
' + '' + - '
' + + '
' + '
', //ajax: { // url: 'app/views/ci/ci-view-detail.html' @@ -637,49 +724,47 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout title: $rootScope.getLocalStorageValue("currentViewTitle"), position: { top: 70, - left: 20, + left: 20, }, size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 110 }, }); - $('#canvasDiv img').load(function () { - + $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + $('#aiSpinner').css('visibility', 'hidden'); + var canvas = document.getElementById("canvas"); + var canvasPaint = document.getElementById("canvasPaint"); + canvas.height = $(".img-thumbnail").height(); + canvasPaint.height = $(".img-thumbnail").height(); }); - $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("height", $("#aiImagePanel .jsPanel-content").height()); + + $("#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(); + + + } - - }, function (error) { // handle errors here console.log(' $scope.AIllustrationData = ' + error.statusText); } - ); - // console.log($rootScope.OpenAdamImages); $('#AIView').css("height", $(window).outerHeight()); - $('#AIView').css("width", $(window).outerWidth()); - + $('#AIView').css("width", $(window).outerWidth()); } $scope.$on('annotationToolEvent', function (event, data) { @@ -691,15 +776,19 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $("#canvas").css("display", "block"); $("#canvasPaint").css("display", "block"); - + $rootScope.onDrawingCanvasClick(); $rootScope.FreeStylePaint(); }); - $scope.ReloadListViewImageDiv = function (id) { + $scope.ReloadListViewImageDiv = function (id,imgCount) { //console.log(id); $scope.idSelected = id; $scope.hiderow = true; + $rootScope.isLoading = true; + $('#aiSpinner').css('visibility', 'visible'); + $('#aiSpinner').css('zIndex', '20000'); + //$scope.DisableUI(); var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') promise.then( @@ -710,7 +799,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout SelectedAIthumbImage = new jinqJs() .from($scope.IllustrationData.root.AIData) .where('_id = ' + id) - .select('_ThumbnailImage', '_id', '_Title'); + .select('_ThumbnailImage', '_id', '_Title').slice(0, imgCount); $scope.SelectedAIthumbImage = "~/../content/images/ai/thumbnails/" + SelectedAIthumbImage[0]._ThumbnailImage; $scope.SelectedAIId = SelectedAIthumbImage[0]._id; @@ -721,16 +810,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var curAIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScroll"); if (typeof (curAIListViewScroll) !== "undefined" && curAIListViewScroll !== null && curAIListViewScroll !== '') { if (typeof InstallTrigger !== 'undefined') { - - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("AIListViewScroll") }); + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("AIListViewScroll") }); } else { - $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("AIListViewScroll")); } } - + $rootScope.isLoading = false; + $('#aiSpinner').css('visibility', 'hidden'); + //setTimeout(function () { + // $scope.EnableUI(); + //}, 10); }, function (error) { // handle errors here @@ -746,9 +837,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.hiderow = false; } } - - - }] ); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index cd703b3..2d4dad6 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -1351,7 +1351,8 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A if (alreadyOpenThisView != null) { for (var i = 0; i < $rootScope.openViews.length; i++) { k++; - if ($rootScope.openViews[i].body - views == title) { + //if ($rootScope.openViews[i].body - views == title) { + if ($rootScope.openViews[i].body-views == title) { $rootScope.openViews.splice((k - 1), 1); $rootScope.openViews.push( @@ -5426,7 +5427,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A OpenJSPanel(); // open jsPanel here if ($('#jsPanel-1').length > 0) { - $('.jsPanel-btn-norm').attr('style', 'display: none'); + $('.jsPanel-btn-norm').attr('style', 'display: block'); } console.log('jsPanel loaded exist= ' + document.getElementById('jsPanel-1')); // document.getElementsByClassName('ppImagePanel')); @@ -5596,18 +5597,23 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A ResizeImage(0); } }); - - $(document).on('click', '#btnPrint', function () { + + $(document).one('click', '#btnPrint', function () { + PrintDivContentByID('printBoxPor'); + this.stopPropagation(); + }); - + function PrintDivContentByID(id) { - if (id == 'printBoxPor') { $("#printPSOptions").val("100%"); ResizeImage(1); } - var contents = document.getElementById(id).innerHTML; + var contents; + $(document).ready(function () { + contents = document.getElementById(id).innerHTML; + }); // code for printng in ipads var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html index 5b8c60a..574d5f6 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/ai/ai-view.html @@ -1,6 +1,6 @@ 
-
-
+
+
+
@@ -73,7 +76,7 @@ {{item._Title}} - +
@@ -94,8 +97,8 @@
-