Commit 9cf71f79 by Fernando Martínez Santiago

Merge branches 'fernando_branch' and 'master' of http://scm.ujaen.es/softuno/pictogram

parents e67f731f 684caa78
This diff could not be displayed because it is too large.
......@@ -843,6 +843,22 @@ module.exports = {
});
},
//
// Returns the last instruction for the student
//
last_instruction: function(req, res) {
if (!req.params.id_stu)
return res.json(400, {err: 'id_stu parameter is missing'});
VStuLastInstruction.find({id_stu: req.params.id_stu}).exec(function(err, found) {
if (err)
return res.json(500, err);
if (!found)
return res.json({});
return res.json(found);
});
},
//
// Test raw sql on models
sqlquery: function(req, res) {
......
......@@ -71,11 +71,13 @@ module.exports = {
//
categories: function(id_sup, id_cat, callback) {
Supervisor.findOne(id_sup).exec(function(err, sup) {
if (err)
if (err) {
console.log("Error retrieving categories for supervisor " + id_sup + ": " + err);
return callback(err, {});
}
// 0 for the main categories --> null in DB
if(id_cat == 0) id_cat = null;
// if(id_cat == 0) id_cat = null;
PictoCat.find({id_supercat: id_cat}).populate('exps', {lang: sup.lang}).exec(function(err, pictoCats) {
if (err || !pictoCats || pictoCats.length == 0)
......@@ -91,9 +93,11 @@ module.exports = {
//
fromcategory: function(id_sup, id_cat, callback) {
Supervisor.findOne(id_sup).exec(function(err, sup) {
if (err)
if (err) {
console.log("Error retrieving categories for supervisor " + id_sup + ": " + err);
return callback(err, {});
}
Picto.find({category: id_cat}).populate('expressions', {lang: sup.lang}).exec(function(err, pictos) {
if (err || !pictos || pictos.length == 0)
return callback(err, {});
......
......@@ -40,6 +40,7 @@
"child": "Child",
"click": "Click",
"click_login": "Click to login",
"close": "Close",
"collections": "Collections",
"confirmation": "Are you sure?",
"contact_person": "Contact person",
......
......@@ -40,6 +40,7 @@
"child": "Niño",
"click": "Clic",
"click_login": "Clic para iniciar sesión",
"close": "Cerrar",
"collections": "Colecciones",
"confirmation": "¿Estás seguro?",
"contact_person": "Persona de contacto",
......
......@@ -22,7 +22,7 @@ angular.module('dashboardServices', [])
responseError: function (rejection) {
if (rejection.status === 401) {
// handle the case where the user is not authenticated
console.log("eerrrorrrrr 401");
console.log("error 401");
// send "logout" to children controllers so main.js controller can catch it and logout
$rootScope.$broadcast('logout', null);
......
<div class="container" ng-controller="AdminCtrl">
<!-- AdminCtrl controls here, see app.js -->
<div class="container">
<!-- Admin header -->
<header-admin></header-admin>
......
......@@ -10,7 +10,8 @@
<img src="img/logo_pictogram.png" alt="Pictogram" title="Pictogram" />
</p>
<!-- Formulario -->
<form name="loginForm" ng-controller="LoginCtrl" ng-submit="login()" novalidate>
<!-- LoginCtrl controls here, see app.js -->
<form name="loginForm" ng-submit="login()" novalidate>
<!-- Alert and success messages -->
<div ng-show="{{ 'showmessage' }}" class="alert" ng-class="alert" translate translate-value-name="{{name}}">{{message}}</div>
......
......@@ -10,7 +10,8 @@
<img src="img/logo_pictogram.png" alt="Pictogram" title="Pictogram" />
</p>
<!-- Formulario -->
<form name="loginForm" ng-controller="LoginAdminCtrl" ng-submit="login()" novalidate>
<!-- LoginAdminCtrl controls here, see app.js -->
<form name="loginForm" ng-submit="login()" novalidate>
<!-- Alert and success messages -->
<div ng-show="{{ 'showmessage' }}" class="alert" ng-class="alert" translate translate-value-name="{{name}}">{{message}}</div>
......
<div class="row" ng-controller="LoginSettingPasswordCtrl">
<!-- LoggingSettingPasswordCtrl controls here, see app.js -->
<div class="row">
<!-- Rejilla 3 elementos de igual ancho -->
<div class="col-md-4">&nbsp;</div>
......
<!-- SigningCtrl controls here, see app.js -->
<div class="container">
<div class="row">
......@@ -16,7 +17,7 @@
<!-- Logo Pictogram -->
<!-- Formulario -->
<form name="signInForm" role="form" ng-controller="SignInCtrl" ng-submit="signin()">
<form name="signInForm" role="form" ng-submit="signin()">
<!-- Alert and success messages -->
<div ng-show="{{ 'showmessage' }}" class="alert" ng-class="alert" translate translate-values="{name: formdata.name, surname: formdata.surname, email: formdata.email}">{{message}}</div>
......
......@@ -44,7 +44,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
console.log("Error from API: " + data.error);
});
//
// Load pictos from a category
//
$scope.load_pictos = function (id_cat){
$http
.get(config.backend+'/sup/'+ $scope.sup.id +'/pic_fromcategory/' + id_cat)
......@@ -52,15 +54,17 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
// Add to list
$scope.pictos = data;
//console.log(JSON.stringify($scope.pictos));
console.log("Pictos listed");
console.log("Pictos listed" + data);
})
.error(function(data, status, headers, config) {
console.log("Error from API: " + data.error);
});
};
//
// Load pictos from owned by the actual supervisor
// TEST --> change with real supervisor pictos
//
$scope.load_own_pictos = function (){
$http
.get(config.backend+'/sup/'+ $scope.sup.id +'/pictos')
......@@ -75,7 +79,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
});
};
//
// Load the folders of a category
//
$scope.load_category = function (id_cat){
$http
.get(config.backend+'/sup/'+ $scope.sup.id +'/pic_categories/' + id_cat)
......@@ -89,7 +95,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
});
};
//
// Request folders of a category from the panel (symbolstx)
//
$scope.open_category = function (cat) {
// Add to breadcrumbs
$scope.breadcrumbs.push({
......@@ -102,7 +110,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
$scope.load_pictos(cat.id);
};
//
// Request folders of a category from the breadcrumbs (symbolstx)
//
$scope.open_category_from_bc = function (id_cat) {
// Delete from breadcrumbs
......@@ -119,11 +129,16 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
$scope.alert = { type: 'danger', msg: 'Category is full of pictos.', show: false };
//
// Close alert message
//
$scope.closeAlert = function() {
$scope.alert.show = false;
};
//
// Upload to own supervisor collection when a picto is selected from file
//
$scope.onPictoSelect = function($files) {
//$files: an array of files selected, each file has name, size, and type.
for (var i = 0; i < $files.length; i++) {
......@@ -165,7 +180,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
}
};
//
// Add a picto to student when it is dropped into a category
//
$scope.handleDropAddPicto = function(origin, destination) {
// Add picto to stu_picto
var v_dest = destination.split("_"); // 3 values: idcat_coordx_coordy
......@@ -327,7 +344,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
}
};
//
// Delete picto added
//
$scope.remove_picto = function (stuPicto, id_cat){
console.log("delete_studentPicto: " + JSON.stringify(stuPicto));
......@@ -369,7 +388,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
};
//
// Delete own picto
//
$scope.remove_own_picto = function (id_picto){
console.log("delete_picto:" + id_picto);
var deletePicto = $window.confirm('Are you absolutely sure you want to delete?');
......@@ -392,6 +413,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
}
};
//
//
//
$scope.close = function () {
$modalInstance.close("Ejemplo de elemento devuelto");
};
......@@ -403,7 +427,9 @@ dashboardControllers.controller('AddPictoCtrl', function ($scope, $modalInstance
$modalInstance.dismiss('cancel');
};
//
// Modal window to open picto expression
//
$scope.open_exp = function (picto) {
var modalInstance = $modal.open({
......
......@@ -237,7 +237,7 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
animation: true,
templateUrl: 'modules/student/views/addpicto.html',
controller: 'AddPictoCtrl',
size: size,
size: 'lg',
resolve: { // Passing data to the controller of the window
stu_id: function(){
return $scope.studentData.id;
......
......@@ -56,7 +56,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.numPerPage = 5;
$scope.totalPages = Math.ceil($scope.wsessions.length / $scope.numPerPage);
$scope.ws_recover = $scope.wsessions[0]!=null && $scope.wsessions[0].end==null;
console.log("tries: " + $scope.wsessions.length);
console.log("sessions: " + $scope.wsessions.length);
console.log("numPerPage: " + $scope.numPerPage);
console.log("pages: " + $scope.totalPages);
......@@ -267,7 +267,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope.stop_ws = function (){
// For view
$scope.sessionRunning = false;
$scope.wsessions[$scope.wsessions.length-1].tries.pop();
$scope.ws.end = new Date();
$http
......
......@@ -115,6 +115,6 @@
</div>
<!-- End modal-body -->
<div class="modal-footer">
<button class="btn btn-primary" ng-click="close()">Cerrar</button>
<button class="btn btn-primary" ng-click="close()">{{ 'close' | translate }}</button>
</div>
</div>
\ No newline at end of file
......@@ -26,7 +26,7 @@
<!-- Fin de columna vistas por categorías -->
<div class="col-md-2 text-right">
<a href="#" class="btn btn-success btn-sm" role="button" ng-click="open('lg')">
<a class="btn btn-success btn-sm" role="button" ng-click="open()">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> <span translate>add_picto<span>
</a>
</div>
......
......@@ -13,15 +13,14 @@
</div>
<!-- Agrupar los enlaces de navegación, los formularios y cualquier otro elemento que se pueda ocultar al minimizar la barra -->
<div class="collapse navbar-collapse navbar-ex16-collapse">
<div class="row">
<div class="nav navbar-nav navbar-left thumbnail img_profile">
<div class="col-md-3 thumbnail img_profile">
<img ng-src="{{studentData.pic}}" alt="" title="" />
</div>
<div class="nav navbar-nav navbar-left navbar-text">
<div class="col-md-6 ">
<h4>{{studentData.name}} {{studentData.surname}}</h4>
<p>{{studentData.current_method | translate}} | {{studentData.current_instruction | translate}}</p>
<p>{{studentData.current_method | translate}}</p><p>{{studentData.current_instruction | translate}}</p>
</div>
<div class="nav navbar-nav navbar-right tabs_student">
......
......@@ -10,7 +10,7 @@
</li>
</ul>
</div>
-->
<!-- Fin de listado de dispositivos -->
<!-- Select con Instrucciones -->
<div class="col-md-6">
......@@ -24,40 +24,36 @@
<option value="">-- Select an instruction --</option>
</select>
</form>
<!-- wsessions navigation info -->
<div ng-hide="!selectedIns">
<h4>{{ 'sessions' | translate}}: {{wsessions.length}}</h4>
<p>{{ 'pages' | translate}}: {{ totalPages }}</p>
</div>
</div>
<!-- Fin de select con Instrucciones -->
<!-- Temporizador Sesión de trabajo -->
<div class="col-md-6">
<p class="session_controls text-right">
<a ng-click="startTimer(); new_ws()" ng-disabled="!selectedIns" ng-hide="sessionRunning" class="btn btn-success btn-sm" role="button" id="session_new">Nueva sesión</a>
<a class="text_large" ng-click="pause_ws(); pauseTimer();" ng-hide="!sessionRunning || paused" id="session_pause" popover="{{ 'pause_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-pause" aria-hidden="true" title="Pausar sesión"></span>
</a>
<a class="text_large" ng-click="resume_ws(); resumeTimer();" ng-hide="!sessionRunning || !paused" id="session_continue" popover="{{ 'continue_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-play" aria-hidden="true" title="Reanudar sesión"></span>
</a>
</div> <!--row -->
<!-- wsessions navigation info -->
<div class="row" ng-hide="!selectedIns">
<!-- Fin de select con Instrucciones -->
<!-- Temporizador Sesión de trabajo -->
<p/><p class="session_controls">
<div class="col-md-4">
<a ng-click="startTimer(); new_ws()" ng-disabled="!selectedIns" ng-hide="sessionRunning" class="btn btn-success btn-sm" role="button" id="session_new">Nueva sesión</a>
<a class="text_large" ng-click="stopTimer(); stop_ws()" ng-hide="!sessionRunning" id="session_stop" popover="{{ 'finish_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-stop color_black" aria-hidden="true" title="Terminar sesión"></span>
</a>
</p>
</div>
<!-- Fin temporizador sesión de trabajo -->
</div>
<!-- Fin de row -->
<a class="text_large" ng-click="pause_ws(); pauseTimer();" ng-hide="!sessionRunning || paused" id="session_pause" popover="{{ 'pause_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-pause" aria-hidden="true" title="Pausar sesión"></span>
</a>
<!-- Title for list of sessions -->
<a class="text_large" ng-click="resume_ws(); resumeTimer();" ng-hide="!sessionRunning || !paused" id="session_continue" popover="{{ 'continue_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-play" aria-hidden="true" title="Reanudar sesión"></span>
</a>
<a class="text_large" ng-click="stopTimer(); stop_ws()" ng-hide="!sessionRunning" id="session_stop" popover="{{ 'finish_session' | translate}}" popover-trigger="mouseenter">
<span class="glyphicon glyphicon-stop color_black" aria-hidden="true" title="Terminar sesión"></span>
</a>
</div>
<div class="col-md-2" style="text-align: right">
<span class="label label-success" style="font-size: 10pt">{{ 'sessions' | translate}} <span class="badge" style="font-size: 10pt">{{wsessions.length}}</span></span>
</div>
</div>
<!-- Title for list of sessions FERNANDO: No necesario, ya aparece en la lista
<div class="page-header" ng-show="selectedIns"><h2 id="try_title">{{ 'sessions_of' | translate}} {{ selectedIns.name }}</h2></div>
-->
<!-- Tries panel with actual try and wsessions list -->
......
......@@ -16,20 +16,25 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl($scope, $s
"lang": 'es-es',
"notes": '',
"pic": "/app/img/default.jpg",
"office": $scope.user.office
"office": $scope.user.office || {name: ""}
};
//
// Flags for showing buttons according to role
//
$scope.user = JSON.parse($window.sessionStorage.user);
if ($scope.user.office && $scope.user.office.admin === $scope.user.id) // The user is administrator of the office
$scope.user.isAdmin = true;
if ($scope.user.office.currentStudents >= $scope.user.office.maxStudents)
$scope.num_licenses_left = 0;
else
$scope.num_licenses_left = $scope.user.office.maxStudents - $scope.user.office.currentStudents;
if ($scope.user.office) {
if ($scope.user.office.admin === $scope.user.id) // The user is administrator of the office
$scope.user.isAdmin = true;
if ($scope.user.office.currentStudents >= $scope.user.office.maxStudents)
$scope.num_licenses_left = 0;
else
$scope.num_licenses_left = $scope.user.office.maxStudents - $scope.user.office.currentStudents;
} else {
$scope.user.office = {name: ""}
}
//
// Get list of supervisor's students
......@@ -60,7 +65,7 @@ dashboardControllers.controller('StudentsCtrl', function StudentsCtrl($scope, $s
"lang": 'es-es',
"notes": '',
"pic": "/app/img/default.jpg",
"office": $scope.user.office,
"office": $scope.user.office || {name: ""},
"current_method": "no_method",
"current_instruction": "no_instruction"
};
......
......@@ -10,29 +10,33 @@
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/app/#/students"><img src="img/logo_pictogram.png" alt="Pictogram" title="Pictogram" style="height: 70px;" /></a>
<h4 class="navbar-brand navbar-left text-left">{{user.office.name}}</h4>
</div>
<!-- Agrupar los enlaces de navegación, los formularios y cualquier otro elemento que se pueda ocultar al minimizar la barra -->
<div class="collapse navbar-collapse navbar-ex6-collapse">
<div class="nav navbar-nav navbar-right thumbnail img_profile">
<div class="nav navbar-nav navbar-right thumbnail img_profile" context-menu data-target="menu-sup">
<img id="supervisor_profile" ng-src="{{user.pic}}" alt="Supervisor" title="Supervisor" />
</div>
<div class="dropdown position-fixed" id="menu-sup" style="z-index:10">
<ul class="dropdown-menu" role="menu">
<li>
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/setup">
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span> {{ 'setup' | translate }}
</a>
</li>
<li>
<a class="pointer" role="menuitem" tabindex="0" ng-click="logout()">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> {{ 'logout' | translate }}
</a>
</li>
</ul>
</div>
<div class="nav navbar-nav navbar-right navbar-text">
<h5 class="text-right">{{user.getFullName()}}</h5>
<p class="text-right">
<!-- Botón configuración -->
<a href="/app/#/setup" class="btn btn-default btn-sm" role="button">
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span> {{ 'setup' | translate }}
</a>
<!-- Botón salir -->
<a ng-click="logout()" class="btn btn-default btn-sm" role="button">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> {{ 'logout' | translate }}
</a>
</p>
<h4 class="text-right">{{user.getFullName()}}</h4>
<h5 class="text-right">{{user.office.name}}</h5>
</div>
</div>
......
<div ng-controller="SetupCtrl">
<!-- SetupCtrl controls here, see app.js -->
<div>
<div class="page-header">
<h2 translate>setup</h2>
</div>
......
<toast></toast>
<div class="panel panel-default" ng-controller="StudentsCtrl">
<!-- StudentsCtrl controls here, see app.js -->
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading"><h3 class="panel-title" translate>students</h3>
<span ng-if="user.isAdmin">({{user.office.currentStudents}}/{{user.office.maxStudents}} - <span translate="licenses_left" translate-values="{number: num_licenses_left}"></span>)</span>
......
<div class="container" ng-controller="SupervisorCtrl">
<!-- SupervisorCtrl controls here, see app.js -->
<div class="container">
<header-supervisor></header-supervisor>
......
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