├── data
├── mongod.lock
├── WiredTiger.lock
├── WiredTiger
├── storage.bson
├── WiredTiger.wt
├── _mdb_catalog.wt
├── sizeStorer.wt
├── WiredTigerLAS.wt
├── index-1--8932423520697425361.wt
├── index-3--8932423520697425361.wt
├── collection-0--8932423520697425361.wt
├── collection-2--8932423520697425361.wt
├── diagnostic.data
│ └── metrics.2016-03-23T17-37-22Z-00000
└── WiredTiger.turtle
├── helpers
└── date.js
├── middlewares
├── auth.js
└── users.js
├── tests
├── helpers
│ └── date.js
├── ui
│ └── homepage.js
├── integration
│ └── loading.js
├── middlewares
│ ├── auth.js
│ └── users.js
├── controllers
│ └── comments.js
└── models
│ └── comment.js
├── views
├── index.jade
├── error.jade
├── layout.jade
├── exams
│ ├── exam_submit.jade
│ ├── performance.jade
│ ├── question_list.jade
│ ├── take_exam_code_entry.jade
│ ├── view_performance_code_entry.jade
│ ├── new.jade
│ ├── new_question.jade
│ └── take_exam.jade
├── faculties
│ ├── home.jade
│ ├── get_username_edit.jade
│ ├── get_username_delete.jade
│ ├── assign.jade
│ ├── unassign.jade
│ ├── edit.jade
│ └── new.jade
├── welcome.jade
├── students
│ ├── home.jade
│ ├── get_username_edit.jade
│ ├── get_username_delete.jade
│ ├── register.jade
│ ├── deregister.jade
│ ├── new.jade
│ └── edit.jade
├── courses
│ ├── get_courseid_edit.jade
│ ├── get_courseid_delete.jade
│ ├── new.jade
│ └── edit.jade
├── login.jade
└── admin
│ └── home.jade
├── Test Report.docx
├── SRS_Version_1.2.pdf
├── public
├── stylesheets
│ ├── assets
│ │ ├── ico
│ │ │ ├── favicon.png
│ │ │ ├── apple-touch-icon-57-precomposed.png
│ │ │ ├── apple-touch-icon-72-precomposed.png
│ │ │ ├── apple-touch-icon-114-precomposed.png
│ │ │ └── apple-touch-icon-144-precomposed.png
│ │ ├── img
│ │ │ └── backgrounds
│ │ │ │ ├── 1.jpg
│ │ │ │ ├── 2.jpg
│ │ │ │ ├── 3.jpg
│ │ │ │ ├── 1@2x.jpg
│ │ │ │ ├── 2@2x.jpg
│ │ │ │ └── 3@2x.jpg
│ │ ├── js
│ │ │ ├── placeholder.js
│ │ │ ├── scripts.js
│ │ │ ├── jquery.backstretch.min.js
│ │ │ └── jquery.backstretch.js
│ │ ├── font-awesome
│ │ │ ├── fonts
│ │ │ │ ├── FontAwesome.otf
│ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ ├── fontawesome-webfont.woff
│ │ │ │ └── fontawesome-webfont.woff2
│ │ │ ├── less
│ │ │ │ ├── fixed-width.less
│ │ │ │ ├── bordered-pulled.less
│ │ │ │ ├── larger.less
│ │ │ │ ├── list.less
│ │ │ │ ├── font-awesome.less
│ │ │ │ ├── core.less
│ │ │ │ ├── stacked.less
│ │ │ │ ├── rotated-flipped.less
│ │ │ │ ├── path.less
│ │ │ │ ├── animated.less
│ │ │ │ └── mixins.less
│ │ │ └── scss
│ │ │ │ ├── _fixed-width.scss
│ │ │ │ ├── _bordered-pulled.scss
│ │ │ │ ├── _larger.scss
│ │ │ │ ├── _list.scss
│ │ │ │ ├── font-awesome.scss
│ │ │ │ ├── _core.scss
│ │ │ │ ├── _stacked.scss
│ │ │ │ ├── _rotated-flipped.scss
│ │ │ │ ├── _path.scss
│ │ │ │ ├── _animated.scss
│ │ │ │ └── _mixins.scss
│ │ ├── bootstrap
│ │ │ ├── fonts
│ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ ├── js
│ │ │ │ └── npm.js
│ │ │ └── css
│ │ │ │ ├── font.css
│ │ │ │ └── bootstrap-theme.min.css
│ │ └── css
│ │ │ ├── form-elements.css
│ │ │ └── style.css
│ └── style.css
└── javascripts
│ ├── display.js
│ └── question_list.js
├── controllers
├── index.js
├── admin.js
├── login_controller.js
├── courses.js
├── make_exam_controller.js
├── take_exam_controller.js
├── faculties.js
└── students.js
├── models
├── admin.js
├── course.js
├── exam.js
├── faculty.js
└── student.js
├── package.json
├── bin
└── www
├── README.md
├── config
└── passport.js
└── app.js
/data/mongod.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/helpers/date.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/middlewares/auth.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/middlewares/users.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/helpers/date.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/ui/homepage.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/integration/loading.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/middlewares/auth.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/middlewares/users.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/controllers/comments.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/data/WiredTiger.lock:
--------------------------------------------------------------------------------
1 | WiredTiger lock file
2 |
--------------------------------------------------------------------------------
/data/WiredTiger:
--------------------------------------------------------------------------------
1 | WiredTiger
2 | WiredTiger 2.7.1: (December 8, 2015)
3 |
--------------------------------------------------------------------------------
/views/index.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= "This is the index page"
5 |
--------------------------------------------------------------------------------
/Test Report.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/Test Report.docx
--------------------------------------------------------------------------------
/data/storage.bson:
--------------------------------------------------------------------------------
1 | _ storage Q engine wiredTiger options , directoryPerDB directoryForIndexes
--------------------------------------------------------------------------------
/SRS_Version_1.2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/SRS_Version_1.2.pdf
--------------------------------------------------------------------------------
/data/WiredTiger.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/WiredTiger.wt
--------------------------------------------------------------------------------
/data/_mdb_catalog.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/_mdb_catalog.wt
--------------------------------------------------------------------------------
/data/sizeStorer.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/sizeStorer.wt
--------------------------------------------------------------------------------
/data/WiredTigerLAS.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/WiredTigerLAS.wt
--------------------------------------------------------------------------------
/views/error.jade:
--------------------------------------------------------------------------------
1 | extends layout
2 |
3 | block content
4 | h1= message
5 | h2= error.status
6 | pre #{error.stack}
7 |
--------------------------------------------------------------------------------
/data/index-1--8932423520697425361.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/index-1--8932423520697425361.wt
--------------------------------------------------------------------------------
/data/index-3--8932423520697425361.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/index-3--8932423520697425361.wt
--------------------------------------------------------------------------------
/data/collection-0--8932423520697425361.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/collection-0--8932423520697425361.wt
--------------------------------------------------------------------------------
/data/collection-2--8932423520697425361.wt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/collection-2--8932423520697425361.wt
--------------------------------------------------------------------------------
/public/stylesheets/assets/ico/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/ico/favicon.png
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/1.jpg
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/2.jpg
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/3.jpg
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/1@2x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/1@2x.jpg
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/2@2x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/2@2x.jpg
--------------------------------------------------------------------------------
/public/stylesheets/assets/img/backgrounds/3@2x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/img/backgrounds/3@2x.jpg
--------------------------------------------------------------------------------
/data/diagnostic.data/metrics.2016-03-23T17-37-22Z-00000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/data/diagnostic.data/metrics.2016-03-23T17-37-22Z-00000
--------------------------------------------------------------------------------
/public/stylesheets/assets/js/placeholder.js:
--------------------------------------------------------------------------------
1 |
2 | $(document).ready(function(){
3 |
4 | $(".form-username").val("Username...");
5 | $(".form-password").val("Password...");
6 |
7 | });
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/controllers/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | , router = express.Router()
3 |
4 | router.get('/', function(req, res) {
5 | res.render('welcome');
6 | })
7 |
8 | module.exports = router
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/fixed-width.less:
--------------------------------------------------------------------------------
1 | // Fixed Width Icons
2 | // -------------------------
3 | .@{fa-css-prefix}-fw {
4 | width: (18em / 14);
5 | text-align: center;
6 | }
7 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_fixed-width.scss:
--------------------------------------------------------------------------------
1 | // Fixed Width Icons
2 | // -------------------------
3 | .#{$fa-css-prefix}-fw {
4 | width: (18em / 14);
5 | text-align: center;
6 | }
7 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/ico/apple-touch-icon-57-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/ico/apple-touch-icon-57-precomposed.png
--------------------------------------------------------------------------------
/public/stylesheets/assets/ico/apple-touch-icon-72-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/ico/apple-touch-icon-72-precomposed.png
--------------------------------------------------------------------------------
/public/stylesheets/assets/ico/apple-touch-icon-114-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/ico/apple-touch-icon-114-precomposed.png
--------------------------------------------------------------------------------
/public/stylesheets/assets/ico/apple-touch-icon-144-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/ico/apple-touch-icon-144-precomposed.png
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/font-awesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/annuay/online-objective-examination-system/HEAD/public/stylesheets/assets/bootstrap/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/views/layout.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | title= title
5 | link(rel='stylesheet', href='/stylesheets/style.css')
6 | body
7 | block content
8 | script(src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js')
9 |
10 |
--------------------------------------------------------------------------------
/tests/models/comment.js:
--------------------------------------------------------------------------------
1 | should = require('should')
2 |
3 | Comment = require('../../models/comment')
4 |
5 | describe('Model Comment', function() {
6 |
7 | it('get', function(done) {
8 | var id = '5678'
9 |
10 | Comment.get(id, function(err, comment) {
11 | comment.id.should.eql(id)
12 | done()
13 | })
14 | })
15 |
16 | })
--------------------------------------------------------------------------------
/models/admin.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | var monk = require('monk');
5 | var db = monk('localhost:27017/examdb');
6 | var admin_collection = db.get('admin');
7 |
8 | module.exports = {
9 |
10 | findByUserName: function(username, cb) {
11 | admin_collection.findOne({username: username}, cb);
12 | },
13 |
14 | };
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/bordered-pulled.less:
--------------------------------------------------------------------------------
1 | // Bordered & Pulled
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-border {
5 | padding: .2em .25em .15em;
6 | border: solid .08em @fa-border-color;
7 | border-radius: .1em;
8 | }
9 |
10 | .pull-right { float: right; }
11 | .pull-left { float: left; }
12 |
13 | .@{fa-css-prefix} {
14 | &.pull-left { margin-right: .3em; }
15 | &.pull-right { margin-left: .3em; }
16 | }
17 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_bordered-pulled.scss:
--------------------------------------------------------------------------------
1 | // Bordered & Pulled
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-border {
5 | padding: .2em .25em .15em;
6 | border: solid .08em $fa-border-color;
7 | border-radius: .1em;
8 | }
9 |
10 | .pull-right { float: right; }
11 | .pull-left { float: left; }
12 |
13 | .#{$fa-css-prefix} {
14 | &.pull-left { margin-right: .3em; }
15 | &.pull-right { margin-left: .3em; }
16 | }
17 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/larger.less:
--------------------------------------------------------------------------------
1 | // Icon Sizes
2 | // -------------------------
3 |
4 | /* makes the font 33% larger relative to the icon container */
5 | .@{fa-css-prefix}-lg {
6 | font-size: (4em / 3);
7 | line-height: (3em / 4);
8 | vertical-align: -15%;
9 | }
10 | .@{fa-css-prefix}-2x { font-size: 2em; }
11 | .@{fa-css-prefix}-3x { font-size: 3em; }
12 | .@{fa-css-prefix}-4x { font-size: 4em; }
13 | .@{fa-css-prefix}-5x { font-size: 5em; }
14 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_larger.scss:
--------------------------------------------------------------------------------
1 | // Icon Sizes
2 | // -------------------------
3 |
4 | /* makes the font 33% larger relative to the icon container */
5 | .#{$fa-css-prefix}-lg {
6 | font-size: (4em / 3);
7 | line-height: (3em / 4);
8 | vertical-align: -15%;
9 | }
10 | .#{$fa-css-prefix}-2x { font-size: 2em; }
11 | .#{$fa-css-prefix}-3x { font-size: 3em; }
12 | .#{$fa-css-prefix}-4x { font-size: 4em; }
13 | .#{$fa-css-prefix}-5x { font-size: 5em; }
14 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/list.less:
--------------------------------------------------------------------------------
1 | // List Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-ul {
5 | padding-left: 0;
6 | margin-left: @fa-li-width;
7 | list-style-type: none;
8 | > li { position: relative; }
9 | }
10 | .@{fa-css-prefix}-li {
11 | position: absolute;
12 | left: -@fa-li-width;
13 | width: @fa-li-width;
14 | top: (2em / 14);
15 | text-align: center;
16 | &.@{fa-css-prefix}-lg {
17 | left: (-@fa-li-width + (4em / 14));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_list.scss:
--------------------------------------------------------------------------------
1 | // List Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-ul {
5 | padding-left: 0;
6 | margin-left: $fa-li-width;
7 | list-style-type: none;
8 | > li { position: relative; }
9 | }
10 | .#{$fa-css-prefix}-li {
11 | position: absolute;
12 | left: -$fa-li-width;
13 | width: $fa-li-width;
14 | top: (2em / 14);
15 | text-align: center;
16 | &.#{$fa-css-prefix}-lg {
17 | left: -$fa-li-width + (4em / 14);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/font-awesome.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 | */
5 |
6 | @import "variables";
7 | @import "mixins";
8 | @import "path";
9 | @import "core";
10 | @import "larger";
11 | @import "fixed-width";
12 | @import "list";
13 | @import "bordered-pulled";
14 | @import "animated";
15 | @import "rotated-flipped";
16 | @import "stacked";
17 | @import "icons";
18 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/bootstrap/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/font-awesome.less:
--------------------------------------------------------------------------------
1 | /*!
2 | * Font Awesome 4.3.0 by @davegandy - http://fontawesome.io - @fontawesome
3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 | */
5 |
6 | @import "variables.less";
7 | @import "mixins.less";
8 | @import "path.less";
9 | @import "core.less";
10 | @import "larger.less";
11 | @import "fixed-width.less";
12 | @import "list.less";
13 | @import "bordered-pulled.less";
14 | @import "animated.less";
15 | @import "rotated-flipped.less";
16 | @import "stacked.less";
17 | @import "icons.less";
18 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/core.less:
--------------------------------------------------------------------------------
1 | // Base Class Definition
2 | // -------------------------
3 |
4 | .@{fa-css-prefix} {
5 | display: inline-block;
6 | font: normal normal normal @fa-font-size-base/1 FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 | transform: translate(0, 0); // ensures no half-pixel rendering in firefox
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/stacked.less:
--------------------------------------------------------------------------------
1 | // Stacked Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-stack {
5 | position: relative;
6 | display: inline-block;
7 | width: 2em;
8 | height: 2em;
9 | line-height: 2em;
10 | vertical-align: middle;
11 | }
12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x {
13 | position: absolute;
14 | left: 0;
15 | width: 100%;
16 | text-align: center;
17 | }
18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; }
19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; }
20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; }
21 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_core.scss:
--------------------------------------------------------------------------------
1 | // Base Class Definition
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix} {
5 | display: inline-block;
6 | font: normal normal normal #{$fa-font-size-base}/1 FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 | transform: translate(0, 0); // ensures no half-pixel rendering in firefox
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_stacked.scss:
--------------------------------------------------------------------------------
1 | // Stacked Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-stack {
5 | position: relative;
6 | display: inline-block;
7 | width: 2em;
8 | height: 2em;
9 | line-height: 2em;
10 | vertical-align: middle;
11 | }
12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x {
13 | position: absolute;
14 | left: 0;
15 | width: 100%;
16 | text-align: center;
17 | }
18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; }
19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; }
20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; }
21 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "online_exam",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "node ./bin/www"
7 | },
8 | "dependencies": {
9 | "bcrypt-nodejs": "latest",
10 | "body-parser": "~1.13.2",
11 | "connect-flash": "~0.1.1",
12 | "cookie-parser": "~1.3.5",
13 | "debug": "~2.2.0",
14 | "express": "~4.13.1",
15 | "express-session": "~1.0.0",
16 | "jade": "~1.11.0",
17 | "method-override": "~1.0.0",
18 | "mongodb": "^1.4.40",
19 | "monk": "~1.0.1",
20 | "morgan": "~1.6.1",
21 | "passport": "~0.1.17",
22 | "passport-local": "~0.1.6",
23 | "serve-favicon": "~2.3.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/controllers/admin.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | , router = express.Router()
3 | , Admin = require('../models/admin');
4 |
5 | router.get('/home', isLoggedIn, function(req, res) {
6 | res.render('admin/home', { title: 'Options'});
7 | });
8 |
9 | router.get('/logout', function(req, res) {
10 | req.logout();
11 | res.redirect('/');
12 | });
13 |
14 | module.exports = router;
15 |
16 | function isLoggedIn(req, res, next) {
17 |
18 | // if user is authenticated in the session, carry on
19 | if (req.isAuthenticated()&&req.user.usertype=='admin')
20 | {return next();}
21 |
22 | // if they aren't redirect them to the home page
23 | res.redirect('/');
24 | }
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/rotated-flipped.less:
--------------------------------------------------------------------------------
1 | // Rotated & Flipped Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); }
5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); }
6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); }
7 |
8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); }
9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); }
10 |
11 | // Hook for IE8-9
12 | // -------------------------
13 |
14 | :root .@{fa-css-prefix}-rotate-90,
15 | :root .@{fa-css-prefix}-rotate-180,
16 | :root .@{fa-css-prefix}-rotate-270,
17 | :root .@{fa-css-prefix}-flip-horizontal,
18 | :root .@{fa-css-prefix}-flip-vertical {
19 | filter: none;
20 | }
21 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_rotated-flipped.scss:
--------------------------------------------------------------------------------
1 | // Rotated & Flipped Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); }
5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); }
6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); }
7 |
8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); }
9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); }
10 |
11 | // Hook for IE8-9
12 | // -------------------------
13 |
14 | :root .#{$fa-css-prefix}-rotate-90,
15 | :root .#{$fa-css-prefix}-rotate-180,
16 | :root .#{$fa-css-prefix}-rotate-270,
17 | :root .#{$fa-css-prefix}-flip-horizontal,
18 | :root .#{$fa-css-prefix}-flip-vertical {
19 | filter: none;
20 | }
21 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/path.less:
--------------------------------------------------------------------------------
1 | /* FONT PATH
2 | * -------------------------- */
3 |
4 | @font-face {
5 | font-family: 'FontAwesome';
6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}');
7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'),
8 | url('@{fa-font-path}/fontawesome-webfont.woff2?v=@{fa-version}') format('woff2'),
9 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'),
10 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'),
11 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg');
12 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_path.scss:
--------------------------------------------------------------------------------
1 | /* FONT PATH
2 | * -------------------------- */
3 |
4 | @font-face {
5 | font-family: 'FontAwesome';
6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}');
7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'),
8 | url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'),
9 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'),
10 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'),
11 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg');
12 | // src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/animated.less:
--------------------------------------------------------------------------------
1 | // Animated Icons
2 | // --------------------------
3 |
4 | .@{fa-css-prefix}-spin {
5 | -webkit-animation: fa-spin 2s infinite linear;
6 | animation: fa-spin 2s infinite linear;
7 | }
8 |
9 | .@{fa-css-prefix}-pulse {
10 | -webkit-animation: fa-spin 1s infinite steps(8);
11 | animation: fa-spin 1s infinite steps(8);
12 | }
13 |
14 | @-webkit-keyframes fa-spin {
15 | 0% {
16 | -webkit-transform: rotate(0deg);
17 | transform: rotate(0deg);
18 | }
19 | 100% {
20 | -webkit-transform: rotate(359deg);
21 | transform: rotate(359deg);
22 | }
23 | }
24 |
25 | @keyframes fa-spin {
26 | 0% {
27 | -webkit-transform: rotate(0deg);
28 | transform: rotate(0deg);
29 | }
30 | 100% {
31 | -webkit-transform: rotate(359deg);
32 | transform: rotate(359deg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_animated.scss:
--------------------------------------------------------------------------------
1 | // Spinning Icons
2 | // --------------------------
3 |
4 | .#{$fa-css-prefix}-spin {
5 | -webkit-animation: fa-spin 2s infinite linear;
6 | animation: fa-spin 2s infinite linear;
7 | }
8 |
9 | .#{$fa-css-prefix}-pulse {
10 | -webkit-animation: fa-spin 1s infinite steps(8);
11 | animation: fa-spin 1s infinite steps(8);
12 | }
13 |
14 | @-webkit-keyframes fa-spin {
15 | 0% {
16 | -webkit-transform: rotate(0deg);
17 | transform: rotate(0deg);
18 | }
19 | 100% {
20 | -webkit-transform: rotate(359deg);
21 | transform: rotate(359deg);
22 | }
23 | }
24 |
25 | @keyframes fa-spin {
26 | 0% {
27 | -webkit-transform: rotate(0deg);
28 | transform: rotate(0deg);
29 | }
30 | 100% {
31 | -webkit-transform: rotate(359deg);
32 | transform: rotate(359deg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/data/WiredTiger.turtle:
--------------------------------------------------------------------------------
1 | WiredTiger version string
2 | WiredTiger 2.7.1: (December 8, 2015)
3 | WiredTiger version
4 | major=2,minor=7,patch=1
5 | file:WiredTiger.wt
6 | allocation_size=4KB,app_metadata=,block_allocation=best,block_compressor=,cache_resident=0,checkpoint=(WiredTigerCheckpoint.1=(addr="018281e484aa50188381e40c5855ca808080808080e22fc0e20fc0",order=1,time=1458754679,size=12288,write_gen=2)),checkpoint_lsn=(1,10112),checksum=uncompressed,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,internal_item_max=0,internal_key_max=0,internal_key_truncate=,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=),memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0,prefix_compression_min=4,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=75,value_format=S,version=(major=1,minor=1)
7 |
--------------------------------------------------------------------------------
/models/course.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | var monk = require('monk');
5 | var db = monk('localhost:27017/examdb');
6 | var course_collection = db.get('courses');
7 |
8 | module.exports = {
9 | // MAKE VALIDATION FUNCTIONS HERE
10 | // Create new course in the database
11 | create: function(course, cb) {
12 | course_collection.insert(course, cb);
13 | },
14 |
15 | // Retrieve course using courseid
16 | getBycourseid: function(courseid, cb) {
17 | course_collection.findOne({courseid: courseid}, {}, cb);
18 | },
19 |
20 | // Update an existing course by courseid
21 | update: function(prevcourseid, course, cb) {
22 | course_collection.update({courseid: prevcourseid},
23 | { $set: {courseid: course.courseid, coursename: course.coursename} },
24 | cb);
25 | },
26 |
27 | // Remove an existing course by courseid
28 | remove: function(courseid, cb) {
29 | console.log(courseid);
30 | course_collection.remove({courseid: courseid}, cb);
31 | }
32 |
33 | };
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/js/scripts.js:
--------------------------------------------------------------------------------
1 |
2 | jQuery(document).ready(function() {
3 |
4 | /*
5 | Fullscreen background
6 | */
7 | $.backstretch([
8 | "/stylesheets/assets/img/backgrounds/2.jpg"
9 | , "/stylesheets/assets/img/backgrounds/3.jpg"
10 | , "/stylesheets/assets/img/backgrounds/1.jpg"
11 | ], {duration: 3000, fade: 750});
12 |
13 | /*
14 | Form validation
15 | */
16 | $('.login-form input[type="text"], .login-form input[type="password"], .login-form textarea').on('focus', function() {
17 | $(this).removeClass('input-error');
18 | });
19 |
20 | $('.login-form').on('submit', function(e) {
21 |
22 | $(this).find('input[type="text"], input[type="password"], textarea').each(function(){
23 | if( $(this).val() == "" ) {
24 | e.preventDefault();
25 | $(this).addClass('input-error');
26 | }
27 | else {
28 | $(this).removeClass('input-error');
29 | }
30 | });
31 |
32 | });
33 |
34 |
35 | });
36 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/less/mixins.less:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | .fa-icon() {
5 | display: inline-block;
6 | font: normal normal normal @fa-font-size-base/1 FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 | transform: translate(0, 0); // ensures no half-pixel rendering in firefox
12 |
13 | }
14 |
15 | .fa-icon-rotate(@degrees, @rotation) {
16 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation);
17 | -webkit-transform: rotate(@degrees);
18 | -ms-transform: rotate(@degrees);
19 | transform: rotate(@degrees);
20 | }
21 |
22 | .fa-icon-flip(@horiz, @vert, @rotation) {
23 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1);
24 | -webkit-transform: scale(@horiz, @vert);
25 | -ms-transform: scale(@horiz, @vert);
26 | transform: scale(@horiz, @vert);
27 | }
28 |
--------------------------------------------------------------------------------
/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 30px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | h2 {
7 | margin:0 0 .5em 0;
8 | }
9 |
10 | a {
11 | color: #00B7FF;
12 | }
13 |
14 | #wrapper {
15 | padding-left:312px;
16 | position:relative;
17 | }
18 |
19 | #questionList {
20 | margin:0 0 30px 0;
21 | }
22 | #questionList table {
23 | border-collapse:separate;
24 | border-spacing:1px;
25 | background:#CCC;
26 | }
27 | #questionList table th {
28 | background:#EEE;
29 | font-weight:600;
30 | padding:10px 20px;
31 | text-align:center;
32 | }
33 | #questionList table tbody {
34 | padding:0; margin:0;
35 | border-collapse:collapse;
36 | border-spacing:0px;
37 | }
38 | #questionList table td {
39 | background:#FFF;
40 | padding:5px 10px;
41 | text-align:center;
42 | }
43 |
44 | #questionBox {
45 | width:250px;
46 | position:absolute;
47 | top:0; left:0;
48 | }
49 | #questionBox p {
50 | padding:15px;
51 | border:1px solid #CCC;
52 | background:rgba(80,120,255,0.05);
53 | }
54 |
55 | fieldset {
56 | border:0;
57 | padding:0; margin:0;
58 | }
--------------------------------------------------------------------------------
/public/stylesheets/assets/font-awesome/scss/_mixins.scss:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | @mixin fa-icon() {
5 | display: inline-block;
6 | font: normal normal normal #{$fa-font-size-base}/1 FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 | transform: translate(0, 0); // ensures no half-pixel rendering in firefox
12 |
13 | }
14 |
15 | @mixin fa-icon-rotate($degrees, $rotation) {
16 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
17 | -webkit-transform: rotate($degrees);
18 | -ms-transform: rotate($degrees);
19 | transform: rotate($degrees);
20 | }
21 |
22 | @mixin fa-icon-flip($horiz, $vert, $rotation) {
23 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
24 | -webkit-transform: scale($horiz, $vert);
25 | -ms-transform: scale($horiz, $vert);
26 | transform: scale($horiz, $vert);
27 | }
28 |
--------------------------------------------------------------------------------
/controllers/login_controller.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | , passport = require('passport')
3 | , router = express.Router();
4 |
5 | router.get('/', function(req, res) {
6 | var usertype = req.query.usertype;
7 | if(usertype == 'admin')
8 | res.render('login', {title: "Admin Login", method: "authenticate_admin"});
9 | if(usertype == 'student')
10 | res.render('login', {title: "Student Login", method: "authenticate_student"});
11 | if(usertype == 'faculty')
12 | res.render('login', {title: "Faculty Login", method: "authenticate_faculty"});
13 | });
14 |
15 | router.post('/authenticate_admin', passport.authenticate('local-login-admin', {
16 | successRedirect : '../admin/home',
17 | failureRedirect : '/',
18 | failureFlash : true
19 | }));
20 |
21 | router.post('/authenticate_student', passport.authenticate('local-login-student', {
22 | successRedirect : '../students/home',
23 | failureRedirect : '/',
24 | failureFlash : true
25 | }));
26 |
27 | router.post('/authenticate_faculty', passport.authenticate('local-login-faculty', {
28 | successRedirect : '../faculties/home',
29 | failureRedirect : '/',
30 | failureFlash : true
31 | }));
32 |
33 |
34 | module.exports = router;
--------------------------------------------------------------------------------
/public/javascripts/display.js:
--------------------------------------------------------------------------------
1 | var questionData = [];
2 |
3 | // DOM Ready =============================================================
4 | $(document).ready(function() {
5 |
6 | // Display Questions
7 | fillQuestions();
8 |
9 | });
10 |
11 | // Functions =============================================================
12 |
13 | // Fill Question List
14 | function fillQuestions() {
15 |
16 | // Empty content string
17 | var questionContent = '';
18 |
19 | // jQuery AJAX call for JSON
20 | $.getJSON( '/make_exam/list', {exam_code: exam_code}, function( data ) {
21 |
22 | // Question Content
23 | questionData = data.question_list;
24 |
25 | $i=1;
26 | // For each item in our JSON, add a question line
27 | $.each(data.question_list, function(){
28 | //questionContent += this.question;
29 | questionContent += 'Question'+$i+' :';
30 | questionContent += this.question + '
';
31 | questionContent += ' A.' + this.optionA + ' B.' + this.optionB + ' C.' + this.optionC + ' D.' + this.optionD + ' Key' + this.key + '
';
32 |
33 | $i++;
34 | });
35 |
36 | // Inject the whole content string into our existing HTML table
37 | document.getElementById("temp").innerHTML = questionContent ;
38 | });
39 | };
40 |
--------------------------------------------------------------------------------
/views/exams/exam_submit.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Return
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Go Back to HomePage
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='../students/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | // Javascript
29 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
30 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
31 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
32 | script(src='/stylesheets/assets/js/scripts.js')
33 | //if lt IE 10
34 | script(src='assets/js/placeholder.js')
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/models/exam.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | var monk = require('monk');
5 | var db = monk('localhost:27017/examdb');
6 | var exam_collection = db.get('exams');
7 | var student_collection = db.get('students');
8 | var response_collection = db.get('responses');
9 |
10 |
11 | module.exports = {
12 | // MAKE VALIDATION FUNCTIONS HERE
13 | // Create new student in the database
14 | create: function(exam, cb) {
15 | exam_collection.insert(exam, cb);
16 | },
17 |
18 | getByExamCode: function(exam_code, cb) {
19 | exam_collection.findOne({exam_code: exam_code}, cb);
20 | },
21 |
22 | getResponseByExamCode: function(exam_code, username, cb) {
23 | response_collection.findOne({exam_code: exam_code, username: username}, cb);
24 | },
25 |
26 | addQuestion: function(exam_code, question_full, cb) {
27 | exam_collection.update(
28 | { exam_code: exam_code },
29 | { $push: { question_list: { $each: [
30 | {question: question_full.question,
31 | optionA: question_full.optionA,
32 | optionB: question_full.optionB,
33 | optionC: question_full.optionC,
34 | optionD: question_full.optionD,
35 | key: question_full.key
36 | } ] } } }, cb);
37 | },
38 |
39 | // Submit Responses
40 | addResponses: function(username, exam_code, response, cb) {
41 |
42 | var temp_response =
43 | {
44 | username: username,
45 | exam_code: exam_code,
46 | response: response
47 | };
48 | response_collection.insert(temp_response, cb);
49 | },
50 |
51 | checkResponse: function(username, exam_code, cb) {
52 | response_collection.findOne({username:username, exam_code: exam_code}, cb);
53 | }
54 |
55 | };
--------------------------------------------------------------------------------
/models/faculty.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | var monk = require('monk');
5 | var db = monk('localhost:27017/examdb');
6 | var faculty_collection = db.get('faculties');
7 |
8 | module.exports = {
9 | // MAKE VALIDATION FUNCTIONS HERE
10 | // Create new student in the database
11 | create: function(faculty, cb) {
12 | faculty_collection.insert(faculty, cb);
13 | },
14 |
15 | // Retrieve faculty using username
16 | getByUserName: function(username, cb) {
17 | faculty_collection.findOne({username: username}, {}, cb);
18 | },
19 |
20 | findByUserName: function(username, cb) {
21 | faculty_collection.findOne({username: username}, {}, cb);
22 | },
23 |
24 | // Update an existing faculty by username
25 | update: function(prevusername, faculty, cb) {
26 | faculty_collection.update({username: prevusername},
27 | { $set: {username: faculty.username, password: faculty.password,
28 | name: faculty.name} },
29 | cb);
30 | },
31 |
32 | // Remove an existing faculty by username
33 | remove: function(username, cb) {
34 | faculty_collection.remove({username: username}, cb);
35 | },
36 |
37 | // Assign faculty to a course by username and course ID
38 | assign: function(username, course_code, cb) {
39 | faculty_collection.update(
40 | { username: username },
41 | { $addToSet: { course_list: { $each: [ course_code] } } }, cb);
42 | },
43 |
44 | unassign: function(username, course_code, cb)
45 | {
46 | faculty_collection.update(
47 | {username: username},
48 | { $pull: { course_list: course_code } },cb);
49 | },
50 |
51 | getBycourseid: function(username,course_code, cb) {
52 | faculty_collection.findOne({username: username, course_list :course_code}, {}, cb);
53 | }
54 |
55 | };
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/models/student.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | var monk = require('monk');
5 | var db = monk('localhost:27017/examdb');
6 | var student_collection = db.get('students');
7 |
8 | module.exports = {
9 | // MAKE VALIDATION FUNCTIONS HERE
10 | // Create new student in the database
11 | create: function(student, cb) {
12 | student_collection.insert(student, cb);
13 | },
14 |
15 | findByUserName: function(username, cb) {
16 | student_collection.findOne({username: username}, {}, cb);
17 | },
18 |
19 | // Retrieve student using username
20 | getByUserName: function(username, cb) {
21 | student_collection.findOne({username: username}, {}, cb);
22 | },
23 |
24 | // Update an existing student by username
25 | update: function(prevusername, student, cb) {
26 | student_collection.update({username: prevusername},
27 | { $set: {username: student.username, password: student.password,
28 | name: student.name, rollno: student.rollno} },
29 | cb);
30 | },
31 |
32 | // Remove an existing student by username
33 | remove: function(username, cb) {
34 | student_collection.remove({username: username}, cb);
35 | },
36 |
37 | // Register student to a course by username and course ID
38 | register: function(username, course_code, cb) {
39 | student_collection.update(
40 | { username: username },
41 | { $addToSet: { course_list: { $each: [ course_code] } } }, cb);
42 | },
43 |
44 | deregister: function(username, course_code, cb)
45 | {
46 | student_collection.update(
47 | {username: username},
48 | { $pull: { course_list: course_code } },cb);
49 | },
50 |
51 | getBycourseid: function(username,course_code, cb) {
52 | student_collection.findOne({username: username, course_list :course_code}, {}, cb);
53 | }
54 |
55 | };
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/views/faculties/home.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Faculty Home
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Hello Faculty
24 | .row
25 | .col-sm-3
26 |
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | p What do you want to do?
31 | .form-bottom
32 | .form-group
33 | center
34 | a.btn.btn-info(href='/make_exam/new', role='button') Make Exam
35 | .form-group
36 | .col-sm-3
37 | a.btn.btn-info(href='/faculties/logout', role='button') Logout!
38 | // Javascript
39 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
40 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
41 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
42 | script(src='/stylesheets/assets/js/scripts.js')
43 | //if lt IE 10
44 | script(src='assets/js/placeholder.js')
45 |
--------------------------------------------------------------------------------
/views/exams/performance.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Performance Report
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Performance Report
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='../students/home', role='button') Go Back!
27 | .col-sm-7.form-box
28 | .form-top
29 | .form-top-left
30 | h2
31 | strong Total Questions:  
32 | "#{total_questions}"
33 | h2
34 | strong Attempted Questions:  
35 | "#{attempted}"
36 | h2
37 | strong Correct Questions:  
38 | "#{correct}"
39 | // Javascript
40 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
41 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
42 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
43 | script(src='/stylesheets/assets/js/scripts.js')
44 | //if lt IE 10
45 | script(src='assets/js/placeholder.js')
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/views/welcome.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Welcome
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Welcome
24 | .row
25 | .col-sm-3
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h2
30 | center             Login As:
31 | .form-bottom
32 | center
33 | a.btn.btn-info(href='/login?usertype=admin', role='button') Admin
34 | br
35 | br
36 | a.btn.btn-info(href='/login?usertype=student', role='button') Student
37 | br
38 | br
39 | a.btn.btn-info(href='/login?usertype=faculty', role='button') Faculty
40 | // Javascript
41 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
42 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
43 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
44 | script(src='/stylesheets/assets/js/scripts.js')
45 | //if lt IE 10
46 | script(src='assets/js/placeholder.js')
47 |
48 |
49 |
--------------------------------------------------------------------------------
/bin/www:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * Module dependencies.
5 | */
6 |
7 | var app = require('../app');
8 | var debug = require('debug')('online_exam:server');
9 | var http = require('http');
10 |
11 | /**
12 | * Get port from environment and store in Express.
13 | */
14 |
15 | var port = normalizePort(process.env.PORT || '3000');
16 | app.set('port', port);
17 |
18 | /**
19 | * Create HTTP server.
20 | */
21 |
22 | var server = http.createServer(app);
23 |
24 | /**
25 | * Listen on provided port, on all network interfaces.
26 | */
27 |
28 | server.listen(port);
29 | server.on('error', onError);
30 | server.on('listening', onListening);
31 |
32 | /**
33 | * Normalize a port into a number, string, or false.
34 | */
35 |
36 | function normalizePort(val) {
37 | var port = parseInt(val, 10);
38 |
39 | if (isNaN(port)) {
40 | // named pipe
41 | return val;
42 | }
43 |
44 | if (port >= 0) {
45 | // port number
46 | return port;
47 | }
48 |
49 | return false;
50 | }
51 |
52 | /**
53 | * Event listener for HTTP server "error" event.
54 | */
55 |
56 | function onError(error) {
57 | if (error.syscall !== 'listen') {
58 | throw error;
59 | }
60 |
61 | var bind = typeof port === 'string'
62 | ? 'Pipe ' + port
63 | : 'Port ' + port;
64 |
65 | // handle specific listen errors with friendly messages
66 | switch (error.code) {
67 | case 'EACCES':
68 | console.error(bind + ' requires elevated privileges');
69 | process.exit(1);
70 | break;
71 | case 'EADDRINUSE':
72 | console.error(bind + ' is already in use');
73 | process.exit(1);
74 | break;
75 | default:
76 | throw error;
77 | }
78 | }
79 |
80 | /**
81 | * Event listener for HTTP server "listening" event.
82 | */
83 |
84 | function onListening() {
85 | var addr = server.address();
86 | var bind = typeof addr === 'string'
87 | ? 'pipe ' + addr
88 | : 'port ' + addr.port;
89 | debug('Listening on ' + bind);
90 | }
91 |
--------------------------------------------------------------------------------
/views/faculties/get_username_edit.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Edit Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Edit Faculty
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Edit Faculty
30 | p Fill the username:
31 | .form-bottom
32 | form.login-form(role='form', action='edit', method='get')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | button.btn(type='submit') Details
37 | .col-sm-3
38 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
39 | // Javascript
40 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
41 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
42 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
43 | script(src='/stylesheets/assets/js/scripts.js')
44 | //if lt IE 10
45 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/faculties/get_username_delete.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Delete Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Delete Faculty
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Edit Faculty
30 | p Fill the username:
31 | .form-bottom
32 | form.login-form(role='form', action='delete', method='post')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | button.btn(type='submit') Delete
37 | .col-sm-3
38 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
39 | // Javascript
40 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
41 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
42 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
43 | script(src='/stylesheets/assets/js/scripts.js')
44 | //if lt IE 10
45 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/students/home.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Student Home
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Hello Student
24 | .row
25 | .col-sm-3
26 |
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | p What do you want to do?
31 | .form-bottom
32 | .form-group
33 |              
34 | a.btn.btn-info(href='/take_exam/performance', role='button') View Performance
35 |                                           
36 | a.btn.btn-info(href='/take_exam', role='button') Take Exam
37 | .form-group
38 | .col-sm-3
39 | a.btn.btn-info(href='/students/logout', role='button') Logout!
40 | // Javascript
41 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
42 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
43 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
44 | script(src='/stylesheets/assets/js/scripts.js')
45 | //if lt IE 10
46 | script(src='assets/js/placeholder.js')
47 |
--------------------------------------------------------------------------------
/views/students/get_username_edit.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Get UserName to Edit Student
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Edit Student
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | h3 Edit Student
31 | p Fill the username:
32 | .form-bottom
33 | form.login-form(role='form', action='edit', method='get')
34 | .form-group
35 | label.sr-only(for='form-username') Username
36 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
37 | button.btn(type='submit') Details
38 | .col-sm-3
39 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
40 | // Javascript
41 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
42 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
43 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
44 | script(src='/stylesheets/assets/js/scripts.js')
45 | //if lt IE 10
46 | script(src='assets/js/placeholder.js')
47 |
48 |
49 |
--------------------------------------------------------------------------------
/views/courses/get_courseid_edit.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Get CourseID to Edit Course
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Edit Course
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | h3 Edit Course
31 | p Fill the courseid:
32 | .form-bottom
33 | form.login-form(role='form', action='edit', method='get')
34 | .form-group
35 | label.sr-only(for='form-courseid') courseid
36 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='courseid...')
37 | button.btn(type='submit') Details
38 | .col-sm-3
39 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
40 | // Javascript
41 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
42 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
43 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
44 | script(src='/stylesheets/assets/js/scripts.js')
45 | //if lt IE 10
46 | script(src='assets/js/placeholder.js')
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/views/students/get_username_delete.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Get UserName to Delete Student
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Delete Student
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | h3 Delete Student
31 | p Fill the form to delete a student:
32 | .form-bottom
33 | form.login-form(role='form', action='delete', method='post')
34 | .form-group
35 | label.sr-only(for='form-username') Username
36 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
37 | button.btn(type='submit') Details
38 | .col-sm-3
39 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
40 | // Javascript
41 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
42 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
43 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
44 | script(src='/stylesheets/assets/js/scripts.js')
45 | //if lt IE 10
46 | script(src='assets/js/placeholder.js')
47 |
48 |
49 |
--------------------------------------------------------------------------------
/views/courses/get_courseid_delete.jade:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | doctype html
5 | html(lang='en')
6 | head
7 | meta(charset='utf-8')
8 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
9 | meta(name='viewport', content='width=device-width, initial-scale=1')
10 | title Get CourseID to Delete Course
11 | // CSS
12 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
15 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
16 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
17 | body
18 | // Top content
19 | .top-content
20 | .inner-bg
21 | .container
22 | .row
23 | .col-sm-8.col-sm-offset-2.text
24 | h1
25 | strong Delete Course
26 | .row
27 | .col-sm-3
28 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
29 | .col-sm-6.form-box
30 | .form-top
31 | .form-top-left
32 | h3 Delete Course
33 | p Fill the courseid:
34 | .form-bottom
35 | form.login-form(role='form', action='delete', method='post')
36 | .form-group
37 | label.sr-only(for='form-courseid') courseid
38 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='courseid...')
39 | button.btn(type='submit') Delete
40 | .col-sm-3
41 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/views/login.jade:
--------------------------------------------------------------------------------
1 |
2 |
3 | doctype html
4 | html(lang='en')
5 | head
6 | meta(charset='utf-8')
7 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
8 | meta(name='viewport', content='width=device-width, initial-scale=1')
9 | title Login
10 | // CSS
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
15 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
16 | body
17 | // Top content
18 | .top-content
19 | .inner-bg
20 | .container
21 | .row
22 | .col-sm-8.col-sm-offset-2.text
23 | h1
24 | strong Login
25 | .row
26 | .col-sm-3
27 | a.btn.btn-info(href='/', role='button') Go Back!
28 | .col-sm-6.form-box
29 | .form-top
30 | .form-top-left
31 | h3 Fill the form to sign in:
32 | .form-bottom
33 | form.login-form(role='formlogin', action='login/#{method}', method='post')
34 | .form-group
35 | label.sr-only(for='form-username') Username
36 | input#form-username.form-username.form-control(type='text', name='username', placeholder="username")
37 | .form-group
38 | label.sr-only(for='form-password') Password
39 | input#form-password.form-password.form-control(type='password', name='password', placeholder="password")
40 | button.btn(type='submit') Login
41 | .col-sm-3
42 |
43 | // Javascript
44 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
45 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
46 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
47 | script(src='/stylesheets/assets/js/scripts.js')
48 | //if lt IE 10
49 | script(src='assets/js/placeholder.js')
50 |
51 |
52 |
--------------------------------------------------------------------------------
/views/exams/question_list.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | script(src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js')
4 | script(type='text/javascript')| var exam_code =!{JSON.stringify(exam.exam_code)};
5 | script(src='/javascripts/display.js')
6 | head
7 | meta(charset='utf-8')
8 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
9 | meta(name='viewport', content='width=device-width, initial-scale=1')
10 | title Questions
11 | // CSS
12 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
15 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
16 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
17 | body
18 | // Top content
19 | .top-content
20 | .inner-bg
21 | .container
22 | .row
23 | .col-sm-8.col-sm-offset-2.text
24 | h1
25 | a.btn.btn-info(href='/faculties/home', role='button') Submit
26 |          
27 | strong EXAM CODE: #{exam.exam_code}
28 |          
29 | form.login-form(role='form', action='add_question', method='post')
30 | .form-group
31 | label.sr-only(for='form-exam_code') Exam Code
32 | input#form-exam_code.form-exam_code.form-control(type='hidden', name='exam_code', value=exam.exam_code)
33 | button.btn(type='submit') Add Question
34 | .row
35 |
36 | .col-sm-12.form-box
37 | .form-top
38 | .form-top-left
39 | h4#temp
40 | .form-bottom
41 |
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/courses/new.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Add Course
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Add New Course
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | h3 Add New Course
31 | p Fill the form to add a new Course:
32 | .form-bottom
33 | form.login-form(role='form', action='create', method='post')
34 | .form-group
35 | label.sr-only(for='form-name') CourseName
36 | input#form-name.form-name.form-control(type='text', name='coursename', placeholder=course.coursename)
37 | .form-group
38 | label.sr-only(for='form-username') CourseID
39 | input#form-username.form-username.form-control(type='text', name='courseid', placeholder=course.courseid)
40 | button.btn(type='submit') Add
41 | .col-sm-3
42 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
43 | // Javascript
44 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
45 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
46 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
47 | script(src='/stylesheets/assets/js/scripts.js')
48 | //if lt IE 10
49 | script(src='assets/js/placeholder.js')
50 |
51 |
--------------------------------------------------------------------------------
/views/faculties/assign.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Assign Course to a Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Assign Course
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Assign Course
30 | p Fill the form to assign a course to the faculty:
31 | .form-bottom
32 | form.login-form(role='form', action='assign', method='post')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | .form-group
37 | label.sr-only(for='form-courseid') CourseID
38 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='CourseID')
39 | button.btn(type='submit') Assign
40 | .col-sm-3
41 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/faculties/unassign.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Add Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Unassign course
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Unassign a course
30 | p Fill the form to unassign a course from the faculty:
31 | .form-bottom
32 | form.login-form(role='form', action='unassign', method='post')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | .form-group
37 | label.sr-only(for='form-courseid') Password
38 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='CourseID...')
39 | button.btn(type='submit') Unassign
40 | .col-sm-3
41 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/exams/take_exam_code_entry.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Get exam_code for taking test
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong Take Exam
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='../students/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | p Fill the exam_code:
31 | .form-bottom
32 | form.login-form(role='form', action='/take_exam/exam', method='post' , name='takeexam')
33 | .form-group
34 | label.sr-only(for='form-exam_code') exam_code
35 | input#form-exam_code.form-exam_code.form-control(type='text', name='exam_code', value=exam_code)
36 | .form-group
37 | label.sr-only(for='form-exam_code') exam_code
38 | input#form-exam_code.form-exam_code.form-control(type='hidden', name='username', value=username)
39 | button.btn(type='submit') Submit
40 | .col-sm-3
41 | a.btn.btn-info(href='../students/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/views/students/register.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Register Student to a Course
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Register Student
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Register Student
30 | p Fill the form to register student to a course:
31 | .form-bottom
32 | form.login-form(role='form', action='register', method='post')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | .form-group
37 | label.sr-only(for='form-courseid') CourseID
38 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='CourseID')
39 | button.btn(type='submit') Register
40 | .col-sm-3
41 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/students/deregister.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Deregister Student to a Course
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Deregister Student
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Deregister Student
30 | p Fill the form to register student to a course:
31 | .form-bottom
32 | form.login-form(role='form', action='deregister', method='post')
33 | .form-group
34 | label.sr-only(for='form-username') Username
35 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
36 | .form-group
37 | label.sr-only(for='form-courseid') CourseID
38 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', placeholder='CourseID')
39 | button.btn(type='submit') Deregister
40 | .col-sm-3
41 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/exams/view_performance_code_entry.jade:
--------------------------------------------------------------------------------
1 |
2 | doctype html
3 | html(lang='en')
4 | head
5 | meta(charset='utf-8')
6 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
7 | meta(name='viewport', content='width=device-width, initial-scale=1')
8 | title Get exam_code to view performance
9 | // CSS
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
15 | body
16 | // Top content
17 | .top-content
18 | .inner-bg
19 | .container
20 | .row
21 | .col-sm-8.col-sm-offset-2.text
22 | h1
23 | strong View Performance
24 | .row
25 | .col-sm-3
26 | a.btn.btn-info(href='../students/home', role='button') Go Back!
27 | .col-sm-6.form-box
28 | .form-top
29 | .form-top-left
30 | p Fill the exam_code:
31 | .form-bottom
32 | form.login-form(role='form', action='performance_view', method='post' , name='takeexam')
33 | .form-group
34 | label.sr-only(for='form-exam_code') exam_code
35 | input#form-exam_code.form-exam_code.form-control(type='text', name='exam_code', value=exam_code)
36 | .form-group
37 | label.sr-only(for='form-username') username
38 | input#form-username.form-username.form-control(type='hidden', name='username', value=username)
39 | button.btn(type='submit') Submit
40 | .col-sm-3
41 | a.btn.btn-info(href='../students/logout', role='button') Logout!
42 | // Javascript
43 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
44 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
45 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
46 | script(src='/stylesheets/assets/js/scripts.js')
47 | //if lt IE 10
48 | script(src='assets/js/placeholder.js')
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to Online Objective Examination System
2 |
3 | Online Objective Examination System(OOES) is a web application developed using Node.js platform and a lightweight Node.js framework Express.js. The templating engine used is Jade and the database used is MongoDB.
4 |
5 | OOES can be operated by three different types of users- Admin, Student and Faculty. They can login valid credentials(College ID and Password). Once logged in, their data is stored in a session using Passport.js and they can logout from it anytime they wish.
6 |
7 | The Admin is allowed to add, edit and delete Student and Faculty users. They can also add, edit and delete Courses. In addition to this, they can register a Student to a particular course and deregister him from the same. The Admin can also assign a course to a Faculty and deassign him from the same. Admin users are directly managed using the database and cannot be created or deleted through the software.
8 |
9 | Faculty users are allowed to create exams for the courses they teach. They can set the name and code of the exam, its duration and the number of questions.
10 |
11 | Student users can take the exams of the courses they are registered in. Once an exam is successfully submitted by the student, he cannot attempt it again. The Students have an option to view their performance in the past exams.
12 |
13 | ## Getting Started
14 |
15 | 1. Extract the zip file of the GitHub repository to an empty folder. Let this folder be called OOES.
16 |
17 | 2. Install Node.js version '4.4.0' using the command line or from the setup at Node.js website. This installs Node.js and NPM(Node Package Manager) as well.
18 |
19 | 3. Install the Node package Express(this is for the Node.js framework Express.js) globally using NPM install.
20 |
21 | 4. Install MongoDB from MongoDB website. Start Mongo Daemon and set the dbpath to OOES/data.
22 |
23 | 5. Start the application using the command npm start after navigating to OOES folder.
24 |
25 | 6. Using a browser, go to http://localhost:3000 and you'll see the application running!
26 |
27 | ## Setting Up Default Admin User
28 |
29 | Create an admin user in database to log in. Set up MongoDB on port 27017. Create a new DB called examdb. Create a new collection called admin. Add the following entry (directly to DB):
30 | {username: DESIRED_ADMIN_USERNAME, password: DESIRED_ADMIN_PASSWORD}.
31 |
32 | ## Contributing
33 |
34 | We encourage you to contribute to OOES project. Suggest new features and fix bugs to contribute!
35 |
36 |
--------------------------------------------------------------------------------
/views/faculties/edit.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Edit Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Edit Faculty
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Edit Faculty
30 | p Fill the form to edit the faculty details:
31 | .form-bottom
32 | form.login-form(role='form', action='update', method='post')
33 | .form-group
34 | label.sr-only(for='form-password') Name
35 | input#form-password.form-password.form-control(type='text', name='', value=student.name)
36 | .form-group
37 | label.sr-only(for='form-password') Username
38 | input#form-password.form-password.form-control(type='text', name='', value=student.username)
39 | .form-group
40 | label.sr-only(for='form-password') Password
41 | input#form-password.form-password.form-control(type='password', name='password', placeholder='Password...')
42 | button.btn(type='submit') Edit
43 | .col-sm-3
44 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
45 | // Javascript
46 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
47 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
48 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
49 | script(src='/stylesheets/assets/js/scripts.js')
50 | //if lt IE 10
51 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/faculties/new.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Add Faculty
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Add New Faculty
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Add New Faculty
30 | p Fill the form to add a new faculty:
31 | .form-bottom
32 | form.login-form(role='form', action='create', method='post')
33 | .form-group
34 | label.sr-only(for='form-name') Name
35 | input#form-name.form-name.form-control(type='text', name='name', placeholder='Name...')
36 | .form-group
37 | label.sr-only(for='form-username') Username
38 | input#form-username.form-username.form-control(type='text', name='username', placeholder='Username...')
39 | .form-group
40 | label.sr-only(for='form-password') Password
41 | input#form-password.form-password.form-control(type='password', name='password', placeholder='Password...')
42 | button.btn(type='submit') Add
43 | .col-sm-3
44 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
45 | // Javascript
46 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
47 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
48 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
49 | script(src='/stylesheets/assets/js/scripts.js')
50 | //if lt IE 10
51 | script(src='assets/js/placeholder.js')
--------------------------------------------------------------------------------
/views/courses/edit.jade:
--------------------------------------------------------------------------------
1 |
2 |
3 | doctype html
4 | html(lang='en')
5 | head
6 | meta(charset='utf-8')
7 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
8 | meta(name='viewport', content='width=device-width, initial-scale=1')
9 | title Edit Course
10 | // CSS
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
15 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
16 | body
17 | // Top content
18 | .top-content
19 | .inner-bg
20 | .container
21 | .row
22 | .col-sm-8.col-sm-offset-2.text
23 | h1
24 | strong Edit Course
25 | .row
26 | .col-sm-3
27 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
28 | .col-sm-6.form-box
29 | .form-top
30 | .form-top-left
31 | h3 Edit Course
32 | p Fill the form to add a new Course:
33 | .form-bottom
34 | form.login-form(role='form', action='update', method='post')
35 | .form-group
36 | label.sr-only(for='form-name') CourseName
37 | input#form-name.form-name.form-control(type='text', name='coursename', value=course.coursename)
38 |
39 | .form-group
40 | label.sr-only(for='form-courseid') courseid
41 | input#form-courseid.form-courseid.form-control(type='text', name='courseid', value=course.courseid)
42 |
43 | .form-group
44 | label.sr-only(for='form-password') Previous
45 | input#form-password.form-password.form-control(type='hidden', name='', value=course.courseid)
46 |
47 | button.btn(type='submit') Edit
48 | .col-sm-3
49 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
50 | // Javascript
51 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
52 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
53 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
54 | script(src='/stylesheets/assets/js/scripts.js')
55 | //if lt IE 10
56 | script(src='assets/js/placeholder.js')
57 |
--------------------------------------------------------------------------------
/config/passport.js:
--------------------------------------------------------------------------------
1 | var LocalStrategy = require('passport-local').Strategy;
2 |
3 | var AdminUser = require('../models/admin.js');
4 | var StudentUser = require('../models/student.js');
5 | var FacultyUser = require('../models/faculty.js');
6 |
7 | module.exports = function(passport) {
8 |
9 | passport.serializeUser(function (user, done) {
10 | done(null, JSON.stringify(user));
11 | });
12 |
13 | passport.deserializeUser(function (user, done) {
14 | done(null, JSON.parse(user));
15 | });
16 |
17 | passport.use('local-login-admin', new LocalStrategy({
18 | passReqToCallback : true
19 | },
20 | function(req, username, password, done) {
21 | AdminUser.findByUserName(username, function(err, user) {
22 | if (err)
23 | return done(err);
24 | if (!user)
25 | return done(null, false, req.flash('loginMessage', 'No user found.'));
26 | if (user.password!=password)
27 | return done(null, false, req.flash('loginMessage', 'Oops! Wrong password.'));
28 | user.usertype='admin';
29 | return done(null, user);
30 | });
31 |
32 | }));
33 |
34 | passport.use('local-login-student', new LocalStrategy({
35 | passReqToCallback : true
36 | },
37 | function(req, username, password, done) {
38 | StudentUser.findByUserName(username, function(err, user) {
39 | if (err)
40 | return done(err);
41 | if (!user)
42 | return done(null, false, req.flash('loginMessage', 'No user found.'));
43 | if (user.password!=password)
44 | return done(null, false, req.flash('loginMessage', 'Oops! Wrong password.'));
45 | user.usertype='student';
46 | return done(null, user);
47 | });
48 |
49 | }));
50 |
51 | passport.use('local-login-faculty', new LocalStrategy({
52 | passReqToCallback : true
53 | },
54 | function(req, username, password, done) {
55 | FacultyUser.findByUserName(username, function(err, user) {
56 | if (err)
57 | return done(err);
58 | if (!user)
59 | return done(null, false, req.flash('loginMessage', 'No user found.'));
60 | if (user.password!=password)
61 | return done(null, false, req.flash('loginMessage', 'Oops! Wrong password.'));
62 | user.usertype='faculty';
63 | return done(null, user);
64 | });
65 |
66 | }));
67 |
68 | };
69 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var path = require('path');
3 | var favicon = require('serve-favicon');
4 | var passport = require('passport');
5 | var flash = require('connect-flash');
6 | var logger = require('morgan');
7 | var cookieParser = require('cookie-parser');
8 | var bodyParser = require('body-parser');
9 | var session = require('express-session');
10 |
11 | var app = express();
12 |
13 | require('./config/passport')(passport);
14 |
15 | // uncomment after placing your favicon in /public
16 | //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
17 | app.use(logger('dev'));
18 | app.use(cookieParser());
19 | app.use(bodyParser.json());
20 | app.use(bodyParser.urlencoded({ extended: false }));
21 | app.use(express.static(path.join(__dirname, 'public')));
22 |
23 | // view engine setup
24 | app.set('views', path.join(__dirname, 'views'));
25 | app.set('view engine', 'jade');
26 |
27 | app.use(session({secret: 'my_app_secret'}));
28 | app.use(passport.initialize());
29 | app.use(passport.session());
30 | app.use(flash());
31 |
32 | var monk = require('monk');
33 | var db = monk('localhost:2701/examdb');
34 |
35 | var index = require('./controllers/index');
36 | var students = require('./controllers/students');
37 | var courses = require('./controllers/courses');
38 | var faculties = require('./controllers/faculties');
39 | var make_exam = require('./controllers/make_exam_controller');
40 | var take_exam = require('./controllers/take_exam_controller');
41 | var admin = require('./controllers/admin');
42 | var login = require('./controllers/login_controller');
43 |
44 | app.use('/',index);
45 | app.use('/students', students);
46 | app.use('/courses', courses);
47 | app.use('/faculties', faculties);
48 | app.use('/make_exam', make_exam);
49 | app.use('/take_exam', take_exam);
50 | app.use('/admin', admin);
51 | app.use('/login', login);
52 |
53 | // catch 404 and forward to error handler
54 | app.use(function(req, res, next) {
55 | var err = new Error('Not Found');
56 | err.status = 404;
57 | next(err);
58 | });
59 |
60 | // error handlers
61 |
62 | // development error handler
63 | // will print stacktrace
64 | if (app.get('env') === 'development') {
65 | app.use(function(err, req, res, next) {
66 | res.status(err.status || 500);
67 | res.render('error', {
68 | message: err.message,
69 | error: err
70 | });
71 | });
72 | }
73 |
74 | // production error handler
75 | // no stacktraces leaked to user
76 | app.use(function(err, req, res, next) {
77 | res.status(err.status || 500);
78 | res.render('error', {
79 | message: err.message,
80 | error: {}
81 | });
82 | });
83 |
84 |
85 | module.exports = app;
86 |
--------------------------------------------------------------------------------
/views/students/new.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html(lang='en')
3 | head
4 | meta(charset='utf-8')
5 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
6 | meta(name='viewport', content='width=device-width, initial-scale=1')
7 | title Add Student
8 | // CSS
9 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
10 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
11 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
14 | body
15 | // Top content
16 | .top-content
17 | .inner-bg
18 | .container
19 | .row
20 | .col-sm-8.col-sm-offset-2.text
21 | h1
22 | strong Add New Student
23 | .row
24 | .col-sm-3
25 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
26 | .col-sm-6.form-box
27 | .form-top
28 | .form-top-left
29 | h3 Add New Student
30 | p Fill the form to add a new student:
31 | .form-bottom
32 | form.login-form(role='form', action='create', method='post')
33 | .form-group
34 | label.sr-only(for='form-name') Name
35 | input#form-name.form-name.form-control(type='text', name='name', placeholder=student.name)
36 | .form-group
37 | label.sr-only(for='form-roll') Roll Number
38 | input#form-roll.form-roll.form-control(type='text', name='rollno', placeholder=student.rollno)
39 | .form-group
40 | label.sr-only(for='form-username') Username
41 | input#form-username.form-username.form-control(type='text', name='username', placeholder=student.username)
42 | .form-group
43 | label.sr-only(for='form-password') Password
44 | input#form-password.form-password.form-control(type='password', name='password', placeholder=student.password)
45 | button.btn(type='submit') Add
46 | .col-sm-3
47 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
48 | // Javascript
49 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
50 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
51 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
52 | script(src='/stylesheets/assets/js/scripts.js')
53 | //if lt IE 10
54 | script(src='assets/js/placeholder.js')
55 |
--------------------------------------------------------------------------------
/public/stylesheets/assets/css/form-elements.css:
--------------------------------------------------------------------------------
1 |
2 | input[type="text"],
3 | input[type="password"],
4 | textarea,
5 | textarea.form-control {
6 | height: 50px;
7 | margin: 0;
8 | padding: 0 20px;
9 | vertical-align: middle;
10 | background: #f8f8f8;
11 | border: 3px solid #ddd;
12 | font-family: 'Roboto', sans-serif;
13 | font-size: 16px;
14 | font-weight: 300;
15 | line-height: 50px;
16 | color: #888;
17 | -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
18 | -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none;
19 | -o-transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -ms-transition: all .3s; transition: all .3s;
20 | }
21 |
22 | textarea,
23 | textarea.form-control {
24 | padding-top: 10px;
25 | padding-bottom: 10px;
26 | line-height: 30px;
27 | }
28 |
29 | input[type="text"]:focus,
30 | input[type="password"]:focus,
31 | textarea:focus,
32 | textarea.form-control:focus {
33 | outline: 0;
34 | background: #fff;
35 | border: 3px solid #ccc;
36 | -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none;
37 | }
38 |
39 | input[type="text"]:-moz-placeholder, input[type="password"]:-moz-placeholder,
40 | textarea:-moz-placeholder, textarea.form-control:-moz-placeholder { color: #888; }
41 |
42 | input[type="text"]:-ms-input-placeholder, input[type="password"]:-ms-input-placeholder,
43 | textarea:-ms-input-placeholder, textarea.form-control:-ms-input-placeholder { color: #888; }
44 |
45 | input[type="text"]::-webkit-input-placeholder, input[type="password"]::-webkit-input-placeholder,
46 | textarea::-webkit-input-placeholder, textarea.form-control::-webkit-input-placeholder { color: #888; }
47 |
48 |
49 |
50 | button.btn {
51 | height: 50px;
52 | margin: 0;
53 | padding: 0 20px;
54 | vertical-align: middle;
55 | background: #de995e;
56 | border: 0;
57 | font-family: 'Roboto', sans-serif;
58 | font-size: 16px;
59 | font-weight: 300;
60 | line-height: 50px;
61 | color: #fff;
62 | -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;
63 | text-shadow: none;
64 | -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none;
65 | -o-transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -ms-transition: all .3s; transition: all .3s;
66 | }
67 |
68 | button.btn:hover { opacity: 0.6; color: #fff; }
69 |
70 | button.btn:active { outline: 0; opacity: 0.6; color: #fff; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; }
71 |
72 | button.btn:focus { outline: 0; opacity: 0.6; background: #de995e; color: #fff; }
73 |
74 | button.btn:active:focus, button.btn.active:focus { outline: 0; opacity: 0.6; background: #de995e; color: #fff; }
75 |
--------------------------------------------------------------------------------
/views/students/edit.jade:
--------------------------------------------------------------------------------
1 |
2 |
3 | doctype html
4 | html(lang='en')
5 | head
6 | meta(charset='utf-8')
7 | meta(http-equiv='X-UA-Compatible', content='IE=edge')
8 | meta(name='viewport', content='width=device-width, initial-scale=1')
9 | title Edit Student
10 | // CSS
11 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/font.css')
12 | link(rel='stylesheet', href='/stylesheets/assets/bootstrap/css/bootstrap.min.css')
13 | link(rel='stylesheet', href='/stylesheets/assets/font-awesome/css/font-awesome.min.css')
14 | link(rel='stylesheet', href='/stylesheets/assets/css/form-elements.css')
15 | link(rel='stylesheet', href='/stylesheets/assets/css/style.css')
16 | body
17 | // Top content
18 | .top-content
19 | .inner-bg
20 | .container
21 | .row
22 | .col-sm-8.col-sm-offset-2.text
23 | h1
24 | strong Edit Student
25 | .row
26 | .col-sm-3
27 | a.btn.btn-info(href='/admin/home', role='button') Go Back!
28 | .col-sm-6.form-box
29 | .form-top
30 | .form-top-left
31 | h3 Edit Student
32 | p Fill the form to add a new student:
33 | .form-bottom
34 | form.login-form(role='form', action='update', method='post')
35 | .form-group
36 | label.sr-only(for='form-name') Name
37 | input#form-name.form-name.form-control(type='text', name='name', value=student.name)
38 |
39 | .form-group
40 | label.sr-only(for='form-roll') Roll Number
41 | input#form-roll.form-roll.form-control(type='text', name='rollno', value=student.rollno)
42 |
43 | .form-group
44 | label.sr-only(for='form-username') Username
45 | input#form-username.form-username.form-control(type='text', name='username', value=student.username)
46 |
47 | .form-group
48 | label.sr-only(for='form-password') Password
49 | input#form-password.form-password.form-control(type='password', name='password', value=student.password)
50 |
51 | .form-group
52 | label.sr-only(for='form-password') Previous
53 | input#form-password.form-password.form-control(type='hidden', name='', value=student.username)
54 |
55 | button.btn(type='submit') Edit
56 | .col-sm-3
57 | a.btn.btn-info(href='../admin/logout', role='button') Logout!
58 | // Javascript
59 | script(src='/stylesheets/assets/js/jquery-1.11.1.min.js')
60 | script(src='/stylesheets/assets/bootstrap/js/bootstrap.min.js')
61 | script(src='/stylesheets/assets/js/jquery.backstretch.min.js')
62 | script(src='/stylesheets/assets/js/scripts.js')
63 | //if lt IE 10
64 | script(src='assets/js/placeholder.js')
65 |
--------------------------------------------------------------------------------
/controllers/courses.js:
--------------------------------------------------------------------------------
1 | var express = require('express')
2 | , router = express.Router()
3 | , Course = require('../models/course');
4 |
5 | var default_courseid = "CourseID";
6 |
7 | var default_course = {
8 | courseid: "CourseID",
9 | coursename: "coursename"
10 | };
11 |
12 | router.get('/new', isLoggedIn, function(req, res) {
13 | res.render('courses/new', { title: 'Add New course', course: default_course});
14 | });
15 |
16 | router.post('/create', isLoggedIn, function(req, res) {
17 | var course = {
18 | courseid: req.body.courseid,
19 | coursename: req.body.coursename
20 | };
21 | var courseid = req.body.courseid;
22 |
23 | Course.getBycourseid(courseid, function(err,doc) {
24 | if(err)
25 | res.send("Some error occured");
26 | else if(doc)
27 | res.redirect('/courses/new');
28 | else{
29 | Course.create(course, function(err, doc) {
30 | if(err)
31 | res.send("Some error occured");
32 | else
33 | res.redirect('/admin/home');
34 | }) }
35 | })
36 | });
37 |
38 | router.get('/get_courseid_edit', isLoggedIn, function(req, res) {
39 | res.render('courses/get_courseid_edit', { title: "Get course ID", courseid: default_courseid});
40 | });
41 |
42 | router.get('/edit', isLoggedIn, function(req,res) {
43 | var courseid = req.query.courseid;
44 | Course.getBycourseid(courseid, function(err,doc) {
45 | if(err)
46 | res.send("Some error occured");
47 | else
48 | {
49 | if(doc)
50 | res.render('courses/edit', {title: 'Edit Course', course: doc});
51 | else
52 | res.render('courses/get_courseid_edit', { title: "Get course ID", courseid: default_courseid});
53 | }
54 | });
55 | });
56 |
57 | router.post('/update', isLoggedIn, function(req, res) {
58 | var course = {
59 | courseid: req.body.courseid,
60 | coursename: req.body.coursename
61 | };
62 | var prevcourseid = req.body.prevcourseid;
63 | Course.update(prevcourseid, course, function(err, doc) {
64 | if(err)
65 | res.render('courses/edit', { title: 'Edit Course', course: doc});
66 | else
67 | res.redirect('../admin/home');
68 | });
69 | });
70 |
71 | router.get('/get_courseid_delete', isLoggedIn, function(req, res) {
72 | var default_courseid = "User Name";
73 | res.render('courses/get_courseid_delete', { title: "Get course ID", courseid: default_courseid});
74 | });
75 |
76 |
77 | router.post('/delete', isLoggedIn, function(req, res) {
78 | var courseid = req.body.courseid;
79 | Course.getBycourseid(courseid, function(err,doc) {
80 | if(err)
81 | res.send("Some error occured");
82 | else if(doc)
83 | {
84 | Course.remove(courseid, function(err, doc) {
85 | if(err)
86 | res.send("Some error occured");
87 | else
88 | res.redirect('../admin/home');
89 | })}
90 | else
91 | res.render('courses/get_courseid_delete', { title: "Get course ID", courseid: default_courseid});
92 | })
93 | });
94 |
95 | module.exports = router;
96 |
97 | function isLoggedIn(req, res, next) {
98 |
99 | // if user is authenticated in the session, carry on
100 | if (req.isAuthenticated()&&req.user.usertype=='admin')
101 | {return next();}
102 |
103 | // if they aren't redirect them to the home page
104 | res.redirect('/');
105 | }
--------------------------------------------------------------------------------
/public/javascripts/question_list.js:
--------------------------------------------------------------------------------
1 | var questionData = [];
2 |
3 | // DOM Ready =============================================================
4 | $(document).ready(function() {
5 |
6 | var time = { hours: "", minutes: ""};
7 | var seconds = 0;
8 |
9 | // Populate the question table on intial load
10 | fillQuestions(time);
11 |
12 | //Timer
13 | var timer = setInterval(function() {
14 |
15 | document.getElementById("time").innerHTML = time.hours + " hrs " + time.minutes + " mins " + (seconds) + " secs" ;
16 |
17 | //Trigger submit on completion of time
18 | if(time.hours == 0 && time.minutes == 0 && seconds == 0 )
19 | {
20 | clearInterval(timer);
21 | document.getElementById("formResponse").submit();
22 | }
23 |
24 | seconds--;
25 |
26 | if(seconds == -1)
27 | {
28 | seconds = 59;
29 | time.minutes-=1;
30 |
31 | if(time.minutes == -1)
32 | {
33 | time.minutes = 59;
34 | time.hours-=1;
35 | }
36 | }
37 | }, 1000);
38 |
39 | // Question link click
40 | $('#questionList table tbody').on('click', 'td a.linkshowuser', showUserInfo);
41 |
42 | });
43 |
44 | // Functions =============================================================
45 |
46 | // Fill Question List
47 | function fillQuestions(time) {
48 |
49 | // Empty content string
50 | var tableContent = '';
51 |
52 | // jQuery AJAX call for JSON
53 | $.getJSON( '/take_exam/list', {exam_code: exam_code}, function( data ) {
54 |
55 | // Question Content
56 | questionData = data.question_list;
57 |
58 | //Exam time data
59 | time.hours = data.duration_hours;
60 | time.minutes = data.duration_minutes;
61 |
62 | $qno=1;
63 |
64 | // For each item in our JSON, add a question link and answer select box
65 | $.each(data.question_list, function(){
66 | tableContent += '