diff --git a/app/controllers/applications.js b/app/controllers/applications.js index 7bd184d7..9334f2d7 100644 --- a/app/controllers/applications.js +++ b/app/controllers/applications.js @@ -135,6 +135,7 @@ function filterApplications(req, res, cb) { ID: bioApp.userstudentid, FirstName: bioApp.userfname, LastName: bioApp.userlname, + PhoneNumber: bioApp.phonenumber, 'BIO GPA': bioApp.programgpa, Concentration: bioApp.major, 'Expected Graduation': bioApp.expectedGraduationSemester + ' ' + bioApp.expectedGraduationYear, @@ -144,7 +145,7 @@ function filterApplications(req, res, cb) { appArray.push(bioJson); }); - fields = ['ID', 'FirstName', 'LastName', 'BIO GPA', 'Concentration', + fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'BIO GPA', 'Concentration', 'Expected Graduation', 'Semester', 'Year']; cb(null, { @@ -170,6 +171,7 @@ function filterApplications(req, res, cb) { ID: itecApp.userstudentid, FirstName: itecApp.userfname, LastName: itecApp.userlname, + PhoneNumber: itecApp.phonenumber, 'ITEC GPA': itecApp.itecgpa, Concentration: itecApp.major, 'Expected Graduation': itecApp.expectedGraduationSemester + ' ' + itecApp.expectedGraduationYear, @@ -180,7 +182,7 @@ function filterApplications(req, res, cb) { appArray.push(itecJson); }); - fields = ['ID', 'FirstName', 'LastName', 'ITEC GPA', 'Concentration', + fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'ITEC GPA', 'Concentration', 'Expected Graduation', 'Programming', 'Semester', 'Year']; cb(null, { @@ -223,6 +225,7 @@ module.exports.filterApplications = function (req, res) { } } + function write(fileName, csv, req, res) { fs.writeFile(fileName, csv, function (err) { if (err) { @@ -234,6 +237,7 @@ function write(fileName, csv, req, res) { } }); } +//passes in comma seperated file function download(csvPath, req, res) { res.download(csvPath, function (err) { @@ -269,13 +273,19 @@ module.exports.getSpecificBioApplication = function (req, res) { if (err) throw err; Document.getBioDocumentsForUser(bioApp.useremail, function (incomingDocuments) { documents = incomingDocuments; - res.render('applicationdetails.ejs', { - application: bioApp, - documents: documents, - user: req.user, - successMessage: req.flash('success'), - failureMessage: req.flash('failure') - }); + User.findOne({_id: req.user._id}, function(err, user) { + if (err) { + throw err; + } + res.render('applicationdetails.ejs', { + application: bioApp, + documents: documents, + user: user, + // userPhoneNumber: user.local.phone, + successMessage: req.flash('success'), + failureMessage: req.flash('failure') + }); + }) }); }); }; @@ -293,13 +303,19 @@ module.exports.getSpecificItecApplication = function (req, res) { if (err) throw err; Document.getItecDocumentsForUser(itecApp.useremail, function (incomingDocuments) { documents = incomingDocuments; - res.render('applicationdetails.ejs', { - application: itecApp, - documents: documents, - user: req.user, - successMessage: req.flash('success'), - failureMessage: req.flash('failure') - }); + User.findOne({_id: req.user._id}, function(err, user) { + if (err) { + throw err; + } + res.render('applicationdetails.ejs', { + application: itecApp, + documents: documents, + user: user, + // userPhoneNumber: user.local.phone, + successMessage: req.flash('success'), + failureMessage: req.flash('failure') + }); + }) }); }); } @@ -686,6 +702,7 @@ module.exports.postItecApplication = function (req, res) { itecapp.userstudentid = req.user.studentid; itecapp.userfname = req.user.fname; itecapp.userlname = req.user.lname; + itecapp.userphone = req.user.phone; itecapp.useraddress = req.user.address; itecapp.usercity = req.user.city; itecapp.userstate = req.user.state; @@ -718,6 +735,7 @@ module.exports.postBioApplication = function (req, res) { bioapp.userstudentid = req.user.studentid; bioapp.userfname = req.user.fname; bioapp.userlname = req.user.lname; + bioapp.userphone = req.user.phone; bioapp.useraddress = req.user.address; bioapp.usercity = req.user.city; bioapp.userstate = req.user.state; diff --git a/app/controllers/editApplications.js b/app/controllers/editApplications.js index aef057d1..35fdd651 100644 --- a/app/controllers/editApplications.js +++ b/app/controllers/editApplications.js @@ -4,32 +4,45 @@ - Logic for routes: getEditBio, getEditItec, updateBioApp, updateItecApp - Loads the user's submitted bio/itec application and then updates */ - +var User = require('../models/user'); var Bio = require('../models/bio'); var Itec = require('../models/itec'); module.exports.getEditBio = function(req, res) { Bio.getUsersBioApp(req.user.email, function(foundBioApp) { - res.render('editbio', { - application: foundBioApp, - user : req.user, - successMessage: req.flash('success'), - failureMessage: req.flash('failure') - }); + User.findOne({_id: req.user._id}, function(err, user) { + res.render('editbio', { + application: foundBioApp, + user : user, + successMessage: req.flash('success'), + failureMessage: req.flash('failure') + }); + }) }); } module.exports.getEditItec = function(req, res) { Itec.getUsersItecApp(req.user.email, function(foundItecApp) { - res.render('editItec', { - application: foundItecApp, - user : req.user, - successMessage: req.flash('success'), - failureMessage: req.flash('failure') - }); + User.findOne({_id: req.user._id}, function(err, user) { + res.render('editItec', { + application: foundItecApp, + user : user, + successMessage: req.flash('success'), + failureMessage: req.flash('failure') + }); + }) }); } + +module.exports.updateAppStatusItec = function (req, res){ + newItecapp.applicationstatus = oldItecApp.applicationstatusItec; +} + +module.exports.updateAppStatusBio = function (req, res){ + newBioapp.applicationstatus = oldBioApp.applicationstatusBio; +} + module.exports.updateBioApp = function(req, res) { var newBioapp = new Bio(req.body); @@ -37,6 +50,7 @@ module.exports.updateBioApp = function(req, res) { newBioapp.userstudentid = req.user.studentid; newBioapp.userfname = req.user.fname; newBioapp.userlname = req.user.lname; + newBioapp.userphone = req.user.phone; newBioapp.useraddress = req.user.address; newBioapp.usercity = req.user.city; newBioapp.userstate = req.user.state; @@ -68,6 +82,7 @@ module.exports.updateItecApp = function(req, res) { newItecapp.userstudentid = req.user.studentid; newItecapp.userfname = req.user.fname; newItecapp.userlname = req.user.lname; + newItecapp.userphone = req.user.phone; newItecapp.useraddress = req.user.address; newItecapp.usercity = req.user.city; newItecapp.userstate = req.user.state; diff --git a/app/controllers/editprofile.js b/app/controllers/editprofile.js index 76b5ab03..3e8278f5 100644 --- a/app/controllers/editprofile.js +++ b/app/controllers/editprofile.js @@ -29,6 +29,7 @@ module.exports.getEditProfile = function(req, res) { HTTP Req: POST URL: '/editprofile' */ + module.exports.updateProfile = function(req, res) { User.update({'local.email' : req.user.email}, { 'local.studentid' : req.body.studentid, @@ -38,7 +39,8 @@ module.exports.updateProfile = function(req, res) { 'local.city' : req.body.city, 'local.state' : req.body.state, 'local.zipcode' : req.body.zipcode, - 'local.discipline' : req.body.discipline + 'local.discipline' : req.body.discipline, + 'local.phone' : req.body.phone }, function(err) { if (err) { res.flash('failure', 'An error has occured, your profile could not be updated.'); diff --git a/app/controllers/export.js b/app/controllers/export.js index 0ed66564..ffc75227 100644 --- a/app/controllers/export.js +++ b/app/controllers/export.js @@ -124,6 +124,7 @@ module.exports.exportExport = function (req, res) { ID: bioApp.userstudentid, FirstName: bioApp.userfname, LastName: bioApp.userlname, + PhoneNumber: bioApp.userphone, 'BIO GPA': bioApp.programgpa, Concentration: bioApp.major, 'Expected Graduation': bioApp.expectedGraduationSemester + ' ' + bioApp.expectedGraduationYear, @@ -133,7 +134,7 @@ module.exports.exportExport = function (req, res) { appArray.push(bioJson); }); - fields = ['ID', 'FirstName', 'LastName', 'BIO GPA', 'Concentration', + fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'BIO GPA', 'Concentration', 'Expected Graduation', 'Semester', 'Year']; var csv = json2csv({ data: appArray, fields: fields }); @@ -155,6 +156,7 @@ module.exports.exportExport = function (req, res) { ID: itecApp.userstudentid, FirstName: itecApp.userfname, LastName: itecApp.userlname, + PhoneNumber: itecApp.userphone, 'ITEC GPA': itecApp.itecgpa, Concentration: itecApp.major, 'Expected Graduation': itecApp.expectedGraduationSemester + ' ' + itecApp.expectedGraduationYear, @@ -165,7 +167,7 @@ module.exports.exportExport = function (req, res) { appArray.push(itecJson); }); - fields = ['ID', 'FirstName', 'LastName', 'ITEC GPA', 'Concentration', + fields = ['ID', 'FirstName', 'LastName', 'PhoneNumber', 'ITEC GPA', 'Concentration', 'Expected Graduation', 'Programming', 'Semester', 'Year']; var csv = json2csv({ data: appArray, fields: fields }); @@ -531,6 +533,7 @@ module.exports.postItecApplication = function (req, res) { itecapp.userstudentid = req.user.studentid; itecapp.userfname = req.user.fname; itecapp.userlname = req.user.lname; + itecapp.userphone = req.user.phone; itecapp.useraddress = req.user.address; itecapp.usercity = req.user.city; itecapp.userstate = req.user.state; @@ -563,6 +566,7 @@ module.exports.postBioApplication = function (req, res) { bioapp.userstudentid = req.user.studentid; bioapp.userfname = req.user.fname; bioapp.userlname = req.user.lname; + bioapp.userphone = req.user.phone; bioapp.useraddress = req.user.address; bioapp.usercity = req.user.city; bioapp.userstate = req.user.state; diff --git a/app/controllers/support.js b/app/controllers/support.js new file mode 100644 index 00000000..f9c63cbc --- /dev/null +++ b/app/controllers/support.js @@ -0,0 +1,18 @@ +/* + Controller functions containing the logic for the support routes + Authors : Matthew Rosario +*/ + +/* + HTTP Req: GET + URL: '/support' +*/ +module.exports.getSupport = function(req, res) { + if (req.isAuthenticated()) { + res.render('support.ejs', { + user: req.user + }); + } else { + res.render('support.ejs'); + } +}; \ No newline at end of file diff --git a/app/models/bio.js b/app/models/bio.js index dd2e6c9e..0245d987 100644 --- a/app/models/bio.js +++ b/app/models/bio.js @@ -11,7 +11,7 @@ var bioSchema = mongoose.Schema({ }, phonenumber: { type: String, - required: false + required: true }, emergencycontactname: { type: String, @@ -213,6 +213,10 @@ var bioSchema = mongoose.Schema({ type: String, required: false }, + userphone: { + type: String, + required: false + }, useraddress: { type: String, required: false diff --git a/app/models/document.js b/app/models/document.js index d2d1272f..bf3004eb 100644 --- a/app/models/document.js +++ b/app/models/document.js @@ -1,5 +1,6 @@ var mongoose = require('mongoose'); + var documentSchema = mongoose.Schema({ user: { user_id : { diff --git a/app/models/itec.js b/app/models/itec.js index 2f515c61..d90cc6ac 100644 --- a/app/models/itec.js +++ b/app/models/itec.js @@ -23,7 +23,7 @@ var itecSchema = mongoose.Schema({ }, phonenumber: { type: String, - required: false + required: true }, classification: { type: String, @@ -175,6 +175,10 @@ var itecSchema = mongoose.Schema({ type: String, required: false }, + userphone: { + type: String, + required: false + }, useraddress: { type: String, required: false diff --git a/app/models/user.js b/app/models/user.js index 27d8c4b1..6e62738e 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -39,6 +39,10 @@ var userSchema = mongoose.Schema({ type: String, required: true }, + phone: { + type: String, + required: true + }, address: { type: String, required: true diff --git a/app/routes/index.js b/app/routes/index.js index 29bd65b9..ef5a959c 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -24,6 +24,8 @@ var ctrlMongoToCsv = require('../controllers/mongoToCsv'); var ctrlUpload = require('../controllers/documentUpload'); var ctrlDelete = require('../controllers/documentDelete'); var ctrlSiteNotes = require('../controllers/sitenotes'); +var ctrlSupport = require('../controllers/support'); + @@ -187,10 +189,10 @@ module.exports = function (app, passport) { app.get('/site/contacts/:siteid/:documentid', isLoggedIn, isAdminOrInstructor, ctrlSites.deleteSiteContact); app.get('/site/edit/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.getSiteToEdit); app.get('/site/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.getSiteDetails); - app.post('/addSite', isLoggedIn, isAdmin, ctrlSites.postAddSite); + app.post('/addSite', isLoggedIn, isAdminOrInstructor, ctrlSites.postAddSite); app.post('/site/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.addSiteContact); - app.post('/site/edit/:siteid', isLoggedIn, isAdmin, ctrlSites.updateSite); - app.post('/site/delete/:siteid', isLoggedIn, isAdmin, ctrlSites.deleteSite); + app.post('/site/edit/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.updateSite); + app.post('/site/delete/:siteid', isLoggedIn, isAdminOrInstructor, ctrlSites.deleteSite); app.get('/site/:siteId/export/contacts', makeCSVDirectory, isLoggedIn, isAdminOrInstructor, ctrlSites.exportContacts); /* Promote page */ @@ -204,6 +206,9 @@ module.exports = function (app, passport) { /* FAQ page */ app.get('/faq', ctrlFAQ.getFAQ); + /* Support Page */ + app.get('/support', ctrlSupport.getSupport); + /* Help page */ app.get('/help', ctrlHelp.getHelp); app.get('/admininstructorhelp', ctrlHelp.getAdminInstructorHelp); diff --git a/config/passport.js b/config/passport.js index e3c178e5..5f8aa062 100644 --- a/config/passport.js +++ b/config/passport.js @@ -23,6 +23,7 @@ var User = require('../app/models/user'); studentid: user.local.studentid, fname: user.local.fname, lname: user.local.lname, + phone: user.local.phone, address: user.local.address, city: user.local.city, state: user.local.state, @@ -83,6 +84,7 @@ var User = require('../app/models/user'); newUser.local.studentid = req.body.studentid; newUser.local.fname = req.body.fname; newUser.local.lname = req.body.lname; + newUser.local.phone = req.body.phone; newUser.local.address = req.body.address; newUser.local.city = req.body.city; newUser.local.state = req.body.state; diff --git a/development/css/main.css b/development/css/main.css index 70f9561f..16b3d375 100644 --- a/development/css/main.css +++ b/development/css/main.css @@ -15,7 +15,7 @@ body { .scrollable { overflow-y: scroll; height: 100px; - resize: none; /* Remove this if you want the user to resize the textarea */ + resize: none; /*Remove this if you want the user to resize the textarea */ } .otherLabel { diff --git a/documentation/fall2021/Client_Requirements.docx b/documentation/fall2021/Client_Requirements.docx index 5c8466fb..53a88804 100644 Binary files a/documentation/fall2021/Client_Requirements.docx and b/documentation/fall2021/Client_Requirements.docx differ diff --git a/documentation/fall2021/InternApp-fall-2021-IP-agreement.pdf b/documentation/fall2021/InternApp-fall-2021-IP-agreement.pdf new file mode 100644 index 00000000..578028ba Binary files /dev/null and b/documentation/fall2021/InternApp-fall-2021-IP-agreement.pdf differ diff --git a/documentation/fall2021/~$ient_Requirements.docx b/documentation/fall2021/~$ient_Requirements.docx new file mode 100644 index 00000000..646773bb Binary files /dev/null and b/documentation/fall2021/~$ient_Requirements.docx differ diff --git a/package-lock.json b/package-lock.json index 8852c1c5..4d02e9df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2845,8 +2845,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3055,14 +3054,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3081,7 +3078,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3182,7 +3178,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -3268,8 +3263,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -3325,7 +3319,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3369,14 +3362,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/server.js b/server.js index 97e7624f..1d985c5b 100644 --- a/server.js +++ b/server.js @@ -2,6 +2,7 @@ // set up ====================================================================== // get all the tools we need +var fs = require('fs'); var express = require('express'); var app = express(); var path = require('path'); diff --git a/views/.vs/ProjectSettings.json b/views/.vs/ProjectSettings.json deleted file mode 100644 index f8b48885..00000000 --- a/views/.vs/ProjectSettings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "CurrentProjectSetting": null -} \ No newline at end of file diff --git a/views/.vs/VSWorkspaceState.json b/views/.vs/VSWorkspaceState.json deleted file mode 100644 index 8d395b47..00000000 --- a/views/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ExpandedNodes": [ - "" - ], - "SelectedNode": "\\home.ejs", - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/views/.vs/config/applicationhost.config b/views/.vs/config/applicationhost.config deleted file mode 100644 index 5441f24f..00000000 --- a/views/.vs/config/applicationhost.config +++ /dev/null @@ -1,1022 +0,0 @@ - - - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/views/.vs/slnx.sqlite b/views/.vs/slnx.sqlite deleted file mode 100644 index eab3be06..00000000 Binary files a/views/.vs/slnx.sqlite and /dev/null differ diff --git a/views/.vs/views/v15/.suo b/views/.vs/views/v15/.suo deleted file mode 100644 index 69e338d7..00000000 Binary files a/views/.vs/views/v15/.suo and /dev/null differ diff --git a/views/adminhome.ejs b/views/adminhome.ejs index 355b34bf..36ebb578 100644 --- a/views/adminhome.ejs +++ b/views/adminhome.ejs @@ -22,7 +22,7 @@
- +
diff --git a/views/applications.ejs b/views/applications.ejs index 3676a753..c1700472 100644 --- a/views/applications.ejs +++ b/views/applications.ejs @@ -35,7 +35,7 @@ a.three:hover {font-size:150%;}

Select your filters

- +
@@ -137,11 +137,9 @@ a.three:hover {font-size:150%;} Student ID Major Application Status - Program Proposed Semester Year Expected Graduation View Details - Delete Record @@ -174,9 +172,6 @@ a.three:hover {font-size:150%;} <%= application.applicationstatus %> - - <%= application.userdiscipline %> - <%= application.proposedinternsemester + " " + application.proposedinternyear %> @@ -187,18 +182,12 @@ a.three:hover {font-size:150%;} - - - - <% }); %>
- -


@@ -237,6 +226,7 @@ a.three:hover {font-size:150%;} } +