diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index f123574..0fcbb35 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -348,7 +348,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout while ($scope.searchAIListViewData.length) { $scope.searchAIListViewData.pop(); } - //$scope.loadAllAI(ImageCount); + $scope.loadAllAI(ImageCount); } $scope.ApplySearch = function (query) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index f7676f8..b99de8e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -9,6 +9,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $scope.countRightlist; $rootScope.selectedNodeSingle = []; $scope.selectedNodeSingleObj = []; + $rootScope.saveDraftSingleObj = []; + $rootScope.saveDraftDynamicTest = []; + $rootScope.updateSaveDraftCB = []; $scope.IsVisible = function () { $scope.scroll(); } @@ -207,82 +210,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } - $rootScope.exportToFile = function () { - - for (var i = 0; i < $rootScope.structure.length; i++) { - - } - $rootScope.selectedNodeSingle.push( - { - "slideshow": { - "presentation": { - "structure": { - "structure": [ - { - "_label": "Untitled Slide", - "_id": "-1507902782", - "_isRoot": "false", - "_isBranch": "false", - "_isLocked": "false" - } - - ], - "_label": "Untitled Curriculum", - "_id": "-225638207", - "_isRoot": "true", - "_isBranch": "true", - "_isLocked": "false" - }, - "_anchor": "true", - "_window_position": "6,10", - "_window_size": "828,453" - }, - "content": { - "element": [ - { - "notes": "

", - "windows": { - "window": "{\"windowTitle\":\"Hand (Post/Ant)\",\"selectedCallouts\":[],\"annotationData\":\"\",\"minimised\":false,\"scrollPosition\":{\"vertical\":78,\"horizontal\":120},\"selectedStructureID\":7446,\"maximised\":false,\"size\":{\"width\":800,\"height\":753},\"id\":\"424\",\"showSelectedPins\":true,\"scaleIndex\":0,\"bodySystemId\":11,\"windowListId\":\"0\",\"imageId\":\"424\",\"position\":{\"x\":840,\"y\":10},\"mType\":\"ATLAS_ANATOMY\",\"hideCallOuts\":true,\"containsCapturedContent\":true,\"selectedPins\":[\"32783\"],\"contextMenu\":{\"hideLeftBar\":false,\"hideTitleBar\":false,\"hideTopToolBar\":false,\"lockResize\":false}}" - }, - "_id": "-1507902782" - } - ] - } - } - }); - - $scope.filename = "filename.json"; - var filename = $scope.filename; - var blob = new Blob([angular.toJson($rootScope.selectedNodeSingle, true)], { type: 'text/text' }); - if (window.navigator && window.navigator.msSaveOrOpenBlob) { - window.navigator.msSaveOrOpenBlob(blob, filename); - } else { - var e = document.createEvent('MouseEvents'), - a = document.createElement('a'); - a.download = filename; - a.href = window.URL.createObjectURL(blob); - a.dataset.downloadurl = ['text/json', a.download, a.href].join(':'); - e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); - a.dispatchEvent(e); - // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource - } - $http({ method: 'Post', url: $scope.fileName }).success(function (data) { - localStorage.setItem("cbJsonDataObject", JSON.stringify(data)); - $rootScope.cbJsonData = JSON.parse(localStorage.getItem("cbJsonDataObject")); - $rootScope.cbDynamicJsonData = data; - //$scope.getCBsummary(); - $rootScope.cbJsonData.slideshow.content.element = "Eement data"; - $rootScope.cbDynamicJsonData.slideshow.content.element = "slideshow element data"; - $rootScope.note = "save data" - //$scope.openCurriculumDetail(); - }) - .error(function (data, status, headers, config) { - console.log(data); - }); - }; + $rootScope.saveCurricullam = function (file_Name) { - + $scope.exportToFile(); $scope.selectedNodeSingleObj.push( { "slideshow": { @@ -972,7 +903,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ else { $rootScope.cbBack(); } - $scope.DeleteSlide(cbCurrentSelectedId); + $scope.deleteSectionForCB(cbCurrentSelectedId, CurrentSelectedParentSpanId); + $scope.DeleteSlide(cbCurrentSelectedId, CurrentSelectedParentSpanId); var CurrentId = document.getElementById('cbSelect').value; $scope.DropDownSelectNodeClick(CurrentId); $rootScope.closeDeleteModel(); @@ -1036,6 +968,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ }); } + $rootScope.CBAddSection = function () { var current_id if (($rootScope.getLocalStorageValue("cbSelectId")) != '') { @@ -1120,31 +1053,65 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } + $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) { + if ($rootScope.saveDraftSingleObj.length == 0) { + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array + } + traverse($rootScope.stru, currentid); + for (var j = 0; j < $scope.saveDraftSingleObj.length; j++) { + if (($scope.saveDraftSingleObj[j]._id == currentid)) { + $scope.saveDraftSingleObj.splice(j, 1); + } + } + console.log($scope.saveDraftSingleObj); + } - $scope.DeleteSlide = function (currentid) { + $scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) { + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array traverse($rootScope.stru, currentid); for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { if (($scope.selectedNodeSiblingObjs[j]._id == currentid)) { $scope.selectedNodeSiblingObjs.splice(j, 1); + + //Added Code by Sandeep for Delete slide from node tree for save draft CB + for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) { + if (($rootScope.saveDraftSingleObj[x]._id == CurrentSelectedParentSpanId)) { + for (var y = 0; y < $rootScope.saveDraftSingleObj[x]['structure'].length; y++) { + if ($rootScope.saveDraftSingleObj[x]['structure'][y]._id == currentid) { + $rootScope.saveDraftSingleObj[x]['structure'].splice(y, 1); + } + } + } + } } + } // prune($rootScope.stru, currentid); // alert("After" + JSON.stringify($rootScope.stru)); - + + } + $scope.addSection = function (currentid, AddSecionId) { - traverseTreeSelectedSingleObj($rootScope.stru, currentid); - traverse($rootScope.stru, currentid); + if ($rootScope.saveDraftSingleObj.length == 0) { + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array + } + //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array + //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array + //$rootScope.updateSaveDraftDynamicTest = []; - if (currentid == "-225638207") { + traverseTreeSelectedSingleObj($rootScope.stru, currentid); + traverse($rootScope.stru, currentid); + //if (currentid == "-225638207") { + if($rootScope.cbTreeFirstID == currentid){ $rootScope.selectedNodeSingle.push( - { - "structure": { + { + "structure": { "structure": [ //{ // "_label": "NEW ", @@ -1159,9 +1126,22 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_isRoot": "false", "_isBranch": "true", "_isLocked": "false" - } - - }); + } + + }); + + $rootScope.saveDraftSingleObj.push( + { + "structure": { + "structure": [ + ], + "_label": "New Section", + "_id": AddSecionId, + "_isRoot": "false", + "_isBranch": "true", + "_isLocked": "false" + } + }); } else { $scope.selectedNodeSingleObj['structure'].push( @@ -1181,15 +1161,34 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_isBranch": "true", "_isLocked": "false" }); + + for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { + if ($rootScope.saveDraftSingleObj[i]._id == currentid) { + $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure']; + } + } } // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500); } + $scope.addSlide = function (currentid, AddSlideId) { + + if ($rootScope.saveDraftSingleObj.length == 0) { + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array + } + //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array + //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array + //$rootScope.updateSaveDraftDynamicTest = []; + + traverseTreeSelectedSingleObj($rootScope.stru, currentid); - // traverse($rootScope.stru, currentid); + traverse($rootScope.stru, currentid); + //Assign object by traverse method $scope.selectedNodeSiblingObjs + //console.log(JSON.stringify($scope.upDateJsonObj)) - if (currentid == "-225638207") { + //if (currentid == "-225638207") { + if ($rootScope.cbTreeFirstID == currentid) { $rootScope.selectedNodeSingle.push( { "_label": "NEW Slide1", @@ -1198,6 +1197,19 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_isBranch": "false", "_isLocked": "false" }); + + $rootScope.saveDraftSingleObj.push({ + "_label": "NEW Slide1", + "_id": AddSlideId, + "_isRoot": "false", + "_isBranch": "false", + "_isLocked": "false" + }); + //for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { + // if ($rootScope.saveDraftSingleObj[i]._id == currentid) { + // $rootScope.saveDraftSingleObj[i] = $rootScope.selectedNodeSingle; + // } + //} } else { $scope.selectedNodeSingleObj['structure'].push({ @@ -1207,6 +1219,12 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_isBranch": "false", "_isLocked": "false" }); + for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { + if($rootScope.saveDraftSingleObj[i]._id == currentid) + { + $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure']; + } + } } // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000); setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); @@ -1214,6 +1232,171 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } + $rootScope.exportToFile = function () { + + + $scope.DynamicAddspanID = []; + $scope.contentEleNote = []; + $scope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; + //for (var i = 0; i < $rootScope.structure.length; i++) { + + //} + var spanIds = []; + var cbCurrentId = document.getElementById('cbSelect').value; + //$('.jstree-container-ul li a span').each(function () { + // var span_Id = $(this).attr("id"); + // var spanText = $(this).text(); + // //spanIds.push(span_Id); + // if (span_Id == cbCurrentId) { + // } + // if (span_Id != "-225638207" && _parentId == 0) { + // $scope.DynamicAddspanID.push( + // { + // "_label": spanText, + // "_id": span_Id, + // "_isRoot": "false", + // "_isBranch": "false", + // "_isLocked": "false", + // }); + "," + // } + // else if (_isbranch == true && _parentId != 0) { + // $scope.selectedNodeSingleObj['structure'] + // $scope.DynamicAddspanID.push({ + // "structure": [ + // { + // "_label": spanText, + // "_id": span_Id, + // "_isRoot": "false", + // "_isBranch": "false", + // "_isLocked": "false", + // } + + // ] + // }); + // } + //}); + + + + + + + + //for (var i = 0; i < $rootScope.cbJsonData.slideshow.content.element.length; i++) { + // $scope.contentEleNote.push( + // { + // "notes": $rootScope.cbJsonData.slideshow.content.element[i].notes, + // "windows": { + // "window": $rootScope.cbJsonData.slideshow.content.element[i].windows.window + // }, + // "_id": $rootScope.cbJsonData.slideshow.content.element[i]._id + // }); + "," + + //} + //var myJSON = JSON.stringify($scope.DynamicAddspanID); + $rootScope.saveDraftDynamicTest.push( + { + "slideshow": { + "presentation": { + "structure": { + "structure": //[ + + //$scope.DynamicAddspanID, + $rootScope.saveDraftSingleObj, + + + //], + "_label": $rootScope.cbTreeFirstLabel, + "_id": $rootScope.cbTreeFirstID, + "_isRoot": "true", + "_isBranch": "true", + "_isLocked": "false" + }, + "_anchor": "true", + "_window_position": "6,10", + "_window_size": "828,453" + }, + "content": { + "element": [ + + //"notes": "

", + //"windows": { + // "window": "{\"windowTitle\":\"Hand (Post/Ant)\",\"selectedCallouts\":[],\"annotationData\":\"\",\"minimised\":false,\"scrollPosition\":{\"vertical\":78,\"horizontal\":120},\"selectedStructureID\":7446,\"maximised\":false,\"size\":{\"width\":800,\"height\":753},\"id\":\"424\",\"showSelectedPins\":true,\"scaleIndex\":0,\"bodySystemId\":11,\"windowListId\":\"0\",\"imageId\":\"424\",\"position\":{\"x\":840,\"y\":10},\"mType\":\"ATLAS_ANATOMY\",\"hideCallOuts\":true,\"containsCapturedContent\":true,\"selectedPins\":[\"32783\"],\"contextMenu\":{\"hideLeftBar\":false,\"hideTitleBar\":false,\"hideTopToolBar\":false,\"lockResize\":false}}" + //}, + //"_id": "-1507902782" + $scope.contentEleNote, + + ] + } + } + + }); + + + + $scope.filename = "filename.json"; + var filename = $scope.filename; + var blob = new Blob([angular.toJson($rootScope.saveDraftDynamicTest, true)], { type: 'text/text' }); + if (window.navigator && window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveOrOpenBlob(blob, filename); + } else { + var e = document.createEvent('MouseEvents'), + a = document.createElement('a'); + a.download = filename; + a.href = window.URL.createObjectURL(blob); + a.dataset.downloadurl = ['text/json', a.download, a.href].join(':'); + e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + a.dispatchEvent(e); + // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource + } + $http({ method: 'Post', url: $scope.fileName }).success(function (data) { + localStorage.setItem("cbJsonDataObject", JSON.stringify(data)); + $rootScope.cbJsonData = JSON.parse(localStorage.getItem("cbJsonDataObject")); + $rootScope.cbDynamicJsonData = data; + //$scope.getCBsummary(); + $rootScope.cbJsonData.slideshow.content.element = "Eement data"; + $rootScope.cbDynamicJsonData.slideshow.content.element = "slideshow element data"; + $rootScope.note = "save data" + //$scope.openCurriculumDetail(); + }) + .error(function (data, status, headers, config) { + console.log(data); + }); + }; + + + + + + //$scope.addSlide = function (currentid, AddSlideId) { + // traverseTreeSelectedSingleObj($rootScope.stru, currentid); + // // traverse($rootScope.stru, currentid); + // //console.log(JSON.stringify($scope.upDateJsonObj)) + // if (currentid == "-225638207") { + // $rootScope.selectedNodeSingle.push( + // { + // "_label": "NEW Slide1", + // "_id": AddSlideId, + // "_isRoot": "false", + // "_isBranch": "false", + // "_isLocked": "false" + // }); + // } + // else { + // $scope.selectedNodeSingleObj['structure'].push({ + // "_label": "New Slide", + // "_id": AddSlideId, + // "_isRoot": "false", + // "_isBranch": "false", + // "_isLocked": "false" + // }); + // } + // // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000); + // setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); + + + //} + $scope.moveDown = function (currentid) { @@ -1238,7 +1421,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ if (o[i] !== null && typeof (o[i]) == "object") { if (o[i]._id == current_id) { - $scope.selectedNodeSingleObj = o[i]; + $scope.selectedNodeSingleObj = o[i]; } traverseTreeSelectedSingleObj(o[i], current_id); } @@ -1519,6 +1702,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('body,html').animate({ scrollTop: $('#' + selected_Id).position().top }, 500); } } + + }] );