Skip to content
Permalink
0f924d8336
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
73 lines (67 sloc) 2.59 KB
angular.module('routerApp').controller('homeController', function($scope, $http,urlService,$q,$state,$cookies,$rootScope) {
/* BEGIN FUNCTIONS FUNCTIONS */
$scope.authenticateAdmin = function(id,pass){
return $q(function(resolve,reject){
var param = id + " " + pass;
var promise = $http.post(url + "/authenticateAdmin",param)
.success(function(data) {
if (data.STATUS == 555) {
$scope.authenticated = false;
resolve('We did it');
} else {
$scope.authenticated = true;
resolve('We did it');
}
})
.error(function(data, status, headers, config) {
$scope.messages = 'There was a network error. Try again later.';
reject('We did not do it');
});
})
}
$scope.toAdminPage = function (user) {
//$cookies.put('LOGIN','ADMIN ' + $cookies.get('DEPID') + ' ' + $cookies.get('PWD') )
//var promise = $scope.authenticateAdmin(user.username,user.password);
//promise.then(function(){
// if($scope.authenticated == true){
// $cookies.put('ADMIN',user.username);
//$cookies.put('PWD',user.password);
// $scope.messages = null;
$state.go('admin-home');
//}
// else if ($scope.authenticated == false){
// $scope.messages = 'Incorrect Login Information.';
// }
// });
}
$scope.toUserPage = function (user) {
//$cookies.put('LOGIN','ADMIN ' + $cookies.get('DEPID') + ' ' + $cookies.get('PWD') )
//var promise = $scope.authenticateAdmin(user.username,user.password);
//promise.then(function(){
// if($scope.authenticated == true){
// $cookies.put('ADMIN',user.username);
//$cookies.put('PWD',user.password);
// $scope.messages = null;
$state.go('user-home');
//}
// else if ($scope.authenticated == false){
// $scope.messages = 'Incorrect Login Information.';
// }
// });
}
/* BEGIN LOGIC */
var url = urlService.web;
$scope.myInterval = 5000;
$scope.noWrapSlides = false;
var slides = $scope.slides = [{image: '../../images/C1.JPG', text: 'Hello'},{image: '../../images/C2.JPG', text: 'Hello'},{image: '../../images/C3.JPG', text: 'Hello'},
{image: '../../images/C4.JPG', text: 'Hello'},{image: '../../images/C5.JPG', text: 'Hello'}];
$scope.addSlide = function() {
var newWidth = 600 + slides.length + 1;
slides.push({
image: '//placekitten.com/' + newWidth + '/300',
text: ['More','Extra','Lots of','Surplus'][slides.length % 4] + ' ' +
['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
});
};
/* END LOGIC */
});