Skip to content

Commit 28bdf4c

Browse files
author
Lionel Laské
committed
Merge branch 'dev'
2 parents 6319475 + aa9b3d2 commit 28bdf4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+8137
-5970
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ dashboard/public/js/bootstrap-tour.min.js
33
dashboard/public/js/bootstrap.min.js
44
dashboard/public/js/Chart.min.js
55
dashboard/public/js/jquery-3.1.0.min.js
6-
dashboard/public/js/jquery-sortable.js
76
dashboard/public/js/jquery-ui-1-11-4.js
7+
dashboard/public/js/jquery.ui.sortable-animation.js
88
dashboard/public/js/jquery.multi-select.js
99
dashboard/public/js/jquery.searchable.js
1010
dashboard/public/js/l10n.js
@@ -13,6 +13,8 @@ dashboard/public/js/material.min.js
1313
dashboard/public/js/moment.min.js
1414
dashboard/public/js/noty.js
1515
dashboard/public/js/pace.min.js
16+
dashboard/public/js/qrcodegen.js
17+
dashboard/public/js/FileSaver.js
1618
dashboard/public/js/select2.min.js
1719

1820
docs/

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@
6868
"url": "writable",
6969
"headers": "writable",
7070
"icon": "readonly",
71-
"Chart": "readonly"
71+
"Chart": "readonly",
72+
"QRCode": "readonly",
73+
"saveAs": "readonly",
74+
"Uint8Array": "readonly"
7275
}
7376
},
7477
{

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.0] - 2020-10-11
8+
### Added
9+
- Provide a way to remove multiple users at the same time #217
10+
- Allow teachers to connect to Sugarizer client #222
11+
- Add a download icon in Dashboard Journal view #220
12+
- Show the right icon in Dashboard for TXT/ODT/DOC/PDF #226
13+
- Allow opening PDF content in dashboard #227
14+
- Add an upload button in Dashboard Journal view #221
15+
- Added tutorial for User Edit and Profile view
16+
- Added title to charts in statistics view
17+
- Add multiple actions to Journal and Users view #245
18+
- Added All Classrooms option in Users View
19+
- Added multi-delete in classroom view
20+
- Documentation to deploy on GCP with ansible #256
21+
- Allow signup function to validate if name exist
22+
- Replicaset parameter for MongoDB
23+
24+
### Changed
25+
- Change edit classroom screen to handle large number of students
26+
- Replace deprecated node library request by superagent #254
27+
28+
### Fixed
29+
- Package vulnerability fix
30+
- Fixed button position in Users View
31+
- Server crash when dashboard call with several thousand of entries #208
32+
- Classroom name could be null or could already exist
33+
- Shared journal content is incorrect in dashboard #219
34+
- Activity list doesn't scroll while reordering, causes multiple server calls. #235
35+
- Overflow on opening any dropbox #238
36+
- Selected option's text isn't localized #240
37+
- Page navigation problem on language switching #142
38+
- Popup is not displayed when Add/Edit/Delete a Chart
39+
- Fix tutorial restart on views
40+
41+
742
## [1.2.0] - 2019-12-01
843
### Added
944
- Teacher profile

Gruntfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ module.exports = function(grunt) {
1111
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' +
1212
' Licensed <%= pkg.license %> */\n',
1313
// Task configuration.
14-
uglify: {
14+
terser: {
1515
options: {
16-
banner: '<%= banner %>'
16+
keep_fnames: true
1717
},
1818
dynamic_mappings: {
1919
expand: true,
@@ -47,11 +47,11 @@ module.exports = function(grunt) {
4747
});
4848

4949
// These plugins provide necessary tasks.
50-
grunt.loadNpmTasks('grunt-contrib-uglify');
50+
grunt.loadNpmTasks('grunt-terser');
5151
grunt.loadNpmTasks('grunt-contrib-imagemin');
5252
grunt.loadNpmTasks('grunt-contrib-cssmin');
5353

5454
// Default task.
55-
grunt.registerTask('default', ['uglify', 'imagemin', 'cssmin']);
55+
grunt.registerTask('default', ['terser', 'imagemin', 'cssmin']);
5656

5757
};

LICENSE

Lines changed: 202 additions & 191 deletions
Large diffs are not rendered by default.

NOTICE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2014 Lionel Laské
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[Sugarizer](https://github.com/llaske/sugarizer) is the open source learning platform based on Sugar that began in the famous One Laptop Per Child project.
66

7-
Sugarizer Server allow deployment of Sugarizer on a local server, for example on a school server, so expose locally Sugarizer as a Web Application. Sugarizer Server can also be used to provide collaboration features for Sugarizer Application on the network. Sugarizer Server could be deployed in a Docker container or on any computer with Node.js 6+ and MongoDB 2.6+.
7+
Sugarizer Server allows the deployment of Sugarizer on a local server, for example on a school server, so expose locally Sugarizer as a Web Application. Sugarizer Server can also be used to provide collaboration features for Sugarizer Application on the network. Sugarizer Server could be deployed in a Docker container or on any computer with Node.js 6+ and MongoDB 2.6+.
88

99

1010
## Running Sugarizer Server
@@ -59,6 +59,7 @@ Following is the typical content of Sugarizer Server settings file:
5959
port = 27018
6060
name = sugarizer
6161
waitdb = 1
62+
replicaset = false
6263

6364
[collections]
6465
users = users
@@ -81,27 +82,27 @@ Following is the typical content of Sugarizer Server settings file:
8182

8283
The **[information]** section is for describing your server. It could be useful for clients connected to the server.
8384

84-
The **[web]** section describe the settings of the node.js process. By default, the web server is on the port 8080.
85+
The **[web]** section describes the settings of the node.js process. By default, the web server is on the port 8080.
8586

8687
The **[security]** section regroup security settings. `min_password_size` is the minimum number of characters for the password. `max_age` is the expiration time in milliseconds of a session with the client. At the expiration of the session, the client should reenter its password. Default time is 172800000 (48 hours). Parameters `https`, `certificate_file`, `key_file` and `strict_ssl` are explain above.
8788
It `no_signup_mode` is true, account creation is allowed only by an administrator or a teacher (no direct sign-up allowed by a student).
8889

8990
The **[client]** indicate the place where is located Sugarizer Client. Sugarizer Client is need by the server.
9091

91-
The **[presence]** section describe the settings of the presence server. By default, a web socket is created on port 8039. You need to change this value if you want to use another port.
92+
The **[presence]** section describes the settings of the presence server. By default, a web socket is created on port 8039. You need to change this value if you want to use another port.
9293

93-
The **[database]** and **[collections]** sections are for MongoDB settings. You could update the server name (by default MongoDB run locally) and the server port. Names of the database and collections had no reason to be changed. The `waitdb` parameter allow you to force server to wait for the database.
94+
The **[database]** and **[collections]** sections are for MongoDB settings. You could update the server name (by default MongoDB run locally) and the server port. Names of the database and collections had no reason to be changed. The `waitdb` parameter allow you to force server to wait for the database. Optionally, the `replicaset` parameter can be set to `true` to enable MongoDB Replicaset support, in this case the server name becomes the replicaset connection string.
9495

9596
The **[statistics]** section indicate if the server will log client usage.
9697

9798
The **[log]** section indicate how the server log access. If `level` value is greater than 0 or is not present, Sugarizer Server will log all access to the server on the command line.
9899

99-
The **[activities]** section describe information on where to find embedded activities. The favorites value list ids of activities that Web Application users will find by default on the home page. All values are self explained and had no reason to be changed.
100+
The **[activities]** section describes information on where to find embedded activities. The favorites value list ids of activities that Web Application users will find by default on the home page. All values are self explained and had no reason to be changed.
100101

101102

102103
## Dashboard
103104

104-
Sugarizer Server Dashboard is an admin tool for teachers and deployment administrator. This dashboard can be used to control and manage the work of learners and manage and analyze all activities on a Sugarizer Server. The Dashboard have following features:
105+
Sugarizer Server Dashboard is an admin tool for teachers and deployment administrator. This dashboard can be used to control and manage the work of learners and manage and analyze all activities on a Sugarizer Server. The Dashboard has following features:
105106

106107
* Users: how many users have been registered on the server, recent users, top users on the server, create/edit/remove a user.
107108
* Journal: how many Journals and how many entries in Journal on the server, last Journal, and last entries, edit a journal (see/update/remove) entries.
@@ -113,15 +114,15 @@ To login to the Dashboard the first time, you will have to create an admin accou
113114

114115
sh add-admin.sh admin password http://127.0.0.1:8080/auth/signup
115116

116-
Note: For security reason, the script should be launched from the local machine. On Docker, attach a new shell to the container and launch the script from this shell - in that case the port to use should be 80, not 8080.
117+
Note: For security reasons, the script should be launched from the local machine. On Docker, attach a new shell to the container and launch the script from this shell - in that case the port to use should be 80, not 8080.
117118

118119
Where **admin** is the login for the new admin account and **password** is the password.
119120

120121
Once the admin account is created, you could access Sugarizer Dashboard on http://127.0.0.1:8080/dashboard.
121122

122123
## Server API
123124

124-
To implement the above functionalities, the sugarizer backend expose an API. The API routes look as follows:
125+
To implement the above functionalities, the sugarizer backend exposes an API. The API routes look as follows:
125126

126127

127128
#### INFORMATION ROUTE
@@ -207,43 +208,45 @@ To generate docs, run the following command in `terminal`.
207208
apidoc -i api/controller -i dashboard/helper -o docs/www/
208209

209210

210-
## Import users from a CSV file
211+
## Import/Delete users using a CSV file
211212

212-
Sugarizer Server comes with a script to import a set of students, administrators and classrooms from a CSV file.
213+
Sugarizer Server comes with a script to import/delete a set of students, teachers, administrators and classrooms from a CSV file.
213214

214215
To launch it, run the command line:
215216

216217
cd sugarizer-server
217218
export NODE_ENV=settings
218219
node scripts/seed_users.js filename.csv
219220

220-
Where `settings` is the name of the .ini file to use for settings (default is `sugarizer`). `filename.csv` is the CSV who contains items to create. Here's an example of CSV file:
221+
Where `settings` is the name of the .ini file to use for settings (default is `sugarizer`). `filename.csv` is the CSV who contains items to create/delete. Here's an example of CSV file:
221222

222-
name,type,language,color,password,classroom
223-
Lionel,admin,fr,"{""stroke"":""#F8E800"",""fill"":""#FF8F00""}",aaaa,
224-
Nikhil,student,,,,CM2
223+
name,type,language,stroke,fill,password,classroom
224+
Lionel,admin,fr,#BCCDFF,#FF8F00,aaaa,
225+
Nikhil,student,,,,,CM2
225226

226227
Note that the header line is needed.
227228

228229
The signification of each field is:
229230

230231
* `name` is the name of the account to create.
231-
* `type` is the type of account. Should be `student` or `admin`.
232+
* `type` is the type of account. Should be `student`, `teacher`, `admin` or `delete`. If the type of set to `delete`, the user with that `name` will be deleted.
232233
* `language` is the language for the account. If missing, the default is `en`.
233-
* `color` is the color for the account. If missing, it's generated randomly.
234+
* `stroke` is the stroke color for the account. If missing, it's generated randomly.
235+
* `fill` is the fill color for the account. If missing, it's generated randomly.
234236
* `password` is the password for the account. If missing, it's generated randomly.
235-
* `classroom` is the classroom for the student. If a classroom with this name exist, the student is add to the classroom. If a classroom don't exist, the classroom is created first. If missing, the student is let without classroom.
237+
* `classroom` is the classroom for the student. If a classroom with this name exists, the student is added to the classroom. If a classroom doesn't exist, the classroom is created first. If missing, the student is let without classroom.
236238

237-
At the end of the script a new CSV file named `output.csv` is generated. The output file has the same format than the input field with two more fields:
239+
At the end of the script, a new CSV file named `output.csv` is generated. The output file has the same format than the input field with three more fields:
238240

239-
* `status` is 1 if item created, 0 if an error happened.
241+
* `status` is 1 if item created, 2 if item deleted, 0 if an error happened.
240242
* `comment` is the detail of action done.
243+
* `_id` is the ObjectId of the created account.
241244

242245
Here's an example of output file:
243246

244-
name,type,language,color,password,classroom,status,comment
245-
Lionel,admin,fr,"{""stroke"":""#F8E800"",""fill"":""#FF8F00""}",aaaa,,1,
246-
Nikhil,student,en,"{""stroke"":""#807500"",""fill"":""#FF8F00""}",l0dU,CM2,1,Given password was invalid (Generated random password).
247+
status,comment,_id,name,type,language,stroke,fill,password,classroom
248+
1,,5d30162ced7ee117b842ad4a,Lionel,admin,fr,#BCCDFF,#FF8F00,aaaa,
249+
1,Given password was invalid (Generated random password).,5d30162ced7ee117b842ad57,Nikhil,student,en,#D1A3FF,#AC32FF,l0dU,CM2
247250

248251
Note: For security reason, the script should be launched from the local machine. On Docker, attach a new shell to the container and launch the script from this shell - in that case the port to use should be 80, not 8080.
249252

@@ -255,7 +258,7 @@ Few parameters in the **[security]** section of the setting file are dedicated t
255258

256259
* To run the server securely set `https` parameter to `true`.
257260
* `certificate_file` and `key_file` are path to certificate and key file to sign requests.
258-
* `strict_ssl` should be set to `false` if your certificate is a self signed certificate or is a certificate not signed by a trusted authority.
261+
* `strict_ssl` should be set to `false` if your certificate is a self-signed certificate or is a certificate not signed by a trusted authority.
259262

260263

261264
## Unit testing
@@ -271,27 +274,27 @@ Note that settings for unit testing are defined in [env/test.ini](env/test.ini).
271274

272275
# Optimize performance
273276

274-
If you want to optimize JavaScript performance, you could generate an optimized version of Sugarizer and Sugarizer-Server with [Grunt](http://gruntjs.com). This optimized version will minimize and reduce size of the public resources.
277+
If you want to optimize JavaScript performance, you could generate an optimized version of Sugarizer and Sugarizer-Server with [Grunt](http://gruntjs.com). This optimized version will minimize and reduce the size of the public resources.
275278

276-
First ensure than Node.js and npm is installed on your machine. See [here](http://nodejs.org/) for more information.
279+
First, ensure that Node.js and npm are installed on your machine. See [here](http://nodejs.org/) for more information.
277280

278-
The Gruntfile.js contains tasks settings to build an optimized version of Sugarizer and Sugarizer-Server. To do that, ensure first that Grunt is installed:
281+
The Gruntfile.js contains task settings to build an optimized version of Sugarizer and Sugarizer-Server. To do that, ensure first that Grunt is installed:
279282

280283
npm install -g grunt-cli
281284

282-
Then navigate to Sugarizer directory install specific component for Sugarizer by running:
285+
Then navigate to Sugarizer directory install the specific component for Sugarizer by running:
283286

284287
npm install
285288

286289
Then launch Grunt task to minify Sugarizer JavaScript files:
287290

288291
grunt -v
289292

290-
After minification, the `build` directory will contain the optimized version of each file in a same directory that the initial one, so you could just copy files:
293+
After minification, the `build` directory will contain the optimized version of each file in the same directory as the initial one, so you could just copy files:
291294

292295
cp -r build/* .
293296

294-
Then navigate to Sugarizer-Server directory install specific component for Sugarizer-Server by running:
297+
Then navigate to Sugarizer-Server directory install the specific component for Sugarizer-Server by running:
295298

296299
npm install
297300

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# creates the vm instance
2+
3+
- hosts: localhost
4+
tasks:
5+
- name: Creating Disk for VM instance
6+
gcp_compute_disk:
7+
name: sugarizer-disk
8+
size_gb: "{{ disk_size_gb }}"
9+
source_image: "{{ image }}"
10+
zone: "{{ zone }}"
11+
project: "{{ project_id }}"
12+
auth_kind: serviceaccount
13+
service_account_file: "{{ credentials_file }}"
14+
state: present
15+
register: disk
16+
17+
- include_vars:
18+
file: gcp-start-script.yml
19+
20+
- name: Creating GCP VM instance
21+
gcp_compute_instance:
22+
name: "{{ instance_names }}"
23+
zone: "{{ zone }}"
24+
machine_type: "{{ machine_type }}"
25+
disks:
26+
- auto_delete: 'true'
27+
boot: 'true'
28+
source: "{{ disk }}"
29+
network_interfaces:
30+
- network: null
31+
access_configs:
32+
- name: External NAT
33+
type: ONE_TO_ONE_NAT
34+
state: present
35+
metadata:
36+
startup-script: "{{ script }}"
37+
auth_kind: serviceaccount
38+
service_account_file: "{{ credentials_file }}"
39+
project: "{{ project_id }}"
40+
register: gce
41+
42+
- name: Getting External IPs of hosts
43+
debug:
44+
msg: "ExternalIP = {{ gce.networkInterfaces[0].accessConfigs[0].natIP }}"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# creates the firewall rule
2+
3+
- name: create a firewall
4+
hosts: localhost
5+
tasks:
6+
- gcp_compute_firewall:
7+
name: firewall-role
8+
allowed:
9+
- ip_protocol: tcp
10+
project: "{{ project_id }}"
11+
priority: "65534"
12+
direction: "INGRESS"
13+
auth_kind: serviceaccount
14+
service_account_file: "{{ credentials_file }}"
15+
state: present
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
script: 'apt update;
2+
apt install -y git;
3+
git clone https://github.com/llaske/sugarizer;
4+
git clone https://github.com/llaske/sugarizer-server;
5+
curl -fsSL https://get.docker.com/ | sh;
6+
curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
7+
chmod +x /usr/local/bin/docker-compose;
8+
cd sugarizer-server;
9+
sh generate-docker-compose.sh;
10+
sleep 30s;
11+
docker-compose up -d'

0 commit comments

Comments
 (0)