Commit 6fbe990611803f62665246694468ff4dfdf4028d
1 parent
f3e77c03
add functionalities for import CB
Showing
4 changed files
with
323 additions
and
551 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
1 | 1 | AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location", "$timeout", "ModuleService", "$interval","$window", |
2 | 2 | function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $timeout, ModuleService, $interval, $window) { |
3 | 3 | |
4 | - // $rootScope.currentActiveModuleTitle = pages[6].name; | |
5 | 4 | $scope.showTabButton = false; |
6 | 5 | $scope.listCurriculumBuilder = null; |
7 | 6 | $scope.dataPopup = null; |
... | ... | @@ -13,7 +12,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
13 | 12 | $rootScope.contentNotesForSaveCB = []; |
14 | 13 | $rootScope.dynamicUpdatedJsonForSaveCB = ""; |
15 | 14 | $scope.isChangeFromDropDown=false; |
16 | - //$rootScope.updateSaveDraftCB = []; | |
17 | 15 | $scope.IsVisible = function () { |
18 | 16 | $scope.scroll(); |
19 | 17 | } |
... | ... | @@ -23,10 +21,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
23 | 21 | //alert("scroll"); |
24 | 22 | } |
25 | 23 | |
26 | - //$scope.showDeleteEditorModel = function () { | |
27 | - // document.getElementById('cbModelDeleteBackground').style.display = "block"; | |
28 | - // document.getElementById('cbModelDeleteEditorId').style.display = "block"; | |
29 | - //} | |
30 | 24 | $rootScope.closeEditorModel = function () { |
31 | 25 | document.getElementById('cbModelDeleteBackground').style.display = "none"; |
32 | 26 | document.getElementById('cbModelDeleteEditorId').style.display = "none"; |
... | ... | @@ -52,8 +46,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
52 | 46 | tinymce.execCommand('mceRemoveEditor', true, 'CBTextArea'); |
53 | 47 | tinymce.execCommand('mceAddEditor', true, 'CBTextArea'); |
54 | 48 | |
55 | - //$rootScope.structureObjForSaveCB = []; | |
56 | - //$rootScope.contentNotesForSaveCB = []; | |
57 | 49 | if ($('#' + id).html() != undefined) { |
58 | 50 | |
59 | 51 | $('#' + id).remove(); |
... | ... | @@ -72,9 +64,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
72 | 64 | |
73 | 65 | }); |
74 | 66 | |
75 | - | |
76 | - | |
77 | - | |
78 | 67 | $scope.CBDisableUI = function () { |
79 | 68 | |
80 | 69 | $rootScope.isLoading = true; |
... | ... | @@ -318,7 +307,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
318 | 307 | $scope.CBEnableUI(); |
319 | 308 | var jsonData = JSON.parse(e.target.result); |
320 | 309 | localStorage.setItem("cbJsonDataObject", JSON.stringify(jsonData)); |
321 | - $rootScope.cbJsonData = ""; $rootScope.cbDynamicJsonData = ""; | |
310 | + $rootScope.cbJsonData = ""; | |
311 | + $rootScope.cbDynamicJsonData = ""; | |
322 | 312 | $rootScope.cbJsonData = JSON.parse(e.target.result); |
323 | 313 | $rootScope.cbDynamicJsonData = JSON.parse(e.target.result); |
324 | 314 | $rootScope.cbTreeFirstLabel = $rootScope.cbJsonData.slideshow.presentation.structure._label; |
... | ... | @@ -332,7 +322,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
332 | 322 | $timeout(function () { |
333 | 323 | $('#modal-CurBuilder').css("display", "block"); |
334 | 324 | $("#CurBuilderbackground").css("display", "block"); |
335 | - //$scope.openCurriculumDetail(); | |
336 | 325 | }, 200); |
337 | 326 | |
338 | 327 | } |
... | ... | @@ -382,19 +371,33 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
382 | 371 | "_isLocked": "false" |
383 | 372 | }); |
384 | 373 | $rootScope.stru = $scope.selectedNodeSingle[0]; |
385 | - //$scope.nodeid = $scope.selectedNodeSingle[0].structure.structure[0]._label; | |
386 | - //traverseTreeSelectedSingleObj($rootScope.stru, $scope.nodeid); | |
387 | - //$scope.structure = $scope.selectedNodeSingle[0].structure.structure[0]._label; | |
388 | 374 | $rootScope.cbTreeFirstLabel = $scope.selectedNodeSingle[0]._label; |
389 | 375 | $rootScope.structure = $scope.selectedNodeSingle[0].structure.structure; |
390 | - //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure; | |
391 | 376 | $rootScope.cbTreeFirstID = $scope.selectedNodeSingle[0]._id; |
392 | 377 | $location.url("/curriculum-builder-detail"); |
393 | 378 | } |
394 | 379 | |
395 | - | |
396 | 380 | $scope.openCBJsPanel = function () { |
397 | 381 | $scope.CBDisableUI(); |
382 | + | |
383 | + $('#jstree').empty(); | |
384 | + var $e1 = $('<ul><li>' | |
385 | + + '<span id="{{cbTreeFirstID}}">{{cbTreeFirstLabel}}</span>' | |
386 | + +'<script type="text/ng-template" id="strTree"><span id="{{str._id}}" isBranch="{{str._isBranch}}">{{ str._label }}</span>' | |
387 | + +'<ul ng-if="str.structure">' | |
388 | + + "<li ng-repeat='str in str.structure' ng-include=\"'strTree'\"></li></ul></script>" | |
389 | + + "<ul><li ng-repeat='str in structure' ng-include=\"'strTree'\"></li></ul>" | |
390 | + + '</li></ul>').appendTo('#jstree'); | |
391 | + $compile($e1)($scope); | |
392 | + | |
393 | + $timeout(function () { | |
394 | + $scope.openCBEditorPanel(); | |
395 | + }, 500); | |
396 | + | |
397 | + } | |
398 | + | |
399 | + $scope.openCBEditorPanel = function () { | |
400 | + | |
398 | 401 | var jsContentURL = 'app/views/CBuild/curriculum-builder-TinyMCEjspanel.html'; |
399 | 402 | $.jsPanel({ |
400 | 403 | id: 'CBTinyMCEPanel', |
... | ... | @@ -417,9 +420,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
417 | 420 | }); |
418 | 421 | |
419 | 422 | $timeout(function () { |
420 | - $rootScope.resetMenuOptionOnClick("CBTinyMCEPanel"); | |
421 | - | |
422 | - }, 200); | |
423 | + $rootScope.resetMenuOptionOnClick("CBTinyMCEPanel"); | |
424 | + }, 200); | |
423 | 425 | |
424 | 426 | } |
425 | 427 | |
... | ... | @@ -460,14 +462,14 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
460 | 462 | var nodeid = document.getElementById('cbSelect').value; |
461 | 463 | $('#jstree').jstree('select_node', nodeid); |
462 | 464 | |
463 | - traverseTreeForSetIcons($rootScope.stru, nodeid); | |
465 | + // traverseTreeForSetIcons($rootScope.stru, nodeid); | |
464 | 466 | }, 200); |
465 | 467 | |
466 | 468 | } |
467 | 469 | |
468 | - $scope.openTinyMCE = function (nodeid) { | |
469 | - $scope.CBDisableUI(); | |
470 | + $scope.openTinyMCE = function (nodeid) { | |
470 | 471 | if ($scope.Currentselectednodeid == undefined || $scope.Currentselectednodeid != nodeid) { |
472 | + $scope.CBDisableUI(); | |
471 | 473 | console.log("instance create for id : " + nodeid); |
472 | 474 | $scope.Currentselectednodeid = nodeid; |
473 | 475 | |
... | ... | @@ -546,9 +548,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
546 | 548 | |
547 | 549 | } |
548 | 550 | } |
549 | - else { | |
550 | - $scope.CBEnableUI(); | |
551 | - } | |
551 | + | |
552 | 552 | } |
553 | 553 | |
554 | 554 | $rootScope.cbSelectOnChange = function (obj,prevValue) { |
... | ... | @@ -568,7 +568,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - | |
572 | 571 | var isActive = false; |
573 | 572 | //Start Code by Sandeep for TicketNo: 49226(3) |
574 | 573 | $scope.DropDownSelectNodeClick = function (nodeid) { |
... | ... | @@ -720,7 +719,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
720 | 719 | } |
721 | 720 | } |
722 | 721 | |
723 | - | |
724 | 722 | $rootScope.cbPasswordModelShow = function () { |
725 | 723 | //var current_id = document.getElementById('cbSelect').value; |
726 | 724 | //traverseTreeSelectedSingleObj($rootScope.stru, current_id); |
... | ... | @@ -772,7 +770,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
772 | 770 | } |
773 | 771 | } |
774 | 772 | if ($scope.selectedNodeSingleObj._isBranch == "true") { |
775 | - //traverseTreeSelectedSingleObj($rootScope.Auther, current_id); | |
776 | 773 | traverseTreeSelectedSingleObj($rootScope.contentNotesForSaveCB, current_id); |
777 | 774 | //document.getElementById('cbRenameDate').value = $scope.selectedNodeSingleObj.modified; |
778 | 775 | $scope.setProperties(); |
... | ... | @@ -950,6 +947,143 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
950 | 947 | document.getElementById('cbModelDeleteBackground').style.display = "block"; |
951 | 948 | document.getElementById('cbModelDeleteConfirmBoxId').style.display = "block"; |
952 | 949 | } |
950 | + | |
951 | + $rootScope.ImportSection = function () { | |
952 | + var fileupload = document.getElementById("openCBJsonFile"); | |
953 | + $timeout(function () { | |
954 | + $(fileupload).trigger('click'); | |
955 | + }, 300); | |
956 | + | |
957 | + $(fileupload).val('');//old file path | |
958 | + fileupload.onchange = function () { | |
959 | + | |
960 | + var fileId, file, objFileRead; | |
961 | + if (typeof window.FileReader !== 'function') { | |
962 | + alert("The file API isn't supported on this browser yet."); | |
963 | + return; | |
964 | + } | |
965 | + fileId = document.getElementById('openCBJsonFile'); | |
966 | + if (!fileId) { | |
967 | + alert("File couldn't find the element."); | |
968 | + } | |
969 | + else if (!fileId.files) { | |
970 | + alert("This browser doesn't seem to support the `files` property of file inputs."); | |
971 | + } | |
972 | + else if (!fileId.files[0]) { | |
973 | + alert("Please select a file before clicking 'Load'"); | |
974 | + } | |
975 | + else { | |
976 | + file = fileId.files[0]; | |
977 | + var extension = file.name.split(".")[1]; | |
978 | + if (file.type == "application/json" && extension == "json") { | |
979 | + $timeout(function () { | |
980 | + objFileRead = new FileReader(); | |
981 | + objFileRead.onload = CbFileData; | |
982 | + objFileRead.readAsText(file); | |
983 | + }, 300); | |
984 | + } else { | |
985 | + alert("Please select only Export Curriculum Builder Json file!"); | |
986 | + } | |
987 | + | |
988 | + } | |
989 | + | |
990 | + function CbFileData(e) { | |
991 | + //$scope.CBEnableUI(); | |
992 | + var importdata = JSON.parse(e.target.result); | |
993 | + $rootScope.ImportCurriculum(importdata); | |
994 | + | |
995 | + } | |
996 | + }; | |
997 | + | |
998 | + } | |
999 | + | |
1000 | + $rootScope.ImportCurriculum = function (importdata) { | |
1001 | + var cbCurrentId = document.getElementById('cbSelect').value; | |
1002 | + if ($rootScope.structureObjForSaveCB.length == 0) { | |
1003 | + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1004 | + } | |
1005 | + if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1006 | + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents | |
1007 | + } | |
1008 | + $rootScope.updatedContentFromEditor(cbCurrentId); | |
1009 | + | |
1010 | + $scope.updateWindowsContentForSaveCB(cbCurrentId,false); | |
1011 | + | |
1012 | + $scope.newstructure = importdata.slideshow.presentation.structure; | |
1013 | + $scope.newcontent = importdata.slideshow.content.element; | |
1014 | + | |
1015 | + //set false for root for import | |
1016 | + $scope.newstructure._isRoot="false"; | |
1017 | + | |
1018 | + // modidy with new slide resolve conflict of id while import on same curriculum | |
1019 | + var date = new Date(); | |
1020 | + var newId =date.getTime().toString();//timestamp is the number of milliseconds that have passed since January 1, 1970 | |
1021 | + $scope.newstructure._id+="-"+newId; | |
1022 | + | |
1023 | + var newData=[]; | |
1024 | + var parentid = $('#jstree').jstree('get_selected')[0]; | |
1025 | + newData.push({ "id" : $scope.newstructure._id,"chid":$scope.newstructure._id+'_imp', "isBranch":$scope.newstructure._isBranch , "parent" : parentid, "label" : $scope.newstructure._label}) | |
1026 | + | |
1027 | + function traverseTreeforImportContent(o,pid) { | |
1028 | + for (var i in o) { | |
1029 | + if (o[i] !== null && typeof (o[i]) == "object") { | |
1030 | + var selectedNode = o[i]; | |
1031 | + var childId = selectedNode._id; | |
1032 | + if(childId!=undefined) | |
1033 | + { | |
1034 | + for (var k = 0; k < $scope.newcontent.length; k++) { | |
1035 | + if (($scope.newcontent[k]._id == childId)) { | |
1036 | + childId=childId +'-'+newId; | |
1037 | + o[i]._id= childId; | |
1038 | + $scope.newcontent[k]._id=childId; | |
1039 | + newData.push({ "id" : childId, "chid":childId+'_imp' ,"isBranch":selectedNode._isBranch, "parent" : pid+'_imp', "label" : selectedNode._label}) | |
1040 | + break; | |
1041 | + } | |
1042 | + } | |
1043 | + } | |
1044 | + var newpid= i=="structure"?pid: childId; | |
1045 | + | |
1046 | + traverseTreeforImportContent(o[i],newpid); | |
1047 | + } | |
1048 | + } | |
1049 | + } | |
1050 | + traverseTreeforImportContent($scope.newstructure,$scope.newstructure._id); | |
1051 | + | |
1052 | + //expend parent if collapse | |
1053 | + $("#jstree").jstree("open_node", $('#'+parentid)); | |
1054 | + | |
1055 | + traverseTreeSelectedSingleObj($rootScope.stru, cbCurrentId); | |
1056 | + | |
1057 | + | |
1058 | + $scope.selectedNodeSingleObj['structure'].push($scope.newstructure); | |
1059 | + | |
1060 | + $.merge($rootScope.contentNotesForSaveCB,$scope.newcontent); | |
1061 | + | |
1062 | + $rootScope.cbDynamicContents=$rootScope.contentNotesForSaveCB; | |
1063 | + $rootScope.cbDynamicJsonData.slideshow.content.element=$rootScope.cbDynamicContents; | |
1064 | + $rootScope.structure = $rootScope.cbDynamicJsonData.slideshow.presentation.structure.structure | |
1065 | + | |
1066 | + // add new node to tree | |
1067 | + for (var i = 0 ; i < newData.length; i++) { | |
1068 | + $('#jstree').jstree().create_node(newData[i].parent, { | |
1069 | + "id": newData[i].chid, | |
1070 | + "text":'<span id=' + newData[i].id + ' isbranch='+newData[i].isBranch+' >'+newData[i].label+'</span>' | |
1071 | + }, "last"); | |
1072 | + } | |
1073 | + $timeout(function(){ | |
1074 | + for (var i = 0 ; i < newData.length; i++) { | |
1075 | + $("#jstree").jstree("open_node", $('#'+newData[i].chid)); | |
1076 | + var span_Id = newData[i].id; | |
1077 | + var isbranch = newData[i].isBranch; | |
1078 | + if (isbranch == "false") { | |
1079 | + $("#jstree").jstree(true).set_icon(span_Id, "../../../content/images/CB/file.png"); | |
1080 | + } | |
1081 | + } | |
1082 | + },500); | |
1083 | + | |
1084 | + | |
1085 | + } | |
1086 | + | |
953 | 1087 | $rootScope.ExportSection = function () { |
954 | 1088 | var currentid = document.getElementById('cbSelect').value; |
955 | 1089 | |
... | ... | @@ -981,10 +1115,10 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
981 | 1115 | alert("Curriculum name is empty!"); |
982 | 1116 | return; |
983 | 1117 | } |
984 | - | |
1118 | + | |
985 | 1119 | var strFromParent=$scope.selectedNodeSingleObj['structure']; |
986 | 1120 | var parentLevel=$scope.selectedNodeSingleObj._label; |
987 | - var parentId=$scope.selectedNodeSingleObj._id; | |
1121 | + var parentId=$scope.selectedNodeSingleObj._id ; | |
988 | 1122 | |
989 | 1123 | var rootNoteSummary = new jinqJs() |
990 | 1124 | .from($rootScope.contentNotesForSaveCB) |
... | ... | @@ -1012,7 +1146,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1012 | 1146 | { |
1013 | 1147 | for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) { |
1014 | 1148 | if (($rootScope.contentNotesForSaveCB[k]._id == childId)) { |
1015 | - $scope.SectionContentForExportCB.push($rootScope.contentNotesForSaveCB[k]); | |
1149 | + $scope.SectionContentForExportCB.push($rootScope.contentNotesForSaveCB[k]); | |
1150 | + break; | |
1016 | 1151 | } |
1017 | 1152 | } |
1018 | 1153 | } |
... | ... | @@ -1022,9 +1157,9 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1022 | 1157 | |
1023 | 1158 | } |
1024 | 1159 | } |
1025 | - | |
1160 | + | |
1026 | 1161 | traverseTreeforExportContent(strFromParent); |
1027 | - | |
1162 | + | |
1028 | 1163 | $rootScope.dynamicUpdatedJsonForExportCB = |
1029 | 1164 | { |
1030 | 1165 | "slideshow": { |
... | ... | @@ -1071,7 +1206,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1071 | 1206 | |
1072 | 1207 | } |
1073 | 1208 | |
1074 | - | |
1075 | 1209 | $rootScope.DeleteSlideSection = function () { |
1076 | 1210 | var cbCurrentSelectedId = document.getElementById('cbSelect').value; |
1077 | 1211 | var CurrentSelectedLiId = $('#' + cbCurrentSelectedId).closest('li').attr('id'); |
... | ... | @@ -1093,7 +1227,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1093 | 1227 | else { |
1094 | 1228 | $rootScope.cbBack(); |
1095 | 1229 | } |
1096 | - //$scope.deleteSectionForCB(cbCurrentSelectedId, CurrentSelectedParentSpanId); | |
1097 | 1230 | $scope.DeleteSlide(cbCurrentSelectedId, CurrentSelectedParentSpanId); |
1098 | 1231 | var CurrentId = document.getElementById('cbSelect').value; |
1099 | 1232 | $scope.DropDownSelectNodeClick(CurrentId); |
... | ... | @@ -1105,7 +1238,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1105 | 1238 | document.getElementById('cbModelDeleteConfirmBoxId').style.display = "none"; |
1106 | 1239 | } |
1107 | 1240 | |
1108 | - | |
1109 | 1241 | $rootScope.CBAddSlide = function () { |
1110 | 1242 | var current_id |
1111 | 1243 | if (($rootScope.getLocalStorageValue("cbSelectId")) != '') { |
... | ... | @@ -1115,7 +1247,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1115 | 1247 | current_id = document.getElementById('cbSelect').value; |
1116 | 1248 | } |
1117 | 1249 | |
1118 | - | |
1119 | 1250 | traverseTreeSelectedSingleObj($rootScope.stru, current_id); |
1120 | 1251 | var parentid = $('#' + current_id).parent().parent().parent().parent().find('span').attr('id'); |
1121 | 1252 | var createNodeId; |
... | ... | @@ -1128,31 +1259,68 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1128 | 1259 | createNodeId = parentid; |
1129 | 1260 | } |
1130 | 1261 | |
1131 | - var AddSlideId = ""; | |
1132 | - var AddSlideLiId = ""; | |
1133 | - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
1262 | + var date = new Date(); | |
1263 | + var newSlideId = 'sd'+date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 | |
1264 | + | |
1265 | + var treeliId=newSlideId+'li'; | |
1266 | + | |
1267 | + //expend parent if collapse | |
1268 | + $("#jstree").jstree("open_node", $('#'+createNodeId)); | |
1134 | 1269 | |
1135 | - for (var i = 0; i < 5; i++) { | |
1136 | - AddSlideId += possible.charAt(Math.floor(Math.random() * possible.length)); | |
1137 | - AddSlideLiId += possible.charAt(Math.floor(Math.random() * (possible.length) + 1)); | |
1138 | - } | |
1139 | - // var AddSlideId = 'abcd'; | |
1140 | - //var AddSlideId = Math.random().toString(); | |
1141 | 1270 | $('#jstree').jstree().create_node(createNodeId, { |
1142 | - li_attr: { "name": "isBranchFalse" }, | |
1143 | - "id": AddSlideLiId, | |
1144 | - "text": '<span id=' + AddSlideId + ' >New Slide</span>' | |
1271 | + "id": treeliId, | |
1272 | + "text": '<span id=' + newSlideId + ' isbranch="false" >New Slide</span>' | |
1145 | 1273 | }, "last", function () { |
1146 | - // //$scope.addCBSlide(current_id, AddSlideId); | |
1147 | - $scope.addSlide(createNodeId, AddSlideId); | |
1148 | - //$scope.DropDownSelectNodeClick(current_id); | |
1274 | + $scope.addSlide(createNodeId, newSlideId); | |
1149 | 1275 | $('#jstree').jstree(true).deselect_all(); |
1150 | - $('#jstree').jstree('select_node', AddSlideLiId); | |
1151 | - //$('#jstree').jstree('select_node', AddSlideId); | |
1152 | - //$scope.openTinyMCE(AddSlideId); | |
1276 | + $('#jstree').jstree('select_node', newSlideId); | |
1277 | + }); | |
1153 | 1278 | |
1279 | + } | |
1280 | + | |
1281 | + $scope.addSlide = function (currentid, AddSlideId) { | |
1282 | + if ($rootScope.structureObjForSaveCB.length == 0) { | |
1283 | + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1284 | + } | |
1285 | + | |
1286 | + traverseTreeSelectedSingleObj($rootScope.stru, currentid); | |
1287 | + | |
1288 | + if (currentid == "-225638207") { | |
1289 | + $rootScope.selectedNodeSingle.push( | |
1290 | + { | |
1291 | + "_label": "NEW Slide1", | |
1292 | + "_id": AddSlideId, | |
1293 | + "_isRoot": "false", | |
1294 | + "_isBranch": "false", | |
1295 | + "_isLocked": "false" | |
1296 | + }); | |
1297 | + $rootScope.structureObjForSaveCB.push({ | |
1298 | + "_label": "NEW Slide1", | |
1299 | + "_id": AddSlideId, | |
1300 | + "_isRoot": "false", | |
1301 | + "_isBranch": "false", | |
1302 | + "_isLocked": "false" | |
1303 | + }); | |
1304 | + } | |
1305 | + else { | |
1306 | + $scope.selectedNodeSingleObj['structure'].push({ | |
1307 | + "_label": "New Slide", | |
1308 | + "_id": AddSlideId, | |
1309 | + "_isRoot": "false", | |
1310 | + "_isBranch": "false", | |
1311 | + "_isLocked": "false" | |
1312 | + }); | |
1154 | 1313 | |
1155 | - }); | |
1314 | + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) { | |
1315 | + if ($rootScope.structureObjForSaveCB[i]._id == currentid) { | |
1316 | + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure']; | |
1317 | + } | |
1318 | + } | |
1319 | + } | |
1320 | + | |
1321 | + setTimeout(function () { | |
1322 | + $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); | |
1323 | + }, 500); | |
1156 | 1324 | } |
1157 | 1325 | |
1158 | 1326 | $rootScope.CBAddSection = function () { |
... | ... | @@ -1174,88 +1342,100 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1174 | 1342 | createNodeId = parentid; |
1175 | 1343 | |
1176 | 1344 | } |
1345 | + var date = new Date(); | |
1346 | + var newSectionId = 'sn'+date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 | |
1347 | + | |
1348 | + var treeliId=newSectionId+'li'; | |
1349 | + //expend parent if collapse | |
1350 | + $("#jstree").jstree("open_node", $('#'+createNodeId)); | |
1177 | 1351 | |
1178 | - var AddSectionId = ""; | |
1179 | - var AddSectionLiId = ""; | |
1180 | - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
1181 | - | |
1182 | - for (var i = 0; i < 5; i++) { | |
1183 | - AddSectionId += possible.charAt(Math.floor(Math.random() * possible.length)); | |
1184 | - AddSectionLiId += possible.charAt(Math.floor(Math.random() * (possible.length) + 1)); | |
1185 | - } | |
1186 | - | |
1187 | - // var AddSlideId = 'abcd'; | |
1188 | - //var AddSlideId = Math.random().toString(); | |
1189 | 1352 | $('#jstree').jstree().create_node(createNodeId, { |
1190 | - li_attr: { "name": "isBranchFalse" }, | |
1191 | - "id": AddSectionLiId, | |
1192 | - "text": '<span id=' + AddSectionId + ' >New Section</span>' | |
1353 | + "id": treeliId, | |
1354 | + "text": '<span id=' + newSectionId + ' isbranch="true" >New Section</span>' | |
1193 | 1355 | }, "last", function () { |
1194 | - //$scope.addCBSlide(current_id, AddSlideId); | |
1195 | - $scope.addSection(createNodeId, AddSectionId); | |
1196 | - //$scope.DropDownSelectNodeClick(current_id); | |
1356 | + $scope.addSection(createNodeId, newSectionId); | |
1197 | 1357 | $('#jstree').jstree(true).deselect_all(); |
1198 | - //$('#jstree').jstree('select_node', AddSectionId); | |
1199 | - $('#jstree').jstree('select_node', AddSectionLiId); | |
1200 | - | |
1201 | - | |
1358 | + $('#jstree').jstree('select_node', newSectionId); | |
1202 | 1359 | }); |
1203 | 1360 | |
1204 | 1361 | } |
1205 | 1362 | |
1363 | + $scope.addSection = function (currentid, AddSecionId) { | |
1206 | 1364 | |
1207 | - function traverseForLoadDropDown(o) { | |
1208 | - | |
1209 | - for (var i = 0; i < o.structure.structure.length; i++) { | |
1210 | - $('#cbSelect').append('<option value="' + o.structure.structure[i]._id + '">' + o.structure.structure[i]._label + '</option>'); | |
1365 | + if ($rootScope.structureObjForSaveCB.length == 0) { | |
1366 | + $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1367 | + } | |
1368 | + if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1369 | + $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; | |
1211 | 1370 | } |
1212 | - } | |
1213 | 1371 | |
1372 | + traverseTreeSelectedSingleObj($rootScope.stru, currentid); | |
1373 | + traverse($rootScope.stru, currentid); | |
1374 | + if (currentid == "-225638207") { | |
1375 | + $rootScope.selectedNodeSingle.push( | |
1376 | + { | |
1377 | + "structure": { | |
1378 | + "structure": [ | |
1379 | + ], | |
1380 | + "_label": "New Section", | |
1381 | + "_id": AddSecionId, | |
1382 | + "_isRoot": "false", | |
1383 | + "_isBranch": "true", | |
1384 | + "_isLocked": "false" | |
1385 | + } | |
1214 | 1386 | |
1387 | + }); | |
1388 | + $rootScope.structureObjForSaveCB.push( | |
1389 | + { | |
1390 | + "structure": [ | |
1391 | + ], | |
1392 | + "_label": "New Section", | |
1393 | + "_id": AddSecionId, | |
1394 | + "_isRoot": "false", | |
1395 | + "_isBranch": "true", | |
1396 | + "_isLocked": "false" | |
1215 | 1397 | |
1216 | - $scope.deleteSectionForCB = function (currentid, CurrentSelectedParentSpanId) { | |
1398 | + }); | |
1399 | + } | |
1400 | + else { | |
1401 | + $scope.selectedNodeSingleObj['structure'].push( | |
1402 | + { | |
1403 | + "structure": [ | |
1404 | + ], | |
1405 | + "_label": "New Section", | |
1406 | + "_id": AddSecionId, | |
1407 | + "_isRoot": "false", | |
1408 | + "_isBranch": "true", | |
1409 | + "_isLocked": "false" | |
1410 | + }); | |
1217 | 1411 | |
1218 | - if ($rootScope.structureObjForSaveCB.length == 0) { | |
1412 | + $rootScope.contentNotesForSaveCB.push( | |
1413 | + { | |
1414 | + "summary": "", | |
1415 | + "author": "", | |
1416 | + "modified": "", | |
1417 | + "password": "", | |
1418 | + "version": "", | |
1419 | + "windows": "", | |
1420 | + "_id": AddSecionId | |
1421 | + }); | |
1219 | 1422 | |
1220 | - $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1221 | - } | |
1222 | - if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1223 | - //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element; | |
1224 | - $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents | |
1225 | - } | |
1226 | - traverseTreeSelectedSingleObj($rootScope.structureObjForSaveCB, currentid); | |
1227 | - if ($scope.selectedNodeSingleObj._isBranch == "true") { | |
1228 | - for (var j = 0; j < $scope.selectedNodeSingleObj['structure'].length; j++) { | |
1229 | - if ($scope.selectedNodeSingleObj._id == currentid) { | |
1230 | - var childNodesForSelectedSection = $scope.selectedNodeSingleObj['structure']; | |
1231 | - | |
1232 | - if (childNodesForSelectedSection.length > 0) { | |
1233 | - | |
1234 | - for (var l = 0; l < childNodesForSelectedSection.length; l++) { | |
1235 | - var childId = childNodesForSelectedSection[l]._id; // Get Child ID for selected Section node | |
1236 | - for (var k = 0; k < $rootScope.contentNotesForSaveCB.length; k++) { | |
1237 | - if (($rootScope.contentNotesForSaveCB[k]._id == childId)) { | |
1238 | - $rootScope.contentNotesForSaveCB.splice(k, 1); | |
1239 | - } | |
1240 | - } | |
1241 | - } | |
1242 | - } | |
1423 | + | |
1424 | + for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) { | |
1425 | + if ($rootScope.structureObjForSaveCB[i]._id == currentid) { | |
1426 | + $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure']; | |
1243 | 1427 | } |
1244 | - $scope.selectedNodeSingleObj['structure'].splice(j, 1); | |
1245 | - //$rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1246 | 1428 | } |
1429 | + | |
1247 | 1430 | } |
1431 | + | |
1432 | + } | |
1248 | 1433 | |
1434 | + function traverseForLoadDropDown(o) { | |
1249 | 1435 | |
1250 | - //Delete notes for SavedraftCB as per Selected Section from tree | |
1251 | - var deleteNotes = $rootScope.contentNotesForSaveCB | |
1252 | - var remaingNotesForCB = new jinqJs() | |
1253 | - .from(deleteNotes) | |
1254 | - .delete().at("_id == " + currentid).select(); | |
1255 | - $rootScope.contentNotesForSaveCB = remaingNotesForCB; | |
1256 | - | |
1257 | - //$rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; | |
1258 | - | |
1436 | + for (var i = 0; i < o.structure.structure.length; i++) { | |
1437 | + $('#cbSelect').append('<option value="' + o.structure.structure[i]._id + '">' + o.structure.structure[i]._label + '</option>'); | |
1438 | + } | |
1259 | 1439 | } |
1260 | 1440 | |
1261 | 1441 | function getLoadNodeId(o) { |
... | ... | @@ -1276,7 +1456,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1276 | 1456 | $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; |
1277 | 1457 | } |
1278 | 1458 | if ($rootScope.contentNotesForSaveCB.length == 0) { |
1279 | - //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element; | |
1280 | 1459 | $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents |
1281 | 1460 | } |
1282 | 1461 | |
... | ... | @@ -1409,7 +1588,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1409 | 1588 | $("#filename").val(""); |
1410 | 1589 | } |
1411 | 1590 | |
1412 | - | |
1413 | 1591 | $rootScope.updatedContentFromEditor = function (cbCurrentId) { |
1414 | 1592 | |
1415 | 1593 | if ($rootScope.contentNotesForSaveCB.length == 0) { |
... | ... | @@ -1427,8 +1605,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1427 | 1605 | if (notesForSelectedSlide == "" || notesForSelectedSlide == undefined) { |
1428 | 1606 | notesForSelectedSlide = selectedSlideContent[0].notes; |
1429 | 1607 | } |
1430 | - //Calling method for update Windows Data for selected slide | |
1431 | - //$scope.windowsContentForSelectedSlide(windowsInSelectedSlide); | |
1608 | + | |
1432 | 1609 | } |
1433 | 1610 | else { |
1434 | 1611 | windowsInSelectedSlide = ""; |
... | ... | @@ -1454,7 +1631,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1454 | 1631 | } |
1455 | 1632 | |
1456 | 1633 | else if ($scope.selectedNodeSingleObj._isBranch == "true" && $scope.selectedNodeSingleObj._isRoot == "true") { |
1457 | - //traverseTreeSelectedSingleObj($rootScope.Auther, cbCurrentId); | |
1458 | 1634 | traverseTreeSelectedSingleObj($rootScope.cbDynamicContents, cbCurrentId); |
1459 | 1635 | $rootScope.contentNotesForSaveCB.push( |
1460 | 1636 | { |
... | ... | @@ -1471,7 +1647,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1471 | 1647 | }); |
1472 | 1648 | } |
1473 | 1649 | else if ($scope.selectedNodeSingleObj._isBranch == "true") { |
1474 | - //traverseTreeSelectedSingleObj($rootScope.Auther, cbCurrentId); | |
1475 | 1650 | traverseTreeSelectedSingleObj($rootScope.cbDynamicContents, cbCurrentId); |
1476 | 1651 | $rootScope.contentNotesForSaveCB.push( |
1477 | 1652 | { |
... | ... | @@ -1494,241 +1669,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1494 | 1669 | |
1495 | 1670 | } |
1496 | 1671 | |
1497 | - | |
1498 | - $rootScope.exportToFile = function () { | |
1499 | - | |
1500 | - var cbCurrentId = document.getElementById('cbSelect').value; | |
1501 | - if ($rootScope.structureObjForSaveCB.length == 0) { | |
1502 | - //$rootScope.structureObjForSaveCB = $rootScope.structure;// only Tree Array | |
1503 | - //$rootScope.structureObjForSaveCB = $rootScope.stru.slideshow.presentation.structure.structure; | |
1504 | - $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1505 | - } | |
1506 | - if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1507 | - //$rootScope.contentNotesForSaveCB = $rootScope.cbJsonData.slideshow.content.element; | |
1508 | - $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents;//Assign Dnamic Contents | |
1509 | - } | |
1510 | - $rootScope.updatedContentFromEditor(cbCurrentId); | |
1511 | - | |
1512 | - $rootScope.dynamicUpdatedJsonForSaveCB = | |
1513 | - { | |
1514 | - "slideshow": { | |
1515 | - "presentation": { | |
1516 | - "structure": { | |
1517 | - "structure": //[ | |
1518 | - | |
1519 | - $rootScope.structureObjForSaveCB, | |
1520 | - //], | |
1521 | - "_label": $rootScope.cbTreeFirstLabel, | |
1522 | - "_id": $rootScope.cbTreeFirstID, | |
1523 | - "_isRoot": "true", | |
1524 | - "_isBranch": "true", | |
1525 | - "_isLocked": "false" | |
1526 | - }, | |
1527 | - "_anchor": "true", | |
1528 | - "_window_position": "6,10", | |
1529 | - "_window_size": "828,453" // Apply Dynamic | |
1530 | - }, | |
1531 | - "content": { | |
1532 | - "element": //[ | |
1533 | - | |
1534 | - $rootScope.contentNotesForSaveCB, | |
1535 | - //] | |
1536 | - } | |
1537 | - } | |
1538 | - | |
1539 | - }; | |
1540 | - | |
1541 | - $scope.slideshow = $rootScope.dynamicUpdatedJsonForSaveCB; | |
1542 | - $scope.filename = "SandySaveCB.json"; | |
1543 | - var filename = $scope.filename; | |
1544 | - var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/text' }); | |
1545 | - if (window.navigator && window.navigator.msSaveOrOpenBlob) { | |
1546 | - window.navigator.msSaveOrOpenBlob(blob, filename); | |
1547 | - } | |
1548 | - else { | |
1549 | - | |
1550 | - $(document).execCommand("SaveAs", true, filename); | |
1551 | - document.execCommand("SaveAs", true, filename); | |
1552 | - angular.element(document.execCommand("SaveAs", false, filename)).scope(); | |
1553 | - | |
1554 | - //var e = document.createEvent('MouseEvents'), | |
1555 | - //a = document.createElement('a'); | |
1556 | - // a.download = filename; | |
1557 | - //a.href = window.URL.createObjectURL(blob); | |
1558 | - //a.dataset.downloadurl = ['text/json', a.download, a.href].join(':'); | |
1559 | - //e.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
1560 | - //a.dispatchEvent(e); | |
1561 | - //window.URL.revokeObjectURL(url); // clean the url.createObjectURL resource | |
1562 | - } | |
1563 | - $rootScope.dynamicUpdatedJsonForSaveCB = ""; | |
1564 | - //$rootScope.contentNotesForSaveCB = []; | |
1565 | - //$rootScope.structureObjForSaveCB = []; | |
1566 | - | |
1567 | - // $http({ method: 'Post', url: $scope.fileName }).success(function (data) { | |
1568 | - // localStorage.setItem("cbJsonDataObject", JSON.stringify(data)); | |
1569 | - // $rootScope.cbJsonData = JSON.parse(localStorage.getItem("cbJsonDataObject")); | |
1570 | - // $rootScope.cbDynamicJsonData = data; | |
1571 | - // //$scope.getCBsummary(); | |
1572 | - // $rootScope.cbJsonData.slideshow.content.element = "Eement data"; | |
1573 | - // $rootScope.cbDynamicJsonData.slideshow.content.element = "slideshow element data"; | |
1574 | - // $rootScope.note = "save data" | |
1575 | - // //$scope.openCurriculumDetail(); | |
1576 | - // }) | |
1577 | - //.error(function (data, status, headers, config) { | |
1578 | - // console.log(data); | |
1579 | - //}); | |
1580 | - }; | |
1581 | - | |
1582 | - $scope.addSection = function (currentid, AddSecionId) { | |
1583 | - | |
1584 | - if ($rootScope.structureObjForSaveCB.length == 0) { | |
1585 | - $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1586 | - } | |
1587 | - if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1588 | - $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; | |
1589 | - } | |
1590 | - | |
1591 | - traverseTreeSelectedSingleObj($rootScope.stru, currentid); | |
1592 | - traverse($rootScope.stru, currentid); | |
1593 | - if (currentid == "-225638207") { | |
1594 | - $rootScope.selectedNodeSingle.push( | |
1595 | - { | |
1596 | - "structure": { | |
1597 | - "structure": [ | |
1598 | - ], | |
1599 | - "_label": "New Section", | |
1600 | - "_id": AddSecionId, | |
1601 | - "_isRoot": "false", | |
1602 | - "_isBranch": "true", | |
1603 | - "_isLocked": "false" | |
1604 | - } | |
1605 | - | |
1606 | - }); | |
1607 | - $rootScope.structureObjForSaveCB.push( | |
1608 | - { | |
1609 | - "structure": [ | |
1610 | - ], | |
1611 | - "_label": "New Section", | |
1612 | - "_id": AddSecionId, | |
1613 | - "_isRoot": "false", | |
1614 | - "_isBranch": "true", | |
1615 | - "_isLocked": "false" | |
1616 | - | |
1617 | - }); | |
1618 | - } | |
1619 | - else { | |
1620 | - $scope.selectedNodeSingleObj['structure'].push( | |
1621 | - { | |
1622 | - "structure": [ | |
1623 | - ], | |
1624 | - "_label": "New Section", | |
1625 | - "_id": AddSecionId, | |
1626 | - "_isRoot": "false", | |
1627 | - "_isBranch": "true", | |
1628 | - "_isLocked": "false" | |
1629 | - }); | |
1630 | - | |
1631 | - $rootScope.contentNotesForSaveCB.push( | |
1632 | - { | |
1633 | - "summary": "", | |
1634 | - "author": "", | |
1635 | - "modified": "", | |
1636 | - "password": "", | |
1637 | - "version": "", | |
1638 | - "windows": "", | |
1639 | - "_id": AddSecionId | |
1640 | - //"notes": notesForSelectedSlide, | |
1641 | - //"windows": windowsInSelectedSlide, | |
1642 | - //"_id": cbCurrentId | |
1643 | - }); | |
1644 | - | |
1645 | - //if (currentid == $rootScope.cbTreeFirstID) { | |
1646 | - // $rootScope.structureObjForSaveCB.push( | |
1647 | - // { | |
1648 | - // "structure": [ | |
1649 | - // ], | |
1650 | - // "_label": "New Section", | |
1651 | - // "_id": AddSecionId, | |
1652 | - // "_isRoot": "false", | |
1653 | - // "_isBranch": "true", | |
1654 | - // "_isLocked": "false" | |
1655 | - // }); | |
1656 | - //} | |
1657 | - //else { | |
1658 | - for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) { | |
1659 | - if ($rootScope.structureObjForSaveCB[i]._id == currentid) { | |
1660 | - $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure']; | |
1661 | - } | |
1662 | - } | |
1663 | - //} | |
1664 | - } | |
1665 | - // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 1500); | |
1666 | - } | |
1667 | - | |
1668 | - $scope.addSlide = function (currentid, AddSlideId) { | |
1669 | - if ($rootScope.structureObjForSaveCB.length == 0) { | |
1670 | - $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; | |
1671 | - } | |
1672 | - //if ($rootScope.contentNotesForSaveCB.length == 0) { | |
1673 | - // $rootScope.contentNotesForSaveCB = $rootScope.cbDynamicContents; | |
1674 | - //} | |
1675 | - traverseTreeSelectedSingleObj($rootScope.stru, currentid); | |
1676 | - // traverse($rootScope.stru, currentid); | |
1677 | - //console.log(JSON.stringify($scope.upDateJsonObj)) | |
1678 | - if (currentid == "-225638207") { | |
1679 | - $rootScope.selectedNodeSingle.push( | |
1680 | - { | |
1681 | - "_label": "NEW Slide1", | |
1682 | - "_id": AddSlideId, | |
1683 | - "_isRoot": "false", | |
1684 | - "_isBranch": "false", | |
1685 | - "_isLocked": "false" | |
1686 | - }); | |
1687 | - $rootScope.structureObjForSaveCB.push({ | |
1688 | - "_label": "NEW Slide1", | |
1689 | - "_id": AddSlideId, | |
1690 | - "_isRoot": "false", | |
1691 | - "_isBranch": "false", | |
1692 | - "_isLocked": "false" | |
1693 | - }); | |
1694 | - } | |
1695 | - else { | |
1696 | - $scope.selectedNodeSingleObj['structure'].push({ | |
1697 | - "_label": "New Slide", | |
1698 | - "_id": AddSlideId, | |
1699 | - "_isRoot": "false", | |
1700 | - "_isBranch": "false", | |
1701 | - "_isLocked": "false" | |
1702 | - }); | |
1703 | - | |
1704 | - //$rootScope.contentNotesForSaveCB.push({ | |
1705 | - // "notes": tinyMCE.activeEditor.getContent(), | |
1706 | - // "windows": "", | |
1707 | - // "_id": AddSlideId | |
1708 | - //}); | |
1709 | - | |
1710 | - //if (currentid == $rootScope.cbTreeFirstID) { | |
1711 | - // $rootScope.structureObjForSaveCB.push({ | |
1712 | - // "_label": "New Slide", | |
1713 | - // "_id": AddSlideId, | |
1714 | - // "_isRoot": "false", | |
1715 | - // "_isBranch": "false", | |
1716 | - // "_isLocked": "false" | |
1717 | - // }); | |
1718 | - //} | |
1719 | - //else { | |
1720 | - for (var i = 0; i < $rootScope.structureObjForSaveCB.length; i++) { | |
1721 | - if ($rootScope.structureObjForSaveCB[i]._id == currentid) { | |
1722 | - $rootScope.structureObjForSaveCB[i]['structure'] = $scope.selectedNodeSingleObj['structure']; | |
1723 | - } | |
1724 | - } | |
1725 | - //} | |
1726 | - } | |
1727 | - // setTimeout(function () { traverseTreeForSetIcons($rootScope.stru, currentid); }, 3000); | |
1728 | - setTimeout(function () { $("#jstree").jstree(true).set_icon(AddSlideId, "../../../content/images/CB/file.png"); }, 100); | |
1729 | - } | |
1730 | - | |
1731 | - | |
1732 | 1672 | $scope.moveDown = function (currentid) { |
1733 | 1673 | |
1734 | 1674 | traverse($rootScope.stru, currentid); |
... | ... | @@ -1747,8 +1687,6 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1747 | 1687 | |
1748 | 1688 | $scope.moveUP = function (currentid) { |
1749 | 1689 | traverse($rootScope.stru, currentid); |
1750 | - //console.log("cbJsonData Before" + JSON.stringify($rootScope.stru)); | |
1751 | - //console.log("upDateJsonObj Before" + JSON.stringify($scope.selectedNodeSiblingObjs)); | |
1752 | 1690 | for (var j = 0; j < $scope.selectedNodeSiblingObjs.length; j++) { |
1753 | 1691 | |
1754 | 1692 | if (($scope.selectedNodeSiblingObjs[j]._id == currentid) && ($scope.selectedNodeSiblingObjs[j - 1] != undefined)) { |
... | ... | @@ -1758,9 +1696,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1758 | 1696 | } |
1759 | 1697 | } |
1760 | 1698 | $rootScope.structureObjForSaveCB = $rootScope.stru.structure.structure; |
1761 | - //console.log("upDateJsonObjenew after" + JSON.stringify($scope.selectedNodeSiblingObjs)); | |
1762 | - //console.log("stru after" + JSON.stringify($rootScope.stru)); | |
1763 | - //console.log("structure after" + JSON.stringify($rootScope.structure)); | |
1699 | + | |
1764 | 1700 | } |
1765 | 1701 | |
1766 | 1702 | function traverseTreeSelectedSingleObj(o, current_id) { |
... | ... | @@ -2157,128 +2093,8 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
2157 | 2093 | } |
2158 | 2094 | } |
2159 | 2095 | |
2160 | - //Start Code for Update Windows Content for DA, CA, CI, AA, 3D Module to Save CB | |
2161 | - $scope.windowsContentForSelectedSlide = function (currentId) { | |
2162 | - var contentWindowsdata = $rootScope.contentNotesForSaveCB; | |
2163 | - $scope.setWinDataToArray = []; | |
2164 | - var selectedSlideContent = new jinqJs() | |
2165 | - .from(contentWindowsdata) | |
2166 | - .where("_id == " + currentId) | |
2167 | - .select(); | |
2168 | - if (selectedSlideContent[0].windows != "") { | |
2169 | - if (selectedSlideContent != undefined && Array.isArray(selectedSlideContent[0].windows.window)) { | |
2170 | - for (var i = 0 ; i < selectedSlideContent[0].windows.window.length; i++) { | |
2171 | - $scope.windowDataforCB = JSON.parse(selectedSlideContent[0].windows.window[i]) | |
2172 | - $scope.setWinDataToArray.push($scope.windowDataforCB); | |
2173 | - } | |
2174 | - } | |
2175 | - else { | |
2176 | - $scope.windowDataforCB = JSON.parse(selectedSlideContent[0].windows.window) | |
2177 | - $scope.setWinDataToArray.push($scope.windowDataforCB); | |
2178 | - } | |
2179 | - $rootScope.updateWindowsContentForSaveCB_Old(currentId); | |
2180 | - } | |
2181 | - } | |
2182 | - | |
2183 | 2096 | $scope.updatedWindowListForSaveCB = []; |
2184 | 2097 | |
2185 | - $rootScope.updateWindowsContentForSaveCB_Old = function (currentId) { | |
2186 | - var isAA = true; var isCI = true; var isDA = true; | |
2187 | - for (var j = 0; j < $scope.setWinDataToArray.length; j++) { | |
2188 | - | |
2189 | - switch ($scope.setWinDataToArray[j].mType) { | |
2190 | - case "MY_PICTURES": | |
2191 | - $scope.savePicWindowActivity($scope.windowDataforCB); | |
2192 | - break; | |
2193 | - case "DISSECTIBLE_ANATOMY": | |
2194 | - $scope.saveDAWindowActivity(); | |
2195 | - break; | |
2196 | - case "ATLAS_ANATOMY": | |
2197 | - if (isAA) { | |
2198 | - $scope.saveAAWindowActivity(); | |
2199 | - isAA = false; | |
2200 | - } | |
2201 | - break; | |
2202 | - case "CLINICAL_ILLUSTRATIONS": | |
2203 | - if (isCI) { | |
2204 | - $scope.saveCIWindowActivity(); | |
2205 | - isCI = false; | |
2206 | - } | |
2207 | - break; | |
2208 | - case "CLINICAL_ANIMATIONS": | |
2209 | - $scope.saveCAWindowActivity(); | |
2210 | - break; | |
2211 | - case "THREE_D_ANATOMY": | |
2212 | - $scope.save3DWindowActivity(); | |
2213 | - break; | |
2214 | - default: | |
2215 | - | |
2216 | - } | |
2217 | - } | |
2218 | - findKeyForChange($rootScope.contentNotesForSaveCB, currentId); | |
2219 | - $scope.selectedKey.windows.window = []; | |
2220 | - | |
2221 | - for (var s = 0; s < $scope.updatedWindowListForSaveCB.length; s++) { | |
2222 | - var arrToStrWinObj = JSON.stringify($scope.updatedWindowListForSaveCB[s]); | |
2223 | - $scope.selectedKey.windows.window.push(arrToStrWinObj); | |
2224 | - } | |
2225 | - $scope.updatedWindowListForSaveCB = []; | |
2226 | - console.log($scope.selectedKey.windows.window); | |
2227 | - } | |
2228 | - | |
2229 | - $scope.saveCIWindowActivity_Old = function (keyName, value) { | |
2230 | - for (var i = 0; i < $scope.setWinDataToArray.length; i++) { | |
2231 | - $scope.setWinDataToArray[i][keyName] = value; | |
2232 | - var current_id; | |
2233 | - if (($rootScope.getLocalStorageValue("cbSelectId")) != '') { | |
2234 | - current_id = $rootScope.getLocalStorageValue("cbSelectId"); | |
2235 | - } | |
2236 | - else { | |
2237 | - current_id = document.getElementById('cbSelect').value; | |
2238 | - } | |
2239 | - findKeyForChange($rootScope.contentNotesForSaveCB, current_id); | |
2240 | - //var modifiedWindowObj = JSON.parse($scope.selectedKey.windows.window); | |
2241 | - //modifiedWindowObj.textVisible = value; | |
2242 | - //$scope.selectedKey.windows.window = modifiedWindowObj; | |
2243 | - $scope.selectedKey.windows.window = ""; | |
2244 | - if (keyName != "") { | |
2245 | - $scope.selectedKey.windows.window = JSON.stringify($scope.setWinDataToArray[i]); | |
2246 | - } | |
2247 | - } | |
2248 | - console.log($rootScope.contentNotesForSaveCB); | |
2249 | - | |
2250 | - //$scope.windowDataforCB = { | |
2251 | - //slideId: currentId,//SlideNo, | |
2252 | - //currentWindowId: windowId, | |
2253 | - //mType: windowData.mType, | |
2254 | - //containsCapturedContent: windowData.containsCapturedContent, | |
2255 | - | |
2256 | - //textVisible: checkVisiblity//windowData.textVisible, | |
2257 | - //anatomyTitle: windowData.currentViewTitle, | |
2258 | - //horizontalScroll: windowData.scrollPosition.horizontal + 'px', | |
2259 | - //verticalScroll: windowData.scrollPosition.vertical + 'px', | |
2260 | - //imageId: windowData.imageId,//N | |
2261 | - //maximised: windowData.maximised,//Not Found | |
2262 | - //minimised: windowData.minimised,//Not Found | |
2263 | - //id: windowData.id, | |
2264 | - //size: windowData.size, | |
2265 | - //position: windowData.position, | |
2266 | - //position: { | |
2267 | - // top: $rootScope.jsPanelTop, | |
2268 | - // left: $rootScope.jsPanelLeft, | |
2269 | - //}, | |
2270 | - | |
2271 | - //size: { | |
2272 | - // width: $rootScope.jsPanelWidth, | |
2273 | - // height: $rootScope.jsPanelHeight | |
2274 | - //}, | |
2275 | - //contextMenu: windowData.contextMenu, | |
2276 | - //annotationData: windowData.annotationData | |
2277 | - | |
2278 | - //}; | |
2279 | - | |
2280 | - } | |
2281 | - | |
2282 | 2098 | function findKeyForChange(o, keyname) { |
2283 | 2099 | var i; |
2284 | 2100 | for (i in o) { |
... | ... | @@ -2289,11 +2105,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
2289 | 2105 | } |
2290 | 2106 | findKeyForChange(o[i], keyname); |
2291 | 2107 | } |
2292 | - //else { | |
2293 | - // if (i == keyname) { | |
2294 | - // $scope.selectedKey = i; | |
2295 | - // } | |
2296 | - //} | |
2108 | + | |
2297 | 2109 | } |
2298 | 2110 | } |
2299 | 2111 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/CBuild/CBuild-view.html
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <div ng-include="'app/widget/MainMenu.html'" /> |
3 | 3 | <div class="main" ng-init="loadCurriculumBuiderData()"> |
4 | 4 | <div class="col-sm-12"> |
5 | - <div class="well" style=" height:100vh"> | |
5 | + <div class="well" style=" height:75vh"> | |
6 | 6 | <div class="col-sm-6"> |
7 | 7 | <ul class="list-group" id="leftBodyViewList"></ul> |
8 | 8 | </div> |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | </div> |
26 | 26 | <div class="modal-body"> |
27 | 27 | <div class="row"> |
28 | - <div class="col-sm-4"><img src="content/images/popup-img.jpg" alt="" title="" class="img-responsive"></div> | |
28 | + <div class="col-sm-4"><img src="content/images/popup-img.jpg" alt="" title="" class="img-responsive" style="height: 300px;"></div> | |
29 | 29 | <div class="col-sm-8"> |
30 | 30 | <h5><b>{{AutherName}}</b></h5> |
31 | 31 | <p>{{summary}}</p> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/CBuild/curriculum-builder-TinyMCEjspanel.html
... | ... | @@ -76,7 +76,7 @@ |
76 | 76 | editor.on('init', function () { |
77 | 77 | //birendra |
78 | 78 | // call after initilization |
79 | - callEditorOnInit(); | |
79 | + callEditorOnInit(); | |
80 | 80 | }); |
81 | 81 | }, |
82 | 82 | plugins: 'advlist, lists, autolink, link, anchor, print, preview, searchreplace, fullscreen, hr', |
... | ... | @@ -141,6 +141,10 @@ |
141 | 141 | |
142 | 142 | angular.element(document.querySelector('[ng-controller="CurrBuildController"]')).scope().ExportSection(); |
143 | 143 | } |
144 | + function ImportSection() { | |
145 | + | |
146 | + angular.element(document.querySelector('[ng-controller="CurrBuildController"]')).scope().ImportSection(); | |
147 | + } | |
144 | 148 | |
145 | 149 | //Added Code by Sandeep for User Story-52695 |
146 | 150 | //function captureScreen() { | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/views/CBuild/curriculum-builder-detail.html
1 | - | |
2 | - | |
3 | 1 | <style> |
4 | 2 | div.content_wrap div.left { |
5 | 3 | } |
... | ... | @@ -58,33 +56,7 @@ |
58 | 56 | <div class="content_wrap" style="background:#fff;height:540px;overflow-y:scroll"> |
59 | 57 | <!--this is for Tree structure ul li with json tree--> |
60 | 58 | <div id="jstree"> |
61 | - <ul> | |
62 | - <li> | |
63 | - <span id="{{cbTreeFirstID}}" name="root">{{cbTreeFirstLabel}}</span> | |
64 | - | |
65 | - | |
66 | - <script type="text/ng-template" id="strTree"> | |
67 | - | |
68 | - <span id="{{str._id}}" isBranch="{{str._isBranch}}">{{ str._label }}</span> | |
69 | - | |
70 | - <ul ng-if="str.structure"> | |
71 | - <!--<li ng-repeat="str in str.structure" name="isBranchFalse" ng-include="'strTree'" ng-if="str._isBranch == 'false'" data-jstree='{"icon":"../../../content/images/CB/file.png"}'>--> | |
72 | - <li ng-repeat="str in str.structure" ng-include="'strTree'"> | |
73 | - </li> | |
74 | - | |
75 | - <!--<li ng-repeat="str in str.structure" ng-include="'strTree'" ng-if="str._isBranch == 'true'"> | |
76 | - | |
77 | - </li>--> | |
78 | - </ul> | |
79 | - </script> | |
80 | - <ul> | |
81 | - <!--<!--<li ng-repeat="str in structure" ng-include="'strTree'" ng-if="str._isBranch == 'false'" data-jstree='{"icon":"../../../content/images/CB/file.png"}'></li>-->--> | |
82 | - <li ng-repeat="str in structure" ng-include=" 'strTree'"> | |
83 | - </li> | |
84 | - <!--<li ng-repeat="str in structure" ng-include="'strTree'" ng-if="str._isBranch == 'true'"> </li>--> | |
85 | - </ul> | |
86 | - </li> | |
87 | - </ul> | |
59 | + //loading from controller | |
88 | 60 | </div> |
89 | 61 | </div> |
90 | 62 | <div class="indicators"> |
... | ... | @@ -179,22 +151,7 @@ |
179 | 151 | <button type="button" class="btn btn-primary btn-sm" ng-click="closeRenameModel()">Cancel</button> |
180 | 152 | </div> |
181 | 153 | </div> |
182 | - <!--<div class="modal-content"> | |
183 | - <div class="modal-header"> | |
184 | - <h5 class="modal-title">New Name Of slide?</h5> | |
185 | - <form> | |
186 | - <div class="form-group"> | |
187 | - <input type="text" class="form-control" id="renameInputBoxId"> | |
188 | - </div> | |
189 | - </form> | |
190 | - </div> | |
191 | - <div class="modal-footer"> | |
192 | - <button id="" type="button" class="btn btn-primary btn-sm" ng-click="cbRenameSlide()"> | |
193 | - OK | |
194 | - </button> | |
195 | - <button type="button" class="btn btn-primary btn-sm" ng-click="closeRenameModel()">Cancel</button> | |
196 | - </div> | |
197 | - </div>--> | |
154 | + | |
198 | 155 | </div> |
199 | 156 | <div class="cbModelRename" id="cbModelSectionRenameId" style="z-index: 1000000000; background: white;width: 302px;position:absolute;left:30%;right:0;top:70px;"> |
200 | 157 | <div class="modal-content"> |
... | ... | @@ -362,7 +319,7 @@ |
362 | 319 | { |
363 | 320 | $("#filename").val(string.split(' ').join('')); |
364 | 321 | } |
365 | - | |
322 | + | |
366 | 323 | function callEditorOnInit() |
367 | 324 | { |
368 | 325 | setTimeout(function () { |
... | ... | @@ -374,7 +331,16 @@ |
374 | 331 | //"plugins": ["dnd"], |
375 | 332 | |
376 | 333 | }).on('ready.jstree',function() |
377 | - { | |
334 | + { | |
335 | + $('.jstree-container-ul li a span').each(function () { | |
336 | + var span_Id = $(this).attr("id"); | |
337 | + var isbranch = $(this).attr("isbranch"); | |
338 | + if (isbranch == "false") { | |
339 | + $("#jstree").jstree(true).set_icon(span_Id, "../../../content/images/CB/file.png"); | |
340 | + } | |
341 | + | |
342 | + }); | |
343 | + | |
378 | 344 | setTimeout(function () { |
379 | 345 | angular.element(document.querySelector('[ng-controller="CurrBuildController"]')).scope().loadNotesById(); |
380 | 346 | },1); |
... | ... | @@ -501,17 +467,12 @@ |
501 | 467 | |
502 | 468 | </script> |
503 | 469 | |
504 | - | |
505 | - | |
506 | 470 | <script> |
507 | 471 | $('.modal').draggable({ |
508 | 472 | handle: '.modal-header' |
509 | 473 | }) |
510 | 474 | </script> |
511 | 475 | |
512 | - | |
513 | - | |
514 | - | |
515 | 476 | <script> |
516 | 477 | $("#menu-toggle").click(function (e) { |
517 | 478 | e.preventDefault(); |
... | ... | @@ -532,9 +493,4 @@ |
532 | 493 | showHeight("window", $(window).height()); |
533 | 494 | }); |
534 | 495 | |
535 | - | |
536 | - | |
537 | - //$('#btnShapeStyle').on('click', 'li', function () { | |
538 | - // alert("hi"); | |
539 | - //}); | |
540 | 496 | </script> |
541 | 497 | \ No newline at end of file | ... | ... |