CurrBuildController.js
5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location",
function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location) {
// $rootScope.currentActiveModuleTitle = pages[6].name;
$scope.showTabButton = false;
$scope.listCurriculumBuilder = null;
$scope.dataPopup = null;
$scope.countLeftlist;
$scope.countRightlist;
$scope.IsVisible = function () {
$scope.scroll();
}
$scope.scroll = function () {
// $window.scrollTo(0, 0);
$("html,body").scrollTop(0);
//alert("scroll");
}
//load json data
$scope.loadCurriculumBuiderData = function () {
if ($rootScope.refreshcheck == null) {
$location.path('/');
}
//get current path
var currentURL = $location.path();
var selectedModuleName = '';
//set module title
angular.forEach($rootScope.userModules, function (value, key) {
if (value.slug === currentURL.replace('/', '')) {
selectedModuleName = value.name;
}
$rootScope.currentActiveModuleTitle = selectedModuleName;
})
//get current path
var currentURL = $location.path();
$http({ method: 'GET', url: 'content/data/json/cb/cb_list_content.json' }).success(function (data) {
$scope.listCurriculumBuilder = data;
//load default body view list
$scope.getCBViewList();
})
.error(function (data, status, headers, config) {
console.log(data);
});
}
//get CB body view list
$scope.getCBViewList = function ($event) {
$('#leftBodyViewList').empty();
$scope.countLeftlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length / 2;
$scope.loadleftBodyViewList = new jinqJs()
.from($scope.listCurriculumBuilder.slideshows.slideshow)
.select();
for (var i = 0; i < $scope.countLeftlist; i++) {
console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
//alert($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._filename);
var $el = $('<li class="list-group-item" ><a href="#" ng-click="loadSlideShowXmldata($event)" id="' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._filename + '"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#leftBodyViewList');
$compile($el)($scope);
}
$scope.countRightlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length;
for (var i = $scope.countLeftlist; i < $scope.countRightlist; i++) {
console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
var $el1 = $('<li class="list-group-item"><a href="#" ng-click="loadSlideShowXmldata($event)" id="' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._filename + '"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#rightBodyViewList');
$compile($el1)($scope);
}
}
$scope.loadSlideShowXmldata = function (e) {
$rootScope.fileNames = e.target.id;
$rootScope.fileName = $rootScope.fileNames.split('.');
alert("$rootScope.fileName" + $rootScope.fileName[0]);
$('#modal-CurBuilder').css("display", "block");
$("#CurBuilderbackground").css("display", "block");
// alert(e);
$http({ method: 'GET', url: 'content/data/json/cb/SlideShow/json/' + $rootScope.fileName[0] + '.json' }).success(function (data) {
$scope.dataPopup = data;
alert(JSON.stringify($scope.dataPopup));
$scope.getCBJsonData();
})
.error(function (data, status, headers, config) {
console.log(data);
});
}
$scope.getCBJsonData = function ()
{
alert("sdf" + $scope.dataPopup.slideshow.content.element[0].summary);
$scope.summary = $scope.dataPopup.slideshow.content.element[0].summary;
}
$scope.closeCurBulderModal = function () {
$('#modal-CurBuilder').css("display", "none");
$("#CurBuilderbackground").css("display", "none");
}
$scope.openCurriculumDetail = function ()
{
$location.url("/curriculum-builder-detail");
}
$scope.openCBModuleItem = function ()
{
var jsContentURL = 'app/views/CBuild/curriculum-builder-jspanel.html';
$.jsPanel({
id: 'CBPanel',
selector: '.CBBodyView',
theme: 'success',
currentController: 'CurrBuildController',
parentSlug: 'curriculum-builder',
ajax: {
url: jsContentURL
},
title: "curbulerd",
position: {
top: 70,
left: 1,
},
size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 125 },
});
if (document.getElementById('CBBodyView') != null) {
//0.4 added some stylesheets
$('#CBBodyView').css("height", $(window).outerHeight() - 65);
$('#CBBodyView').css("width", $(window).outerWidth() - 15);
}
}
$(function () {
$("#modal-CurBuilder").draggable();
});
}]
);