Commit f6baf974af9bcdeaf38d753a5a366c4560ede8cc
1 parent
23c5c78b
added correct code
Showing
1 changed file
with
70 additions
and
181 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
... | ... | @@ -18,39 +18,39 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
18 | 18 | }; |
19 | 19 | |
20 | 20 | $(document).ready(function () { |
21 | - $timeout(function () { | |
22 | - var Count = 200; | |
23 | - localStorage.setItem("ImageCount", Count); | |
24 | - var searchByText = $rootScope.getLocalStorageValue("SearchText"); | |
25 | - var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); | |
26 | - $("#ListViewDiv").on('scroll', function () { | |
27 | - if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) { | |
28 | - Count += 100; | |
29 | - var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
30 | - if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { | |
31 | - $scope.query.SearchText = searchByText; | |
32 | - } | |
33 | - else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { | |
34 | - $scope.query.SearchTextByAlphabet = searchTextByAlphabet; | |
35 | - } | |
36 | - else { | |
37 | - $scope.query.SearchTextByAlphabet = ""; | |
38 | - } | |
39 | - | |
40 | - if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { | |
41 | - | |
42 | - $scope.LoadAIJsonData(Count); | |
43 | - $scope.loadAllAI(Count); | |
44 | - } | |
45 | - else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { | |
46 | - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); | |
47 | - } | |
48 | - else { | |
49 | - $scope.ApplySearch($scope.query); | |
50 | - } | |
21 | + $timeout(function () { | |
22 | + var Count = 200; | |
23 | + localStorage.setItem("ImageCount", Count); | |
24 | + var searchByText = $rootScope.getLocalStorageValue("SearchText"); | |
25 | + var searchTextByAlphabet = $rootScope.getLocalStorageValue("SearchByAlphabet"); | |
26 | + $("#ListViewDiv").on('scroll', function () { | |
27 | + if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight - 10) { | |
28 | + Count += 100; | |
29 | + var ImageCount = $rootScope.getLocalStorageValue("ImageCount"); | |
30 | + if (typeof (searchByText) !== "undefined" && searchByText !== null && searchByText !== '') { | |
31 | + $scope.query.SearchText = searchByText; | |
51 | 32 | } |
52 | - }); | |
53 | - }, 10); | |
33 | + else if (typeof (searchTextByAlphabet) !== "undefined" && searchTextByAlphabet !== null && searchTextByAlphabet !== '') { | |
34 | + $scope.query.SearchTextByAlphabet = searchTextByAlphabet; | |
35 | + } | |
36 | + else { | |
37 | + $scope.query.SearchTextByAlphabet = ""; | |
38 | + } | |
39 | + | |
40 | + if ($scope.query.SearchText == "" && $scope.query.SearchTextByAlphabet == "") { | |
41 | + | |
42 | + $scope.LoadAIJsonData(Count); | |
43 | + $scope.loadAllAI(Count); | |
44 | + } | |
45 | + else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { | |
46 | + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); | |
47 | + } | |
48 | + else { | |
49 | + $scope.ApplySearch($scope.query); | |
50 | + } | |
51 | + } | |
52 | + }); | |
53 | + }, 10); | |
54 | 54 | }); |
55 | 55 | |
56 | 56 | $(document).ready(function () { |
... | ... | @@ -78,14 +78,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
78 | 78 | $scope.loadAllAI(Count); |
79 | 79 | } |
80 | 80 | else if ($scope.query.SearchTextByAlphabet != "" || $scope.query.SearchText == "") { |
81 | - $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet ); | |
81 | + $scope.ApplySearchByAlphabet($scope.query.SearchTextByAlphabet); | |
82 | 82 | } |
83 | 83 | else { |
84 | 84 | $scope.ApplySearch($scope.query); |
85 | - } | |
85 | + } | |
86 | 86 | } |
87 | 87 | }); |
88 | - | |
88 | + | |
89 | 89 | }); |
90 | 90 | |
91 | 91 | $scope.setActiveTab = function (tabToSet) { |
... | ... | @@ -99,7 +99,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
99 | 99 | var selectedImageId = $rootScope.getLocalStorageValue("currentAIImageId"); |
100 | 100 | $scope.ReloadListViewImageDiv(selectedImageId, ImageCount); |
101 | 101 | } |
102 | - else { | |
102 | + else { | |
103 | 103 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).find('.thumbnail').addClass('HightLightThumbnail'); |
104 | 104 | $('#' + $rootScope.getLocalStorageValue("currentAIImageId")).removeClass('selected'); |
105 | 105 | $scope.loadAllAI(ImageCount); |
... | ... | @@ -136,7 +136,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
136 | 136 | //set the local storage |
137 | 137 | |
138 | 138 | var curtab = $rootScope.getLocalStorageValue("currentAITabView"); |
139 | - if (curtab == 2) { | |
139 | + if (curtab == 2) { | |
140 | 140 | $scope.setActiveTab(2); |
141 | 141 | var curSelectedRowId = $rootScope.getLocalStorageValue("AISelectedRowId"); |
142 | 142 | if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { |
... | ... | @@ -213,8 +213,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
213 | 213 | $('ul li span').removeAttr("style"); |
214 | 214 | $('#aiSpinner').css('visibility', 'visible'); |
215 | 215 | $('#aiSpinner').css('zIndex', '20000'); |
216 | - if ($location.url() == "/ADAM-images") | |
217 | - { | |
216 | + if ($location.url() == "/ADAM-images") { | |
218 | 217 | $scope.DisableUI(); |
219 | 218 | } |
220 | 219 | var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') |
... | ... | @@ -225,7 +224,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
225 | 224 | $scope.selectedAIListViewData = new jinqJs() |
226 | 225 | .from($scope.IllustrationData.root.AIData) |
227 | 226 | .orderBy([{ field: '_Title', sort: 'asc' }]) |
228 | - .select().slice(0,ImageCount); | |
227 | + .select().slice(0, ImageCount); | |
229 | 228 | |
230 | 229 | //console.log($scope.selectedAIListViewData); |
231 | 230 | |
... | ... | @@ -252,7 +251,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
252 | 251 | $scope.EnableUI(); |
253 | 252 | }, 10); |
254 | 253 | } |
255 | - | |
254 | + | |
256 | 255 | |
257 | 256 | }, |
258 | 257 | function (error) { |
... | ... | @@ -305,7 +304,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
305 | 304 | $scope.SelectedAITitle = SelectedAIthumbImage[0]._Title; |
306 | 305 | |
307 | 306 | } |
308 | - | |
307 | + | |
309 | 308 | } |
310 | 309 | }; |
311 | 310 | |
... | ... | @@ -346,9 +345,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
346 | 345 | $rootScope.isLoading = true; |
347 | 346 | $('#aiSpinner').css('visibility', 'visible'); |
348 | 347 | $scope.DisableUI(); |
349 | - $rootScope.isLoading = true; | |
350 | - $('#spinner').css('visibility', 'visible'); | |
351 | - | |
352 | 348 | $scope.filterstring = true; |
353 | 349 | |
354 | 350 | //while ($scope.searchAIListViewData.length) { |
... | ... | @@ -394,7 +390,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
394 | 390 | if (selectimg === true) { |
395 | 391 | $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; |
396 | 392 | |
397 | - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="AdamDetail($event)">' | |
393 | + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="OpenAdamImage($event)">' | |
398 | 394 | + '<div style="width:auto;height:auto;" class="thumbnail" >' |
399 | 395 | + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' |
400 | 396 | + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); |
... | ... | @@ -402,113 +398,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
402 | 398 | $compile($el)($scope); |
403 | 399 | |
404 | 400 | |
405 | - $(".sidebar").mCustomScrollbar({ | |
406 | - autoHideScrollbar: true, | |
407 | - //theme:"rounded" | |
408 | - }); | |
409 | - | |
410 | - | |
411 | - $scope.searchAIListViewData.push( | |
412 | - { | |
413 | - "_id": value._id, | |
414 | - //"_ImageId": value._ImageId, | |
415 | - "_Title": value._Title, | |
416 | - "_contentImage": value._contentImage, | |
417 | - "_ThumbnailImage": value._ThumbnailImage, | |
418 | - | |
419 | - | |
420 | - }); | |
421 | - } | |
422 | - }); | |
423 | - $('table > #ListViewDiv > #searchItem').remove(); | |
424 | - //Show Error Message in case of gridview if no data is found | |
425 | - if ($scope.searchAIListViewData.length == 0) { | |
426 | - var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view'); | |
427 | - $compile($el)($scope); | |
428 | - $('table > #ListViewDiv > #searchItem').remove(); | |
429 | - | |
430 | - $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>'); | |
431 | - } | |
432 | - $rootScope.isLoading = false; | |
433 | - $('#spinner').css('visibility', 'hidden'); | |
434 | - | |
435 | - }, | |
436 | - function (error) { | |
437 | - // handle errors here | |
438 | - console.log(' $scope.IllustrationData = ' + error.statusText); | |
439 | - } | |
440 | - ); | |
441 | - } | |
442 | - | |
443 | - | |
444 | - | |
445 | - $scope.ApplySearchByAlphabet = function (SearchText) { | |
446 | - | |
447 | - $rootScope.isLoading = true; | |
448 | - $('#spinner').css('visibility', 'visible'); | |
449 | - | |
450 | - $scope.filterstring = true; | |
451 | - | |
452 | - while ($scope.searchAIListViewData.length) { | |
453 | - $scope.searchAIListViewData.pop(); | |
454 | - } | |
455 | - | |
456 | - | |
457 | - | |
458 | - | |
459 | - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { | |
460 | - | |
461 | - localStorage.setItem("AIImageId", SearchText); | |
462 | - | |
463 | - } | |
464 | - else { | |
465 | - localStorage.setItem("AIImageId", ''); | |
466 | - | |
467 | - } | |
468 | - | |
469 | - var promise = DataService.getJson('~/../content/data/json/ai/ai_dat_contentlist.json') | |
470 | - promise.then( | |
471 | - function (result) { | |
472 | - $scope.IllustrationData = result; | |
473 | - | |
474 | - $scope.selectedAIListViewData = new jinqJs() | |
475 | - .from($scope.IllustrationData.root.AIData) | |
476 | - .orderBy([{ field: '_Title', sort: 'asc' }]) | |
477 | - .select(); | |
478 | - | |
479 | - $('#grid-view').empty(); | |
480 | - | |
481 | - angular.forEach($scope.selectedAIListViewData, function (value, key) { | |
482 | - | |
483 | - var selectimg = true; | |
484 | - //var count = 0; | |
485 | - if (typeof (SearchText) !== "undefined" && (SearchText !== null && SearchText !== "")) { | |
486 | - | |
487 | - var firstChar = value._Title[0]; | |
488 | - | |
489 | - if (firstChar == SearchText) { | |
490 | - selectimg = true; | |
491 | - //count = count + 1; | |
492 | - | |
493 | - } | |
494 | - else { | |
495 | - selectimg = false; | |
496 | - //count = count - 1; | |
497 | - } | |
498 | - | |
499 | - } | |
500 | - | |
501 | - if (selectimg === true) { | |
502 | - $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; | |
503 | - | |
504 | - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="AdamDetail($event)">' | |
505 | - + '<div style="width:auto;height:auto;" class="thumbnail" >' | |
506 | - + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' | |
507 | - + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); | |
508 | - | |
509 | - $compile($el)($scope); | |
510 | - | |
511 | - | |
512 | 401 | //$(".sidebar").mCustomScrollbar({ |
513 | 402 | // autoHideScrollbar: true, |
514 | 403 | // //theme:"rounded" |
... | ... | @@ -540,14 +429,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
540 | 429 | }, 10); |
541 | 430 | |
542 | 431 | }, |
543 | - function (error) { | |
544 | - // handle errors here | |
545 | - console.log(' $scope.IllustrationData = ' + error.statusText); | |
546 | - } | |
547 | - ); | |
432 | + function (error) { | |
433 | + // handle errors here | |
434 | + console.log(' $scope.IllustrationData = ' + error.statusText); | |
435 | + } | |
436 | + ); | |
548 | 437 | } |
549 | 438 | $scope.DisableUI = function () { |
550 | - | |
439 | + | |
551 | 440 | $('#imgParent').css('z-index', '1'); |
552 | 441 | document.getElementById("imgParent").style.pointerEvents = "none"; |
553 | 442 | document.getElementById("imgParent").style.opacity = "0.5"; |
... | ... | @@ -564,7 +453,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
564 | 453 | $rootScope.isLoading = true; |
565 | 454 | $('#aiSpinner').css('visibility', 'visible'); |
566 | 455 | $scope.DisableUI(); |
567 | - $('ul li span').removeAttr("style"); | |
456 | + $('ul li span').removeAttr("style"); | |
568 | 457 | $('#' + $rootScope.SearchTextByAlphabet).css({ "color": "white", "background-color": "#1B92D0" }); |
569 | 458 | $scope.filterstring = true; |
570 | 459 | if (typeof (SearchTextByAlphabet) !== "undefined" && (SearchTextByAlphabet !== null && SearchTextByAlphabet !== "")) { |
... | ... | @@ -581,7 +470,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
581 | 470 | |
582 | 471 | $scope.selectedAIListViewData = new jinqJs() |
583 | 472 | .from($scope.IllustrationData.root.AIData) |
584 | - .orderBy([{ field: '_Title', sort: 'asc' }]).select(); | |
473 | + .orderBy([{ field: '_Title', sort: 'asc' }]).select(); | |
585 | 474 | |
586 | 475 | $('#grid-view').empty(); |
587 | 476 | |
... | ... | @@ -601,7 +490,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
601 | 490 | if (selectimg === true) { |
602 | 491 | $scope.imagePath = "~/../content/images/ai/thumbnails/" + value._ThumbnailImage; |
603 | 492 | |
604 | - var $el = $('<div id="' + value._id + '" ng-disabled="' + $scope.IsDisable + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="OpenAdamImage($event)">' | |
493 | + var $el = $('<div id="' + value._id + '" ng-disabled="' + $scope.IsDisable + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="OpenAdamImage($event)">' | |
605 | 494 | + '<div style="width:auto;height:auto;" class="thumbnail" >' |
606 | 495 | + '<img style="height:150px" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >' |
607 | 496 | + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view'); |
... | ... | @@ -629,17 +518,17 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
629 | 518 | } |
630 | 519 | $rootScope.isLoading = false; |
631 | 520 | |
632 | - setTimeout(function () { | |
633 | - $scope.EnableUI(); | |
634 | - }, 10); | |
521 | + setTimeout(function () { | |
522 | + $scope.EnableUI(); | |
523 | + }, 10); | |
635 | 524 | }, |
636 | 525 | function (error) { |
637 | 526 | console.log(' $scope.IllustrationData = ' + error.statusText); |
638 | 527 | } |
639 | - | |
528 | + | |
640 | 529 | ); |
641 | - | |
642 | - | |
530 | + | |
531 | + | |
643 | 532 | } |
644 | 533 | |
645 | 534 | |
... | ... | @@ -704,9 +593,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
704 | 593 | .select('_contentImage'); |
705 | 594 | |
706 | 595 | $scope.clickedAIImage = "~/../content/images/ai/images/" + clickedAIImage[0]._contentImage; |
707 | - | |
596 | + | |
708 | 597 | if (clickedAIImage.length > 0) { |
709 | - | |
598 | + | |
710 | 599 | $.jsPanel({ |
711 | 600 | id: 'aiImagePanel', |
712 | 601 | selector: '.aiView', |
... | ... | @@ -724,7 +613,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
724 | 613 | title: $rootScope.getLocalStorageValue("currentViewTitle"), |
725 | 614 | position: { |
726 | 615 | top: 70, |
727 | - left: 20, | |
616 | + left: 20, | |
728 | 617 | }, |
729 | 618 | |
730 | 619 | size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 110 }, |
... | ... | @@ -732,7 +621,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
732 | 621 | }); |
733 | 622 | |
734 | 623 | $('#canvasDiv img').load(function () { |
735 | - | |
624 | + | |
736 | 625 | $rootScope.isLoading = false; |
737 | 626 | $('#aiSpinner').css('visibility', 'hidden'); |
738 | 627 | var canvas = document.getElementById("canvas"); |
... | ... | @@ -746,14 +635,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
746 | 635 | "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentAIImageId, |
747 | 636 | "slug": $rootScope.currentSlug |
748 | 637 | }); |
749 | - | |
750 | - $("#aiImagePanel .img-thumbnail").css("min-height", $("#aiImagePanel .jsPanel-content").height()); | |
638 | + | |
639 | + $("#aiImagePanel .img-thumbnail").css("min-height", $("#aiImagePanel .jsPanel-content").height()); | |
751 | 640 | $('.jsPanel-content .jsPanel-theme-success').css('overflow-y', 'auto !important') |
752 | 641 | var jspContentHeight = $('.jsPanel-content').height(); |
753 | - | |
754 | - | |
755 | 642 | |
756 | - | |
643 | + | |
644 | + | |
645 | + | |
757 | 646 | } |
758 | 647 | }, |
759 | 648 | function (error) { |
... | ... | @@ -764,7 +653,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
764 | 653 | // console.log($rootScope.OpenAdamImages); |
765 | 654 | $('#AIView').css("height", $(window).outerHeight()); |
766 | 655 | |
767 | - $('#AIView').css("width", $(window).outerWidth()); | |
656 | + $('#AIView').css("width", $(window).outerWidth()); | |
768 | 657 | } |
769 | 658 | |
770 | 659 | $scope.$on('annotationToolEvent', function (event, data) { |
... | ... | @@ -776,12 +665,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
776 | 665 | |
777 | 666 | $("#canvas").css("display", "block"); |
778 | 667 | $("#canvasPaint").css("display", "block"); |
779 | - | |
668 | + | |
780 | 669 | $rootScope.onDrawingCanvasClick(); |
781 | 670 | $rootScope.FreeStylePaint(); |
782 | 671 | }); |
783 | 672 | |
784 | - $scope.ReloadListViewImageDiv = function (id,imgCount) { | |
673 | + $scope.ReloadListViewImageDiv = function (id, imgCount) { | |
785 | 674 | //console.log(id); |
786 | 675 | $scope.idSelected = id; |
787 | 676 | $scope.hiderow = true; |
... | ... | @@ -810,7 +699,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout |
810 | 699 | var curAIListViewScroll = $rootScope.getLocalStorageValue("AIListViewScroll"); |
811 | 700 | if (typeof (curAIListViewScroll) !== "undefined" && curAIListViewScroll !== null && curAIListViewScroll !== '') { |
812 | 701 | if (typeof InstallTrigger !== 'undefined') { |
813 | - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("AIListViewScroll") }); | |
702 | + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("AIListViewScroll") }); | |
814 | 703 | } |
815 | 704 | else { |
816 | 705 | $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("AIListViewScroll")); | ... | ... |