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
24 class userNotificationsModalCtrl {
\r
25 constructor($scope, $log, functionalMenuService, confirmBoxService, notificationService, $modal, ngDialog, $state, $filter) {
\r
27 let newNotifModel = {
\r
28 'isOnlineUsersOnly': null,
\r
29 'isForAllRolesOptions': null,
\r
30 'selectedPriority': null,
\r
35 'msgDescription': null,
\r
37 'roleObj': {notificationRoleIds:null}
\r
40 $scope.notificationId = null;
\r
41 $scope.selectedCat = null;
\r
42 $scope.selectedEcompFunc = null;
\r
43 this.YN_index_mapping = {
\r
48 $scope.onlineAllUsersOptions = [
\r
49 { "index": 0, "value": "Y", "title": "Online Users Only" },
\r
50 { "index": 1, "value": "N", "title": "Online & Offline Users" }
\r
54 $scope.isForAllRolesOptions = [
\r
55 { "index": 0, "value": "Y", "title": "Yes" },
\r
56 { "index": 1, "value": "N", "title": "No" }
\r
59 $scope.priorityOptions = [
\r
60 { "index": 0, "value": 1, "title": "Normal" },
\r
61 { "index": 1, "value": 2, "title": "Important" }
\r
64 $scope.isActiveOptions = [
\r
65 { "index": 0, "value": "Y", "title": "Yes" },
\r
66 { "index": 1, "value": "N", "title": "No" }
\r
68 $scope.isActive = $scope.isActiveOptions[0];
\r
69 $scope.selectPriority = $scope.priorityOptions[0];
\r
70 $scope.isOnlineUsersOnly = $scope.onlineAllUsersOptions[1];
\r
71 $scope.isForAllRoles=$scope.isForAllRolesOptions[0].value;
\r
72 $scope.isFunctionalMenu ="Y";
\r
74 $scope.selectedPriority=$scope.priorityOptions[0].value;
\r
76 // $scope.notificationRoleIds = [];
\r
77 $scope.msgHeader = '';
\r
78 $scope.msgDescription = '';
\r
79 $scope.treeTitle="Functional Menu";
\r
80 $scope.notifObj= {isCategoriesFunctionalMenu:true};
\r
83 // $log.info('userNotificationsModalCtrl::init');
\r
84 this.isSaving = false;
\r
85 var today = new Date();
\r
86 $scope.minDate = today.toISOString().substring(0, 10);
\r
87 var threeMonthsFromNow = new Date();
\r
88 threeMonthsFromNow.setMonth(threeMonthsFromNow.getMonth() + 3);
\r
89 $scope.maxDate = threeMonthsFromNow.toISOString().substring(0, 10);
\r
90 if ($scope.ngDialogData && $scope.ngDialogData.notif) {
\r
91 // $log.debug('userNotificationsModalCtrl:init:: Edit
\r
92 // notification mode for', $scope.ngDialogData.notif);
\r
93 $scope.isEditMode = true;
\r
94 $scope.editModeObj = {isEditMode: true};
\r
95 this.notif = _.clone($scope.ngDialogData.notif);
\r
96 $scope.modalPgTitle = 'View Notification'
\r
97 $scope.isOnlineUsersOnly = $scope.onlineAllUsersOptions[this.YN_index_mapping[this.notif.isForOnlineUsers]];
\r
98 $scope.isForAllRoles = $scope.isForAllRolesOptions[this.YN_index_mapping[this.notif.isForAllRoles]].value;
\r
99 $scope.isActive = $scope.isActiveOptions[this.YN_index_mapping[this.notif.activeYn]];
\r
100 $scope.selectedPriority = $scope.priorityOptions[this.notif.priority - 1].value;
\r
101 $scope.startTime = new Date(this.notif.startTime);
\r
102 $scope.endTime = new Date(this.notif.endTime);
\r
103 $scope.msgHeader = this.notif.msgHeader;
\r
104 $scope.msgDescription = this.notif.msgDescription;
\r
105 $scope.notificationId = this.notif.notificationId;
\r
106 $scope.notificationRoleIds = this.notif.roleIds;
\r
107 $scope.roleObj = {notificationRoleIds:this.notif.roleIds};
\r
109 // $log.debug('AppDetailsModalCtrl:init:: New app mode');
\r
110 $scope.isEditMode = false;
\r
111 $scope.editModeObj = {isEditMode: false};
\r
112 $scope.modalPgTitle = 'Add a New Notification'
\r
113 this.notif = _.clone(newNotifModel);
\r
114 $scope.roleObj = {notificationRoleIds:null};
\r
117 this.conflictMessages = {};
\r
118 this.scrollApi = {};
\r
119 let handleConflictErrors = err => {
\r
123 if(!err.data.length){ // support objects
\r
124 err.data = [err.data]
\r
126 _.forEach(err.data, item => {
\r
127 _.forEach(item.fields, field => {
\r
128 // set conflict message
\r
129 this.conflictMessages[field.name] = errorMessageByCode[item.errorCode];
\r
130 // set field as invalid
\r
131 $scope.appForm[field.name].$setValidity('conflict', false);
\r
132 // set watch once to clear error after user correction
\r
133 watchOnce[field.name]();
\r
136 this.scrollApi.scrollTop();
\r
139 let resetConflict = fieldName => {
\r
140 delete this.conflictMessages[fieldName];
\r
141 if($scope.appForm[fieldName]){
\r
142 $scope.appForm[fieldName].$setValidity('conflict', true);
\r
145 $scope.addUserNotificationValidation = function () {
\r
146 // // pre-processing
\r
147 if (!($scope.isEditMode)) {
\r
148 var validation=false;
\r
150 if($scope.startTime && $scope.endTime && $scope.msgHeader != '' && $scope.msgDescription != '' && ($scope.startTime<$scope.endTime)){
\r
152 if( $scope.isForAllRoles=='N'){
\r
153 validation = $scope.checkBoxObj.isAnyRoleSelected;
\r
161 return !validation;
\r
165 /* format the value for viewing a notification */
\r
166 $scope.formatStartDate = function () {
\r
167 if ($scope.startTime) {
\r
168 $scope.startTime = $filter('date')($scope.startTime, 'medium');
\r
172 /* format the value for viewing a notification */
\r
173 $scope.formatEndDate = function () {
\r
174 if($scope.endTime){
\r
175 $scope.endTime = $filter('date')($scope.endTime, 'medium');
\r
179 $scope.addUserNotification = function () {
\r
180 $scope.notificationRoleIds = [];
\r
182 for (var key in $scope.checkboxIdDict) {
\r
183 if ($scope.checkboxIdDict[key].is_box_checked && ($scope.checkboxIdDict[key].role_id != null)) {
\r
184 var role_ids = $scope.checkboxIdDict[key].role_id;
\r
185 for (var i in role_ids) {
\r
186 if (!($scope.notificationRoleIds.indexOf(role_ids[i]) > -1)) {
\r
187 $scope.notificationRoleIds.push(role_ids[i]);
\r
193 $scope.notificationRoleIds.sort();
\r
194 if (($scope.isOnlineUsersOnly) && ($scope.isForAllRoles) && ($scope.selectedPriority) && ($scope.isActive)
\r
195 && ($scope.startTime) && ($scope.endTime) && ($scope.msgHeader != '') && ($scope.msgDescription != '')) {
\r
196 this.newUserNotification =
\r
198 'notificationId':$scope.notificationId,
\r
199 'isForOnlineUsers': $scope.isOnlineUsersOnly.value,
\r
200 'isForAllRoles': $scope.isForAllRoles,
\r
201 'priority': $scope.selectedPriority,
\r
202 'activeYn': $scope.isActive.value,
\r
203 'startTime': $scope.startTime,
\r
204 'endTime': $scope.endTime,
\r
205 'msgHeader': $scope.msgHeader,
\r
206 'msgDescription': $scope.msgDescription,
\r
207 'roleIds': $scope.notificationRoleIds,
\r
208 'createdDate': new Date()
\r
211 // POST ajax call here;
\r
212 if ($scope.isEditMode) {
\r
213 notificationService.updateAdminNotification(this.newUserNotification)
\r
215 //$log.debug('NotificationService:updateAdminNotification:: Admin notification update succeeded!');
\r
216 $scope.closeThisDialog(true);
\r
219 $log.error('notificationService.updateAdminNotfication failed: ' + JSON.stringify(err));
\r
220 switch (err.status) {
\r
221 case '409': // Conflict
\r
222 // handleConflictErrors(err);
\r
224 case '500': // Internal Server Error
\r
225 confirmBoxService.showInformation('There was a problem updating the notification. ' +
\r
226 'Please try again later. Error: ' + err.status).then(isConfirmed => { });
\r
228 case '403': // Forbidden... possible
\r
229 // webjunction error to
\r
231 confirmBoxService.showInformation('There was a problem updating the notification. ' +
\r
232 'Please try again. If the problem persists, then try again later. Error: ' + err.status).then(isConfirmed => { });
\r
235 confirmBoxService.showInformation('There was a problem updating the notification. ' +
\r
236 'Please try again. If the problem persists, then try again later. Error: ' + err.status).then(isConfirmed => { });
\r
239 // for bug in IE 11
\r
240 var objOffsetVersion = objAgent.indexOf("MSIE");
\r
241 if (objOffsetVersion != -1) {
\r
242 $log.debug('AppDetailsModalCtrl:updateOnboardingApp:: Browser is IE, forcing Refresh');
\r
243 $window.location.reload();
\r
245 // for bug in IE 11
\r
249 notificationService.addAdminNotification(this.newUserNotification)
\r
251 $log.debug('notificationService:addAdminNotification:: Admin notification creation succeeded!,',res);
\r
252 if(res.status=='ERROR'){
\r
253 confirmBoxService.showInformation('There was a problem adding the notification. ' +
\r
254 ' Error: ' + res.response).then(isConfirmed => { });
\r
259 $scope.closeThisDialog(true);
\r
264 switch (err.status) {
\r
265 case '409': // Conflict
\r
266 // handleConflictErrors(err);
\r
268 case '500': // Internal Server Error
\r
269 confirmBoxService.showInformation('There was a problem adding the notification. ' +
\r
270 'Please try again later. Error: ' + err.status).then(isConfirmed => { });
\r
273 confirmBoxService.showInformation('There was a problem adding the notification. ' +
\r
274 'Please try again. If the problem persists, then try again later. Error: ' +
\r
275 err.status).then(isConfirmed => { });
\r
277 $log.error('notificationService:addAdminNotification error:: ' + JSON.stringify(err));
\r
283 $log.warn('please fill in all required fields');
\r
284 confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => { });
\r
287 // Populate the category list for category dropdown list
\r
288 let getFunctionalMenu = () => {
\r
289 this.isLoadingTable = true;
\r
290 $scope.notifObj= {isCategoriesFunctionalMenu:true};
\r
291 functionalMenuService.getFunctionalMenuRole().then(role_res => {
\r
292 var menu_role_dict = {};
\r
293 for (var i in role_res) {
\r
294 // if first time appear in menu_role_dict
\r
295 if (!(role_res[i].menuId in menu_role_dict)) {
\r
296 menu_role_dict[role_res[i].menuId] = [role_res[i].roleId];
\r
298 menu_role_dict[role_res[i].menuId].push(role_res[i].roleId);
\r
301 functionalMenuService.getManagedFunctionalMenuForNotificationTree().then(res => {
\r
302 let actualData = [];
\r
303 var exclude_list = ['Favorites']
\r
304 // Adding children and label attribute to all objects in
\r
305 $scope.checkboxIdDict = {};
\r
306 $scope.checkBoxObj = {isAnyRoleSelected:false};
\r
307 for (let i = 0; i < res.length; i++) {
\r
308 res[i].children = [];
\r
309 res[i].label = res[i].text;
\r
310 res[i].id = res[i].text;
\r
311 // res[i].is_box_checked = false;
\r
312 res[i].can_check = true;
\r
313 res[i].roleId = menu_role_dict[res[i].menuId];
\r
314 $scope.checkboxIdDict[res[i].id] = { 'is_box_checked': false, 'role_id': res[i].roleId };
\r
317 // Adding actual child items to children array in res
\r
319 $scope.parentChildDict ={};
\r
320 $scope.parentChildRoleIdDict ={};
\r
321 for (let i = 0; i < res.length; i++) {
\r
322 let parentId = res[i].menuId;
\r
323 $scope.parentChildDict[parentId] = [];
\r
324 $scope.parentChildRoleIdDict[parentId]=[];
\r
325 for (let j = 0; j < res.length; j++) {
\r
326 let childId = res[j].parentMenuId;
\r
327 if (parentId === childId) {
\r
328 res[i].children.push(res[j]);
\r
329 $scope.parentChildDict[parentId].push(res[j].menuId);
\r
330 //if res[j].roleId is defined
\r
331 if (res[j].roleId) {
\r
332 for (let k in res[j].roleId) {
\r
333 $scope.parentChildRoleIdDict[parentId].push(res[j].roleId[k]);
\r
341 //check if grand children exist
\r
342 for (var key in $scope.parentChildDict){
\r
343 var children = $scope.parentChildDict[key];
\r
344 var isGrandParent = false;
\r
345 if (children.length>0) {
\r
346 for (var i in children) {
\r
347 if ($scope.parentChildDict[children[i]].length>0){
\r
348 isGrandParent = true;
\r
353 if (isGrandParent) {
\r
354 for (var i in children) {
\r
355 // if the child has children
\r
356 if ($scope.parentChildDict[children[i]].length>0) {
\r
357 for (var j in $scope.parentChildRoleIdDict[children[i]]) {
\r
359 if ($scope.parentChildRoleIdDict[key].indexOf($scope.parentChildRoleIdDict[children[i]][j]) === -1) {
\r
360 $scope.parentChildRoleIdDict[key].push($scope.parentChildRoleIdDict[children[i]][j]);
\r
372 var ListMenuIdToRemove = [];
\r
373 //$scope.parentObj = {ListMenuIdToRemove : []};
\r
374 //get the list of menuId that needs to be removed
\r
375 for (let i = 0; i < res.length; i++) {
\r
376 if ((res[i].children.length==0)&&(!res[i].roleId)) {
\r
377 var menuIdToRemove = res[i].menuId;
\r
378 if (ListMenuIdToRemove.indexOf(menuIdToRemove) === -1){
\r
379 ListMenuIdToRemove.push(menuIdToRemove);
\r
384 // a scope variable that marks whether each functional menu item should be displayed.
\r
385 $scope.toShowItemDict = {};
\r
386 for (let i = 0; i < res.length; i++) {
\r
387 if (res[i].roleId==null) {
\r
388 if (res[i].children.length==0) {
\r
389 $scope.toShowItemDict[res[i].menuId]=false;
\r
390 } else if(res[i].children.length>0){
\r
391 if($scope.parentChildDict[res[i].menuId].length === _.intersection($scope.parentChildDict[res[i].menuId], ListMenuIdToRemove).length){
\r
392 $scope.toShowItemDict[res[i].menuId]=false;
\r
394 $scope.toShowItemDict[res[i].menuId]=true;
\r
398 $scope.toShowItemDict[res[i].menuId]=true;
\r
402 // Sort the top-level menu items in order based on the
\r
404 res.sort(function (a, b) {
\r
405 return a.column - b.column;
\r
408 // Sort all the children in order based on the column
\r
409 for (let i = 0; i < res.length; i++) {
\r
410 res[i].children.sort(function (a, b) {
\r
411 return a.column - b.column;
\r
415 // Forming actual parent items
\r
416 for (let i = 0; i < res.length; i++) {
\r
417 let parentId = res[i].parentMenuId;
\r
418 if (parentId === null) {
\r
419 actualData.push(res[i]);
\r
423 // $scope.treedata = actualData;
\r
424 var treedata = actualData[0].children;
\r
425 $scope.treedata = [];
\r
426 for (var i in treedata) {
\r
427 if (!(treedata[i].label.indexOf(exclude_list) > -1)) {
\r
428 $scope.treedata.push(treedata[i])
\r
433 $log.error('FunctionalMenuCtrl:getFunctionalMenu:: error ', err);
\r
435 this.isLoadingTable = false;
\r
439 $log.error('FunctionalMenuCtrl:getFunctionalMenu:: error ', err);
\r
445 let getAppRoleIds = () => {
\r
446 $scope.notifObj= {isCategoriesFunctionalMenu:false};
\r
447 notificationService.getAppRoleIds().then(res => {
\r
450 let actualData = [];
\r
451 // var exclude_list = ['Favorites']
\r
452 var app_id_name_list = {};
\r
453 $scope.checkboxIdDict = {};
\r
454 $scope.checkBoxObj = {isAnyRoleSelected:false};
\r
456 for (let i = 0; i < res.length; i++) {
\r
457 if (!(res[i].appId in app_id_name_list)) {
\r
458 app_id_name_list[res[i].appId] = res[i].appName;
\r
461 res[i].children = [];
\r
462 res[i].label = res[i].roleName;
\r
463 res[i].id = res[i].roleId;
\r
464 res[i].menuId = res[i].roleId;
\r
465 res[i].parentMenuId = res[i].appId;
\r
466 res[i].can_check = true;
\r
467 res[i].roleId = [res[i].roleId];
\r
468 $scope.checkboxIdDict[res[i].id] = { 'is_box_checked': false, 'role_id': res[i].roleId};
\r
471 for (var app_id in app_id_name_list) {
\r
473 new_res.children = [];
\r
474 new_res.label = app_id_name_list[app_id];
\r
475 new_res.id = app_id;
\r
476 new_res.menuId = app_id;
\r
477 new_res.parentMenuId = null;
\r
478 new_res.appId = null;
\r
479 new_res.can_check = true;
\r
480 new_res.roleId = null;
\r
481 $scope.checkboxIdDict[new_res.id]= { 'is_box_checked': false, 'role_id': new_res.roleId };
\r
484 $scope.parentChildRoleIdDict ={};
\r
485 //Adding actual child items to children array in res objects
\r
486 for (let i = 0; i < res.length; i++) {
\r
487 let parentId = res[i].menuId;
\r
488 $scope.parentChildRoleIdDict[parentId]=[];
\r
489 for (let j = 0; j < res.length; j++) {
\r
490 let childId = res[j].parentMenuId;
\r
491 if (parentId == childId) {
\r
492 res[i].children.push(res[j]);
\r
493 if (res[j].roleId) {
\r
494 for (let k in res[j].roleId) {
\r
495 $scope.parentChildRoleIdDict[parentId].push(res[j].roleId[k]);
\r
502 //Forming actual parent items
\r
503 for (let i = 0; i < res.length; i++) {
\r
504 let parentId = res[i].parentMenuId;
\r
505 if (parentId === null) {
\r
506 actualData.push(res[i]);
\r
510 $scope.treedata = actualData;
\r
512 $log.error('FunctionalMenuCtrl:getFunctionalMenu:: error ', err);
\r
514 this.isLoadingTable = false;
\r
517 $scope.getFunctionalMenu= function() {
\r
518 $scope.treeTitle="Functional Menu";
\r
519 getFunctionalMenu();
\r
521 $scope.getAppRoleIds = function() {
\r
522 $scope.treeTitle="Applications/Roles";
\r
527 getFunctionalMenu();
\r
533 userNotificationsModalCtrl.$inject = ['$scope', '$log', 'functionalMenuService', 'confirmBoxService', 'notificationService', '$modal', 'ngDialog', '$state', '$filter'];
\r
534 angular.module('ecompApp').controller('userNotificationsModalCtrl', userNotificationsModalCtrl);
\r
536 angular.module('ecompApp').directive('attDatepickerCustom', ['$log', function($log) {
\r
539 require: 'ngModel',
\r
542 controller: ['$scope', '$element', '$attrs', '$compile', 'datepickerConfig', 'datepickerService', function($scope, $element, $attrs, $compile, datepickerConfig, datepickerService) {
\r
543 var dateFormatString = angular.isDefined($attrs.dateFormat) ? $scope.$parent.$eval($attrs.dateFormat) : datepickerConfig.dateFormat;
\r
544 var selectedDateMessage = '<div class="sr-focus hidden-spoken" tabindex="-1">the date you selected is {{$parent.current | date : \'' + dateFormatString + '\'}}</div>';
\r
545 $element.removeAttr('att-datepicker-custom');
\r
546 $element.removeAttr('ng-model');
\r
547 $element.attr('ng-value', '$parent.current | date:"EEEE, MMMM d, y"');
\r
548 $element.attr('aria-describedby', 'datepicker');
\r
550 $element.attr('maxlength', 10);
\r
552 var wrapperElement = angular.element('<div></div>');
\r
553 wrapperElement.attr('datepicker-popup', '');
\r
554 wrapperElement.attr('current', 'current');
\r
556 datepickerService.setAttributes($attrs, wrapperElement);
\r
557 datepickerService.bindScope($attrs, $scope);
\r
559 wrapperElement.html('');
\r
560 wrapperElement.append($element.prop('outerHTML'));
\r
561 if (navigator.userAgent.match(/MSIE 8/) === null) {
\r
562 wrapperElement.append(selectedDateMessage);
\r
564 var elm = wrapperElement.prop('outerHTML');
\r
565 elm = $compile(elm)($scope);
\r
566 $element.replaceWith(elm);
\r
568 link: function(scope, elem, attr, ctrl) {
\r
570 // do nothing if no ng-model
\r
571 $log.error("ng-model is required.");
\r
575 scope.$watch('current', function(value) {
\r
576 ctrl.$setViewValue(value);
\r
578 ctrl.$render = function() {
\r
579 scope.current = ctrl.$viewValue;
\r
586 angular.module('ecompApp').directive('jqTreeUserNotif', ['functionalMenuService', '$log', 'confirmBoxService', '$compile', function (functionalMenuService, $log, confirmBoxService, $compile) {
\r
589 templateUrl: 'jq-tree-tmpl-user-notif.html',
\r
590 link: function (scope, el, attrs) {
\r
592 var $jqTree = el.find('#jqTreeUserNotif').tree({
\r
593 data: scope.treedata,
\r
594 autoOpen: scope.editModeObj.isEditMode,
\r
595 dragAndDrop: false,
\r
596 onCreateLi: function (node, $li) {
\r
597 node.is_checked = false;
\r
598 if (node.roleId&&scope.roleObj.notificationRoleIds) {
\r
599 node.is_checked = (node.roleId.length === _.intersection(node.roleId, scope.roleObj.notificationRoleIds).length);
\r
601 if (typeof node.id =="string"){
\r
602 $li.attr('id', node.id.replace(/\s+/g, '_'));
\r
604 var isChecked = '';
\r
605 if (node.is_checked) {
\r
606 isChecked = 'checked="checked"';
\r
608 if (node.can_check) {
\r
610 if (scope.notifObj.isCategoriesFunctionalMenu) {
\r
611 toShow = scope.toShowItemDict[node.menuId];
\r
613 var isDisabled = "";
\r
614 if (scope.editModeObj.isEditMode) {
\r
615 isDisabled = " disabled"
\r
617 //if node is a parent/grandparent node
\r
618 if (node.children.length>0){
\r
619 //whether to show node first
\r
620 if (_.intersection(scope.parentChildRoleIdDict[node.menuId], scope.roleObj.notificationRoleIds).length) {
\r
622 if (scope.parentChildRoleIdDict[node.menuId].length==_.intersection(scope.parentChildRoleIdDict[node.menuId], scope.roleObj.notificationRoleIds).length) {
\r
623 isChecked = 'checked="checked"';
\r
629 //if node is a child node
\r
631 if (node.is_checked) {
\r
642 var template = '<input ng-click="thisCheckboxClicked($event)" type="checkbox" class="edit js-node-check" data-node-menu-id="' + node.menuId + '" data-node-id="' + node.id + '" ' + isChecked + ' ng-show="' + toShow + '"' + isDisabled+ '/>'
\r
644 var templateEl = angular.element(template);
\r
645 var $jqCheckbox = $compile(templateEl)(scope);
\r
647 $li.find('.jqtree-element').prepend($jqCheckbox);
\r
649 $li.find('.jqtree-element').remove();
\r
655 scope.thisCheckboxClicked = function (e) {
\r
657 var nodeId = e.target.attributes[4].value;
\r
661 var sBrowser, sUsrAg = window.navigator.userAgent;
\r
662 //if (sUsrAg.indexOf("Firefox") > -1) {
\r
664 if (sUsrAg.indexOf("Trident") > -1) {
\r
665 nodeId = e.target.attributes[5].value;
\r
668 // if (sUsrAg.indexOf("MSIE") > 1) {
\r
669 // alert("hELLO tHIS IS IE10");
\r
670 // nodeId = e.target.attributes[3].value;
\r
671 // alert('nodeId 26 of IE 45 : '+nodeId);
\r
674 var version = navigator.userAgent.match(/Firefox\/(.*)$/);
\r
676 if(version && version.length > 1){
\r
677 if(parseInt(version[1]) >= 50){
\r
678 nodeId = e.target.attributes[3].value;
\r
679 } else if(parseInt(version[1]) >= 45){
\r
681 nodeId = e.target.attributes[2].value;
\r
684 var thisNode = el.find('#jqTreeUserNotif').tree('getNodeById', nodeId);
\r
685 var isChecked = e.target.checked;
\r
686 scope.checkboxIdDict[nodeId]['is_box_checked'] = isChecked;
\r
688 thisNode = angular.element(thisNode);
\r
689 if (thisNode[0].hasOwnProperty('children') && thisNode[0].children.length > 0) {
\r
690 var jsNodeCheckList = angular.element(e.target).parent().next().find('.js-node-check')
\r
691 // check/uncheck children items
\r
692 jsNodeCheckList.prop('checked', isChecked);
\r
694 for (var i in jsNodeCheckList) {
\r
695 var singlediv = jsNodeCheckList[i];
\r
696 if (typeof singlediv == 'object' & (!singlediv.length)) {
\r
698 var tempNodeId = angular.element(singlediv)[0].attributes[4].value;
\r
702 if (sUsrAg.indexOf("Trident") > -1) {
\r
704 var tempNodeId = angular.element(singlediv)[0].attributes[5].value;
\r
709 // if (sUsrAg.indexOf("MSIE") > 0) {
\r
710 // var tempNodeId = angular.element(singlediv)[0].attributes[3].value;
\r
711 // alert('tempNodeId 2 FF 45 : '+tempNodeId);
\r
713 if(version && version.length > 1){
\r
714 if(parseInt(version[1]) >= 50){
\r
715 tempNodeId = angular.element(singlediv)[0].attributes[3].value;
\r
717 else if(parseInt(version[1]) >= 45){
\r
718 tempNodeId = angular.element(singlediv)[0].attributes[2].value;
\r
721 scope.checkboxIdDict[tempNodeId]['is_box_checked'] = isChecked;
\r
726 scope.checkBoxObj.isAnyRoleSelected = false;
\r
727 for (var key in scope.checkboxIdDict) {
\r
728 if (scope.checkboxIdDict[key]['is_box_checked']&&scope.checkboxIdDict[key]['role_id']) {
\r
729 scope.checkBoxObj.isAnyRoleSelected = true;
\r
737 scope.$watch('treedata', function (oldValue, newValue) {
\r
738 if (oldValue !== newValue) {
\r
739 $jqTree.tree('loadData', scope.treedata);
\r
740 $jqTree.tree('reload', function () {
\r