Commit 796ca94a0c4116fcb42fe0b3a25e364d1b75f3f0

Authored by Sandeep Kumar
1 parent f1cdcfd1

Add slide for Save draft CB

400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js
@@ -348,7 +348,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -348,7 +348,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
348 while ($scope.searchAIListViewData.length) { 348 while ($scope.searchAIListViewData.length) {
349 $scope.searchAIListViewData.pop(); 349 $scope.searchAIListViewData.pop();
350 } 350 }
351 - //$scope.loadAllAI(ImageCount); 351 + $scope.loadAllAI(ImageCount);
352 } 352 }
353 353
354 $scope.ApplySearch = function (query) { 354 $scope.ApplySearch = function (query) {
400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
@@ -9,6 +9,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -9,6 +9,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
9 $scope.countRightlist; 9 $scope.countRightlist;
10 $rootScope.selectedNodeSingle = []; 10 $rootScope.selectedNodeSingle = [];
11 $scope.selectedNodeSingleObj = []; 11 $scope.selectedNodeSingleObj = [];
  12 + $rootScope.saveDraftSingleObj = [];
  13 + $rootScope.saveDraftDynamicTest = [];
  14 + $rootScope.updateSaveDraftCB = [];
12 $scope.IsVisible = function () { 15 $scope.IsVisible = function () {
13 $scope.scroll(); 16 $scope.scroll();
14 } 17 }
@@ -207,82 +210,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -207,82 +210,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
207 210
208 } 211 }
209 212
210 - $rootScope.exportToFile = function () {  
211 -  
212 - for (var i = 0; i < $rootScope.structure.length; i++) {  
213 -  
214 - }  
215 - $rootScope.selectedNodeSingle.push(  
216 - {  
217 - "slideshow": {  
218 - "presentation": {  
219 - "structure": {  
220 - "structure": [  
221 - {  
222 - "_label": "Untitled Slide",  
223 - "_id": "-1507902782",  
224 - "_isRoot": "false",  
225 - "_isBranch": "false",  
226 - "_isLocked": "false"  
227 - }  
228 -  
229 - ],  
230 - "_label": "Untitled Curriculum",  
231 - "_id": "-225638207",  
232 - "_isRoot": "true",  
233 - "_isBranch": "true",  
234 - "_isLocked": "false"  
235 - },  
236 - "_anchor": "true",  
237 - "_window_position": "6,10",  
238 - "_window_size": "828,453"  
239 - },  
240 - "content": {  
241 - "element": [  
242 - {  
243 - "notes": "<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT>",  
244 - "windows": {  
245 - "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}}"  
246 - },  
247 - "_id": "-1507902782"  
248 - }  
249 - ]  
250 - }  
251 - }  
252 - });  
253 -  
254 - $scope.filename = "filename.json";  
255 - var filename = $scope.filename;  
256 - var blob = new Blob([angular.toJson($rootScope.selectedNodeSingle, true)], { type: 'text/text' });  
257 - if (window.navigator && window.navigator.msSaveOrOpenBlob) {  
258 - window.navigator.msSaveOrOpenBlob(blob, filename);  
259 - } else {  
260 - var e = document.createEvent('MouseEvents'),  
261 - a = document.createElement('a');  
262 - a.download = filename;  
263 - a.href = window.URL.createObjectURL(blob);  
264 - a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');  
265 - e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);  
266 - a.dispatchEvent(e);  
267 - // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource  
268 - }  
269 - $http({ method: 'Post', url: $scope.fileName }).success(function (data) {  
270 - localStorage.setItem("cbJsonDataObject", JSON.stringify(data));  
271 - $rootScope.cbJsonData = JSON.parse(localStorage.getItem("cbJsonDataObject"));  
272 - $rootScope.cbDynamicJsonData = data;  
273 - //$scope.getCBsummary();  
274 - $rootScope.cbJsonData.slideshow.content.element = "Eement data";  
275 - $rootScope.cbDynamicJsonData.slideshow.content.element = "slideshow element data";  
276 - $rootScope.note = "save data"  
277 - //$scope.openCurriculumDetail();  
278 - })  
279 - .error(function (data, status, headers, config) {  
280 - console.log(data);  
281 - });  
282 - }; 213 +
283 214
284 $rootScope.saveCurricullam = function (file_Name) { 215 $rootScope.saveCurricullam = function (file_Name) {
285 - 216 + $scope.exportToFile();
286 $scope.selectedNodeSingleObj.push( 217 $scope.selectedNodeSingleObj.push(
287 { 218 {
288 "slideshow": { 219 "slideshow": {
@@ -972,7 +903,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -972,7 +903,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
972 else { 903 else {
973 $rootScope.cbBack(); 904 $rootScope.cbBack();
974 } 905 }
975 - $scope.DeleteSlide(cbCurrentSelectedId); 906 + $scope.deleteSectionForCB(cbCurrentSelectedId, CurrentSelectedParentSpanId);
  907 + $scope.DeleteSlide(cbCurrentSelectedId, CurrentSelectedParentSpanId);
976 var CurrentId = document.getElementById('cbSelect').value; 908 var CurrentId = document.getElementById('cbSelect').value;
977 $scope.DropDownSelectNodeClick(CurrentId); 909 $scope.DropDownSelectNodeClick(CurrentId);
978 $rootScope.closeDeleteModel(); 910 $rootScope.closeDeleteModel();
@@ -1036,6 +968,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1036,6 +968,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1036 968
1037 }); 969 });
1038 } 970 }
  971 +
1039 $rootScope.CBAddSection = function () { 972 $rootScope.CBAddSection = function () {
1040 var current_id 973 var current_id
1041 if (($rootScope.getLocalStorageValue("cbSelectId")) != '') { 974 if (($rootScope.getLocalStorageValue("cbSelectId")) != '') {
@@ -1120,31 +1053,65 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1120,31 +1053,65 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1120 1053
1121 } 1054 }
1122 1055
  1056 + $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) {
1123 1057
  1058 + if ($rootScope.saveDraftSingleObj.length == 0) {
  1059 + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  1060 + }
  1061 + traverse($rootScope.stru, currentid);
  1062 + for (var j = 0; j < $scope.saveDraftSingleObj.length; j++) {
  1063 + if (($scope.saveDraftSingleObj[j]._id == currentid)) {
  1064 + $scope.saveDraftSingleObj.splice(j, 1);
  1065 + }
  1066 + }
  1067 + console.log($scope.saveDraftSingleObj);
  1068 + }
1124 1069
1125 - $scope.DeleteSlide = function (currentid) { 1070 + $scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) {
1126 1071
  1072 + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
1127 traverse($rootScope.stru, currentid); 1073 traverse($rootScope.stru, currentid);
1128 for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { 1074 for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
1129 1075
1130 if (($scope.selectedNodeSiblingObjs[j]._id == currentid)) { 1076 if (($scope.selectedNodeSiblingObjs[j]._id == currentid)) {
1131 $scope.selectedNodeSiblingObjs.splice(j, 1); 1077 $scope.selectedNodeSiblingObjs.splice(j, 1);
  1078 +
  1079 + //Added Code by Sandeep for Delete slide from node tree for save draft CB
  1080 + for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) {
  1081 + if (($rootScope.saveDraftSingleObj[x]._id == CurrentSelectedParentSpanId)) {
  1082 + for (var y = 0; y < $rootScope.saveDraftSingleObj[x]['structure'].length; y++) {
  1083 + if ($rootScope.saveDraftSingleObj[x]['structure'][y]._id == currentid) {
  1084 + $rootScope.saveDraftSingleObj[x]['structure'].splice(y, 1);
  1085 + }
  1086 + }
  1087 + }
  1088 + }
1132 } 1089 }
1133 1090
  1091 +
1134 } 1092 }
1135 // prune($rootScope.stru, currentid); 1093 // prune($rootScope.stru, currentid);
1136 // alert("After" + JSON.stringify($rootScope.stru)); 1094 // alert("After" + JSON.stringify($rootScope.stru));
1137 - 1095 +
  1096 +
1138 } 1097 }
  1098 +
1139 $scope.addSection = function (currentid, AddSecionId) { 1099 $scope.addSection = function (currentid, AddSecionId) {
1140 - traverseTreeSelectedSingleObj($rootScope.stru, currentid);  
1141 1100
1142 - traverse($rootScope.stru, currentid); 1101 + if ($rootScope.saveDraftSingleObj.length == 0) {
  1102 + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  1103 + }
  1104 + //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array
  1105 + //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  1106 + //$rootScope.updateSaveDraftDynamicTest = [];
1143 1107
1144 - if (currentid == "-225638207") { 1108 + traverseTreeSelectedSingleObj($rootScope.stru, currentid);
  1109 + traverse($rootScope.stru, currentid);
  1110 + //if (currentid == "-225638207") {
  1111 + if($rootScope.cbTreeFirstID == currentid){
1145 $rootScope.selectedNodeSingle.push( 1112 $rootScope.selectedNodeSingle.push(
1146 - {  
1147 - "structure": { 1113 + {
  1114 + "structure": {
1148 "structure": [ 1115 "structure": [
1149 //{ 1116 //{
1150 // "_label": "NEW ", 1117 // "_label": "NEW ",
@@ -1159,9 +1126,22 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1159,9 +1126,22 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1159 "_isRoot": "false", 1126 "_isRoot": "false",
1160 "_isBranch": "true", 1127 "_isBranch": "true",
1161 "_isLocked": "false" 1128 "_isLocked": "false"
1162 - }  
1163 -  
1164 - }); 1129 + }
  1130 +
  1131 + });
  1132 +
  1133 + $rootScope.saveDraftSingleObj.push(
  1134 + {
  1135 + "structure": {
  1136 + "structure": [
  1137 + ],
  1138 + "_label": "New Section",
  1139 + "_id": AddSecionId,
  1140 + "_isRoot": "false",
  1141 + "_isBranch": "true",
  1142 + "_isLocked": "false"
  1143 + }
  1144 + });
1165 } 1145 }
1166 else { 1146 else {
1167 $scope.selectedNodeSingleObj['structure'].push( 1147 $scope.selectedNodeSingleObj['structure'].push(
@@ -1181,15 +1161,34 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1181,15 +1161,34 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1181 "_isBranch": "true", 1161 "_isBranch": "true",
1182 "_isLocked": "false" 1162 "_isLocked": "false"
1183 }); 1163 });
  1164 +
  1165 + for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
  1166 + if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
  1167 + $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1168 + }
  1169 + }
1184 } 1170 }
1185 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500); 1171 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500);
1186 1172
1187 } 1173 }
  1174 +
1188 $scope.addSlide = function (currentid, AddSlideId) { 1175 $scope.addSlide = function (currentid, AddSlideId) {
  1176 +
  1177 + if ($rootScope.saveDraftSingleObj.length == 0) {
  1178 + $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  1179 + }
  1180 + //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array
  1181 + //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
  1182 + //$rootScope.updateSaveDraftDynamicTest = [];
  1183 +
  1184 +
1189 traverseTreeSelectedSingleObj($rootScope.stru, currentid); 1185 traverseTreeSelectedSingleObj($rootScope.stru, currentid);
1190 - // traverse($rootScope.stru, currentid); 1186 + traverse($rootScope.stru, currentid);
  1187 + //Assign object by traverse method $scope.selectedNodeSiblingObjs
  1188 +
1191 //console.log(JSON.stringify($scope.upDateJsonObj)) 1189 //console.log(JSON.stringify($scope.upDateJsonObj))
1192 - if (currentid == "-225638207") { 1190 + //if (currentid == "-225638207") {
  1191 + if ($rootScope.cbTreeFirstID == currentid) {
1193 $rootScope.selectedNodeSingle.push( 1192 $rootScope.selectedNodeSingle.push(
1194 { 1193 {
1195 "_label": "NEW Slide1", 1194 "_label": "NEW Slide1",
@@ -1198,6 +1197,19 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1198,6 +1197,19 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1198 "_isBranch": "false", 1197 "_isBranch": "false",
1199 "_isLocked": "false" 1198 "_isLocked": "false"
1200 }); 1199 });
  1200 +
  1201 + $rootScope.saveDraftSingleObj.push({
  1202 + "_label": "NEW Slide1",
  1203 + "_id": AddSlideId,
  1204 + "_isRoot": "false",
  1205 + "_isBranch": "false",
  1206 + "_isLocked": "false"
  1207 + });
  1208 + //for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
  1209 + // if ($rootScope.saveDraftSingleObj[i]._id == currentid) {
  1210 + // $rootScope.saveDraftSingleObj[i] = $rootScope.selectedNodeSingle;
  1211 + // }
  1212 + //}
1201 } 1213 }
1202 else { 1214 else {
1203 $scope.selectedNodeSingleObj['structure'].push({ 1215 $scope.selectedNodeSingleObj['structure'].push({
@@ -1207,6 +1219,12 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1207,6 +1219,12 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1207 "_isBranch": "false", 1219 "_isBranch": "false",
1208 "_isLocked": "false" 1220 "_isLocked": "false"
1209 }); 1221 });
  1222 + for (i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
  1223 + if($rootScope.saveDraftSingleObj[i]._id == currentid)
  1224 + {
  1225 + $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
  1226 + }
  1227 + }
1210 } 1228 }
1211 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000); 1229 // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000);
1212 setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); 1230 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, $ @@ -1214,6 +1232,171 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1214 1232
1215 } 1233 }
1216 1234
  1235 + $rootScope.exportToFile = function () {
  1236 +
  1237 +
  1238 + $scope.DynamicAddspanID = [];
  1239 + $scope.contentEleNote = [];
  1240 + $scope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
  1241 + //for (var i = 0; i < $rootScope.structure.length; i++) {
  1242 +
  1243 + //}
  1244 + var spanIds = [];
  1245 + var cbCurrentId = document.getElementById('cbSelect').value;
  1246 + //$('.jstree-container-ul li a span').each(function () {
  1247 + // var span_Id = $(this).attr("id");
  1248 + // var spanText = $(this).text();
  1249 + // //spanIds.push(span_Id);
  1250 + // if (span_Id == cbCurrentId) {
  1251 + // }
  1252 + // if (span_Id != "-225638207" && _parentId == 0) {
  1253 + // $scope.DynamicAddspanID.push(
  1254 + // {
  1255 + // "_label": spanText,
  1256 + // "_id": span_Id,
  1257 + // "_isRoot": "false",
  1258 + // "_isBranch": "false",
  1259 + // "_isLocked": "false",
  1260 + // }); + ","
  1261 + // }
  1262 + // else if (_isbranch == true && _parentId != 0) {
  1263 + // $scope.selectedNodeSingleObj['structure']
  1264 + // $scope.DynamicAddspanID.push({
  1265 + // "structure": [
  1266 + // {
  1267 + // "_label": spanText,
  1268 + // "_id": span_Id,
  1269 + // "_isRoot": "false",
  1270 + // "_isBranch": "false",
  1271 + // "_isLocked": "false",
  1272 + // }
  1273 +
  1274 + // ]
  1275 + // });
  1276 + // }
  1277 + //});
  1278 +
  1279 +
  1280 +
  1281 +
  1282 +
  1283 +
  1284 +
  1285 + //for (var i = 0; i < $rootScope.cbJsonData.slideshow.content.element.length; i++) {
  1286 + // $scope.contentEleNote.push(
  1287 + // {
  1288 + // "notes": $rootScope.cbJsonData.slideshow.content.element[i].notes,
  1289 + // "windows": {
  1290 + // "window": $rootScope.cbJsonData.slideshow.content.element[i].windows.window
  1291 + // },
  1292 + // "_id": $rootScope.cbJsonData.slideshow.content.element[i]._id
  1293 + // }); + ","
  1294 +
  1295 + //}
  1296 + //var myJSON = JSON.stringify($scope.DynamicAddspanID);
  1297 + $rootScope.saveDraftDynamicTest.push(
  1298 + {
  1299 + "slideshow": {
  1300 + "presentation": {
  1301 + "structure": {
  1302 + "structure": //[
  1303 +
  1304 + //$scope.DynamicAddspanID,
  1305 + $rootScope.saveDraftSingleObj,
  1306 +
  1307 +
  1308 + //],
  1309 + "_label": $rootScope.cbTreeFirstLabel,
  1310 + "_id": $rootScope.cbTreeFirstID,
  1311 + "_isRoot": "true",
  1312 + "_isBranch": "true",
  1313 + "_isLocked": "false"
  1314 + },
  1315 + "_anchor": "true",
  1316 + "_window_position": "6,10",
  1317 + "_window_size": "828,453"
  1318 + },
  1319 + "content": {
  1320 + "element": [
  1321 +
  1322 + //"notes": "<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT><TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Microsoft Sans Serif\" SIZE=\"13\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"> </FONT></P></TEXTFORMAT>",
  1323 + //"windows": {
  1324 + // "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}}"
  1325 + //},
  1326 + //"_id": "-1507902782"
  1327 + $scope.contentEleNote,
  1328 +
  1329 + ]
  1330 + }
  1331 + }
  1332 +
  1333 + });
  1334 +
  1335 +
  1336 +
  1337 + $scope.filename = "filename.json";
  1338 + var filename = $scope.filename;
  1339 + var blob = new Blob([angular.toJson($rootScope.saveDraftDynamicTest, true)], { type: 'text/text' });
  1340 + if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  1341 + window.navigator.msSaveOrOpenBlob(blob, filename);
  1342 + } else {
  1343 + var e = document.createEvent('MouseEvents'),
  1344 + a = document.createElement('a');
  1345 + a.download = filename;
  1346 + a.href = window.URL.createObjectURL(blob);
  1347 + a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');
  1348 + e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  1349 + a.dispatchEvent(e);
  1350 + // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource
  1351 + }
  1352 + $http({ method: 'Post', url: $scope.fileName }).success(function (data) {
  1353 + localStorage.setItem("cbJsonDataObject", JSON.stringify(data));
  1354 + $rootScope.cbJsonData = JSON.parse(localStorage.getItem("cbJsonDataObject"));
  1355 + $rootScope.cbDynamicJsonData = data;
  1356 + //$scope.getCBsummary();
  1357 + $rootScope.cbJsonData.slideshow.content.element = "Eement data";
  1358 + $rootScope.cbDynamicJsonData.slideshow.content.element = "slideshow element data";
  1359 + $rootScope.note = "save data"
  1360 + //$scope.openCurriculumDetail();
  1361 + })
  1362 + .error(function (data, status, headers, config) {
  1363 + console.log(data);
  1364 + });
  1365 + };
  1366 +
  1367 +
  1368 +
  1369 +
  1370 +
  1371 + //$scope.addSlide = function (currentid, AddSlideId) {
  1372 + // traverseTreeSelectedSingleObj($rootScope.stru, currentid);
  1373 + // // traverse($rootScope.stru, currentid);
  1374 + // //console.log(JSON.stringify($scope.upDateJsonObj))
  1375 + // if (currentid == "-225638207") {
  1376 + // $rootScope.selectedNodeSingle.push(
  1377 + // {
  1378 + // "_label": "NEW Slide1",
  1379 + // "_id": AddSlideId,
  1380 + // "_isRoot": "false",
  1381 + // "_isBranch": "false",
  1382 + // "_isLocked": "false"
  1383 + // });
  1384 + // }
  1385 + // else {
  1386 + // $scope.selectedNodeSingleObj['structure'].push({
  1387 + // "_label": "New Slide",
  1388 + // "_id": AddSlideId,
  1389 + // "_isRoot": "false",
  1390 + // "_isBranch": "false",
  1391 + // "_isLocked": "false"
  1392 + // });
  1393 + // }
  1394 + // // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000);
  1395 + // setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100);
  1396 +
  1397 +
  1398 + //}
  1399 +
1217 $scope.moveDown = function (currentid) { 1400 $scope.moveDown = function (currentid) {
1218 1401
1219 1402
@@ -1238,7 +1421,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1238,7 +1421,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1238 1421
1239 if (o[i] !== null && typeof (o[i]) == "object") { 1422 if (o[i] !== null && typeof (o[i]) == "object") {
1240 if (o[i]._id == current_id) { 1423 if (o[i]._id == current_id) {
1241 - $scope.selectedNodeSingleObj = o[i]; 1424 + $scope.selectedNodeSingleObj = o[i];
1242 } 1425 }
1243 traverseTreeSelectedSingleObj(o[i], current_id); 1426 traverseTreeSelectedSingleObj(o[i], current_id);
1244 } 1427 }
@@ -1519,6 +1702,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ @@ -1519,6 +1702,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
1519 $('body,html').animate({ scrollTop: $('#' + selected_Id).position().top }, 500); 1702 $('body,html').animate({ scrollTop: $('#' + selected_Id).position().top }, 500);
1520 } 1703 }
1521 } 1704 }
  1705 +
  1706 +
1522 }] 1707 }]
1523 ); 1708 );
1524 1709