aboutsummaryrefslogtreecommitdiffstats
path: root/epsdk-app-onap/src/main/webapp/WEB-INF/fusion/jsp/ds2/header.jsp
blob: 483922fca83512399e014e5f5ed2713ecb33f0da (plain)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<script src="./app/fusion/external/angular-1.5/angular.min.js"></script>
<script src="./app/fusion/external/angular-1.5/angular-messages.js"></script>
<script src="./app/fusion/external/angular-1.5/angular-touch.js"></script>
<script src="./app/fusion/external/angular-1.5/angular-sanitize.js"></script>
<script src="./app/fusion/external/angular-1.5/angular-route.min.js"></script>
<script src="./app/fusion/external/angular-1.5/angular-cookies.min.js"></script>
<script src="./app/fusion/external/ds2/js/b2b-angular/b2b-library.min.js"></script>
<script src="./app/fusion/external/ds2/js/digital-ng-library/digital-design-library.js"></script>
<script src="./app/fusion/scripts/DS2-services/leftMenuServiceDS2.js"></script>
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/b2b-angular/b2b-angular.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/b2b-angular/b2b-angular.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/extras/ds2-accordion.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/extras/ds2-bootstrap-datepicker.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/extras/ds2-cc-input-field.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/extras/ds2-tooltip.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/extras/x-tabs-pills.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-accordion.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-bootstrap-datepicker.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-c2c.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-cc-input-field.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-filmstrip.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-filters.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-legacynav-fix.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-marquee.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-pagination.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-popover.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-progressbar.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ds2-tooltip.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/global.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/digital-design-library.css">

<link rel="stylesheet" type="text/css" href="./app/fusion/external/ds2/css/digital-ng-library/ionicons.css">
<link rel="stylesheet" type="text/css" href="./app/fusion/styles/ecomp.css">
<script>
angular.module('att.abs.helper', []);
angular.module('quantum', []);
var appDS2=angular.module("abs", ["ngRoute", 'ngAnimate', 'ngTouch', 'ui.bootstrap', 'ngMessages', 'ngCookies', 'b2b.att.tpls', 'ddh.att.tpls', 'ddh.att.switches', 'b2b.att.footer', 'b2b.att.header', 'btorfs.multiselect']);
</script>

<script src="./app/fusion/scripts/DS2-services/leftMenuServiceDS2.js"></script>

<script>
appDS2.controller("leftMenuController", ['$scope', '$filter','$http','$timeout','$cookies','LeftMenuServiceDS2', function ($scope, $filter, $http, $timeout, $cookies, LeftMenuServiceDS2) {
	$scope.menuData = [];
	$scope.leftChildData=[];
	$scope.leftParentData=[];
	$scope.leftMenuItems = [];
	$scope.app_name = "";
	$scope.app_name_full;
	LeftMenuServiceDS2.getLeftMenu().then(function(response){
	var j = response; 
		try{
			if(j && j !== "null" && j!== "undefined"){
				$scope.leftParentData = JSON.parse(j.data);
  		    $scope.leftChildData = JSON.parse(j.data2);
			}else{
				throw "Get Left Menu respsone is not an object/is empty"; 
			}  
	    	try{
	    		var leftChildItemList = $scope.leftChildData;
          		var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
         		var leftParentList =$scope.leftParentData;
         		
	    		for (var i = 0; i < leftParentList.length; i++) {
	    			var parentItem = {};
	    			parentItem.name = leftParentList[i].label;
	    			if(parentItem.name == 'Home'){
	    				parentItem.imageSrc = /*"icon-location-pinpoint"*/ "icon-building-home";
	    			} else if(parentItem.name == 'Sample Pages'){
	    				parentItem.imageSrc = "icon-documents-book";
	    			} else if(parentItem.name == 'Reports'){
	    				parentItem.imageSrc = "icon-misc-piechart";
	    			} else if(parentItem.name == 'Profile'){
	    				parentItem.imageSrc = "icon-people-oneperson";
	    			} else if(parentItem.name == 'Admin'){
	    				parentItem.imageSrc = "icon-content-star";
	    			} else if(parentItem.name == 'Sample Pages'){
	    				parentItem.imageSrc = "icon-content-searchchannels";
	    			} else {
	    				parentItem.imageSrc = "icon-building-door";
	    			}            		    			
	    			parentItem.menuItems = [];
	    			for (var j = 0; j < leftChildItemList[i].length; j++) {
	    				if(leftChildItemList[i][j].label != null && leftChildItemList[i][j].label.length > 0) {
		    				var childItem = {};
		    				childItem.name = leftChildItemList[i][j].label;
		    				childItem.href = leftChildItemList[i][j].action;
		    				parentItem.menuItems.push(childItem)
	    				}
		    		}
	    			$scope.menuData.push(parentItem);
	    		}
	    		
  			
	    	//For Home, add href
	    	$scope.menuData[0].href = leftParentList[0].action;
	    		
     		for (var i = 0; i < leftParentList.length; i++) {
     			$scope.item = {
     				parentLabel : leftParentList[i].label,
     				parentAction : leftParentList[i].action,
     				parentImageSrc : leftParentList[i].imageSrc,                 				
     				open:pageUrl==leftParentList[i].action?true:false,
     				childItemList : leftChildItemList[i]
     			};
     		};   
  		}catch(err){
  			console.log("error happened while trying to set left menu structure"+err);  					   
  		}
		}catch (e) {
			console.log("error happened while trying to get left menu items"+e);
			reloadPageOnce();
			return;
    }	       
},function(error){
	console.log("error happened while calling getLeftMenu"+error);
});

LeftMenuServiceDS2.getAppName().then(function(response){
	var j = response; 
		try{
			if(j && j !== "null" && j!== "undefined"){
				console.log("app name is " + $scope.app_name);
				$scope.app_name_full = j.data;
				var processed_app_name = j.data;
				var n = processed_app_name.length;
				if (n > 15) {
					n = 15;
				}
				$scope.app_name = processed_app_name.substr(0, n);
			}else{
				throw "Get app_name respsone is not an object/is empty"; 
			}  
		}catch (e) {
			console.log("error happened while trying to get app name "+e);
			return;
    }	       
},function(error){
	console.log("error happened while calling getAppName "+error);
});

$scope.adjustHeader=function() {
	$scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
	
	if($scope.showHeader == true) {
		$scope.drawer_margin_top = 50;
		$scope.drawer_custom_top = 54;
		$scope.toggle_drawer_top = 55;
	}
	else  {
		
		$scope.drawer_margin_	top = 40;
		$scope.drawer_custom_top = 0;
		$scope.toggle_drawer_top = 10;
	}
	
	
};

$scope.adjustHLeftMenu = function (type){
	$scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
	
	if($scope.showHeader == true) {
		$scope.drawer_margin_top = 60;
		$scope.drawer_custom_top = 54;
		$scope.toggle_drawer_top = 55;
	}
	else  {
		
		$scope.drawer_margin_top = 50;
		$scope.drawer_custom_top = 0;
		$scope.toggle_drawer_top = 10;
	}
	if(type=='burgerIcon'){
		return { "top": $scope.toggle_drawer_top+"px"};
	}else if(type=='leftMenu'){
		return { "margin-top": $scope.drawer_margin_top+"px"};
	}else
		return;
}
$scope.adjustHeader();
$scope.drawerOpen = true;

$scope.toggleDrawer = function() {
	$scope.drawerOpen = !($scope.drawerOpen);
	if ($scope.drawerOpen) {
	// setCookie('drawerOpen','open',30);
	$scope.arrowShow = true;


	if (document.getElementById('fnMenueContent')!=null)
	document.getElementById('fnMenueContent').style.marginLeft = "0px";
	
	if (document.getElementById('rightContentAdmin')!=null)
			document.getElementById('rightContentAdmin').style.marginLeft = "210px"; 
			
		else if (document.getElementById('rightContentProfile')!=null)
			document.getElementById('rightContentProfile').style.marginLeft = "210px";
	} else {

	$scope.arrowShow = false;

	if (document.getElementById('fnMenueContent')!=null)
	document.getElementById('fnMenueContent').style.marginLeft = "-150px";
	
	if (document.getElementById('rightContentAdmin')!=null) {
				document.getElementById('rightContentAdmin').style.marginLeft = "50px";					
			}
			
	else if (document.getElementById('rightContentProfile')!=null)
		document.getElementById('rightContentProfile').style.marginLeft = "50px";
	}
	};
	
$timeout(function() {
	//detectScrollEvent();
    	}, 800);
}]);
</script>

<style>
#page-content{
margin-top:-250px;
}

#page-content td, th {
    padding: 0px;
    border:none;
}
</style>
<div ng-app="abs">
	<div ng-controller = "leftMenuController">
		<ddh-left-navigation menu-data="menuData"></ddh-left-navigation>
	</div>
</div>