2 ================================================================================
\r
4 ================================================================================
\r
5 Copyright (C) 2017 AT&T Intellectual Property
\r
6 ================================================================================
\r
7 Licensed under the Apache License, Version 2.0 (the "License");
\r
8 you may not use this file except in compliance with the License.
\r
9 You may obtain a copy of the License at
\r
11 http://www.apache.org/licenses/LICENSE-2.0
\r
13 Unless required by applicable law or agreed to in writing, software
\r
14 distributed under the License is distributed on an "AS IS" BASIS,
\r
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 See the License for the specific language governing permissions and
\r
17 limitations under the License.
\r
18 ================================================================================
\r
20 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
\r
21 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
\r
22 <%@ page isELIgnored="false"%>
\r
23 <%@ page import="org.openecomp.portalsdk.core.util.SystemProperties"%>
\r
24 <%@ page import="org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties"%>
\r
25 <%@ page import="org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants"%>
\r
26 <%@ page import="org.openecomp.portalsdk.core.domain.MenuData"%>
\r
27 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
\r
28 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
\r
29 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
\r
32 <!-- <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
\r
33 <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
\r
34 <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
\r
35 <script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
\r
36 <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
\r
37 <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
\r
38 <script src="static/js/jquery-1.10.2.js"></script>
\r
39 <script src="app/fusion/scripts/modalService.js"></script>
\r
40 <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
\r
41 <script src="static/js/jquery-ui.js" type="text/javascript"></script>
\r
42 <script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
\r
43 <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
\r
44 <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
\r
45 <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
\r
46 <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>
\r
47 <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
\r
48 <script src="app/fusion/scripts/services/userInfoService.js"></script>
\r
49 <script src="app/fusion/scripts/services/leftMenuService.js"></script> -->
\r
52 <jsp:include page="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" ></jsp:include>
\r
55 <c:set var="UserName" value="<%= session.getAttribute(\"fullName\")%>" />
\r
56 <c:set var="UserFirstName" value="<%= session.getAttribute(\"first_name\")%>" />
\r
59 String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK);
\r
60 String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
\r
61 String portalUrl = redirectUrl;
\r
62 String getAccessLink = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/get_access";
\r
64 <c:set var="returnPortalUrl" value="<%=portalUrl%>" />
\r
65 <c:set var="contactUsLink" value="<%=contactUsLink%>" />
\r
66 <c:set var="getAccessLink" value="<%=getAccessLink%>" />
\r
71 <%@include file="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" %>
\r
73 <div style="position: relative; z-index: 999;">
\r
74 <div ng-controller="headerController">
\r
76 <div class="headerContainer" id="headerContainer" ng-cloak ng-show="{{showHeader}}">
\r
77 <div id="megaMenuContainer" class="megaMenuContainer" style="margin-top: 0; overflow: visible;">
\r
79 <!--for mega Menu-->
\r
80 <!-- Mega Menu parent-tab directive with three models menu-items, active-sub-menu, active-menu -->
\r
81 <div id="topMenu" class="top-megamenu" ng-mouseleave="activeClickSubMenu.x.active=false; activeClickMenu.x.active=false">
\r
82 <div style="float:left;width:100%;"parent-tab menu-items="megaMenuDataObject" active-sub-menu='activeClickSubMenu.x' active-menu='activeClickMenu.x'>
\r
83 <div parentmenu-tabs mega-menu="true" menu-items="megaMenuDataObject" style="height:55px;">
\r
84 <div style="float:left">
\r
85 <li class="megamenu__item" style="line-height:55px;" onclick="returnToPortal()">
\r
86 <img src="app/fusion/external/ebz/images/logo.png" class="Logo" ></span>
\r
87 <!-- <a id='returnPortal' class="primaryMenuOptionLink" style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;">ECOMP</a>
\r
88 --> <strong style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;" id='returnPortal' >ECOMP Portal</strong>
\r
90 <div menu-tabs mega-menu="true" tab-name="item.text" menu-item="item" active-menu="activeClickMenu.x"
\r
91 ng-repeat="item in megaMenuDataObject" style="font-size: 18px;" ng-mousedown="loadFavorites()" >
\r
92 <div parentmenu-tabs sub-menu="true" ng-show="activeClickMenu.x.active && item.active" menu-items="activeClickMenu.x.children">
\r
93 <!-- Second level menu -->
\r
95 <div menu-tabs sub-menu="true" tab-name="subItem.text"
\r
96 tab-url="subItem.url" menu-item="subItem"
\r
97 ng-repeat="subItem in activeClickMenu.x.children | orderBy : 'column'" active-menu="activeClickSubMenu.x"
\r
98 sub-item-active="{{subItem.active}}" style="float:left;" aria-label="{{subItem.text}}"
\r
99 ng-mouseenter="submenuLevelAction(subItem.text,subItem.column)"
\r
100 ng-mouseleave="submenuLevelAction(subItem.text,subItem.column)"
\r
101 ng-click="submenuLevelAction(subItem.text,subItem.column)" >
\r
102 <i ng-if="subItem.text=='Favorites'" id="favorite-star"
\r
103 class="icon-star favorites-icon-active">
\r
107 <div class="sub__menu" ng-mouseleave="activeClickSubMenu.x.active=false" >
\r
108 <ul ng-show="activeClickSubMenu.x.active" role="menubar" class="columns">
\r
109 <!-- Third level menu -->
\r
110 <div menu-tabs menu-item="subItem"
\r
111 class="columns-div"
\r
112 ng-repeat="subItem in activeClickSubMenu.x.children | orderBy : 'column'"
\r
113 ng-show="activeClickSubMenu.x.active">
\r
115 <i id="favorite-selector-third-level"
\r
116 ng-show="isUrlFavorite(subItem.menuId)==false"
\r
117 class="icon-star favorites-icon-inactive"
\r
118 ng-if="subItem.url.length > 1">
\r
120 <i id="favorite-selector-third-level"
\r
121 ng-show="isUrlFavorite(subItem.menuId)"
\r
122 class="icon-star favorites-icon-active"
\r
123 ng-if="subItem.url.length > 1">
\r
125 <span class="title" aria-label="{{subItem.text}}"
\r
126 ng-click="goToUrl(subItem)">{{subItem.text}}</span>
\r
127 <!-- Fourth level menus -->
\r
128 <div att-links-list="">
\r
129 <i id="favorite-selector-fourth-level"
\r
130 class="icon-star favorites-icon-inactive"
\r
131 ng-show="isUrlFavorite(tabValue.menuId)==false"
\r
132 ng-if="tabValue.url.length > 1">
\r
135 <i id="favorite-selector-fourth-level"
\r
136 class="icon-star favorites-icon-active"
\r
137 ng-show="isUrlFavorite(tabValue.menuId)"
\r
138 ng-if="tabValue.url.length > 1">
\r
141 <span role="menuitem" att-links-list-item=""
\r
142 ng-repeat="tabValue in subItem.children"
\r
143 ng-click="goToUrl(tabValue)"
\r
144 att-accessibility-click="13,32"
\r
145 ng-class="{'disabled': tabValue.disabled}">{{tabValue.text}}</span>
\r
147 <hr ng-show="!$last"/>
\r
151 <!-- Favorites level menu -->
\r
152 <div class="favorites-window" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()">
\r
153 <div id="favorites-menu-items" ng-show="showFavorites">
\r
154 <div ng-repeat="subItem in favoritesMenuItems" att-links-list="" style='display: inline'>
\r
155 <i id="favorite-selector-favorites-list" class="icon-star favorites-icon-active">
\r
157 <a id="favorites-list" aria-label="{{subItem.text}}"
\r
158 ng-click="goToUrl(subItem)"
\r
159 style="margin-left: 3px; margin-right: 20px; text-decoration: none; color: #666666;">
\r
165 <p style='font-weight: 400; font-family: clearview_att_bold !important;
\r
166 font-size: 18px; text-align: center; background-color: lightgray;
\r
167 width: 400px; margin-left: 25%; margin-right: 25%;'>
\r
168 Manage favorites on ECOMP Portal.
\r
172 <!-- Favorites when empty -->
\r
173 <div id="favorites-empty" ng-show='favoritesWindow' ng-show="emptyFavorites">
\r
174 <div id="favorites-empty" ng-show="emptyFavorites" class="favorites-window-empty">
\r
176 <img src="app/fusion/external/ebz/images/no_favorites_star.png">
\r
177 <p class='favoritesLargeText'>No Favorites</p>
\r
178 <p class='favoritesNormalText'>Manage favorites on ECOMP Portal.</p>
\r
188 <li class="megamenu__item" style="line-height:55px;" ng-if="loadMenufail">
\r
189 <strong style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;" >Unable to load menus</strong>
\r
191 <!-- <li class="megamenu__item" style="width: 20%;"> </li>
\r
193 <!-- Login Snippet-->
\r
194 <div style="float:right">
\r
195 <li id="bcLoginSnippet" class="megamenu__item" style="width: 140px;" >
\r
196 <div popover="loginSnippet.html" aria-label="Login Snippet" referby="loginSnippet" att-accessibility-click="13,32" popover-style="\" popover-placement="below" style="width: 200px;">
\r
197 <div class="icon-user-small login-snippet-icon"></div>
\r
198 <div class="login-snippet-text" style="display: inline-block; font-size:12px; margin-left:5px;overflow: hidden; max-height: 31px; max-width:120px; padding-top: 0px; margin-top: 0px; white-space: nowrap;" ng-bind="userProfile.firstName"></div>
\r
201 <li class="megamenu__item" style="width:120px;"> </li>
\r
206 <div style="clear: both"></div>
\r
211 <div class="license-notification" id="license-notification">
\r
212 <a href="javascript:void(0)" style="background-color:#bbb;" class="button button--small" tooltip="Please contact ECOMP Portal team to get the license" tooltip-placement="below" tooltip-style="light" tooltip-popup-delay="500" >
\r
213 <span style="">{{app_name_full}}</span>
\r
216 <div style="position: relative; color: black; top: 70px;">
\r
218 <span ng-style="adjustHLeftMenu('burgerIcon')" style="z-index:998; position:fixed; left:0%; font-size:35px; margin-left:10px;text-decoration:none;">
\r
219 <a ng-click="toggleDrawer();isOpen = !isOpen" href="javascript:void(0);" class="arrow-icon-left" >
\r
220 <span class="icon-hamburger"></span></a>
\r
221 <span ng-init="isOpen = true" ng-show="isOpen" style="font-size:16px; position:relative; top:-8px; left:-15px;">    {{app_name}}</span>
\r
223 <div att-drawer drawer-slide="left" drawer-custom-top="{{drawer_custom_top}}px" drawer-size="200px" drawer-open="drawerOpen" drawer-custom-height="100%" >
\r
224 <div ng-style="adjustHLeftMenu('leftMenu')">
\r
225 <div class="attDrawer" style="margin-top:{{drawer_margin_top}}px;">
\r
226 <div style="margin-left:10px; margin-right:10px;">
\r
227 <accordion close-others="true" css="att-accordion--no-box">
\r
228 <accordion-group ng-repeat="parent in menuItems" heading="{{parent.parentLabel}}" child="{{parent.parentAction}}" parent-link="{{parent.parentAction}}" image-source="{{parent.parentImageSrc}}" child-length="{{parent.childItemList.length}}" is-open="parent.open">
\r
229 <div ng-repeat="subMenu in parent.childItemList" style="font-size:12px; margin-left:10px;">
\r
230 <a href="{{subMenu.action}}" style="font-size:12px; color:#666666;" >{{subMenu.label}}</a>
\r
244 function returnToPortal(){
\r
245 window.location.href = "<c:out value='${returnPortalUrl}'/>";
\r
247 detectScrollEvent = function() {
\r
248 var footerOff = $('#footerContainer').offset().top;
\r
249 var headOff = $('#headerContainer').offset().top;
\r
250 var winHeight = $(window).height();
\r
251 if ((footerOff - headOff) <= winHeight) {
\r
252 $('.att-drawer').css({
\r
253 "height" : footerOff - headOff - 55
\r
256 $('.att-drawer').css({
\r
261 $(window).scroll(function() {
\r
262 if ($('.att-drawer').is(':visible')) {
\r
263 detectScrollEvent();
\r
266 app.controller("headerController", function($scope, $timeout, $log, $http, UserInfoService, $window, $cookies,LeftMenuService) {
\r
267 // $log.debug('HeaderController started');
\r
268 $scope.jsonMenuData = [];
\r
269 $scope.loadMenufail=false;
\r
270 $scope.app_name = "";
\r
271 $scope.app_name_full = "";
\r
272 $scope.megaMenuDataObject =[];
\r
273 $scope.activeClickSubMenu = {
\r
276 $scope.activeClickMenu = {
\r
279 $scope.favoritesMenuItems = [];
\r
280 $scope.favoriteItemsCount = 0;
\r
281 $scope.showFavorites = false;
\r
282 $scope.emptyFavorites = false;
\r
283 $scope.favoritesWindow = false;
\r
284 $scope.userProfile={
\r
290 /*Put user info into fields*/
\r
291 $scope.inputUserInfo = function(userInfo){
\r
292 if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
\r
293 if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
\r
294 $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
\r
295 if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
\r
296 $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
\r
297 if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
\r
298 $scope.userProfile.email = userInfo.USER_EMAIL;
\r
301 /*getting user info from session*/
\r
302 $scope.getUserNameFromSession = function(){
\r
303 UserInfoService.getFunctionalMenuStaticDetailSession()
\r
304 .then(function (res) {
\r
305 $scope.userProfile.firstName = res.firstName;
\r
306 $scope.redirectUrl = res.portalUrl;
\r
309 $scope.getTopMenuStaticInfo=function() {
\r
310 var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
\r
313 if(res==null || res==''){
\r
314 $log.info('failed getting static User information');
\r
315 $scope.getUserNameFromSession();
\r
317 $log.info('Received static User information');
\r
318 var resData = res;
\r
319 $scope.inputUserInfo(resData);
\r
320 $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
\r
324 $log.info('failed getting static User information');
\r
329 var unflatten = function( array, parent, tree ){
\r
330 tree = typeof tree !== 'undefined' ? tree : [];
\r
331 parent = typeof parent !== 'undefined' ? parent : { menuId: null };
\r
332 var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
\r
334 if( !_.isEmpty( children ) ){
\r
335 if( parent.menuId === null ){
\r
338 parent['children'] = children
\r
340 _.each( children, function( child ){ unflatten( array, child ) } );
\r
346 var menuStructureConvert = function(menuItems) {
\r
347 var megaMenuDataObjectTemp = [
\r
356 url:"<c:out value='${contactUsLink}'/>"
\r
360 url:"<c:out value='${getAccessLink}'/>"
\r
364 return megaMenuDataObjectTemp;
\r
369 LeftMenuService.getAppName().then(function(response){
\r
372 if(j && j !== "null" && j!== "undefined"){
\r
373 // console.log("app name is " + $scope.app_name);
\r
374 $scope.app_name_full = j.data;
\r
375 var processed_app_name = j.data;
\r
376 if(processed_app_name.indexOf("[")<=-1) {
\r
377 if (document.getElementById('license-notification')!=null)
\r
378 document.getElementById('license-notification').style.display = "none";
\r
380 var n = processed_app_name.length;
\r
384 $scope.app_name = processed_app_name.substr(0, n);
\r
386 throw "Get app_name response is not an object/is empty";
\r
389 console.log("error happened while trying to get app name "+e);
\r
393 console.log('getAppName failed', error);
\r
396 $scope.getTopMenuStaticInfo();
\r
397 $scope.getMenu=function() {
\r
401 url: 'get_functional_menu',
\r
402 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
404 }).success(function (response) {
\r
405 if(response == '101: Timeout') {
\r
406 $log.error('Timeout attempting to get_functional_menu');
\r
407 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
408 // $scope.createErrorMenu();
\r
409 $scope.megaMenuDataObject = menuStructureConvert('');
\r
411 $log.debug('get_functional_menu success: ' + response);
\r
412 if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
\r
413 // createErrorMenu() USED FOR LOCAL TESTING ONLY
\r
414 // $scope.createErrorMenu();
\r
415 $scope.megaMenuDataObject = menuStructureConvert('');
\r
416 // $scope.loadMenufail=true;
\r
418 $scope.jsonMenuData = unflatten( response );
\r
419 $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
\r
422 }).error(function (response){
\r
423 // createErrorMenu() USED FOR LOCAL TESTING ONLY
\r
424 // $scope.createErrorMenu();
\r
426 //$scope.loadMenufail=true;
\r
427 $scope.megaMenuDataObject = menuStructureConvert('');
\r
428 $log.debug('REST API failed get_functional_menu...'+ response);
\r
431 $scope.adjustHLeftMenu = function (type){
\r
432 $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
\r
434 if($scope.showHeader == true) {
\r
435 $scope.drawer_margin_top = 60;
\r
436 $scope.drawer_custom_top = 54;
\r
437 $scope.toggle_drawer_top = 55;
\r
441 $scope.drawer_margin_top = 50;
\r
442 $scope.drawer_custom_top = 0;
\r
443 $scope.toggle_drawer_top = 10;
\r
445 if(type=='burgerIcon'){
\r
446 return { "top": $scope.toggle_drawer_top+"px"};
\r
447 }else if(type=='leftMenu'){
\r
448 return { "margin-top": $scope.drawer_margin_top+"px"};
\r
452 $scope.adjustHeader=function() {
\r
453 $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
\r
455 if($scope.showHeader == true) {
\r
456 $scope.drawer_margin_top = 50;
\r
457 $scope.drawer_custom_top = 54;
\r
458 $scope.toggle_drawer_top = 55;
\r
462 $scope.drawer_margin_top = 40;
\r
463 $scope.drawer_custom_top = 0;
\r
464 $scope.toggle_drawer_top = 10;
\r
471 //$scope.getMenu();
\r
472 $scope.adjustHeader();
\r
475 /* **************************************************************************/
\r
476 /* Logic for the favorite menus is here */
\r
478 $scope.loadFavorites = function () {
\r
479 $log.debug('loadFavorites has happened.');
\r
480 if ($scope.favoritesMenuItems == '') {
\r
481 $scope.generateFavoriteItems();
\r
482 $log.debug('loadFavorites is calling generateFavoriteItems()');
\r
484 $log.debug('loadFavorites is NOT calling generateFavoriteItems()');
\r
488 $scope.goToUrl = function (item) {
\r
489 $log.info("goToUrl called")
\r
492 var url = item.url;
\r
493 var restrictedApp = item.restrictedApp;
\r
494 $log.debug('Restricted app status is: ' + restrictedApp);
\r
496 $log.info('No url found for this application, doing nothing..');
\r
499 if (restrictedApp) {
\r
500 $window.open(url, '_blank');
\r
502 $window.open(url, '_self');
\r
507 $scope.submenuLevelAction = function(index, column) {
\r
508 if ($scope.favoritesMenuItems == '') {
\r
509 $scope.generateFavoriteItems();
\r
510 $log.debug('submenuLevelAction is calling generateFavoriteItems()');
\r
512 $log.debug('item hovered/clicked: ' + index + '; column = ' + column);
\r
513 if (column == 2) { // 2 is Design
\r
514 $scope.favoritesWindow = false;
\r
515 $scope.showFavorites = false;
\r
516 $scope.emptyFavorites = false;
\r
518 if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
\r
519 $log.debug('Showing Favorites window');
\r
520 $scope.favoritesWindow = true;
\r
521 $scope.showFavorites = true;
\r
522 $scope.emptyFavorites = false;
\r
524 if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
\r
525 $log.debug('Hiding Favorites window in favor of No Favorites Window');
\r
526 $scope.favoritesWindow = true;
\r
527 $scope.showFavorites = false;
\r
528 $scope.emptyFavorites = true;
\r
531 $scope.favoritesWindow = false;
\r
532 $scope.showFavorites = false;
\r
533 $scope.emptyFavorites = false;
\r
537 $scope.hideFavoritesWindow = function() {
\r
538 $log.debug('$scope.hideFavoritesWindow has been called');
\r
539 $scope.showFavorites = false;
\r
540 $scope.emptyFavorites = false;
\r
543 $scope.isUrlFavorite = function (menuId) {
\r
544 // $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
\r
545 var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
\r
546 var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
\r
547 if (isMenuFavorite==-1) {
\r
555 $scope.generateFavoriteItems = function() {
\r
558 url: 'get_favorites',
\r
559 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
561 }).success(function (response) {
\r
562 if (response == '101: Timeout') {
\r
563 $log.error('Timeout attempting to get_favorites_menu');
\r
565 if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
\r
566 $log.error('REST API failed get_favorites' + response);
\r
568 $log.debug('get_favorites = ' + JSON.stringify(response));
\r
569 $scope.favoritesMenuItems = response;
\r
570 $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
\r
571 $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
\r
574 }).error(function (response){
\r
575 $log.error('REST API failed get_favorites' + response);
\r
576 //createFavoriteErrorMenu() USED FOR LOCAL TESTING ONLY
\r
577 // $scope.createFavoriteErrorMenu();
\r
581 $scope.createFavoriteErrorMenu=function() {
\r
582 $scope.favoritesMenuItems = [
\r
585 $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
\r
586 $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
\r
589 /* end of Favorite Menu code */
\r
590 /* **************************************************************************/
\r
593 /* **************************************************************************/
\r
594 // THIS IS USED FOR LOCAL TESTING ONLY
\r
595 /* **************************************************************************/
\r
597 $scope.createErrorMenu=function() {
\r
598 $scope.jsonMenuData = [
\r
601 $scope.jsonMenuData = unflatten( $scope.jsonMenuData );
\r
602 $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
\r
603 // $log.debug(JSON.stringify($scope.jsonMenuData));
\r
605 var childItemList="";
\r
606 var parentList = "";
\r
608 childItemList = ${menu.childItemList};
\r
609 parentList = ${menu.parentList};
\r
611 console.log("ebz_header: failed to get child/parent lists", err);
\r
614 var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
\r
616 $scope.menuItems = [];
\r
617 for (var i = 0; i < parentList.length; i++) {
\r
618 $scope.openCurrentMenu = false;
\r
619 if(pageUrl==parentList[i].action)
\r
620 $scope.openCurrentMenu = true;
\r
621 $scope.childItemList = childItemList[i];
\r
622 for(chIndex in $scope.childItemList){
\r
623 if($scope.childItemList.length>0)
\r
624 if($scope.childItemList[chIndex].action!=null){
\r
625 if($scope.childItemList[chIndex].action==pageUrl)
\r
626 $scope.openCurrentMenu = true;
\r
630 parentLabel : parentList[i].label,
\r
631 parentAction : parentList[i].action,
\r
632 parentImageSrc : parentList[i].imageSrc,
\r
633 open:$scope.openCurrentMenu,
\r
634 childItemList : $scope.childItemList
\r
636 $scope.menuItems.push($scope.item);
\r
638 $scope.arrowShow = true;
\r
639 $scope.drawerOpen = false;
\r
640 $scope.subMenuContent = false;
\r
641 $scope.toggleSubMenu = function() {
\r
642 $scope.subMenuContent = !$scope.subMenuContent;
\r
645 var drawerOpen = 'open';
\r
646 if (drawerOpen == 'open') {
\r
647 $scope.drawerOpen = true;
\r
648 $scope.arrowShow = true;
\r
650 $scope.arrowShow = false;
\r
652 $scope.arrowShow = true;
\r
653 $scope.drawerOpen = false;
\r
654 $scope.toggleDrawer = function() {
\r
655 $scope.drawerOpen = !($scope.drawerOpen);
\r
656 if ($scope.drawerOpen) {
\r
657 $scope.arrowShow = true;
\r
658 if (document.getElementById('mContent')!=null)
\r
659 document.getElementById('mContent').style.marginLeft = "0px";
\r
661 $scope.arrowShow = false;
\r
662 if (document.getElementById('mContent')!=null)
\r
663 document.getElementById('mContent').style.marginLeft = "-150px";
\r
666 //var drawerOpen = getCookie('drawerOpen');
\r
667 if (drawerOpen == 'open') {
\r
668 $scope.drawerOpen = true;
\r
669 $scope.arrowShow = true;
\r
671 $scope.arrowShow = false;
\r
673 $timeout(function() {
\r
674 detectScrollEvent();
\r
679 app.filter("ellipsis", function(){
\r
680 return function(text, length){
\r
682 var ellipsis = text.length > length ? "..." : "";
\r
683 return text.slice(0, length) + ellipsis;
\r