diff options
| author | okalintu <ilkka.oksanen@aalto.fi> | 2015-03-09 16:12:45 +0200 |
|---|---|---|
| committer | okalintu <ilkka.oksanen@aalto.fi> | 2015-03-09 16:12:45 +0200 |
| commit | f5e82d12e4e5cf2959a38b73271abc2eab434519 (patch) | |
| tree | 8ab28dc2d797b6ab4b231a61cb322800f595be27 | |
| parent | f607dac15deb8b9faeb060661ccf8edd2b9564fc (diff) | |
sanitized log and added outdated property to admin
| -rw-r--r-- | f/scripts/client.js | 7 | ||||
| -rw-r--r-- | f/styles/style.css | 7 | ||||
| -rw-r--r-- | f/templates/adm.html | 2 | ||||
| -rw-r--r-- | f/templates/index.html | 12 | ||||
| -rw-r--r-- | index.js | 21 |
5 files changed, 41 insertions, 8 deletions
diff --git a/f/scripts/client.js b/f/scripts/client.js index 546aa57..b02123f 100644 --- a/f/scripts/client.js +++ b/f/scripts/client.js @@ -9,6 +9,7 @@ ioc.controller('ioctrl',function($scope){ $scope.row=""; $scope.name=""; $scope.qsize=0; + $scope.outdated = true; $scope.submit = function(){ soc.emit("queadd",{"row":$scope.row,"name":$scope.name,"uid":$scope.uid}); @@ -19,6 +20,7 @@ ioc.controller('ioctrl',function($scope){ soc.on("quedata",function(data){ $scope.que=data; $scope.qsize=data.length; + $scope.outdated = false; $scope.$apply(); }); @@ -27,11 +29,16 @@ ioc.controller('ioctrl',function($scope){ pw= data.pw; }); + soc.on("disconnect",function(data){ + setTimeout(function(){console.log("blblbl");$scope.uid = data.uid;pw= data.pw;$scope.$apply();},1000) + }); + soc.on("err",function(err){ console.log("error! msg: "+err.msg); }); $scope.popfirst = function(){ + $scope.outdated = true; soc.emit("quepopfirst",""); }; $scope.querm = function(qid){ diff --git a/f/styles/style.css b/f/styles/style.css index ae909c8..d63e083 100644 --- a/f/styles/style.css +++ b/f/styles/style.css @@ -39,7 +39,6 @@ td:first-child{ }
#adminscreen{
border:3px solid #202020;
- background-color:darkgreen;
font-size:72px;
width:400px;
margin-left:auto;
@@ -51,3 +50,9 @@ td:first-child{ #adminscreen td {
padding-left:10px;
}
+.outdated{
+background-color:darkred;
+}
+.updated{
+background-color:darkgreen;
+}
diff --git a/f/templates/adm.html b/f/templates/adm.html index bd78764..ae9de77 100644 --- a/f/templates/adm.html +++ b/f/templates/adm.html @@ -9,7 +9,7 @@ </head> <body ng-app="ioc" > <div ng-controller="ioctrl"> - <table ng-click="popfirst()" id="adminscreen"> + <table ng-click="popfirst()" ng-class="{outdated:outdated,updated:!outdated}" id="adminscreen"> <tr><td> Jonoa:</td><td> {{qsize}}</td></tr> <tr><td>Nimi: </td><td> {{que[0].name}}</td></tr> <tr><td>Rivi: </td><td> {{que[0].row}}</td></tr> diff --git a/f/templates/index.html b/f/templates/index.html index b02d4b8..f5da8a9 100644 --- a/f/templates/index.html +++ b/f/templates/index.html @@ -10,6 +10,18 @@ </head> <body ng-app="ioc" > <div ng-controller="ioctrl" id="container_main"> +<H1>Jono @ jono.dy.fi </h1> +<div> +<H2>ohjeita</h2> +SPSS löytyy seuraavasti: +<br> +käynnistävalikko (windowslogo!) -> all programs -> +IBM SPSS statistics -> IBM SPSS statistics 22 +<br> +ÄLKÄÄ SULKEKO OUTPUT IKKUNAA/IKKUNOITA!! +Niiden sisältöä käytetään tarkistuksessa. +<br> +</div> <table id="addform"> <tr><td>Rivi: </td><td> <select ng-model="row"> <option value="1" selected="selected">1</option> @@ -29,15 +29,15 @@ io.on('connection', function(socket){ socket.on("queadd",function(data){ - console.log("adding new que entry with user :" ); + log("adding new que entry with user: " +data.name+ " , row " +data.row); data.qid= Date.now(); que.push(data); io.emit("quedata",que); }); socket.on("quepopfirst",function(data){ - console.log("deleting first from que"); - que.shift(); + var deleted = que.shift(); + log("admin deleted "+ deleted.name +" from que"); io.emit("quedata",que); }); @@ -48,7 +48,7 @@ io.on('connection', function(socket){ socket.emit("err",{"msg":"you're not allowed to remove this entry"}); break; } - console.log("deleting: "+ que[i].name); + log(que[i].name+" deleted himself from que"); que.splice(i,1); io.emit("quedata",que); break; @@ -58,6 +58,15 @@ io.on('connection', function(socket){ }); -http.listen(3000, function(){ - console.log('listening on *:3000'); +function getTimeString() +{ + return Date().toLocaleString(); +} + +function log(msg){ + console.log(getTimeString()+": "+msg); +} + +http.listen(80, function(){ + log('listening on *:80'); }); |
