@edifice.io/client 2.0.5-develop.20250127164045 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globals.d.ts +0 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +290 -395
- package/dist/resources/interface.d.ts +0 -8
- package/package.json +3 -3
- package/dist/resources/services/HomeworksResourceService.d.ts +0 -14
- package/dist/resources/services/TimelineGeneratorResourceService.d.ts +0 -14
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
2
|
var T = (o, e, t) => e in o ? v(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
-
var
|
|
3
|
+
var n = (o, e, t) => T(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import axios from "axios";
|
|
5
5
|
import { MimeTypeUtils } from "@edifice.io/utilities";
|
|
6
6
|
const ERROR_CODE = {
|
|
@@ -14,7 +14,7 @@ const ERROR_CODE = {
|
|
|
14
14
|
TIME_OUT: "0070",
|
|
15
15
|
MALFORMED_DATA: "0080",
|
|
16
16
|
NOT_LOGGED_IN: "0090"
|
|
17
|
-
}, APP$
|
|
17
|
+
}, APP$1 = {
|
|
18
18
|
ADMIN: "admin",
|
|
19
19
|
ARCHIVE: "archive",
|
|
20
20
|
AUTH: "auth",
|
|
@@ -30,13 +30,11 @@ const ERROR_CODE = {
|
|
|
30
30
|
WORKSPACE: "workspace",
|
|
31
31
|
// -- a few others commonly used apps
|
|
32
32
|
EXPLORER: "explorer",
|
|
33
|
-
HOMEWORKS: "homeworks",
|
|
34
33
|
VIDEO: "video",
|
|
35
34
|
MINDMAP: "mindmap",
|
|
36
35
|
SCRAPBOOK: "scrapbook",
|
|
37
36
|
COLLABORATIVEWALL: "collaborativewall",
|
|
38
|
-
WIKI: "wiki"
|
|
39
|
-
TIMELINEGENERATOR: "timelinegenerator"
|
|
37
|
+
WIKI: "wiki"
|
|
40
38
|
// TODO compléter/trier les apps suivantes
|
|
41
39
|
/*
|
|
42
40
|
"competences"
|
|
@@ -99,7 +97,7 @@ const ERROR_CODE = {
|
|
|
99
97
|
};
|
|
100
98
|
class Subscription {
|
|
101
99
|
constructor(e, t) {
|
|
102
|
-
|
|
100
|
+
n(this, "revoke");
|
|
103
101
|
this._channel = e, this.revoke = this.setReceiver(
|
|
104
102
|
(s) => t == null ? void 0 : t(s.data)
|
|
105
103
|
);
|
|
@@ -117,7 +115,7 @@ class Subject {
|
|
|
117
115
|
* => We maintain here channels for *sending* messages.
|
|
118
116
|
* *Receiving* channels will be instantiated while subscribing.
|
|
119
117
|
*/
|
|
120
|
-
|
|
118
|
+
n(this, "publishChannels", /* @__PURE__ */ new Map());
|
|
121
119
|
}
|
|
122
120
|
getChannelName(e) {
|
|
123
121
|
return "Subject:" + e;
|
|
@@ -152,9 +150,9 @@ const ASYNC_DATA_NAME = {
|
|
|
152
150
|
class Promisified {
|
|
153
151
|
constructor() {
|
|
154
152
|
//-------------------------------------
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
n(this, "_resolution");
|
|
154
|
+
n(this, "_rejection");
|
|
155
|
+
n(this, "_promise", new Promise((e, t) => {
|
|
158
156
|
this._resolution = e, this._rejection = t;
|
|
159
157
|
}));
|
|
160
158
|
}
|
|
@@ -171,8 +169,8 @@ class Promisified {
|
|
|
171
169
|
class NotifyFramework {
|
|
172
170
|
constructor() {
|
|
173
171
|
//-------------------------------------
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
n(this, "promises", {});
|
|
173
|
+
n(this, "subject", new Subject());
|
|
176
174
|
}
|
|
177
175
|
asyncData(e) {
|
|
178
176
|
return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
|
|
@@ -203,8 +201,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
|
|
|
203
201
|
class Http {
|
|
204
202
|
constructor(e) {
|
|
205
203
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
n(this, "axios");
|
|
205
|
+
n(this, "_latestResponse");
|
|
208
206
|
this.axios = axios.create(e);
|
|
209
207
|
}
|
|
210
208
|
setCdn(e) {
|
|
@@ -282,15 +280,15 @@ class Http {
|
|
|
282
280
|
}
|
|
283
281
|
getScript(e, t, s) {
|
|
284
282
|
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
285
|
-
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((
|
|
283
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
|
|
286
284
|
try {
|
|
287
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
285
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
|
|
288
286
|
return Function(a)();
|
|
289
287
|
} catch {
|
|
290
|
-
return
|
|
288
|
+
return u;
|
|
291
289
|
}
|
|
292
|
-
}).catch((
|
|
293
|
-
throw this.mapAxiosError(
|
|
290
|
+
}).catch((u) => {
|
|
291
|
+
throw this.mapAxiosError(u, t), u;
|
|
294
292
|
});
|
|
295
293
|
}
|
|
296
294
|
loadScript(e, t) {
|
|
@@ -301,7 +299,7 @@ class Http {
|
|
|
301
299
|
}
|
|
302
300
|
class TransportFramework {
|
|
303
301
|
constructor() {
|
|
304
|
-
|
|
302
|
+
n(this, "_http", new Http());
|
|
305
303
|
}
|
|
306
304
|
get http() {
|
|
307
305
|
return this._http;
|
|
@@ -320,11 +318,11 @@ class ConfigurationFrameworkFactory {
|
|
|
320
318
|
const http$2 = transport.http;
|
|
321
319
|
class Session {
|
|
322
320
|
constructor() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
321
|
+
n(this, "_me", null);
|
|
322
|
+
n(this, "_currentLanguage", "");
|
|
323
|
+
n(this, "_notLoggedIn", !0);
|
|
324
|
+
n(this, "_description");
|
|
325
|
+
n(this, "_profile");
|
|
328
326
|
}
|
|
329
327
|
get currentLanguage() {
|
|
330
328
|
return this._currentLanguage;
|
|
@@ -369,8 +367,8 @@ class Session {
|
|
|
369
367
|
hasRight(e, t) {
|
|
370
368
|
if (t === "owner")
|
|
371
369
|
return e.owner && e.owner.userId === this._me.userId;
|
|
372
|
-
const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0,
|
|
373
|
-
return i &&
|
|
370
|
+
const s = t.right || t, i = e.shared.filter((a) => (this._me.groupsIds || []).indexOf(a.groupId) !== -1 || a.userId === this._me.userId).find((a) => a[s] || a.manager) !== void 0, u = t.workflow ? this.hasWorkflow(t.workflow) : !0;
|
|
371
|
+
return i && u;
|
|
374
372
|
}
|
|
375
373
|
////////////////////////////////////////////////////////// Storage management
|
|
376
374
|
get latestQuotaAndUsage() {
|
|
@@ -442,7 +440,7 @@ class Session {
|
|
|
442
440
|
}
|
|
443
441
|
class SessionFramework {
|
|
444
442
|
constructor() {
|
|
445
|
-
|
|
443
|
+
n(this, "session", new Session());
|
|
446
444
|
}
|
|
447
445
|
initialize() {
|
|
448
446
|
return this.session.initialize();
|
|
@@ -466,22 +464,22 @@ class SessionFramework {
|
|
|
466
464
|
const session = new SessionFramework();
|
|
467
465
|
class Theme {
|
|
468
466
|
constructor() {
|
|
469
|
-
|
|
470
|
-
|
|
467
|
+
n(this, "_conf");
|
|
468
|
+
n(this, "_loaded");
|
|
471
469
|
// legacy (readonly)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
470
|
+
n(this, "skinName", "");
|
|
471
|
+
n(this, "themeName", "");
|
|
472
|
+
n(this, "skin", "raw");
|
|
473
|
+
n(this, "themeUrl", "/assets/themes/raw/default/");
|
|
474
|
+
n(this, "templateOverrides", {});
|
|
475
|
+
n(this, "portalTemplate", "/assets/themes/raw/portal.html");
|
|
476
|
+
n(this, "basePath", "");
|
|
477
|
+
n(this, "logoutCallback", "/");
|
|
478
|
+
n(this, "skins", []);
|
|
479
|
+
n(this, "is1D", !1);
|
|
480
|
+
n(this, "is2D", !1);
|
|
481
|
+
n(this, "_onSkinReady", notify.onSkinReady());
|
|
482
|
+
n(this, "_onOverrideReady", notify.onOverridesReady());
|
|
485
483
|
}
|
|
486
484
|
initialize(e) {
|
|
487
485
|
return notify.onSessionReady().promise.then(() => this.load(e));
|
|
@@ -814,8 +812,8 @@ class Idiom {
|
|
|
814
812
|
else {
|
|
815
813
|
const i = new Promisified();
|
|
816
814
|
promises$1[t] = i.promise;
|
|
817
|
-
const
|
|
818
|
-
e && (
|
|
815
|
+
const u = {};
|
|
816
|
+
e && (u["Accept-Language"] = e), transport.http.get(t, { headers: u }).then((a) => {
|
|
819
817
|
Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
|
|
820
818
|
}).catch((a) => {
|
|
821
819
|
typeof s == "function" && s(), i.reject();
|
|
@@ -853,7 +851,7 @@ class Idiom {
|
|
|
853
851
|
class UserPreferences {
|
|
854
852
|
constructor() {
|
|
855
853
|
//-------------------------------------
|
|
856
|
-
|
|
854
|
+
n(this, "data", {});
|
|
857
855
|
}
|
|
858
856
|
get(e) {
|
|
859
857
|
return this.data[e];
|
|
@@ -880,10 +878,10 @@ class UserPreferences {
|
|
|
880
878
|
class User {
|
|
881
879
|
constructor() {
|
|
882
880
|
//-------------------------------------
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
881
|
+
n(this, "_me", null);
|
|
882
|
+
n(this, "_keepOpenOnLogout", !1);
|
|
883
|
+
n(this, "_preferences", new UserPreferences());
|
|
884
|
+
n(this, "_bookmarkedApps", []);
|
|
887
885
|
}
|
|
888
886
|
get keepOpenOnLogout() {
|
|
889
887
|
return this._keepOpenOnLogout;
|
|
@@ -915,7 +913,7 @@ class User {
|
|
|
915
913
|
let s;
|
|
916
914
|
if (t && t.length && typeof t.concat == "function") {
|
|
917
915
|
this._bookmarkedApps = t, s = {
|
|
918
|
-
bookmarks: t.map((
|
|
916
|
+
bookmarks: t.map((u) => u.name),
|
|
919
917
|
applications: []
|
|
920
918
|
}, transport.http.putJson("/userbook/preference/apps", s);
|
|
921
919
|
return;
|
|
@@ -927,15 +925,15 @@ class User {
|
|
|
927
925
|
});
|
|
928
926
|
let r = !0;
|
|
929
927
|
const i = [];
|
|
930
|
-
s.bookmarks.forEach((
|
|
931
|
-
const c = this._me.apps.find((h) => h.name ===
|
|
928
|
+
s.bookmarks.forEach((u, a) => {
|
|
929
|
+
const c = this._me.apps.find((h) => h.name === u);
|
|
932
930
|
if (c) {
|
|
933
931
|
const h = Object.assign({}, c);
|
|
934
932
|
this._bookmarkedApps.push(h);
|
|
935
933
|
} else
|
|
936
|
-
i.push(
|
|
937
|
-
}), i.forEach((
|
|
938
|
-
const a = s.bookmarks.indexOf(
|
|
934
|
+
i.push(u), r = !1;
|
|
935
|
+
}), i.forEach((u) => {
|
|
936
|
+
const a = s.bookmarks.indexOf(u);
|
|
939
937
|
a !== -1 && s.bookmarks.splice(a, 1);
|
|
940
938
|
}), r || transport.http.putJson("/userbook/preference/apps", s);
|
|
941
939
|
});
|
|
@@ -957,9 +955,9 @@ const http$1 = transport == null ? void 0 : transport.http;
|
|
|
957
955
|
class AppConf {
|
|
958
956
|
constructor() {
|
|
959
957
|
//-------------------------------------
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
958
|
+
n(this, "_publicConf", {});
|
|
959
|
+
n(this, "_currentApp");
|
|
960
|
+
n(this, "_appConf", {});
|
|
963
961
|
}
|
|
964
962
|
/**
|
|
965
963
|
* Get the currently initialized App.
|
|
@@ -997,8 +995,8 @@ class AppConf {
|
|
|
997
995
|
class Analytics {
|
|
998
996
|
constructor() {
|
|
999
997
|
//-------------------------------------
|
|
1000
|
-
|
|
1001
|
-
|
|
998
|
+
n(this, "_status", "void");
|
|
999
|
+
n(this, "_params");
|
|
1002
1000
|
}
|
|
1003
1001
|
get status() {
|
|
1004
1002
|
return this._status;
|
|
@@ -1050,8 +1048,8 @@ class Analytics {
|
|
|
1050
1048
|
configure.Platform.apps.currentApp
|
|
1051
1049
|
);
|
|
1052
1050
|
if (!i) return;
|
|
1053
|
-
const
|
|
1054
|
-
if (!
|
|
1051
|
+
const u = i.xiti;
|
|
1052
|
+
if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
|
|
1055
1053
|
function a(h) {
|
|
1056
1054
|
let l = "";
|
|
1057
1055
|
for (let E = 0; E < h.length; E++)
|
|
@@ -1066,10 +1064,10 @@ class Analytics {
|
|
|
1066
1064
|
Guest: "AUTRE"
|
|
1067
1065
|
};
|
|
1068
1066
|
return {
|
|
1069
|
-
LIBELLE_SERVICE:
|
|
1067
|
+
LIBELLE_SERVICE: u.LIBELLE_SERVICE,
|
|
1070
1068
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
1071
|
-
TYPE:
|
|
1072
|
-
OUTIL:
|
|
1069
|
+
TYPE: u.OUTIL ? "TIERS" : "NATIF",
|
|
1070
|
+
OUTIL: u.OUTIL ? u.OUTIL : "",
|
|
1073
1071
|
STRUCT_ID: r.collectiviteId,
|
|
1074
1072
|
STRUCT_UAI: r.UAI,
|
|
1075
1073
|
PROJET: r.projetId ? r.projetId : e.ID_PROJET,
|
|
@@ -1083,7 +1081,7 @@ class Analytics {
|
|
|
1083
1081
|
class ConfigurationFramework {
|
|
1084
1082
|
constructor() {
|
|
1085
1083
|
//-------------------------------------
|
|
1086
|
-
|
|
1084
|
+
n(this, "Platform", {
|
|
1087
1085
|
deploymentTag: "",
|
|
1088
1086
|
cdnDomain: "",
|
|
1089
1087
|
apps: new AppConf(),
|
|
@@ -1092,15 +1090,15 @@ class ConfigurationFramework {
|
|
|
1092
1090
|
idiom: new Idiom(),
|
|
1093
1091
|
listLanguages: () => transport.http.get("/languages")
|
|
1094
1092
|
});
|
|
1095
|
-
|
|
1093
|
+
n(this, "School", {
|
|
1096
1094
|
//apps; -> pinnedApps;
|
|
1097
1095
|
});
|
|
1098
|
-
|
|
1096
|
+
n(this, "User", new User());
|
|
1099
1097
|
}
|
|
1100
1098
|
async initialize(e, t) {
|
|
1101
1099
|
if (!e) {
|
|
1102
|
-
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(),
|
|
1103
|
-
e = `${
|
|
1100
|
+
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), u = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
|
|
1101
|
+
e = `${u}${r(a)}${r(c)}`;
|
|
1104
1102
|
}
|
|
1105
1103
|
const s = e;
|
|
1106
1104
|
this.Platform.deploymentTag = e, typeof t == "string" && t.length > 0 && (this.Platform.cdnDomain = t), transport.http.setCdn(this.Platform.cdnDomain), await Promise.all([
|
|
@@ -1142,8 +1140,8 @@ var _;
|
|
|
1142
1140
|
const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
|
|
1143
1141
|
class Notification {
|
|
1144
1142
|
constructor(e) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1143
|
+
n(this, "_id");
|
|
1144
|
+
n(this, "model");
|
|
1147
1145
|
e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
|
|
1148
1146
|
}
|
|
1149
1147
|
isUnread() {
|
|
@@ -1163,14 +1161,14 @@ class Notification {
|
|
|
1163
1161
|
class TimelineApp {
|
|
1164
1162
|
constructor() {
|
|
1165
1163
|
//-------------------------------------
|
|
1166
|
-
|
|
1167
|
-
|
|
1164
|
+
n(this, "_notifications", []);
|
|
1165
|
+
n(this, "_notificationTypes", []);
|
|
1168
1166
|
// ex: ["BLOG"]
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1167
|
+
n(this, "_flashMessages", []);
|
|
1168
|
+
n(this, "_pageNumber", 0);
|
|
1169
|
+
n(this, "_lastPage", !1);
|
|
1170
|
+
n(this, "_loading", !1);
|
|
1171
|
+
n(this, "showMine", !1);
|
|
1174
1172
|
}
|
|
1175
1173
|
get notifications() {
|
|
1176
1174
|
return this._notifications;
|
|
@@ -1191,20 +1189,20 @@ class TimelineApp {
|
|
|
1191
1189
|
return this.preferences.type = this.preferences.type || [], this.preferences.type;
|
|
1192
1190
|
}
|
|
1193
1191
|
get preferences() {
|
|
1194
|
-
return configure.User.preferences.get(APP$
|
|
1192
|
+
return configure.User.preferences.get(APP$1.TIMELINE);
|
|
1195
1193
|
}
|
|
1196
1194
|
get flashMessages() {
|
|
1197
1195
|
return this._flashMessages;
|
|
1198
1196
|
}
|
|
1199
1197
|
savePreferences() {
|
|
1200
|
-
return configure.User.saveAppPrefs(APP$
|
|
1198
|
+
return configure.User.saveAppPrefs(APP$1.TIMELINE);
|
|
1201
1199
|
}
|
|
1202
1200
|
resetPagination() {
|
|
1203
1201
|
this._pageNumber = 0, this._lastPage = !1, this._loading = !1;
|
|
1204
1202
|
}
|
|
1205
1203
|
initialize() {
|
|
1206
1204
|
return Promise.all([
|
|
1207
|
-
configure.User.loadAppPrefs(APP$
|
|
1205
|
+
configure.User.loadAppPrefs(APP$1.TIMELINE),
|
|
1208
1206
|
transport.http.get("/timeline/types")
|
|
1209
1207
|
]).then((e) => {
|
|
1210
1208
|
this._notificationTypes = e[1];
|
|
@@ -1228,10 +1226,10 @@ class TimelineApp {
|
|
|
1228
1226
|
if (this._loading = !1, r.status === "ok")
|
|
1229
1227
|
if (r.number && r.results) {
|
|
1230
1228
|
const i = r.results.filter(
|
|
1231
|
-
(
|
|
1232
|
-
(a) => a._id ===
|
|
1229
|
+
(u) => this._notifications.findIndex(
|
|
1230
|
+
(a) => a._id === u._id
|
|
1233
1231
|
) === -1
|
|
1234
|
-
).map((
|
|
1232
|
+
).map((u) => new Notification(u));
|
|
1235
1233
|
this._notifications = this._notifications.concat(i), this._pageNumber++;
|
|
1236
1234
|
} else
|
|
1237
1235
|
this._lastPage = !0;
|
|
@@ -1319,7 +1317,7 @@ const f = class f {
|
|
|
1319
1317
|
//
|
|
1320
1318
|
// PROTECTED HELPERS
|
|
1321
1319
|
//
|
|
1322
|
-
|
|
1320
|
+
n(this, "checkHttpResponse", (e) => {
|
|
1323
1321
|
if (this.http.latestResponse.status >= 300)
|
|
1324
1322
|
throw this.http.latestResponse.statusText;
|
|
1325
1323
|
return e;
|
|
@@ -1471,7 +1469,7 @@ const f = class f {
|
|
|
1471
1469
|
});
|
|
1472
1470
|
return t.map((r) => {
|
|
1473
1471
|
const i = s.resources.find(
|
|
1474
|
-
(
|
|
1472
|
+
(u) => u.assetId === r
|
|
1475
1473
|
);
|
|
1476
1474
|
if (i === void 0)
|
|
1477
1475
|
throw "explorer.assetid.notfound";
|
|
@@ -1537,10 +1535,10 @@ const f = class f {
|
|
|
1537
1535
|
//
|
|
1538
1536
|
// STATIC REGISTRY
|
|
1539
1537
|
//
|
|
1540
|
-
|
|
1541
|
-
|
|
1538
|
+
n(f, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
1539
|
+
n(f, "register", f.registry.register.bind(f.registry)), n(f, "findService", f.registry.findService.bind(f.registry)), n(f, "findMainService", f.registry.findMainService.bind(f.registry)), n(f, "isRegistered", f.registry.isRegistered.bind(f.registry));
|
|
1542
1540
|
let ResourceService = f;
|
|
1543
|
-
const APP
|
|
1541
|
+
const APP = "scrapbook", RESOURCE = "scrapbook";
|
|
1544
1542
|
class ScrapbookResourceService extends ResourceService {
|
|
1545
1543
|
create(e) {
|
|
1546
1544
|
throw new Error("Method not implemented.");
|
|
@@ -1558,10 +1556,10 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1558
1556
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1559
1557
|
}
|
|
1560
1558
|
getResourceType() {
|
|
1561
|
-
return RESOURCE
|
|
1559
|
+
return RESOURCE;
|
|
1562
1560
|
}
|
|
1563
1561
|
getApplication() {
|
|
1564
|
-
return APP
|
|
1562
|
+
return APP;
|
|
1565
1563
|
}
|
|
1566
1564
|
getFormUrl(e) {
|
|
1567
1565
|
return e ? `/scrapbook?folderid=${e}#/create-scrapbook/` : "/scrapbook#/create-scrapbook/";
|
|
@@ -1579,112 +1577,9 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1579
1577
|
return `/scrapbook/exportHtml/${e}`;
|
|
1580
1578
|
}
|
|
1581
1579
|
}
|
|
1582
|
-
ResourceService.register(
|
|
1583
|
-
{ application: RESOURCE$2, resourceType: RESOURCE$2 },
|
|
1584
|
-
(o) => new ScrapbookResourceService(o)
|
|
1585
|
-
);
|
|
1586
|
-
const APP$1 = "homeworks", RESOURCE$1 = "homeworks";
|
|
1587
|
-
class HomeworksResourceService extends ResourceService {
|
|
1588
|
-
async create(e) {
|
|
1589
|
-
const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.post("/homeworks", {
|
|
1590
|
-
title: e.name,
|
|
1591
|
-
thumbnail: t,
|
|
1592
|
-
description: e.description,
|
|
1593
|
-
repeats: e.repeats
|
|
1594
|
-
});
|
|
1595
|
-
return this.checkHttpResponse(s), { thumbnail: t, entId: s._id };
|
|
1596
|
-
}
|
|
1597
|
-
async update(e) {
|
|
1598
|
-
const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.put(
|
|
1599
|
-
`/homeworks/${e.entId}`,
|
|
1600
|
-
{
|
|
1601
|
-
title: e.name,
|
|
1602
|
-
thumbnail: t,
|
|
1603
|
-
repeats: e.repeats
|
|
1604
|
-
}
|
|
1605
|
-
);
|
|
1606
|
-
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1607
|
-
}
|
|
1608
|
-
getResourceType() {
|
|
1609
|
-
return RESOURCE$1;
|
|
1610
|
-
}
|
|
1611
|
-
getApplication() {
|
|
1612
|
-
return APP$1;
|
|
1613
|
-
}
|
|
1614
|
-
getFormUrl(e) {
|
|
1615
|
-
return e ? `/homeworks?folderid=${e}#/create-homeworks/` : "/homeworks#/create-homeworks/";
|
|
1616
|
-
}
|
|
1617
|
-
getViewUrl(e) {
|
|
1618
|
-
return `/homeworks#/view-homeworks/${e}`;
|
|
1619
|
-
}
|
|
1620
|
-
getPrintUrl(e) {
|
|
1621
|
-
return `/homeworks/print#/print-homeworks/${e}`;
|
|
1622
|
-
}
|
|
1623
|
-
getEditUrl(e) {
|
|
1624
|
-
return `/homeworks#/edit-homeworks/${e}`;
|
|
1625
|
-
}
|
|
1626
|
-
getExportUrl() {
|
|
1627
|
-
throw new Error("Export not implemented.");
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
ResourceService.register(
|
|
1631
|
-
{ application: RESOURCE$1, resourceType: RESOURCE$1 },
|
|
1632
|
-
(o) => new HomeworksResourceService(o)
|
|
1633
|
-
);
|
|
1634
|
-
const APP = "timelinegenerator", RESOURCE = "timelinegenerator";
|
|
1635
|
-
class TimelineGeneratorResourceService extends ResourceService {
|
|
1636
|
-
async create(e) {
|
|
1637
|
-
const t = e.thumbnail ? await this.getThumbnailPath(e.thumbnail) : "", s = await this.http.post(
|
|
1638
|
-
"/timelinegenerator/timelines",
|
|
1639
|
-
{
|
|
1640
|
-
headline: e.name,
|
|
1641
|
-
text: e.description,
|
|
1642
|
-
icon: t,
|
|
1643
|
-
type: "default",
|
|
1644
|
-
folder: e.folder
|
|
1645
|
-
}
|
|
1646
|
-
);
|
|
1647
|
-
return this.checkHttpResponse(s), s;
|
|
1648
|
-
}
|
|
1649
|
-
async update(e) {
|
|
1650
|
-
const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.put(
|
|
1651
|
-
`/timelinegenerator/timeline/${e.entId}`,
|
|
1652
|
-
{
|
|
1653
|
-
headline: e.name,
|
|
1654
|
-
text: e.description,
|
|
1655
|
-
icon: t,
|
|
1656
|
-
trashed: !!e.trashed,
|
|
1657
|
-
_id: e.entId,
|
|
1658
|
-
type: "default"
|
|
1659
|
-
}
|
|
1660
|
-
);
|
|
1661
|
-
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1662
|
-
}
|
|
1663
|
-
getResourceType() {
|
|
1664
|
-
return RESOURCE;
|
|
1665
|
-
}
|
|
1666
|
-
getApplication() {
|
|
1667
|
-
return APP;
|
|
1668
|
-
}
|
|
1669
|
-
getFormUrl() {
|
|
1670
|
-
throw new Error("Method not implemented.");
|
|
1671
|
-
}
|
|
1672
|
-
getViewUrl(e) {
|
|
1673
|
-
return `/timelinegenerator#/view/${e}`;
|
|
1674
|
-
}
|
|
1675
|
-
getPrintUrl(e) {
|
|
1676
|
-
return `/timelinegenerator/print#/print/${e}`;
|
|
1677
|
-
}
|
|
1678
|
-
getEditUrl() {
|
|
1679
|
-
throw new Error("Method not implemented.");
|
|
1680
|
-
}
|
|
1681
|
-
getExportUrl() {
|
|
1682
|
-
throw new Error("Method not implemented.");
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
1580
|
ResourceService.register(
|
|
1686
1581
|
{ application: RESOURCE, resourceType: RESOURCE },
|
|
1687
|
-
(o) => new
|
|
1582
|
+
(o) => new ScrapbookResourceService(o)
|
|
1688
1583
|
);
|
|
1689
1584
|
const globalCache = {}, mutexPromise = {};
|
|
1690
1585
|
class CacheService {
|
|
@@ -1753,14 +1648,14 @@ class ConfService {
|
|
|
1753
1648
|
]), [r, i] = await Promise.all([
|
|
1754
1649
|
this.getTheme({ conf: t, publicTheme: s === void 0 }),
|
|
1755
1650
|
this.getWebAppConf({ app: e, applications: s ?? [] })
|
|
1756
|
-
]),
|
|
1651
|
+
]), u = {
|
|
1757
1652
|
app: e,
|
|
1758
1653
|
applications: s ?? [],
|
|
1759
1654
|
conf: t,
|
|
1760
1655
|
currentApp: i,
|
|
1761
1656
|
theme: r
|
|
1762
1657
|
};
|
|
1763
|
-
return this.notify.onAppConfReady().resolve(
|
|
1658
|
+
return this.notify.onAppConfReady().resolve(u), u;
|
|
1764
1659
|
}
|
|
1765
1660
|
async getPublicConf(e) {
|
|
1766
1661
|
const { response: t, value: s } = await this.cache.httpGet(
|
|
@@ -1812,23 +1707,23 @@ class ConfService {
|
|
|
1812
1707
|
conf: t,
|
|
1813
1708
|
publicTheme: s
|
|
1814
1709
|
}) {
|
|
1815
|
-
const r = await this.http.get("/theme"), i = s ? null : r,
|
|
1710
|
+
const r = await this.http.get("/theme"), i = s ? null : r, u = t == null ? void 0 : t.overriding.find(
|
|
1816
1711
|
(p) => (
|
|
1817
1712
|
// Public access => simply use the 1st override
|
|
1818
1713
|
i === null || p.child === i.themeName
|
|
1819
1714
|
)
|
|
1820
|
-
), a = (i == null ? void 0 : i.skinName) ||
|
|
1715
|
+
), a = (i == null ? void 0 : i.skinName) || u.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${u.child}/skins/${a}/`, h = u.skins, l = u.bootstrapVersion.split("-").slice(-1)[0], E = u.parent === "panda";
|
|
1821
1716
|
return {
|
|
1822
1717
|
basePath: `${this.cdnDomain}${c}../../`,
|
|
1823
1718
|
bootstrapVersion: l,
|
|
1824
1719
|
is1d: E,
|
|
1825
1720
|
logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
|
|
1826
|
-
skin:
|
|
1721
|
+
skin: u.child,
|
|
1827
1722
|
skinName: a,
|
|
1828
1723
|
skins: h,
|
|
1829
|
-
themeName:
|
|
1724
|
+
themeName: u.child,
|
|
1830
1725
|
themeUrl: c,
|
|
1831
|
-
npmTheme:
|
|
1726
|
+
npmTheme: u.npmTheme ?? void 0
|
|
1832
1727
|
};
|
|
1833
1728
|
}
|
|
1834
1729
|
async getLogoutCallback(e) {
|
|
@@ -1873,13 +1768,13 @@ class DirectoryService {
|
|
|
1873
1768
|
return {
|
|
1874
1769
|
id: s,
|
|
1875
1770
|
displayName: r,
|
|
1876
|
-
groups: t.map(({ name:
|
|
1877
|
-
displayName:
|
|
1771
|
+
groups: t.map(({ name: u, id: a }) => ({
|
|
1772
|
+
displayName: u,
|
|
1878
1773
|
id: a
|
|
1879
1774
|
})),
|
|
1880
|
-
users: i.map(({ displayName:
|
|
1775
|
+
users: i.map(({ displayName: u, id: a, profile: c }) => ({
|
|
1881
1776
|
profile: c,
|
|
1882
|
-
displayName:
|
|
1777
|
+
displayName: u,
|
|
1883
1778
|
// these info are missing from api
|
|
1884
1779
|
firstName: "",
|
|
1885
1780
|
lastName: "",
|
|
@@ -1894,19 +1789,19 @@ class DirectoryService {
|
|
|
1894
1789
|
users: r
|
|
1895
1790
|
}) {
|
|
1896
1791
|
this.cache.clearCache("/directory/sharebookmark/all");
|
|
1897
|
-
const i = r.map((p) => typeof p == "string" ? p : p.id),
|
|
1792
|
+
const i = r.map((p) => typeof p == "string" ? p : p.id), u = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
|
|
1898
1793
|
if (typeof p == "string") {
|
|
1899
|
-
const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id),
|
|
1794
|
+
const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), R = g.map((F) => F.id);
|
|
1900
1795
|
return {
|
|
1901
1796
|
displayName: d,
|
|
1902
1797
|
id: A,
|
|
1903
|
-
members: [...
|
|
1798
|
+
members: [...R, ...b]
|
|
1904
1799
|
};
|
|
1905
1800
|
} else
|
|
1906
1801
|
return Promise.resolve(p);
|
|
1907
1802
|
}), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
|
|
1908
1803
|
name: e,
|
|
1909
|
-
members: [...i, ...
|
|
1804
|
+
members: [...i, ...u, ...h]
|
|
1910
1805
|
}, { id: E } = await this.http.postJson(
|
|
1911
1806
|
"/directory/sharebookmark",
|
|
1912
1807
|
l
|
|
@@ -1922,10 +1817,10 @@ const loadedScripts = {};
|
|
|
1922
1817
|
class HttpService {
|
|
1923
1818
|
constructor(e, t) {
|
|
1924
1819
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1820
|
+
n(this, "axios");
|
|
1821
|
+
n(this, "baseUrl");
|
|
1822
|
+
n(this, "headers", {});
|
|
1823
|
+
n(this, "_latestResponse");
|
|
1929
1824
|
this.context = e, this.axios = axios.create(t);
|
|
1930
1825
|
}
|
|
1931
1826
|
fixBaseUrl(e) {
|
|
@@ -1970,15 +1865,15 @@ class HttpService {
|
|
|
1970
1865
|
status: 500,
|
|
1971
1866
|
statusText: ERROR_CODE.UNKNOWN
|
|
1972
1867
|
};
|
|
1973
|
-
const { status: s, statusText: r, headers: i, data:
|
|
1868
|
+
const { status: s, statusText: r, headers: i, data: u } = this._latestResponse;
|
|
1974
1869
|
return t != null && t.disableNotifications || notify.events().publish(LAYER_NAME.TRANSPORT, {
|
|
1975
1870
|
name: EVENT_NAME.ERROR_OCCURED,
|
|
1976
1871
|
data: {
|
|
1977
1872
|
params: t,
|
|
1978
1873
|
response: { status: s, statusText: r, headers: i },
|
|
1979
|
-
payload:
|
|
1874
|
+
payload: u
|
|
1980
1875
|
}
|
|
1981
|
-
}),
|
|
1876
|
+
}), u;
|
|
1982
1877
|
}
|
|
1983
1878
|
mapAxiosResponse(e, t) {
|
|
1984
1879
|
return this._latestResponse = e, e.data;
|
|
@@ -2101,15 +1996,15 @@ class HttpService {
|
|
|
2101
1996
|
}
|
|
2102
1997
|
getScript(e, t, s) {
|
|
2103
1998
|
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
2104
|
-
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((
|
|
1999
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((u) => this.mapAxiosResponse(u, t)).then((u) => {
|
|
2105
2000
|
try {
|
|
2106
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
2001
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${u};return ${r};`;
|
|
2107
2002
|
return Function(a)();
|
|
2108
2003
|
} catch {
|
|
2109
|
-
return
|
|
2004
|
+
return u;
|
|
2110
2005
|
}
|
|
2111
|
-
}).catch((
|
|
2112
|
-
throw this.mapAxiosError(
|
|
2006
|
+
}).catch((u) => {
|
|
2007
|
+
throw this.mapAxiosError(u, t), u;
|
|
2113
2008
|
});
|
|
2114
2009
|
}
|
|
2115
2010
|
loadScript(e, t) {
|
|
@@ -2169,13 +2064,13 @@ class RightService {
|
|
|
2169
2064
|
* @returns true if has rights
|
|
2170
2065
|
*/
|
|
2171
2066
|
hasResourceRight({ id: e, groupIds: t }, s, r) {
|
|
2172
|
-
const i = r.map((
|
|
2173
|
-
for (const
|
|
2174
|
-
if (
|
|
2067
|
+
const i = r.map((u) => typeof u == "string" ? this.parseResourceRight(u) : u).filter((u) => u !== void 0);
|
|
2068
|
+
for (const u of i) {
|
|
2069
|
+
if (u.id === e && u.type === "creator")
|
|
2175
2070
|
return !0;
|
|
2176
|
-
if (
|
|
2071
|
+
if (u.id === e && u.type === "user" && u.right === s)
|
|
2177
2072
|
return !0;
|
|
2178
|
-
if (t.includes(
|
|
2073
|
+
if (t.includes(u.id) && u.type === "group" && u.right === s)
|
|
2179
2074
|
return !0;
|
|
2180
2075
|
}
|
|
2181
2076
|
return !1;
|
|
@@ -2312,7 +2207,7 @@ class SessionService {
|
|
|
2312
2207
|
s,
|
|
2313
2208
|
r,
|
|
2314
2209
|
i,
|
|
2315
|
-
|
|
2210
|
+
u
|
|
2316
2211
|
] = await Promise.all([
|
|
2317
2212
|
this.getCurrentLanguage(e),
|
|
2318
2213
|
this.latestQuotaAndUsage(e),
|
|
@@ -2326,7 +2221,7 @@ class SessionService {
|
|
|
2326
2221
|
currentLanguage: t,
|
|
2327
2222
|
userDescription: r,
|
|
2328
2223
|
userProfile: i,
|
|
2329
|
-
bookmarkedApps:
|
|
2224
|
+
bookmarkedApps: u
|
|
2330
2225
|
};
|
|
2331
2226
|
}
|
|
2332
2227
|
login(e, t, s, r) {
|
|
@@ -2420,9 +2315,9 @@ class SessionService {
|
|
|
2420
2315
|
applications: []
|
|
2421
2316
|
});
|
|
2422
2317
|
const i = [];
|
|
2423
|
-
return r.bookmarks.forEach((
|
|
2318
|
+
return r.bookmarks.forEach((u, a) => {
|
|
2424
2319
|
const c = ((e == null ? void 0 : e.apps) || []).find(
|
|
2425
|
-
(h) => h.name ===
|
|
2320
|
+
(h) => h.name === u
|
|
2426
2321
|
);
|
|
2427
2322
|
if (c) {
|
|
2428
2323
|
const h = Object.assign({}, c);
|
|
@@ -2432,8 +2327,8 @@ class SessionService {
|
|
|
2432
2327
|
}
|
|
2433
2328
|
async getUserProfile(e = {}) {
|
|
2434
2329
|
var c, h;
|
|
2435
|
-
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response:
|
|
2436
|
-
return
|
|
2330
|
+
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: u, value: a } = await this.cache.httpGet(i, t);
|
|
2331
|
+
return u.status < 200 || u.status >= 300 || typeof a == "string" ? ["Guest"] : ((h = (c = a == null ? void 0 : a.result) == null ? void 0 : c[0]) == null ? void 0 : h.type) || ["Guest"];
|
|
2437
2332
|
}
|
|
2438
2333
|
async isAdml() {
|
|
2439
2334
|
const e = await this.getUser();
|
|
@@ -2697,8 +2592,8 @@ class IdiomService {
|
|
|
2697
2592
|
else {
|
|
2698
2593
|
const i = new Promisified();
|
|
2699
2594
|
promises[t] = i.promise;
|
|
2700
|
-
const
|
|
2701
|
-
e && (
|
|
2595
|
+
const u = {};
|
|
2596
|
+
e && (u["Accept-Language"] = e), this.http.get(t, { headers: u }).then((a) => {
|
|
2702
2597
|
Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
|
|
2703
2598
|
}).catch((a) => {
|
|
2704
2599
|
typeof s == "function" && s(), i.reject();
|
|
@@ -2762,7 +2657,7 @@ class ShareService {
|
|
|
2762
2657
|
async searchShareSubjects(e, t, s) {
|
|
2763
2658
|
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
2764
2659
|
`/${e}/share/json/${t}?search=${s}`
|
|
2765
|
-
),
|
|
2660
|
+
), u = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
|
|
2766
2661
|
const g = StringUtils.removeAccents(
|
|
2767
2662
|
p || ""
|
|
2768
2663
|
).toLowerCase(), A = StringUtils.removeAccents(
|
|
@@ -2795,7 +2690,7 @@ class ShareService {
|
|
|
2795
2690
|
displayName: l.displayName,
|
|
2796
2691
|
id: l.id,
|
|
2797
2692
|
type: "sharebookmark"
|
|
2798
|
-
})), ...
|
|
2693
|
+
})), ...u, ...a];
|
|
2799
2694
|
}
|
|
2800
2695
|
async getShareMapping(e) {
|
|
2801
2696
|
const t = await this.cache.httpGetJson(
|
|
@@ -2809,15 +2704,15 @@ class ShareService {
|
|
|
2809
2704
|
return t;
|
|
2810
2705
|
}
|
|
2811
2706
|
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2812
|
-
const
|
|
2707
|
+
const u = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2813
2708
|
for (const h of a)
|
|
2814
2709
|
r[h].filter(
|
|
2815
|
-
(p) =>
|
|
2710
|
+
(p) => u.includes(p)
|
|
2816
2711
|
).length > 0 && c.push(h);
|
|
2817
2712
|
return c;
|
|
2818
2713
|
}
|
|
2819
2714
|
async getRightsForResource(e, t) {
|
|
2820
|
-
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r),
|
|
2715
|
+
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), u = await this.getShareMapping(e), a = await this.cache.httpGetJson(
|
|
2821
2716
|
"/infra/public/json/sharing-rights.json"
|
|
2822
2717
|
), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
|
|
2823
2718
|
(A) => A.id === d
|
|
@@ -2825,7 +2720,7 @@ class ShareService {
|
|
|
2825
2720
|
const g = this.getActionsAvailableFor(
|
|
2826
2721
|
{ id: d.id, type: "user" },
|
|
2827
2722
|
i,
|
|
2828
|
-
|
|
2723
|
+
u
|
|
2829
2724
|
);
|
|
2830
2725
|
return {
|
|
2831
2726
|
id: d.id,
|
|
@@ -2849,7 +2744,7 @@ class ShareService {
|
|
|
2849
2744
|
const g = this.getActionsAvailableFor(
|
|
2850
2745
|
{ id: d.id, type: "group" },
|
|
2851
2746
|
i,
|
|
2852
|
-
|
|
2747
|
+
u
|
|
2853
2748
|
);
|
|
2854
2749
|
return {
|
|
2855
2750
|
id: d.id,
|
|
@@ -2873,11 +2768,11 @@ class ShareService {
|
|
|
2873
2768
|
id: g
|
|
2874
2769
|
})
|
|
2875
2770
|
), p = i.users.visibles.map(
|
|
2876
|
-
({ id: d, profile: g, username: A, firstName: m, lastName: b, login:
|
|
2771
|
+
({ id: d, profile: g, username: A, firstName: m, lastName: b, login: R }) => ({
|
|
2877
2772
|
displayName: A,
|
|
2878
2773
|
firstName: m,
|
|
2879
2774
|
lastName: b,
|
|
2880
|
-
login:
|
|
2775
|
+
login: R,
|
|
2881
2776
|
profile: g,
|
|
2882
2777
|
id: d
|
|
2883
2778
|
})
|
|
@@ -2899,25 +2794,25 @@ class ShareService {
|
|
|
2899
2794
|
const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
|
|
2900
2795
|
l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
|
|
2901
2796
|
}
|
|
2902
|
-
const
|
|
2903
|
-
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(
|
|
2797
|
+
const u = `/${e}/share/resource/${t}`;
|
|
2798
|
+
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(u, i);
|
|
2904
2799
|
}
|
|
2905
2800
|
async getActionsForApp(e) {
|
|
2906
2801
|
const t = await this.cache.httpGetJson(
|
|
2907
2802
|
"/infra/public/json/sharing-rights.json"
|
|
2908
2803
|
), s = await this.getShareMapping(e);
|
|
2909
2804
|
return Object.keys(t).map((i) => {
|
|
2910
|
-
const
|
|
2805
|
+
const u = t[i];
|
|
2911
2806
|
return {
|
|
2912
2807
|
displayName: i,
|
|
2913
2808
|
id: i,
|
|
2914
|
-
priority:
|
|
2915
|
-
requires:
|
|
2809
|
+
priority: u.priority,
|
|
2810
|
+
requires: u.requires
|
|
2916
2811
|
};
|
|
2917
2812
|
}).filter((i) => {
|
|
2918
|
-
var
|
|
2919
|
-
return ((
|
|
2920
|
-
}).sort((i,
|
|
2813
|
+
var u;
|
|
2814
|
+
return ((u = s[i.id]) == null ? void 0 : u.length) > 0;
|
|
2815
|
+
}).sort((i, u) => i.priority - u.priority);
|
|
2921
2816
|
}
|
|
2922
2817
|
}
|
|
2923
2818
|
const defaultMappers = {
|
|
@@ -2954,11 +2849,11 @@ const defaultMappers = {
|
|
|
2954
2849
|
zip: function({ type: o }) {
|
|
2955
2850
|
return o.indexOf("zip") !== -1 || o.indexOf("rar") !== -1 || o.indexOf("tar") !== -1 || o.indexOf("7z") !== -1;
|
|
2956
2851
|
}
|
|
2957
|
-
},
|
|
2852
|
+
}, w = class w {
|
|
2958
2853
|
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
2959
2854
|
static getRole(e) {
|
|
2960
2855
|
var t, s;
|
|
2961
|
-
return
|
|
2856
|
+
return w.role(
|
|
2962
2857
|
(t = e.metadata) == null ? void 0 : t["content-type"],
|
|
2963
2858
|
!1,
|
|
2964
2859
|
(s = e.metadata) == null ? void 0 : s.extension
|
|
@@ -2970,18 +2865,18 @@ const defaultMappers = {
|
|
|
2970
2865
|
this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
|
|
2971
2866
|
const r = { type: e, previewRole: t, extension: s };
|
|
2972
2867
|
for (const i of this.roleMappers) {
|
|
2973
|
-
const
|
|
2974
|
-
if (
|
|
2975
|
-
return
|
|
2868
|
+
const u = i(r);
|
|
2869
|
+
if (u)
|
|
2870
|
+
return u;
|
|
2976
2871
|
}
|
|
2977
2872
|
return "unknown";
|
|
2978
2873
|
}
|
|
2979
2874
|
};
|
|
2980
2875
|
// FIXME add edumedia support
|
|
2981
|
-
|
|
2876
|
+
n(w, "roleMappers", [
|
|
2982
2877
|
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
2983
2878
|
]);
|
|
2984
|
-
let DocumentHelper =
|
|
2879
|
+
let DocumentHelper = w;
|
|
2985
2880
|
class WorkspaceService {
|
|
2986
2881
|
constructor(e) {
|
|
2987
2882
|
this.context = e;
|
|
@@ -2990,22 +2885,22 @@ class WorkspaceService {
|
|
|
2990
2885
|
return this.context.http();
|
|
2991
2886
|
}
|
|
2992
2887
|
extractMetadata(e) {
|
|
2993
|
-
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "",
|
|
2888
|
+
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", u = {
|
|
2994
2889
|
"content-type": r,
|
|
2995
2890
|
filename: t,
|
|
2996
2891
|
size: e.size,
|
|
2997
2892
|
extension: i,
|
|
2998
2893
|
role: DocumentHelper.role(r, !1, i)
|
|
2999
|
-
}, a = t.replace("." +
|
|
3000
|
-
return { basename: a, fullname: c, metadata:
|
|
2894
|
+
}, a = t.replace("." + u.extension, ""), c = u.extension ? a + "." + u.extension : a;
|
|
2895
|
+
return { basename: a, fullname: c, metadata: u };
|
|
3001
2896
|
}
|
|
3002
2897
|
async saveFile(e, t) {
|
|
3003
2898
|
const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
|
|
3004
2899
|
i.append("file", e, s);
|
|
3005
|
-
const
|
|
3006
|
-
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") &&
|
|
2900
|
+
const u = [];
|
|
2901
|
+
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && u.push(`${t.visibility}=true`), t != null && t.application && u.push(`application=${t.application}`), r.role === "img" && u.push("quality=1"), t != null && t.parentId && u.push(`parentId=${t.parentId}`);
|
|
3007
2902
|
const a = await this.http.postFile(
|
|
3008
|
-
`/workspace/document?${
|
|
2903
|
+
`/workspace/document?${u.join("&")}`,
|
|
3009
2904
|
i
|
|
3010
2905
|
);
|
|
3011
2906
|
if (this.http.isResponseError())
|
|
@@ -3013,13 +2908,13 @@ class WorkspaceService {
|
|
|
3013
2908
|
return a;
|
|
3014
2909
|
}
|
|
3015
2910
|
async updateFile(e, t, s) {
|
|
3016
|
-
const { fullname: r, metadata: i } = this.extractMetadata(t),
|
|
3017
|
-
|
|
2911
|
+
const { fullname: r, metadata: i } = this.extractMetadata(t), u = new FormData();
|
|
2912
|
+
u.append("file", t, r);
|
|
3018
2913
|
const a = [];
|
|
3019
2914
|
i.role === "img" && a.push("quality=1"), s != null && s.alt && a.push(`alt=${s.alt}`), s != null && s.legend && a.push(`legend=${s.legend}`), s != null && s.name && a.push(`name=${s.name}`);
|
|
3020
2915
|
const c = await this.http.putFile(
|
|
3021
2916
|
`/workspace/document/${e}?${a.join("&")}`,
|
|
3022
|
-
|
|
2917
|
+
u
|
|
3023
2918
|
);
|
|
3024
2919
|
if (this.http.isResponseError())
|
|
3025
2920
|
throw this.http.latestResponse.statusText;
|
|
@@ -3064,17 +2959,17 @@ class WorkspaceService {
|
|
|
3064
2959
|
{
|
|
3065
2960
|
application: t,
|
|
3066
2961
|
visibility: s,
|
|
3067
|
-
ids: r.map((
|
|
2962
|
+
ids: r.map((u) => u._id)
|
|
3068
2963
|
}
|
|
3069
2964
|
);
|
|
3070
2965
|
if (this.http.isResponseError())
|
|
3071
2966
|
throw this.http.latestResponse.statusText;
|
|
3072
|
-
return r.forEach((
|
|
2967
|
+
return r.forEach((u, a) => {
|
|
3073
2968
|
const c = e.findIndex(
|
|
3074
|
-
(h) => h._id ===
|
|
2969
|
+
(h) => h._id === u._id
|
|
3075
2970
|
);
|
|
3076
2971
|
0 <= c && c < e.length && (e[c] = i[a]);
|
|
3077
|
-
}), e.filter((
|
|
2972
|
+
}), e.filter((u) => !!u);
|
|
3078
2973
|
}
|
|
3079
2974
|
return e;
|
|
3080
2975
|
}
|
|
@@ -3083,13 +2978,13 @@ class WorkspaceService {
|
|
|
3083
2978
|
* or `null` if none exists or can be created.
|
|
3084
2979
|
*/
|
|
3085
2980
|
getThumbnailUrl(e, t = 0, s = 0) {
|
|
3086
|
-
var i,
|
|
2981
|
+
var i, u;
|
|
3087
2982
|
const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
|
|
3088
2983
|
if (typeof e == "string")
|
|
3089
2984
|
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
|
|
3090
2985
|
{
|
|
3091
2986
|
const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
3092
|
-
if ((
|
|
2987
|
+
if ((u = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && u.includes("video")) {
|
|
3093
2988
|
const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
3094
2989
|
return h ? a + h : null;
|
|
3095
2990
|
} else
|
|
@@ -3185,8 +3080,8 @@ class AnalyticsService {
|
|
|
3185
3080
|
if (!r || !r.active) return;
|
|
3186
3081
|
const i = await configure.Platform.apps.getPublicConf(e);
|
|
3187
3082
|
if (!i) return;
|
|
3188
|
-
const
|
|
3189
|
-
if (!
|
|
3083
|
+
const u = i.xiti;
|
|
3084
|
+
if (!u || !u.LIBELLE_SERVICE || !r.UAI) return;
|
|
3190
3085
|
function a(h) {
|
|
3191
3086
|
let l = "";
|
|
3192
3087
|
for (let E = 0; E < h.length; E++)
|
|
@@ -3201,10 +3096,10 @@ class AnalyticsService {
|
|
|
3201
3096
|
Guest: "AUTRE"
|
|
3202
3097
|
};
|
|
3203
3098
|
return {
|
|
3204
|
-
LIBELLE_SERVICE:
|
|
3099
|
+
LIBELLE_SERVICE: u.LIBELLE_SERVICE,
|
|
3205
3100
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
3206
|
-
TYPE:
|
|
3207
|
-
OUTIL:
|
|
3101
|
+
TYPE: u.OUTIL ? "TIERS" : "NATIF",
|
|
3102
|
+
OUTIL: u.OUTIL ? u.OUTIL : "",
|
|
3208
3103
|
STRUCT_ID: r.collectiviteId,
|
|
3209
3104
|
STRUCT_UAI: r.UAI,
|
|
3210
3105
|
PROJET: r.projetId ? r.projetId : o.ID_PROJET,
|
|
@@ -3215,7 +3110,7 @@ class AnalyticsService {
|
|
|
3215
3110
|
};
|
|
3216
3111
|
}
|
|
3217
3112
|
}
|
|
3218
|
-
const
|
|
3113
|
+
const C = class C {
|
|
3219
3114
|
// in minutes. Applies to recorded videos.
|
|
3220
3115
|
constructor(e) {
|
|
3221
3116
|
this.context = e;
|
|
@@ -3233,11 +3128,11 @@ const w = class w {
|
|
|
3233
3128
|
async getVideoConf() {
|
|
3234
3129
|
var t;
|
|
3235
3130
|
const e = await this.conf.getPublicConf(
|
|
3236
|
-
APP$
|
|
3131
|
+
APP$1.VIDEO
|
|
3237
3132
|
);
|
|
3238
3133
|
return {
|
|
3239
|
-
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ??
|
|
3240
|
-
maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ??
|
|
3134
|
+
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? C.MAX_WEIGHT,
|
|
3135
|
+
maxDuration: (e == null ? void 0 : e["max-videoduration-minutes"]) ?? C.MAX_DURATION,
|
|
3241
3136
|
acceptVideoUploadExtensions: ((t = e == null ? void 0 : e["accept-videoupload-extensions"]) == null ? void 0 : t.map(
|
|
3242
3137
|
(s) => s.toUpperCase()
|
|
3243
3138
|
)) ?? []
|
|
@@ -3258,13 +3153,13 @@ const w = class w {
|
|
|
3258
3153
|
throw new Error("Invalid video file.");
|
|
3259
3154
|
if (!e.filename)
|
|
3260
3155
|
throw new Error("Invalid video filename");
|
|
3261
|
-
const i = `${e.browser.name} ${e.browser.version}`,
|
|
3262
|
-
|
|
3156
|
+
const i = `${e.browser.name} ${e.browser.version}`, u = new FormData();
|
|
3157
|
+
u.append("device", e.device || ""), u.append("browser", i), u.append("url", e.url), u.append("app", t), u.append("file", e.file, e.filename), u.append("weight", "" + e.file.size), u.append("captation", "" + s);
|
|
3263
3158
|
let a = `/video/encode?captation=${s}`;
|
|
3264
3159
|
r && (a += `&duration=${r}`);
|
|
3265
3160
|
const c = await this.http.post(
|
|
3266
3161
|
a,
|
|
3267
|
-
|
|
3162
|
+
u,
|
|
3268
3163
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
3269
3164
|
);
|
|
3270
3165
|
if (c.state == "running") {
|
|
@@ -3294,9 +3189,9 @@ const w = class w {
|
|
|
3294
3189
|
throw new Error("Video cannot be uploaded.");
|
|
3295
3190
|
}
|
|
3296
3191
|
};
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
let VideoService =
|
|
3192
|
+
n(C, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
|
|
3193
|
+
n(C, "MAX_DURATION", 3);
|
|
3194
|
+
let VideoService = C;
|
|
3300
3195
|
class EmbedderService {
|
|
3301
3196
|
constructor(e) {
|
|
3302
3197
|
this.context = e;
|
|
@@ -3332,9 +3227,9 @@ class EmbedderService {
|
|
|
3332
3227
|
urlIsFromPattern(e, t) {
|
|
3333
3228
|
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
3334
3229
|
let i = !0;
|
|
3335
|
-
const
|
|
3230
|
+
const u = t.match(s) || [], a = [];
|
|
3336
3231
|
return (t.match(r) || []).forEach((h, l) => {
|
|
3337
|
-
h.includes("ignore") || a.push(
|
|
3232
|
+
h.includes("ignore") || a.push(u[l]);
|
|
3338
3233
|
}), a.forEach((h) => {
|
|
3339
3234
|
if (!e.includes(h)) {
|
|
3340
3235
|
i = !1;
|
|
@@ -3365,7 +3260,7 @@ class EmbedderService {
|
|
|
3365
3260
|
for (const s of e.url)
|
|
3366
3261
|
if (this.urlIsFromPattern(t, s)) {
|
|
3367
3262
|
const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
|
|
3368
|
-
let
|
|
3263
|
+
let u = e.embed;
|
|
3369
3264
|
for (const a of i) {
|
|
3370
3265
|
let c = s.split(a)[0];
|
|
3371
3266
|
const h = c.split("}");
|
|
@@ -3376,9 +3271,9 @@ class EmbedderService {
|
|
|
3376
3271
|
const E = s.split(a)[1].split("{")[0];
|
|
3377
3272
|
E && (l = l.split(E)[0]);
|
|
3378
3273
|
const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
|
|
3379
|
-
|
|
3274
|
+
u = u.replace(p, l);
|
|
3380
3275
|
}
|
|
3381
|
-
return
|
|
3276
|
+
return u;
|
|
3382
3277
|
}
|
|
3383
3278
|
return "";
|
|
3384
3279
|
}
|
|
@@ -3391,7 +3286,7 @@ class AbstractBehaviourService {
|
|
|
3391
3286
|
//-----------------
|
|
3392
3287
|
//--- Utilities ---
|
|
3393
3288
|
//-----------------
|
|
3394
|
-
|
|
3289
|
+
n(this, "_cache");
|
|
3395
3290
|
this.context = e, this._cache = new CacheService(this.context);
|
|
3396
3291
|
}
|
|
3397
3292
|
getApplication() {
|
|
@@ -3425,8 +3320,8 @@ class AbstractBehaviourService {
|
|
|
3425
3320
|
class ActualitesBehaviour extends AbstractBehaviourService {
|
|
3426
3321
|
constructor() {
|
|
3427
3322
|
super(...arguments);
|
|
3428
|
-
|
|
3429
|
-
|
|
3323
|
+
n(this, "APP", "actualites");
|
|
3324
|
+
n(this, "RESOURCE", "actualites");
|
|
3430
3325
|
}
|
|
3431
3326
|
async loadResources() {
|
|
3432
3327
|
return (await this.httpGet(
|
|
@@ -3449,24 +3344,24 @@ class ActualitesBehaviour extends AbstractBehaviourService {
|
|
|
3449
3344
|
class BlogBehaviour extends AbstractBehaviourService {
|
|
3450
3345
|
constructor() {
|
|
3451
3346
|
super(...arguments);
|
|
3452
|
-
|
|
3453
|
-
|
|
3347
|
+
n(this, "APP", "blog");
|
|
3348
|
+
n(this, "RESOURCE", "blog");
|
|
3454
3349
|
}
|
|
3455
3350
|
loadResources() {
|
|
3456
3351
|
return new Promise(async (t, s) => {
|
|
3457
3352
|
try {
|
|
3458
3353
|
const r = await this.httpGet("/blog/linker"), i = [];
|
|
3459
|
-
r.forEach((
|
|
3460
|
-
|
|
3461
|
-
const a =
|
|
3462
|
-
owner:
|
|
3463
|
-
ownerName:
|
|
3464
|
-
title: c.title + " [" +
|
|
3465
|
-
_id: `${
|
|
3466
|
-
icon:
|
|
3467
|
-
path: `/blog/id/${
|
|
3468
|
-
shared: !!(
|
|
3469
|
-
modified:
|
|
3354
|
+
r.forEach((u) => {
|
|
3355
|
+
u.thumbnail ? u.thumbnail = u.thumbnail + "?thumbnail=48x48" : u.thumbnail = "/img/illustrations/blog.svg";
|
|
3356
|
+
const a = u.fetchPosts.map((c) => this.dataToResource({
|
|
3357
|
+
owner: u.author.userId,
|
|
3358
|
+
ownerName: u.author.username,
|
|
3359
|
+
title: c.title + " [" + u.title + "]",
|
|
3360
|
+
_id: `${u._id}#${c._id}`,
|
|
3361
|
+
icon: u.thumbnail,
|
|
3362
|
+
path: `/blog/id/${u._id}/post/${c._id}`,
|
|
3363
|
+
shared: !!(u.shared && u.shared.length >= 0),
|
|
3364
|
+
modified: u.modified
|
|
3470
3365
|
}));
|
|
3471
3366
|
i.push(...a);
|
|
3472
3367
|
}), t(i);
|
|
@@ -3479,8 +3374,8 @@ class BlogBehaviour extends AbstractBehaviourService {
|
|
|
3479
3374
|
class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
3480
3375
|
constructor() {
|
|
3481
3376
|
super(...arguments);
|
|
3482
|
-
|
|
3483
|
-
|
|
3377
|
+
n(this, "APP", "collaborativewall");
|
|
3378
|
+
n(this, "RESOURCE", "collaborativewall");
|
|
3484
3379
|
}
|
|
3485
3380
|
async loadResources() {
|
|
3486
3381
|
return (await this.httpGet(
|
|
@@ -3502,8 +3397,8 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
|
3502
3397
|
class CommunityBehaviour extends AbstractBehaviourService {
|
|
3503
3398
|
constructor() {
|
|
3504
3399
|
super(...arguments);
|
|
3505
|
-
|
|
3506
|
-
|
|
3400
|
+
n(this, "APP", "community");
|
|
3401
|
+
n(this, "RESOURCE", "community");
|
|
3507
3402
|
}
|
|
3508
3403
|
async loadResources() {
|
|
3509
3404
|
return (await this.httpGet(
|
|
@@ -3527,24 +3422,24 @@ class CommunityBehaviour extends AbstractBehaviourService {
|
|
|
3527
3422
|
class ExercizerBehaviour extends AbstractBehaviourService {
|
|
3528
3423
|
constructor() {
|
|
3529
3424
|
super(...arguments);
|
|
3530
|
-
|
|
3531
|
-
|
|
3425
|
+
n(this, "APP", "exercizer");
|
|
3426
|
+
n(this, "RESOURCE", "exercizer");
|
|
3532
3427
|
}
|
|
3533
3428
|
async loadResources() {
|
|
3534
3429
|
return (await this.httpGet(
|
|
3535
3430
|
"/exercizer/subjects-scheduled"
|
|
3536
3431
|
)).map((s) => {
|
|
3537
3432
|
const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
|
|
3538
|
-
let i,
|
|
3433
|
+
let i, u = !1;
|
|
3539
3434
|
const a = JSON.parse(s.scheduled_at);
|
|
3540
|
-
return a.groupList.length > 0 ? (
|
|
3435
|
+
return a.groupList.length > 0 ? (u = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (u = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
|
|
3541
3436
|
title: s.title,
|
|
3542
3437
|
owner: s.owner,
|
|
3543
3438
|
ownerName: i,
|
|
3544
3439
|
icon: r,
|
|
3545
3440
|
path: "/exercizer#/linker/" + s.id,
|
|
3546
3441
|
_id: "" + s.id,
|
|
3547
|
-
shared:
|
|
3442
|
+
shared: u,
|
|
3548
3443
|
modified: s.modified
|
|
3549
3444
|
});
|
|
3550
3445
|
});
|
|
@@ -3553,8 +3448,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
|
|
|
3553
3448
|
class FormulaireBehaviour extends AbstractBehaviourService {
|
|
3554
3449
|
constructor() {
|
|
3555
3450
|
super(...arguments);
|
|
3556
|
-
|
|
3557
|
-
|
|
3451
|
+
n(this, "APP", "formulaire");
|
|
3452
|
+
n(this, "RESOURCE", "formulaire");
|
|
3558
3453
|
}
|
|
3559
3454
|
async loadResources() {
|
|
3560
3455
|
return (await this.httpGet(
|
|
@@ -3574,8 +3469,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
|
|
|
3574
3469
|
class ForumBehaviour extends AbstractBehaviourService {
|
|
3575
3470
|
constructor() {
|
|
3576
3471
|
super(...arguments);
|
|
3577
|
-
|
|
3578
|
-
|
|
3472
|
+
n(this, "APP", "forum");
|
|
3473
|
+
n(this, "RESOURCE", "forum");
|
|
3579
3474
|
}
|
|
3580
3475
|
async loadResources() {
|
|
3581
3476
|
return (await this.httpGet("/forum/categories")).map(
|
|
@@ -3595,8 +3490,8 @@ class ForumBehaviour extends AbstractBehaviourService {
|
|
|
3595
3490
|
class HomeworksBehaviour extends AbstractBehaviourService {
|
|
3596
3491
|
constructor() {
|
|
3597
3492
|
super(...arguments);
|
|
3598
|
-
|
|
3599
|
-
|
|
3493
|
+
n(this, "APP", "homeworks");
|
|
3494
|
+
n(this, "RESOURCE", "homeworks");
|
|
3600
3495
|
}
|
|
3601
3496
|
async loadResources() {
|
|
3602
3497
|
return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
|
|
@@ -3614,8 +3509,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
|
|
|
3614
3509
|
class MagnetoBehaviour extends AbstractBehaviourService {
|
|
3615
3510
|
constructor() {
|
|
3616
3511
|
super(...arguments);
|
|
3617
|
-
|
|
3618
|
-
|
|
3512
|
+
n(this, "APP", "magneto");
|
|
3513
|
+
n(this, "RESOURCE", "magneto");
|
|
3619
3514
|
}
|
|
3620
3515
|
async loadResources() {
|
|
3621
3516
|
const { all: t } = await this.httpGet(
|
|
@@ -3636,8 +3531,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
|
|
|
3636
3531
|
class MindmapBehaviour extends AbstractBehaviourService {
|
|
3637
3532
|
constructor() {
|
|
3638
3533
|
super(...arguments);
|
|
3639
|
-
|
|
3640
|
-
|
|
3534
|
+
n(this, "APP", "mindmap");
|
|
3535
|
+
n(this, "RESOURCE", "mindmap");
|
|
3641
3536
|
}
|
|
3642
3537
|
async loadResources() {
|
|
3643
3538
|
return (await this.httpGet("/mindmap/list/all")).map(
|
|
@@ -3657,13 +3552,13 @@ class MindmapBehaviour extends AbstractBehaviourService {
|
|
|
3657
3552
|
class PagesBehaviour extends AbstractBehaviourService {
|
|
3658
3553
|
constructor() {
|
|
3659
3554
|
super(...arguments);
|
|
3660
|
-
|
|
3661
|
-
|
|
3555
|
+
n(this, "APP", "pages");
|
|
3556
|
+
n(this, "RESOURCE", "pages");
|
|
3662
3557
|
}
|
|
3663
3558
|
async loadResources() {
|
|
3664
3559
|
const t = await this.httpGet("/pages/list/all"), s = [];
|
|
3665
3560
|
return t.forEach((r) => {
|
|
3666
|
-
var
|
|
3561
|
+
var u;
|
|
3667
3562
|
const i = r.thumbnail ? r.thumbnail + "?thumbnail=48x48" : "/img/illustrations/pages.svg";
|
|
3668
3563
|
s.push(
|
|
3669
3564
|
this.dataToResource({
|
|
@@ -3676,7 +3571,7 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3676
3571
|
shared: typeof r.shared < "u",
|
|
3677
3572
|
modified: r.modified
|
|
3678
3573
|
})
|
|
3679
|
-
), (
|
|
3574
|
+
), (u = r.pages) == null || u.forEach((a) => {
|
|
3680
3575
|
s.push(
|
|
3681
3576
|
this.dataToResource({
|
|
3682
3577
|
title: a.title,
|
|
@@ -3696,8 +3591,8 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3696
3591
|
class PollBehaviour extends AbstractBehaviourService {
|
|
3697
3592
|
constructor() {
|
|
3698
3593
|
super(...arguments);
|
|
3699
|
-
|
|
3700
|
-
|
|
3594
|
+
n(this, "APP", "poll");
|
|
3595
|
+
n(this, "RESOURCE", "poll");
|
|
3701
3596
|
}
|
|
3702
3597
|
async loadResources() {
|
|
3703
3598
|
return (await this.httpGet("/poll/list/all")).map((s) => {
|
|
@@ -3718,8 +3613,8 @@ class PollBehaviour extends AbstractBehaviourService {
|
|
|
3718
3613
|
class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
3719
3614
|
constructor() {
|
|
3720
3615
|
super(...arguments);
|
|
3721
|
-
|
|
3722
|
-
|
|
3616
|
+
n(this, "APP", "scrapbook");
|
|
3617
|
+
n(this, "RESOURCE", "scrapbook");
|
|
3723
3618
|
}
|
|
3724
3619
|
async loadResources() {
|
|
3725
3620
|
return (await this.httpGet(
|
|
@@ -3742,25 +3637,25 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
|
3742
3637
|
class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
3743
3638
|
constructor() {
|
|
3744
3639
|
super(...arguments);
|
|
3745
|
-
|
|
3746
|
-
|
|
3640
|
+
n(this, "APP", "timelinegenerator");
|
|
3641
|
+
n(this, "RESOURCE", "timelinegenerator");
|
|
3747
3642
|
}
|
|
3748
3643
|
loadResources() {
|
|
3749
3644
|
return new Promise(async (t, s) => {
|
|
3750
3645
|
try {
|
|
3751
3646
|
const i = (await this.httpGet(
|
|
3752
3647
|
"/timelinegenerator/timelines"
|
|
3753
|
-
)).map((
|
|
3754
|
-
const a =
|
|
3648
|
+
)).map((u) => {
|
|
3649
|
+
const a = u.icon || "/img/illustrations/timeline-default.png";
|
|
3755
3650
|
return this.dataToResource({
|
|
3756
|
-
title:
|
|
3757
|
-
ownerName:
|
|
3758
|
-
owner:
|
|
3651
|
+
title: u.headline,
|
|
3652
|
+
ownerName: u.owner.displayName,
|
|
3653
|
+
owner: u.owner.userId,
|
|
3759
3654
|
icon: a,
|
|
3760
|
-
path: "/timelinegenerator#/view/" +
|
|
3761
|
-
_id:
|
|
3762
|
-
shared: typeof
|
|
3763
|
-
modified:
|
|
3655
|
+
path: "/timelinegenerator#/view/" + u._id,
|
|
3656
|
+
_id: u._id,
|
|
3657
|
+
shared: typeof u.shared < "u",
|
|
3658
|
+
modified: u.modified
|
|
3764
3659
|
});
|
|
3765
3660
|
});
|
|
3766
3661
|
t(i);
|
|
@@ -3773,8 +3668,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
|
3773
3668
|
class WikiBehaviour extends AbstractBehaviourService {
|
|
3774
3669
|
constructor() {
|
|
3775
3670
|
super(...arguments);
|
|
3776
|
-
|
|
3777
|
-
|
|
3671
|
+
n(this, "APP", "wiki");
|
|
3672
|
+
n(this, "RESOURCE", "wiki");
|
|
3778
3673
|
}
|
|
3779
3674
|
async loadResources() {
|
|
3780
3675
|
return (await this.httpGet(
|
|
@@ -3797,15 +3692,15 @@ class WikiBehaviour extends AbstractBehaviourService {
|
|
|
3797
3692
|
class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
3798
3693
|
constructor() {
|
|
3799
3694
|
super(...arguments);
|
|
3800
|
-
|
|
3801
|
-
|
|
3695
|
+
n(this, "APP", "workspace");
|
|
3696
|
+
n(this, "RESOURCE", "workspace");
|
|
3802
3697
|
}
|
|
3803
3698
|
loadResources({ search: t, asset_id: s }) {
|
|
3804
3699
|
return new Promise(async (r, i) => {
|
|
3805
3700
|
try {
|
|
3806
|
-
let
|
|
3807
|
-
s && s.length ?
|
|
3808
|
-
const c = (await this.httpGet(
|
|
3701
|
+
let u = "/workspace/documents?filter=all&hierarchical=true";
|
|
3702
|
+
s && s.length ? u += `&search=${t}` : t && t.length && (u += `&search=${t}`);
|
|
3703
|
+
const c = (await this.httpGet(u)).filter((h) => !h.deleted).map((h) => {
|
|
3809
3704
|
const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
3810
3705
|
return this.dataToResource({
|
|
3811
3706
|
title: h.name,
|
|
@@ -3819,8 +3714,8 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
3819
3714
|
});
|
|
3820
3715
|
});
|
|
3821
3716
|
r(c);
|
|
3822
|
-
} catch (
|
|
3823
|
-
i(
|
|
3717
|
+
} catch (u) {
|
|
3718
|
+
i(u);
|
|
3824
3719
|
}
|
|
3825
3720
|
});
|
|
3826
3721
|
}
|
|
@@ -3836,7 +3731,7 @@ const y = class y {
|
|
|
3836
3731
|
e.session().getUser()
|
|
3837
3732
|
]);
|
|
3838
3733
|
i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
|
|
3839
|
-
(
|
|
3734
|
+
(u) => i.apps.some((a) => a.address.includes(u))
|
|
3840
3735
|
));
|
|
3841
3736
|
} catch (r) {
|
|
3842
3737
|
console.warn("Failed to load resource-producing apps:", r);
|
|
@@ -3913,13 +3808,13 @@ const y = class y {
|
|
|
3913
3808
|
//
|
|
3914
3809
|
// STATIC REGISTRY
|
|
3915
3810
|
//
|
|
3916
|
-
|
|
3917
|
-
|
|
3811
|
+
n(y, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
3812
|
+
n(y, "findBehaviour", y.registry.findService.bind(y.registry)), n(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), n(y, "resourceProducingApps", []);
|
|
3918
3813
|
let SnipletsService = y;
|
|
3919
3814
|
const SEND_ALL = "*";
|
|
3920
3815
|
class WebBroker {
|
|
3921
3816
|
constructor(e) {
|
|
3922
|
-
|
|
3817
|
+
n(this, "subscription");
|
|
3923
3818
|
this.odeServices = e;
|
|
3924
3819
|
}
|
|
3925
3820
|
get http() {
|
|
@@ -3951,10 +3846,10 @@ class WebBroker {
|
|
|
3951
3846
|
}
|
|
3952
3847
|
class DataService {
|
|
3953
3848
|
constructor(e) {
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3849
|
+
n(this, "_webBroker");
|
|
3850
|
+
n(this, "app");
|
|
3851
|
+
n(this, "user");
|
|
3852
|
+
n(this, "profile");
|
|
3958
3853
|
this.odeServices = e;
|
|
3959
3854
|
}
|
|
3960
3855
|
get conf() {
|
|
@@ -3988,12 +3883,12 @@ class DataService {
|
|
|
3988
3883
|
addUserInfos(e) {
|
|
3989
3884
|
return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
|
|
3990
3885
|
}
|
|
3991
|
-
trackVideoSave(e, t, s, r, i,
|
|
3886
|
+
trackVideoSave(e, t, s, r, i, u, a) {
|
|
3992
3887
|
const c = this.addUserInfos({
|
|
3993
3888
|
"event-type": "VIDEO_SAVE",
|
|
3994
3889
|
module: "video",
|
|
3995
3890
|
video_id: e,
|
|
3996
|
-
browser:
|
|
3891
|
+
browser: u,
|
|
3997
3892
|
duration: Math.round(t),
|
|
3998
3893
|
weight: s,
|
|
3999
3894
|
source: r ? "CAPTURED" : "UPLOADED",
|
|
@@ -4002,7 +3897,7 @@ class DataService {
|
|
|
4002
3897
|
this.app && (c["override-module"] = this.app), a && (c.device_type = a), this.trackWebEvent(c);
|
|
4003
3898
|
}
|
|
4004
3899
|
trackVideoRead(e, t, s, r, i) {
|
|
4005
|
-
const
|
|
3900
|
+
const u = this.addUserInfos({
|
|
4006
3901
|
"event-type": "VIDEO_READ",
|
|
4007
3902
|
module: "video",
|
|
4008
3903
|
video_id: e,
|
|
@@ -4010,7 +3905,7 @@ class DataService {
|
|
|
4010
3905
|
source: t ? "CAPTURED" : "UPLOADED",
|
|
4011
3906
|
url: s
|
|
4012
3907
|
});
|
|
4013
|
-
this.app && (
|
|
3908
|
+
this.app && (u["override-module"] = this.app), i && (u.device_type = i), this.trackWebEvent(u);
|
|
4014
3909
|
}
|
|
4015
3910
|
trackSpeechAndText(e) {
|
|
4016
3911
|
const t = this.addUserInfos({
|
|
@@ -4116,20 +4011,20 @@ class AudienceService {
|
|
|
4116
4011
|
}
|
|
4117
4012
|
class OdeServices {
|
|
4118
4013
|
constructor() {
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4014
|
+
n(this, "_analytics");
|
|
4015
|
+
n(this, "_cache");
|
|
4016
|
+
n(this, "_conf");
|
|
4017
|
+
n(this, "_data");
|
|
4018
|
+
n(this, "_directory");
|
|
4019
|
+
n(this, "_http");
|
|
4020
|
+
n(this, "_idiom");
|
|
4021
|
+
n(this, "_notify");
|
|
4022
|
+
n(this, "_rights");
|
|
4023
|
+
n(this, "_session");
|
|
4024
|
+
n(this, "_share");
|
|
4025
|
+
n(this, "_video");
|
|
4026
|
+
n(this, "_workspace");
|
|
4027
|
+
n(this, "_embedder");
|
|
4133
4028
|
this._analytics = new AnalyticsService(this), this._cache = new CacheService(this), this._conf = new ConfService(this), this._data = new DataService(this), this._directory = new DirectoryService(this), this._http = new HttpService(this), this._idiom = new IdiomService(this), this._notify = NotifyFrameworkFactory.instance(), this._rights = new RightService(this), this._session = new SessionService(this), this._share = new ShareService(this), this._video = new VideoService(this), this._workspace = new WorkspaceService(this), this._embedder = new EmbedderService(this);
|
|
4134
4029
|
}
|
|
4135
4030
|
initialize() {
|
|
@@ -4331,10 +4226,10 @@ const isActionAvailable = (o, e) => {
|
|
|
4331
4226
|
class WidgetFramework {
|
|
4332
4227
|
constructor() {
|
|
4333
4228
|
//-------------------------------------
|
|
4334
|
-
|
|
4335
|
-
|
|
4229
|
+
n(this, "_initialized");
|
|
4230
|
+
n(this, "_widgets", []);
|
|
4336
4231
|
////////////////////////////////////// USER PREFERENCES
|
|
4337
|
-
|
|
4232
|
+
n(this, "_userPrefs", {});
|
|
4338
4233
|
}
|
|
4339
4234
|
initialize(e, t) {
|
|
4340
4235
|
return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
|
|
@@ -4345,8 +4240,8 @@ class WidgetFramework {
|
|
|
4345
4240
|
var i;
|
|
4346
4241
|
(i = this._initialized) == null || i.resolve();
|
|
4347
4242
|
}).catch((i) => {
|
|
4348
|
-
var
|
|
4349
|
-
(
|
|
4243
|
+
var u;
|
|
4244
|
+
(u = this._initialized) == null || u.reject();
|
|
4350
4245
|
})) : (r = this._initialized) == null || r.reject();
|
|
4351
4246
|
})), this._initialized.promise;
|
|
4352
4247
|
}
|
|
@@ -4387,9 +4282,9 @@ class WidgetFramework {
|
|
|
4387
4282
|
position: c.platformConf.position
|
|
4388
4283
|
}), c.platformConf.mandatory && (this._userPrefs[l].show = !0, this._userPrefs[l].index = defaultWidgetOrder[l] ?? 999), c.platformConf.i18n && s.push(c.platformConf.i18n), c.applyUserPref(this._userPrefs[l]), !0);
|
|
4389
4284
|
});
|
|
4390
|
-
const
|
|
4285
|
+
const u = new Idiom();
|
|
4391
4286
|
this._widgets = this._widgets.sort((c, h) => {
|
|
4392
|
-
const l =
|
|
4287
|
+
const l = u.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = u.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
|
|
4393
4288
|
return l < E ? -1 : l > E ? 1 : 0;
|
|
4394
4289
|
});
|
|
4395
4290
|
});
|
|
@@ -4398,8 +4293,8 @@ class WidgetFramework {
|
|
|
4398
4293
|
class Widget {
|
|
4399
4294
|
//-------------------------------------
|
|
4400
4295
|
constructor(e) {
|
|
4401
|
-
|
|
4402
|
-
|
|
4296
|
+
n(this, "_schoolConf", {});
|
|
4297
|
+
n(this, "_userPref");
|
|
4403
4298
|
this._platformConf = e, this._userPref = null;
|
|
4404
4299
|
}
|
|
4405
4300
|
get platformConf() {
|
|
@@ -4458,7 +4353,7 @@ class WidgetFrameworkFactory {
|
|
|
4458
4353
|
}
|
|
4459
4354
|
export {
|
|
4460
4355
|
ACTION,
|
|
4461
|
-
APP$
|
|
4356
|
+
APP$1 as APP,
|
|
4462
4357
|
BOOLEAN_FILTER,
|
|
4463
4358
|
ConfigurationFrameworkFactory,
|
|
4464
4359
|
DocumentHelper,
|