Merge branch 'master' of https://github.com/sagidayan/SE-Hub into API_Dev

This commit is contained in:
Aran Zaiger 2015-06-28 17:18:51 +03:00
commit ec1eacb3cd
31 changed files with 1296 additions and 533 deletions

View file

@ -139,12 +139,12 @@ def send_activation(token):
return Response(status=200)
@app.route('/api/help')
def documentation():
def documentation_index():
return app.send_static_file('API_Doc/api_doc_index.html')
# @app.route('/api/help/campuses')
# def documentation():
# return auto.html()
@app.route('/api/help/misc')
def documentation_misc():
return auto.html()
@app.route('/home')
def returnHome():

View file

@ -192,7 +192,65 @@ def getCampusesByUser(token):
return bad_request("Bad user Token")
arr = []
for i in user['campuses_id_list']:
for i in user.campuses_id_list:
campus = Campus.get_by_id(int(i))
arr.append(dict(json.loads(campus.to_JSON())))
if len(arr) != 0:
return Response(response=json.dumps(arr),
status=200,
mimetype="application/json")
else:
return Response(response=[],
status=200,
mimetype="application/json")
@campus_routes.route('/api/campuses/getCampusesByUserID/', defaults={'token': None, 'id': None})
@campus_routes.route('/api/campuses/getCampusesByUserID/<string:token>/<string:id>', methods=['GET'])
@auto.doc()
def getCampusesByUserID(token, id):
"""
<span class="card-title">This Call will return an array of all Campuses of a certain User By ID</span>
<br>
<b>Route Parameters</b><br>
- token: 'seToken' of requesting user
- The ID of <b>Wanted</b> User Campuses
<br>
<br>
<b>Payload</b><br>
- NONE <br>
<br>
<br>
<b>Response</b>
<br>
200 - JSON Array, Example:<br>
[<br>
{
'title': 'JCE',<br>
'email_ending': '@post.jce.ac.il',<br>
'master_user_id': 123453433341, (User that created the campus)<br>
'avatar_url': 'http://some.domain.com/imagefile.jpg',<br>
'id' : 1234567890<br>
},<br>
....<br>
{<br>
...<br>
}req<br>
]<br>
<br>
403 - Invalid Token<br>
"""
user = get_user_by_token(token)
if user is None:
return forbidden("Invalid Token")
user = get_user_by_id(int(id))
if user is None:
return no_content("No User")
arr = []
for i in user.campuses_id_list:
campus = Campus.get_by_id(int(i))
arr.append(dict(json.loads(campus.to_JSON())))

View file

@ -259,7 +259,7 @@ def getCampusesByUser(token, campusId):
arr = []
for i in user['courses_id_list']:
for i in user.courses_id_list:
course = Course.get_by_id(int(i))
if course.campusId == campus.key().id():
arr.append(dict(json.loads(course.to_JSON())))
@ -269,7 +269,7 @@ def getCampusesByUser(token, campusId):
status=200,
mimetype="application/json")
else:
return Response(response=[],
return Response(response='[]',
status=200,
mimetype="application/json")

View file

@ -269,6 +269,66 @@ def getUserByToken(token):
status=200,
mimetype="application/json") # Real response!
return no_content("No User Found")
@user_routes.route('/api/users/getUserById/', defaults={'token': None, 'id': None})
@user_routes.route('/api/users/getUserById/<string:token>/<string:id>', methods=["GET"])
@auto.doc()
def getUserById(token, id):
"""
<span class="card-title">>This Call will return a user by a given UserId</span>
<br>
<b>Route Parameters</b><br>
- seToken: 'seToken'
<br>
<br>
<b>Payload</b><br>
- NONE
<br>
<br>
<b>Response</b>
<br>
200 - JSON Example:<br>
<code>
{<br>
'username': 'DarkLord',<br>
'name': 'Darth Vader',<br>
'email': 'darkLord@death.planet,<br>
'isLecturer': 'True',<br>
'seToken': 'xxxxxx-xxxxx-xxxxx-xxxxxx',<br>
'avatar_url': 'http://location.git.com/somthing'<br>
'isFirstLogin': False,<br>
'campuses_id_list': [{<br>
'master_user_id': 111,<br>
'id': 5629499534213120,<br>
'email_ending': "@post.jce.ac.il",<br>
'avatar_url': "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg",<br>
'title': "JCE"
}],<br>
'courses_id_list': ['a','b','c'],<br>
'id': 234253523<br>
}<br>
</code>
<br>
403 - No User Found
"""
if token is None or id is None:
return no_content("No Token/ID, No User Found")
if get_user_by_token(token) is None:
return forbidden('Invalid Token')
u = get_user_by_id(int(id))
if u is None:
return no_content('No user Found')
for index, c in enumerate(u.campuses_id_list):
c = json.loads(Campus.get_by_id(int(c)).to_JSON())
u.campuses_id_list[index] = c
return Response(response=u.to_JSON(),
status=200,
mimetype="application/json") # Real response!
return no_content("No User Found")

View file

@ -13,6 +13,10 @@ def get_user_by_token(token):
return u
return None
def get_user_by_id(id):
u = User.get_by_id(id)
return u
def get_campus_by_campusName(campusName):
query = Campus.all()
query.filter("title = ", campusName)

View file

@ -27,6 +27,7 @@ class User(db.Model):
'campusName': self.campusName,
'campuses_id_list': self.campuses_id_list,
'courses_id_list': self.courses_id_list,
'projects_id_list': self.projects_id_list
'projects_id_list': self.projects_id_list,
'id' : self.key().id()
}
return json.dumps(data)

View file

@ -54,8 +54,8 @@
SE-Hub Docs Index
</h1>
<div>
<center>
<div style="width: 40%">
<ul class="collection">
<li class="collection-item dismissable"><div>Users Related API<a href="/api/users/help" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
<li class="collection-item dismissable"><div>Campuses Related API<a href="/api/campuses/help" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
@ -64,9 +64,10 @@
<li class="collection-item dismissable"><div>Tasks Related API<a href="/api/tasks/help" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
<li class="collection-item dismissable"><div>Messages Related API<a href="/api/messages/help" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
<li class="collection-item dismissable"><div>Validation Related API<a href="#!" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
<li class="collection-item dismissable"><div>Miscellaneous Methods<a href="/api/help/misc" class="secondary-content"><i class="mdi-content-send"></i></a></div></li>
</ul>
</div>
</center>
<footer class="page-footer">
<div class="container">
<div class="row">

View file

@ -151,6 +151,38 @@ body.noscroll
/*width: 100%;*/
}
/*.hvr-curl-top-left {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
}*/
/* Grow Rotate */
/*.campusCard {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: transform;
transition-property: transform;
}*/
.campusCard:hover, .campusCard:focus, .campusCard:active {
-webkit-transform: rotate(4deg);
transform: rotate(4deg);
}
/*.feedMessages
{
overflow: scroll;
@ -197,6 +229,18 @@ body.noscroll
border-radius: 1px black solid;
}*/
.allCampusesShow
{
overflow:hidden;
background-size: auto;
}
.campusCard
{
/*height:80%;*/
/*width:80%;*/
}
.gray-font
{
color: #7f7f7f;
@ -397,6 +441,11 @@ body.noscroll
border-color: solid red;
}
.cardAllCampuses
{
word-break: break-word;
}
.addMessage
{
font-size: 2em;

View file

@ -38,15 +38,15 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/home.html',
controller: 'homeController'
})
.when('/Settings', {
templateUrl: 'templates/views/settings.html',
controller: 'settingsController'
.when('/profile/:id', {
templateUrl: 'templates/views/profile.html',
controller: 'profileController'
})
.when('/tasks', {
templateUrl: 'templates/views/tasks.html',
controller: 'tasksController'
})
.when('/myClasses', {
.when('/myClasses/:campusId', {
templateUrl: 'templates/views/myClasses.html',
controller: 'myClassesController'
})
@ -54,13 +54,21 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/newTask.html',
controller: 'newTasksController'
})
.when('/projects', {
.when('/projects/:classId', {
templateUrl: 'templates/views/projects.html',
controller: 'projectsController'
})
.when('/newCourse', {
templateUrl: 'templates/views/newCourse.html',
controller: 'newCourseController'
})
.when('/campuses', {
templateUrl: 'templates/views/campuses.html',
controller: 'campusesController'
})
.when('/myProjects', {
templateUrl: 'templates/views/myProjects.html',
controller: 'thisProjectController'
});
}
]);

View file

@ -0,0 +1,58 @@
angular.module('SeHub')
.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope)
{
$scope.threeSizedArray =[];
$scope.campusesEmpty = false;
var token = $cookies['com.sehub.www'];
var init = function()
{
$scope.threeSizedArray = [];
var tempArr = [];
var sizeOfSmallArrays = 3;
for (var i = 0 ; i < $scope.campuses.length ; i++) {
if(i % sizeOfSmallArrays !== 0){
tempArr.push($scope.campuses[i]);
}else{
if(i !== 0){
$scope.threeSizedArray.push(tempArr);
tempArr = [];
tempArr.push($scope.campuses[i]);
}else{
tempArr.push($scope.campuses[i]);
}
}
};
$scope.threeSizedArray.push(tempArr);
console.log($scope.threeSizedArray); // TODO REMOVE
}
$scope.goToCampus = function(campusId) // Will pass you to courses by specific campus
{
$location.path('/myClasses/' + campusId.toString());
}
$scope.displayCampuses = function()
{
apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
console.log("INSIDE " + $scope.campuses);
init(); // Executing the function to initialize campuses display
}).error(function()
{
// TODO
});
if($scope.campuses != null)
{
$scope.campusesEmpty = true;
}
}
$scope.displayCampuses(); // Displaying all campuses by user
}]);

View file

@ -13,7 +13,6 @@ angular.module('SeHub')
var imagePath = $scope.user.avatar_url;
//var campusName = '';
$scope.course = '';
// $scope.campusName = '';
$scope.phones = [
@ -35,13 +34,13 @@ angular.module('SeHub')
console.log("Student Mode!");
}
// apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data)
// apiService.getCourseByCampusName(token).success(function(data)
// {
// console.log("Campus Name is ON! " + $scope.user.classes_id_list[0])
// console.log("Campus Name is ON! " + token)
// $scope.course = data;
// }).error(function()
// }).error(function(err)
// {
// console.log("Error on ===> getCourseByCampusName")
// console.log("Error ===> " + err + " ===> getCourseByCampusName")
// });
@ -51,8 +50,30 @@ angular.module('SeHub')
}
$scope.postMessageClicked = function() // Posting the message itself
{
if($scope.msg.msgToAdd != null)
{
jsonNewMsg = {
'courseName': 'A', // TODO Should be ===> $scope.course.courseName
'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'
*/
console.log($scope.msg.msgToAdd);
$scope.messages.push({"text": $scope.msg.msgToAdd});
}

View file

@ -1,5 +1,7 @@
angular.module('SeHub')
.controller('mainController', ['$scope', '$rootScope', 'dataService','apiService', '$cookies', '$cookieStore', '$location', '$window',
.controller('mainController',
['$scope', '$rootScope', 'dataService', 'apiService', '$cookies',
'$cookieStore', '$location', '$window',
function($scope, $rootScope, dataService, apiService, $cookies, $cookieStore, $location, $window) {
top.setIsEnterd = true;
@ -14,6 +16,39 @@ angular.module('SeHub')
}
$scope.loadingData = false;
$scope.user = data;
$scope.menuItems = [{
"title": "Dash Board",
"icon": "fa fa-tachometer",
"style": "selected",
"route": "/home"
}, {
"title": "Explore",
"icon": "fa fa-compass",
"style": "",
"route": "/campuses"
}, {
"title": "My Projects",
"icon": "fa fa-cube",
"style": "",
"route": "/myProjects"
}, {
"title": "Tasks",
"icon": "fa fa-clipboard",
"style": "",
"route": "/tasks"
}, {
"title": "Profile",
"icon": "fa fa-cogs",
"style": "",
"route": "/profile/" + $scope.user.id.toString()
}, {
"title": "Log Out",
"icon": "fa fa-power-off",
"style": "",
"route": "/logout"
}];
dataService.initService($scope); //Start Data Sync Service (For User)
console.log(data);
if ($scope.user.isFirstLogin) {
@ -27,44 +62,7 @@ angular.module('SeHub')
});
$scope.menuItems = [{
"title": "Dash Board",
"icon": "fa fa-tachometer",
"style": "selected",
"route": "/home"
}, {
"title": "My Campuses",
"icon": "fa fa-university",
"style": "",
"route": "/campuses"
}, {
"title": "My Classes",
"icon": "fa fa-graduation-cap",
"style": "",
"route": "/myClasses"
}, {
"title": "My Projects",
"icon": "fa fa-cube",
"style": "",
"route": "/projects"
}, {
"title": "Tasks",
"icon": "fa fa-clipboard",
"style": "",
"route": "/tasks"
}, {
"title": "Settings",
"icon": "fa fa-cogs",
"style": "",
"route": "/Settings"
}, {
"title": "Log Out",
"icon": "fa fa-power-off",
"style": "",
"route": "/logout"
}];
$scope.menuClicked = function(item) {
var route = ""

View file

@ -1,14 +1,141 @@
angular.module('SeHub')
.controller('myClassesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
.controller('myClassesController', ['$scope', '$location', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope',
function ($scope, $location, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
$scope.isStudent = false;
$scope.isCourse = false;
$scope.isNewCourse = false;
$scope.newClassName = false;
$scope.user.createNewCourse = '';
$scope.course = {};
var token = $cookies['com.sehub.www'];
$scope.user.finalDate = '';
$scope.user.startDate = '';
$scope.showMyClass = false;
$scope.coursesEmpty = false;
var campusId = $routeParams.campusId;
var displayCourses = function()
{
apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display
{
$scope.courses = data;
console.log("success " + $scope.courses);
init(); // Executing the function to initialize course display
}).error(function(err)
{
console.log("error: " + err);
});
if($scope.courses = null)
{
$scope.coursesEmpty = true;
}
}
$scope.goToClass = function(classId)
{
console.log("Done! " + $scope.courses);
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course
}
$scope.chooseCourseClicked = function()
{
$scope.isCourse = true;
console.log("choose course Clicked!!");
apiService.getAllCampuses(token).success(function(data)
{
$scope.campuses = data;
console.log("Campuses: " + $scope.campuses.toString());
}).error(function(err)
{
console.log("Error: " + err);
});
}
$scope.createCourseClicked = function()
{
$scope.isNewCourse = !$scope.isNewCourse;
}
$scope.submitNewClassClicked = function()
{
if($scope.course.courseName != null && $scope.course.endDate != null && $scope.course.startDate != null)
{
var jsonNewCourse =
{
'courseName': $scope.course.courseName,
'campusName': $scope.course.campusName,
'startDate': {
'year' : $scope.course.startDate.getFullYear(),
'day' : $scope.course.startDate.getDate(),
'month': $scope.course.startDate.getMonth() + 1
},
'endDate': {
'year' : $scope.course.endDate.getFullYear(),
'day' : $scope.course.endDate.getDate(),
'month': $scope.course.endDate.getMonth() + 1
}
};
console.log("Json here: " + $scope.chosenCampus);
console.log(jsonNewCourse);
apiService.createCourse(token, jsonNewCourse).success(function(data)
{
console.log("createCourse API done");
$mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.')
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() {
$location.path('/newCourse'); // TODO TODO TODO
}); // Pop-up alert
}).error(function(err)
{
console.log(err);
});
}
else
{
$mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('Some fields are missing.')
.ariaLabel('Email verification alert dialog').ok('Try Again!').targetEvent());
}
}
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.courses.length % 3) === 0)
{
newLength = ($scope.courses.length / 3);
}
else
{
newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up
}
console.log("length: " + newLength);
$scope.holdArrays.length = newLength;
for(j = 0; j < newLength; j++)
{
$scope.holdArrays[j] = [3]; // Creating array in size of 3 in each array cell
}
for(i = 0; i < newLength; i++)
{
for(j = 0; j < newLength; j++)
{
if($scope.courses[(3*i) + j] != null)
{
$scope.holdArrays[i][j] = $scope.courses[(3*i) + j];
}
}
}
console.log($scope.holdArrays);
}
if($scope.user.isLecturer)
{
$scope.isStudent = false;
@ -20,42 +147,7 @@ angular.module('SeHub')
console.log("Student Mode!");
}
$scope.chooseCourseClicked = function()
{
$scope.isCourse = true;
console.log("choose course Clicked!!");
}
$scope.createCourseClicked = function()
{
$scope.isNewCourse = true;
$scope.showMyClass = false;
console.log("create course Clicked!!");
}
$scope.showMyCourses = function()
{
$scope.showMyClass = true;
$scope.isNewCourse = false;
}
$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());
}
}
displayCourses(); // Will display the courses that the user related to // TODO!!

View file

@ -0,0 +1,81 @@
angular.module('SeHub')
.controller('thisProjectController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
$scope.isEditPressed = false;
$scope.myProjectsEmpty = false;
var token = $cookies['com.sehub.www'];
$scope.displayMyProjects = function()
{
apiService.getProjectsByUser(token).success(function(data)
{
console.log("Success " + data);
$scope.myProjects = data;
}).error(function(err)
{
console.log("Error: " + err);
});
if($scope.myProjects === null)
{
myProjectsEmpty = true;
}
}
$scope.goToMyProject = function()
{
console.log("projects only from classID: " + classId)
$location.path('/thisProject' + classId);
}
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.projects.length % 3) === 0)
{
newLength = ($scope.projects.length / 3);
}
else
{
newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up
}
console.log("length: " + newLength);
$scope.arrayHolder.length = newLength;
for(j = 0; j < newLength; j++)
{
$scope.arrayHolder[j] = [3]; // Creating array in size of 3 in each array cell
}
for(i = 0; i < newLength; i++)
{
for(j = 0; j < newLength; j++)
{
if($scope.projects[(3*i) + j] != null)
{
$scope.arrayHolder[i][j] = $scope.projects[(3*i) + j];
}
}
}
console.log($scope.arrayHolder);
}
$scope.editPressed = function()
{
$scope.isEditPressed = true;
console.log("EditPressed " + $scope.isEditPressed);
}
$scope.removeProject = function()
{
console.log("Project has been removed!");
}
$scope.displayMyProjects(); // Will display all my projects
}]);

View file

@ -1,10 +1,9 @@
angular.module('SeHub')
.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
.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';
$location.path('/myClasses');
}
}]);

View file

@ -1,6 +1,8 @@
angular.module('SeHub').controller('newTasksController', ['$scope',
function($scope) {
$scope.newComp = {};
$scope.newComp.isMandatory = false;
$scope.componentTypes = [{
@ -9,25 +11,105 @@ angular.module('SeHub').controller('newTasksController', ['$scope',
"type": "textarea"
}, {
"type": "checkbox"
}, {
"type": "link"
}, {
"type": "radiobuttons"
}];
$scope.task = {};
$scope.task.task = {};
$scope.task.components= [];
$scope.task.isPersonal = false;
$scope.task.components = [];
$scope.task.isPersonal = false;
// $scope.task = [];
$scope.addComponent = function() {
$scope.task.components.push($scope.newComp);
var comp = {};
var type = $scope.newComp.type;
comp.type = type;
comp.isMandatory = $scope.newComp.isMandatory;
comp.label = "";
var i = 0
if (!(type === 'textbox' || type === 'textarea' || type === 'checkbox'))
while ($scope.newComp.label[i]) {
comp.label += $scope.newComp.label[i] + "|";
i++;
} else
comp.label = $scope.newComp.label[i];
console.log(comp);
$scope.task.components.push(comp);
// console.log($scope.newComp);
$scope.newComp = {};
$scope.newComp.isMandatory = false;
$scope.compDetails = [];
$scope.isRadioButton = false;
}
$scope.dueTime = function(){
if(!$scope.task.date || $scope.task.date === '')
$scope.dueTimeFromNow = "";
var d = new Date($scope.task.date);
$scope.dueTimeFromNow = moment(d).fromNow();
$scope.ComponentType = function(type) {
if (type === 'textbox' || type === 'textarea' || type === 'checkbox')
$scope.compDetails = [{
detail: "Label"
}];
else if (type === 'radiobuttons') {
$scope.compDetails = [{
detail: "Label"
}];
$scope.compDetails.push({
detail: "Option" + $scope.compDetails.length + ": "
});
} else if (type === 'link')
$scope.compDetails = [{
detail: "Label"
}, {
detail: "URL Path"
}];
if (type === 'radiobuttons')
$scope.isRadioButton = true;
else
$scope.isRadioButton = false;
}
$scope.addMoreOptions = function() {
$scope.compDetails.push({
detail: "Option" + $scope.compDetails.length + ": "
});
}
$scope.dueTime = function() {
if (!$scope.task.date || $scope.task.date === '')
$scope.dueTimeFromNow = "";
var d = new Date($scope.task.date);
$scope.dueTimeFromNow = moment(d).fromNow();
}
$scope.initLinkComp = function(component){
var arr = component.label.split("|");
for (var i = 0; i < arr.length - 1; i++) {
if(i == 0)
component.title = arr[i];
else
component.href = arr[i];
};
}
$scope.initRadioButtonsComp = function(component){
var arr = component.label.split("|");
component.values = [];
for (var i = 0; i < arr.length - 1; i++) {
if(i == 0)
component.title = arr[i];
else
component.values.push({text: arr[i], id: i});
};
}
$scope.RB = function(comp){
console.info(comp);
}
}
]);

View file

@ -1,30 +1,33 @@
angular.module('SeHub')
.controller('settingsController', ['$scope', '$rootScope', 'dataService', 'apiService', '$cookies', '$location',
function($scope, $rootScope, dataService, apiService, $cookies, $location) {
.controller('profileController', ['$scope', '$rootScope', 'dataService', 'apiService',
'$cookies', '$location', '$routeParams',
function($scope, $rootScope, dataService, apiService, $cookies, $location, $routeParams) {
var token = $cookies['com.sehub.www'];
var id = $routeParams.id;
$scope.loadingData = true;
$scope.isInRegisterMode = false;
$scope.title = "Settings"
$scope.title = "Profile";
apiService.getUserByToken(token).success(function(data) {
apiService.getUserById(token, id).success(function(data) {
if (data.message == 'No User Found') {
console.error("No User Found!");
}
$scope.loadingData = false;
$scope.user = data;
console.log(data);
if ($scope.user.isFirstLogin) {
$scope.menuObj = {};
$scope.isInRegisterMode = true;
apiService.getCampusesByUserId(token, id).success(function(data) {
$scope.campuses = data;
console.log(data);
$scope.loadingData = false;
$location.path('/register')
}
}).error(function(err) {
console.error(err);
});
});
$scope.isEditMode = false;
$scope.profileMode = "Edit Profile";
$scope.profileModeIcon = "fa fa-pencil";
@ -67,17 +70,17 @@ angular.module('SeHub')
"campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg"
}];
$scope.campuses = [{
'title': 'JCE',
'email_ending': '@post.jce.ac.il',
'master_user_id': 123453433341,
'avatar_url': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg'
}, {
'title': 'Stanford',
'email_ending': '@post.jce.ac.il',
'master_user_id': 123453433341,
'avatar_url': 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR9M4uQgaJP1zyiCGw-dK31hU8buWqeuOi9vTXBd4Y8hQcFTZqA'
}];
// $scope.campuses = [{
// 'title': 'JCE',
// 'email_ending': '@post.jce.ac.il',
// 'master_user_id': 123453433341,
// 'avatar_url': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg'
// }, {
// 'title': 'Stanford',
// 'email_ending': '@post.jce.ac.il',
// 'master_user_id': 123453433341,
// 'avatar_url': 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR9M4uQgaJP1zyiCGw-dK31hU8buWqeuOi9vTXBd4Y8hQcFTZqA'
// }];
$scope.labels = ['Commits', 'Issues Assigned', 'Messages', 'Open Tasks'];
@ -88,6 +91,7 @@ angular.module('SeHub')
[28, 48, 40, 3]
];
$scope.isUser = $scope.$parent.user.id.toString() /*The Actual User*/ === $routeParams.id /*The Profile User*/;
}
]);

View file

@ -1,15 +1,113 @@
angular.module('SeHub')
.controller('projectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
.controller('projectsController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
console.log("in projects controller");
var token = $cookies['com.sehub.www'];
var classId = $routeParams.id;
$scope.projectEmpty = false;
$scope.displayProjects = function()
{
console.log("in displayProjecs!!! ");
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
{
$scope.projects = data;
init(); // Executing the function to initialize projects display
console.log("project created! not rly!! " + classId);
}).error(function(err)
{
console.log("Error: " + err);
});
if($scope.projects = null)
{
$scope.projectEmpty = true;
}
}
$scope.displayProjects(); // Displaying all projects related to user
$scope.createProjectClicked = function()
{
console.log("project created! not rly!! ");
console.log("project created! not rly!! " + classId);
// $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page
}
// $scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs'];
$scope.goToProject = function()
{
console.log("projects only from classID: " + classId)
$location.path('/thisProject' + classId);
}
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if(($scope.projects.length % 3) === 0)
{
newLength = ($scope.projects.length / 3);
}
else
{
newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up
}
console.log("length: " + newLength);
$scope.arrayHolder.length = newLength;
for(j = 0; j < newLength; j++)
{
$scope.arrayHolder[j] = [3]; // Creating array in size of 3 in each array cell
}
for(i = 0; i < newLength; i++)
{
for(j = 0; j < newLength; j++)
{
if($scope.projects[(3*i) + j] != null)
{
$scope.arrayHolder[i][j] = $scope.projects[(3*i) + j];
}
}
}
console.log($scope.arrayHolder);
}
/*
var jsonNewCourse =
{
'courseName': $scope.course.courseName,
'campusName': $scope.course.campusName,
'startDate': {
'year' : $scope.course.startDate.getFullYear(),
'day' : $scope.course.startDate.getDate(),
'month': $scope.course.startDate.getMonth() + 1
},
'endDate': {
'year' : $scope.course.endDate.getFullYear(),
'day' : $scope.course.endDate.getDate(),
'month': $scope.course.endDate.getMonth() + 1
}
};*/
/*
{
'projectName': 'Advance Math',
'courseName': 'JCE',
'grade': 98,
'logo_url': 'http://location.domain.com/image.jpg',
'gitRepository': 'http://location.git.com/somthing',
'membersId': ['bob', 'dylan', 'quentin', 'terentino'],
'id' : 1234567890
}
*/

View file

@ -1,141 +1,126 @@
angular.module('SeHub')
.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;
$scope.isEmpty = true; // if the academic email line is empty
$scope.jsonCreateCampus =
{
"title": "Create Campus",
"email": "email_ending",
"avatar": "self.avatar.url"
}
$rootScope.seToken = $cookies['com.sehub.www'];
var token = $rootScope.seToken;
apiService.getUserByToken(token).success(function(data) // Get user token
{
$scope.user = data;
if(data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if($scope.user.name === ";")
{
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
.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;
$scope.isEmpty = true; // if the academic email line is empty
$scope.jsonCreateCampus = {
"title": "Create Campus",
"email": "email_ending",
"avatar": "self.avatar.url"
}
apiService.getAllCampuses($scope.user.seToken).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function()
{
// TODO
});
});
$rootScope.seToken = $cookies['com.sehub.www'];
var token = $rootScope.seToken;
$scope.dropdownClicked = function()
{
if($scope.campus){
$scope.campusChecked = true;
$scope.campusObj = null;
for (var i = $scope.campuses.length - 1; i >= 0; i--) {
if($scope.campuses[i].title == $scope.campus){
$scope.campusObj = $scope.campuses[i];
console.log($scope.campusObj); // TODO REMOVE!!
}
apiService.getUserByToken(token).success(function(data) // Get user token
{
$scope.user = data;
if (data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if ($scope.user.name === ";") {
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
}
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function() {
// TODO
});
});
$scope.dropdownClicked = function() {
if ($scope.campus) {
$scope.campusChecked = true;
$scope.campusObj = null;
for (var i = $scope.campuses.length - 1; i >= 0; i--) {
if ($scope.campuses[i].title == $scope.campus) {
$scope.campusObj = $scope.campuses[i];
console.log($scope.campusObj); // TODO REMOVE!!
}
};
};
};
$scope.submitClicked = function(ev) {
var emailValid = false;
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);
apiService.sendValidationMail(token, fullMail).success(function(data) {
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(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
}); // Pop-up alert for e-mail verification
}).error(function() {
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
});
} else // TODO Fix when success to show mdDialog until 'Got it' clicked
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
};
};
};
$scope.createCampus = function(ev) {
$scope.createCampusClicked = !$scope.createCampusClicked;
$scope.submitClicked = function(ev)
{
var emailValid = false;
var jsonUpdateUser =
{
"lecturerStat": "$scope.user.isLecturer",
"campName": "$scope.campusName"
}
if($scope.user.AcMail != null)
{
var fullMail = $scope.user.AcMail + $scope.campusObj.email_ending; // Holds the full academic email of the user
apiService.updateUser($scope.user.seToken, jsonUpdateUser).success(function(data)
if (!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
{
}).error(function()
{
// TODO Error
console.log("Error occured on updateUser");
});
console.log("Mail: " + fullMail);
apiService.sendValidationMail($scope.user.seToken, fullMail).success(function(data)
{
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(ev)); // 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()
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
});
}
else // TODO Fix when success to show mdDialog until 'Got it' clicked
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(ev));
};
};
$scope.createCampus = function(ev)
{
$scope.createCampusClicked = true;
if(!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing)
{
if($scope.user.campusMail != null)
{
validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix"
if ($scope.user.campusMail != null) {
validateEmail($scope.user.campusMail); // Verify the email according to "xxx@name.suffix"
}
}
}
}
validateEmail = function(email)
{
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if (!result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
}
if(result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
{
console.log("Im good");
apiService.sendValidationMail($scope.user.seToken, email).success(function(data)
validateEmail = function(email) {
var result = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if (!result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
{
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()
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
}
if (result.test(email)) // TODO Fix when success to show mdDialog until 'Got it' clicked
{
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address or in the campus name.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
});
console.log("Im good");
apiService.sendValidationMail(token, email).success(function(data) {
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() {
$mdDialog.show($mdDialog.alert().title('Error - E-mail Verification').content('An error has occured in your e-mail address or in the campus name.')
.ariaLabel('Email verification error alert dialog').ok('Got it!').targetEvent(email));
});
}
}
}
}]);
}]);

View file

@ -7,8 +7,7 @@ angular.module('SeHub')
{
var taskName = name;
console.log("task created! " + taskName);
$window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page
$location.path("/tasks/new"); // Reference to 'newTask' page
}

View file

@ -37,18 +37,17 @@ service.factory('apiService', ['$http', function($http) {
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/updateUser/" + token;
req = {
method: "POST",
method: "PUT",
url: url,
data: payLoad
};
return $http(req);
},
getCourseByCampusName: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token;
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseByCampusName/" + token;
req = {
method : "GET",
url : url,
data: token
url : url
};
return $http(req);
@ -71,14 +70,104 @@ service.factory('apiService', ['$http', function($http) {
};
return $http(req);
},
getCourseMessages: function(token, courseName){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseMessages/" + token + '/' + courseName;
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);
},
getMessagesByCourseName: function(token, courseName){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getMessagesByCourseName/" + token + '/' + courseName;
req = {
method : "GET",
url : url
};
return $http(req);
},
createCourse: function(token, payLoad){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token;
req = {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
},
getCampusesByUser: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUser/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getCoursesByUser: function(token, campusId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + campusId;
req = {
method : "GET",
url : url
};
return $http(req);
},
getProjectsByCourse: function(token, classId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token + "/" + classId;
req = {
method : "GET",
url : url
};
return $http(req);
},
getProjectsByUser: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getUserById: function(token, id){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + id;
req = {
method : "GET",
url : url
};
return $http(req);
},
getCampusesByUserId: function(token, id){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUserID/" + token + "/" + id;
req = {
method : "GET",
url : url
};
return $http(req);
},
joinCourse: function(token, courseId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + courseId;
req = {
method : "PUT",
url : url
};
return $http(req);
},
createMessage: function(token, payLoad){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token;
req = {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
}
};
}]);

View file

@ -0,0 +1,42 @@
<div class = "myCampuses">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> Pick A Campus</h1>
</md-content>
<md-card class="cardAllCampuses">
<div ng-if = "!scope.campusesEmpty">
<div class = "allCampusesShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "campus in t" value = "{{campus}}" >
<div ng-if="t.length != 1">
<md-button ng-click = "goToCampus(campus.id)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
<!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
<md-card style="width:97%;height:97%">
<img ng-src="{{campus.avatar_url}}" class="md-card-image" alt="Washed Out">
<md-card-content>
<h2 class="md-title">{{campus.title}}</h2>
</md-card-content>
</md-card>
</md-button>
</div>
<div ng-if="t.length == 1">
<md-button ng-click = "goToCampus(campus.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
<!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
<md-card style="width:97%;height:97%">
<img ng-src="{{campus.avatar_url}}" class="md-card-image" alt="Washed Out">
<md-card-content>
<h2 class="md-title">{{campus.title}}</h2>
</md-card-content>
</md-card>
</md-button>
</div>
<div class="spacer"></div>
</div>
</div>
</div>
<div ng-if = "scope.campusesEmpty">>
<md-card>
You Are Not Related To Any Course, You Can Join A Course By Press 'Join'.
</md-card>
</div>
</md-card>
</div>

View file

@ -99,71 +99,16 @@
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</md-button>
</div>
<div class="port_spacer"></div>
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required>
</md-input-container>
</div>
</md-content>
<md-content layout-padding layout-margin>
<h1>
<em><i class="fa fa-folder-open"></i> Project Evaluation</em>
</h1>
<md-select placeholder="Choose Project" ng-model="project" ng-click="chooseProjectClicked()" style="z-index: 300" class="projectDropDown">
</md-select>
<div layout = "column" layout-margin layout-padding>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit" >
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
</div>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
</div>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<div layout-padding layout = "row">
<div flex = "60">
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required></input>
</md-input-container>
</div>
<div flex = "30">
<md-select placeholder="Choose Course" ng-model="course" ng-click="chooseCourseClicked()" style="z-index: 300" class="courseDropDown"></md-select>
</div>
</div>
</div>
</md-content>

View file

@ -109,13 +109,15 @@
<!-- Controllers -->
<script src="templates/js/controllers/mainController.js"></script>
<script src="templates/js/controllers/homeController.js"></script>
<script src="templates/js/controllers/settingsController.js"></script>
<script src="templates/js/controllers/profileController.js"></script>
<script src="templates/js/controllers/registerController.js"></script>
<script src="templates/js/controllers/tasksController.js"></script>
<script src="templates/js/controllers/myClassesController.js"></script>
<script src="templates/js/controllers/newTasksController.js"></script>
<script src="templates/js/controllers/projectsController.js"></script>
<script src="templates/js/controllers/newCourseController.js"></script>
<script src="templates/js/controllers/campusesController.js"></script>
<script src="templates/js/controllers/myProjectsController.js"></script>
</body>
</html>

View file

@ -2,55 +2,54 @@
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
</md-content>
<md-card class="cardAllcourses">
<div flex = "99" class = "allcoursesShow" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}">
<div flex ="32" layout = "column" ng-repeat = "course in t" value = "{{course}}" layout-padding>
<div ng-of = "!scope.coursesEmpty">
<md-card ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "campusCard">
{{course.id}}
</md-card>
</div>
<div ng-if = "scope.coursesEmpty">
You Are Not Related To Any Course, You May Join Any Course You Wish.
</div>
</div>
</div>
</md-card>
<!-- <md-button ng-click="joinCourseClicked()" ng class="md-raised md-primary">Join Class</md-button> -->
<div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<div layout="row">
<div layout-margin layout-padding>
<md-button ng-click="createCourseClicked()" ng class="md-raised md-primary">Create Class</md-button>
</div>
<div layout-margin layout-padding>
<md-button ng-click="showMyCourses()" ng class="md-raised md-primary">Show My Classes</md-button>
</div>
</div>
<div ng-if="isNewCourse">
<md-content>
<md-content layout-padding layout="row" layout-sm="column">
<md-input-container>
<label>User Name</label>
<input ng-model="user.name">
</md-input-container>
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email">
</md-input-container>
</md-content>
<md-content layout-padding>
<form name="createNewCourseForm">
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label>Class Name</label>
<input ng-model="user.createNewCourse" min-length="1" required>
</md-input-container>
<md-input-container flex>
<label>Course Finish Date</label>
<input type="date" ng-model="user.finalDate" required>
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container flex>
<label>First name</label>
<input ng-model="user.firstName">
</md-input-container>
<md-input-container flex>
<label>Last Name</label>
<input ng-model="theMax">
</md-input-container>
</div>
<md-input-container flex>
<label>General Info (optional)</label>
<textarea ng-model="user.courseInfo" columns="1" md-maxlength="150"></textarea>
<md-content layout-padding>
<md-card layout-padding>
<div layout layout-sm="column">
<!-- <input ng-model="course.campusName" required> -->
<md-select placeholder = "Campus name" ng-model="course.campusName" ng-click = "chooseCourseClicked()" required>
<md-option ng-repeat="c in campuses" value="{{c.title}}">
{{c.title}}
</md-option>
</md-select>
</div>
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label flex = "50">Class Name</label>
<input ng-model="course.courseName" min-length="1" required>
</md-input-container>
</form>
</md-content>
<md-input-container flex = "20">
<label>Course Start Date</label>
<input type="date" ng-model="course.startDate" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Finish Date</label>
<input type="date" ng-model="course.endDate" required>
</md-input-container>
</div>
</md-card>
<div layout-padding layout-margin>
<md-button ng-click="submitNewClassClicked()" class="md-raised md-primary">Submit New Class</md-button>
</div>
@ -61,91 +60,6 @@
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
<!-- <md-content>
<div layout="row">
<div flex="65">
<md-card>
<p class = "messagesFeed">Messages</p>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksFeed">Tasks</p>
</md-card>
</div>
</div>
<div layout="row">
<div flex="65">
<md-card>
<div class = "messagesContent">
<md-card ng-repeat = "msg in messages">
<div layout="column">
<div layout="row" layout-margin layout-padding>
<div flex="10" class="md-avatar">
<img ng-src="{{user.avatar_url}}" style="width:100%">
</div>
<div flex>
<div layout = "column">
<div>
<b>{{user.name}}</b>
</div>
<div>
class_name
</div>
</div>
</div>
</div>
<div>
<div flex="69" class="msgSent" layout-margin layout-padding>
{{msg.text}}
</div>
</div>
</div>
</md-card>
</div>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksContent">
For Task 3 Press: <a href="http://localhost:8080/home#/tasks">Task #3</a>
<br></br>
For Task 4 Press: <a href="http://localhost:8080/home#/home">Task #4</a>
<br></br>
For Task 5 Press: <a href="http://localhost:8080/home#/home">Task #5</a>
<br></br>
For Task 6 Press: <a href="http://localhost:8080/home#/home">Task #6</a>
<br></br>
For Task 7 Press: <a href="http://localhost:8080/home#/home">Task #7</a>
<br></br>
For Task 8 Press: <a href="http://localhost:8080/home#/home">Task #8</a>
</p>
</md-card>
</div>
</div>
<div class ="addMessage" layout="row" layout-margin layout padding>
<div>
<md-button ng-click="addMessageClicked()" ng class="md-raised md-primary"><i class="fa fa-comments"></i></md-button>
</div>
<div ng-if="addMsg">
<md-select placeholder="Choose Course" ng-model="course" ng-click="chooseCourseClicked()" class="courseDropDown">
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
</div>
<div ng-if="addMsg">
<div layout = "row" layout-margin layout padding layout-align = "left center">
<md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</md-button>
</div>
<div class="port_spacer"></div>
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required>
</md-input-container>
</div>
</md-content> -->
</div>
<div ng-if="isStudent"> <!-- Student Mode -->

View file

@ -0,0 +1,85 @@
<div class = "myProjects">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> {{user.name}}'s projects</h1>
<md-card class="cardAllProjects">
<div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
<div ng-if = "!scope.myProjectsEmpty">
<md-card layout-padding ng-click = "goToMyProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project.id}}
</md-card>
</div>
</div>
<div ng-if = "scope.myProjectsEmpty">
You Do Not Have Any Project, You May Create One.
</div>
</div>
</md-card>
</md-content>
</div>
<!-- div layout-padding layout-margin>
<div layout = "row" layout-padding layout-margin>
<div flex = "49">
Project Creator: {{user.name}} Should Be Project creator
</div>
<div flex = "49" >
<div ng-if="user.isLecturer">
<div layout = "row" layout-padding>
<div>
<md-button ng-click="editPressed()" class="md-raised md-primary">Edit</md-button>
</div>
<div ng-if="isEditPressed">
<md-button ng-click="removeProject()" class="md-raised md-primary">Remove</md-button>
</div>
</div>
</div>
</div>
</div>
<div layout = "row" layout-padding layout-margin>
<div flex = "49">
<md-card>
Here Will Be Graph - Commits Over Period Of Time
</md-card>
</div>
<div flex = "49">
<md-card>
Here Will Be Graph (by columns) - Commits, Issues, Open Tasks
</md-card>
</div>
</div>
<div flex>
<md-card>
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Commits">
<md-content class="md-padding">
<h1 class="md-display-2">Commits</h1>
<p>Commits...</p>
</md-content>
</md-tab>
<md-tab label="Issues">
<md-content class="md-padding">
<h1 class="md-display-2">Issues</h1>
<p>Issues...</p>
</md-content>
</md-tab>
<md-tab label="Bugs">
<md-content class="md-padding">
<h1 class="md-display-2">Bugs</h1>
<p> Bugs Bugs Bugs..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
<md-content class="md-padding">
<h1 class="md-display-2">WhatEver</h1>
<p>Bla Bla Bla..</p>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</md-card>
</div>
</div> -->

View file

@ -1,6 +1,6 @@
<div class = "newCourse">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My New Course</h1>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> {{user.name}}'s' New Course</h1>
<md-button ng-click="goBack()" class="md-raised md-primary">Go Back</md-button>
</md-content>
</div>

View file

@ -1,72 +1,81 @@
<div layout-padding>
<div layout="row">
<div flex="20" layout-padding>
<h2>
<i class="fa fa-info-circle"></i> Task Info:
</h2>
<div flex="40" layout-padding>
<md-card layout-padding>
<h2>
<i class="fa fa-info-circle"></i> Task Info:
</h2>
<div layout="column">
<div>
<md-input-container>
<label>Title</label>
<input ng-model="task.task.title" required>
</md-input-container>
</div>
<div>
<md-input-container>
<label>Description</label>
<textarea ng-model="task.task.description" required></textarea>
</md-input-container>
</div>
<div>
<md-switch ng-model="task.isPersonal" aria-label="Switch 1">
This Is: a {{(task.isPersonal) ? "Personal" : "Project"}} Task
</md-switch>
</div>
<div>
Due Date:
<datepicker date-format="d MMMM yyyy" style="width:100%" ng-click="dueTime()">
<input ng-model="task.date" type="text"/>
</datepicker>
</div>
<div layout="row">
<div flex="60"></div>
<div>
<md-button class="md-raised md-primary"><i class="fa fa-paper-plane"></i> Submit</md-button>
</div>
</div>
</div>
</md-card>
<div layout="column">
<div>
<md-input-container>
<label>Title</label>
<input ng-model="task.task.title" required>
</md-input-container>
</div>
<div>
<md-input-container>
<label>Description</label>
<textarea ng-model="task.task.description" required></textarea>
</div>
<div>
<md-switch ng-model="task.isPersonal" aria-label="Switch 1">
This Is: a {{(task.isPersonal) ? "Personal" : "Project"}} Task
</md-switch>
</div>
<div>
Due Date:
<datepicker date-format="d MMMM yyyy" style="width:100%" ng-click="dueTime()">
<input ng-model="task.date" type="text"/>
</datepicker>
</div>
<div layout="row">
<div flex="60"></div>
<div>
<md-button class="md-raised md-primary"><i class="fa fa-paper-plane"></i> Submit</md-button>
</div>
</div>
</div>
<md-card layout-padding>
<div>
<h2>
<i class="fa fa-cubes"></i> Add A component:
</h2>
</div>
<div>
Select Type:
<md-select placeholder="Component Type" ng-model="newComp.type" ng-change="ComponentType(newComp.type)">
<md-option ng-repeat="component in componentTypes" value="{{component.type}}">{{component.type}}</md-option>
</md-select>
</div>
<div>
<md-input-container ng-repeat="detail in compDetails">
<label>{{detail.detail}}</label>
<input ng-model="newComp.label[$index]" required>
</md-input-container>
</div>
<div ng-if="isRadioButton">
<md-button ng-click="addMoreOptions()" >
Add An Option
</md-button>
</div>
<div>
<md-switch ng-model="newComp.isMandatory" aria-label="Switch 1">
Mandatory?: {{ newComp.isMandatory}}
</md-switch>
</div>
<div layout="row">
<div flex="65"></div>
<md-button class="md-raised" ng-click="addComponent()"><i class="fa fa-plus"></i> Add To Task</md-button>
</div>
</md-card>
</div>
</div>
<div layout="column" flex="30" layout-padding>
<div>
<h2>
<i class="fa fa-cubes"></i> Add A component:
</h2>
</div>
<div>
Select Type:
<md-select placeholder="Component Type" ng-model="newComp.type">
<md-option ng-repeat="component in componentTypes" value="{{component.type}}">{{component.type}}</md-option>
</md-select>
</div>
<div>
<md-input-container>
<label>Label</label>
<input ng-model="newComp.label" required>
</md-input-container>
</div>
<div>
<md-switch ng-model="newComp.isMandatory" aria-label="Switch 1">
Mandatory?: {{ newComp.isMandatory}}
</md-switch>
</div>
<div layout="row">
<div flex="65"></div>
<md-button class="md-raised" ng-click="addComponent()"><i class="fa fa-plus"></i> Add To Task</md-button>
</div>
</div>
<div flex="50" layout-padding>
<div flex="60" layout-padding>
<!-- <md-card style="background-image: url('http://www.stationeryhq.com/content/images/thumbs/0000324_clipboard_500.png')">
</md-card> -->
@ -80,6 +89,9 @@
<p>{{ dueTimeFromNow }}</p>
<p>{{task.task.description}}</p>
<p>{{(task.isPersonal) ? "Personal" : "Project"}} Task</p>
<md-divider ng-if="!$last"></md-divider>
<div ng-repeat="component in task.components">
<!-- if text box -->
<div ng-if="component.type == 'textbox'">
@ -101,6 +113,20 @@
{{ component.label}}
</md-checkbox>
</div>
<!-- if Link -->
<div ng-if="component.type == 'link'" layout="column" ng-init="initLinkComp(component)" style="width: 100%" layout-align="center">
<md-button ng-href="{{component.href}}" style="width: 100%" target="_blank">
<i class="fa fa-link"></i> {{component.title}}
</md-button>
</div>
<!-- if RadioButtons -->
<div ng-if="component.type == 'radiobuttons'" ng-init="initRadioButtonsComp(component)">
{{component.title}}
<md-radio-group ng-model="component.value" ng-change="RB(component)">
<md-radio-button ng-repeat="option in component.values" value="{{option.text}}" class="md-primary">{{option.text}}</md-radio-button>
</md-radio-group>
</div>
<md-divider ng-if="!$last"></md-divider>
</div>
</md-card>
</div>

View file

@ -1,6 +1,8 @@
<div>
<div class="loader" ng-if="loadingData">
<div class="loader" ng-if="loadingData" layout="row" layout-align="center">
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
<md-content layout-padding>
<md-card layout-padding>
@ -15,7 +17,7 @@
<img ng-src="{{user.avatar_url}}" alt="" style="width:20%">
</div>
<div flex="70%">
<md-button class="md-raised" ng-click="changeProfileMode()">
<md-button class="md-raised" ng-click="changeProfileMode()" ng-if="isUser">
<i ng-class="profileModeIcon"></i> {{profileMode}}
</md-button>
</div>
@ -78,7 +80,7 @@
</div>
<div class="spacer"></div>
<div>
<md-button class="">
<md-button class="" ng-if="isUser">
X
</md-button>
</div>
@ -96,11 +98,11 @@
<img alt="{{ person.name }}" ng-src="{{ campus.avatar_url }}" class="md-avatar" />
</div>
<div class="port_spacer">
{{ campus.title }} -
<strong>{{ campus.title }}</strong> {{campus.email_ending}}
</div>
<div class="spacer"></div>
<div>
<md-button class="">
<md-button class="" ng-if="isUser">
X
</md-button>
</div>

View file

@ -1,6 +1,20 @@
<div class = "projects">
<h1 style="margin-left:15px"><i class="fa fa-cube"></i> Projects</h1>
<md-card class="cardAllProjects">
<div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
<div ng-if = "!scope.projectEmpty">
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project.id}}
</md-card>
</div>
</div>
<div ng-if = "scope.projectEmpty">
You Are Not Related To Any Course, You May Join Any Course You Wish.
</div>
</div>
</md-card>
<md-content layout-padding layout-margin>
<h1 style="margin-left:15px"><i class="fa fa-file-cube-o"></i> Projects</h1>
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
</md-content>
</div>

View file

@ -1,6 +1,52 @@
<div class = "tasks">
<md-content layout-padding layout-margin>
<h1 style="margin-left:15px"><i class="fa fa-file-text-o"></i> Tasks</h1>
<md-button ng-click="createTaskClicked(taskName)" ng class="md-raised md-primary">Create Task</md-button>
<div ng-if="user.isLecturer">
<md-button ng-click="createTaskClicked(taskName)" ng class="md-raised md-primary">Create Task</md-button>
<div flex>
<md-card>
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Submitted">
<md-content class="md-padding">
<h1 class="md-display-2">Submitted</h1>
<p>Submitted...</p>
</md-content>
</md-tab>
<md-tab label="Delayed">
<md-content class="md-padding">
<h1 class="md-display-2">Delayed</h1>
<p>Delayed...</p>
</md-content>
</md-tab>
<md-tab label="Not Submitted">
<md-content class="md-padding">
<h1 class="md-display-2">Not Submitted</h1>
<p> Not Submitted ..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
<md-content class="md-padding">
<h1 class="md-display-2">WhatEver</h1>
<p>Bla Bla Bla..</p>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</md-card>
</div>
<!-- Should Be In Table List -->
<div class = "allProjectsShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}">
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" flex="32" layout-padding class = "md-raised">
<!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
{{project.title}}
</md-button>
</div>
</div>
<!-- Should Be In Table List -->
</div>
</md-content>
</div>