working on issue #297

parent 418be65a
......@@ -7,6 +7,10 @@
*.o
*.so
# Temporal files
################
\#.*\#
# BCrypt build #
################
sails/src/node_modules/bcrypt/build/
......@@ -15,6 +19,8 @@ sails/src/node_modules/bcrypt/build/
##########
sails/upload
sails/symbolstx
sails/src/assets/symbolstx
sails/src/assets/upload
# Other #
#########
......
......@@ -11,7 +11,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Reload student pictos (back from addpicto)
$scope.reload_pictos = function(){
$http
.get(config.backend+'/stu/'+ $scope.studentUser.id +'/pictos')
.get(config.backend+'/stu/'+ $scope.studentData.id +'/pictos')
.success(function(data, status, headers, config) {
// Add to list
$scope.studentPictos = data;
......@@ -69,7 +69,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
var deleteStuPicto = $window.confirm('Are you absolutely sure you want to delete?');
if(deleteStuPicto){
$http
.delete(config.backend+'/stu/'+ $scope.studentUser.id + '/picto/' + stuPicto.id)
.delete(config.backend+'/stu/'+ $scope.studentData.id + '/picto/' + stuPicto.id)
.success(function(data, status, headers, config) {
// Eliminar de la vista: Se recorre el array de objetos json para buscarlo
......@@ -91,7 +91,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
io.socket.post('/stu/vocabulary', {
action: 'delete',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: data
}
},
......@@ -117,7 +117,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
else stuPicto.attributes.status = "enabled";
$http
.put(config.backend+'/stu/'+ $scope.studentUser.id + '/picto/' + stuPicto.id, { 'attributes': stuPicto.attributes })
.put(config.backend+'/stu/'+ $scope.studentData.id + '/picto/' + stuPicto.id, { 'attributes': stuPicto.attributes })
.success(function(data, status, headers, config) {
// Actualizar la vista: Se recorre el array de objetos json para buscarlo
......@@ -128,7 +128,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
io.socket.post('/stu/vocabulary', {
action: 'update',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: data
}
},
......@@ -159,7 +159,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Update the ORIGIN picto coords in server (if the picto is not empty)
if($scope.pcb[c_ori[0]][c_ori[1]].id){
$http
.put(config.backend+'/stu/'+ $scope.studentUser.id + '/picto/' +
.put(config.backend+'/stu/'+ $scope.studentData.id + '/picto/' +
$scope.pcb[c_ori[0]][c_ori[1]].id, { 'attributes': $scope.pcb[c_ori[0]][c_ori[1]].attributes })
.success(function(data, status, headers, config) {
console.log("Coords for picto origin updated");
......@@ -169,7 +169,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
io.socket.post('/stu/vocabulary', {
action: 'update',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: data
}
},
......@@ -187,7 +187,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
// Update the DESTINATION picto coords in server (if the picto is not empty)
if($scope.pcb[c_des[0]][c_des[1]].id){
$http
.put(config.backend+'/stu/'+ $scope.studentUser.id + '/picto/' +
.put(config.backend+'/stu/'+ $scope.studentData.id + '/picto/' +
$scope.pcb[c_des[0]][c_des[1]].id, { 'attributes': $scope.pcb[c_des[0]][c_des[1]].attributes })
.success(function(data, status, headers, config) {
console.log("Coords for picto destination updated");
......@@ -197,7 +197,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
io.socket.post('/stu/vocabulary', {
action: 'update',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: data
}
},
......@@ -234,7 +234,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
size: size,
resolve: { // Passing data to the controller of the window
stu_id: function(){
return $scope.studentUser.id;
return $scope.studentData.id;
},
sup: function(){
return $scope.user;
......@@ -308,7 +308,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
return $scope.user;
},
stu: function(){
return $scope.studentUser
return $scope.studentData
}
}
});
......@@ -327,6 +327,11 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
//////////////////////////////////////////////////////////////////////
// websockets events handling
// Remove all listeners to this event
io.socket.off('vocabulary');
// Add new listener to the event
io.socket.on('vocabulary', function(data) {
console.log('Vocabulary '+ data.action +' event received with the following data:');
console.log(JSON.stringify(data.attributes));
......
......@@ -14,16 +14,16 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Get last method/instruction for this student
//
/* $http
.get(config.backend+'/stu/'+ $scope.studentUser.id +'/last_instruction')
.get(config.backend+'/stu/'+ $scope.studentData.id +'/last_instruction')
.success(function(data, status, headers, config) {
$scope.studentUser.current_method = data.met_name;
$scope.studentUser.current_instruction = data.ins_name;
$scope.studentData.current_method = data.met_name;
$scope.studentData.current_instruction = data.ins_name;
console.log('Last method/instruction:' + JSON.stringify(data));
})
.error(function(data, status, headers, config) {
console.log('Last method/instruction error:' + JSON.stringify(data));
$scope.studentUser.current_method = 'undefined';
$scope.studentUser.current_instruction = 'undefined';
$scope.studentData.current_method = 'undefined';
$scope.studentData.current_instruction = 'undefined';
});*/
// Add method selected to the student
......
......@@ -78,7 +78,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.put(config.backend+'/try/' + t.id, update_data)
.success(function(data, status, headers, config) {
console.log("Try - updated: " + $scope.studentUser.id+" try:"+t.id);
console.log("Try - updated: " + $scope.studentData.id+" try:"+t.id);
})
.error(function(data, status, headers, config) {
console.log("Error from API: " + data.error);
......@@ -91,7 +91,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
.put(config.backend+'/try/' + $rootScope.actual_try.id, { result: $rootScope.actual_try.result, end: new Date() })
.then(
function(data, status, headers, config) {
console.log("Current try - updated. Student: " + $scope.studentUser.id+" try:"+$rootScope.actual_try.id);
console.log("Current try - updated. Student: " + $scope.studentData.id+" try:"+$rootScope.actual_try.id);
}
, function(data, status, headers, config) {
console.log("Error from API: " + data.error+ "when updating try "+$rootScope.actual_try);
......@@ -99,10 +99,10 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
);
};
$scope.send_show_action = function(){
console.log("ACTION!" + $scope.studentUser.id+" try:"+$rootScope.actual_try.id);
console.log("ACTION!" + $scope.studentData.id+" try:"+$rootScope.actual_try.id);
$http
.post(config.backend+'/action', {
student: $scope.studentUser.id,
student: $scope.studentData.id,
type: 'Show',
timestamp: new Date(),
_try: $rootScope.actual_try.id
......@@ -159,7 +159,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.post(config.backend+'/workingsession', {
"id_sup": $scope.user.id,
"id_stu": $scope.studentUser.id,
"id_stu": $scope.studentData.id,
"id_ins": $scope.selectedIns
})
.success(function(data, status, headers, config) {
......@@ -182,8 +182,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Adding initial action to the list of actions
$rootScope.actual_try.actions.push({ action: 'tryinit' });
console.log("WS created for method "+$scope.selectedMethod.name+" Ins:"+$scope.selectedIns.name+": "+JSON.stringify(data));
$scope.studentUser.current_method=$scope.selectedMethod.name;
$scope.studentUser.current_instruction=$scope.selectedIns.name;
$scope.studentData.current_method=$scope.selectedMethod.name;
$scope.studentData.current_instruction=$scope.selectedIns.name;
})
.error(function(data, status, headers, config) {
console.log("Error from API: " + data.error);
......@@ -217,7 +217,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.put(config.backend+'/workingsession/' + $rootScope.ws.id, { "end": $rootScope.ws.end,
"id_stu": $scope.studentUser.id
"id_stu": $scope.studentData.id
})
.success(function(data, status, headers, config) {
console.log("WS stopped - updated: " + JSON.stringify(data));
......@@ -244,7 +244,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'pausesession',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
id_ws: $rootScope.ws.id
}
};
......@@ -255,10 +255,10 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
///////////////////////////////////////////////////////////////
*/
$http
$http
.post(config.backend+'/action', {
"type": "pausesession",
"student": $scope.studentUser.id,
"student": $scope.studentData.id,
"supervisor": $scope.user.id
})
.success(function(data, status, headers, config) {
......@@ -283,7 +283,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'resumesession',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
id_ws: $rootScope.ws.id
}
};
......@@ -297,7 +297,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.post(config.backend+'/action', {
"type": "resumesession",
"student": $scope.studentUser.id,
"student": $scope.studentData.id,
"supervisor": $scope.user.id
})
.success(function(data, status, headers, config) {
......@@ -397,7 +397,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'tryinit',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
timestamp: new Date()
}
};
......@@ -414,7 +414,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'add',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: $scope.pic,
timestamp: new Date()
}
......@@ -439,7 +439,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'delete',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: $scope.pic,
timestamp: new Date()
}
......@@ -464,7 +464,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'select',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
picto: $scope.pic,
timestamp: new Date()
}
......@@ -491,7 +491,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var datashow = {
action: 'show',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
pictos: [ $scope.pic, $scope.pic, $scope.pic ], // The actual state of the phrase stripe
timestamp: endDate
}
......@@ -503,7 +503,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'tryend',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
timestamp: endDate
}
};
......@@ -528,7 +528,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
"begin": $scope.pcb_try.begin,
"end": $scope.pcb_try.end,
"actions": $scope.pcb_actions,
"student": $scope.studentUser.id,
"student": $scope.studentData.id,
"supervisor": $scope.user.id,
"device": 58
})
......@@ -552,7 +552,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$http
.post(config.backend+'/actions', {
"actions": $scope.pcb_actions,
"student": $scope.studentUser.id,
"student": $scope.studentData.id,
"supervisor": $scope.user.id,
"device": 58
})
......@@ -585,7 +585,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
var data = {
action: 'unshow',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
timestamp: new Date()
}
};
......@@ -596,7 +596,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
data = {
action: 'tryinit',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
timestamp: new Date()
}
};
......@@ -609,7 +609,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
io.socket.post('/stu/action', {
action: 'unshow',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
timestamp: new Date()
}
},
......@@ -636,7 +636,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
io.socket.post('/stu/action', {
action: 'show_device',
attributes: {
id_stu: $scope.studentUser.id,
id_stu: $scope.studentData.id,
id_dev: 58,
timestamp: new Date()
}
......@@ -681,6 +681,11 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
// websockets events handling (Dashboard)
//
// Remove all listeners to this event
io.socket.off('action');
// Add new listener to the event
io.socket.on('action', function(data) {
// Socket.io does not live inside the angular lifecycle, and thus Angular
......
......@@ -16,30 +16,30 @@
<div class="collapse navbar-collapse navbar-ex16-collapse">
<div class="nav navbar-nav navbar-left thumbnail img_profile">
<img ng-src="{{studentUser.pic}}" alt="" title="" />
<img ng-src="{{studentData.pic}}" alt="" title="" />
</div>
<div class="nav navbar-nav navbar-left navbar-text">
<h4>{{studentUser.name}} {{studentUser.surname}}</h4>
<p>{{studentUser.current_method | translate}} | {{studentUser.current_instruction | translate}}</p>
<h4>{{studentData.name}} {{studentData.surname}}</h4>
<p>{{studentData.current_method | translate}} | {{studentData.current_instruction | translate}}</p>
</div>
<div class="nav navbar-nav navbar-right tabs_student">
<ul class="nav nav-tabs">
<li role="presentation" ng-class="{'active' : nav.tab == 'collections'}">
<a href="/app/#/student/{{studentUser.id}}/collections" ng-click="nav.tab = ''"><span class="glyphicon glyphicon-th" aria-hidden="true"></span> {{ 'collections' | translate }}</a>
<a href="/app/#/student/{{studentData.id}}/collections" ng-click="nav.tab = ''"><span class="glyphicon glyphicon-th" aria-hidden="true"></span> {{ 'collections' | translate }}</a>
</li>
<li role="presentation" ng-class="{'active' : nav.tab == 'instructions'}">
<a href="/app/#/student/{{studentUser.id}}/instructions" ng-click="nav.tab = 'instructions'"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> {{ 'instructions' | translate }}</a>
<a href="/app/#/student/{{studentData.id}}/instructions" ng-click="nav.tab = 'instructions'"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> {{ 'instructions' | translate }}</a>
</li>
<li role="presentation" ng-class="{'active' : nav.tab == 'session'}">
<a href="/app/#/student/{{studentUser.id}}/session" ng-click="nav.tab = 'session'"><span class="glyphicon glyphicon-transfer" aria-hidden="true"></span> {{ 'session' | translate }}</a>
<a href="/app/#/student/{{studentData.id}}/session" ng-click="nav.tab = 'session'"><span class="glyphicon glyphicon-transfer" aria-hidden="true"></span> {{ 'session' | translate }}</a>
</li>
<li role="presentation" ng-class="{'active' : nav.tab == 'reports'}">
<a href="/app/#/student/{{studentUser.id}}/reports" ng-click="nav.tab = 'reports'"><span class="glyphicon glyphicon-file" aria-hidden="true"></span> {{ 'reports' | translate }}</a>
<a href="/app/#/student/{{studentData.id}}/reports" ng-click="nav.tab = 'reports'"><span class="glyphicon glyphicon-file" aria-hidden="true"></span> {{ 'reports' | translate }}</a>
</li>
<li role="presentation" ng-class="{'active' : nav.tab == 'setup'}">
<a href="/app/#/student/{{studentUser.id}}/setup" ng-click="nav.tab = 'setup'"
<a href="/app/#/student/{{studentData.id}}/setup" ng-click="nav.tab = 'setup'"
><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> {{ 'setup' | translate }}</a>
</li>
</ul>
......
......@@ -183,7 +183,7 @@
<!-- <span class="badge">{{ s.tries.length }}</span> -->
<div ng-show="showLastTry && wsessions.length > 0">
<h3>
{{ 'last_session' | translate}}: {{ studentUser.current_method }}, {{ studentUser.current_instruction }} ({{s.begin | date:'dd-MM-yyyy'}} )
{{ 'last_session' | translate}}: {{ studentData.current_method }}, {{ studentData.current_instruction }} ({{s.begin | date:'dd-MM-yyyy'}} )
</h3>
<div ng-show="ws_recover" >
<table style="border: 1px solid #666666; padding:5px; background-color:#f5f5f5;" width="100%">
......
/home/dofer/pictogram/sails/symbolstx
\ No newline at end of file
/home/dofer/pictogram/sails/upload
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment