2015-05-06 04:06:13 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {angular.Module}
|
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
2015-07-28 17:54:49 +02:00
|
|
|
navController.$inject = ['$scope', '$timeout', '$interval', '$http', '$mdSidenav', '$mdBottomSheet', '$mdMedia', '$log', 'sgConstant', 'sgSettings', 'Alarm'];
|
|
|
|
function navController($scope, $timeout, $interval, $http, $mdSidenav, $mdBottomSheet, $mdMedia, $log, sgConstant, sgSettings, Alarm) {
|
2015-07-14 22:12:07 +02:00
|
|
|
|
2015-09-04 23:31:16 +02:00
|
|
|
$scope.isPopup = sgSettings.isPopup;
|
2015-08-03 17:53:54 +02:00
|
|
|
$scope.activeUser = sgSettings.activeUser();
|
2015-08-14 18:14:15 +02:00
|
|
|
$scope.baseURL = sgSettings.baseURL();
|
2015-05-06 04:06:13 +02:00
|
|
|
|
|
|
|
// Show current day in top bar
|
|
|
|
$scope.currentDay = window.currentDay;
|
|
|
|
$timeout(function() {
|
|
|
|
// Update date when day ends
|
|
|
|
$interval(function() {
|
|
|
|
$http.get('../date').success(function(data) {
|
|
|
|
$scope.currentDay = data;
|
|
|
|
});
|
|
|
|
}, 24 * 3600 * 1000);
|
2015-08-03 17:53:54 +02:00
|
|
|
}, window.currentDay.secondsBeforeTomorrow * 1000);
|
2015-05-06 04:06:13 +02:00
|
|
|
|
|
|
|
$scope.toggleLeft = function () {
|
|
|
|
$mdSidenav('left').toggle()
|
|
|
|
.then(function () {
|
|
|
|
$log.debug("toggle left is done");
|
|
|
|
});
|
|
|
|
};
|
|
|
|
$scope.toggleRight = function () {
|
|
|
|
$mdSidenav('right').toggle()
|
|
|
|
.then(function () {
|
|
|
|
$log.debug("toggle RIGHT is done");
|
|
|
|
});
|
|
|
|
};
|
2015-09-03 16:27:11 +02:00
|
|
|
// $scope.openBottomSheet = function() {
|
|
|
|
// $mdBottomSheet.show({
|
|
|
|
// parent: angular.element(document.getElementById('left-sidenav')),
|
|
|
|
// templateUrl: 'bottomSheetTemplate.html'
|
|
|
|
// });
|
|
|
|
// };
|
2015-11-25 17:12:30 +01:00
|
|
|
// $scope.toggleDetailView = function() {
|
|
|
|
// var detail = angular.element(document.getElementById('detailView'));
|
|
|
|
// detail.toggleClass('sg-close');
|
|
|
|
// };
|
2015-05-06 04:06:13 +02:00
|
|
|
$scope.$watch(function() {
|
|
|
|
return $mdMedia(sgConstant['gt-md']);
|
|
|
|
}, function(newVal) {
|
|
|
|
$scope.isGtMedium = newVal;
|
|
|
|
});
|
2015-07-28 17:54:49 +02:00
|
|
|
|
|
|
|
Alarm.getAlarms();
|
2015-05-06 04:06:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
angular.module('SOGo.Common')
|
|
|
|
.controller('navController', navController);
|
|
|
|
})();
|