Merge remote-tracking branch 'origin/master'
# Conflicts: # client/main/main.js
This commit is contained in:
commit
ecb8ebae64
@ -11,6 +11,7 @@ var openValues = {
|
|||||||
"options": "-20%"
|
"options": "-20%"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// Sets values for the different themes
|
// Sets values for the different themes
|
||||||
|
|
||||||
Session.set('themeColors', {
|
Session.set('themeColors', {
|
||||||
@ -43,6 +44,8 @@ Session.set('themeColors', {
|
|||||||
|
|
||||||
//Sets colors for different assignment statuses
|
//Sets colors for different assignment statuses
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> origin/master
|
||||||
var workColors = {
|
var workColors = {
|
||||||
"normal": "#2E4F74",
|
"normal": "#2E4F74",
|
||||||
"quiz": "#409333",
|
"quiz": "#409333",
|
||||||
@ -73,13 +76,12 @@ var ref = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Reactive variables.
|
// Reactive variables.
|
||||||
Session.set("calendarclasses", null); //
|
Session.set("calendarclasses", null); //
|
||||||
Session.set("sidebar", null);
|
Session.set("sidebar", null);
|
||||||
Session.set("newWork",null);
|
Session.set("newWork",null);
|
||||||
Session.set("currentWork",null);
|
Session.set("currentWork",null);
|
||||||
Session.set("currentReadableWork",null);
|
Session.set("currentReadableWork",null);
|
||||||
Session.set("modifying",null);
|
Session.set("modifying",null);
|
||||||
Session.set("serverData",null);
|
|
||||||
Session.set("noclass",null);
|
Session.set("noclass",null);
|
||||||
Session.set("calCreWork",null);
|
Session.set("calCreWork",null);
|
||||||
Session.set("calWorkDate",null);
|
Session.set("calWorkDate",null);
|
||||||
@ -87,12 +89,12 @@ Session.set("classDisp",[]);
|
|||||||
Session.set("classDispHover",null);
|
Session.set("classDispHover",null);
|
||||||
Session.set("commentRestrict",null);
|
Session.set("commentRestrict",null);
|
||||||
|
|
||||||
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in Session.get("themeColors").
|
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in themeColors.
|
||||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div];
|
return themeColors[Meteor.user().profile.preferences.theme][div];
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('textColor', () => { // Reactive color for text.
|
Template.registerHelper('textColor', () => { // Reactive color for text.
|
||||||
document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text;
|
document.getElementsByTagName("body")[0].style.color = themeColors[Meteor.user().profile.preferences.theme].text;
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -101,11 +103,11 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co
|
|||||||
var width = "width:" + dim[0].toString() + "px;";
|
var width = "width:" + dim[0].toString() + "px;";
|
||||||
var height = "height:" + dim[1].toString() + "px;";
|
var height = "height:" + dim[1].toString() + "px;";
|
||||||
var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;";
|
var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;";
|
||||||
var bg = "background-color:" + Session.get("themeColors")[Meteor.user().profile.preferences.theme].header + ";";
|
var bg = "background-color:" + themeColors[Meteor.user().profile.preferences.theme].header + ";";
|
||||||
return width + height + margin + bg;
|
return width + height + margin + bg;
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('myClasses', () => {
|
Template.registerHelper('myClasses', () => {
|
||||||
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
||||||
Session.set("noclass",true);
|
Session.set("noclass",true);
|
||||||
return [];
|
return [];
|
||||||
@ -150,7 +152,7 @@ Template.registerHelper('myClasses', () => {
|
|||||||
}
|
}
|
||||||
while(thisWork.indexOf("no") !== -1) thisWork.splice(thisWork.indexOf("no"),1);
|
while(thisWork.indexOf("no") !== -1) thisWork.splice(thisWork.indexOf("no"),1);
|
||||||
|
|
||||||
for(var j = 0; j < thisWork.length; j++) {
|
for(var j = 0; j < thisWork.length; j++) {
|
||||||
thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, {
|
thisWork[j].dueDate = moment(thisWork[j].dueDate).calendar(null, {
|
||||||
sameDay: '[Today]',
|
sameDay: '[Today]',
|
||||||
nextDay: '[Tomorrow]',
|
nextDay: '[Tomorrow]',
|
||||||
@ -186,7 +188,7 @@ Template.registerHelper('pref', (val) => {
|
|||||||
if(Object.keys(Meteor.user().profile.preferences).length !== Object.keys(defaults).length) {
|
if(Object.keys(Meteor.user().profile.preferences).length !== Object.keys(defaults).length) {
|
||||||
var array = Meteor.user().profile;
|
var array = Meteor.user().profile;
|
||||||
array.preferences = defaults;
|
array.preferences = defaults;
|
||||||
Session.set("serverData",array);
|
serverData = array;
|
||||||
sendData("editProfile");
|
sendData("editProfile");
|
||||||
if(val === 'timeHide' || val === 'done') return defaults[val];
|
if(val === 'timeHide' || val === 'done') return defaults[val];
|
||||||
return defaults[val].charAt(0).toUpperCase() + defaults[val].slice(1);
|
return defaults[val].charAt(0).toUpperCase() + defaults[val].slice(1);
|
||||||
@ -206,9 +208,9 @@ Template.main.helpers({
|
|||||||
},
|
},
|
||||||
iconColor(icon) { //Sets the color of the user's icon
|
iconColor(icon) { //Sets the color of the user's icon
|
||||||
if (Session.get("sidebar") === icon + "Container") {
|
if (Session.get("sidebar") === icon + "Container") {
|
||||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].statusIcons;
|
return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
|
||||||
} else if (Session.get("sidebar") === "both") {
|
} else if (Session.get("sidebar") === "both") {
|
||||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].statusIcons;
|
return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -216,13 +218,13 @@ Template.main.helpers({
|
|||||||
defaultMode() { //Loads the defaults for a new/uncustomized user
|
defaultMode() { //Loads the defaults for a new/uncustomized user
|
||||||
if(load) {
|
if(load) {
|
||||||
Session.set("mode",Meteor.user().profile.preferences.mode);
|
Session.set("mode",Meteor.user().profile.preferences.mode);
|
||||||
load = false;
|
load = false;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
bgSrc() { // Adjusts for different, larger screen sizes
|
bgSrc() { // Adjusts for different, larger screen sizes
|
||||||
var dim = [window.innerWidth, window.innerHeight];
|
var dim = [window.innerWidth, window.innerHeight];
|
||||||
var pic = "Backgrounds/"+Session.get("themeColors")[Meteor.user().profile.preferences.theme].background;
|
var pic = "Backgrounds/"+themeColors[Meteor.user().profile.preferences.theme].background;
|
||||||
return pic;
|
return pic;
|
||||||
},
|
},
|
||||||
menuStatus() {
|
menuStatus() {
|
||||||
@ -245,7 +247,7 @@ Template.main.helpers({
|
|||||||
},
|
},
|
||||||
modeStatus(status) {
|
modeStatus(status) {
|
||||||
if (status === Session.get("mode")) {
|
if (status === Session.get("mode")) {
|
||||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].highlightText;
|
return themeColors[Meteor.user().profile.preferences.theme].highlightText;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -282,14 +284,14 @@ Template.main.helpers({
|
|||||||
var today = (moment().subtract(hide,'days'))["_d"];
|
var today = (moment().subtract(hide,'days'))["_d"];
|
||||||
if(today > due) {
|
if(today > due) {
|
||||||
disp = false;
|
disp = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Meteor.user().profile.preferences.done && current.done.indexOf(Meteor.userId()) !== -1) disp = false;
|
if(Meteor.user().profile.preferences.done && current.done.indexOf(Meteor.userId()) !== -1) disp = false;
|
||||||
|
|
||||||
var inRole = false;
|
var inRole = false;
|
||||||
var currClass = classes.findOne({_id: current.class})
|
var currClass = classes.findOne({_id: current.class})
|
||||||
|
|
||||||
if(Meteor.userId() === current.creator ||
|
if(Meteor.userId() === current.creator ||
|
||||||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
||||||
currClass.banned.indexOf(Meteor.userId()) !== -1
|
currClass.banned.indexOf(Meteor.userId()) !== -1
|
||||||
@ -317,7 +319,7 @@ Template.main.helpers({
|
|||||||
var current = work.findOne({_id:event.id});
|
var current = work.findOne({_id:event.id});
|
||||||
var date = event.start.format().split("-");
|
var date = event.start.format().split("-");
|
||||||
current.dueDate = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
|
current.dueDate = new Date(date[0],parseInt(date[1])-1,date[2],11,59,59);
|
||||||
Session.set("serverData",current);
|
serverData = current;
|
||||||
sendData("editWork");
|
sendData("editWork");
|
||||||
},
|
},
|
||||||
eventClick: function(event, jsEvent, view) {
|
eventClick: function(event, jsEvent, view) {
|
||||||
@ -332,7 +334,7 @@ Template.main.helpers({
|
|||||||
if(jsEvent.target.className.includes("fc-other-month") || jsEvent.target.className.includes("fc-past")) return;
|
if(jsEvent.target.className.includes("fc-other-month") || jsEvent.target.className.includes("fc-past")) return;
|
||||||
Session.set("calCreWork",true);
|
Session.set("calCreWork",true);
|
||||||
Session.set("calWorkDate",date.format());
|
Session.set("calWorkDate",date.format());
|
||||||
Session.set("sidebar","menuContainer");
|
Session.set("sidebar","menuContainer");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -340,8 +342,13 @@ Template.main.helpers({
|
|||||||
var width = window.innerWidth * 0.85;
|
var width = window.innerWidth * 0.85;
|
||||||
return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;";
|
return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;";
|
||||||
},
|
},
|
||||||
|
<<<<<<< HEAD
|
||||||
calColor() { // Sets the color of the calendar according to theme
|
calColor() { // Sets the color of the calendar according to theme
|
||||||
return "color:"+Session.get("themeColors")[Meteor.user().profile.preferences.theme].calendar;
|
return "color:"+Session.get("themeColors")[Meteor.user().profile.preferences.theme].calendar;
|
||||||
|
=======
|
||||||
|
calColor() {
|
||||||
|
return "color:"+themeColors[Meteor.user().profile.preferences.theme].calendar;
|
||||||
|
>>>>>>> origin/master
|
||||||
},
|
},
|
||||||
calbg() { //Sets size of the calendar
|
calbg() { //Sets size of the calendar
|
||||||
var width = window.innerWidth * 0.865;
|
var width = window.innerWidth * 0.865;
|
||||||
@ -508,14 +515,14 @@ Template.main.events({
|
|||||||
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
if(!Session.get("newWork")) {
|
if(!Session.get("newWork")) {
|
||||||
if(getHomeworkFormData() === null) return;
|
if(getHomeworkFormData() === null) return;
|
||||||
Session.set("serverData",Session.get("currentWork"));
|
serverData = Session.get("currentWork");
|
||||||
sendData("editWork");
|
sendData("editWork");
|
||||||
document.getElementById("workComment").value = "";
|
document.getElementById("workComment").value = "";
|
||||||
}
|
}
|
||||||
Session.set("newWork",null);
|
Session.set("newWork",null);
|
||||||
Session.set("currentWork",null);
|
Session.set("currentWork",null);
|
||||||
Session.set("currentReadableWork",null);
|
Session.set("currentReadableWork",null);
|
||||||
$('.req').css("color","")
|
$('.req').css("color","");
|
||||||
Session.set("commentRestrict",null);
|
Session.set("commentRestrict",null);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -561,7 +568,7 @@ Template.main.events({
|
|||||||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
||||||
currClass.banned.indexOf(Meteor.userId()) !== -1
|
currClass.banned.indexOf(Meteor.userId()) !== -1
|
||||||
)) return;
|
)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ele = event.target;
|
var ele = event.target;
|
||||||
@ -623,7 +630,7 @@ Template.main.events({
|
|||||||
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
||||||
currClass.banned.indexOf(Meteor.userId()) !== -1
|
currClass.banned.indexOf(Meteor.userId()) !== -1
|
||||||
)) return;
|
)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var op = event.target;
|
var op = event.target;
|
||||||
@ -711,7 +718,7 @@ Template.main.events({
|
|||||||
},
|
},
|
||||||
'click #workSubmit' () { // Apples on the work submit button. If the current value, then terminate. Otherwise, create a new work or edit the current piece of work
|
'click #workSubmit' () { // Apples on the work submit button. If the current value, then terminate. Otherwise, create a new work or edit the current piece of work
|
||||||
if(getHomeworkFormData() === null) return;
|
if(getHomeworkFormData() === null) return;
|
||||||
Session.set("serverData",Session.get("currentWork"));
|
serverData = Session.get("currentWork");
|
||||||
if(Session.get("newWork")) {
|
if(Session.get("newWork")) {
|
||||||
sendData("createWork");
|
sendData("createWork");
|
||||||
} else {
|
} else {
|
||||||
@ -741,7 +748,7 @@ Template.main.events({
|
|||||||
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
currClass.moderators.indexOf(Meteor.userId()) !== -1 ||
|
||||||
currClass.banned.indexOf(Meteor.userId()) !== -1)) {
|
currClass.banned.indexOf(Meteor.userId()) !== -1)) {
|
||||||
var inputs = $('#editWork .change').css("cursor","default");
|
var inputs = $('#editWork .change').css("cursor","default");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
@ -783,7 +790,7 @@ Template.main.events({
|
|||||||
array.splice(array.indexOf(classid),1);
|
array.splice(array.indexOf(classid),1);
|
||||||
} else {
|
} else {
|
||||||
array.push(classid);
|
array.push(classid);
|
||||||
}
|
}
|
||||||
Session.set("classDisp",array);
|
Session.set("classDisp",array);
|
||||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
}
|
}
|
||||||
@ -792,7 +799,7 @@ Template.main.events({
|
|||||||
if(event.target.className !== "sideClass") {
|
if(event.target.className !== "sideClass") {
|
||||||
var div = event.target.parentNode;
|
var div = event.target.parentNode;
|
||||||
} else {
|
} else {
|
||||||
var div = event.target;
|
var div = event.target;
|
||||||
}
|
}
|
||||||
while(div.getAttribute("classid") === null) div = div.parentNode;
|
while(div.getAttribute("classid") === null) div = div.parentNode;
|
||||||
var classid = div.getAttribute("classid");
|
var classid = div.getAttribute("classid");
|
||||||
@ -814,15 +821,15 @@ Template.main.events({
|
|||||||
Session.set("commentRestrict", "Characters left: " + (200-chars).toString());
|
Session.set("commentRestrict", "Characters left: " + (200-chars).toString());
|
||||||
},
|
},
|
||||||
'click #markDone' () {
|
'click #markDone' () {
|
||||||
Session.set("serverData", [Session.get("currentWork")._id, "done"])
|
serverData = [Session.get("currentWork")._id, "done"]
|
||||||
sendData("toggleWork");
|
sendData("toggleWork");
|
||||||
},
|
},
|
||||||
'click #markConfirm' () {
|
'click #markConfirm' () {
|
||||||
Session.set("serverData", [Session.get("currentWork")._id, "confirmations"])
|
serverData = [Session.get("currentWork")._id, "confirmations"]
|
||||||
sendData("toggleWork");
|
sendData("toggleWork");
|
||||||
},
|
},
|
||||||
'click #markReport' () {
|
'click #markReport' () {
|
||||||
Session.set("serverData", [Session.get("currentWork")._id, "reports"])
|
serverData = [Session.get("currentWork")._id, "reports"]
|
||||||
sendData("toggleWork");
|
sendData("toggleWork");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -843,7 +850,7 @@ function closeDivFade(div) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendData(funcName) {
|
function sendData(funcName) {
|
||||||
Meteor.call(funcName, Session.get("serverData") , function(err,result) {
|
Meteor.call(funcName, serverData , function(err,result) {
|
||||||
if((funcName === "editWork" || funcName === "createWork") && Session.get("mode") === "calendar") {
|
if((funcName === "editWork" || funcName === "createWork") && Session.get("mode") === "calendar") {
|
||||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
} else if(funcName === "toggleWork") {
|
} else if(funcName === "toggleWork") {
|
||||||
@ -855,7 +862,7 @@ function sendData(funcName) {
|
|||||||
} else if(funcName === "editProfile") {
|
} else if(funcName === "editProfile") {
|
||||||
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
$("#fullcalendar").fullCalendar( 'refetchEvents' );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeInput(sessval) {
|
function closeInput(sessval) {
|
||||||
@ -881,11 +888,11 @@ function closeInput(sessval) {
|
|||||||
Session.set("modifying", null);
|
Session.set("modifying", null);
|
||||||
|
|
||||||
if(Session.equals("sidebar","optionsContainer") || Session.equals("sidebar","both")) {
|
if(Session.equals("sidebar","optionsContainer") || Session.equals("sidebar","both")) {
|
||||||
Session.set("serverData",getPreferencesData());
|
serverData = getPreferencesData();
|
||||||
sendData("editProfile");
|
sendData("editProfile");
|
||||||
} else if(!Session.get("newWork")) {
|
} else if(!Session.get("newWork")) {
|
||||||
if(getHomeworkFormData() === null) return;
|
if(getHomeworkFormData() === null) return;
|
||||||
Session.set("serverData",Session.get("currentWork"));
|
serverData = Session.get("currentWork");
|
||||||
sendData("editWork");
|
sendData("editWork");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,15 +4,13 @@
|
|||||||
|
|
||||||
// Sets up global variables
|
// Sets up global variables
|
||||||
|
|
||||||
Session.set("profInputOpen", null);
|
|
||||||
Session.set("profClassTab", "manClass");
|
Session.set("profClassTab", "manClass");
|
||||||
Session.set("modifying", null);
|
Session.set("modifying", null);
|
||||||
Session.set("notsearching", true);
|
Session.set("notsearching", true);
|
||||||
Session.set("confirm", null);
|
Session.set("confirm", null);
|
||||||
Session.set("serverData", null);
|
|
||||||
Session.set("autocompleteDivs", null);
|
Session.set("autocompleteDivs", null);
|
||||||
Session.set("confirmText", null);
|
Session.set("confirmText", null);
|
||||||
Session.set("selectedClass",null);
|
Session.set("selectedClass",null);
|
||||||
Session.set("selectClassId",null);
|
Session.set("selectClassId",null);
|
||||||
Session.set("code",null);
|
Session.set("code",null);
|
||||||
Session.set("noclass",null);
|
Session.set("noclass",null);
|
||||||
@ -419,7 +417,7 @@ Template.profile.events({
|
|||||||
var attribute = event.target.getAttribute("classid");
|
var attribute = event.target.getAttribute("classid");
|
||||||
}
|
}
|
||||||
var data = [attribute, ""];
|
var data = [attribute, ""];
|
||||||
Session.set("serverData", data);
|
serverData = data;
|
||||||
Session.set("confirm", "joinClass");
|
Session.set("confirm", "joinClass");
|
||||||
Session.set("confirmText", "Join class?");
|
Session.set("confirmText", "Join class?");
|
||||||
|
|
||||||
@ -435,18 +433,18 @@ Template.profile.events({
|
|||||||
var form = document.getElementById("create");
|
var form = document.getElementById("create");
|
||||||
for(var i = 0; i < form.length; i++) form[i].value = "";
|
for(var i = 0; i < form.length; i++) form[i].value = "";
|
||||||
}
|
}
|
||||||
Session.set("serverData", null);
|
serverData = null;
|
||||||
Session.set("confirm", null);
|
Session.set("confirm", null);
|
||||||
},
|
},
|
||||||
'click .fa-times-circle-o' () { // Deny Button
|
'click .fa-times-circle-o' () { // Deny Button
|
||||||
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
Session.set("serverData", null);
|
serverData = null;
|
||||||
Session.set("confirm", null);
|
Session.set("confirm", null);
|
||||||
},
|
},
|
||||||
'click #creSubmit' () { //Submits form data for class
|
'click #creSubmit' () { //Submits form data for class
|
||||||
var data = getCreateFormData();
|
var data = getCreateFormData();
|
||||||
if (data === null) return;
|
if (data === null) return;
|
||||||
Session.set("serverData", data);
|
serverData = data;
|
||||||
Session.set("confirm", "createClass");
|
Session.set("confirm", "createClass");
|
||||||
Session.set("confirmText", "Submit request?");
|
Session.set("confirmText", "Submit request?");
|
||||||
|
|
||||||
@ -478,29 +476,29 @@ Template.profile.events({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var user = Meteor.users.findOne({"services.google.email":value});
|
var user = Meteor.users.findOne({"services.google.email":value});
|
||||||
Session.set("serverData", [
|
serverData = [
|
||||||
user._id,
|
user._id,
|
||||||
classid,
|
classid,
|
||||||
event.target.parentNode.childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
event.target.parentNode.childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
||||||
]);
|
];
|
||||||
sendData("trackUserInClass");
|
sendData("trackUserInClass");
|
||||||
|
|
||||||
},
|
},
|
||||||
'click .classBox .fa-times' (event) { // Leaves a class
|
'click .classBox .fa-times' (event) { // Leaves a class
|
||||||
var box = event.target.parentNode;
|
var box = event.target.parentNode;
|
||||||
var classid = box.getAttribute("classid");
|
var classid = box.getAttribute("classid");
|
||||||
Session.set("serverData", box.getAttribute("classid"));
|
serverData = box.getAttribute("classid");
|
||||||
Session.set("confirm","leaveClass");
|
Session.set("confirm","leaveClass");
|
||||||
Session.set("confirmText", "Leave this class?");
|
Session.set("confirmText", "Leave this class?");
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
},
|
},
|
||||||
'click .userBox .fa-times' (event) { // Removes user from permissions
|
'click .userBox .fa-times' (event) { // Removes user from permissions
|
||||||
var box = event.target.parentNode;
|
var box = event.target.parentNode;
|
||||||
Session.set("serverData", [
|
serverData = [
|
||||||
box.getAttribute("userid"),
|
box.getAttribute("userid"),
|
||||||
document.getElementById("createdClasses").getAttribute("classid"),
|
document.getElementById("createdClasses").getAttribute("classid"),
|
||||||
box.parentNode.parentNode.childNodes[1].childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
box.parentNode.parentNode.childNodes[1].childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
||||||
])
|
];
|
||||||
sendData("untrackUserInClass");
|
sendData("untrackUserInClass");
|
||||||
},
|
},
|
||||||
'click #copy' () { //Copies googlee-classroom style code
|
'click #copy' () { //Copies googlee-classroom style code
|
||||||
@ -509,7 +507,7 @@ Template.profile.events({
|
|||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
},
|
},
|
||||||
'click #deleteClass' () {
|
'click #deleteClass' () {
|
||||||
Session.set("serverData",document.getElementById("createdClasses").getAttribute("classid"));
|
serverData = document.getElementById("createdClasses").getAttribute("classid");
|
||||||
Session.set("confirm", "deleteClass");
|
Session.set("confirm", "deleteClass");
|
||||||
Session.set("confirmText", "Delete this class?");
|
Session.set("confirmText", "Delete this class?");
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
openDivFade(document.getElementsByClassName("overlay")[0]);
|
||||||
@ -538,7 +536,7 @@ Template.profile.events({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var user = Meteor.users.findOne({"services.google.email":value});
|
var user = Meteor.users.findOne({"services.google.email":value});
|
||||||
Session.set("serverData", [user._id,classid]);
|
serverData = [user._id,classid];
|
||||||
Session.set("confirm","changeAdmin");
|
Session.set("confirm","changeAdmin");
|
||||||
Session.set("confirmText", "Are you really sure?");
|
Session.set("confirmText", "Are you really sure?");
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0])
|
openDivFade(document.getElementsByClassName("overlay")[0])
|
||||||
@ -555,7 +553,7 @@ Template.profile.events({
|
|||||||
var input = document.getElementById("privateCode");
|
var input = document.getElementById("privateCode");
|
||||||
var code = input.value;
|
var code = input.value;
|
||||||
input.value = "";
|
input.value = "";
|
||||||
Session.set("serverData", code);
|
serverData = code;
|
||||||
Meteor.call("joinPrivateClass", code, function(error, result) {
|
Meteor.call("joinPrivateClass", code, function(error, result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
document.getElementById("joinPrivClass").style.marginBottom = "-10%";
|
document.getElementById("joinPrivClass").style.marginBottom = "-10%";
|
||||||
@ -597,12 +595,12 @@ function closeInput(sessval) {
|
|||||||
}
|
}
|
||||||
span.style.display = "initial";
|
span.style.display = "initial";
|
||||||
Session.set("modifying", null);
|
Session.set("modifying", null);
|
||||||
Session.set("serverData", getProfileData());
|
serverData = getProfileData();
|
||||||
sendData("editProfile");
|
sendData("editProfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendData(funcName) {
|
function sendData(funcName) {
|
||||||
Meteor.call(funcName, Session.get("serverData"));
|
Meteor.call(funcName, serverData);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfileData() {
|
function getProfileData() {
|
||||||
@ -668,4 +666,4 @@ function checkUser(email,classid) {
|
|||||||
if(classes.findOne({_id:classid}).subscribers)
|
if(classes.findOne({_id:classid}).subscribers)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
hourglass/lib/constants.js
Normal file
29
hourglass/lib/constants.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
themeColors = {
|
||||||
|
"light": {
|
||||||
|
"background": "White.jpg",
|
||||||
|
"header": "#EBEBEB",
|
||||||
|
"sidebar": "#65839A",
|
||||||
|
"funcButton": "#849CAE",
|
||||||
|
"statusIcons": "#33ADFF",
|
||||||
|
"highlightText": "#FF1A1A",
|
||||||
|
"cards": "#FEFEFE",
|
||||||
|
"classes":"#EBEBEB",
|
||||||
|
"calendar": "#000",
|
||||||
|
"text": "#000"
|
||||||
|
},
|
||||||
|
"dark": {
|
||||||
|
"background": "Black.jpg",
|
||||||
|
"header": "#373A56",
|
||||||
|
"sidebar": "#35435D",
|
||||||
|
"funcButton": "#5d75A2",
|
||||||
|
"statusIcons": "#33ADFF",
|
||||||
|
"highlightText": "#FF1A1A",
|
||||||
|
"cards": "#151A2B",
|
||||||
|
"classes":"#46396E",
|
||||||
|
"calendar": "#000",
|
||||||
|
//30313B
|
||||||
|
"text": "#F6F6F6"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
serverData = null;
|
||||||
@ -8,12 +8,12 @@ import {
|
|||||||
|
|
||||||
// Defines who the admins are - not added
|
// Defines who the admins are - not added
|
||||||
|
|
||||||
superadmins = [
|
var superadmins = [
|
||||||
"ybq987@gmail.com",
|
"ybq987@gmail.com",
|
||||||
"ksjdragon@gmail.com"
|
"ksjdragon@gmail.com"
|
||||||
];
|
];
|
||||||
|
|
||||||
worktype = ["test", "quiz", "project", "normal", "other"];
|
var worktype = ["test", "quiz", "project", "normal", "other"];
|
||||||
var possiblelist = ["moderators", "banned"];
|
var possiblelist = ["moderators", "banned"];
|
||||||
|
|
||||||
// Adds roles to superadmins
|
// Adds roles to superadmins
|
||||||
@ -45,7 +45,7 @@ Meteor.publish('classes', function() {
|
|||||||
return classes.find();
|
return classes.find();
|
||||||
} else {
|
} else {
|
||||||
// Return user classes (if private) and public classes.
|
// Return user classes (if private) and public classes.
|
||||||
userclasses = Meteor.users.findOne(this.userId).profile.classes;
|
var userclasses = Meteor.users.findOne(this.userId).profile.classes;
|
||||||
if (userclasses !== undefined) {
|
if (userclasses !== undefined) {
|
||||||
return classes.find({
|
return classes.find({
|
||||||
$or: [{
|
$or: [{
|
||||||
@ -86,7 +86,7 @@ Meteor.publish('work', function() {
|
|||||||
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
||||||
return work.find();
|
return work.find();
|
||||||
} else {
|
} else {
|
||||||
userclasses = Meteor.users.findOne(this.userId).profile.classes;
|
var userclasses = Meteor.users.findOne(this.userId).profile.classes;
|
||||||
if (userclasses !== undefined) {
|
if (userclasses !== undefined) {
|
||||||
return work.find({
|
return work.find({
|
||||||
// Only return work of enrolled classes
|
// Only return work of enrolled classes
|
||||||
@ -142,7 +142,7 @@ Meteor.methods({
|
|||||||
|
|
||||||
//Generates private codes for classes - like google classroom
|
//Generates private codes for classes - like google classroom
|
||||||
'genCode': function() {
|
'genCode': function() {
|
||||||
currcode = Math.random().toString(36).substr(2, 6);
|
var currcode = Math.random().toString(36).substr(2, 6);
|
||||||
while (classes.findOne({
|
while (classes.findOne({
|
||||||
code: currcode
|
code: currcode
|
||||||
}) !== undefined) {
|
}) !== undefined) {
|
||||||
@ -430,11 +430,11 @@ Meteor.methods({
|
|||||||
_id: workobject.class
|
_id: workobject.class
|
||||||
});
|
});
|
||||||
var user = Meteor.userId();
|
var user = Meteor.userId();
|
||||||
foundsubs = currentclass.subscribers;
|
var foundsubs = currentclass.subscribers;
|
||||||
if (typeof comment === "string" && comment.length <= 200 &&
|
if (typeof comment === "string" && comment.length <= 200 &&
|
||||||
foundsubs.indexOf(Meteor.userId()) != -1 &&
|
foundsubs.indexOf(Meteor.userId()) != -1 &&
|
||||||
currentclass.banned.indexOf(Meteor.userId()) === -1) {
|
currentclass.banned.indexOf(Meteor.userId()) === -1) {
|
||||||
commentInfo = {
|
var commentInfo = {
|
||||||
"comment":input[0],
|
"comment":input[0],
|
||||||
"user":user,
|
"user":user,
|
||||||
"date": new Date()
|
"date": new Date()
|
||||||
@ -460,7 +460,7 @@ Meteor.methods({
|
|||||||
_id: workobject.class
|
_id: workobject.class
|
||||||
});
|
});
|
||||||
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
|
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
|
||||||
userindex = workobject[input[1]].indexOf(Meteor.userId());
|
var 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());
|
||||||
if (input[1] === "confirmations" &&
|
if (input[1] === "confirmations" &&
|
||||||
@ -535,7 +535,7 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'createProfile': function(userId) {
|
'createProfile': function(userId) {
|
||||||
current = Meteor.users.findOne({
|
var current = Meteor.users.findOne({
|
||||||
_id: userId
|
_id: userId
|
||||||
}).profile;
|
}).profile;
|
||||||
current.classes = [];
|
current.classes = [];
|
||||||
@ -559,7 +559,7 @@ Meteor.methods({
|
|||||||
found !== null &&
|
found !== null &&
|
||||||
pass === found.code &&
|
pass === found.code &&
|
||||||
prof.classes.indexOf(change) === -1) {
|
prof.classes.indexOf(change) === -1) {
|
||||||
foundsubs = found.subscribers;
|
var foundsubs = found.subscribers;
|
||||||
classes.update({
|
classes.update({
|
||||||
_id: found._id
|
_id: found._id
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user