diff --git a/templates/css/theme.css b/templates/css/theme.css index cd4e0fc..ab99672 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -424,6 +424,7 @@ body.noscroll .messagesContent .msgSent { word-break: break-word; + padding-top: 2em; } .tabDesign @@ -445,7 +446,7 @@ body.noscroll background-color: aliceblue; overflow: scroll; overflow-y: visible; - height:250; + height:500; width:340; } .messagesContent @@ -453,10 +454,10 @@ body.noscroll padding-left: 4px; padding-right: 4px; margin: 5px; - background-color: #f5f5f5; - overflow: scroll; - height:250; - width:690; + /*background-color: #f5f5f5;*/ + /*overflow: scroll;*/ + height:500; + /*width:690;*/ } p.tasksFeed { diff --git a/templates/js/controllers/classController.js b/templates/js/controllers/classController.js index 397890a..5bf3304 100644 --- a/templates/js/controllers/classController.js +++ b/templates/js/controllers/classController.js @@ -73,7 +73,7 @@ angular.module('SeHub') jsonNewProj.logo_url = $scope.project.logoUrl; - apiService.create(token, jsonNewProj).success(function(data) + apiService.createProject(token, jsonNewProj).success(function(data) { loadingData = false; projectId = data.id; diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 9bcab36..ddd8125 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -6,27 +6,21 @@ angular.module('SeHub') $scope.msgToPost = ""; $scope.oldText = ""; $scope.messages = []; + $scope.messagesDisplay = []; + $scope.courses = []; + $scope.campuses = []; $scope.msg = {}; + $scope.courseObj = {}; + // $scope.course = ""; // should be "" ? // {} ?? $rootScope.seToken = $cookies['com.sehub.www']; var token = $rootScope.seToken; - var imagePath = $scope.user.avatar_url; - //var campusName = ''; - // $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 { @@ -40,31 +34,33 @@ angular.module('SeHub') } $scope.postMessageClicked = function() // Posting the message itself { - if($scope.msg.msgToAdd != null) + console.log($scope.courseObj); + if($scope.msg.msgToAdd != null && $scope.courseObj.courseName) { + console.log("NOW"); + jsonNewMsg = { - 'courseName': 'Math', // TODO Should be ===> $scope.course.courseName + 'groupId': $scope.courseObj.id, // TODO Should be ===> $scope.courseObj.id 'message': $scope.msg.msgToAdd }; - // console.log("J: " + jsonNewMsg.toString() + "msg: " + $scope.msg.msgToAdd); - - // apiService.createMessage(token, jsonNewMsg).success(function(data) - // { - // console.log("create Msg!"); - // }).error(function(err) - // { - // console.log("Error: " + err); - // }); - - /* - 'courseName': 'Advance Math', - 'message': 'The lecture today is canceled' - */ + apiService.createMessage(token, jsonNewMsg).success(function(data) + { + console.log("create Msg!"); + }).error(function(err) + { + console.log("Error Below"); + console.log(err); + }); console.log($scope.msg.msgToAdd); $scope.messages.push({"text": $scope.msg.msgToAdd}); } + else + { + $mdDialog.show($mdDialog.alert().title('Error Creating Message').content('Message content or Course is missing') + .ariaLabel('Send Message alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert + } $scope.msg.msgToAdd = null; } @@ -81,22 +77,54 @@ angular.module('SeHub') } - $scope.getCourses = function() + $scope.displayMessages = function() { - // apiService.getAllCoursesByCampus(token, campusId).success(function(data) // Shows all classes from this campus + // apiService.getMessagesByGroupId(token, $scope.courseObj.id).success(function(data) // { - // $scope.loadingData = false; - // $scope.courses = data; - // console.log("success " + $scope.courses); - // init(); // Executing the function to initialize course display - // if($scope.courses && $scope.courses.length > 0) - // { - // $scope.coursesEmpty = false; - // } + // $scope.messages = data; + // console.log($scope.messages); // }).error(function(err) // { - // console.log("error: " + err); - // }); + // console.log(err); + // }); + } + + + $scope.getCampuses = function() + { + apiService.getCampusesByUser(token).success(function(data) + { + $scope.campuses = data; + $scope.getCourses(); // Get all the courses info + if($scope.messages) + { + $scope.displayMessages(); // // Display all messages in message feed and the latest one + } + }).error(function(err) + { + console.log("Error: " + err); + }); + + } + + $scope.getCourses = function() + { + for(var i = 0; i < $scope.campuses.length; i++) + { + apiService.getAllCoursesByCampus(token, $scope.campuses[i].id).success(function(data) // Shows all classes from this campus + { + $scope.loadingData = false; + $scope.courses = data; + // console.log($scope.courses); + if($scope.courses && $scope.courses.length > 0) + { + $scope.coursesEmpty = false; + } + }).error(function(err) + { + console.log("Error: " + err); + }); + } } $scope.clearAllClicked = function() // Clear Screen from text @@ -106,16 +134,49 @@ angular.module('SeHub') $scope.chooseCourseClicked = function() { - console.log("choose course Clicked!!"); + // console.log($scope.courseObj); + if($scope.courseObj) + { + for(var i = 0; i < $scope.courses.length; i++) + { + if($scope.courses[i].courseName === $scope.courseObj.name) + { + $scope.courseObj = $scope.courses[i]; + } + } + } + console.log($scope.courseObj); } + // $scope.chooseCourseClicked = function() + // { + // console.log("Click "); + // console.log($scope.choosenCourse); + // if($scope.choosenCourse) + // { + // console.log("here"); + // $scope.courseObj = null; + // for(var i = 0; i < $scope.courses.length; i++) + // { + // if($scope.courses[i].courseName === $scope.choosenCourse) + // { + // $scope.courseObj = $scope.courses[i]; + // console.log($scope.courseObj); + // } + // } + // } + // } + $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); } + + $scope.getCampuses(); // Get all the campuses info // animation + + // $scope.displayTasks(); // Display all tasks in task feed and the latest one $scope.isEnterd = top.setIsEnterd; - $scope.getCourses(); // Get all the courses info - $scope.displayTasks(); // Display all tasks in task feed + }]); \ No newline at end of file diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index a131673..8b8503e 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -1,5 +1,6 @@ angular.module('SeHub') - .controller('registerController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { + .controller('registerController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', + function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { $scope.userHasNoName = false; $scope.campusChecked = false; $scope.createCampusClicked = false; @@ -37,7 +38,7 @@ angular.module('SeHub') $scope.dropdownClicked = function() { $scope.createCampusClicked = false; - if ($scope.campus) { + if($scope.campus) { $scope.campusChecked = true; $scope.campusObj = null; for (var i = $scope.campuses.length - 1; i >= 0; i--) { @@ -47,7 +48,6 @@ angular.module('SeHub') } }; }; - }; $scope.submitClicked = function(ev) { @@ -55,12 +55,8 @@ angular.module('SeHub') if ($scope.user.AcMail != null) { var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user - apiService.updateUser(token, $scope.user).success(function(data) { - }).error(function() { - // TODO Error - console.log("Error occured on updateUser"); }); console.log("Mail: " + fullMail); @@ -74,7 +70,6 @@ angular.module('SeHub') .ok('Got it!') .targetEvent(ev)) .then(function() { - // TODO ADD- delete cookies and redirect only after pressed 'Got it' $cookieStore.remove("com.sehub.www"); // Removing the cookies $window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page @@ -115,7 +110,6 @@ angular.module('SeHub') console.log("DONE - 200"); $mdDialog.show($mdDialog.alert().title('E-mail Verification').content('A verification e-mail has been sent to your email address.') .ariaLabel('Email verification alert dialog').ok('Got it!').targetEvent(email)); // Pop-up alert for e-mail verification - // TODO ADD delete cookies and redirect only after pressed 'Got it' $cookieStore.remove("com.sehub.www"); // Removing the cookies $window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page }).error(function() { diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 81d9e7a..7da3ab1 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -53,8 +53,8 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getAllMessages: function(token){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAllMessages/" + token; + getMessagesByGroupId: function(token, groupId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/messages/getMessagesByGroup/" + token + "/" + groupId; req = { method : "GET", url : url @@ -134,7 +134,7 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - create: function(token, payLoad){ // createProject + createProject: function(token, payLoad){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/create/" + token; req = { method : "POST", @@ -143,15 +143,6 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - createMessage: function(token, payLoad){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/createMessage/" + token; - req = { - method : "POST", - url : url, - data: payLoad - }; - return $http(req); - }, sendValidationMail: function(token, email){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/validation/sendmail/" + token; payload = { diff --git a/templates/views/home.html b/templates/views/home.html index 0737ca4..ebc3f1f 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -1,8 +1,8 @@ -
Tasks
-Task Name | Date | Grade |
---|