Merge branch with master

This commit is contained in:
Kenneth Jao 2016-08-18 18:48:32 -04:00
commit 80459a006b
6 changed files with 306 additions and 218 deletions

View File

@ -12,3 +12,4 @@ notices-for-facebook-graph-api-2
1.2.0-breaking-changes 1.2.0-breaking-changes
1.3.0-split-minifiers-package 1.3.0-split-minifiers-package
1.4.0-remove-old-dev-bundle-link 1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package

View File

@ -6,23 +6,23 @@
meteor-base@1.0.4 # Packages every Meteor app needs to have meteor-base@1.0.4 # Packages every Meteor app needs to have
mobile-experience@1.0.4 # Packages for a great mobile UX mobile-experience@1.0.4 # Packages for a great mobile UX
mongo@1.1.10 # The database Meteor supports right now mongo@1.1.11 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.10 # Reactive variable for tracker reactive-var@1.0.10 # Reactive variable for tracker
jquery@1.11.9 # Helpful client-side library jquery@1.11.9 # Helpful client-side library
tracker@1.1.0 # Meteor's client-side reactive programming library tracker@1.1.0 # Meteor's client-side reactive programming library
standard-minifier-css@1.1.8 # CSS minifier run for production mode standard-minifier-css@1.2.0 # CSS minifier run for production mode
standard-minifier-js@1.1.8 # JS minifier run for production mode standard-minifier-js@1.2.0 # JS minifier run for production mode
es5-shim@4.6.13 # ECMAScript 5 compatibility for older browsers. es5-shim@4.6.14 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.5.7 # Enable ECMAScript2015+ syntax in app code ecmascript@0.5.8 # Enable ECMAScript2015+ syntax in app code
fortawesome:fontawesome fortawesome:fontawesome
session session@1.1.6
proyk:meteor-cookies proyk:meteor-cookies
aldeed:simple-schema aldeed:simple-schema
accounts-google accounts-google@1.0.10
accounts-ui accounts-ui@1.1.9
iron:router iron:router
ongoworks:security ongoworks:security
mizzao:autocomplete mizzao:autocomplete
@ -30,3 +30,4 @@ alanning:roles
rzymek:fullcalendar rzymek:fullcalendar
momentjs:moment momentjs:moment
eternicode:bootstrap-datepicker eternicode:bootstrap-datepicker
shell-server

View File

@ -1 +1 @@
METEOR@1.4.0.1 METEOR@1.4.1

View File

@ -1,4 +1,4 @@
accounts-base@1.2.9 accounts-base@1.2.11
accounts-google@1.0.10 accounts-google@1.0.10
accounts-oauth@1.1.13 accounts-oauth@1.1.13
accounts-ui@1.1.9 accounts-ui@1.1.9
@ -6,41 +6,41 @@ accounts-ui-unstyled@1.1.12
alanning:roles@1.2.15 alanning:roles@1.2.15
aldeed:simple-schema@1.5.3 aldeed:simple-schema@1.5.3
allow-deny@1.0.5 allow-deny@1.0.5
autoupdate@1.2.11 autoupdate@1.3.11
babel-compiler@6.9.0 babel-compiler@6.9.1
babel-runtime@0.1.10 babel-runtime@0.1.11
base64@1.0.9 base64@1.0.9
binary-heap@1.0.9 binary-heap@1.0.9
blaze@2.1.8 blaze@2.1.8
blaze-html-templates@1.0.4 blaze-html-templates@1.0.4
blaze-tools@1.0.9 blaze-tools@1.0.9
boilerplate-generator@1.0.9 boilerplate-generator@1.0.9
caching-compiler@1.0.6 caching-compiler@1.1.7
caching-html-compiler@1.0.6 caching-html-compiler@1.0.6
callback-hook@1.0.9 callback-hook@1.0.9
check@1.2.3 check@1.2.3
coffeescript@1.0.17 coffeescript@1.2.4
dandv:caret-position@2.1.1 dandv:caret-position@2.1.1
ddp@1.2.5 ddp@1.2.5
ddp-client@1.2.9 ddp-client@1.3.1
ddp-common@1.2.6 ddp-common@1.2.6
ddp-rate-limiter@1.0.5 ddp-rate-limiter@1.0.5
ddp-server@1.2.10 ddp-server@1.3.10
deps@1.0.12 deps@1.0.12
diff-sequence@1.0.6 diff-sequence@1.0.6
ecmascript@0.5.7 ecmascript@0.5.8
ecmascript-runtime@0.3.12 ecmascript-runtime@0.3.14
ejson@1.0.12 ejson@1.0.12
es5-shim@4.6.13 es5-shim@4.6.14
eternicode:bootstrap-datepicker@1.6.0_3 eternicode:bootstrap-datepicker@1.6.0_3
fastclick@1.0.12 fastclick@1.0.12
fortawesome:fontawesome@4.5.0 fortawesome:fontawesome@4.5.0
geojson-utils@1.0.9 geojson-utils@1.0.9
google@1.1.13 google@1.1.14
hot-code-push@1.0.4 hot-code-push@1.0.4
html-tools@1.0.10 html-tools@1.0.10
htmljs@1.0.10 htmljs@1.0.10
http@1.1.8 http@1.2.9
id-map@1.0.8 id-map@1.0.8
iron:controller@1.0.12 iron:controller@1.0.12
iron:core@1.0.11 iron:core@1.0.11
@ -52,31 +52,31 @@ iron:router@1.0.13
iron:url@1.0.11 iron:url@1.0.11
jquery@1.11.9 jquery@1.11.9
launch-screen@1.0.12 launch-screen@1.0.12
less@2.6.5 less@2.7.5
livedata@1.0.18 livedata@1.0.18
localstorage@1.0.11 localstorage@1.0.11
logging@1.1.14 logging@1.1.15
mdg:validation-error@0.2.0 mdg:validation-error@0.5.1
meteor@1.2.16 meteor@1.2.17
meteor-base@1.0.4 meteor-base@1.0.4
minifier-css@1.2.13 minifier-css@1.2.14
minifier-js@1.2.13 minifier-js@1.2.14
minimongo@1.0.17 minimongo@1.0.17
mizzao:autocomplete@0.5.1 mizzao:autocomplete@0.5.1
mobile-experience@1.0.4 mobile-experience@1.0.4
mobile-status-bar@1.0.12 mobile-status-bar@1.0.12
modules@0.7.5 modules@0.7.6
modules-runtime@0.7.5 modules-runtime@0.7.6
momentjs:moment@2.8.4 momentjs:moment@2.14.4
mongo@1.1.10 mongo@1.1.11
mongo-id@1.0.5 mongo-id@1.0.5
npm-mongo@1.5.45 npm-mongo@1.5.46
oauth@1.1.11 oauth@1.1.11
oauth2@1.1.10 oauth2@1.1.10
observe-sequence@1.0.12 observe-sequence@1.0.12
ongoworks:security@2.0.1 ongoworks:security@2.0.1
ordered-dict@1.0.8 ordered-dict@1.0.8
promise@0.8.3 promise@0.8.4
proyk:meteor-cookies@0.0.1 proyk:meteor-cookies@0.0.1
random@1.0.10 random@1.0.10
rate-limit@1.0.5 rate-limit@1.0.5
@ -88,15 +88,16 @@ routepolicy@1.0.11
rzymek:fullcalendar@2.7.2 rzymek:fullcalendar@2.7.2
service-configuration@1.0.10 service-configuration@1.0.10
session@1.1.6 session@1.1.6
shell-server@0.2.1
spacebars@1.0.12 spacebars@1.0.12
spacebars-compiler@1.0.12 spacebars-compiler@1.0.12
standard-minifier-css@1.1.8 standard-minifier-css@1.2.0
standard-minifier-js@1.1.8 standard-minifier-js@1.2.0
templating@1.1.14 templating@1.2.14
templating-tools@1.0.4 templating-tools@1.0.4
tracker@1.1.0 tracker@1.1.0
ui@1.0.11 ui@1.0.11
underscore@1.0.9 underscore@1.0.9
url@1.0.10 url@1.0.10
webapp@1.3.10 webapp@1.3.11
webapp-hashing@1.0.9 webapp-hashing@1.0.9

View File

@ -72,20 +72,35 @@ Template.registerHelper('myClasses', () => {
var thisWork = work.find({class: courses[i]}).fetch(); var thisWork = work.find({class: courses[i]}).fetch();
for(var j = 0; j < thisWork.length; j++) { for(var j = 0; j < thisWork.length; j++) {
thisWork[j].dueDate = getReadableDate(thisWork[j].dueDate); thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'MMMM Do'
});
thisWork[j].typeColor = workColors[thisWork[j].type]; thisWork[j].typeColor = workColors[thisWork[j].type];
} }
array[i].thisClassWork = thisWork; array[i].thisClassWork = thisWork;
} }
Session.set("noclass",false); Session.set("noclass",false);
<<<<<<< HEAD
console.log(array); console.log(array);
return array; return array;
=======
return array;
>>>>>>> afd60acb9ab69a32ee86ae92e86e0d67e39af7be
} }
}); });
Template.main.helpers({ Template.main.helpers({
schoolName() { schoolName() {
<<<<<<< HEAD
Session.set("calendarclasses", Meteor.user().profile.classes); Session.set("calendarclasses", Meteor.user().profile.classes);
=======
Session.set("calendarclasses", Meteor.user().profile.classes);
>>>>>>> afd60acb9ab69a32ee86ae92e86e0d67e39af7be
return " - " + Meteor.user().profile.school; return " - " + Meteor.user().profile.school;
}, },
iconColor(icon) { iconColor(icon) {
@ -451,8 +466,9 @@ Template.main.events({
'focus #workDatea' () { 'focus #workDatea' () {
$('#workDatea').datepicker({ $('#workDatea').datepicker({
format: 'DD, MM d, yyyy', format: 'DD, MM d, yyyy',
startDate: 'mm-dd-yyyy', startDate: 'd',
autoclose: true, todayHighlight: true,
autoclose: true
}); });
} }

View File

@ -5,18 +5,13 @@ import {
Mongo Mongo
} from 'meteor/mongo'; } from 'meteor/mongo';
_uuid4 = function(cc) {
var rr = Math.random() * 16 | 0;
return (cc === 'x' ? rr : (rr & 0x3 | 0x8)).toString(16);
};
superadmins = [ superadmins = [
"ybq987@gmail.com", "ybq987@gmail.com",
"ksjdragon@gmail.com" "ksjdragon@gmail.com"
]; ];
worktype = ["test", "quiz", "project", "normal"]; worktype = ["test", "quiz", "project", "normal", "other"];
var possiblelist = ["moderators","banned"]; var possiblelist = ["moderators", "banned"];
for (var i = 0; i < superadmins.length; i++) { for (var i = 0; i < superadmins.length; i++) {
var superadmin = superadmins[i]; var superadmin = superadmins[i];
@ -81,7 +76,11 @@ Meteor.publish('users', function() {
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) { if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
return Meteor.users.find(); return Meteor.users.find();
} else { } else {
return Meteor.users.find({}, {fields: {'services.google.email': 1}}); return Meteor.users.find({}, {
fields: {
'services.google.email': 1
}
});
} }
}); });
@ -89,7 +88,7 @@ Security.permit(['insert', 'update', 'remove']).collections([schools, classes, w
Meteor.methods({ Meteor.methods({
'genCode': function() { 'genCode': function() {
return 'xxxxxx'.replace(/[x]/g, _uuid4); return Math.random().toString(36).substring(7);
}, },
'createSchool': function(schoolname) { 'createSchool': function(schoolname) {
if (Meteor.user() !== null && if (Meteor.user() !== null &&
@ -160,34 +159,62 @@ Meteor.methods({
} }
}, },
'changeAdmin': function(input) { 'changeAdmin': function(input) {
var found = Meteor.users.find({_id: input[0]}); var found = Meteor.users.find({
var foundclass = classes.find({_id: input[1]}); _id: input[0]
});
var foundclass = classes.find({
_id: input[1]
});
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
classes.update({_id: input[1]}, {$set: {admin: input[0]}}); classes.update({
_id: input[1]
}, {
$set: {
admin: input[0]
}
});
} else if (found && foundclass && foundclass.admin == Meteor.userId() && } else if (found && foundclass && foundclass.admin == Meteor.userId() &&
foundclass.banned.indexOf(input[0]) === -1 && foundclass.banned.indexOf(input[0]) === -1 &&
foundclass.subscribers.indexOf(input[0]) !== -1) { foundclass.subscribers.indexOf(input[0]) !== -1) {
classes.update({_id: input[1]}, {$set: {admin: input[0]}}); classes.update({
_id: input[1]
}, {
$set: {
admin: input[0]
}
});
} else { } else {
throw "Unauthorized"; throw "Unauthorized";
} }
}, },
'trackUserInClass': function(input) { 'trackUserInClass': function(input) {
var foundclass = classes.findOne({_id: input[1]}); var foundclass = classes.findOne({
_id: input[1]
});
var userlist = input[2]; var userlist = input[2];
var index = possiblelist.indexOf(input[2]); var index = possiblelist.indexOf(input[2]);
var set = {}; var set = {};
set[userlist] = foundclass[userlist].concat(input[0]); set[userlist] = foundclass[userlist].concat(input[0]);
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
classes.update({_id: input[1]}, {$set: set}); classes.update({
_id: input[1]
}, {
$set: set
});
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 && } else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
(index === 1 || foundclass.moderators.indexOf(Meteor.userId()) !== -1) && (index === 1 || foundclass.moderators.indexOf(Meteor.userId()) !== -1) &&
foundclass[userlist].indexOf(input[0]) === -1) { foundclass[userlist].indexOf(input[0]) === -1) {
classes.update({_id: input[1]}, {$set: set}); classes.update({
_id: input[1]
}, {
$set: set
});
} }
}, },
'untrackUserInClass': function(input) { 'untrackUserInClass': function(input) {
var foundclass = classes.findOne({_id: input[1]}); var foundclass = classes.findOne({
_id: input[1]
});
var userlist = input[2]; var userlist = input[2];
var index = possiblelist.indexOf(input[2]); var index = possiblelist.indexOf(input[2]);
var set = {}; var set = {};
@ -195,11 +222,19 @@ Meteor.methods({
set[userlist] = foundclass[userlist]; set[userlist] = foundclass[userlist];
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
classes.update({_id: input[1]}, {$set: set}); classes.update({
_id: input[1]
}, {
$set: set
});
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 && } else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
(index === 1 || foundclass.moderators.indexOf(Meteor.userId()) !== -1) && (index === 1 || foundclass.moderators.indexOf(Meteor.userId()) !== -1) &&
foundclass[userlist].indexOf(input[0]) !== -1) { foundclass[userlist].indexOf(input[0]) !== -1) {
classes.update({_id: input[1]}, {$set: set}); classes.update({
_id: input[1]
}, {
$set: set
});
} }
}, },
'deleteClass': function(classid) { 'deleteClass': function(classid) {
@ -209,7 +244,9 @@ Meteor.methods({
if (Meteor.user() !== null && found !== null && if (Meteor.user() !== null && found !== null &&
(found.admin === Meteor.user()._id || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']))) { (found.admin === Meteor.user()._id || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']))) {
for (var i = 0; i < found.subscribers.length; i++) { for (var i = 0; i < found.subscribers.length; i++) {
var current = Meteor.users.findOne({_id:found.subscribers[i]}).profile; var current = Meteor.users.findOne({
_id: found.subscribers[i]
}).profile;
var index = current.classes.indexOf(classid); var index = current.classes.indexOf(classid);
current.classes.splice(index, 1); current.classes.splice(index, 1);
Meteor.users.update({ Meteor.users.update({
@ -226,7 +263,9 @@ Meteor.methods({
} }
}, },
'createWork': function(input) { 'createWork': function(input) {
var ref = new Date().getTime(); var ref = new Date();
ref.setHours(0,0,0,0);
ref = ref.getTime();
input.creator = Meteor.userId(); input.creator = Meteor.userId();
work.schema.validate(input); work.schema.validate(input);
var found = classes.findOne({ var found = classes.findOne({
@ -251,8 +290,9 @@ Meteor.methods({
}, },
'editWork': function(change) { 'editWork': function(change) {
var ref = new Date().getTime(); var ref = new Date();
ref.setHours(0,0,0,0);
ref = ref.getTime();
var currentclass = classes.findOne({ var currentclass = classes.findOne({
_id: work.findOne({ _id: work.findOne({
_id: change._id _id: change._id
@ -318,7 +358,7 @@ Meteor.methods({
}, { }, {
$set: { $set: {
comments: comments, comments: comments,
user:user, user: user,
time: new Date() time: new Date()
} }
}); });
@ -331,8 +371,7 @@ Meteor.methods({
var currentclass = classes.findOne({ var currentclass = classes.findOne({
_id: workobject.class _id: workobject.class
}); });
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
userindex = workobject[input[1]].indexOf(Meteor.userId()); userindex = workobject[input[1]].indexOf(Meteor.userId());
if (userindex === -1) { if (userindex === -1) {
workobject[input[1]] = workobject[input[1]].concat(Meteor.userId()); workobject[input[1]] = workobject[input[1]].concat(Meteor.userId());
@ -406,7 +445,13 @@ Meteor.methods({
found !== null && found !== null &&
pass === found.code && pass === found.code &&
prof.classes.indexOf(change) === -1) { prof.classes.indexOf(change) === -1) {
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers.concat(Meteor.userId())}}); classes.update({
_id: found._id
}, {
$set: {
subscribers: found.subscribers.concat(Meteor.userId())
}
});
var current = Meteor.user().profile; var current = Meteor.user().profile;
current.classes = current.classes.concat(change); current.classes = current.classes.concat(change);
Meteor.users.update({ Meteor.users.update({
@ -422,13 +467,29 @@ Meteor.methods({
} }
}, },
'joinPrivateClass': function(input) { 'joinPrivateClass': function(input) {
var found = classes.findOne({status: true, privacy: true, code:input}); var found = classes.findOne({
status: true,
privacy: true,
code: input
});
var current = Meteor.user().profile; var current = Meteor.user().profile;
if (found !== undefined && input !== undefined && if (found !== undefined && input !== undefined &&
current.classes.indexOf(found._id) === -1) { current.classes.indexOf(found._id) === -1) {
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers.concat(Meteor.userId())}}); classes.update({
_id: found._id
}, {
$set: {
subscribers: found.subscribers.concat(Meteor.userId())
}
});
current.classes = current.classes.concat(found._id); current.classes = current.classes.concat(found._id);
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}}); Meteor.users.update({
_id: Meteor.userId()
}, {
$set: {
profile: current
}
});
return true; return true;
} else { } else {
return false; return false;
@ -450,8 +511,16 @@ Meteor.methods({
profile: current profile: current
} }
}); });
var newstudents = classes.findOne({_id: change}).subscribers.splice(Meteor.userId(), 1); var newstudents = classes.findOne({
classes.update({_id: change}, {$set: {subscribers: newstudents}}); _id: change
}).subscribers.splice(Meteor.userId(), 1);
classes.update({
_id: change
}, {
$set: {
subscribers: newstudents
}
});
return 1; return 1;
} else { } else {
throw "You are currently the admin of this class. Transfer ownership in order to leave this class."; throw "You are currently the admin of this class. Transfer ownership in order to leave this class.";