diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index fed418b..09516d1 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -65,6 +65,7 @@ + @@ -78,6 +79,8 @@ + + @@ -116,6 +119,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 7b8e4a8..f3dec1f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -117,6 +117,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", var lastOpenMoudle = $rootScope.openViews[openViews.length - 1]; } $('#daImagePanel').remove(); + if ($('#jsPanel-1').length > 0) + $('#jsPanel-1').remove(); $location.url('/' + slug); $rootScope.$broadcast('jsPanelCloseEvent', true); @@ -154,6 +156,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.ClearIframe = function () { if ($('#daImagePanel') != null) $('#daImagePanel').remove(); + if ($('#jsPanel-1').length > 0) + $('#jsPanel-1').remove(); $rootScope.hideScrollbar(); } @@ -2501,6 +2505,178 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", console.log('close') $(".export-image").css("display", "none"); }; + + $rootScope.ShowPrintWindow = function () { // Print Active Viewer + html2canvas($("#canvasDiv"), { + onrendered: function (canvas) { + var dataURL = canvas.toDataURL("image/jpeg"); + var imageToPrint = new Image(); + imageToPrint.src = dataURL; + $('#snipImage').attr('src', dataURL); + + $('#spnModule').text($rootScope.currentActiveModuleTitle); + $('#spnPosture').text(localStorage.getItem('currentViewTitle')); + + PrintDIVContent('printBox'); // Open Print Window + } + }); + }; + + $rootScope.ShowPrintPreviewWindow = function (event) { // Print Preview + $('#dvPrintPreview').css('display', 'block'); + html2canvas($("#canvasDiv"), { + onrendered: function (canvas) { + var dataURL = canvas.toDataURL("image/jpeg"); + var imageToPrint = new Image(); + imageToPrint.src = dataURL; + + OpenJSPanel(); // open jsPanel here + if ($('#jsPanel-1').length > 0) { + $('.jsPanel-btn-min').attr('style', 'display: none'); + $('.jsPanel-btn-max').attr('style', 'display: none'); + $('.jsPanel-btn-norm').attr('style', 'display: none'); + } + + console.log('jsPanel loaded exist= ' + document.getElementById('jsPanel-1')); // document.getElementsByClassName('ppImagePanel')); + + var curModule = $rootScope.currentActiveModuleTitle; + var curPosture = localStorage.getItem('currentViewTitle'); + + if (document.getElementById('jsPanel-1')) { //document.getElementsByClassName('ppImagePanel')) { + setTimeout(function () { + document.getElementById('imgPortrait').setAttribute('src', dataURL); + document.getElementById('imgLandscape').setAttribute('src', dataURL); + document.getElementById('spnModulePor').innerHTML = curModule; + document.getElementById('spnBodyViewTitlePor').innerHTML = curPosture; + document.getElementById('spnModuleLan').innerHTML = curModule; + document.getElementById('spnBodyViewTitleLan').innerHTML = curPosture; + }, 100); + } + + $('#fileMenuAnchor').addClass('disableMenuannotation'); + if ($('#daImagePanel').length > 0) { + console.log('close') + //$('#daImagePanel').css('display', 'none'); + $('#daImagePanel').remove(); + } + } + }); + }; + + function OpenJSPanel() { + $.jsPanel({ + id: 'jsPanel-1', + selector: '#dvPrintPreview', + theme: 'success', + currentController: 'HomeController', + parentSlug: 'da-view-list', //After closing panel, control moves to here + ajax: { + url: 'app/views/home/printPreview.html' + }, + title: localStorage.getItem("currentViewTitle"), + position: { + top: 70, + left: 1, + }, + size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 }, + }); + } + + // $().on('', '', callback); + $(document).on('change', 'input[name=inlineRadioOptions]', function () { + if ($(this).attr("value") == "Portrait") { + $(".print-box").not(".portrait-box").hide(); + $(".portrait-box").show(); + } + if ($(this).attr("value") == "Landscape") { + $(".print-box").not(".landscape-box").hide(); + $(".landscape-box").show(); + } + }); + + $(document).on('change', '#printPSOptions', function () { + var option = $('#printPSOptions').find(":selected").text(); + switch (option) { + case (option = "10%"): + ResizeImage(0.1); + break; + case (option = "25%"): + ResizeImage(0.25); + break; + case (option = "50%"): + ResizeImage(0.5); + break; + case (option = "75%"): + ResizeImage(.75); + break; + case (option = "65%"): + ResizeImage(0.65); + break; + case (option = "100%"): + ResizeImage(1); + break; + case (option = "150%"): + ResizeImage(1.5); + break; + case (option = "200%"): + ResizeImage(2); + break; + case (option = "500%"): + ResizeImage(5); + break; + case (option = "Auto"): + ResizeImage(0); + break; + default: + ResizeImage(0); + } + }); + + $(document).on('click', '#btnPrint', function () { + PrintDivContentByID('printBoxPor'); + }); + + function PrintDivContentByID(id) { + if (id == 'printBoxPor') { + $("#printPSOptions").val("100%"); + ResizeImage(1); + } + var contents = document.getElementById(id).innerHTML; + + var frame1 = $('