Commit fa8d09bd6e80fdb63bcf584cf60c7e5e4ba50b67
1 parent
da0510e7
Code changes for Save draft CB
Showing
1 changed file
with
114 additions
and
51 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
@@ -218,24 +218,24 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -218,24 +218,24 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
218 | 218 | ||
219 | 219 | ||
220 | $scope.getJsonFileFromLocal = function loadFile() { | 220 | $scope.getJsonFileFromLocal = function loadFile() { |
221 | - var input, file, fr; | 221 | + var fileId, file, fr; |
222 | 222 | ||
223 | if (typeof window.FileReader !== 'function') { | 223 | if (typeof window.FileReader !== 'function') { |
224 | alert("The file API isn't supported on this browser yet."); | 224 | alert("The file API isn't supported on this browser yet."); |
225 | return; | 225 | return; |
226 | } | 226 | } |
227 | - input = document.getElementById('opencbview'); | ||
228 | - if (!input) { | ||
229 | - alert("Um, couldn't find the fileinput element."); | 227 | + fileId = document.getElementById('opencbview'); |
228 | + if (!fileId) { | ||
229 | + alert("File couldn't find the element."); | ||
230 | } | 230 | } |
231 | - else if (!input.files) { | 231 | + else if (!fileId.files) { |
232 | alert("This browser doesn't seem to support the `files` property of file inputs."); | 232 | alert("This browser doesn't seem to support the `files` property of file inputs."); |
233 | } | 233 | } |
234 | - else if (!input.files[0]) { | 234 | + else if (!fileId.files[0]) { |
235 | alert("Please select a file before clicking 'Load'"); | 235 | alert("Please select a file before clicking 'Load'"); |
236 | } | 236 | } |
237 | else { | 237 | else { |
238 | - file = input.files[0]; | 238 | + file = fileId.files[0]; |
239 | fr = new FileReader(); | 239 | fr = new FileReader(); |
240 | fr.onload = receivedText; | 240 | fr.onload = receivedText; |
241 | fr.readAsText(file); | 241 | fr.readAsText(file); |
@@ -431,6 +431,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -431,6 +431,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
431 | $scope.openCurriculumDetail = function () { | 431 | $scope.openCurriculumDetail = function () { |
432 | $rootScope.structure = $rootScope.cbJsonData.slideshow.presentation.structure.structure; | 432 | $rootScope.structure = $rootScope.cbJsonData.slideshow.presentation.structure.structure; |
433 | $rootScope.stru = $rootScope.cbDynamicJsonData.slideshow.presentation; | 433 | $rootScope.stru = $rootScope.cbDynamicJsonData.slideshow.presentation; |
434 | + $rootScope.cbDynamicContents = $rootScope.cbDynamicJsonData.slideshow.content.element; | ||
434 | $rootScope.cbTreeFirstLabel = $rootScope.cbJsonData.slideshow.presentation.structure._label; | 435 | $rootScope.cbTreeFirstLabel = $rootScope.cbJsonData.slideshow.presentation.structure._label; |
435 | $rootScope.cbTreeFirstID = $rootScope.cbJsonData.slideshow.presentation.structure._id; | 436 | $rootScope.cbTreeFirstID = $rootScope.cbJsonData.slideshow.presentation.structure._id; |
436 | $location.url("/curriculum-builder-detail"); | 437 | $location.url("/curriculum-builder-detail"); |
@@ -462,6 +463,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -462,6 +463,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
462 | //$scope.structure = $scope.selectedNodeSingle[0].structure.structure[0]._label; | 463 | //$scope.structure = $scope.selectedNodeSingle[0].structure.structure[0]._label; |
463 | $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingle[0]._label; | 464 | $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingle[0]._label; |
464 | $rootScope.structure = $scope.selectedNodeSingle[0].structure.structure; | 465 | $rootScope.structure = $scope.selectedNodeSingle[0].structure.structure; |
466 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
465 | $rootScope.cbTreeFirstID = $scope.selectedNodeSingle[0]._id; | 467 | $rootScope.cbTreeFirstID = $scope.selectedNodeSingle[0]._id; |
466 | $location.url("/curriculum-builder-detail"); | 468 | $location.url("/curriculum-builder-detail"); |
467 | } | 469 | } |
@@ -665,6 +667,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -665,6 +667,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
665 | var current_id = document.getElementById('cbSelect').value; | 667 | var current_id = document.getElementById('cbSelect').value; |
666 | if ($rootScope.saveDraftSingleObj.length == 0) { | 668 | if ($rootScope.saveDraftSingleObj.length == 0) { |
667 | $rootScope.saveDraftSingleObj = $rootScope.structure; | 669 | $rootScope.saveDraftSingleObj = $rootScope.structure; |
670 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
668 | } | 671 | } |
669 | traverseSelectedObjForSaveDraftCB($rootScope.saveDraftSingleObj, current_id); | 672 | traverseSelectedObjForSaveDraftCB($rootScope.saveDraftSingleObj, current_id); |
670 | if ($rootScope.saveDraftSingleObj.length != $rootScope.stru.structure.structure.length) { | 673 | if ($rootScope.saveDraftSingleObj.length != $rootScope.stru.structure.structure.length) { |
@@ -985,6 +988,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -985,6 +988,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
985 | $scope.selectedNodeSingleObj._label = newSlideText; | 988 | $scope.selectedNodeSingleObj._label = newSlideText; |
986 | if ($rootScope.saveDraftSingleObj.length == 0) { | 989 | if ($rootScope.saveDraftSingleObj.length == 0) { |
987 | $rootScope.saveDraftSingleObj = $rootScope.structure; | 990 | $rootScope.saveDraftSingleObj = $rootScope.structure; |
991 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
988 | } | 992 | } |
989 | //Update Save Draft object for Rename slide | 993 | //Update Save Draft object for Rename slide |
990 | for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { | 994 | for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { |
@@ -1019,8 +1023,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1019,8 +1023,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1019 | else { | 1023 | else { |
1020 | nodeid = document.getElementById('cbSelect').value; | 1024 | nodeid = document.getElementById('cbSelect').value; |
1021 | } | 1025 | } |
1022 | - | ||
1023 | - | ||
1024 | //var nodeid = document.getElementById('cbSelect').value; | 1026 | //var nodeid = document.getElementById('cbSelect').value; |
1025 | $scope.cbRenameDate(); | 1027 | $scope.cbRenameDate(); |
1026 | //var newSlideName = document.getElementById('cbRenameSectionTitle').value; | 1028 | //var newSlideName = document.getElementById('cbRenameSectionTitle').value; |
@@ -1035,6 +1037,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1035,6 +1037,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1035 | //Update Save Draft object for rename section | 1037 | //Update Save Draft object for rename section |
1036 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1038 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1037 | $rootScope.saveDraftSingleObj = $rootScope.structure; | 1039 | $rootScope.saveDraftSingleObj = $rootScope.structure; |
1040 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1038 | } | 1041 | } |
1039 | for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { | 1042 | for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) { |
1040 | if ($rootScope.saveDraftSingleObj[i]._id == nodeid) { | 1043 | if ($rootScope.saveDraftSingleObj[i]._id == nodeid) { |
@@ -1044,8 +1047,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1044,8 +1047,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1044 | //else if ($rootScope.saveDraftSingleObj[i]['structure']._id == nodeid) { | 1047 | //else if ($rootScope.saveDraftSingleObj[i]['structure']._id == nodeid) { |
1045 | // $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure']; | 1048 | // $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure']; |
1046 | //} | 1049 | //} |
1047 | - } | ||
1048 | - | 1050 | + } |
1051 | + if ($rootScope.cbTreeFirstID == nodeid) { | ||
1052 | + $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingleObj._label; | ||
1053 | + } | ||
1049 | //$scope.selectedNodeSingleObj = ""; | 1054 | //$scope.selectedNodeSingleObj = ""; |
1050 | traverseTreeSelectedSingleObj($rootScope.Auther, nodeid); | 1055 | traverseTreeSelectedSingleObj($rootScope.Auther, nodeid); |
1051 | setTimeout(function () { | 1056 | setTimeout(function () { |
@@ -1053,11 +1058,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1053,11 +1058,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1053 | $scope.selectedNodeSingleObj.author = newAuthorName; | 1058 | $scope.selectedNodeSingleObj.author = newAuthorName; |
1054 | $scope.selectedNodeSingleObj.version = newversion; | 1059 | $scope.selectedNodeSingleObj.version = newversion; |
1055 | $scope.selectedNodeSingleObj.modified = $scope.dateTime; | 1060 | $scope.selectedNodeSingleObj.modified = $scope.dateTime; |
1061 | + //Add code for Save Draft Content | ||
1062 | + if ($rootScope.contentEleNote.length == 0) { | ||
1063 | + $rootScope.contentEleNote = $rootScope.cbDynamicContents.element; | ||
1064 | + } | ||
1056 | $scope.DropDownSelectNodeClick(nodeid); | 1065 | $scope.DropDownSelectNodeClick(nodeid); |
1057 | console.log("summary" + JSON.stringify($rootScope.cbDynamicJsonData)); | 1066 | console.log("summary" + JSON.stringify($rootScope.cbDynamicJsonData)); |
1058 | }, 100); | 1067 | }, 100); |
1059 | - $rootScope.closeRenameModel(); | ||
1060 | - console.log(JSON.stringify($rootScope.stru, $rootScope.structure)); | 1068 | + $rootScope.closeRenameModel(); |
1061 | } | 1069 | } |
1062 | 1070 | ||
1063 | $scope.cbRenameDate = function () { | 1071 | $scope.cbRenameDate = function () { |
@@ -1227,7 +1235,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1227,7 +1235,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1227 | } | 1235 | } |
1228 | 1236 | ||
1229 | 1237 | ||
1230 | - | ||
1231 | function traverseForLoadDropDown(o) { | 1238 | function traverseForLoadDropDown(o) { |
1232 | 1239 | ||
1233 | for (var i = 0; i < o.structure.structure.length; i++) { | 1240 | for (var i = 0; i < o.structure.structure.length; i++) { |
@@ -1235,44 +1242,46 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1235,44 +1242,46 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1235 | } | 1242 | } |
1236 | } | 1243 | } |
1237 | 1244 | ||
1238 | - $scope.moveUP = function (currentid) { | 1245 | + //$scope.moveUP = function (currentid) { |
1239 | 1246 | ||
1240 | 1247 | ||
1241 | - traverse($rootScope.stru, currentid); | 1248 | + // traverse($rootScope.stru, currentid); |
1242 | 1249 | ||
1243 | - console.log("cbJsonData Before" + JSON.stringify($rootScope.stru)); | ||
1244 | - console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs)); | ||
1245 | - for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { | 1250 | + // console.log("cbJsonData Before" + JSON.stringify($rootScope.stru)); |
1251 | + // console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs)); | ||
1252 | + // for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { | ||
1246 | 1253 | ||
1247 | - if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) { | ||
1248 | - var key = $scope.selectedNodeSiblingObjs[j]; | ||
1249 | - $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1]; | ||
1250 | - $scope.selectedNodeSiblingObjs[j - 1] = key; | ||
1251 | - } | 1254 | + // if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) { |
1255 | + // var key = $scope.selectedNodeSiblingObjs[j]; | ||
1256 | + // $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1]; | ||
1257 | + // $scope.selectedNodeSiblingObjs[j - 1] = key; | ||
1258 | + // } | ||
1252 | 1259 | ||
1253 | - } | ||
1254 | - console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs)); | 1260 | + // } |
1261 | + // console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs)); | ||
1255 | 1262 | ||
1256 | - console.log("stru after" + JSON.stringify($rootScope.stru)); | 1263 | + // console.log("stru after" + JSON.stringify($rootScope.stru)); |
1257 | 1264 | ||
1258 | - console.log("structure after" + JSON.stringify($rootScope.structure)); | 1265 | + // console.log("structure after" + JSON.stringify($rootScope.structure)); |
1259 | 1266 | ||
1260 | 1267 | ||
1261 | 1268 | ||
1262 | - } | 1269 | + //} |
1263 | 1270 | ||
1264 | $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) { | 1271 | $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) { |
1265 | 1272 | ||
1266 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1273 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1267 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1274 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1275 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1268 | } | 1276 | } |
1269 | if ($rootScope.contentEleNote.length == 0) { | 1277 | if ($rootScope.contentEleNote.length == 0) { |
1270 | - $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; | 1278 | + //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; |
1279 | + $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents | ||
1271 | } | 1280 | } |
1272 | traverse($rootScope.stru, currentid); | 1281 | traverse($rootScope.stru, currentid); |
1273 | for (var j = 0; j < $rootScope.saveDraftSingleObj.length; j++) { | 1282 | for (var j = 0; j < $rootScope.saveDraftSingleObj.length; j++) { |
1274 | - if (($rootScope.saveDraftSingleObj[j]._id == currentid)) { | ||
1275 | - | 1283 | + //if (($rootScope.saveDraftSingleObj[j]._id == currentid)) { |
1284 | + if ($rootScope.saveDraftSingleObj[j]._id == currentid && $rootScope.saveDraftSingleObj[j]._isBranch == "true") { | ||
1276 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); | 1285 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); |
1277 | traverse($rootScope.stru, currentid); | 1286 | traverse($rootScope.stru, currentid); |
1278 | var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure']; | 1287 | var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure']; |
@@ -1305,6 +1314,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1305,6 +1314,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1305 | .delete().at("_id == " + currentid).select(); | 1314 | .delete().at("_id == " + currentid).select(); |
1306 | $rootScope.contentEleNote = remaingNotesForCB; | 1315 | $rootScope.contentEleNote = remaingNotesForCB; |
1307 | 1316 | ||
1317 | + $rootScope.contentEleNote = $rootScope.cbDynamicContents; | ||
1308 | console.log($rootScope.contentEleNote); | 1318 | console.log($rootScope.contentEleNote); |
1309 | console.log($rootScope.saveDraftSingleObj); | 1319 | console.log($rootScope.saveDraftSingleObj); |
1310 | } | 1320 | } |
@@ -1324,9 +1334,11 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1324,9 +1334,11 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1324 | $scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) { | 1334 | $scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) { |
1325 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1335 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1326 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1336 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1337 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1327 | } | 1338 | } |
1328 | if ($rootScope.contentEleNote.length == 0) { | 1339 | if ($rootScope.contentEleNote.length == 0) { |
1329 | - $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; | 1340 | + //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; |
1341 | + $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents | ||
1330 | } | 1342 | } |
1331 | traverse($rootScope.stru, currentid); | 1343 | traverse($rootScope.stru, currentid); |
1332 | for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { | 1344 | for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { |
@@ -1334,6 +1346,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1334,6 +1346,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1334 | $scope.selectedNodeSiblingObjs.splice(j, 1); | 1346 | $scope.selectedNodeSiblingObjs.splice(j, 1); |
1335 | 1347 | ||
1336 | $rootScope.saveDraftSingleObj = $rootScope.structure; | 1348 | $rootScope.saveDraftSingleObj = $rootScope.structure; |
1349 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1337 | 1350 | ||
1338 | //Added Code by Sandeep for Delete slide from node tree for save draft CB | 1351 | //Added Code by Sandeep for Delete slide from node tree for save draft CB |
1339 | for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) { | 1352 | for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) { |
@@ -1344,6 +1357,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1344,6 +1357,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1344 | } | 1357 | } |
1345 | else { | 1358 | else { |
1346 | $rootScope.saveDraftSingleObj = $rootScope.structure; | 1359 | $rootScope.saveDraftSingleObj = $rootScope.structure; |
1360 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1347 | } | 1361 | } |
1348 | } | 1362 | } |
1349 | } | 1363 | } |
@@ -1368,15 +1382,25 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1368,15 +1382,25 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1368 | $scope.exportToFile(file_Name); | 1382 | $scope.exportToFile(file_Name); |
1369 | } | 1383 | } |
1370 | 1384 | ||
1371 | - $rootScope.exportToFile = function () { | 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 | + }); | ||
1392 | + } | ||
1393 | + | ||
1372 | 1394 | ||
1373 | var cbCurrentId = document.getElementById('cbSelect').value; | 1395 | var cbCurrentId = document.getElementById('cbSelect').value; |
1374 | 1396 | ||
1375 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1397 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1376 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1398 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1399 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1377 | } | 1400 | } |
1378 | if ($rootScope.contentEleNote.length == 0) { | 1401 | if ($rootScope.contentEleNote.length == 0) { |
1379 | - $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; | 1402 | + //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element; |
1403 | + $rootScope.contentEleNote = $rootScope.cbDynamicContents;//Assign Dnamic Contents | ||
1380 | } | 1404 | } |
1381 | $rootScope.dynamicUpdatedJsonForSaveCB = | 1405 | $rootScope.dynamicUpdatedJsonForSaveCB = |
1382 | { | 1406 | { |
@@ -1410,20 +1434,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1410,20 +1434,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1410 | $scope.slideshow = $rootScope.dynamicUpdatedJsonForSaveCB; | 1434 | $scope.slideshow = $rootScope.dynamicUpdatedJsonForSaveCB; |
1411 | $scope.filename = "SandySaveCB.json"; | 1435 | $scope.filename = "SandySaveCB.json"; |
1412 | var filename = $scope.filename; | 1436 | var filename = $scope.filename; |
1413 | - var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' }); | ||
1414 | - if (window.navigator && window.navigator.msSaveOrOpenBlob) { | ||
1415 | - window.navigator.msSaveOrOpenBlob(blob, filename); | ||
1416 | - } | ||
1417 | - else { | ||
1418 | - var e = document.createEvent('MouseEvents'), | ||
1419 | - a = document.createElement('a'); | ||
1420 | - a.download = filename; | ||
1421 | - a.href = window.URL.createObjectURL(blob); | ||
1422 | - a.dataset.downloadurl = ['text/json', a.download, a.href].join(':'); | ||
1423 | - e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
1424 | - a.dispatchEvent(e); | ||
1425 | - // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource | ||
1426 | - } | 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 | + //} | ||
1427 | $rootScope.dynamicUpdatedJsonForSaveCB = ""; | 1451 | $rootScope.dynamicUpdatedJsonForSaveCB = ""; |
1428 | //$rootScope.contentEleNote = []; | 1452 | //$rootScope.contentEleNote = []; |
1429 | //$rootScope.saveDraftSingleObj = []; | 1453 | //$rootScope.saveDraftSingleObj = []; |
@@ -1447,6 +1471,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1447,6 +1471,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1447 | 1471 | ||
1448 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1472 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1449 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1473 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1474 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1450 | } | 1475 | } |
1451 | 1476 | ||
1452 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); | 1477 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); |
@@ -1514,6 +1539,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1514,6 +1539,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1514 | $scope.addSlide = function (currentid, AddSlideId) { | 1539 | $scope.addSlide = function (currentid, AddSlideId) { |
1515 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1540 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1516 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1541 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1542 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1517 | } | 1543 | } |
1518 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); | 1544 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); |
1519 | // traverse($rootScope.stru, currentid); | 1545 | // traverse($rootScope.stru, currentid); |
@@ -1564,8 +1590,26 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1564,8 +1590,26 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1564 | setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); | 1590 | setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); |
1565 | } | 1591 | } |
1566 | 1592 | ||
1567 | - $scope.moveDown = function (currentid) { | 1593 | + //$scope.moveDown = function (currentid) { |
1594 | + | ||
1595 | + | ||
1596 | + // traverse($rootScope.stru, currentid); | ||
1597 | + | ||
1598 | + // for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { | ||
1599 | + | ||
1600 | + // if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j + 1] != undefined)) { | ||
1601 | + // var key1 = $scope.selectedNodeSiblingObjs[j]; | ||
1602 | + // $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j + 1]; | ||
1603 | + // $scope.selectedNodeSiblingObjs[j + 1] = key1; | ||
1604 | + // break; | ||
1605 | + // } | ||
1606 | + | ||
1607 | + // } | ||
1608 | + | ||
1609 | + | ||
1610 | + //} | ||
1568 | 1611 | ||
1612 | + $scope.moveDown = function (currentid) { | ||
1569 | 1613 | ||
1570 | traverse($rootScope.stru, currentid); | 1614 | traverse($rootScope.stru, currentid); |
1571 | 1615 | ||
@@ -1577,11 +1621,28 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1577,11 +1621,28 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1577 | $scope.selectedNodeSiblingObjs[j + 1] = key1; | 1621 | $scope.selectedNodeSiblingObjs[j + 1] = key1; |
1578 | break; | 1622 | break; |
1579 | } | 1623 | } |
1580 | - | ||
1581 | } | 1624 | } |
1625 | + $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure; | ||
1626 | + } | ||
1582 | 1627 | ||
1628 | + $scope.moveUP = function (currentid) { | ||
1629 | + traverse($rootScope.stru, currentid); | ||
1630 | + //console.log("cbJsonData Before" + JSON.stringify($rootScope.stru)); | ||
1631 | + //console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs)); | ||
1632 | + for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { | ||
1583 | 1633 | ||
1634 | + if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) { | ||
1635 | + var key = $scope.selectedNodeSiblingObjs[j]; | ||
1636 | + $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1]; | ||
1637 | + $scope.selectedNodeSiblingObjs[j - 1] = key; | ||
1638 | + } | ||
1639 | + } | ||
1640 | + $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure; | ||
1641 | + //console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs)); | ||
1642 | + //console.log("stru after" + JSON.stringify($rootScope.stru)); | ||
1643 | + //console.log("structure after" + JSON.stringify($rootScope.structure)); | ||
1584 | } | 1644 | } |
1645 | + | ||
1585 | function traverseTreeSelectedSingleObj(o, current_id) { | 1646 | function traverseTreeSelectedSingleObj(o, current_id) { |
1586 | 1647 | ||
1587 | for (var i in o) { | 1648 | for (var i in o) { |
@@ -1876,6 +1937,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1876,6 +1937,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1876 | 1937 | ||
1877 | if ($rootScope.saveDraftSingleObj.length == 0) { | 1938 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1878 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1939 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
1940 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1879 | } | 1941 | } |
1880 | //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array | 1942 | //$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array |
1881 | //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 1943 | //$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
@@ -1970,6 +2032,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | @@ -1970,6 +2032,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ | ||
1970 | 2032 | ||
1971 | if ($rootScope.saveDraftSingleObj.length == 0) { | 2033 | if ($rootScope.saveDraftSingleObj.length == 0) { |
1972 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array | 2034 | $rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array |
2035 | + //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure; | ||
1973 | } | 2036 | } |
1974 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); | 2037 | traverseTreeSelectedSingleObj($rootScope.stru, currentid); |
1975 | //traverse($rootScope.stru, currentid); | 2038 | //traverse($rootScope.stru, currentid); |