diff --git a/app.js b/app.js index f91d56c..ffa418d 100644 --- a/app.js +++ b/app.js @@ -25,7 +25,7 @@ app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); // uncomment after placing your favicon in /public -//app.use(favicon(__dirname + '/public/favicon.ico')); +app.use(favicon(__dirname + '/public/favicon.ico')); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); @@ -67,6 +67,6 @@ app.use(function(err, req, res, next) { }); //////////////////Main program loop ////////////////// -//mainLoop.queryLoop; +mainLoop.queryLoop; module.exports = app; diff --git a/mongoui/mongoui-master/.gitignore b/mongoui/mongoui-master/.gitignore index 9340349..f3c8e35 100644 --- a/mongoui/mongoui-master/.gitignore +++ b/mongoui/mongoui-master/.gitignore @@ -1,3 +1,2 @@ npm-debug.log -config.json public/gen \ No newline at end of file diff --git a/mongoui/mongoui-master/config.json b/mongoui/mongoui-master/config.json new file mode 100644 index 0000000..5c4d51b --- /dev/null +++ b/mongoui/mongoui-master/config.json @@ -0,0 +1,11 @@ +{ + "database": { + "default": { + "host": "localhost", + "port": 27017, + "name": "storify_localhost", + "username": "", + "password": "" + } + } +} \ No newline at end of file diff --git a/mongoui/mongoui-master/config_default.json b/mongoui/mongoui-master/config_default.json new file mode 100644 index 0000000..5c4d51b --- /dev/null +++ b/mongoui/mongoui-master/config_default.json @@ -0,0 +1,11 @@ +{ + "database": { + "default": { + "host": "localhost", + "port": 27017, + "name": "storify_localhost", + "username": "", + "password": "" + } + } +} \ No newline at end of file diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..807d49b --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,37 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe', +1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', +1 verbose cli 'start' ] +2 info using npm@2.11.2 +3 info using node@v0.12.5 +4 verbose run-script [ 'prestart', 'start', 'poststart' ] +5 info prestart myapp@0.0.0 +6 info start myapp@0.0.0 +7 verbose unsafe-perm in lifecycle true +8 info myapp@0.0.0 Failed to exec start script +9 verbose stack Error: myapp@0.0.0 start: `node ./bin/www` +9 verbose stack Exit status 1 +9 verbose stack at EventEmitter. (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16) +9 verbose stack at EventEmitter.emit (events.js:110:17) +9 verbose stack at ChildProcess. (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:24:14) +9 verbose stack at ChildProcess.emit (events.js:110:17) +9 verbose stack at maybeClose (child_process.js:1015:16) +9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5) +10 verbose pkgid myapp@0.0.0 +11 verbose cwd C:\Users\Mitchell\Desktop\mywebsite +12 error Windows_NT 6.1.7601 +13 error argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" +14 error node v0.12.5 +15 error npm v2.11.2 +16 error code ELIFECYCLE +17 error myapp@0.0.0 start: `node ./bin/www` +17 error Exit status 1 +18 error Failed at the myapp@0.0.0 start script 'node ./bin/www'. +18 error This is most likely a problem with the myapp package, +18 error not with npm itself. +18 error Tell the author that this fails on your system: +18 error node ./bin/www +18 error You can get their info via: +18 error npm owner ls myapp +18 error There is likely additional logging output above. +19 verbose exit [ 1, true ] diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..5c788a8 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/javascripts/custom.js b/public/javascripts/custom.js index fa925e2..e156642 100644 --- a/public/javascripts/custom.js +++ b/public/javascripts/custom.js @@ -4,6 +4,6 @@ $(document).ready(function(){ }); $(function() { - $("#timepicker").timepicker({ 'step' : 15}); + $("#timepicker").timepicker(); }); }); \ No newline at end of file diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 1214b6b..83881d8 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -1,5 +1,5 @@ body { - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; + font-family: 'Arvo', serif; } a { @@ -28,3 +28,21 @@ a { transform: translateY(-50%); } +.form-signin { + max-width: 500px; + padding: 15px; + margin: 0 auto; +} +.form-signin .form-control { + position: relative; + height: auto; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 10px; + font-size: 16px; +} + +.colorRed { + color: red; +} diff --git a/routes/index.js b/routes/index.js index 90e31e3..6002580 100644 --- a/routes/index.js +++ b/routes/index.js @@ -10,46 +10,41 @@ router.get('/', function(req, res, next) { }); router.post('/', function(req, res,next) { - - //check to see which form is being submitted - var checkPage = req.body.searchNumber; - //if searching for number - if (typeof checkPage != 'undefined'){ + var number = req.body.number; + var date = req.body.date; + var time = req.body.time; + var message = req.body.message; + var carrier = req.body.carrier; + var invalid = {}; + var validInputs = true; - var searchNumber = req.param("searchNumber"); - - var query = info.find({'number' : searchNumber}); - - query.select("number date time message updated"); - - query.exec(function (err, callback) { - if (err) return handleError(err); - else { - console.log(callback); - res.render('index', {findParams : callback}); - } - }); - - + if(!numberValidator(number)){ + invalid.number = 'Invalid Number'; + validInputs = false; } - //if submitting records + if(!dateValidator(date)){ + invalid.date = 'Invalid Date'; + validInputs = false; + } + + if (!timeValidator(time)){ + invalid.time = "Invalid Time"; + validInputs = false; + } + + if (validInputs == false){ + res.render('index', invalid); + } else { - - var number = req.body.number; - var date = new Date(req.body.date); - var time = req.body.time; - var message = req.body.message; - var carrier = req.body.carrier; - console.log("------------------------------" + carrier); number = number.replace("-", ""); number = number.replace("-", ""); number = number.concat(carrier); + date = new Date(date); date.setHours(get24Hours(time)); date.setMinutes(getMinutes(time)); - console.log("------------------ " + number); var entry = new info({ number: number, @@ -65,12 +60,7 @@ router.post('/', function(req, res,next) { console.log(entry); res.render('index'); - } -}); - -router.post('/search', function(req, res, next) { - - + } }); module.exports = router; @@ -101,4 +91,20 @@ function get24Hours(time){ function getMinutes(time){ var minutes = parseInt(time.substring(time.indexOf(':') + 1, time.length -2)); return minutes; +} + +function numberValidator(number){ + var re = /^\d{3}\-?\d{3}\-?\d{4}$/; + return re.test(number); +} + +function dateValidator(date){ + var re = /^\d{2}\/\d{2}\/\d{4}$/; + return re.test(date); +} + +function timeValidator(time){ + //var re = /^\d{1,2}\:\d{2}am$|^\d{1,2}\:\d{2}pm$/; + var re = /^[0-9]\:[0-5][0-9]am$|^[0-9]\:[0-5][0-9]pm$|^1[0-2]\:[0-5][0-9]am$|^1[0-2]\:[0-5][0-9]pm$/; + return re.test(time); } \ No newline at end of file diff --git a/savedElements.jade b/savedElements.jade new file mode 100644 index 0000000..30c5241 --- /dev/null +++ b/savedElements.jade @@ -0,0 +1,26 @@ + div.col-lg-4 + h1 Search by number + form(action="/", method="post") + div.form-group + Span Phone Number: + br + input.form-control(type="text", name="searchNumber", placeholder="555-555-5555") + br + input(type="submit", value="submit").btn + br + if (findParams != null) + div.col-lg-4 + each index in findParams + -var date = new Date(index.date); + + Span= index.number + br + Span= date + br + Span= index.time + br + Span= index.message + br + Span= index.updated + br + br \ No newline at end of file diff --git a/testAdd b/testAdd deleted file mode 100644 index e69de29..0000000 diff --git a/views/index.jade b/views/index.jade index 97c1529..d2a7aa7 100644 --- a/views/index.jade +++ b/views/index.jade @@ -6,55 +6,47 @@ block content h1.headerText.textCenter mitchellG.me div.container - div.row - div.col-lg-4 - h1 Submit Form - form(action="/", method="post") - div.form-group - Span Phone Number: - br - input.form-control(type="text", name="number", placeholder="555-555-5555") - br - Span Carrier: - select.form-control(name="carrier") - option(value="@vtext.com") Verizon - br - Span Date: - br - input.form-control(type="text", name="date", id="datepicker" placeholder="YYYY-MM-DD") - br - Span Time: - br - input.form-control(type="text", name="time", id="timepicker" placeholder="12:00am") - br - Span Message: - input.form-control(type="textarea", name="message", placeholder="Type your message here...") - br - input(type="submit", value="submit").btn - div.col-lg-4 - h1 Search by number - form(action="/", method="post") - div.form-group - Span Phone Number: - br - input.form-control(type="text", name="searchNumber", placeholder="555-555-5555") - br - input(type="submit", value="submit").btn + h1.textCenter Submit Form + form(action="/", method="post") + div.form-signin + Span Phone Number: + if (number != null) + Span.colorRed= " " + number br - if (findParams != null) - div.col-lg-4 - each index in findParams - -var date = new Date(index.date); - - Span= index.number - br - Span= date - br - Span= index.time - br - Span= index.message - br - Span= index.updated - br - br + input.form-control(required type="text", name="number", placeholder="555-555-5555") + br + Span Carrier: + select.form-control(name="carrier") + option(value="@vtext.com") Verizon + option(value="@txt.att.net") AT&T + option(value="@tmomail.net") T-Mobile + option(value="@messaging.sprintpcs.com ") Sprint + option(value="@vmobl.com") Virgin Mobile + option(value="@mmst5.tracfone.com") Tracfone + option(value="@mymetropcs.com") Metro PCS + option(value="@myboostmobile.com") Boost Mobile + option(value="@sms.mycricket.com") Cricket + option(value="@messaging.nextel.com") Nextel + option(value="@message.alltel.com") Alltel + option(value="@ptel.com") Ptel + option(value="@tms.suncom.com") Suncom + option(value="@qwestmp.com") Quest + option(value="@email.uscc.net") U.S. Cellular + br + Span Date: + if (date != null) + Span.colorRed= " " + date + br + input.form-control(required type="text", name="date", id="datepicker" placeholder="YYYY-MM-DD") + br + Span Time: + if (time != null) + Span.colorRed= " " + time + br + input.form-control(required type="text", name="time", id="timepicker" placeholder="12:00am") + br + Span Message: + textarea.form-control(required type="textarea", name="message", placeholder="Type your message here...") + br + input(type="submit", value="Remind Me").btn.btn-lg.btn-primary.btn-block \ No newline at end of file diff --git a/views/layout.jade b/views/layout.jade index c49b671..49ba084 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -6,6 +6,7 @@ html link(rel='stylesheet', href='/stylesheets/style.css') link(rel='stylesheet', href='jquery-ui-1.11.4/jquery-ui.css') link(rel='stylesheet', href='jquery-timepicker/jquery.timepicker.css') + link(href='http://fonts.googleapis.com/css?family=Arvo', rel='stylesheet', type='text/css') body block content script(src="http://code.jquery.com/jquery-latest.min.js")