diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index 978f0cd..16592d2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -970,10 +970,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('#cbRenameAuthor').val($scope.selectedNodeSingleObj.author); } if ($scope.selectedNodeSingleObj.version != "undefined") { - $('#cbRenameSummary').val($scope.selectedNodeSingleObj.version); + $('#cbRenameSummary').val($scope.selectedNodeSingleObj.summary); } if ($scope.selectedNodeSingleObj.summary != "undefined") { - $('#cbRenameVersionNo').val($scope.selectedNodeSingleObj.summary); + $('#cbRenameVersionNo').val($scope.selectedNodeSingleObj.version); } if ($scope.selectedNodeSingleObj.modified != "undefined") { $('#cbRenameDate').val($scope.selectedNodeSingleObj.modified); @@ -981,6 +981,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } $rootScope.cbRenameModelShow = function () { + //Add code for Save Draft Content + if ($rootScope.contentNotesForSaveCB.length == 0) { + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; + } var current_id = document.getElementById('cbSelect').value; document.getElementById('renameInputBoxId').value = ""; traverseTreeSelectedSingleObj($rootScope.stru, current_id); @@ -988,7 +992,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $('#cbRenameSectionTitle').val($scope.selectedNodeSingleObj._label); } if ($scope.selectedNodeSingleObj._isBranch == "true") { - traverseTreeSelectedSingleObj($rootScope.Auther, current_id); + //traverseTreeSelectedSingleObj($rootScope.Auther, current_id); + traverseTreeSelectedSingleObj($rootScope.contentNotesForSaveCB, current_id); //document.getElementById('cbRenameDate').value = $scope.selectedNodeSingleObj.modified; $scope.setProperties(); document.getElementById('cbModelRenameBackground').style.display = "block"; @@ -997,6 +1002,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ else { document.getElementById('cbModelRenameBackground').style.display = "block"; document.getElementById('cbModelRenameId').style.display = "block"; + if ($scope.selectedNodeSingleObj._label != "undefined") { + $('#renameInputBoxId').val($scope.selectedNodeSingleObj._label); + } + } } @@ -1078,18 +1087,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } if ($rootScope.cbTreeFirstID == nodeid) { $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingleObj._label; - } + } + //Add code for Save Draft Content + if ($rootScope.contentNotesForSaveCB.length == 0) { + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; + } //$scope.selectedNodeSingleObj = ""; - traverseTreeSelectedSingleObj($rootScope.Auther, nodeid); + //traverseTreeSelectedSingleObj($rootScope.Auther, nodeid); + traverseTreeSelectedSingleObj($rootScope.contentNotesForSaveCB, nodeid); setTimeout(function () { $scope.selectedNodeSingleObj.summary = newSummary; $scope.selectedNodeSingleObj.author = newAuthorName; $scope.selectedNodeSingleObj.version = newversion; $scope.selectedNodeSingleObj.modified = $scope.dateTime; - //Add code for Save Draft Content - if ($rootScope.contentNotesForSaveCB.length == 0) { - $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; - } + $scope.DropDownSelectNodeClick(nodeid); console.log("Structure:" + JSON.stringify($rootScope.structureObjForSaveCB)); console.log("Notes:" + JSON.stringify($rootScope.contentNotesForSaveCB)); @@ -1434,6 +1445,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } } $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; + $scope.selectedNodeSingleObj = ""; //traverseTreeSelectedSingleObj($rootScope.structureObjForSaveCB, currentid); //if ($scope.selectedNodeSingleObj._isBranch == "true") { // for (var j = 0; j < $scope.selectedNodeSingleObj['structure'].length; j++) { @@ -1477,6 +1489,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $rootScope.updatedContentFromEditor = function (cbCurrentId) { + if ($rootScope.contentNotesForSaveCB.length == 0) { + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents + } var windowsInSelectedSlide; var notesForSelectedSlide; var contentWindowsNotes = $rootScope.contentNotesForSaveCB var selectedSlideContent = new jinqJs() @@ -1501,8 +1516,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ .delete().at("_id == " + cbCurrentId).select(); $rootScope.contentNotesForSaveCB = remaingNotesForCB; - traverseTreeSelectedSingleObj($rootScope.Auther, nodeid); - //traverseTreeSelectedSingleObj($rootScope.contentNotesForSaveCB, cbCurrentId); + + traverseTreeSelectedSingleObj($rootScope.stru, cbCurrentId); //$scope.selectedNodeSingleObj.summary //$scope.selectedNodeSingleObj.author //$scope.selectedNodeSingleObj.version @@ -1515,30 +1530,35 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_id": cbCurrentId }); } - else if ($scope.selectedNodeSingleObj._isBranch == "true") { + + else if ($scope.selectedNodeSingleObj._isBranch == "true" && $scope.selectedNodeSingleObj._isRoot == "true") { + //traverseTreeSelectedSingleObj($rootScope.Auther, cbCurrentId); + traverseTreeSelectedSingleObj($rootScope.cbDynamicContents, cbCurrentId); $rootScope.contentNotesForSaveCB.push( { - "summary": $scope.selectedNodeSingleObj.summary, - "author": $scope.selectedNodeSingleObj.author, + "windows": windowsInSelectedSlide, + "summary": $scope.selectedNodeSingleObj.summary, + "author": $scope.selectedNodeSingleObj.author, "modified": $scope.selectedNodeSingleObj.modified, "password": "", - "version": $scope.selectedNodeSingleObj.version , - "windows": windowsInSelectedSlide, - "_id": cbCurrentId + "version": $scope.selectedNodeSingleObj.version, + "_id": cbCurrentId //"notes": notesForSelectedSlide, //"windows": windowsInSelectedSlide, //"_id": cbCurrentId }); } - else if ($scope.selectedNodeSingleObj._isBranch == "true" && $scope.selectedNodeSingleObj._isRoot == "true") { + else if ($scope.selectedNodeSingleObj._isBranch == "true") { + //traverseTreeSelectedSingleObj($rootScope.Auther, cbCurrentId); + traverseTreeSelectedSingleObj($rootScope.cbDynamicContents, cbCurrentId); $rootScope.contentNotesForSaveCB.push( { - "windows": windowsInSelectedSlide, "summary": $scope.selectedNodeSingleObj.summary, - "author": $scope.selectedNodeSingleObj.author, + "author": $scope.selectedNodeSingleObj.author, "modified": $scope.selectedNodeSingleObj.modified, "password": "", "version": $scope.selectedNodeSingleObj.version, + "windows": windowsInSelectedSlide, "_id": cbCurrentId //"notes": notesForSelectedSlide, //"windows": windowsInSelectedSlide, @@ -1636,11 +1656,12 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $scope.addSection = function (currentid, AddSecionId) { - if ($rootScope.structureObjForSaveCB.length == 0) { - //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array - //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure; + if ($rootScope.structureObjForSaveCB.length == 0) { $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; - } + } + if ($rootScope.contentNotesForSaveCB.length == 0) { + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; + } traverseTreeSelectedSingleObj($rootScope.stru, currentid); traverse($rootScope.stru, currentid); @@ -1681,6 +1702,21 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ "_isBranch": "true", "_isLocked": "false" }); + + $rootScope.contentNotesForSaveCB.push( + { + "summary": "", + "author": "", + "modified": "", + "password": "", + "version": "", + "windows": "", + "_id": AddSecionId + //"notes": notesForSelectedSlide, + //"windows": windowsInSelectedSlide, + //"_id": cbCurrentId + }); + //if (currentid == $rootScope.cbTreeFirstID) { // $rootScope.structureObjForSaveCB.push( // { @@ -1699,7 +1735,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure']; } } - //} + //} } // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500); }