diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
index 0368777..97480c6 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
@@ -218,24 +218,24 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.getJsonFileFromLocal = function loadFile() {
- var input, file, fr;
+ var fileId, file, fr;
if (typeof window.FileReader !== 'function') {
alert("The file API isn't supported on this browser yet.");
return;
}
- input = document.getElementById('opencbview');
- if (!input) {
- alert("Um, couldn't find the fileinput element.");
+ fileId = document.getElementById('opencbview');
+ if (!fileId) {
+ alert("File couldn't find the element.");
}
- else if (!input.files) {
+ else if (!fileId.files) {
alert("This browser doesn't seem to support the `files` property of file inputs.");
}
- else if (!input.files[0]) {
+ else if (!fileId.files[0]) {
alert("Please select a file before clicking 'Load'");
}
else {
- file = input.files[0];
+ file = fileId.files[0];
fr = new FileReader();
fr.onload = receivedText;
fr.readAsText(file);
@@ -431,6 +431,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.openCurriculumDetail = function () {
$rootScope.structure = $rootScope.cbJsonData.slideshow.presentation.structure.structure;
$rootScope.stru = $rootScope.cbDynamicJsonData.slideshow.presentation;
+ $rootScope.cbDynamicContents = $rootScope.cbDynamicJsonData.slideshow.content.element;
$rootScope.cbTreeFirstLabel = $rootScope.cbJsonData.slideshow.presentation.structure._label;
$rootScope.cbTreeFirstID = $rootScope.cbJsonData.slideshow.presentation.structure._id;
$location.url("/curriculum-builder-detail");
@@ -462,6 +463,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
//$scope.structure = $scope.selectedNodeSingle[0].structure.structure[0]._label;
$rootScope.cbTreeFirstLabel = $scope.selectedNodeSingle[0]._label;
$rootScope.structure = $scope.selectedNodeSingle[0].structure.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
$rootScope.cbTreeFirstID = $scope.selectedNodeSingle[0]._id;
$location.url("/curriculum-builder-detail");
}
@@ -665,6 +667,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
var current_id = document.getElementById('cbSelect').value;
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
traverseSelectedObjForSaveDraftCB($rootScope.saveDraftSingleObj, current_id);
if ($rootScope.saveDraftSingleObj.length != $rootScope.stru.structure.structure.length) {
@@ -985,6 +988,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.selectedNodeSingleObj._label = newSlideText;
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
//Update Save Draft object for Rename slide
for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
@@ -1019,8 +1023,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
else {
nodeid = document.getElementById('cbSelect').value;
}
-
-
//var nodeid = document.getElementById('cbSelect').value;
$scope.cbRenameDate();
//var newSlideName = document.getElementById('cbRenameSectionTitle').value;
@@ -1035,6 +1037,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
//Update Save Draft object for rename section
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
for (var i = 0; i < $rootScope.saveDraftSingleObj.length; i++) {
if ($rootScope.saveDraftSingleObj[i]._id == nodeid) {
@@ -1044,8 +1047,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
//else if ($rootScope.saveDraftSingleObj[i]['structure']._id == nodeid) {
// $rootScope.saveDraftSingleObj[i]['structure'] = $scope.selectedNodeSingleObj['structure'];
//}
- }
-
+ }
+ if ($rootScope.cbTreeFirstID == nodeid) {
+ $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingleObj._label;
+ }
//$scope.selectedNodeSingleObj = "";
traverseTreeSelectedSingleObj($rootScope.Auther, nodeid);
setTimeout(function () {
@@ -1053,11 +1058,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.selectedNodeSingleObj.author = newAuthorName;
$scope.selectedNodeSingleObj.version = newversion;
$scope.selectedNodeSingleObj.modified = $scope.dateTime;
+ //Add code for Save Draft Content
+ if ($rootScope.contentEleNote.length == 0) {
+ $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;
+ }
$scope.DropDownSelectNodeClick(nodeid);
console.log("summary" + JSON.stringify($rootScope.cbDynamicJsonData));
}, 100);
- $rootScope.closeRenameModel();
- console.log(JSON.stringify($rootScope.stru, $rootScope.structure));
+ $rootScope.closeRenameModel();
}
$scope.cbRenameDate = function () {
@@ -1227,7 +1235,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
}
-
function traverseForLoadDropDown(o) {
for (var i = 0; i < o.structure.structure.length; i++) {
@@ -1235,44 +1242,46 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
}
}
- $scope.moveUP = function (currentid) {
+ //$scope.moveUP = function (currentid) {
- traverse($rootScope.stru, currentid);
+ // traverse($rootScope.stru, currentid);
- console.log("cbJsonData Before" + JSON.stringify($rootScope.stru));
- console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs));
- for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
+ // console.log("cbJsonData Before" + JSON.stringify($rootScope.stru));
+ // console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs));
+ // for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
- if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) {
- var key = $scope.selectedNodeSiblingObjs[j];
- $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1];
- $scope.selectedNodeSiblingObjs[j - 1] = key;
- }
+ // if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) {
+ // var key = $scope.selectedNodeSiblingObjs[j];
+ // $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1];
+ // $scope.selectedNodeSiblingObjs[j - 1] = key;
+ // }
- }
- console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs));
+ // }
+ // console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs));
- console.log("stru after" + JSON.stringify($rootScope.stru));
+ // console.log("stru after" + JSON.stringify($rootScope.stru));
- console.log("structure after" + JSON.stringify($rootScope.structure));
+ // console.log("structure after" + JSON.stringify($rootScope.structure));
- }
+ //}
$scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) {
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
if ($rootScope.contentEleNote.length == 0) {
- $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents
}
traverse($rootScope.stru, currentid);
for (var j = 0; j < $rootScope.saveDraftSingleObj.length; j++) {
- if (($rootScope.saveDraftSingleObj[j]._id == currentid)) {
-
+ //if (($rootScope.saveDraftSingleObj[j]._id == currentid)) {
+ if ($rootScope.saveDraftSingleObj[j]._id == currentid && $rootScope.saveDraftSingleObj[j]._isBranch == "true") {
traverseTreeSelectedSingleObj($rootScope.stru, currentid);
traverse($rootScope.stru, currentid);
var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure'];
@@ -1305,6 +1314,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
.delete().at("_id == " + currentid).select();
$rootScope.contentEleNote = remaingNotesForCB;
+ $rootScope.contentEleNote = $rootScope.cbDynamicContents;
console.log($rootScope.contentEleNote);
console.log($rootScope.saveDraftSingleObj);
}
@@ -1324,9 +1334,11 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.DeleteSlide = function (currentid, CurrentSelectedParentSpanId) {
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
if ($rootScope.contentEleNote.length == 0) {
- $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ $rootScope.contentEleNote = $rootScope.cbDynamicContents.element;//Assign Dnamic Contents
}
traverse($rootScope.stru, currentid);
for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
@@ -1334,6 +1346,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.selectedNodeSiblingObjs.splice(j, 1);
$rootScope.saveDraftSingleObj = $rootScope.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
//Added Code by Sandeep for Delete slide from node tree for save draft CB
for (var x = 0; x < $rootScope.saveDraftSingleObj.length; x++) {
@@ -1344,6 +1357,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
}
else {
$rootScope.saveDraftSingleObj = $rootScope.structure;
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
}
}
@@ -1368,15 +1382,25 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.exportToFile(file_Name);
}
- $rootScope.exportToFile = function () {
+ $rootScope.exportToFile = function () {
+ if ($('.mce-content-body p ul li span').length > 0) {
+ $('.mce-content-body p ul li span').each(function () {
+ var sandytest = $(this).text();
+ var test = $(this).attr('text');
+ console.log(sandytest);
+ });
+ }
+
var cbCurrentId = document.getElementById('cbSelect').value;
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
if ($rootScope.contentEleNote.length == 0) {
- $rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ //$rootScope.contentEleNote = $rootScope.cbJsonData.slideshow.content.element;
+ $rootScope.contentEleNote = $rootScope.cbDynamicContents;//Assign Dnamic Contents
}
$rootScope.dynamicUpdatedJsonForSaveCB =
{
@@ -1410,20 +1434,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.slideshow = $rootScope.dynamicUpdatedJsonForSaveCB;
$scope.filename = "SandySaveCB.json";
var filename = $scope.filename;
- var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' });
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- window.navigator.msSaveOrOpenBlob(blob, filename);
- }
- else {
- var e = document.createEvent('MouseEvents'),
- a = document.createElement('a');
- a.download = filename;
- a.href = window.URL.createObjectURL(blob);
- a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');
- e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- a.dispatchEvent(e);
- // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource
- }
+ //var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' });
+ //if (window.navigator && window.navigator.msSaveOrOpenBlob) {
+ // window.navigator.msSaveOrOpenBlob(blob, filename);
+ //}
+ //else {
+ // var e = document.createEvent('MouseEvents'),
+ // a = document.createElement('a');
+ // a.download = filename;
+ // a.href = window.URL.createObjectURL(blob);
+ // a.dataset.downloadurl = ['text/json', a.download, a.href].join(':');
+ // e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ // a.dispatchEvent(e);
+ // // window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource
+ //}
$rootScope.dynamicUpdatedJsonForSaveCB = "";
//$rootScope.contentEleNote = [];
//$rootScope.saveDraftSingleObj = [];
@@ -1447,6 +1471,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
traverseTreeSelectedSingleObj($rootScope.stru, currentid);
@@ -1514,6 +1539,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.addSlide = function (currentid, AddSlideId) {
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
traverseTreeSelectedSingleObj($rootScope.stru, currentid);
// traverse($rootScope.stru, currentid);
@@ -1564,8 +1590,26 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100);
}
- $scope.moveDown = function (currentid) {
+ //$scope.moveDown = function (currentid) {
+
+
+ // traverse($rootScope.stru, currentid);
+
+ // for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
+
+ // if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j + 1] != undefined)) {
+ // var key1 = $scope.selectedNodeSiblingObjs[j];
+ // $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j + 1];
+ // $scope.selectedNodeSiblingObjs[j + 1] = key1;
+ // break;
+ // }
+
+ // }
+
+
+ //}
+ $scope.moveDown = function (currentid) {
traverse($rootScope.stru, currentid);
@@ -1577,11 +1621,28 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
$scope.selectedNodeSiblingObjs[j + 1] = key1;
break;
}
-
}
+ $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure;
+ }
+ $scope.moveUP = function (currentid) {
+ traverse($rootScope.stru, currentid);
+ //console.log("cbJsonData Before" + JSON.stringify($rootScope.stru));
+ //console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs));
+ for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) {
+ if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) {
+ var key = $scope.selectedNodeSiblingObjs[j];
+ $scope.selectedNodeSiblingObjs[j] = $scope.selectedNodeSiblingObjs[j - 1];
+ $scope.selectedNodeSiblingObjs[j - 1] = key;
+ }
+ }
+ $rootScope.saveDraftSingleObj = $rootScope.stru.structure.structure;
+ //console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs));
+ //console.log("stru after" + JSON.stringify($rootScope.stru));
+ //console.log("structure after" + JSON.stringify($rootScope.structure));
}
+
function traverseTreeSelectedSingleObj(o, current_id) {
for (var i in o) {
@@ -1876,6 +1937,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
//$rootScope.saveDraftSingleObj = $rootScope.stru;//All json Structure with tree array
//$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
@@ -1970,6 +2032,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
if ($rootScope.saveDraftSingleObj.length == 0) {
$rootScope.saveDraftSingleObj = $rootScope.structure;// only Tree Array
+ //$rootScope.saveDraftSingleObj = $rootScope.stru.slideshow.presentation.structure.structure;
}
traverseTreeSelectedSingleObj($rootScope.stru, currentid);
//traverse($rootScope.stru, currentid);