diff --git a/templates/js/app.js b/templates/js/app.js index 9fb2986..1ab2ed6 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -57,6 +57,10 @@ app.config(['$routeProvider', '$locationProvider', .when('/projects', { templateUrl: 'templates/views/projects.html', controller: 'projectsController' + }) + .when('/newCourse', { + templateUrl: 'templates/views/newCourse.html', + controller: 'newCourseController' }); } ]); diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 9a13dbb..58c7c10 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -6,17 +6,28 @@ angular.module('SeHub') $scope.msgToPost = ""; $scope.oldText = ""; $scope.messages = []; + $scope.msg = {}; + + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; var imagePath = $scope.user.avatar_url; + //var campusName = ''; + $scope.course = ''; + // $scope.campusName = ''; + $scope.phones = [ { type: 'Home', number: '(972) 865-82861' }, { type: 'Cell', number: '(972) 5251-32309' }, ]; + + if($scope.user.isLecturer) { $scope.isStudent = false; console.log("Lecturer Mode!"); + // console.log($scope.campusName); } else { @@ -24,12 +35,20 @@ angular.module('SeHub') console.log("Student Mode!"); } + // apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data) + // { + // console.log("Campus Name is ON! " + $scope.user.classes_id_list[0]) + // $scope.course = data; + // }).error(function() + // { + // console.log("Error on ===> getCourseByCampusName") + // }); + + $scope.addMessageClicked = function() { $scope.addMsg = true; // Reveal the "POST" Button } - - $scope.msg = {}; $scope.postMessageClicked = function() // Posting the message itself { if($scope.msg.msgToAdd != null) @@ -48,14 +67,11 @@ angular.module('SeHub') $scope.chooseCourseClicked = function() { console.log("choose course Clicked!!"); - - } $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); - } diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js new file mode 100644 index 0000000..8ca5128 --- /dev/null +++ b/templates/js/controllers/myClassesController.js @@ -0,0 +1,60 @@ +angular.module('SeHub') +.controller('myClassesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + $scope.isStudent = false; + $scope.isCourse = false; + $scope.isNewCourse = false; + $scope.newClassName = false; + $scope.user.createNewCourse = ''; + $scope.user.finalDate = ''; + $scope.showMyClass = false; + + if($scope.user.isLecturer) + { + $scope.isStudent = false; + console.log("Lecturer Mode!"); + } + else + { + $scope.isStudent = true; + console.log("Student Mode!"); + } + + + $scope.chooseCourseClicked = function() + { + $scope.isCourse = true; + console.log("choose course Clicked!!"); + } + + $scope.createCourseClicked = function() + { + $scope.isNewCourse = true; + console.log("create course Clicked!!"); + } + + $scope.showMyCourses = function() + { + $scope.showMyClass = true; + } + + $scope.submitNewClassClicked = function() + { + if($scope.user.createNewCourse != '' && $scope.user.finalDate != '') + { + console.log("finalDate " + $scope.user.finalDate); + console.log($scope.user.createNewCourse); + $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') + .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()); + // $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO + } + else + { + $mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('You have encountered and error in creating the course.') + .ariaLabel('Email verification alert dialog').ok('Try Again!').targetEvent()); + } + } + + + +}]); \ No newline at end of file diff --git a/templates/js/controllers/newCourseController.js b/templates/js/controllers/newCourseController.js new file mode 100644 index 0000000..f66f396 --- /dev/null +++ b/templates/js/controllers/newCourseController.js @@ -0,0 +1,10 @@ +angular.module('SeHub') +.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + + $scope.goBack = function() + { + $window.location.href = 'templates/views/myClasses.html'; + } + +}]); \ No newline at end of file diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js new file mode 100644 index 0000000..f074dc3 --- /dev/null +++ b/templates/js/controllers/projectsController.js @@ -0,0 +1,16 @@ +angular.module('SeHub') +.controller('projectsContoller', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + console.log("in projects controller"); + + $scope.createProjectClicked = function() + { + console.log("project created! not rly!! "); + // $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page + + } + + + + +}]); \ No newline at end of file diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 6ce4d08..279fddd 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -26,7 +26,7 @@ angular.module('SeHub') if($scope.user.name === ";") { $scope.user.name = ""; - $scope.user.name = $scope.user.username + $scope.user.name = $scope.user.username; $scope.userHasNoName = true; } diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js new file mode 100644 index 0000000..416dc63 --- /dev/null +++ b/templates/js/controllers/tasksController.js @@ -0,0 +1,17 @@ +angular.module('SeHub') +.controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + console.log("in controller"); + + $scope.createTaskClicked = function(name) + { + var taskName = name; + console.log("task created! " + taskName); + $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page + + } + + + + +}]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 276fa04..d6d1a03 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -1,3 +1,4 @@ + var DEBUG = true; var service = angular.module('seHub.services', []); @@ -42,6 +43,16 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getCourseByCampusName: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; + req = { + method : "GET", + url : url, + data: token + + }; + return $http(req); + }, getAllCourses: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; req = { diff --git a/templates/views/home.html b/templates/views/home.html index 8f8902f..39db020 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -88,8 +88,10 @@ -