Commit c32b401c21cdf46460e9a3b0ee90a2dff541cd2d

Authored by Sandeep Kumar
1 parent e30f99aa

Code changes for delete node from SaveCB

400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
... ... @@ -9,8 +9,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
9 9 $scope.countRightlist;
10 10 $rootScope.selectedNodeSingle = [];
11 11 $scope.selectedNodeSingleObj = [];
12   - $rootScope.saveDraftSingleObj = [];
13   - $rootScope.contentEleNote = [];
  12 + $rootScope.structureObjForSaveCB = [];
  13 + $rootScope.contentNotesForSaveCB = [];
14 14 $rootScope.dynamicUpdatedJsonForSaveCB = "";
15 15 //$rootScope.updateSaveDraftCB = [];
16 16 $scope.IsVisible = function () {
... ... @@ -42,6 +42,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
42 42 tinymce.execCommand('mceRemoveEditor', true, 'CBTextArea');
43 43 tinymce.execCommand('mceAddEditor', true, 'CBTextArea');
44 44  
  45 + //$rootScope.structureObjForSaveCB = [];
  46 + //$rootScope.contentNotesForSaveCB = [];
45 47 }
46 48  
47 49 if ($('#' + id).html() != undefined) {
... ... @@ -177,13 +179,30 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
177 179 }
178 180  
179 181 $rootScope.OpenExistingCurriculum = function (file_Name) {
180   -
  182 +
  183 + //$window.location.reload();
181 184 $("#opencbview").trigger("click");
182 185 var fileupload = document.getElementById("opencbview");
183 186  
184 187 fileupload.onchange = function () {
  188 + // $route.reload();
  189 + //$location.url("/curriculum-builder");
  190 + //$location.path("/curriculum-builder");
  191 +
  192 + //var name = document.getElementById("opencbview").files[0].name;
  193 +
  194 + //$scope.CBDisableUI();
  195 + $rootScope.AutherName = "";
  196 + $rootScope.summary = "";
  197 + $rootScope.FileTitle = "Sandy File";
  198 +
  199 + $('#modal-CurBuilder').css("display", "block");
  200 + $("#CurBuilderbackground").css("display", "block")
185 201 $scope.getJsonFileFromLocal();
186   - var fileName = fileupload.value.replace('C:\\fakepath\\', '');;
  202 +
  203 +
  204 +
  205 + //var fileName = fileupload.value.replace('C:\\fakepath\\', '');;
187 206 //alert(fileName);
188 207  
189 208 //switch ($location.url()) {
... ... @@ -192,9 +211,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
192 211 // break;
193 212 //}
194 213 // $scope.fileName = file_Name;
195   - $('#modal-CurBuilder').css("display", "block");
196   - $("#CurBuilderbackground").css("display", "block");
197   - var name = document.getElementById("opencbview").files[0].name;
  214 +
  215 +
198 216  
199 217 // $http({
200 218 // method: 'GET',
... ... @@ -242,14 +260,16 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
242 260 }
243 261  
244 262 function receivedText(e) {
245   - let lines = e.target.result;
246   - var newArr = JSON.parse(lines);
  263 + let lines = e.target.result;
247 264  
  265 + var newArr = JSON.parse(lines);
248 266 localStorage.setItem("cbJsonDataObject", JSON.stringify(newArr));
  267 + $rootScope.cbJsonData = ""; $rootScope.cbDynamicJsonData = "";
249 268 $rootScope.cbJsonData = JSON.parse(lines);
250 269 $rootScope.cbDynamicJsonData = JSON.parse(lines);
251 270 $rootScope.getCBsummary();
252 271 $scope.CBEnableUI();
  272 +
253 273 $scope.openCurriculumDetail();
254 274 }
255 275 }
... ... @@ -463,7 +483,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
463 483 //$scope.structure = $scope.selectedNodeSingle[0].structure.structure[0]._label;
464 484 $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingle[0]._label;
465 485 $rootScope.structure = $scope.selectedNodeSingle[0].structure.structure;
466   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  486 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
467 487 $rootScope.cbTreeFirstID = $scope.selectedNodeSingle[0]._id;
468 488 $location.url("/curriculum-builder-detail");
469 489 }
... ... @@ -605,6 +625,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
605 625 }
606 626 $scope.DropDownSelectNodeClick(nodeid);
607 627 $scope.SelectedNotes = "";
  628 +
608 629 traverseTreeSelectedSingleObj($rootScope.note, nodeid);
609 630  
610 631 $scope.SelectedNotes = $scope.selectedNodeSingleObj.notes;
... ... @@ -622,17 +643,18 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
622 643 if ($scope.SelectedNotes != "" && $scope.SelectedNotes != undefined) {
623 644 tinymce.get("CBTextArea").setContent($scope.SelectedNotes);
624 645  
625   - setTimeout(function () {
626   - if ($scope.selectedNodeSingleObj.windows != "") {
627   - $scope.loadContentOfSelectedSlide($scope.selectedNodeSingleObj._id)
  646 + //setTimeout(function () {
  647 + // if ($scope.selectedNodeSingleObj.windows != "") {
  648 + // //$scope.loadContentOfSelectedSlide($scope.selectedNodeSingleObj._id)
628 649  
629   - }
630   - else
631   - {
632   - $scope.CBEnableUI();
  650 + // }
  651 + // else
  652 + // {
  653 + // $scope.CBEnableUI();
633 654  
634   - }
635   - },200);
  655 + // }
  656 + //},200);
  657 + $scope.CBEnableUI();
636 658  
637 659 }
638 660 else
... ... @@ -665,12 +687,13 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
665 687  
666 688 $scope.updateDropdownforSaveDraftCB = function (nodeid) {
667 689 var current_id = document.getElementById('cbSelect').value;
668   - if ($rootScope.saveDraftSingleObj.length == 0) {
669   - $rootScope.saveDraftSingleObj = $rootScope.structure;
670   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  690 + if ($rootScope.structureObjForSaveCB.length == 0) {
  691 + //$rootScope.structureObjForSaveCB = $rootScope.structure;
  692 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  693 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
671 694 }
672   - traverseSelectedObjForSaveDraftCB($rootScope.saveDraftSingleObj, current_id);
673   - if ($rootScope.saveDraftSingleObj.length != $rootScope.stru.structure.structure.length) {
  695 + traverseSelectedObjForSaveDraftCB($rootScope.structureObjForSaveCB, current_id);
  696 + if ($rootScope.structureObjForSaveCB.length != $rootScope.stru.structure.structure.length) {
674 697 if ($scope.selectedObjforSaveDraftCB._isBranch == "true" && $scope.selectedObjforSaveDraftCB._id == nodeid) {
675 698 $('#cbSelect').append('<option selected value="' + $scope.selectedNodeSingleObj._id + '">' + $scope.selectedNodeSingleObj._label + '</option>');
676 699 document.getElementById("slideNumber").innerHTML = "Slide " + $scope.currentSlideNumber + " of " + Object.keys($scope.selectedNodeSingleObj).length;
... ... @@ -689,15 +712,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
689 712  
690 713 //Start Code by Sandeep for TicketNo: 49226(3)
691 714 $scope.DropDownSelectNodeClick = function (nodeid) {
  715 + if ($rootScope.contentNotesForSaveCB.length == 0) {
  716 + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents
  717 + }
  718 + var currentCb_id = document.getElementById('cbSelect').value;
  719 + $rootScope.updatedContentFromEditor(currentCb_id);
692 720  
693   - //var current_id = document.getElementById('cbSelect').value;
  721 +
694 722 traverseTreeSelectedSingleObj($rootScope.stru, nodeid);
695 723 traverse($rootScope.stru, nodeid);
696 724  
697 725 $('#cbEditorRightSideBar').css('pointer-events', 'auto');
698 726 $('#cbEditorRightSideBar').css('opacity', '1');
699 727  
700   - //if ($rootScope.saveDraftSingleObj.length != $rootScope.stru.structure.structure.length && $rootScope.saveDraftSingleObj.length != 0) {
  728 + //if ($rootScope.structureObjForSaveCB.length != $rootScope.stru.structure.structure.length && $rootScope.structureObjForSaveCB.length != 0) {
701 729 // $scope.updateDropdownforSaveDraftCB(nodeid);
702 730 //}
703 731 if ($scope.selectedNodeSingleObj._isBranch == "true") {
... ... @@ -986,18 +1014,18 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
986 1014 $("#jstree").jstree('set_text', current_id, newSlideName);
987 1015 traverseTreeSelectedSingleObj($rootScope.stru, current_id);
988 1016 $scope.selectedNodeSingleObj._label = newSlideText;
989   - if ($rootScope.saveDraftSingleObj.length == 0) {
990   - $rootScope.saveDraftSingleObj = $rootScope.structure;
991   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1017 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1018 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
  1019 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
992 1020 }
993 1021 //Update Save Draft object for Rename slide
994   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
995   - if ($rootScope.saveDraftSingleObj[i]._id == current_id) {
996   - $rootScope.saveDraftSingleObj[i]._label = $scope.selectedNodeSingleObj._label
  1022 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  1023 + if ($rootScope.structureObjForSaveCB[i]._id == current_id) {
  1024 + $rootScope.structureObjForSaveCB[i]._label = $scope.selectedNodeSingleObj._label
997 1025 }
998 1026 }
999 1027 $scope.DropDownSelectNodeClick(current_id);
1000   - console.log(JSON.stringify($rootScope.stru));
  1028 + //console.log(JSON.stringify($rootScope.stru));
1001 1029 $rootScope.closeRenameModel();
1002 1030 }
1003 1031  
... ... @@ -1035,17 +1063,17 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1035 1063 traverseTreeSelectedSingleObj($rootScope.stru, nodeid);
1036 1064 $scope.selectedNodeSingleObj._label = newSectionText;
1037 1065 //Update Save Draft object for rename section
1038   - if ($rootScope.saveDraftSingleObj.length == 0) {
1039   - $rootScope.saveDraftSingleObj = $rootScope.structure;
1040   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
1041   - }
1042   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
1043   - if ($rootScope.saveDraftSingleObj[i]._id == nodeid) {
1044   - $rootScope.saveDraftSingleObj[i]._label = $scope.selectedNodeSingleObj._label;
1045   - //$rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1066 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1067 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
  1068 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1069 + }
  1070 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  1071 + if ($rootScope.structureObjForSaveCB[i]._id == nodeid) {
  1072 + $rootScope.structureObjForSaveCB[i]._label = $scope.selectedNodeSingleObj._label;
  1073 + //$rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
1046 1074 }
1047   - //else if ($rootScope.saveDraftSingleObj[i]['structure']._id == nodeid) {
1048   - // $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1075 + //else if ($rootScope.structureObjForSaveCB[i]['structure']._id == nodeid) {
  1076 + // $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
1049 1077 //}
1050 1078 }
1051 1079 if ($rootScope.cbTreeFirstID == nodeid) {
... ... @@ -1059,11 +1087,12 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1059 1087 $scope.selectedNodeSingleObj.version = newversion;
1060 1088 $scope.selectedNodeSingleObj.modified = $scope.dateTime;
1061 1089 //Add code for Save Draft Content
1062   - if ($rootScope.contentEleNote.length == 0) {
1063   - $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;
  1090 + if ($rootScope.contentNotesForSaveCB.length == 0) {
  1091 + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;
1064 1092 }
1065 1093 $scope.DropDownSelectNodeClick(nodeid);
1066   - console.log("summary" + JSON.stringify($rootScope.cbDynamicJsonData));
  1094 + console.log("Structure:" + JSON.stringify($rootScope.structureObjForSaveCB));
  1095 + console.log("Notes:" + JSON.stringify($rootScope.contentNotesForSaveCB));
1067 1096 }, 100);
1068 1097 $rootScope.closeRenameModel();
1069 1098 }
... ... @@ -1121,7 +1150,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1121 1150 else {
1122 1151 $rootScope.cbBack();
1123 1152 }
1124   - $scope.deleteSectionForCB(cbCurrentSelectedId, CurrentSelectedParentSpanId);
  1153 + //$scope.deleteSectionForCB(cbCurrentSelectedId, CurrentSelectedParentSpanId);
1125 1154 $scope.DeleteSlide(cbCurrentSelectedId, CurrentSelectedParentSpanId);
1126 1155 var CurrentId = document.getElementById('cbSelect').value;
1127 1156 $scope.DropDownSelectNodeClick(CurrentId);
... ... @@ -1270,53 +1299,72 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1270 1299  
1271 1300 $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) {
1272 1301  
1273   - if ($rootScope.saveDraftSingleObj.length == 0) {
1274   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1275   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1302 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1303 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  1304 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1305 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1276 1306 }
1277   - if ($rootScope.contentEleNote.length == 0) {
1278   - //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
1279   - $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents
  1307 + if ($rootScope.contentNotesForSaveCB.length == 0) {
  1308 + //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element;
  1309 + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents
1280 1310 }
1281   - traverse($rootScope.stru, currentid);
1282   - for (var j = 0; j < $rootScope.saveDraftSingleObj.length; j++) {
1283   - //if (($rootScope.saveDraftSingleObj[j]._id == currentid)) {
1284   - if ($rootScope.saveDraftSingleObj[j]._id == currentid && $rootScope.saveDraftSingleObj[j]._isBranch == "true") {
1285   - traverseTreeSelectedSingleObj($rootScope.stru, currentid);
1286   - traverse($rootScope.stru, currentid);
1287   - var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
1288   -
1289   - //if ($rootScope.saveDraftSingleObj[j]['structure'].length > 0) {
1290   - if (childNodesForSelectedSection.length > 0) {
1291   - for (var l = 0; l < childNodesForSelectedSection.length; l++) {
1292   - var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node
1293   - for (var k = 0; k < $rootScope.contentEleNote.length; k++) {
1294   - if (($rootScope.contentEleNote[k]._id == childId)) {
1295   - $rootScope.contentEleNote.splice(k, 1);
  1311 + traverseTreeSelectedSingleObj($rootScope.structureObjForSaveCB, currentid);
  1312 + if ($scope.selectedNodeSingleObj._isBranch == "true") {
  1313 + for (var j = 0; j < $scope.selectedNodeSingleObj['structure'].length; j++) {
  1314 + if ($scope.selectedNodeSingleObj._id == currentid) {
  1315 + var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
  1316 +
  1317 + if (childNodesForSelectedSection.length > 0) {
  1318 +
  1319 + for (var l = 0; l < childNodesForSelectedSection.length; l++) {
  1320 + var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node
  1321 + for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) {
  1322 + if (($rootScope.contentNotesForSaveCB[k]._id == childId)) {
  1323 + $rootScope.contentNotesForSaveCB.splice(k, 1);
  1324 + }
1296 1325 }
1297 1326 }
1298   - }
  1327 + }
1299 1328 }
1300   - $rootScope.saveDraftSingleObj.splice(j, 1);
  1329 + $scope.selectedNodeSingleObj['structure'].splice(j, 1);
  1330 + //$rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1301 1331 }
1302   - }
  1332 + }
  1333 +
  1334 + //traverse($rootScope.stru, currentid);
  1335 + //for (var j = 0; j < $rootScope.structureObjForSaveCB.length; j++) {
  1336 + // //if (($rootScope.structureObjForSaveCB[j]._id == currentid)) {
  1337 + // if ($rootScope.structureObjForSaveCB[j]._id == currentid && $rootScope.structureObjForSaveCB[j]._isBranch == "true") {
  1338 + // traverseTreeSelectedSingleObj($rootScope.stru, currentid);
  1339 + // traverse($rootScope.stru, currentid);
  1340 + // var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
  1341 +
  1342 + // //if ($rootScope.structureObjForSaveCB[j]['structure'].length > 0) {
  1343 + // if (childNodesForSelectedSection.length > 0) {
  1344 + // for (var l = 0; l < childNodesForSelectedSection.length; l++) {
  1345 + // var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node
  1346 + // for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) {
  1347 + // if (($rootScope.contentNotesForSaveCB[k]._id == childId)) {
  1348 + // $rootScope.contentNotesForSaveCB.splice(k, 1);
  1349 + // }
  1350 + // }
  1351 + // }
  1352 + // }
  1353 + // $rootScope.structureObjForSaveCB.splice(j, 1);
  1354 + // }
  1355 + //}
1303 1356  
1304   - for (var k = 0; k < $rootScope.contentEleNote.length; k++) {
1305   - if (($rootScope.contentEleNote[k]._id == currentid)) {
1306   - $rootScope.contentEleNote.splice(k, 1);
1307   - }
1308   - }
  1357 +
1309 1358  
1310 1359 //Delete notes for SavedraftCB as per Selected Section from tree
1311   - var deleteNotes = $rootScope.contentEleNote
  1360 + var deleteNotes = $rootScope.contentNotesForSaveCB
1312 1361 var remaingNotesForCB = new jinqJs()
1313 1362 .from(deleteNotes)
1314 1363 .delete().at("_id == " + currentid).select();
1315   - $rootScope.contentEleNote = remaingNotesForCB;
  1364 + $rootScope.contentNotesForSaveCB = remaingNotesForCB;
1316 1365  
1317   - $rootScope.contentEleNote = $rootScope.cbDynamicContents;
1318   - console.log($rootScope.contentEleNote);
1319   - console.log($rootScope.saveDraftSingleObj);
  1366 + //$rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;
  1367 +
1320 1368 }
1321 1369  
1322 1370 function getLoadNodeId(o) {
... ... @@ -1332,76 +1380,195 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1332 1380 }
1333 1381  
1334 1382 $scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) {
1335   - if ($rootScope.saveDraftSingleObj.length == 0) {
1336   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1337   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1383 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1384 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  1385 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1386 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1338 1387 }
1339   - if ($rootScope.contentEleNote.length == 0) {
1340   - //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
1341   - $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents
  1388 + if ($rootScope.contentNotesForSaveCB.length == 0) {
  1389 + //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element;
  1390 + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents
1342 1391 }
  1392 +
1343 1393 traverse($rootScope.stru, currentid);
  1394 +
  1395 + for (var j = 0; j < $rootScope.structureObjForSaveCB.length; j++) {
  1396 + //if (($rootScope.structureObjForSaveCB[j]._id == currentid)) {
  1397 + if ($rootScope.structureObjForSaveCB[j]._id == currentid && $rootScope.structureObjForSaveCB[j]._isBranch == "true") {
  1398 + traverseTreeSelectedSingleObj($rootScope.stru, currentid);
  1399 + traverse($rootScope.stru, currentid);
  1400 + var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
  1401 +
  1402 + //if ($rootScope.structureObjForSaveCB[j]['structure'].length > 0) {
  1403 + if (childNodesForSelectedSection.length > 0) {
  1404 + for (var l = 0; l < childNodesForSelectedSection.length; l++) {
  1405 + var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node
  1406 + for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) {
  1407 + if (($rootScope.contentNotesForSaveCB[k]._id == childId)) {
  1408 + $rootScope.contentNotesForSaveCB.splice(k, 1);
  1409 + }
  1410 + }
  1411 + }
  1412 + }
  1413 + $rootScope.structureObjForSaveCB.splice(j, 1);
  1414 + }
  1415 + }
  1416 +
1344 1417 for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
1345 1418 if (($scope.selectedNodeSiblingObjs[j]._id == currentid)) {
1346 1419 $scope.selectedNodeSiblingObjs.splice(j, 1);
1347 1420  
1348   - $rootScope.saveDraftSingleObj = $rootScope.structure;
1349   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1421 + //$rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
  1422 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
1350 1423  
1351 1424 //Added Code by Sandeep for Delete slide from node tree for save draft CB
1352   - for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) {
1353   - if (($rootScope.saveDraftSingleObj[x]._id == CurrentSelectedParentSpanId)) {
1354   - for (var y = 0; y < $rootScope.saveDraftSingleObj[x]['structure'].length; y++) {
1355   - if ($rootScope.saveDraftSingleObj[x]['structure'][y]._id == currentid) {
1356   - $rootScope.saveDraftSingleObj[x]['structure'].splice(y, 1);
1357   - }
1358   - else {
1359   - $rootScope.saveDraftSingleObj = $rootScope.structure;
1360   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
1361   - }
  1425 + for (var x = 0; x < $rootScope.structureObjForSaveCB.length; x++) {
  1426 + if (($rootScope.structureObjForSaveCB[x]._id == CurrentSelectedParentSpanId)) {
  1427 + for (var y = 0; y < $rootScope.structureObjForSaveCB[x]['structure'].length; y++) {
  1428 + if ($rootScope.structureObjForSaveCB[x]['structure'][y]._id == currentid) {
  1429 + $rootScope.structureObjForSaveCB[x]['structure'].splice(y, 1);
  1430 + }
1362 1431 }
1363 1432 }
1364 1433 }
1365 1434 }
1366 1435 }
1367   -
  1436 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
  1437 + //traverseTreeSelectedSingleObj($rootScope.structureObjForSaveCB, currentid);
  1438 + //if ($scope.selectedNodeSingleObj._isBranch == "true") {
  1439 + // for (var j = 0; j < $scope.selectedNodeSingleObj['structure'].length; j++) {
  1440 + // if ($scope.selectedNodeSingleObj._id == currentid) {
  1441 + // var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
  1442 +
  1443 + // if (childNodesForSelectedSection.length > 0) {
  1444 +
  1445 + // for (var l = 0; l < childNodesForSelectedSection.length; l++) {
  1446 + // var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node
  1447 + // for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) {
  1448 + // if (($rootScope.contentNotesForSaveCB[k]._id == childId)) {
  1449 + // $rootScope.contentNotesForSaveCB.splice(k, 1);
  1450 + // }
  1451 + // }
  1452 + // }
  1453 + // }
  1454 + // }
  1455 + // $scope.selectedNodeSingleObj['structure'].splice(j, 1);
  1456 + // //$rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
  1457 + // }
  1458 + //}
  1459 +
1368 1460 //Delete notes for SavedraftCB as per Selected Slide from tree
1369   - var deleteNotes = $rootScope.contentEleNote
  1461 + var deleteNotes = $rootScope.contentNotesForSaveCB
1370 1462 var remaingNotesForCB = new jinqJs()
1371 1463 .from(deleteNotes)
1372 1464 .delete().at("_id == " + currentid).select();
1373   - $rootScope.contentEleNote = remaingNotesForCB;
1374   - // prune($rootScope.stru, currentid);
1375   - // alert("After" + JSON.stringify($rootScope.stru));
1376   -
1377   - console.log($rootScope.contentEleNote);
1378   - console.log($rootScope.saveDraftSingleObj);
  1465 + $rootScope.contentNotesForSaveCB = remaingNotesForCB;
  1466 +
  1467 + //alert("After" + JSON.stringify($rootScope.stru));
  1468 + console.log($rootScope.structureObjForSaveCB);
  1469 + console.log($rootScope.contentNotesForSaveCB);
1379 1470 }
1380 1471  
1381 1472 $rootScope.saveCurricullam = function (file_Name) {
1382 1473 $scope.exportToFile(file_Name);
1383 1474 }
1384 1475  
1385   - $rootScope.exportToFile = function () {
1386   - if ($('.mce-content-body p ul li span').length > 0) {
1387   - $('.mce-content-body p ul li span').each(function () {
1388   - var sandytest = $(this).text();
1389   - var test = $(this).attr('text');
1390   - console.log(sandytest);
1391   - });
  1476 +
  1477 +
  1478 + $rootScope.updatedContentFromEditor = function (cbCurrentId) {
  1479 +
  1480 + var windowsInSelectedSlide; var notesForSelectedSlide;
  1481 + var contentWindowsNotes = $rootScope.contentNotesForSaveCB
  1482 + var selectedSlideContent = new jinqJs()
  1483 + .from(contentWindowsNotes)
  1484 + .where("_id == " + cbCurrentId)
  1485 + .select();
  1486 + if (selectedSlideContent.length > 0) {
  1487 + windowsInSelectedSlide = selectedSlideContent[0].windows;
  1488 + notesForSelectedSlide = tinyMCE.activeEditor.getContent();
  1489 + if (notesForSelectedSlide == "" || notesForSelectedSlide == undefined) {
  1490 + notesForSelectedSlide = selectedSlideContent[0].notes;
  1491 + }
1392 1492 }
1393   -
1394   -
1395   - var cbCurrentId = document.getElementById('cbSelect').value;
  1493 + else {
  1494 + windowsInSelectedSlide = "";
  1495 + notesForSelectedSlide = tinyMCE.activeEditor.getContent();
  1496 + }
  1497 +
  1498 + //Delete notes for SavedraftCB as per Selected Section from tree
  1499 + var remaingNotesForCB = new jinqJs()
  1500 + .from(contentWindowsNotes)
  1501 + .delete().at("_id == " + cbCurrentId).select();
  1502 + $rootScope.contentNotesForSaveCB = remaingNotesForCB;
  1503 +
  1504 + traverseTreeSelectedSingleObj($rootScope.Auther, nodeid);
  1505 + //traverseTreeSelectedSingleObj($rootScope.contentNotesForSaveCB, cbCurrentId);
  1506 + //$scope.selectedNodeSingleObj.summary
  1507 + //$scope.selectedNodeSingleObj.author
  1508 + //$scope.selectedNodeSingleObj.version
  1509 + //$scope.selectedNodeSingleObj.modified
  1510 + if ($scope.selectedNodeSingleObj._isBranch == "false") {
  1511 + $rootScope.contentNotesForSaveCB.push(
  1512 + {
  1513 + "notes": notesForSelectedSlide,
  1514 + "windows": windowsInSelectedSlide,
  1515 + "_id": cbCurrentId
  1516 + });
  1517 + }
  1518 + else if ($scope.selectedNodeSingleObj._isBranch == "true") {
  1519 + $rootScope.contentNotesForSaveCB.push(
  1520 + {
  1521 + "summary": $scope.selectedNodeSingleObj.summary,
  1522 + "author": $scope.selectedNodeSingleObj.author,
  1523 + "modified": $scope.selectedNodeSingleObj.modified,
  1524 + "password": "",
  1525 + "version": $scope.selectedNodeSingleObj.version ,
  1526 + "windows": windowsInSelectedSlide,
  1527 + "_id": cbCurrentId
  1528 + //"notes": notesForSelectedSlide,
  1529 + //"windows": windowsInSelectedSlide,
  1530 + //"_id": cbCurrentId
  1531 + });
  1532 + }
  1533 + else if ($scope.selectedNodeSingleObj._isBranch == "true" && $scope.selectedNodeSingleObj._isRoot == "true") {
  1534 + $rootScope.contentNotesForSaveCB.push(
  1535 + {
  1536 + "windows": windowsInSelectedSlide,
  1537 + "summary": $scope.selectedNodeSingleObj.summary,
  1538 + "author": $scope.selectedNodeSingleObj.author,
  1539 + "modified": $scope.selectedNodeSingleObj.modified,
  1540 + "password": "",
  1541 + "version": $scope.selectedNodeSingleObj.version,
  1542 + "_id": cbCurrentId
  1543 + //"notes": notesForSelectedSlide,
  1544 + //"windows": windowsInSelectedSlide,
  1545 + //"_id": cbCurrentId
  1546 + });
  1547 + }
  1548 + $rootScope.cbDynamicContents = $rootScope.contentNotesForSaveCB;
  1549 + $rootScope.note = $rootScope.contentNotesForSaveCB;
  1550 +
  1551 + console.log($rootScope.contentNotesForSaveCB);
  1552 + //console.log(tinyMCE.activeEditor.getContent());
  1553 + //console.log($('#CBTextArea_ifr')[0].contentDocument.body.innerHTML);
  1554 +
  1555 + }
1396 1556  
1397   - if ($rootScope.saveDraftSingleObj.length == 0) {
1398   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1399   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1557 +
  1558 + $rootScope.exportToFile = function () {
  1559 +
  1560 + var cbCurrentId = document.getElementById('cbSelect').value;
  1561 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1562 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  1563 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1564 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1400 1565 }
1401   - if ($rootScope.contentEleNote.length == 0) {
1402   - //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
1403   - $rootScope.contentEleNote = $rootScope.cbDynamicContents;//Assign Dnamic Contents
  1566 + if ($rootScope.contentNotesForSaveCB.length == 0) {
  1567 + //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element;
  1568 + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents
1404 1569 }
  1570 + $rootScope.updatedContentFromEditor(cbCurrentId);
  1571 +
1405 1572 $rootScope.dynamicUpdatedJsonForSaveCB =
1406 1573 {
1407 1574 "slideshow": {
... ... @@ -1409,7 +1576,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1409 1576 "structure": {
1410 1577 "structure": //[
1411 1578  
1412   - $rootScope.saveDraftSingleObj,
  1579 + $rootScope.structureObjForSaveCB,
1413 1580 //],
1414 1581 "_label": $rootScope.cbTreeFirstLabel,
1415 1582 "_id": $rootScope.cbTreeFirstID,
... ... @@ -1419,13 +1586,13 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1419 1586 },
1420 1587 "_anchor": "true",
1421 1588 "_window_position": "6,10",
1422   - "_window_size": "828,453"
  1589 + "_window_size": "828,453" // Apply Dynamic
1423 1590 },
1424 1591 "content": {
1425   - "element": [
  1592 + "element": //[
1426 1593  
1427   - $rootScope.contentEleNote,
1428   - ]
  1594 + $rootScope.contentNotesForSaveCB,
  1595 + //]
1429 1596 }
1430 1597 }
1431 1598  
... ... @@ -1434,23 +1601,23 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1434 1601 $scope.slideshow = $rootScope.dynamicUpdatedJsonForSaveCB;
1435 1602 $scope.filename = "SandySaveCB.json";
1436 1603 var filename = $scope.filename;
1437   - //var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' });
1438   - //if (window.navigator && window.navigator.msSaveOrOpenBlob) {
1439   - // window.navigator.msSaveOrOpenBlob(blob, filename);
1440   - //}
1441   - //else {
1442   - // var e = document.createEvent('MouseEvents'),
1443   - // a = document.createElement('a');
1444   - // a.download = filename;
1445   - // a.href = window.URL.createObjectURL(blob);
1446   - // a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');
1447   - // e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1448   - // a.dispatchEvent(e);
1449   - // // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource
1450   - //}
  1604 + var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' });
  1605 + if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  1606 + window.navigator.msSaveOrOpenBlob(blob, filename);
  1607 + }
  1608 + else {
  1609 + var e = document.createEvent('MouseEvents'),
  1610 + a = document.createElement('a');
  1611 + a.download = filename;
  1612 + a.href = window.URL.createObjectURL(blob);
  1613 + a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');
  1614 + e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  1615 + a.dispatchEvent(e);
  1616 + // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource
  1617 + }
1451 1618 $rootScope.dynamicUpdatedJsonForSaveCB = "";
1452   - //$rootScope.contentEleNote = [];
1453   - //$rootScope.saveDraftSingleObj = [];
  1619 + //$rootScope.contentNotesForSaveCB = [];
  1620 + //$rootScope.structureObjForSaveCB = [];
1454 1621  
1455 1622 // $http({ method: 'Post', url: $scope.fileName }).success(function (data) {
1456 1623 // localStorage.setItem("cbJsonDataObject", JSON.stringify(data));
... ... @@ -1469,9 +1636,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1469 1636  
1470 1637 $scope.addSection = function (currentid, AddSecionId) {
1471 1638  
1472   - if ($rootScope.saveDraftSingleObj.length == 0) {
1473   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1474   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1639 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1640 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  1641 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1642 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1475 1643 }
1476 1644  
1477 1645 traverseTreeSelectedSingleObj($rootScope.stru, currentid);
... ... @@ -1490,7 +1658,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1490 1658 }
1491 1659  
1492 1660 });
1493   - $rootScope.saveDraftSingleObj.push(
  1661 + $rootScope.structureObjForSaveCB.push(
1494 1662 {
1495 1663 "structure": [
1496 1664 ],
... ... @@ -1513,33 +1681,34 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1513 1681 "_isBranch": "true",
1514 1682 "_isLocked": "false"
1515 1683 });
1516   - if (currentid == $rootScope.cbTreeFirstID) {
1517   - $rootScope.saveDraftSingleObj.push(
1518   - {
1519   - "structure": [
1520   - ],
1521   - "_label": "New Section",
1522   - "_id": AddSecionId,
1523   - "_isRoot": "false",
1524   - "_isBranch": "true",
1525   - "_isLocked": "false"
1526   - });
1527   - }
1528   - else {
1529   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
1530   - if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
1531   - $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1684 + //if (currentid == $rootScope.cbTreeFirstID) {
  1685 + // $rootScope.structureObjForSaveCB.push(
  1686 + // {
  1687 + // "structure": [
  1688 + // ],
  1689 + // "_label": "New Section",
  1690 + // "_id": AddSecionId,
  1691 + // "_isRoot": "false",
  1692 + // "_isBranch": "true",
  1693 + // "_isLocked": "false"
  1694 + // });
  1695 + //}
  1696 + //else {
  1697 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  1698 + if ($rootScope.structureObjForSaveCB[i]._id == currentid) {
  1699 + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
1532 1700 }
1533 1701 }
1534   - }
  1702 + //}
1535 1703 }
1536 1704 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500);
1537 1705 }
1538 1706  
1539 1707 $scope.addSlide = function (currentid, AddSlideId) {
1540   - if ($rootScope.saveDraftSingleObj.length == 0) {
1541   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1542   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  1708 + if ($rootScope.structureObjForSaveCB.length == 0) {
  1709 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  1710 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  1711 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1543 1712 }
1544 1713 traverseTreeSelectedSingleObj($rootScope.stru, currentid);
1545 1714 // traverse($rootScope.stru, currentid);
... ... @@ -1553,7 +1722,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1553 1722 "_isBranch": "false",
1554 1723 "_isLocked": "false"
1555 1724 });
1556   - $rootScope.saveDraftSingleObj.push({
  1725 + $rootScope.structureObjForSaveCB.push({
1557 1726 "_label": "NEW Slide1",
1558 1727 "_id": AddSlideId,
1559 1728 "_isRoot": "false",
... ... @@ -1569,22 +1738,22 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1569 1738 "_isBranch": "false",
1570 1739 "_isLocked": "false"
1571 1740 });
1572   - if (currentid == $rootScope.cbTreeFirstID) {
1573   - $rootScope.saveDraftSingleObj.push({
1574   - "_label": "New Slide",
1575   - "_id": AddSlideId,
1576   - "_isRoot": "false",
1577   - "_isBranch": "false",
1578   - "_isLocked": "false"
1579   - });
1580   - }
1581   - else {
1582   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
1583   - if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
1584   - $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1741 + //if (currentid == $rootScope.cbTreeFirstID) {
  1742 + // $rootScope.structureObjForSaveCB.push({
  1743 + // "_label": "New Slide",
  1744 + // "_id": AddSlideId,
  1745 + // "_isRoot": "false",
  1746 + // "_isBranch": "false",
  1747 + // "_isLocked": "false"
  1748 + // });
  1749 + //}
  1750 + //else {
  1751 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  1752 + if ($rootScope.structureObjForSaveCB[i]._id == currentid) {
  1753 + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
1585 1754 }
1586 1755 }
1587   - }
  1756 + //}
1588 1757 }
1589 1758 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000);
1590 1759 setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100);
... ... @@ -1622,7 +1791,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1622 1791 break;
1623 1792 }
1624 1793 }
1625   - $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure;
  1794 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1626 1795 }
1627 1796  
1628 1797 $scope.moveUP = function (currentid) {
... ... @@ -1637,7 +1806,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1637 1806 $scope.selectedNodeSiblingObjs[j - 1] = key;
1638 1807 }
1639 1808 }
1640   - $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure;
  1809 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1641 1810 //console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs));
1642 1811 //console.log("stru after" + JSON.stringify($rootScope.stru));
1643 1812 //console.log("structure after" + JSON.stringify($rootScope.structure));
... ... @@ -1964,12 +2133,13 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1964 2133  
1965 2134 $scope.addSectionForSaveDraft = function (currentid, AddSecionId, parentid) {
1966 2135  
1967   - if ($rootScope.saveDraftSingleObj.length == 0) {
1968   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1969   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  2136 + if ($rootScope.structureObjForSaveCB.length == 0) {
  2137 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  2138 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  2139 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
1970 2140 }
1971   - //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array
1972   - //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  2141 + //$rootScope.structureObjForSaveCB = $rootScope.stru;//All json Structure with tree array
  2142 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
1973 2143 //$rootScope.updateSaveDraftDynamicTest = [];
1974 2144  
1975 2145 traverseTreeSelectedSingleObj($rootScope.stru, currentid);
... ... @@ -1996,7 +2166,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1996 2166  
1997 2167 });
1998 2168  
1999   - $rootScope.saveDraftSingleObj.push(
  2169 + $rootScope.structureObjForSaveCB.push(
2000 2170 {
2001 2171  
2002 2172 "structure": [
... ... @@ -2022,7 +2192,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
2022 2192 // "_isLocked": "false"
2023 2193 // });
2024 2194  
2025   - // $rootScope.saveDraftSingleObj.push(
  2195 + // $rootScope.structureObjForSaveCB.push(
2026 2196 // {
2027 2197 // "structure": {
2028 2198 // "structure": [
... ... @@ -2047,9 +2217,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
2047 2217 "_isLocked": "false"
2048 2218 });
2049 2219  
2050   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
2051   - if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
2052   - $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  2220 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  2221 + if ($rootScope.structureObjForSaveCB[i]._id == currentid) {
  2222 + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
2053 2223 }
2054 2224 }
2055 2225 }
... ... @@ -2059,9 +2229,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
2059 2229  
2060 2230 $scope.addSlideForSaveDraft = function (currentid, AddSlideId, parentid) {
2061 2231  
2062   - if ($rootScope.saveDraftSingleObj.length == 0) {
2063   - $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
2064   - //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
  2232 + if ($rootScope.structureObjForSaveCB.length == 0) {
  2233 + //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array
  2234 + //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure;
  2235 + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure;
2065 2236 }
2066 2237 traverseTreeSelectedSingleObj($rootScope.stru, currentid);
2067 2238 //traverse($rootScope.stru, currentid);
... ... @@ -2079,16 +2250,16 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
2079 2250 "_isLocked": "false"
2080 2251 });
2081 2252  
2082   - $rootScope.saveDraftSingleObj.push({
  2253 + $rootScope.structureObjForSaveCB.push({
2083 2254 "_label": "NEW Slide1",
2084 2255 "_id": AddSlideId,
2085 2256 "_isRoot": "false",
2086 2257 "_isBranch": "false",
2087 2258 "_isLocked": "false"
2088 2259 });
2089   - //for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
2090   - // if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
2091   - // $rootScope.saveDraftSingleObj[i] = $rootScope.selectedNodeSingle;
  2260 + //for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  2261 + // if ($rootScope.structureObjForSaveCB[i]._id == currentid) {
  2262 + // $rootScope.structureObjForSaveCB[i] = $rootScope.selectedNodeSingle;
2092 2263 // }
2093 2264 //}
2094 2265 }
... ... @@ -2100,9 +2271,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
2100 2271 "_isBranch": "false",
2101 2272 "_isLocked": "false"
2102 2273 });
2103   - for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
2104   - if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
2105   - $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  2274 + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) {
  2275 + if ($rootScope.structureObjForSaveCB[i]._id == currentid) {
  2276 + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
2106 2277 }
2107 2278 }
2108 2279 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/CBuild/curriculum-builder-TinyMCEjspanel.html
... ... @@ -66,7 +66,7 @@
66 66 <script type="text/javascript">
67 67  
68 68 $(document).ready(function () {
69   -
  69 + tinymce.remove();
70 70 tinymce.init({
71 71 selector: "#CBTextArea",
72 72 init_instance_callback: function (editor) {
... ...