Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5c1cc678
authored
Sep 01, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
solved several bugs when updating supervisor data
parent
273202b5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
113 additions
and
99 deletions
android/Pictogram/commonlibrary/commonlibrary.iml
android/Pictogram/tablet/tablet.iml
android/Pictogram/watch/watch.iml
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/SupervisorController.js
sails/src/api/models/Supervisor.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/app.js
sails/src/assets/scripts/modules/login/controllers/signin.js
sails/src/assets/scripts/modules/student/controllers/instructions.js
sails/src/assets/scripts/modules/student/controllers/setup.js
sails/src/assets/scripts/modules/supervisor/controllers/setup.js
sails/src/config/pictogram.js
android/Pictogram/commonlibrary/commonlibrary.iml
View file @
5c1cc678
...
@@ -65,14 +65,6 @@
...
@@ -65,14 +65,6 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/jni"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/jni"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/rs"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/rs"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/shaders"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/shaders"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/aidl"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/java"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/assets"
type=
"java-test-resource"
/>
...
@@ -81,6 +73,14 @@
...
@@ -81,6 +73,14 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/aidl"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/java"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/androidTest/shaders"
isTestSource=
"true"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/annotations"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/annotations"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/assets"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/assets"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/blame"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/blame"
/>
...
@@ -125,8 +125,8 @@
...
@@ -125,8 +125,8 @@
<orderEntry
type=
"library"
exported=
""
name=
"androidasync-2.1.8"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"androidasync-2.1.8"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"junit-4.12"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"junit-4.12"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"ion-2.1.8"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"json-20090211"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"json-20090211"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"ion-2.1.8"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-lite-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-lite-9.2.1"
level=
"project"
/>
</component>
</component>
</module>
</module>
\ No newline at end of file
android/Pictogram/tablet/tablet.iml
View file @
5c1cc678
This diff is collapsed.
Click to expand it.
android/Pictogram/watch/watch.iml
View file @
5c1cc678
...
@@ -42,6 +42,12 @@
...
@@ -42,6 +42,12 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/jni"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/jni"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/rs"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/rs"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavorDebug/shaders"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/res"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/resources"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/assets"
type=
"java-test-resource"
/>
...
@@ -50,12 +56,6 @@
...
@@ -50,12 +56,6 @@
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/jni"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/rs"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/testDefaultFlavorDebug/shaders"
isTestSource=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/r/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/aidl/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/source/rs/androidTest/DefaultFlavor/debug"
isTestSource=
"true"
generated=
"true"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/res/rs/androidTest/DefaultFlavor/debug"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/build/generated/res/resValues/androidTest/DefaultFlavor/debug"
type=
"java-test-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/res"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/res"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/resources"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/resources"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/assets"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/DefaultFlavor/assets"
type=
"java-resource"
/>
...
@@ -123,6 +123,8 @@
...
@@ -123,6 +123,8 @@
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/assets"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/assets"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/blame"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/blame"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/bundles"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/bundles"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/classes"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/dependency-cache"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.1.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.1.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.1.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/24.1.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars"
/>
...
@@ -142,12 +144,18 @@
...
@@ -142,12 +144,18 @@
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.2.1/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.support/wearable/2.0.0-alpha2/jars"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/incremental"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/incremental"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/incremental-safeguard"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/instant-run-support"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/jniLibs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/manifests"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/manifests"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/pre-dexed"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/res"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/res"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/rs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/rs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/shaders"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/shaders"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/symbols"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/symbols"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/intermediates/transforms"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/outputs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/outputs"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/build/tmp"
/>
</content>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Android API 24 Platform"
jdkType=
"Android SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Android API 24 Platform"
jdkType=
"Android SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
...
...
sails/src/api/controllers/StudentController.js
View file @
5c1cc678
...
@@ -12,7 +12,7 @@ module.exports = {
...
@@ -12,7 +12,7 @@ module.exports = {
// dummy function to test timeouts
// dummy function to test timeouts
eternal
:
function
(
req
,
res
)
{
eternal
:
function
(
req
,
res
)
{
setTimeout
(
function
(){
return
;},
1000
*
60
*
6
);
setTimeout
(
function
(){
return
;},
1000
*
60
*
6
);
},
},
/**
/**
...
@@ -608,7 +608,7 @@ module.exports = {
...
@@ -608,7 +608,7 @@ module.exports = {
return
res
.
json
(
l_met
);
return
res
.
json
(
l_met
);
}
}
});
});
}
}
});
});
},
},
...
@@ -936,7 +936,7 @@ module.exports = {
...
@@ -936,7 +936,7 @@ module.exports = {
Student
.
findOne
({
id
:
req
.
body
.
id
}).
then
(
function
(
student
)
{
Student
.
findOne
({
id
:
req
.
body
.
id
}).
then
(
function
(
student
)
{
if
(
!
student
)
{
if
(
!
student
)
{
throw
new
Error
();
throw
new
Error
(
"Student not found"
);
}
}
newAvatarFileName
=
sails
.
config
.
pictogram
.
paths
.
getStudentAvatarFileName
(
student
.
id
);
newAvatarFileName
=
sails
.
config
.
pictogram
.
paths
.
getStudentAvatarFileName
(
student
.
id
);
...
@@ -946,7 +946,7 @@ module.exports = {
...
@@ -946,7 +946,7 @@ module.exports = {
saveAs
:
newAvatarFileName
saveAs
:
newAvatarFileName
},
function
whenDone
(
error
,
uploadedFiles
)
{
},
function
whenDone
(
error
,
uploadedFiles
)
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
throw
new
Error
();
throw
new
Error
(
"upload failed"
);
}
}
try
{
try
{
...
@@ -964,12 +964,12 @@ module.exports = {
...
@@ -964,12 +964,12 @@ module.exports = {
});
});
}
catch
(
updateAvatarError
)
{
}
catch
(
updateAvatarError
)
{
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
res
.
serverError
();
res
.
serverError
(
"Error when updating profile image in server"
);
}
}
});
});
})
})
.
catch
(
function
()
{
.
catch
(
function
(
err
)
{
res
.
badRequest
();
res
.
badRequest
(
"Could not find supervisor: "
+
err
);
});
});
},
},
...
...
sails/src/api/controllers/SupervisorController.js
View file @
5c1cc678
...
@@ -480,40 +480,44 @@ module.exports = {
...
@@ -480,40 +480,44 @@ module.exports = {
Supervisor
.
findOne
({
id
:
req
.
body
.
id
}).
then
(
function
(
supervisor
)
{
Supervisor
.
findOne
({
id
:
req
.
body
.
id
}).
then
(
function
(
supervisor
)
{
if
(
!
supervisor
)
{
if
(
!
supervisor
)
{
throw
new
Error
();
throw
new
Error
(
"Supervisor not found"
);
}
}
newAvatarFileName
=
sails
.
config
.
pictogram
.
paths
.
getSupervisorAvatarFileName
(
supervisor
.
id
);
newAvatarFileName
=
sails
.
config
.
pictogram
.
paths
.
getSupervisorAvatarFileName
(
supervisor
.
id
);
sails
.
log
.
debug
(
"Saving file to "
+
newAvatarDirectory
+
"/"
+
newAvatarFileName
);
req
.
file
(
'file'
).
upload
({
req
.
file
(
'file'
).
upload
({
maxBytes
:
1000000
,
maxBytes
:
1000000
,
dirname
:
newAvatarDirectory
,
dirname
:
newAvatarDirectory
,
saveAs
:
newAvatarFileName
saveAs
:
newAvatarFileName
},
function
whenDone
(
error
,
uploadedFiles
)
{
},
function
whenDone
(
error
,
uploadedFiles
)
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
if
(
error
||
(
uploadedFiles
.
length
===
0
))
{
throw
new
Error
();
throw
new
Error
(
"upload failed"
);
}
}
try
{
try
{
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
if
(
supervisor
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
if
(
supervisor
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
sails
.
log
.
debug
(
"removing old profile image"
);
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
supervisor
.
pic
));
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
supervisor
.
pic
));
}
}
supervisor
.
pic
=
newAvatarFileName
;
supervisor
.
pic
=
newAvatarFileName
;
delete
supervisor
.
password
;
sails
.
log
.
debug
(
"saving supervisor data "
+
JSON
.
stringify
(
supervisor
));
supervisor
.
save
(
function
(
updateSupervisorError
)
{
supervisor
.
save
(
function
(
updateSupervisorError
)
{
if
(
updateSupervisorError
)
{
if
(
updateSupervisorError
)
{
throw
updateSupervisorError
;
throw
updateSupervisorError
;
}
}
re
s
.
ok
(
);
re
turn
res
.
ok
({
file
:
{
name
:
supervisor
.
pic
}}
);
});
});
}
catch
(
updateAvatarError
)
{
}
catch
(
updateAvatarError
)
{
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
re
s
.
serverError
(
);
re
turn
res
.
serverError
(
"Error when updating profile image in server: "
+
updateAvatarError
);
}
}
});
});
})
})
.
catch
(
function
()
{
.
catch
(
function
(
err
)
{
res
.
badRequest
();
});
});
},
},
...
...
sails/src/api/models/Supervisor.js
View file @
5c1cc678
...
@@ -151,7 +151,7 @@ module.exports = {
...
@@ -151,7 +151,7 @@ module.exports = {
function
(
cb
)
{
function
(
cb
)
{
var
bcrypt
=
require
(
'bcrypt-nodejs'
);
var
bcrypt
=
require
(
'bcrypt-nodejs'
);
if
(
attrs
.
password
)
{
if
(
attrs
.
password
&&
attrs
.
password
.
length
>
0
)
{
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
}
}
cb
();
cb
();
...
@@ -191,7 +191,7 @@ module.exports = {
...
@@ -191,7 +191,7 @@ module.exports = {
function
(
cb
)
{
function
(
cb
)
{
var
bcrypt
=
require
(
'bcrypt-nodejs'
);
var
bcrypt
=
require
(
'bcrypt-nodejs'
);
if
(
attrs
.
password
)
{
if
(
attrs
.
password
&&
attrs
.
password
.
length
>
0
)
{
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
}
}
cb
();
cb
();
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
5c1cc678
...
@@ -136,8 +136,8 @@
...
@@ -136,8 +136,8 @@
"mark"
:
"Mark"
,
"mark"
:
"Mark"
,
"max_licenses_reached"
:
"Maximum number of licenses reached by the office"
,
"max_licenses_reached"
:
"Maximum number of licenses reached by the office"
,
"May"
:
"May"
,
"May"
:
"May"
,
"method_name_duplicated"
:
"
template already exists.Please, change the name
"
,
"method_name_duplicated"
:
"
Template '{{method_name}}' already exists
"
,
"method_save"
:
"
Method
saved as a new template"
,
"method_save"
:
"
'{{method_name}}'
saved as a new template"
,
"methods"
:
"Methods"
,
"methods"
:
"Methods"
,
"minutes"
:
"minutes"
,
"minutes"
:
"minutes"
,
"month_totals"
:
"Month totals"
,
"month_totals"
:
"Month totals"
,
...
@@ -174,6 +174,7 @@
...
@@ -174,6 +174,7 @@
"password_confirm"
:
"Repeat password"
,
"password_confirm"
:
"Repeat password"
,
"password_match"
:
"The passwords must match"
,
"password_match"
:
"The passwords must match"
,
"password_new_type"
:
"Type the new password"
,
"password_new_type"
:
"Type the new password"
,
"password_short"
:
"Password must have {{minlength}} characters length at least"
,
"password_type"
:
"Password"
,
"password_type"
:
"Password"
,
"pause_session"
:
"Pause session"
,
"pause_session"
:
"Pause session"
,
"personal_data"
:
"Personal data"
,
"personal_data"
:
"Personal data"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
5c1cc678
...
@@ -136,8 +136,8 @@
...
@@ -136,8 +136,8 @@
"mark"
:
"Marcar"
,
"mark"
:
"Marcar"
,
"max_licenses_reached"
:
"Número de licencias máximo alcanzado por la oficina"
,
"max_licenses_reached"
:
"Número de licencias máximo alcanzado por la oficina"
,
"May"
:
"Mayo"
,
"May"
:
"Mayo"
,
"method_name_duplicated"
:
"
plantilla ya existe. Por favor, cambie el nombr
e"
,
"method_name_duplicated"
:
"
La plantilla '{{method_name}}' ya exist
e"
,
"method_save"
:
"
Método
guardado como nueva plantilla"
,
"method_save"
:
"
'{{method_name}}'
guardado como nueva plantilla"
,
"methods"
:
"Métodos"
,
"methods"
:
"Métodos"
,
"minutes"
:
"minutos"
,
"minutes"
:
"minutos"
,
"month_totals"
:
"Totales mes"
,
"month_totals"
:
"Totales mes"
,
...
@@ -175,6 +175,7 @@
...
@@ -175,6 +175,7 @@
"password_match"
:
"Las contraseñas deben coincidir"
,
"password_match"
:
"Las contraseñas deben coincidir"
,
"password_new_type"
:
"Escriba la nueva contraseña"
,
"password_new_type"
:
"Escriba la nueva contraseña"
,
"password_type"
:
"Escriba la contraseña"
,
"password_type"
:
"Escriba la contraseña"
,
"password_short"
:
"La contraseña es muy corta, debe tener al menos una longitud de {{minlength}} caracteres"
,
"pause_session"
:
"Pausar sesión"
,
"pause_session"
:
"Pausar sesión"
,
"personal_data"
:
"Datos personales"
,
"personal_data"
:
"Datos personales"
,
"personal_data"
:
"Datos personales"
,
"personal_data"
:
"Datos personales"
,
...
...
sails/src/assets/scripts/app.js
View file @
5c1cc678
...
@@ -20,6 +20,13 @@ var dashboardApp = angular.module('dashboardApp', [
...
@@ -20,6 +20,13 @@ var dashboardApp = angular.module('dashboardApp', [
'ngLodash'
'ngLodash'
]);
]);
/* Main constants */
dashboardApp
.
constant
(
'CONSTANTS'
,
{
appName
:
'Pictogram Dashboard'
,
appVersion
:
0.1
,
password_minlength
:
8
});
/* Toast (notification) configuration */
/* Toast (notification) configuration */
dashboardApp
.
config
([
'ngToastProvider'
,
function
(
ngToast
)
{
dashboardApp
.
config
([
'ngToastProvider'
,
function
(
ngToast
)
{
ngToast
.
configure
({
ngToast
.
configure
({
...
...
sails/src/assets/scripts/modules/login/controllers/signin.js
View file @
5c1cc678
...
@@ -11,6 +11,7 @@ function SignInCtrl($scope,
...
@@ -11,6 +11,7 @@ function SignInCtrl($scope,
reCAPTCHA
,
reCAPTCHA
,
$translate
,
$translate
,
config
,
config
,
CONSTANTS
,
ngToast
)
{
ngToast
)
{
$scope
.
formdata
=
{
$scope
.
formdata
=
{
name
:
''
,
name
:
''
,
...
@@ -31,17 +32,18 @@ function SignInCtrl($scope,
...
@@ -31,17 +32,18 @@ function SignInCtrl($scope,
$scope
.
signin
=
function
()
{
$scope
.
signin
=
function
()
{
// Validate email match
// Validate email match
if
(
$scope
.
formdata
.
email
!==
$scope
.
formdata
.
email_confirm
)
{
if
(
$scope
.
formdata
.
email
!==
$scope
.
formdata
.
email_confirm
)
{
$translate
(
'email_match'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'email_match'
)
});
ngToast
.
danger
({
content
:
translation
});
});
return
;
return
;
}
}
// Validate password match
// Validate password match
if
(
$scope
.
formdata
.
password
!==
$scope
.
formdata
.
password_confirm
)
{
if
(
$scope
.
formdata
.
password
!==
$scope
.
formdata
.
password_confirm
)
{
$translate
(
'password_match'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'password_match'
)
});
ngToast
.
danger
({
content
:
translation
});
return
;
});
}
if
(
$scope
.
formdata
.
password
.
length
<
CONSTANTS
.
password_minlength
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'password_short'
,
{
minlength
:
CONSTANTS
.
password_minlength
})
});
return
;
return
;
}
}
...
@@ -55,14 +57,10 @@ function SignInCtrl($scope,
...
@@ -55,14 +57,10 @@ function SignInCtrl($scope,
$http
$http
.
post
(
config
.
backend
+
'/sup'
,
$scope
.
formdata
)
.
post
(
config
.
backend
+
'/sup'
,
$scope
.
formdata
)
.
success
(
function
()
{
.
success
(
function
()
{
$translate
(
'user_created'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
$translate
.
instant
(
'user_created'
)
});
ngToast
.
success
({
content
:
translation
});
});
})
})
.
error
(
function
()
{
.
error
(
function
()
{
$translate
(
'user_exists'
,
{
email
:
$scope
.
formdata
.
email
}).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'user_exists'
,
{
email
:
$scope
.
formdata
.
email
})
});
ngToast
.
danger
({
content
:
translation
});
});
});
});
};
};
});
});
sails/src/assets/scripts/modules/student/controllers/instructions.js
View file @
5c1cc678
...
@@ -121,7 +121,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -121,7 +121,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
'Delete Method Template and its Instructions'
);
console
.
log
(
'Delete Method Template and its Instructions'
);
$translate
(
'template_deleted'
).
then
(
t
=>
{
ngToast
.
success
({
content
:
t
}
)});
ngToast
.
success
({
content
:
$translate
.
instant
(
'template_deleted'
)});
// Delete in select
// Delete in select
for
(
var
i
=
0
;
i
<
$scope
.
methods_available
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
$scope
.
methods_available
.
length
;
i
++
)
{
...
@@ -171,25 +171,17 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -171,25 +171,17 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Add to select method
// Add to select method
$scope
.
methods_available
.
push
({
id
:
method
.
id
,
name
:
method
.
name
});
$scope
.
methods_available
.
push
({
id
:
method
.
id
,
name
:
method
.
name
});
// creating a toast using "success", "info", "warning" or "danger" shortcut methods:
ngToast
.
success
({
var
myToastMsg
=
$translate
(
'method_save'
).
then
(
function
(
translation
)
{
content
:
$translate
.
instant
(
'method_saved'
,
{
method_name
:
method
.
name
}),
// Show message
timeout
:
6000
// By default 4000
ngToast
.
success
({
content
:
method
.
name
+
':'
+
translation
,
timeout
:
6000
// By default 4000
});
});
});
}
}
,
function
(
data
,
status
,
headers
,
config
)
{
//error
,
function
(
data
,
status
,
headers
,
config
)
{
//error
console
.
log
(
"Error from API: "
+
data
.
error
+
"("
+
data
.
status
+
")"
);
console
.
log
(
"Error from API: "
+
data
.
error
+
"("
+
data
.
status
+
")"
);
ngToast
.
success
({
var
myToastMsg
=
$translate
(
'method_name_duplicated'
).
then
(
function
(
translation
)
{
content
:
$translate
.
instant
(
'method_name_duplicated'
,
{
method_name
:
method
.
name
}),
// Show message
timeout
:
6000
// By default 4000
ngToast
.
success
({
content
:
method
.
name
+
':'
+
translation
,
timeout
:
6000
// By default 4000
});
});
});
}
}
);
);
...
@@ -216,12 +208,9 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -216,12 +208,9 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
})
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
var
myToastMsg
=
$translate
(
'cannot_delete_method'
).
then
(
function
(
translation
)
{
ngToast
.
warning
({
// Show message
content
:
$translate
.
instant
(
'cannot_delete_method'
),
ngToast
.
warning
({
timeout
:
6000
// By default 4000
content
:
translation
,
timeout
:
6000
// By default 4000
});
});
});
});
});
});
});
...
@@ -291,14 +280,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
...
@@ -291,14 +280,12 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
})
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
console
.
log
(
"Error from API: "
+
data
.
error
);
var
myToastMsg
=
$translate
(
'cannot_delete_instruction'
).
then
(
function
(
translation
)
{
// Show message
// Show message
ngToast
.
warning
({
ngToast
.
warning
({
content
:
translation
,
content
:
$translate
.
instant
(
'cannot_delete_instruction'
)
,
timeout
:
6000
// By default 4000
timeout
:
6000
// By default 4000
});
});
});
});
});
};
};
// Modal window to open instruction details
// Modal window to open instruction details
...
...
sails/src/assets/scripts/modules/student/controllers/setup.js
View file @
5c1cc678
...
@@ -44,19 +44,17 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
...
@@ -44,19 +44,17 @@ dashboardControllers.controller('StudentSetupCtrl', function StudentSetupCtrl(
folder
:
'students'
,
folder
:
'students'
,
id
:
$scope
.
studentData
.
id
id
:
$scope
.
studentData
.
id
},
},
file
:
file
,
file
:
file
}).
progress
(
function
()
{
})
.
progress
(
function
()
{
// TODO show progress to user
// TODO show progress to user
}).
success
(
function
(
data
)
{
})
$translate
(
'student_updated'
).
then
(
function
(
translation
)
{
.
success
(
function
(
data
)
{
ngToast
.
success
({
content
:
translation
});
ngToast
.
success
({
content
:
$translate
.
instant
(
'student_updated'
)
});
});
$scope
.
studentData
.
pic
=
'/upload/studentAvatar/'
+
data
.
file
.
name
;
$scope
.
studentData
.
pic
=
'/upload/students/'
+
data
.
file
.
name
;
});
});
}
else
{
}
else
{
$translate
(
'error_only_support_images'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_only_support_images'
)
});
ngToast
.
danger
({
content
:
translation
});
});
}
}
}
}
};
};
...
...
sails/src/assets/scripts/modules/supervisor/controllers/setup.js
View file @
5c1cc678
...
@@ -13,7 +13,8 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -13,7 +13,8 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
$location
,
$location
,
$upload
,
$upload
,
ngToast
,
ngToast
,
config
)
{
config
,
CONSTANTS
)
{
var
user
;
var
user
;
// Don't show the message at the begining
// Don't show the message at the begining
...
@@ -32,6 +33,8 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -32,6 +33,8 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
for
(
i
=
0
;
i
<
$files
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
$files
.
length
;
i
++
)
{
file
=
$files
[
i
];
// { name, size, type }
file
=
$files
[
i
];
// { name, size, type }
// Check accepted file types
if
(
file
.
type
===
'image/jpeg'
||
file
.
type
===
'image/png'
||
file
.
type
===
'image/gif'
)
{
if
(
file
.
type
===
'image/jpeg'
||
file
.
type
===
'image/png'
||
file
.
type
===
'image/gif'
)
{
extension
=
file
.
name
.
split
(
'.'
).
pop
();
extension
=
file
.
name
.
split
(
'.'
).
pop
();
filename
=
user
.
id
+
file
.
name
;
filename
=
user
.
id
+
file
.
name
;
...
@@ -51,15 +54,15 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -51,15 +54,15 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
// TODO show file upload progress to user
// TODO show file upload progress to user
})
})
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
// TODO show success ngToast
$scope
.
user
.
pic
=
'/upload/supervisorAvatar/'
+
data
.
file
.
name
;
$scope
.
user
.
pic
=
'/upload/supervisors/'
+
data
.
file
.
name
;
user
.
pic
=
$scope
.
user
.
pic
;
user
.
pic
=
$scope
.
user
.
pic
;
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
user
);
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
user
);
})
.
error
(
function
(
err
)
{
console
.
log
(
"ERROR while uploading image: "
+
err
);
});
});
}
else
{
}
else
{
$translate
(
'error_only_support_images'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_only_support_images'
)
});
ngToast
.
error
({
content
:
translation
});
});
}
}
}
}
};
};
...
@@ -69,21 +72,25 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -69,21 +72,25 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
var
supervisor
;
var
supervisor
;
var
actualEmail
;
var
actualEmail
;
if
(
$scope
.
formdata
.
password
!==
$scope
.
formdata
.
password_confirm
)
{
if
(
$scope
.
formdata
.
password
&&
$scope
.
formdata
.
password
!==
$scope
.
formdata
.
password_confirm
)
{
$translate
(
'password_match'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'password_match'
)
});
ngToast
.
danger
({
content
:
translation
});
return
;
});
}
if
(
$scope
.
formdata
.
password
&&
$scope
.
formdata
.
password
.
length
<
CONSTANTS
.
password_minlength
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'password_short'
,
{
minlength
:
CONSTANTS
.
password_minlength
})
});
return
;
return
;
}
}
if
(
!
$scope
.
setupForm
.
$valid
)
{
if
(
!
$scope
.
setupForm
.
$valid
)
{
$translate
(
'invalid_fields'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'invalid_fields'
)
});
ngToast
.
danger
({
content
:
translation
});
});
return
;
return
;
}
}
supervisor
=
$scope
.
formdata
;
supervisor
=
$scope
.
formdata
;
if
(
supervisor
.
password
&&
supervisor
.
password
.
length
==
0
)
delete
supervisor
.
password
;
actualEmail
=
JSON
.
parse
(
$window
.
sessionStorage
.
user
).
email
;
actualEmail
=
JSON
.
parse
(
$window
.
sessionStorage
.
user
).
email
;
// Comprobation for new email
// Comprobation for new email
...
@@ -92,11 +99,12 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -92,11 +99,12 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
delete
supervisor
.
email
;
delete
supervisor
.
email
;
}
}
// image is updated when uploading a file, not here
delete
supervisor
.
pic
;
$http
.
put
(
config
.
backend
+
'/sup/'
+
supervisor
.
id
,
supervisor
)
$http
.
put
(
config
.
backend
+
'/sup/'
+
supervisor
.
id
,
supervisor
)
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
$translate
(
'data_saved'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
$translate
.
instant
(
'data_saved'
)
});
ngToast
.
success
({
content
:
translation
});
});
// Modify the name in the header
// Modify the name in the header
$scope
.
name
=
data
.
name
+
' '
+
data
.
surname
;
$scope
.
name
=
data
.
name
+
' '
+
data
.
surname
;
...
@@ -113,12 +121,11 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
...
@@ -113,12 +121,11 @@ dashboardControllers.controller('SetupCtrl', function SetupCtrl(
delete
user
.
password
;
delete
user
.
password
;
delete
user
.
password_confirm
;
delete
user
.
password_confirm
;
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
user
);
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
user
);
})
})
.
error
(
function
()
{
.
error
(
function
()
{
$translate
(
'data_no_saved'
).
then
(
function
(
translation
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'data_no_saved'
)
});
ngToast
.
danger
({
content
:
translation
});
});
});
});
};
};
});
});
sails/src/config/pictogram.js
View file @
5c1cc678
...
@@ -12,6 +12,8 @@ module.exports.pictogram = {
...
@@ -12,6 +12,8 @@ module.exports.pictogram = {
serialSize
:
10
,
// number of characters in generated serial numbers
serialSize
:
10
,
// number of characters in generated serial numbers
pageLimit
:
10
,
// number of elements per "page"
pageLimit
:
10
,
// number of elements per "page"
password_minlength
:
8
,
// minimal size for the password string
urls
:
{
urls
:
{
/**
/**
* Gets the public url of a supervisor avatar
* Gets the public url of a supervisor avatar
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment