Compare commits

..

No commits in common. "2b84618d1e8ed8bfe0bef958cdebd3f489c6cac3" and "ddadd0e4e6a81ac43e32de36a9a90aa7ad2d341b" have entirely different histories.

12 changed files with 957 additions and 2 deletions

View File

@ -1,6 +1,7 @@
'use strict';
var gpower;
var laststate;
angular.module('roomstateapp.controllers', []).
controller('StatusCtrl', function ($scope, $http, Socket) {
@ -20,6 +21,7 @@ angular.module('roomstateapp.controllers', []).
Socket.on('sdata', function(message) {
console.log("received data from server: " + message.data.names);
stateNotification(message.data.state);
$scope.simple = message.data;
gpower.refresh(message.data.power);
});
@ -83,4 +85,25 @@ gpower = new JustGage({
});
function stateNotification(state) {
if (state == true && laststate != true && laststate != null) {
laststate = true;
showNotification("CTDO - Status", "Der Chaostreff ist nun offen.", "/img/green.png", 4);
} else if (state == false && laststate != false && laststate != null) {
laststate = false;
showNotification("CTDO - Staus", "Der Chaostreff ist nun geschlossen", "/img/red.png", 4);
} else {
laststate = state;
}
}
function toggle() {
toggleNotifications();
if (enabledNotifications === true) {
document.getElementById("notificationButton").innerHTML = "Statusbenachrichtigungen an";
document.getElementById("notificationButton").className = "btn btn-block btn-success";
} else {
document.getElementById("notificationButton").innerHTML = "Statusbenachrichtigungen aus";
document.getElementById("notificationButton").className = "btn btn-block btn-danger";
}
}

41
public/js/graph.js Normal file
View File

@ -0,0 +1,41 @@
$(function() {
// TODO: we could try Rickshaw.Graph.JSONP instead of using jQuery getJSON
// http://code.shutterstock.com/rickshaw/
$.getJSON("/api/usercount", function(data, textStatus, jqXHR) {
var offset = new Date().getTimezoneOffset();
var newData = [];
// TODO: we could change the API to directly give us { x: , y: } objects
for (var i = 0; i < data.datapoints.length; i++) {
var date = moment(data.datapoints[i].at).unix() - offset * 60;
var value = parseInt(data.datapoints[i].value);
newData.push({x: date, y: value});
}
var graph = new Rickshaw.Graph( {
element: document.querySelector("#graph"),
renderer: 'line',
series: [ {
data: newData,
name: 'Benutzer',
color: 'steelblue'
} ]
} );
new Rickshaw.Graph.Axis.Time({graph: graph}).render();
new Rickshaw.Graph.Axis.Y({graph: graph}).render();
new Rickshaw.Graph.HoverDetail({ graph: graph, yFormatter: function (y) { return y.toFixed(0) } });
graph.render();
});
});

1
public/js/vendor/d3.layout.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
public/js/vendor/d3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

43
public/js/vendor/ink-all.min.js vendored Normal file

File diff suppressed because one or more lines are too long

22
public/js/vendor/ink-ui.min.js vendored Normal file

File diff suppressed because one or more lines are too long

715
public/js/vendor/ink.formvalidator.js vendored Normal file
View File

@ -0,0 +1,715 @@
/**
* @module Ink.UI.FormValidator_1
* @author inkdev AT sapo.pt
* @version 1
*/
Ink.createModule('Ink.UI.FormValidator', '1', ['Ink.Dom.Css_1','Ink.Util.Validator_1'], function( Css, InkValidator ) {
'use strict';
/**
* @class Ink.UI.FormValidator
* @version 1
*/
var FormValidator = {
/**
* Specifies the version of the component
*
* @property version
* @type {String}
* @readOnly
* @public
*/
version: '1',
/**
* Available flags to use in the validation process.
* The keys are the 'rules', and their values are objects with the key 'msg', determining
* what is the error message.
*
* @property _flagMap
* @type {Object}
* @readOnly
* @private
*/
_flagMap: {
//'ink-fv-required': {msg: 'Campo obrigat&oacute;rio'},
'ink-fv-required': {msg: 'Required field'},
//'ink-fv-email': {msg: 'E-mail inv&aacute;lido'},
'ink-fv-email': {msg: 'Invalid e-mail address'},
//'ink-fv-url': {msg: 'URL inv&aacute;lido'},
'ink-fv-url': {msg: 'Invalid URL'},
//'ink-fv-number': {msg: 'N&uacute;mero inv&aacute;lido'},
'ink-fv-number': {msg: 'Invalid number'},
//'ink-fv-phone_pt': {msg: 'N&uacute;mero de telefone inv&aacute;lido'},
'ink-fv-phone_pt': {msg: 'Invalid phone number'},
//'ink-fv-phone_cv': {msg: 'N&uacute;mero de telefone inv&aacute;lido'},
'ink-fv-phone_cv': {msg: 'Invalid phone number'},
//'ink-fv-phone_mz': {msg: 'N&uacute;mero de telefone inv&aacute;lido'},
'ink-fv-phone_mz': {msg: 'Invalid phone number'},
//'ink-fv-phone_ao': {msg: 'N&uacute;mero de telefone inv&aacute;lido'},
'ink-fv-phone_ao': {msg: 'Invalid phone number'},
//'ink-fv-date': {msg: 'Data inv&aacute;lida'},
'ink-fv-date': {msg: 'Invalid date'},
//'ink-fv-confirm': {msg: 'Confirma&ccedil;&atilde;o inv&aacute;lida'},
'ink-fv-confirm': {msg: 'Confirmation does not match'},
'ink-fv-custom': {msg: ''}
},
/**
* This property holds all form elements for later validation
*
* @property elements
* @type {Object}
* @public
*/
elements: {},
/**
* This property holds the objects needed to cross-check for the 'confirm' rule
*
* @property confirmElms
* @type {Object}
* @public
*/
confirmElms: {},
/**
* This property holds the previous elements in the confirmElms property, but with a
* true/false specifying if it has the class ink-fv-confirm.
*
* @property hasConfirm
* @type {Object}
*/
hasConfirm: {},
/**
* Defined class name to use in error messages label
*
* @property _errorClassName
* @type {String}
* @readOnly
* @private
*/
_errorClassName: 'tip',
/**
* @property _errorValidationClassName
* @type {String}
* @readOnly
* @private
*/
_errorValidationClassName: 'validaton',
/**
* @property _errorTypeWarningClassName
* @type {String}
* @readOnly
* @private
*/
_errorTypeWarningClassName: 'warning',
/**
* @property _errorTypeErrorClassName
* @type {String}
* @readOnly
* @private
*/
_errorTypeErrorClassName: 'error',
/**
* Check if a form is valid or not
*
* @method validate
* @param {DOMElement|String} elm DOM form element or form id
* @param {Object} options Options for
* @param {Function} [options.onSuccess] function to run when form is valid
* @param {Function} [options.onError] function to run when form is not valid
* @param {Array} [options.customFlag] custom flags to use to validate form fields
* @public
* @return {Boolean}
*/
validate: function(elm, options)
{
this._free();
options = Ink.extendObj({
onSuccess: false,
onError: false,
customFlag: false,
confirmGroup: []
}, options || {});
if(typeof(elm) === 'string') {
elm = document.getElementById(elm);
}
if(elm === null){
return false;
}
this.element = elm;
if(typeof(this.element.id) === 'undefined' || this.element.id === null || this.element.id === '') {
// generate a random ID
this.element.id = 'ink-fv_randomid_'+(Math.round(Math.random() * 99999));
}
this.custom = options.customFlag;
this.confirmGroup = options.confirmGroup;
var fail = this._validateElements();
if(fail.length > 0) {
if(options.onError) {
options.onError(fail);
} else {
this._showError(elm, fail);
}
return false;
} else {
if(!options.onError) {
this._clearError(elm);
}
this._clearCache();
if(options.onSuccess) {
options.onSuccess();
}
return true;
}
},
/**
* Reset previously generated validation errors
*
* @method reset
* @public
*/
reset: function()
{
this._clearError();
this._clearCache();
},
/**
* Cleans the object
*
* @method _free
* @private
*/
_free: function()
{
this.element = null;
//this.elements = [];
this.custom = false;
this.confirmGroup = false;
},
/**
* Cleans the properties responsible for caching
*
* @method _clearCache
* @private
*/
_clearCache: function()
{
this.element = null;
this.elements = [];
this.custom = false;
this.confirmGroup = false;
},
/**
* Gets the form elements and stores them in the caching properties
*
* @method _getElements
* @private
*/
_getElements: function()
{
//this.elements = [];
// if(typeof(this.elements[this.element.id]) !== 'undefined') {
// return;
// }
this.elements[this.element.id] = [];
this.confirmElms[this.element.id] = [];
//console.log(this.element);
//console.log(this.element.elements);
var formElms = this.element.elements;
var curElm = false;
for(var i=0, totalElm = formElms.length; i < totalElm; i++) {
curElm = formElms[i];
if(curElm.getAttribute('type') !== null && curElm.getAttribute('type').toLowerCase() === 'radio') {
if(this.elements[this.element.id].length === 0 ||
(
curElm.getAttribute('type') !== this.elements[this.element.id][(this.elements[this.element.id].length - 1)].getAttribute('type') &&
curElm.getAttribute('name') !== this.elements[this.element.id][(this.elements[this.element.id].length - 1)].getAttribute('name')
)) {
for(var flag in this._flagMap) {
if(Css.hasClassName(curElm, flag)) {
this.elements[this.element.id].push(curElm);
break;
}
}
}
} else {
for(var flag2 in this._flagMap) {
if(Css.hasClassName(curElm, flag2) && flag2 !== 'ink-fv-confirm') {
/*if(flag2 == 'ink-fv-confirm') {
this.confirmElms[this.element.id].push(curElm);
this.hasConfirm[this.element.id] = true;
}*/
this.elements[this.element.id].push(curElm);
break;
}
}
if(Css.hasClassName(curElm, 'ink-fv-confirm')) {
this.confirmElms[this.element.id].push(curElm);
this.hasConfirm[this.element.id] = true;
}
}
}
//debugger;
},
/**
* Runs the validation for each element
*
* @method _validateElements
* @private
*/
_validateElements: function()
{
var oGroups;
this._getElements();
//console.log('HAS CONFIRM', this.hasConfirm);
if(typeof(this.hasConfirm[this.element.id]) !== 'undefined' && this.hasConfirm[this.element.id] === true) {
oGroups = this._makeConfirmGroups();
}
var errors = [];
var curElm = false;
var customErrors = false;
var inArray;
for(var i=0, totalElm = this.elements[this.element.id].length; i < totalElm; i++) {
inArray = false;
curElm = this.elements[this.element.id][i];
if(!curElm.disabled) {
for(var flag in this._flagMap) {
if(Css.hasClassName(curElm, flag)) {
if(flag !== 'ink-fv-custom' && flag !== 'ink-fv-confirm') {
if(!this._isValid(curElm, flag)) {
if(!inArray) {
errors.push({elm: curElm, errors:[flag]});
inArray = true;
} else {
errors[(errors.length - 1)].errors.push(flag);
}
}
} else if(flag !== 'ink-fv-confirm'){
customErrors = this._isCustomValid(curElm);
if(customErrors.length > 0) {
errors.push({elm: curElm, errors:[flag], custom: customErrors});
}
} else if(flag === 'ink-fv-confirm'){
}
}
}
}
}
errors = this._validateConfirmGroups(oGroups, errors);
//console.log(InkDumper.returnDump(errors));
return errors;
},
/**
* Runs the 'confirm' validation for each group of elements
*
* @method _validateConfirmGroups
* @param {Array} oGroups Array/Object that contains the group of confirm objects
* @param {Array} errors Array that will store the errors
* @private
* @return {Array} Array of errors that was passed as 2nd parameter (either changed, or not, depending if errors were found).
*/
_validateConfirmGroups: function(oGroups, errors)
{
//console.log(oGroups);
var curGroup = false;
for(var i in oGroups) {
if (oGroups.hasOwnProperty(i)) {
curGroup = oGroups[i];
if(curGroup.length === 2) {
if(curGroup[0].value !== curGroup[1].value) {
errors.push({elm:curGroup[1], errors:['ink-fv-confirm']});
}
}
}
}
return errors;
},
/**
* Creates the groups of 'confirm' objects
*
* @method _makeConfirmGroups
* @private
* @return {Array|Boolean} Returns the array of confirm elements or false on error.
*/
_makeConfirmGroups: function()
{
var oGroups;
if(this.confirmGroup && this.confirmGroup.length > 0) {
oGroups = {};
var curElm = false;
var curGroup = false;
//this.confirmElms[this.element.id];
for(var i=0, total=this.confirmElms[this.element.id].length; i < total; i++) {
curElm = this.confirmElms[this.element.id][i];
for(var j=0, totalG=this.confirmGroup.length; j < totalG; j++) {
curGroup = this.confirmGroup[j];
if(Css.hasClassName(curElm, curGroup)) {
if(typeof(oGroups[curGroup]) === 'undefined') {
oGroups[curGroup] = [curElm];
} else {
oGroups[curGroup].push(curElm);
}
}
}
}
return oGroups;
} else {
if(this.confirmElms[this.element.id].length === 2) {
oGroups = {
"ink-fv-confirm": [
this.confirmElms[this.element.id][0],
this.confirmElms[this.element.id][1]
]
};
}
return oGroups;
}
return false;
},
/**
* Validates an element with a custom validation
*
* @method _isCustomValid
* @param {DOMElemenmt} elm Element to be validated
* @private
* @return {Array} Array of errors. If no errors are found, results in an empty array.
*/
_isCustomValid: function(elm)
{
var customErrors = [];
var curFlag = false;
for(var i=0, tCustom = this.custom.length; i < tCustom; i++) {
curFlag = this.custom[i];
if(Css.hasClassName(elm, curFlag.flag)) {
if(!curFlag.callback(elm, curFlag.msg)) {
customErrors.push({flag: curFlag.flag, msg: curFlag.msg});
}
}
}
return customErrors;
},
/**
* Runs the normal validation functions for a specific element
*
* @method _isValid
* @param {DOMElement} elm DOMElement that will be validated
* @param {String} fieldType Rule to be validated. This must be one of the keys present in the _flagMap property.
* @private
* @return {Boolean} The result of the validation.
*/
_isValid: function(elm, fieldType)
{
switch(fieldType) {
case 'ink-fv-required':
if(elm.nodeName.toLowerCase() === 'select') {
if(elm.selectedIndex > 0) {
return true;
} else {
return false;
}
}
if(elm.getAttribute('type') !== 'checkbox' && elm.getAttribute('type') !== 'radio') {
if(this._trim(elm.value) !== '') {
return true;
}
} else if(elm.getAttribute('type') === 'checkbox') {
if(elm.checked === true) {
return true;
}
} else if(elm.getAttribute('type') === 'radio') { // get top radio
var aFormRadios = elm.form[elm.name];
if(typeof(aFormRadios.length) === 'undefined') {
aFormRadios = [aFormRadios];
}
var isChecked = false;
for(var i=0, totalRadio = aFormRadios.length; i < totalRadio; i++) {
if(aFormRadios[i].checked === true) {
isChecked = true;
}
}
return isChecked;
}
break;
case 'ink-fv-email':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.mail(elm.value)) {
return true;
}
}
break;
case 'ink-fv-url':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.url(elm.value)) {
return true;
}
}
break;
case 'ink-fv-number':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(!isNaN(Number(elm.value))) {
return true;
}
}
break;
case 'ink-fv-phone_pt':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.isPTPhone(elm.value)) {
return true;
}
}
break;
case 'ink-fv-phone_cv':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.isCVPhone(elm.value)) {
return true;
}
}
break;
case 'ink-fv-phone_ao':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.isAOPhone(elm.value)) {
return true;
}
}
break;
case 'ink-fv-phone_mz':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
if(InkValidator.isMZPhone(elm.value)) {
return true;
}
}
break;
case 'ink-fv-date':
if(this._trim(elm.value) === '') {
if(Css.hasClassName(elm, 'ink-fv-required')) {
return false;
} else {
return true;
}
} else {
var Element = Ink.getModule('Ink.Dom.Element',1);
var dataset = Element.data( elm );
var validFormat = 'yyyy-mm-dd';
if( Css.hasClassName(elm, 'ink-datepicker') && ("format" in dataset) ){
validFormat = dataset.format;
} else if( ("validFormat" in dataset) ){
validFormat = dataset.validFormat;
}
if( !(validFormat in InkValidator._dateParsers ) ){
var validValues = [];
for( var val in InkValidator._dateParsers ){
if (InkValidator._dateParsers.hasOwnProperty(val)) {
validValues.push(val);
}
}
throw "The attribute data-valid-format must be one of the following values: " + validValues.join(',');
}
return InkValidator.isDate( validFormat, elm.value );
}
break;
case 'ink-fv-custom':
break;
}
return false;
},
/**
* Makes the necessary changes to the markup to show the errors of a given element
*
* @method _showError
* @param {DOMElement} formElm The form element to be changed to show the errors
* @param {Array} aFail An array with the errors found.
* @private
*/
_showError: function(formElm, aFail)
{
this._clearError(formElm);
//ink-warning-field
//console.log(aFail);
var curElm = false;
for(var i=0, tFail = aFail.length; i < tFail; i++) {
curElm = aFail[i].elm;
if(curElm.getAttribute('type') !== 'radio') {
var newLabel = document.createElement('p');
//newLabel.setAttribute('for',curElm.id);
//newLabel.className = this._errorClassName;
//newLabel.className += ' ' + this._errorTypeErrorClassName;
Css.addClassName(newLabel, this._errorClassName);
Css.addClassName(newLabel, this._errorTypeErrorClassName);
if(aFail[i].errors[0] !== 'ink-fv-custom') {
newLabel.innerHTML = this._flagMap[aFail[i].errors[0]].msg;
} else {
newLabel.innerHTML = aFail[i].custom[0].msg;
}
if(curElm.getAttribute('type') !== 'checkbox') {
curElm.nextSibling.parentNode.insertBefore(newLabel, curElm.nextSibling);
if(Css.hasClassName(curElm.parentNode, 'control')) {
Css.addClassName(curElm.parentNode.parentNode, 'validation');
if(aFail[i].errors[0] === 'ink-fv-required') {
Css.addClassName(curElm.parentNode.parentNode, 'error');
} else {
Css.addClassName(curElm.parentNode.parentNode, 'warning');
}
}
} else {
/* // TODO checkbox... does not work with this CSS
curElm.parentNode.appendChild(newLabel);
if(Css.hasClassName(curElm.parentNode.parentNode, 'control-group')) {
Css.addClassName(curElm.parentNode.parentNode, 'control');
Css.addClassName(curElm.parentNode.parentNode, 'validation');
Css.addClassName(curElm.parentNode.parentNode, 'error');
}*/
}
} else {
if(Css.hasClassName(curElm.parentNode.parentNode, 'control-group')) {
Css.addClassName(curElm.parentNode.parentNode, 'validation');
Css.addClassName(curElm.parentNode.parentNode, 'error');
}
}
}
},
/**
* Clears the error of a given element. Normally executed before any validation, for all elements, as a reset.
*
* @method _clearErrors
* @param {DOMElement} formElm Form element to be cleared.
* @private
*/
_clearError: function(formElm)
{
//return;
var aErrorLabel = formElm.getElementsByTagName('p');
var curElm = false;
for(var i = (aErrorLabel.length - 1); i >= 0; i--) {
curElm = aErrorLabel[i];
if(Css.hasClassName(curElm, this._errorClassName)) {
if(Css.hasClassName(curElm.parentNode, 'control')) {
Css.removeClassName(curElm.parentNode.parentNode, 'validation');
Css.removeClassName(curElm.parentNode.parentNode, 'error');
Css.removeClassName(curElm.parentNode.parentNode, 'warning');
}
if(Css.hasClassName(curElm,'tip') && Css.hasClassName(curElm,'error')){
curElm.parentNode.removeChild(curElm);
}
}
}
var aErrorLabel2 = formElm.getElementsByTagName('ul');
for(i = (aErrorLabel2.length - 1); i >= 0; i--) {
curElm = aErrorLabel2[i];
if(Css.hasClassName(curElm, 'control-group')) {
Css.removeClassName(curElm, 'validation');
Css.removeClassName(curElm, 'error');
}
}
},
/**
* Removes unnecessary spaces to the left or right of a string
*
* @method _trim
* @param {String} stri String to be trimmed
* @private
* @return {String|undefined} String trimmed.
*/
_trim: function(str)
{
if(typeof(str) === 'string')
{
return str.replace(/^\s+|\s+$|\n+$/g, '');
}
}
};
return FormValidator;
});

52
public/js/vendor/notification.js vendored Normal file
View File

@ -0,0 +1,52 @@
var Notification = window.Notification || window.mozNotification || window.webkitNotification;
var enabledNotifications,
grantedPermission;
function askPermission () {
Notification.requestPermission(function (permission) {
// console.log(permission);
if (permission == "granted") {
grantedPermission = true;
}
else {
grantedPermission = false;
}
});
}
function toggleNotifications() {
if (enabledNotifications === true) {
enabledNotifications = false;
} else if (!enabledNotifications && grantedPermission === true){
enabledNotifications = true;
} else {
askPermission();
}
}
function showNotification(name, body, icon, timeout) {
if (enabledNotifications) {
var instance = new Notification(
name, {
body: body,
icon: icon
}
);
instance.onclick = function () {
// Something to do
};
instance.onerror = function () {
// Something to do
};
instance.onshow = function () {
setTimeout(function(){
instance.close();
}, timeout * 1000);
};
instance.onclose = function () {
// Something to do
};
}
}

View File

@ -2,3 +2,48 @@ exports.index = function (req, res) {
res.render('index', { title: 'Home' })
};
/*
exports.db = function (req, res) {
res.render('database', { title: 'Manage MAC' })
};
exports.form = function (req, res) {
var snmpMac = req.app.get('snmpMac'); //TODO: wie kann man das schoener machen?
var mac = req.body.mac,
label = req.body.label,
action = req.body.action;
var status = "";
mac = mac.toLowerCase();
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
if (/^([0-9a-f]{2}[:-]){5}([0-9a-f]{2})$/.exec(mac)) {
if (action == "add") {
if (label) {
if(label.split('').length > 1) {
console.log("add mac request mac: " +mac + " label " + label + " ip: " + ip);
snmpMac.add(mac, '"' + label + '"', function (err) {
console.log("add mac result: " + err);
req.flash('status', err == null ? "" : "database error: " + err);
res.redirect("/db");
});
}
} else {
req.flash('status', 'label is invalid ("^[0-9a-zA-Z]+$")');
res.redirect("/db");
}
} else if (action == "remove") {
console.log("remove mac request mac: "+mac + " label " + label + " ip: " + ip);
snmpMac.delete(mac, function (err) {
console.log("delete mac result: " + err);
req.flash('status', err == null ? "" : "database error: " + err);
res.redirect("/db");
});
} else {
res.redirect("/db");
}
} else {
req.flash('status', 'mac address is invalid');
res.redirect("/db");
}
};
*/

View File

@ -2,6 +2,9 @@ var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cookieSession = require('cookie-session');
var flash = require('connect-flash');
var Flukso = require("./flukso");
var IpPoll = require("./ip-poll");
@ -118,6 +121,10 @@ setInterval(flukso.pollPower, 5000);
flukso.pollPower();
app.use(express.static('public'));
app.use(cookieParser());
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json({extended: true}));
app.use(cookieSession({secret: 'ctdo', cookie: {maxAge: 60000}}));
app.use(flash());
app.set('/views');

View File

@ -32,9 +32,11 @@ block content
block scripts
script(type="text/javascript",src="/js/vendor/d3.min.js")
script(type="text/javascript",src="/js/vendor/d3.layout.min.js")
script(type="text/javascript",src="/js/vendor/rickshaw.min.js")
script(type="text/javascript",src="/js/vendor/moment.min.js")
script(type="text/javascript",src="/js/graph.js")
script(type="text/javascript",src="/js/vendor/raphael.2.1.0.min.js")
script(type="text/javascript",src="/js/vendor/justgage.1.0.1.min.js")

View File

@ -35,10 +35,12 @@ html(ng-app="roomstateapp")
script(type="text/javascript", src="/js/vendor/jquery-1.9.1.min.js")
script(type="text/javascript", src="/js/vendor/ink.min.js")
script(type="text/javascript", src="/js/vendor/autoload.js")
script(type="text/javascript", src="/js/vendor/html5shiv.js")
script(type="text/javascript", src="/js/vendor/prettify.js")
script(type="text/javascript", src="/js/vendor/modernizr.js")
script(type="text/javascript", src="/js/app.js")
script(type="text/javascript", src="/js/vendor/notification.js")
block scripts