2 ============LICENSE_START==========================================
\r
4 ===================================================================
\r
5 Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 ===================================================================
\r
8 Unless otherwise specified, all software contained herein is licensed
\r
9 under the Apache License, Version 2.0 (the
\93License
\94);
\r
10 you may not use this software except in compliance with the License.
\r
11 You may obtain a copy of the License at
\r
13 http://www.apache.org/licenses/LICENSE-2.0
\r
15 Unless required by applicable law or agreed to in writing, software
\r
16 distributed under the License is distributed on an "AS IS" BASIS,
\r
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
18 See the License for the specific language governing permissions and
\r
19 limitations under the License.
\r
21 Unless otherwise specified, all documentation contained herein is licensed
\r
22 under the Creative Commons License, Attribution 4.0 Intl. (the
\93License
\94);
\r
23 you may not use this documentation except in compliance with the License.
\r
24 You may obtain a copy of the License at
\r
26 https://creativecommons.org/licenses/by/4.0/
\r
28 Unless required by applicable law or agreed to in writing, documentation
\r
29 distributed under the License is distributed on an "AS IS" BASIS,
\r
30 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
31 See the License for the specific language governing permissions and
\r
32 limitations under the License.
\r
34 ============LICENSE_END============================================
\r
36 ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
38 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
\r
39 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
\r
40 <%@ page isELIgnored="false"%>
\r
41 <%@ page import="org.onap.portalsdk.core.util.SystemProperties"%>
\r
42 <%@ page import="org.onap.portalsdk.core.onboarding.util.PortalApiProperties"%>
\r
43 <%@ page import="org.onap.portalsdk.core.onboarding.util.PortalApiConstants"%>
\r
44 <%@ page import="org.onap.portalsdk.core.domain.MenuData"%>
\r
45 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/header.css">
\r
46 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/ebz_header/portal_ebz_header.css">
\r
47 <link rel="stylesheet" type="text/css" href="app/fusion/external/ebz/sandbox/styles/style.css" >
\r
50 <!-- <script src= "app/fusion/external/ebz/angular_js/angular.js"></script>
\r
51 <script src= "app/fusion/external/ebz/angular_js/angular-route.min.js"></script>
\r
52 <script src= "app/fusion/external/ebz/angular_js/angular-sanitize.js"></script>
\r
53 <script src= "app/fusion/external/ebz/angular_js/angular-cookies.js"></script>
\r
54 <script src= "app/fusion/external/ebz/angular_js/app.js"></script>
\r
55 <script src= "app/fusion/external/ebz/angular_js/gestures.js"></script>
\r
56 <script src="static/js/jquery-1.10.2.js"></script>
\r
57 <script src="app/fusion/scripts/modalService.js"></script>
\r
58 <script src="static/js/jquery.mask.min.js" type="text/javascript"></script>
\r
59 <script src="static/js/jquery-ui.js" type="text/javascript"></script>
\r
60 <script src="app/fusion/external/ebz/sandbox/att-abs-tpls.js" type="text/javascript"></script>
\r
61 <script src="static/fusion/js/att_angular_gridster/ui-gridster-tpls.js"></script>
\r
62 <script src="static/fusion/js/att_angular_gridster/angular-gridster.js"></script>
\r
63 <script src= "app/fusion/external/ebz/angular_js/checklist-model.js"></script>
\r
64 <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/0.10.0/lodash.min.js"></script>
\r
65 <script src="app/fusion/external/angular-ui/ui-bootstrap-tpls-1.1.2.min.js"></script>
\r
66 <script src="app/fusion/scripts/services/userInfoService.js"></script>
\r
67 <script src="app/fusion/scripts/services/leftMenuService.js"></script> -->
\r
70 <jsp:include page="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" ></jsp:include>
\r
73 <c:set var="UserName" value="<%= session.getAttribute(\"fullName\")%>" />
\r
74 <c:set var="UserFirstName" value="<%= session.getAttribute(\"first_name\")%>" />
\r
77 String contactUsLink = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK);
\r
78 String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL);
\r
79 String portalUrl = redirectUrl;
\r
80 String getAccessLink = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')) + "/get_access";
\r
82 <c:set var="returnPortalUrl" value="<%=portalUrl%>" />
\r
83 <c:set var="contactUsLink" value="<%=contactUsLink%>" />
\r
84 <c:set var="getAccessLink" value="<%=getAccessLink%>" />
\r
89 <%@include file="/WEB-INF/fusion/jsp/ebz/loginSnippet.html" %>
\r
91 <div style="position: relative; z-index: 999;">
\r
92 <div ng-controller="headerController">
\r
94 <div class="headerContainer" id="headerContainer" ng-cloak ng-show="{{showHeader}}">
\r
95 <div id="megaMenuContainer" class="megaMenuContainer" style="margin-top: 0; overflow: visible;">
\r
97 <!--for mega Menu-->
\r
98 <!-- Mega Menu parent-tab directive with three models menu-items, active-sub-menu, active-menu -->
\r
99 <div id="topMenu" class="top-megamenu" ng-mouseleave="activeClickSubMenu.x.active=false; activeClickMenu.x.active=false">
\r
100 <div style="float:left;width:100%;"parent-tab menu-items="megaMenuDataObject" active-sub-menu='activeClickSubMenu.x' active-menu='activeClickMenu.x'>
\r
101 <div parentmenu-tabs mega-menu="true" menu-items="megaMenuDataObject" style="height:55px;">
\r
102 <div style="float:left">
\r
103 <li class="megamenu__item" style="line-height:55px;" onclick="returnToPortal()">
\r
104 <img src="app/fusion/external/ebz/images/logo.png" class="Logo" ></span>
\r
105 <!-- <a id='returnPortal' class="primaryMenuOptionLink" style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;">ECOMP</a>
\r
106 --> <strong style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;" id='returnPortal' >ECOMP Portal</strong>
\r
108 <div menu-tabs mega-menu="true" tab-name="item.text" menu-item="item" active-menu="activeClickMenu.x"
\r
109 ng-repeat="item in megaMenuDataObject" style="font-size: 18px;" ng-mousedown="loadFavorites()" >
\r
110 <div parentmenu-tabs sub-menu="true" ng-show="activeClickMenu.x.active && item.active" menu-items="activeClickMenu.x.children">
\r
111 <!-- Second level menu -->
\r
113 <div menu-tabs sub-menu="true" tab-name="subItem.text"
\r
114 tab-url="subItem.url" menu-item="subItem"
\r
115 ng-repeat="subItem in activeClickMenu.x.children | orderBy : 'column'" active-menu="activeClickSubMenu.x"
\r
116 sub-item-active="{{subItem.active}}" style="float:left;" aria-label="{{subItem.text}}"
\r
117 ng-mouseenter="submenuLevelAction(subItem.text,subItem.column)"
\r
118 ng-mouseleave="submenuLevelAction(subItem.text,subItem.column)"
\r
119 ng-click="submenuLevelAction(subItem.text,subItem.column)" >
\r
120 <i ng-if="subItem.text=='Favorites'" id="favorite-star"
\r
121 class="icon-star favorites-icon-active">
\r
125 <div class="sub__menu" ng-mouseleave="activeClickSubMenu.x.active=false" >
\r
126 <ul ng-show="activeClickSubMenu.x.active" role="menubar" class="columns">
\r
127 <!-- Third level menu -->
\r
128 <div menu-tabs menu-item="subItem"
\r
129 class="columns-div"
\r
130 ng-repeat="subItem in activeClickSubMenu.x.children | orderBy : 'column'"
\r
131 ng-show="activeClickSubMenu.x.active">
\r
133 <i id="favorite-selector-third-level"
\r
134 ng-show="isUrlFavorite(subItem.menuId)==false"
\r
135 class="icon-star favorites-icon-inactive"
\r
136 ng-if="subItem.url.length > 1">
\r
138 <i id="favorite-selector-third-level"
\r
139 ng-show="isUrlFavorite(subItem.menuId)"
\r
140 class="icon-star favorites-icon-active"
\r
141 ng-if="subItem.url.length > 1">
\r
143 <span class="title" aria-label="{{subItem.text}}"
\r
144 ng-click="goToUrl(subItem)">{{subItem.text}}</span>
\r
145 <!-- Fourth level menus -->
\r
146 <div att-links-list="">
\r
147 <i id="favorite-selector-fourth-level"
\r
148 class="icon-star favorites-icon-inactive"
\r
149 ng-show="isUrlFavorite(tabValue.menuId)==false"
\r
150 ng-if="tabValue.url.length > 1">
\r
153 <i id="favorite-selector-fourth-level"
\r
154 class="icon-star favorites-icon-active"
\r
155 ng-show="isUrlFavorite(tabValue.menuId)"
\r
156 ng-if="tabValue.url.length > 1">
\r
159 <span role="menuitem" att-links-list-item=""
\r
160 ng-repeat="tabValue in subItem.children"
\r
161 ng-click="goToUrl(tabValue)"
\r
162 att-accessibility-click="13,32"
\r
163 ng-class="{'disabled': tabValue.disabled}">{{tabValue.text}}</span>
\r
165 <hr ng-show="!$last"/>
\r
169 <!-- Favorites level menu -->
\r
170 <div class="favorites-window" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()">
\r
171 <div id="favorites-menu-items" ng-show="showFavorites">
\r
172 <div ng-repeat="subItem in favoritesMenuItems" att-links-list="" style='display: inline'>
\r
173 <i id="favorite-selector-favorites-list" class="icon-star favorites-icon-active">
\r
175 <a id="favorites-list" aria-label="{{subItem.text}}"
\r
176 ng-click="goToUrl(subItem)"
\r
177 style="margin-left: 3px; margin-right: 20px; text-decoration: none; color: #666666;">
\r
183 <p style='font-weight: 400; font-family: clearview_att_bold !important;
\r
184 font-size: 18px; text-align: center; background-color: lightgray;
\r
185 width: 400px; margin-left: 25%; margin-right: 25%;'>
\r
186 Manage favorites on ECOMP Portal.
\r
190 <!-- Favorites when empty -->
\r
191 <div id="favorites-empty" ng-show='favoritesWindow' ng-show="emptyFavorites">
\r
192 <div id="favorites-empty" ng-show="emptyFavorites" class="favorites-window-empty">
\r
194 <img src="app/fusion/external/ebz/images/no_favorites_star.png">
\r
195 <p class='favoritesLargeText'>No Favorites</p>
\r
196 <p class='favoritesNormalText'>Manage favorites on ECOMP Portal.</p>
\r
206 <li class="megamenu__item" style="line-height:55px;" ng-if="loadMenufail">
\r
207 <strong style="font-weight: 400 !important; font-family: clearview_att_bold !important; font-size: 18px;" >Unable to load menus</strong>
\r
209 <!-- <li class="megamenu__item" style="width: 20%;"> </li>
\r
211 <!-- Login Snippet-->
\r
212 <div style="float:right">
\r
213 <li id="bcLoginSnippet" class="megamenu__item" style="width: 140px;" >
\r
214 <div popover="loginSnippet.html" aria-label="Login Snippet" referby="loginSnippet" att-accessibility-click="13,32" popover-style="\" popover-placement="below" style="width: 200px;">
\r
215 <div class="icon-user-small login-snippet-icon"></div>
\r
216 <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
219 <li class="megamenu__item" style="width:120px;"> </li>
\r
224 <div style="clear: both"></div>
\r
229 <div class="license-notification" id="license-notification">
\r
230 <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
231 <span style="">{{app_name_full}}</span>
\r
234 <div style="position: relative; color: black; top: 70px;">
\r
236 <span ng-style="adjustHLeftMenu('burgerIcon')" style="z-index:998; position:fixed; left:0%; font-size:35px; margin-left:10px;text-decoration:none;">
\r
237 <a ng-click="toggleDrawer();isOpen = !isOpen" href="javascript:void(0);" class="arrow-icon-left" >
\r
238 <span class="icon-hamburger"></span></a>
\r
239 <span ng-init="isOpen = true" ng-show="isOpen" style="font-size:16px; position:relative; top:-8px; left:-15px;">    {{app_name}}</span>
\r
241 <div att-drawer drawer-slide="left" drawer-custom-top="{{drawer_custom_top}}px" drawer-size="200px" drawer-open="drawerOpen" drawer-custom-height="100%" >
\r
242 <div ng-style="adjustHLeftMenu('leftMenu')">
\r
243 <div class="attDrawer" style="margin-top:{{drawer_margin_top}}px;">
\r
244 <div style="margin-left:10px; margin-right:10px;">
\r
245 <accordion close-others="true" css="att-accordion--no-box">
\r
246 <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
247 <div ng-repeat="subMenu in parent.childItemList" style="font-size:12px; margin-left:10px;">
\r
248 <a href="{{subMenu.action}}" style="font-size:12px; color:#666666;" >{{subMenu.label}}</a>
\r
262 function returnToPortal(){
\r
263 window.location.href = "<c:out value='${returnPortalUrl}'/>";
\r
265 detectScrollEvent = function() {
\r
266 var footerOff = $('#footerContainer').offset().top;
\r
267 var headOff = $('#headerContainer').offset().top;
\r
268 var winHeight = $(window).height();
\r
269 if ((footerOff - headOff) <= winHeight) {
\r
270 $('.att-drawer').css({
\r
271 "height" : footerOff - headOff - 55
\r
274 $('.att-drawer').css({
\r
279 $(window).scroll(function() {
\r
280 if ($('.att-drawer').is(':visible')) {
\r
281 detectScrollEvent();
\r
284 app.controller("headerController", function($scope, $timeout, $log, $http, UserInfoService, $window, $cookies,LeftMenuService) {
\r
285 // $log.debug('HeaderController started');
\r
286 $scope.jsonMenuData = [];
\r
287 $scope.loadMenufail=false;
\r
288 $scope.app_name = "";
\r
289 $scope.app_name_full = "";
\r
290 $scope.megaMenuDataObject =[];
\r
291 $scope.activeClickSubMenu = {
\r
294 $scope.activeClickMenu = {
\r
297 $scope.favoritesMenuItems = [];
\r
298 $scope.favoriteItemsCount = 0;
\r
299 $scope.showFavorites = false;
\r
300 $scope.emptyFavorites = false;
\r
301 $scope.favoritesWindow = false;
\r
302 $scope.userProfile={
\r
308 /*Put user info into fields*/
\r
309 $scope.inputUserInfo = function(userInfo){
\r
310 if (typeof(userInfo) != "undefined" && userInfo!=null && userInfo!=''){
\r
311 if (typeof(userInfo.USER_FIRST_NAME) != "undefined" && userInfo.USER_FIRST_NAME!=null && userInfo.USER_FIRST_NAME!='')
\r
312 $scope.userProfile.firstName = userInfo.USER_FIRST_NAME;
\r
313 if (typeof(userInfo.USER_LAST_NAME) != "undefined" && userInfo.USER_LAST_NAME!=null && userInfo.USER_LAST_NAME!='')
\r
314 $scope.userProfile.lastName = userInfo.USER_LAST_NAME;
\r
315 if (typeof(userInfo.USER_EMAIL) != "undefined" && userInfo.USER_EMAIL!=null && userInfo.USER_EMAIL!='')
\r
316 $scope.userProfile.email = userInfo.USER_EMAIL;
\r
319 /*getting user info from session*/
\r
320 $scope.getUserNameFromSession = function(){
\r
321 UserInfoService.getFunctionalMenuStaticDetailSession()
\r
322 .then(function (res) {
\r
323 $scope.userProfile.firstName = res.firstName;
\r
324 $scope.redirectUrl = res.portalUrl;
\r
327 $scope.getTopMenuStaticInfo=function() {
\r
328 var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
\r
331 if(res==null || res==''){
\r
332 $log.info('failed getting static User information');
\r
333 $scope.getUserNameFromSession();
\r
335 $log.info('Received static User information');
\r
336 var resData = res;
\r
337 $scope.inputUserInfo(resData);
\r
338 $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
\r
342 $log.info('failed getting static User information');
\r
347 var unflatten = function( array, parent, tree ){
\r
348 tree = typeof tree !== 'undefined' ? tree : [];
\r
349 parent = typeof parent !== 'undefined' ? parent : { menuId: null };
\r
350 var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
\r
352 if( !_.isEmpty( children ) ){
\r
353 if( parent.menuId === null ){
\r
356 parent['children'] = children
\r
358 _.each( children, function( child ){ unflatten( array, child ) } );
\r
364 var menuStructureConvert = function(menuItems) {
\r
365 var megaMenuDataObjectTemp = [
\r
374 url:"<c:out value='${contactUsLink}'/>"
\r
378 url:"<c:out value='${getAccessLink}'/>"
\r
382 return megaMenuDataObjectTemp;
\r
387 LeftMenuService.getAppName().then(function(response){
\r
390 if(j && j !== "null" && j!== "undefined"){
\r
391 // console.log("app name is " + $scope.app_name);
\r
392 $scope.app_name_full = j.data;
\r
393 var processed_app_name = j.data;
\r
394 if(processed_app_name.indexOf("[")<=-1) {
\r
395 if (document.getElementById('license-notification')!=null)
\r
396 document.getElementById('license-notification').style.display = "none";
\r
398 var n = processed_app_name.length;
\r
402 $scope.app_name = processed_app_name.substr(0, n);
\r
404 throw "Get app_name response is not an object/is empty";
\r
407 console.log("error happened while trying to get app name "+e);
\r
411 console.log('getAppName failed', error);
\r
414 $scope.getTopMenuStaticInfo();
\r
415 $scope.getMenu=function() {
\r
419 url: 'get_functional_menu',
\r
420 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
422 }).success(function (response) {
\r
423 if(response == '101: Timeout') {
\r
424 $log.error('Timeout attempting to get_functional_menu');
\r
425 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
426 // $scope.createErrorMenu();
\r
427 $scope.megaMenuDataObject = menuStructureConvert('');
\r
429 $log.debug('get_functional_menu success: ' + response);
\r
430 if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
\r
431 // createErrorMenu() USED FOR LOCAL TESTING ONLY
\r
432 // $scope.createErrorMenu();
\r
433 $scope.megaMenuDataObject = menuStructureConvert('');
\r
434 // $scope.loadMenufail=true;
\r
436 $scope.jsonMenuData = unflatten( response );
\r
437 $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
\r
440 }).error(function (response){
\r
441 // createErrorMenu() USED FOR LOCAL TESTING ONLY
\r
442 // $scope.createErrorMenu();
\r
444 //$scope.loadMenufail=true;
\r
445 $scope.megaMenuDataObject = menuStructureConvert('');
\r
446 $log.debug('REST API failed get_functional_menu...'+ response);
\r
449 $scope.adjustHLeftMenu = function (type){
\r
450 $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
\r
452 if($scope.showHeader == true) {
\r
453 $scope.drawer_margin_top = 60;
\r
454 $scope.drawer_custom_top = 54;
\r
455 $scope.toggle_drawer_top = 55;
\r
459 $scope.drawer_margin_top = 50;
\r
460 $scope.drawer_custom_top = 0;
\r
461 $scope.toggle_drawer_top = 10;
\r
463 if(type=='burgerIcon'){
\r
464 return { "top": $scope.toggle_drawer_top+"px"};
\r
465 }else if(type=='leftMenu'){
\r
466 return { "margin-top": $scope.drawer_margin_top+"px"};
\r
470 $scope.adjustHeader=function() {
\r
471 $scope.showHeader = ($cookies.show_app_header == undefined ? true : $cookies.show_app_header);
\r
473 if($scope.showHeader == true) {
\r
474 $scope.drawer_margin_top = 50;
\r
475 $scope.drawer_custom_top = 54;
\r
476 $scope.toggle_drawer_top = 55;
\r
480 $scope.drawer_margin_top = 40;
\r
481 $scope.drawer_custom_top = 0;
\r
482 $scope.toggle_drawer_top = 10;
\r
489 //$scope.getMenu();
\r
490 $scope.adjustHeader();
\r
493 /* **************************************************************************/
\r
494 /* Logic for the favorite menus is here */
\r
496 $scope.loadFavorites = function () {
\r
497 $log.debug('loadFavorites has happened.');
\r
498 if ($scope.favoritesMenuItems == '') {
\r
499 $scope.generateFavoriteItems();
\r
500 $log.debug('loadFavorites is calling generateFavoriteItems()');
\r
502 $log.debug('loadFavorites is NOT calling generateFavoriteItems()');
\r
506 $scope.goToUrl = function (item) {
\r
507 $log.info("goToUrl called")
\r
510 var url = item.url;
\r
511 var restrictedApp = item.restrictedApp;
\r
512 $log.debug('Restricted app status is: ' + restrictedApp);
\r
514 $log.info('No url found for this application, doing nothing..');
\r
517 if (restrictedApp) {
\r
518 $window.open(url, '_blank');
\r
520 $window.open(url, '_self');
\r
525 $scope.submenuLevelAction = function(index, column) {
\r
526 if ($scope.favoritesMenuItems == '') {
\r
527 $scope.generateFavoriteItems();
\r
528 $log.debug('submenuLevelAction is calling generateFavoriteItems()');
\r
530 $log.debug('item hovered/clicked: ' + index + '; column = ' + column);
\r
531 if (column == 2) { // 2 is Design
\r
532 $scope.favoritesWindow = false;
\r
533 $scope.showFavorites = false;
\r
534 $scope.emptyFavorites = false;
\r
536 if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
\r
537 $log.debug('Showing Favorites window');
\r
538 $scope.favoritesWindow = true;
\r
539 $scope.showFavorites = true;
\r
540 $scope.emptyFavorites = false;
\r
542 if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
\r
543 $log.debug('Hiding Favorites window in favor of No Favorites Window');
\r
544 $scope.favoritesWindow = true;
\r
545 $scope.showFavorites = false;
\r
546 $scope.emptyFavorites = true;
\r
549 $scope.favoritesWindow = false;
\r
550 $scope.showFavorites = false;
\r
551 $scope.emptyFavorites = false;
\r
555 $scope.hideFavoritesWindow = function() {
\r
556 $log.debug('$scope.hideFavoritesWindow has been called');
\r
557 $scope.showFavorites = false;
\r
558 $scope.emptyFavorites = false;
\r
561 $scope.isUrlFavorite = function (menuId) {
\r
562 // $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
\r
563 var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
\r
564 var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
\r
565 if (isMenuFavorite==-1) {
\r
573 $scope.generateFavoriteItems = function() {
\r
576 url: 'get_favorites',
\r
577 // TIMEOUT USED FOR LOCAL TESTING ONLY
\r
579 }).success(function (response) {
\r
580 if (response == '101: Timeout') {
\r
581 $log.error('Timeout attempting to get_favorites_menu');
\r
583 if(typeof response != 'undefined' && response.length!=0 && typeof response[0] != 'undefined' && typeof response[0].error!="undefined"){
\r
584 $log.error('REST API failed get_favorites' + response);
\r
586 $log.debug('get_favorites = ' + JSON.stringify(response));
\r
587 $scope.favoritesMenuItems = response;
\r
588 $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
\r
589 $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
\r
592 }).error(function (response){
\r
593 $log.error('REST API failed get_favorites' + response);
\r
594 //createFavoriteErrorMenu() USED FOR LOCAL TESTING ONLY
\r
595 // $scope.createFavoriteErrorMenu();
\r
599 $scope.createFavoriteErrorMenu=function() {
\r
600 $scope.favoritesMenuItems = [
\r
603 $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length;
\r
604 $log.info('number of favorite menus: ' + $scope.favoriteItemsCount);
\r
607 /* end of Favorite Menu code */
\r
608 /* **************************************************************************/
\r
611 /* **************************************************************************/
\r
612 // THIS IS USED FOR LOCAL TESTING ONLY
\r
613 /* **************************************************************************/
\r
615 $scope.createErrorMenu=function() {
\r
616 $scope.jsonMenuData = [
\r
619 $scope.jsonMenuData = unflatten( $scope.jsonMenuData );
\r
620 $scope.megaMenuDataObject = menuStructureConvert($scope.jsonMenuData);
\r
621 // $log.debug(JSON.stringify($scope.jsonMenuData));
\r
623 var childItemList="";
\r
624 var parentList = "";
\r
626 childItemList = ${menu.childItemList};
\r
627 parentList = ${menu.parentList};
\r
629 console.log("ebz_header: failed to get child/parent lists", err);
\r
632 var pageUrl = window.location.href.split('/')[window.location.href.split('/').length-1];
\r
634 $scope.menuItems = [];
\r
635 for (var i = 0; i < parentList.length; i++) {
\r
636 $scope.openCurrentMenu = false;
\r
637 if(pageUrl==parentList[i].action)
\r
638 $scope.openCurrentMenu = true;
\r
639 $scope.childItemList = childItemList[i];
\r
640 for(chIndex in $scope.childItemList){
\r
641 if($scope.childItemList.length>0)
\r
642 if($scope.childItemList[chIndex].action!=null){
\r
643 if($scope.childItemList[chIndex].action==pageUrl)
\r
644 $scope.openCurrentMenu = true;
\r
648 parentLabel : parentList[i].label,
\r
649 parentAction : parentList[i].action,
\r
650 parentImageSrc : parentList[i].imageSrc,
\r
651 open:$scope.openCurrentMenu,
\r
652 childItemList : $scope.childItemList
\r
654 $scope.menuItems.push($scope.item);
\r
656 $scope.arrowShow = true;
\r
657 $scope.drawerOpen = false;
\r
658 $scope.subMenuContent = false;
\r
659 $scope.toggleSubMenu = function() {
\r
660 $scope.subMenuContent = !$scope.subMenuContent;
\r
663 var drawerOpen = 'open';
\r
664 if (drawerOpen == 'open') {
\r
665 $scope.drawerOpen = true;
\r
666 $scope.arrowShow = true;
\r
668 $scope.arrowShow = false;
\r
670 $scope.arrowShow = true;
\r
671 $scope.drawerOpen = false;
\r
672 $scope.toggleDrawer = function() {
\r
673 $scope.drawerOpen = !($scope.drawerOpen);
\r
674 if ($scope.drawerOpen) {
\r
675 $scope.arrowShow = true;
\r
676 if (document.getElementById('mContent')!=null)
\r
677 document.getElementById('mContent').style.marginLeft = "0px";
\r
679 $scope.arrowShow = false;
\r
680 if (document.getElementById('mContent')!=null)
\r
681 document.getElementById('mContent').style.marginLeft = "-150px";
\r
684 //var drawerOpen = getCookie('drawerOpen');
\r
685 if (drawerOpen == 'open') {
\r
686 $scope.drawerOpen = true;
\r
687 $scope.arrowShow = true;
\r
689 $scope.arrowShow = false;
\r
691 $timeout(function() {
\r
692 detectScrollEvent();
\r
697 app.filter("ellipsis", function(){
\r
698 return function(text, length){
\r
700 var ellipsis = text.length > length ? "..." : "";
\r
701 return text.slice(0, length) + ellipsis;
\r