@edifice.io/client 2.0.0-develop-pedago.20250123120301 → 2.0.0-develop-enabling.20250612155511
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/apps/timeline/interfaces.d.ts +1 -1
- package/dist/cache/Service.d.ts +1 -1
- package/dist/configure/Theme.d.ts +1 -1
- package/dist/configure/interfaces.d.ts +1 -2
- package/dist/globals.d.ts +1 -0
- package/dist/idiom/Service.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +732 -684
- package/dist/resources/interface.d.ts +2 -0
- package/dist/resources/services/CollaborativeEditorResourceService.d.ts +14 -0
- package/dist/session/Session.d.ts +5 -5
- package/dist/session/interfaces.d.ts +5 -5
- package/package.json +14 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var T = (
|
|
3
|
-
var
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var T = (u, e, t) => e in u ? D(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
|
+
var n = (u, e, t) => T(u, 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$4 = {
|
|
18
18
|
ADMIN: "admin",
|
|
19
19
|
ARCHIVE: "archive",
|
|
20
20
|
AUTH: "auth",
|
|
@@ -36,7 +36,8 @@ const ERROR_CODE = {
|
|
|
36
36
|
SCRAPBOOK: "scrapbook",
|
|
37
37
|
COLLABORATIVEWALL: "collaborativewall",
|
|
38
38
|
WIKI: "wiki",
|
|
39
|
-
TIMELINEGENERATOR: "timelinegenerator"
|
|
39
|
+
TIMELINEGENERATOR: "timelinegenerator",
|
|
40
|
+
COLLABORATIVEEDITOR: "collaborativeeditor"
|
|
40
41
|
// TODO compléter/trier les apps suivantes
|
|
41
42
|
/*
|
|
42
43
|
"competences"
|
|
@@ -99,7 +100,7 @@ const ERROR_CODE = {
|
|
|
99
100
|
};
|
|
100
101
|
class Subscription {
|
|
101
102
|
constructor(e, t) {
|
|
102
|
-
|
|
103
|
+
n(this, "revoke");
|
|
103
104
|
this._channel = e, this.revoke = this.setReceiver(
|
|
104
105
|
(s) => t == null ? void 0 : t(s.data)
|
|
105
106
|
);
|
|
@@ -117,7 +118,7 @@ class Subject {
|
|
|
117
118
|
* => We maintain here channels for *sending* messages.
|
|
118
119
|
* *Receiving* channels will be instantiated while subscribing.
|
|
119
120
|
*/
|
|
120
|
-
|
|
121
|
+
n(this, "publishChannels", /* @__PURE__ */ new Map());
|
|
121
122
|
}
|
|
122
123
|
getChannelName(e) {
|
|
123
124
|
return "Subject:" + e;
|
|
@@ -152,9 +153,9 @@ const ASYNC_DATA_NAME = {
|
|
|
152
153
|
class Promisified {
|
|
153
154
|
constructor() {
|
|
154
155
|
//-------------------------------------
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
n(this, "_resolution");
|
|
157
|
+
n(this, "_rejection");
|
|
158
|
+
n(this, "_promise", new Promise((e, t) => {
|
|
158
159
|
this._resolution = e, this._rejection = t;
|
|
159
160
|
}));
|
|
160
161
|
}
|
|
@@ -171,8 +172,8 @@ class Promisified {
|
|
|
171
172
|
class NotifyFramework {
|
|
172
173
|
constructor() {
|
|
173
174
|
//-------------------------------------
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
n(this, "promises", {});
|
|
176
|
+
n(this, "subject", new Subject());
|
|
176
177
|
}
|
|
177
178
|
asyncData(e) {
|
|
178
179
|
return typeof this.promises[e] > "u" && (this.promises[e] = new Promisified()), this.promises[e];
|
|
@@ -203,8 +204,8 @@ const notify = new NotifyFramework(), loadedScripts$1 = {};
|
|
|
203
204
|
class Http {
|
|
204
205
|
constructor(e) {
|
|
205
206
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
n(this, "axios");
|
|
208
|
+
n(this, "_latestResponse");
|
|
208
209
|
this.axios = axios.create(e);
|
|
209
210
|
}
|
|
210
211
|
setCdn(e) {
|
|
@@ -282,15 +283,15 @@ class Http {
|
|
|
282
283
|
}
|
|
283
284
|
getScript(e, t, s) {
|
|
284
285
|
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((
|
|
286
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
|
|
286
287
|
try {
|
|
287
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
288
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
|
|
288
289
|
return Function(a)();
|
|
289
290
|
} catch {
|
|
290
|
-
return
|
|
291
|
+
return o;
|
|
291
292
|
}
|
|
292
|
-
}).catch((
|
|
293
|
-
throw this.mapAxiosError(
|
|
293
|
+
}).catch((o) => {
|
|
294
|
+
throw this.mapAxiosError(o, t), o;
|
|
294
295
|
});
|
|
295
296
|
}
|
|
296
297
|
loadScript(e, t) {
|
|
@@ -301,7 +302,7 @@ class Http {
|
|
|
301
302
|
}
|
|
302
303
|
class TransportFramework {
|
|
303
304
|
constructor() {
|
|
304
|
-
|
|
305
|
+
n(this, "_http", new Http());
|
|
305
306
|
}
|
|
306
307
|
get http() {
|
|
307
308
|
return this._http;
|
|
@@ -320,11 +321,11 @@ class ConfigurationFrameworkFactory {
|
|
|
320
321
|
const http$2 = transport.http;
|
|
321
322
|
class Session {
|
|
322
323
|
constructor() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
n(this, "_me", null);
|
|
325
|
+
n(this, "_currentLanguage", "");
|
|
326
|
+
n(this, "_notLoggedIn", !0);
|
|
327
|
+
n(this, "_description");
|
|
328
|
+
n(this, "_profile");
|
|
328
329
|
}
|
|
329
330
|
get currentLanguage() {
|
|
330
331
|
return this._currentLanguage;
|
|
@@ -369,8 +370,8 @@ class Session {
|
|
|
369
370
|
hasRight(e, t) {
|
|
370
371
|
if (t === "owner")
|
|
371
372
|
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 &&
|
|
373
|
+
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, o = t.workflow ? this.hasWorkflow(t.workflow) : !0;
|
|
374
|
+
return i && o;
|
|
374
375
|
}
|
|
375
376
|
////////////////////////////////////////////////////////// Storage management
|
|
376
377
|
get latestQuotaAndUsage() {
|
|
@@ -442,7 +443,7 @@ class Session {
|
|
|
442
443
|
}
|
|
443
444
|
class SessionFramework {
|
|
444
445
|
constructor() {
|
|
445
|
-
|
|
446
|
+
n(this, "session", new Session());
|
|
446
447
|
}
|
|
447
448
|
initialize() {
|
|
448
449
|
return this.session.initialize();
|
|
@@ -466,22 +467,22 @@ class SessionFramework {
|
|
|
466
467
|
const session = new SessionFramework();
|
|
467
468
|
class Theme {
|
|
468
469
|
constructor() {
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
n(this, "_conf");
|
|
471
|
+
n(this, "_loaded");
|
|
471
472
|
// legacy (readonly)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
473
|
+
n(this, "skinName", "");
|
|
474
|
+
n(this, "themeName", "");
|
|
475
|
+
n(this, "skin", "raw");
|
|
476
|
+
n(this, "themeUrl", "/assets/themes/raw/default/");
|
|
477
|
+
n(this, "templateOverrides", {});
|
|
478
|
+
n(this, "portalTemplate", "/assets/themes/raw/portal.html");
|
|
479
|
+
n(this, "basePath", "");
|
|
480
|
+
n(this, "logoutCallback", "/");
|
|
481
|
+
n(this, "skins", []);
|
|
482
|
+
n(this, "is1D", !1);
|
|
483
|
+
n(this, "is2D", !1);
|
|
484
|
+
n(this, "_onSkinReady", notify.onSkinReady());
|
|
485
|
+
n(this, "_onOverrideReady", notify.onOverridesReady());
|
|
485
486
|
}
|
|
486
487
|
initialize(e) {
|
|
487
488
|
return notify.onSessionReady().promise.then(() => this.load(e));
|
|
@@ -791,7 +792,7 @@ class Idiom {
|
|
|
791
792
|
e = e ?? "";
|
|
792
793
|
let s = bundle$1[e] === void 0 ? e : bundle$1[e];
|
|
793
794
|
if (t && typeof t == "object")
|
|
794
|
-
for (
|
|
795
|
+
for (const r in t)
|
|
795
796
|
typeof t[r] < "u" && (s = s.replace(
|
|
796
797
|
new RegExp("\\${" + r + "}", "g"),
|
|
797
798
|
"" + t[r]
|
|
@@ -814,8 +815,8 @@ class Idiom {
|
|
|
814
815
|
else {
|
|
815
816
|
const i = new Promisified();
|
|
816
817
|
promises$1[t] = i.promise;
|
|
817
|
-
const
|
|
818
|
-
e && (
|
|
818
|
+
const o = {};
|
|
819
|
+
e && (o["Accept-Language"] = e), transport.http.get(t, { headers: o }).then((a) => {
|
|
819
820
|
Object.assign(bundle$1, a), typeof s == "function" && s(), i.resolve();
|
|
820
821
|
}).catch((a) => {
|
|
821
822
|
typeof s == "function" && s(), i.reject();
|
|
@@ -838,11 +839,11 @@ class Idiom {
|
|
|
838
839
|
}) : Promise.reject();
|
|
839
840
|
}
|
|
840
841
|
addKeys(e) {
|
|
841
|
-
for (
|
|
842
|
+
for (const t in e)
|
|
842
843
|
typeof bundle$1[t] != "string" && (bundle$1[t] = e[t]);
|
|
843
844
|
}
|
|
844
845
|
removeAccents(e) {
|
|
845
|
-
for (
|
|
846
|
+
for (let t = 0; t < defaultDiacriticsRemovalMap$1.length; t++)
|
|
846
847
|
e = e.replace(
|
|
847
848
|
defaultDiacriticsRemovalMap$1[t].letters,
|
|
848
849
|
defaultDiacriticsRemovalMap$1[t].base
|
|
@@ -853,7 +854,7 @@ class Idiom {
|
|
|
853
854
|
class UserPreferences {
|
|
854
855
|
constructor() {
|
|
855
856
|
//-------------------------------------
|
|
856
|
-
|
|
857
|
+
n(this, "data", {});
|
|
857
858
|
}
|
|
858
859
|
get(e) {
|
|
859
860
|
return this.data[e];
|
|
@@ -880,10 +881,10 @@ class UserPreferences {
|
|
|
880
881
|
class User {
|
|
881
882
|
constructor() {
|
|
882
883
|
//-------------------------------------
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
884
|
+
n(this, "_me", null);
|
|
885
|
+
n(this, "_keepOpenOnLogout", !1);
|
|
886
|
+
n(this, "_preferences", new UserPreferences());
|
|
887
|
+
n(this, "_bookmarkedApps", []);
|
|
887
888
|
}
|
|
888
889
|
get keepOpenOnLogout() {
|
|
889
890
|
return this._keepOpenOnLogout;
|
|
@@ -915,7 +916,7 @@ class User {
|
|
|
915
916
|
let s;
|
|
916
917
|
if (t && t.length && typeof t.concat == "function") {
|
|
917
918
|
this._bookmarkedApps = t, s = {
|
|
918
|
-
bookmarks: t.map((
|
|
919
|
+
bookmarks: t.map((o) => o.name),
|
|
919
920
|
applications: []
|
|
920
921
|
}, transport.http.putJson("/userbook/preference/apps", s);
|
|
921
922
|
return;
|
|
@@ -927,15 +928,15 @@ class User {
|
|
|
927
928
|
});
|
|
928
929
|
let r = !0;
|
|
929
930
|
const i = [];
|
|
930
|
-
s.bookmarks.forEach((
|
|
931
|
-
const c = this._me.apps.find((h) => h.name ===
|
|
931
|
+
s.bookmarks.forEach((o, a) => {
|
|
932
|
+
const c = this._me.apps.find((h) => h.name === o);
|
|
932
933
|
if (c) {
|
|
933
|
-
|
|
934
|
+
const h = Object.assign({}, c);
|
|
934
935
|
this._bookmarkedApps.push(h);
|
|
935
936
|
} else
|
|
936
|
-
i.push(
|
|
937
|
-
}), i.forEach((
|
|
938
|
-
|
|
937
|
+
i.push(o), r = !1;
|
|
938
|
+
}), i.forEach((o) => {
|
|
939
|
+
const a = s.bookmarks.indexOf(o);
|
|
939
940
|
a !== -1 && s.bookmarks.splice(a, 1);
|
|
940
941
|
}), r || transport.http.putJson("/userbook/preference/apps", s);
|
|
941
942
|
});
|
|
@@ -957,9 +958,9 @@ const http$1 = transport == null ? void 0 : transport.http;
|
|
|
957
958
|
class AppConf {
|
|
958
959
|
constructor() {
|
|
959
960
|
//-------------------------------------
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
n(this, "_publicConf", {});
|
|
962
|
+
n(this, "_currentApp");
|
|
963
|
+
n(this, "_appConf", {});
|
|
963
964
|
}
|
|
964
965
|
/**
|
|
965
966
|
* Get the currently initialized App.
|
|
@@ -997,8 +998,8 @@ class AppConf {
|
|
|
997
998
|
class Analytics {
|
|
998
999
|
constructor() {
|
|
999
1000
|
//-------------------------------------
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
n(this, "_status", "void");
|
|
1002
|
+
n(this, "_params");
|
|
1002
1003
|
}
|
|
1003
1004
|
get status() {
|
|
1004
1005
|
return this._status;
|
|
@@ -1038,7 +1039,7 @@ class Analytics {
|
|
|
1038
1039
|
if (!e.structureMap || !configure.Platform.apps.currentApp) return;
|
|
1039
1040
|
const t = await notify.onSessionReady().promise, s = session.session.description;
|
|
1040
1041
|
let r;
|
|
1041
|
-
for (
|
|
1042
|
+
for (const h of t.structures) {
|
|
1042
1043
|
const l = e.structureMap[h];
|
|
1043
1044
|
if (l && l.collectiviteId && l.UAI) {
|
|
1044
1045
|
r = l;
|
|
@@ -1050,8 +1051,8 @@ class Analytics {
|
|
|
1050
1051
|
configure.Platform.apps.currentApp
|
|
1051
1052
|
);
|
|
1052
1053
|
if (!i) return;
|
|
1053
|
-
const
|
|
1054
|
-
if (!
|
|
1054
|
+
const o = i.xiti;
|
|
1055
|
+
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
1055
1056
|
function a(h) {
|
|
1056
1057
|
let l = "";
|
|
1057
1058
|
for (let E = 0; E < h.length; E++)
|
|
@@ -1066,10 +1067,10 @@ class Analytics {
|
|
|
1066
1067
|
Guest: "AUTRE"
|
|
1067
1068
|
};
|
|
1068
1069
|
return {
|
|
1069
|
-
LIBELLE_SERVICE:
|
|
1070
|
+
LIBELLE_SERVICE: o.LIBELLE_SERVICE,
|
|
1070
1071
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
1071
|
-
TYPE:
|
|
1072
|
-
OUTIL:
|
|
1072
|
+
TYPE: o.OUTIL ? "TIERS" : "NATIF",
|
|
1073
|
+
OUTIL: o.OUTIL ? o.OUTIL : "",
|
|
1073
1074
|
STRUCT_ID: r.collectiviteId,
|
|
1074
1075
|
STRUCT_UAI: r.UAI,
|
|
1075
1076
|
PROJET: r.projetId ? r.projetId : e.ID_PROJET,
|
|
@@ -1083,7 +1084,7 @@ class Analytics {
|
|
|
1083
1084
|
class ConfigurationFramework {
|
|
1084
1085
|
constructor() {
|
|
1085
1086
|
//-------------------------------------
|
|
1086
|
-
|
|
1087
|
+
n(this, "Platform", {
|
|
1087
1088
|
deploymentTag: "",
|
|
1088
1089
|
cdnDomain: "",
|
|
1089
1090
|
apps: new AppConf(),
|
|
@@ -1092,15 +1093,15 @@ class ConfigurationFramework {
|
|
|
1092
1093
|
idiom: new Idiom(),
|
|
1093
1094
|
listLanguages: () => transport.http.get("/languages")
|
|
1094
1095
|
});
|
|
1095
|
-
|
|
1096
|
+
n(this, "School", {
|
|
1096
1097
|
//apps; -> pinnedApps;
|
|
1097
1098
|
});
|
|
1098
|
-
|
|
1099
|
+
n(this, "User", new User());
|
|
1099
1100
|
}
|
|
1100
1101
|
async initialize(e, t) {
|
|
1101
1102
|
if (!e) {
|
|
1102
|
-
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(),
|
|
1103
|
-
e = `${
|
|
1103
|
+
const r = (h) => (h < 10 ? "0" : "") + h.toFixed(0), i = /* @__PURE__ */ new Date(), o = i.getFullYear(), a = i.getMonth() + 1, c = i.getDate();
|
|
1104
|
+
e = `${o}${r(a)}${r(c)}`;
|
|
1104
1105
|
}
|
|
1105
1106
|
const s = e;
|
|
1106
1107
|
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 +1143,8 @@ var _;
|
|
|
1142
1143
|
const me = (_ = session == null ? void 0 : session.session) == null ? void 0 : _.user;
|
|
1143
1144
|
class Notification {
|
|
1144
1145
|
constructor(e) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1146
|
+
n(this, "_id");
|
|
1147
|
+
n(this, "model");
|
|
1147
1148
|
e.reported = e.reporters && e.reporters.length > 0, this._id = e._id, this.model = e;
|
|
1148
1149
|
}
|
|
1149
1150
|
isUnread() {
|
|
@@ -1163,14 +1164,14 @@ class Notification {
|
|
|
1163
1164
|
class TimelineApp {
|
|
1164
1165
|
constructor() {
|
|
1165
1166
|
//-------------------------------------
|
|
1166
|
-
|
|
1167
|
-
|
|
1167
|
+
n(this, "_notifications", []);
|
|
1168
|
+
n(this, "_notificationTypes", []);
|
|
1168
1169
|
// ex: ["BLOG"]
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1170
|
+
n(this, "_flashMessages", []);
|
|
1171
|
+
n(this, "_pageNumber", 0);
|
|
1172
|
+
n(this, "_lastPage", !1);
|
|
1173
|
+
n(this, "_loading", !1);
|
|
1174
|
+
n(this, "showMine", !1);
|
|
1174
1175
|
}
|
|
1175
1176
|
get notifications() {
|
|
1176
1177
|
return this._notifications;
|
|
@@ -1191,20 +1192,20 @@ class TimelineApp {
|
|
|
1191
1192
|
return this.preferences.type = this.preferences.type || [], this.preferences.type;
|
|
1192
1193
|
}
|
|
1193
1194
|
get preferences() {
|
|
1194
|
-
return configure.User.preferences.get(APP$
|
|
1195
|
+
return configure.User.preferences.get(APP$4.TIMELINE);
|
|
1195
1196
|
}
|
|
1196
1197
|
get flashMessages() {
|
|
1197
1198
|
return this._flashMessages;
|
|
1198
1199
|
}
|
|
1199
1200
|
savePreferences() {
|
|
1200
|
-
return configure.User.saveAppPrefs(APP$
|
|
1201
|
+
return configure.User.saveAppPrefs(APP$4.TIMELINE);
|
|
1201
1202
|
}
|
|
1202
1203
|
resetPagination() {
|
|
1203
1204
|
this._pageNumber = 0, this._lastPage = !1, this._loading = !1;
|
|
1204
1205
|
}
|
|
1205
1206
|
initialize() {
|
|
1206
1207
|
return Promise.all([
|
|
1207
|
-
configure.User.loadAppPrefs(APP$
|
|
1208
|
+
configure.User.loadAppPrefs(APP$4.TIMELINE),
|
|
1208
1209
|
transport.http.get("/timeline/types")
|
|
1209
1210
|
]).then((e) => {
|
|
1210
1211
|
this._notificationTypes = e[1];
|
|
@@ -1214,10 +1215,10 @@ class TimelineApp {
|
|
|
1214
1215
|
if (this._loading || this._lastPage)
|
|
1215
1216
|
return Promise.resolve();
|
|
1216
1217
|
e && (this._pageNumber++, this._lastPage = !1);
|
|
1217
|
-
|
|
1218
|
+
const t = this.selectedNotificationTypes;
|
|
1218
1219
|
if (t.length === 0)
|
|
1219
1220
|
return this._lastPage = !0, Promise.resolve();
|
|
1220
|
-
|
|
1221
|
+
const s = {
|
|
1221
1222
|
page: this.page,
|
|
1222
1223
|
mine: 1
|
|
1223
1224
|
};
|
|
@@ -1228,10 +1229,10 @@ class TimelineApp {
|
|
|
1228
1229
|
if (this._loading = !1, r.status === "ok")
|
|
1229
1230
|
if (r.number && r.results) {
|
|
1230
1231
|
const i = r.results.filter(
|
|
1231
|
-
(
|
|
1232
|
-
(a) => a._id ===
|
|
1232
|
+
(o) => this._notifications.findIndex(
|
|
1233
|
+
(a) => a._id === o._id
|
|
1233
1234
|
) === -1
|
|
1234
|
-
).map((
|
|
1235
|
+
).map((o) => new Notification(o));
|
|
1235
1236
|
this._notifications = this._notifications.concat(i), this._pageNumber++;
|
|
1236
1237
|
} else
|
|
1237
1238
|
this._lastPage = !0;
|
|
@@ -1319,7 +1320,7 @@ const f = class f {
|
|
|
1319
1320
|
//
|
|
1320
1321
|
// PROTECTED HELPERS
|
|
1321
1322
|
//
|
|
1322
|
-
|
|
1323
|
+
n(this, "checkHttpResponse", (e) => {
|
|
1323
1324
|
if (this.http.latestResponse.status >= 300)
|
|
1324
1325
|
throw this.http.latestResponse.statusText;
|
|
1325
1326
|
return e;
|
|
@@ -1471,7 +1472,7 @@ const f = class f {
|
|
|
1471
1472
|
});
|
|
1472
1473
|
return t.map((r) => {
|
|
1473
1474
|
const i = s.resources.find(
|
|
1474
|
-
(
|
|
1475
|
+
(o) => o.assetId === r
|
|
1475
1476
|
);
|
|
1476
1477
|
if (i === void 0)
|
|
1477
1478
|
throw "explorer.assetid.notfound";
|
|
@@ -1537,10 +1538,10 @@ const f = class f {
|
|
|
1537
1538
|
//
|
|
1538
1539
|
// STATIC REGISTRY
|
|
1539
1540
|
//
|
|
1540
|
-
|
|
1541
|
-
|
|
1541
|
+
n(f, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
1542
|
+
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
1543
|
let ResourceService = f;
|
|
1543
|
-
const APP$
|
|
1544
|
+
const APP$3 = "scrapbook", RESOURCE$3 = "scrapbook";
|
|
1544
1545
|
class ScrapbookResourceService extends ResourceService {
|
|
1545
1546
|
create(e) {
|
|
1546
1547
|
throw new Error("Method not implemented.");
|
|
@@ -1558,10 +1559,10 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1558
1559
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1559
1560
|
}
|
|
1560
1561
|
getResourceType() {
|
|
1561
|
-
return RESOURCE$
|
|
1562
|
+
return RESOURCE$3;
|
|
1562
1563
|
}
|
|
1563
1564
|
getApplication() {
|
|
1564
|
-
return APP$
|
|
1565
|
+
return APP$3;
|
|
1565
1566
|
}
|
|
1566
1567
|
getFormUrl(e) {
|
|
1567
1568
|
return e ? `/scrapbook?folderid=${e}#/create-scrapbook/` : "/scrapbook#/create-scrapbook/";
|
|
@@ -1580,10 +1581,10 @@ class ScrapbookResourceService extends ResourceService {
|
|
|
1580
1581
|
}
|
|
1581
1582
|
}
|
|
1582
1583
|
ResourceService.register(
|
|
1583
|
-
{ application: RESOURCE$
|
|
1584
|
-
(
|
|
1584
|
+
{ application: RESOURCE$3, resourceType: RESOURCE$3 },
|
|
1585
|
+
(u) => new ScrapbookResourceService(u)
|
|
1585
1586
|
);
|
|
1586
|
-
const APP$
|
|
1587
|
+
const APP$2 = "homeworks", RESOURCE$2 = "homeworks";
|
|
1587
1588
|
class HomeworksResourceService extends ResourceService {
|
|
1588
1589
|
async create(e) {
|
|
1589
1590
|
const t = await this.getThumbnailPath(e.thumbnail), s = await this.http.post("/homeworks", {
|
|
@@ -1606,10 +1607,10 @@ class HomeworksResourceService extends ResourceService {
|
|
|
1606
1607
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1607
1608
|
}
|
|
1608
1609
|
getResourceType() {
|
|
1609
|
-
return RESOURCE$
|
|
1610
|
+
return RESOURCE$2;
|
|
1610
1611
|
}
|
|
1611
1612
|
getApplication() {
|
|
1612
|
-
return APP$
|
|
1613
|
+
return APP$2;
|
|
1613
1614
|
}
|
|
1614
1615
|
getFormUrl(e) {
|
|
1615
1616
|
return e ? `/homeworks?folderid=${e}#/create-homeworks/` : "/homeworks#/create-homeworks/";
|
|
@@ -1628,10 +1629,10 @@ class HomeworksResourceService extends ResourceService {
|
|
|
1628
1629
|
}
|
|
1629
1630
|
}
|
|
1630
1631
|
ResourceService.register(
|
|
1631
|
-
{ application: RESOURCE$
|
|
1632
|
-
(
|
|
1632
|
+
{ application: RESOURCE$2, resourceType: RESOURCE$2 },
|
|
1633
|
+
(u) => new HomeworksResourceService(u)
|
|
1633
1634
|
);
|
|
1634
|
-
const APP = "timelinegenerator", RESOURCE = "timelinegenerator";
|
|
1635
|
+
const APP$1 = "timelinegenerator", RESOURCE$1 = "timelinegenerator";
|
|
1635
1636
|
class TimelineGeneratorResourceService extends ResourceService {
|
|
1636
1637
|
async create(e) {
|
|
1637
1638
|
const t = e.thumbnail ? await this.getThumbnailPath(e.thumbnail) : "", s = await this.http.post(
|
|
@@ -1661,10 +1662,10 @@ class TimelineGeneratorResourceService extends ResourceService {
|
|
|
1661
1662
|
return this.checkHttpResponse(s), { thumbnail: t, entId: e.entId };
|
|
1662
1663
|
}
|
|
1663
1664
|
getResourceType() {
|
|
1664
|
-
return RESOURCE;
|
|
1665
|
+
return RESOURCE$1;
|
|
1665
1666
|
}
|
|
1666
1667
|
getApplication() {
|
|
1667
|
-
return APP;
|
|
1668
|
+
return APP$1;
|
|
1668
1669
|
}
|
|
1669
1670
|
getFormUrl() {
|
|
1670
1671
|
throw new Error("Method not implemented.");
|
|
@@ -1682,9 +1683,57 @@ class TimelineGeneratorResourceService extends ResourceService {
|
|
|
1682
1683
|
throw new Error("Method not implemented.");
|
|
1683
1684
|
}
|
|
1684
1685
|
}
|
|
1686
|
+
ResourceService.register(
|
|
1687
|
+
{ application: RESOURCE$1, resourceType: RESOURCE$1 },
|
|
1688
|
+
(u) => new TimelineGeneratorResourceService(u)
|
|
1689
|
+
);
|
|
1690
|
+
const APP = "collaborativeeditor", RESOURCE = "collaborativeeditor";
|
|
1691
|
+
class CollaborativeEditorResourceService extends ResourceService {
|
|
1692
|
+
async create(e) {
|
|
1693
|
+
const { name: t, description: s, thumbnail: r, folder: i } = e, o = r ? await this.getThumbnailPath(r) : "", a = await this.http.post("/collaborativeeditor", {
|
|
1694
|
+
name: t,
|
|
1695
|
+
description: s,
|
|
1696
|
+
thumbnail: o,
|
|
1697
|
+
folder: i
|
|
1698
|
+
});
|
|
1699
|
+
return this.checkHttpResponse(a), a;
|
|
1700
|
+
}
|
|
1701
|
+
async update(e) {
|
|
1702
|
+
const { name: t, description: s, thumbnail: r, entId: i } = e, o = await this.getThumbnailPath(r), a = await this.http.put(
|
|
1703
|
+
`/collaborativeeditor/${i}`,
|
|
1704
|
+
{
|
|
1705
|
+
name: t,
|
|
1706
|
+
description: s,
|
|
1707
|
+
thumbnail: o
|
|
1708
|
+
}
|
|
1709
|
+
);
|
|
1710
|
+
return this.checkHttpResponse(a), { thumbnail: o, entId: i };
|
|
1711
|
+
}
|
|
1712
|
+
getResourceType() {
|
|
1713
|
+
return RESOURCE;
|
|
1714
|
+
}
|
|
1715
|
+
getApplication() {
|
|
1716
|
+
return APP;
|
|
1717
|
+
}
|
|
1718
|
+
getFormUrl() {
|
|
1719
|
+
throw new Error("Method not implemented.");
|
|
1720
|
+
}
|
|
1721
|
+
getViewUrl(e) {
|
|
1722
|
+
return `/collaborativeeditor#/view/${e}`;
|
|
1723
|
+
}
|
|
1724
|
+
getPrintUrl() {
|
|
1725
|
+
throw new Error("Method not implemented.");
|
|
1726
|
+
}
|
|
1727
|
+
getEditUrl() {
|
|
1728
|
+
throw new Error("Method not implemented.");
|
|
1729
|
+
}
|
|
1730
|
+
getExportUrl() {
|
|
1731
|
+
throw new Error("Method not implemented.");
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1685
1734
|
ResourceService.register(
|
|
1686
1735
|
{ application: RESOURCE, resourceType: RESOURCE },
|
|
1687
|
-
(
|
|
1736
|
+
(u) => new CollaborativeEditorResourceService(u)
|
|
1688
1737
|
);
|
|
1689
1738
|
const globalCache = {}, mutexPromise = {};
|
|
1690
1739
|
class CacheService {
|
|
@@ -1695,7 +1744,7 @@ class CacheService {
|
|
|
1695
1744
|
return this.context.http();
|
|
1696
1745
|
}
|
|
1697
1746
|
async fromCacheIfPossible(e, t, s) {
|
|
1698
|
-
if (mutexPromise[e] && await mutexPromise[e], globalCache[e])
|
|
1747
|
+
if (mutexPromise[e] !== void 0 && await mutexPromise[e], globalCache[e])
|
|
1699
1748
|
return globalCache[e];
|
|
1700
1749
|
try {
|
|
1701
1750
|
const r = t();
|
|
@@ -1753,14 +1802,14 @@ class ConfService {
|
|
|
1753
1802
|
]), [r, i] = await Promise.all([
|
|
1754
1803
|
this.getTheme({ conf: t, publicTheme: s === void 0 }),
|
|
1755
1804
|
this.getWebAppConf({ app: e, applications: s ?? [] })
|
|
1756
|
-
]),
|
|
1805
|
+
]), o = {
|
|
1757
1806
|
app: e,
|
|
1758
1807
|
applications: s ?? [],
|
|
1759
1808
|
conf: t,
|
|
1760
1809
|
currentApp: i,
|
|
1761
1810
|
theme: r
|
|
1762
1811
|
};
|
|
1763
|
-
return this.notify.onAppConfReady().resolve(
|
|
1812
|
+
return this.notify.onAppConfReady().resolve(o), o;
|
|
1764
1813
|
}
|
|
1765
1814
|
async getPublicConf(e) {
|
|
1766
1815
|
const { response: t, value: s } = await this.cache.httpGet(
|
|
@@ -1812,25 +1861,23 @@ class ConfService {
|
|
|
1812
1861
|
conf: t,
|
|
1813
1862
|
publicTheme: s
|
|
1814
1863
|
}) {
|
|
1815
|
-
const
|
|
1816
|
-
queryParams: { _: e }
|
|
1817
|
-
}), i = s ? null : r, n = t == null ? void 0 : t.overriding.find(
|
|
1864
|
+
const r = await this.http.get("/theme"), i = s ? null : r, o = t == null ? void 0 : t.overriding.find(
|
|
1818
1865
|
(p) => (
|
|
1819
1866
|
// Public access => simply use the 1st override
|
|
1820
1867
|
i === null || p.child === i.themeName
|
|
1821
1868
|
)
|
|
1822
|
-
), a = (i == null ? void 0 : i.skinName) ||
|
|
1869
|
+
), a = (i == null ? void 0 : i.skinName) || o.skins[0], c = (i == null ? void 0 : i.skin) || `/assets/themes/${o.child}/skins/${a}/`, h = o.skins, l = o.bootstrapVersion.split("-").slice(-1)[0], E = o.parent === "panda";
|
|
1823
1870
|
return {
|
|
1824
1871
|
basePath: `${this.cdnDomain}${c}../../`,
|
|
1825
1872
|
bootstrapVersion: l,
|
|
1826
1873
|
is1d: E,
|
|
1827
1874
|
logoutCallback: (i == null ? void 0 : i.logoutCallback) || "/",
|
|
1828
|
-
skin:
|
|
1875
|
+
skin: o.child,
|
|
1829
1876
|
skinName: a,
|
|
1830
1877
|
skins: h,
|
|
1831
|
-
themeName:
|
|
1878
|
+
themeName: o.child,
|
|
1832
1879
|
themeUrl: c,
|
|
1833
|
-
npmTheme:
|
|
1880
|
+
npmTheme: o.npmTheme ?? void 0
|
|
1834
1881
|
};
|
|
1835
1882
|
}
|
|
1836
1883
|
async getLogoutCallback(e) {
|
|
@@ -1875,13 +1922,13 @@ class DirectoryService {
|
|
|
1875
1922
|
return {
|
|
1876
1923
|
id: s,
|
|
1877
1924
|
displayName: r,
|
|
1878
|
-
groups: t.map(({ name:
|
|
1879
|
-
displayName:
|
|
1925
|
+
groups: t.map(({ name: o, id: a }) => ({
|
|
1926
|
+
displayName: o,
|
|
1880
1927
|
id: a
|
|
1881
1928
|
})),
|
|
1882
|
-
users: i.map(({ displayName:
|
|
1929
|
+
users: i.map(({ displayName: o, id: a, profile: c }) => ({
|
|
1883
1930
|
profile: c,
|
|
1884
|
-
displayName:
|
|
1931
|
+
displayName: o,
|
|
1885
1932
|
// these info are missing from api
|
|
1886
1933
|
firstName: "",
|
|
1887
1934
|
lastName: "",
|
|
@@ -1896,7 +1943,7 @@ class DirectoryService {
|
|
|
1896
1943
|
users: r
|
|
1897
1944
|
}) {
|
|
1898
1945
|
this.cache.clearCache("/directory/sharebookmark/all");
|
|
1899
|
-
const i = r.map((p) => typeof p == "string" ? p : p.id),
|
|
1946
|
+
const i = r.map((p) => typeof p == "string" ? p : p.id), o = s.map((p) => typeof p == "string" ? p : p.id), a = t.map(async (p) => {
|
|
1900
1947
|
if (typeof p == "string") {
|
|
1901
1948
|
const { displayName: d, groups: g, id: A, users: m } = await this.getBookMarkById(p), b = m.map((F) => F.id), C = g.map((F) => F.id);
|
|
1902
1949
|
return {
|
|
@@ -1908,7 +1955,7 @@ class DirectoryService {
|
|
|
1908
1955
|
return Promise.resolve(p);
|
|
1909
1956
|
}), h = (await Promise.all(a)).map((p) => p.members).reduce((p, d) => [...p, ...d], []), l = {
|
|
1910
1957
|
name: e,
|
|
1911
|
-
members: [...i, ...
|
|
1958
|
+
members: [...i, ...o, ...h]
|
|
1912
1959
|
}, { id: E } = await this.http.postJson(
|
|
1913
1960
|
"/directory/sharebookmark",
|
|
1914
1961
|
l
|
|
@@ -1924,10 +1971,10 @@ const loadedScripts = {};
|
|
|
1924
1971
|
class HttpService {
|
|
1925
1972
|
constructor(e, t) {
|
|
1926
1973
|
// Axios automatically manages the XSRF-TOKEN cookie and the X-XSRF-TOKEN HTTP header.
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1974
|
+
n(this, "axios");
|
|
1975
|
+
n(this, "baseUrl");
|
|
1976
|
+
n(this, "headers", {});
|
|
1977
|
+
n(this, "_latestResponse");
|
|
1931
1978
|
this.context = e, this.axios = axios.create(t);
|
|
1932
1979
|
}
|
|
1933
1980
|
fixBaseUrl(e) {
|
|
@@ -1972,15 +2019,15 @@ class HttpService {
|
|
|
1972
2019
|
status: 500,
|
|
1973
2020
|
statusText: ERROR_CODE.UNKNOWN
|
|
1974
2021
|
};
|
|
1975
|
-
const { status: s, statusText: r, headers: i, data:
|
|
2022
|
+
const { status: s, statusText: r, headers: i, data: o } = this._latestResponse;
|
|
1976
2023
|
return t != null && t.disableNotifications || notify.events().publish(LAYER_NAME.TRANSPORT, {
|
|
1977
2024
|
name: EVENT_NAME.ERROR_OCCURED,
|
|
1978
2025
|
data: {
|
|
1979
2026
|
params: t,
|
|
1980
2027
|
response: { status: s, statusText: r, headers: i },
|
|
1981
|
-
payload:
|
|
2028
|
+
payload: o
|
|
1982
2029
|
}
|
|
1983
|
-
}),
|
|
2030
|
+
}), o;
|
|
1984
2031
|
}
|
|
1985
2032
|
mapAxiosResponse(e, t) {
|
|
1986
2033
|
return this._latestResponse = e, e.data;
|
|
@@ -2103,15 +2150,15 @@ class HttpService {
|
|
|
2103
2150
|
}
|
|
2104
2151
|
getScript(e, t, s) {
|
|
2105
2152
|
const r = s ?? "exports", i = this.toAxiosConfig(t);
|
|
2106
|
-
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((
|
|
2153
|
+
return i.headers && (i.headers.Accept = "application/javascript"), this.axios.get(this.toCdnUrl(e), i).then((o) => this.mapAxiosResponse(o, t)).then((o) => {
|
|
2107
2154
|
try {
|
|
2108
|
-
const a = `"use strict";var ${r.split(".")[0]}={};${
|
|
2155
|
+
const a = `"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;
|
|
2109
2156
|
return Function(a)();
|
|
2110
2157
|
} catch {
|
|
2111
|
-
return
|
|
2158
|
+
return o;
|
|
2112
2159
|
}
|
|
2113
|
-
}).catch((
|
|
2114
|
-
throw this.mapAxiosError(
|
|
2160
|
+
}).catch((o) => {
|
|
2161
|
+
throw this.mapAxiosError(o, t), o;
|
|
2115
2162
|
});
|
|
2116
2163
|
}
|
|
2117
2164
|
loadScript(e, t) {
|
|
@@ -2171,13 +2218,13 @@ class RightService {
|
|
|
2171
2218
|
* @returns true if has rights
|
|
2172
2219
|
*/
|
|
2173
2220
|
hasResourceRight({ id: e, groupIds: t }, s, r) {
|
|
2174
|
-
const i = r.map((
|
|
2175
|
-
for (const
|
|
2176
|
-
if (
|
|
2221
|
+
const i = r.map((o) => typeof o == "string" ? this.parseResourceRight(o) : o).filter((o) => o !== void 0);
|
|
2222
|
+
for (const o of i) {
|
|
2223
|
+
if (o.id === e && o.type === "creator")
|
|
2177
2224
|
return !0;
|
|
2178
|
-
if (
|
|
2225
|
+
if (o.id === e && o.type === "user" && o.right === s)
|
|
2179
2226
|
return !0;
|
|
2180
|
-
if (t.includes(
|
|
2227
|
+
if (t.includes(o.id) && o.type === "group" && o.right === s)
|
|
2181
2228
|
return !0;
|
|
2182
2229
|
}
|
|
2183
2230
|
return !1;
|
|
@@ -2314,7 +2361,7 @@ class SessionService {
|
|
|
2314
2361
|
s,
|
|
2315
2362
|
r,
|
|
2316
2363
|
i,
|
|
2317
|
-
|
|
2364
|
+
o
|
|
2318
2365
|
] = await Promise.all([
|
|
2319
2366
|
this.getCurrentLanguage(e),
|
|
2320
2367
|
this.latestQuotaAndUsage(e),
|
|
@@ -2328,7 +2375,7 @@ class SessionService {
|
|
|
2328
2375
|
currentLanguage: t,
|
|
2329
2376
|
userDescription: r,
|
|
2330
2377
|
userProfile: i,
|
|
2331
|
-
bookmarkedApps:
|
|
2378
|
+
bookmarkedApps: o
|
|
2332
2379
|
};
|
|
2333
2380
|
}
|
|
2334
2381
|
login(e, t, s, r) {
|
|
@@ -2422,9 +2469,9 @@ class SessionService {
|
|
|
2422
2469
|
applications: []
|
|
2423
2470
|
});
|
|
2424
2471
|
const i = [];
|
|
2425
|
-
return r.bookmarks.forEach((
|
|
2472
|
+
return r.bookmarks.forEach((o, a) => {
|
|
2426
2473
|
const c = ((e == null ? void 0 : e.apps) || []).find(
|
|
2427
|
-
(h) => h.name ===
|
|
2474
|
+
(h) => h.name === o
|
|
2428
2475
|
);
|
|
2429
2476
|
if (c) {
|
|
2430
2477
|
const h = Object.assign({}, c);
|
|
@@ -2434,8 +2481,8 @@ class SessionService {
|
|
|
2434
2481
|
}
|
|
2435
2482
|
async getUserProfile(e = {}) {
|
|
2436
2483
|
var c, h;
|
|
2437
|
-
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response:
|
|
2438
|
-
return
|
|
2484
|
+
const { options: t = {}, params: s = {} } = e, r = new URLSearchParams(s).toString(), i = `/userbook/api/person${r ? `?${r}` : ""}`, { response: o, value: a } = await this.cache.httpGet(i, t);
|
|
2485
|
+
return o.status < 200 || o.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"];
|
|
2439
2486
|
}
|
|
2440
2487
|
async isAdml() {
|
|
2441
2488
|
const e = await this.getUser();
|
|
@@ -2453,411 +2500,47 @@ class SessionService {
|
|
|
2453
2500
|
});
|
|
2454
2501
|
}
|
|
2455
2502
|
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
defaultDiacriticsRemovalMap$1[t].letters,
|
|
2461
|
-
defaultDiacriticsRemovalMap$1[t].base
|
|
2462
|
-
);
|
|
2463
|
-
return e;
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
class ShareService {
|
|
2467
|
-
//
|
|
2468
|
-
// IMPLEMENTATION
|
|
2469
|
-
//
|
|
2470
|
-
constructor(e) {
|
|
2471
|
-
this.context = e;
|
|
2472
|
-
}
|
|
2473
|
-
get directory() {
|
|
2474
|
-
return this.context.directory();
|
|
2475
|
-
}
|
|
2476
|
-
get http() {
|
|
2477
|
-
return this.context.http();
|
|
2478
|
-
}
|
|
2479
|
-
get cache() {
|
|
2480
|
-
return this.context.cache();
|
|
2481
|
-
}
|
|
2482
|
-
async searchShareSubjects(e, t, s) {
|
|
2483
|
-
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
2484
|
-
`/${e}/share/json/${t}?search=${s}`
|
|
2485
|
-
), n = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
|
|
2486
|
-
const g = StringUtils.removeAccents(
|
|
2487
|
-
p || ""
|
|
2488
|
-
).toLowerCase(), A = StringUtils.removeAccents(
|
|
2489
|
-
E || ""
|
|
2490
|
-
).toLowerCase(), m = StringUtils.removeAccents(
|
|
2491
|
-
l || ""
|
|
2492
|
-
).toLowerCase(), b = StringUtils.removeAccents(d || "").toLowerCase();
|
|
2493
|
-
return m.includes(r) || A.includes(r) || g.includes(r) || b.includes(r);
|
|
2494
|
-
}).map((l) => ({
|
|
2495
|
-
avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
|
|
2496
|
-
directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
|
|
2497
|
-
displayName: l.username,
|
|
2498
|
-
id: l.id,
|
|
2499
|
-
profile: l.profile,
|
|
2500
|
-
type: "user"
|
|
2501
|
-
})), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
|
|
2502
|
-
avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
|
|
2503
|
-
directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
|
|
2504
|
-
displayName: l.name,
|
|
2505
|
-
id: l.id,
|
|
2506
|
-
type: "group",
|
|
2507
|
-
structureName: l.structureName
|
|
2508
|
-
}));
|
|
2509
|
-
return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
|
|
2510
|
-
l || ""
|
|
2511
|
-
).toLowerCase().includes(r)).map((l) => ({
|
|
2512
|
-
avatarUrl: "",
|
|
2513
|
-
directoryUrl: "",
|
|
2514
|
-
profile: "",
|
|
2515
|
-
displayName: l.displayName,
|
|
2516
|
-
id: l.id,
|
|
2517
|
-
type: "sharebookmark"
|
|
2518
|
-
})), ...n, ...a];
|
|
2519
|
-
}
|
|
2520
|
-
async getShareMapping(e) {
|
|
2521
|
-
const t = await this.cache.httpGetJson(
|
|
2522
|
-
`/${e}/rights/sharing`
|
|
2523
|
-
);
|
|
2524
|
-
for (const s of Object.keys(t))
|
|
2525
|
-
if (s.includes(".")) {
|
|
2526
|
-
const r = s.split(".")[1], i = t[s];
|
|
2527
|
-
delete t[s], t[r] = i;
|
|
2528
|
-
}
|
|
2529
|
-
return t;
|
|
2530
|
-
}
|
|
2531
|
-
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2532
|
-
const n = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2533
|
-
for (const h of a)
|
|
2534
|
-
r[h].filter(
|
|
2535
|
-
(p) => n.includes(p)
|
|
2536
|
-
).length > 0 && c.push(h);
|
|
2537
|
-
return c;
|
|
2538
|
-
}
|
|
2539
|
-
async getRightsForResource(e, t) {
|
|
2540
|
-
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), n = await this.getShareMapping(e), a = await this.cache.httpGetJson(
|
|
2541
|
-
"/infra/public/json/sharing-rights.json"
|
|
2542
|
-
), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
|
|
2543
|
-
(A) => A.id === d
|
|
2544
|
-
)).filter((d) => d !== void 0).map((d) => {
|
|
2545
|
-
const g = this.getActionsAvailableFor(
|
|
2546
|
-
{ id: d.id, type: "user" },
|
|
2547
|
-
i,
|
|
2548
|
-
n
|
|
2549
|
-
);
|
|
2550
|
-
return {
|
|
2551
|
-
id: d.id,
|
|
2552
|
-
type: "user",
|
|
2553
|
-
displayName: d.username,
|
|
2554
|
-
profile: d.profile,
|
|
2555
|
-
avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
|
|
2556
|
-
directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
|
|
2557
|
-
actions: g.map((m) => {
|
|
2558
|
-
const b = a[m];
|
|
2559
|
-
return {
|
|
2560
|
-
displayName: m,
|
|
2561
|
-
id: m,
|
|
2562
|
-
priority: b.priority
|
|
2563
|
-
};
|
|
2564
|
-
})
|
|
2565
|
-
};
|
|
2566
|
-
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
|
|
2567
|
-
(A) => A.id === d
|
|
2568
|
-
)).filter((d) => d !== void 0).map((d) => {
|
|
2569
|
-
const g = this.getActionsAvailableFor(
|
|
2570
|
-
{ id: d.id, type: "group" },
|
|
2571
|
-
i,
|
|
2572
|
-
n
|
|
2573
|
-
);
|
|
2574
|
-
return {
|
|
2575
|
-
id: d.id,
|
|
2576
|
-
type: "group",
|
|
2577
|
-
displayName: d.name,
|
|
2578
|
-
profile: void 0,
|
|
2579
|
-
avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
|
|
2580
|
-
directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
|
|
2581
|
-
actions: g.map((m) => {
|
|
2582
|
-
const b = a[m];
|
|
2583
|
-
return {
|
|
2584
|
-
displayName: m,
|
|
2585
|
-
id: m,
|
|
2586
|
-
priority: b.priority
|
|
2587
|
-
};
|
|
2588
|
-
})
|
|
2589
|
-
};
|
|
2590
|
-
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
|
|
2591
|
-
({ groupDisplayName: d, id: g, name: A }) => ({
|
|
2592
|
-
displayName: d || A,
|
|
2593
|
-
id: g
|
|
2594
|
-
})
|
|
2595
|
-
), p = i.users.visibles.map(
|
|
2596
|
-
({ id: d, profile: g, username: A, firstName: m, lastName: b, login: C }) => ({
|
|
2597
|
-
displayName: A,
|
|
2598
|
-
firstName: m,
|
|
2599
|
-
lastName: b,
|
|
2600
|
-
login: C,
|
|
2601
|
-
profile: g,
|
|
2602
|
-
id: d
|
|
2603
|
-
})
|
|
2604
|
-
);
|
|
2605
|
-
return {
|
|
2606
|
-
rights: l,
|
|
2607
|
-
visibleBookmarks: s,
|
|
2608
|
-
visibleGroups: E,
|
|
2609
|
-
visibleUsers: p
|
|
2610
|
-
};
|
|
2611
|
-
}
|
|
2612
|
-
async saveRights(e, t, s) {
|
|
2613
|
-
const r = await this.getShareMapping(e), i = {
|
|
2614
|
-
bookmarks: {},
|
|
2615
|
-
groups: {},
|
|
2616
|
-
users: {}
|
|
2617
|
-
};
|
|
2618
|
-
for (const c of s) {
|
|
2619
|
-
const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
|
|
2620
|
-
l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
|
|
2621
|
-
}
|
|
2622
|
-
const n = `/${e}/share/resource/${t}`;
|
|
2623
|
-
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(n, i);
|
|
2624
|
-
}
|
|
2625
|
-
async getActionsForApp(e) {
|
|
2626
|
-
const t = await this.cache.httpGetJson(
|
|
2627
|
-
"/infra/public/json/sharing-rights.json"
|
|
2628
|
-
), s = await this.getShareMapping(e);
|
|
2629
|
-
return Object.keys(t).map((i) => {
|
|
2630
|
-
const n = t[i];
|
|
2631
|
-
return {
|
|
2632
|
-
displayName: i,
|
|
2633
|
-
id: i,
|
|
2634
|
-
priority: n.priority,
|
|
2635
|
-
requires: n.requires
|
|
2636
|
-
};
|
|
2637
|
-
}).filter((i) => {
|
|
2638
|
-
var n;
|
|
2639
|
-
return ((n = s[i.id]) == null ? void 0 : n.length) > 0;
|
|
2640
|
-
}).sort((i, n) => i.priority - n.priority);
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
const defaultMappers = {
|
|
2644
|
-
csv: function({ type: o, extension: e }) {
|
|
2645
|
-
return MimeTypeUtils.INSTANCE.isCsvLike(o, e);
|
|
2646
|
-
},
|
|
2647
|
-
doc: function({ type: o, extension: e }) {
|
|
2648
|
-
return MimeTypeUtils.INSTANCE.isWordLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("wordprocessing") !== -1;
|
|
2649
|
-
},
|
|
2650
|
-
xls: function({ type: o, extension: e }) {
|
|
2651
|
-
return MimeTypeUtils.INSTANCE.isExcelLike(o, e) ? !0 : o.indexOf("document") !== -1 && o.indexOf("spreadsheet") !== -1 || o.indexOf("ms-excel") !== -1;
|
|
2503
|
+
const bundle = {}, promises = {}, defaultDiacriticsRemovalMap = [
|
|
2504
|
+
{
|
|
2505
|
+
base: "A",
|
|
2506
|
+
letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
|
|
2652
2507
|
},
|
|
2653
|
-
|
|
2654
|
-
|
|
2508
|
+
{ base: "AA", letters: /[\uA732]/g },
|
|
2509
|
+
{ base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
|
|
2510
|
+
{ base: "AO", letters: /[\uA734]/g },
|
|
2511
|
+
{ base: "AU", letters: /[\uA736]/g },
|
|
2512
|
+
{ base: "AV", letters: /[\uA738\uA73A]/g },
|
|
2513
|
+
{ base: "AY", letters: /[\uA73C]/g },
|
|
2514
|
+
{
|
|
2515
|
+
base: "B",
|
|
2516
|
+
letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
|
|
2655
2517
|
},
|
|
2656
|
-
|
|
2657
|
-
|
|
2518
|
+
{
|
|
2519
|
+
base: "C",
|
|
2520
|
+
letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
|
|
2658
2521
|
},
|
|
2659
|
-
|
|
2660
|
-
|
|
2522
|
+
{
|
|
2523
|
+
base: "D",
|
|
2524
|
+
letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
|
|
2661
2525
|
},
|
|
2662
|
-
|
|
2663
|
-
|
|
2526
|
+
{ base: "DZ", letters: /[\u01F1\u01C4]/g },
|
|
2527
|
+
{ base: "Dz", letters: /[\u01F2\u01C5]/g },
|
|
2528
|
+
{
|
|
2529
|
+
base: "E",
|
|
2530
|
+
letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
|
|
2664
2531
|
},
|
|
2665
|
-
|
|
2666
|
-
|
|
2532
|
+
{ base: "F", letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g },
|
|
2533
|
+
{
|
|
2534
|
+
base: "G",
|
|
2535
|
+
letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
|
|
2667
2536
|
},
|
|
2668
|
-
|
|
2669
|
-
|
|
2537
|
+
{
|
|
2538
|
+
base: "H",
|
|
2539
|
+
letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
|
|
2670
2540
|
},
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
zip: function({ type: o }) {
|
|
2675
|
-
return o.indexOf("zip") !== -1 || o.indexOf("rar") !== -1 || o.indexOf("tar") !== -1 || o.indexOf("7z") !== -1;
|
|
2676
|
-
}
|
|
2677
|
-
}, R = class R {
|
|
2678
|
-
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
2679
|
-
static getRole(e) {
|
|
2680
|
-
var t, s;
|
|
2681
|
-
return R.role(
|
|
2682
|
-
(t = e.metadata) == null ? void 0 : t["content-type"],
|
|
2683
|
-
!1,
|
|
2684
|
-
(s = e.metadata) == null ? void 0 : s.extension
|
|
2685
|
-
);
|
|
2686
|
-
}
|
|
2687
|
-
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
2688
|
-
static role(e, t = !1, s) {
|
|
2689
|
-
if (s && (s = s.trim()), !e) return "unknown";
|
|
2690
|
-
this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
|
|
2691
|
-
const r = { type: e, previewRole: t, extension: s };
|
|
2692
|
-
for (const i of this.roleMappers) {
|
|
2693
|
-
const n = i(r);
|
|
2694
|
-
if (n)
|
|
2695
|
-
return n;
|
|
2696
|
-
}
|
|
2697
|
-
return "unknown";
|
|
2698
|
-
}
|
|
2699
|
-
};
|
|
2700
|
-
// FIXME add edumedia support
|
|
2701
|
-
u(R, "roleMappers", [
|
|
2702
|
-
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
2703
|
-
]);
|
|
2704
|
-
let DocumentHelper = R;
|
|
2705
|
-
class WorkspaceService {
|
|
2706
|
-
constructor(e) {
|
|
2707
|
-
this.context = e;
|
|
2708
|
-
}
|
|
2709
|
-
get http() {
|
|
2710
|
-
return this.context.http();
|
|
2711
|
-
}
|
|
2712
|
-
extractMetadata(e) {
|
|
2713
|
-
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", n = {
|
|
2714
|
-
"content-type": r,
|
|
2715
|
-
filename: t,
|
|
2716
|
-
size: e.size,
|
|
2717
|
-
extension: i,
|
|
2718
|
-
role: DocumentHelper.role(r, !1, i)
|
|
2719
|
-
}, a = t.replace("." + n.extension, ""), c = n.extension ? a + "." + n.extension : a;
|
|
2720
|
-
return { basename: a, fullname: c, metadata: n };
|
|
2721
|
-
}
|
|
2722
|
-
async saveFile(e, t) {
|
|
2723
|
-
const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
|
|
2724
|
-
i.append("file", e, s);
|
|
2725
|
-
const n = [];
|
|
2726
|
-
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && n.push(`${t.visibility}=true`), t != null && t.application && n.push(`application=${t.application}`), r.role === "img" && n.push("quality=1"), t != null && t.parentId && n.push(`parentId=${t.parentId}`);
|
|
2727
|
-
const a = await this.http.postFile(
|
|
2728
|
-
`/workspace/document?${n.join("&")}`,
|
|
2729
|
-
i
|
|
2730
|
-
);
|
|
2731
|
-
if (this.http.isResponseError())
|
|
2732
|
-
throw this.http.latestResponse.statusText;
|
|
2733
|
-
return a;
|
|
2734
|
-
}
|
|
2735
|
-
async updateFile(e, t, s) {
|
|
2736
|
-
const { fullname: r, metadata: i } = this.extractMetadata(t), n = new FormData();
|
|
2737
|
-
n.append("file", t, r);
|
|
2738
|
-
const a = [];
|
|
2739
|
-
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}`);
|
|
2740
|
-
const c = await this.http.putFile(
|
|
2741
|
-
`/workspace/document/${e}?${a.join("&")}`,
|
|
2742
|
-
n
|
|
2743
|
-
);
|
|
2744
|
-
if (this.http.isResponseError())
|
|
2745
|
-
throw this.http.latestResponse.statusText;
|
|
2746
|
-
return c;
|
|
2747
|
-
}
|
|
2748
|
-
async deleteFile(e) {
|
|
2749
|
-
const t = e.map((s) => s._id);
|
|
2750
|
-
if (t.length == 0)
|
|
2751
|
-
Promise.resolve(null);
|
|
2752
|
-
else if (await this.http.deleteJson("/workspace/documents", {
|
|
2753
|
-
ids: t
|
|
2754
|
-
}), this.http.isResponseError())
|
|
2755
|
-
throw this.http.latestResponse.statusText;
|
|
2756
|
-
}
|
|
2757
|
-
async acceptDocuments(e) {
|
|
2758
|
-
const t = await this.context.session().getUser();
|
|
2759
|
-
return (s) => s.deleted && s.trasher ? (t == null ? void 0 : t.userId) == s.trasher : !0;
|
|
2760
|
-
}
|
|
2761
|
-
async searchDocuments(e) {
|
|
2762
|
-
const t = e.filter !== "external" || e.parentId ? await this.http.get("/workspace/documents", {
|
|
2763
|
-
queryParams: { ...e, _: (/* @__PURE__ */ new Date()).getTime() }
|
|
2764
|
-
}) : [], s = await this.acceptDocuments(e);
|
|
2765
|
-
return t.filter(s);
|
|
2766
|
-
}
|
|
2767
|
-
async listDocuments(e, t) {
|
|
2768
|
-
return this.searchDocuments({ filter: e, parentId: t, includeall: !0 });
|
|
2769
|
-
}
|
|
2770
|
-
/**
|
|
2771
|
-
* Duplicate and transfers documents if needed to a different folder with the specified application and visibility.
|
|
2772
|
-
* @param documents - The array of documents to transfer.
|
|
2773
|
-
* @param application - The application to associate with the transferred documents.
|
|
2774
|
-
* @param visibility - The visibility of the transferred documents. Defaults to "protected".
|
|
2775
|
-
* @returns A Promise that resolves to an array of transferred WorkspaceElements.
|
|
2776
|
-
*/
|
|
2777
|
-
async transferDocuments(e, t, s = "protected") {
|
|
2778
|
-
const r = [];
|
|
2779
|
-
if (e.forEach((i) => {
|
|
2780
|
-
(s === "public" && !i.public || !i.public && !i.protected) && r.push(i);
|
|
2781
|
-
}), r.length > 0) {
|
|
2782
|
-
const i = await this.http.post(
|
|
2783
|
-
"/workspace/documents/transfer",
|
|
2784
|
-
{
|
|
2785
|
-
application: t,
|
|
2786
|
-
visibility: s,
|
|
2787
|
-
ids: r.map((n) => n._id)
|
|
2788
|
-
}
|
|
2789
|
-
);
|
|
2790
|
-
if (this.http.isResponseError())
|
|
2791
|
-
throw this.http.latestResponse.statusText;
|
|
2792
|
-
return r.forEach((n, a) => {
|
|
2793
|
-
const c = e.findIndex(
|
|
2794
|
-
(h) => h._id === n._id
|
|
2795
|
-
);
|
|
2796
|
-
0 <= c && c < e.length && (e[c] = i[a]);
|
|
2797
|
-
}), e.filter((n) => !!n);
|
|
2798
|
-
}
|
|
2799
|
-
return e;
|
|
2800
|
-
}
|
|
2801
|
-
/**
|
|
2802
|
-
* Get the URL of the thumbnail of a workspace element (or its URL),
|
|
2803
|
-
* or `null` if none exists or can be created.
|
|
2804
|
-
*/
|
|
2805
|
-
getThumbnailUrl(e, t = 0, s = 0) {
|
|
2806
|
-
var i, n;
|
|
2807
|
-
const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
|
|
2808
|
-
if (typeof e == "string")
|
|
2809
|
-
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
|
|
2810
|
-
{
|
|
2811
|
-
const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
2812
|
-
if ((n = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && n.includes("video")) {
|
|
2813
|
-
const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
2814
|
-
return h ? a + h : null;
|
|
2815
|
-
} else
|
|
2816
|
-
return a + r;
|
|
2817
|
-
}
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
const bundle = {}, promises = {}, defaultDiacriticsRemovalMap = [
|
|
2821
|
-
{
|
|
2822
|
-
base: "A",
|
|
2823
|
-
letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
|
|
2824
|
-
},
|
|
2825
|
-
{ base: "AA", letters: /[\uA732]/g },
|
|
2826
|
-
{ base: "AE", letters: /[\u00C6\u01FC\u01E2]/g },
|
|
2827
|
-
{ base: "AO", letters: /[\uA734]/g },
|
|
2828
|
-
{ base: "AU", letters: /[\uA736]/g },
|
|
2829
|
-
{ base: "AV", letters: /[\uA738\uA73A]/g },
|
|
2830
|
-
{ base: "AY", letters: /[\uA73C]/g },
|
|
2831
|
-
{
|
|
2832
|
-
base: "B",
|
|
2833
|
-
letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
|
|
2834
|
-
},
|
|
2835
|
-
{
|
|
2836
|
-
base: "C",
|
|
2837
|
-
letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
|
|
2838
|
-
},
|
|
2839
|
-
{
|
|
2840
|
-
base: "D",
|
|
2841
|
-
letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
|
|
2842
|
-
},
|
|
2843
|
-
{ base: "DZ", letters: /[\u01F1\u01C4]/g },
|
|
2844
|
-
{ base: "Dz", letters: /[\u01F2\u01C5]/g },
|
|
2845
|
-
{
|
|
2846
|
-
base: "E",
|
|
2847
|
-
letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
|
|
2848
|
-
},
|
|
2849
|
-
{ base: "F", letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g },
|
|
2850
|
-
{
|
|
2851
|
-
base: "G",
|
|
2852
|
-
letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
|
|
2853
|
-
},
|
|
2854
|
-
{
|
|
2855
|
-
base: "H",
|
|
2856
|
-
letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
|
|
2857
|
-
},
|
|
2858
|
-
{
|
|
2859
|
-
base: "I",
|
|
2860
|
-
letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
|
|
2541
|
+
{
|
|
2542
|
+
base: "I",
|
|
2543
|
+
letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
|
|
2861
2544
|
},
|
|
2862
2545
|
{ base: "J", letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g },
|
|
2863
2546
|
{
|
|
@@ -3040,7 +2723,7 @@ class IdiomService {
|
|
|
3040
2723
|
e = e ?? "";
|
|
3041
2724
|
let s = bundle[e] === void 0 ? e : bundle[e];
|
|
3042
2725
|
if (t && typeof t == "object")
|
|
3043
|
-
for (
|
|
2726
|
+
for (const r in t)
|
|
3044
2727
|
typeof t[r] < "u" && (s = s.replace(
|
|
3045
2728
|
new RegExp("\\${" + r + "}", "g"),
|
|
3046
2729
|
"" + t[r]
|
|
@@ -3063,8 +2746,8 @@ class IdiomService {
|
|
|
3063
2746
|
else {
|
|
3064
2747
|
const i = new Promisified();
|
|
3065
2748
|
promises[t] = i.promise;
|
|
3066
|
-
const
|
|
3067
|
-
e && (
|
|
2749
|
+
const o = {};
|
|
2750
|
+
e && (o["Accept-Language"] = e), this.http.get(t, { headers: o }).then((a) => {
|
|
3068
2751
|
Object.assign(bundle, a), typeof s == "function" && s(), i.resolve();
|
|
3069
2752
|
}).catch((a) => {
|
|
3070
2753
|
typeof s == "function" && s(), i.reject();
|
|
@@ -3087,11 +2770,11 @@ class IdiomService {
|
|
|
3087
2770
|
}) : Promise.reject();
|
|
3088
2771
|
}
|
|
3089
2772
|
addKeys(e) {
|
|
3090
|
-
for (
|
|
2773
|
+
for (const t in e)
|
|
3091
2774
|
typeof bundle[t] != "string" && (bundle[t] = e[t]);
|
|
3092
2775
|
}
|
|
3093
2776
|
removeAccents(e) {
|
|
3094
|
-
for (
|
|
2777
|
+
for (let t = 0; t < defaultDiacriticsRemovalMap.length; t++)
|
|
3095
2778
|
e = e.replace(
|
|
3096
2779
|
defaultDiacriticsRemovalMap[t].letters,
|
|
3097
2780
|
defaultDiacriticsRemovalMap[t].base
|
|
@@ -3099,10 +2782,374 @@ class IdiomService {
|
|
|
3099
2782
|
return e;
|
|
3100
2783
|
}
|
|
3101
2784
|
}
|
|
2785
|
+
class StringUtils {
|
|
2786
|
+
static removeAccents(e) {
|
|
2787
|
+
for (let t = 0; t < defaultDiacriticsRemovalMap.length; t++)
|
|
2788
|
+
e = e.replace(
|
|
2789
|
+
defaultDiacriticsRemovalMap[t].letters,
|
|
2790
|
+
defaultDiacriticsRemovalMap[t].base
|
|
2791
|
+
);
|
|
2792
|
+
return e;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
class ShareService {
|
|
2796
|
+
//
|
|
2797
|
+
// IMPLEMENTATION
|
|
2798
|
+
//
|
|
2799
|
+
constructor(e) {
|
|
2800
|
+
this.context = e;
|
|
2801
|
+
}
|
|
2802
|
+
get directory() {
|
|
2803
|
+
return this.context.directory();
|
|
2804
|
+
}
|
|
2805
|
+
get http() {
|
|
2806
|
+
return this.context.http();
|
|
2807
|
+
}
|
|
2808
|
+
get cache() {
|
|
2809
|
+
return this.context.cache();
|
|
2810
|
+
}
|
|
2811
|
+
async searchShareSubjects(e, t, s) {
|
|
2812
|
+
const r = StringUtils.removeAccents(s).toLowerCase(), i = await this.cache.httpGetJson(
|
|
2813
|
+
`/${e}/share/json/${t}?search=${s}`
|
|
2814
|
+
), o = i.users.visibles.filter(({ username: l, firstName: E, lastName: p, login: d }) => {
|
|
2815
|
+
const g = StringUtils.removeAccents(
|
|
2816
|
+
p || ""
|
|
2817
|
+
).toLowerCase(), A = StringUtils.removeAccents(
|
|
2818
|
+
E || ""
|
|
2819
|
+
).toLowerCase(), m = StringUtils.removeAccents(
|
|
2820
|
+
l || ""
|
|
2821
|
+
).toLowerCase(), b = StringUtils.removeAccents(d || "").toLowerCase();
|
|
2822
|
+
return m.includes(r) || A.includes(r) || g.includes(r) || b.includes(r);
|
|
2823
|
+
}).map((l) => ({
|
|
2824
|
+
avatarUrl: this.directory.getAvatarUrl(l.id, "user"),
|
|
2825
|
+
directoryUrl: this.directory.getDirectoryUrl(l.id, "user"),
|
|
2826
|
+
displayName: l.username,
|
|
2827
|
+
id: l.id,
|
|
2828
|
+
profile: l.profile,
|
|
2829
|
+
type: "user"
|
|
2830
|
+
})), a = i.groups.visibles.filter(({ name: l }) => StringUtils.removeAccents(l || "").toLowerCase().includes(r)).map((l) => ({
|
|
2831
|
+
avatarUrl: this.directory.getAvatarUrl(l.id, "group"),
|
|
2832
|
+
directoryUrl: this.directory.getDirectoryUrl(l.id, "group"),
|
|
2833
|
+
displayName: l.name,
|
|
2834
|
+
id: l.id,
|
|
2835
|
+
type: "group",
|
|
2836
|
+
structureName: l.structureName
|
|
2837
|
+
}));
|
|
2838
|
+
return [...(await this.directory.getBookMarks()).filter(({ displayName: l }) => StringUtils.removeAccents(
|
|
2839
|
+
l || ""
|
|
2840
|
+
).toLowerCase().includes(r)).map((l) => ({
|
|
2841
|
+
avatarUrl: "",
|
|
2842
|
+
directoryUrl: "",
|
|
2843
|
+
profile: "",
|
|
2844
|
+
displayName: l.displayName,
|
|
2845
|
+
id: l.id,
|
|
2846
|
+
type: "sharebookmark"
|
|
2847
|
+
})), ...o, ...a];
|
|
2848
|
+
}
|
|
2849
|
+
async getShareMapping(e) {
|
|
2850
|
+
const t = await this.cache.httpGetJson(
|
|
2851
|
+
`/${e}/rights/sharing`
|
|
2852
|
+
);
|
|
2853
|
+
for (const s of Object.keys(t))
|
|
2854
|
+
if (s.includes(".")) {
|
|
2855
|
+
const r = s.split(".")[1], i = t[s];
|
|
2856
|
+
delete t[s], t[r] = i;
|
|
2857
|
+
}
|
|
2858
|
+
return t;
|
|
2859
|
+
}
|
|
2860
|
+
getActionsAvailableFor({ id: e, type: t }, s, r) {
|
|
2861
|
+
const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2862
|
+
for (const h of a)
|
|
2863
|
+
r[h].filter(
|
|
2864
|
+
(p) => o.includes(p)
|
|
2865
|
+
).length > 0 && c.push(h);
|
|
2866
|
+
return c;
|
|
2867
|
+
}
|
|
2868
|
+
async getRightsForResource(e, t) {
|
|
2869
|
+
const s = await this.directory.getBookMarks(), r = `/${e}/share/json/${t}?search=`, i = await this.cache.httpGetJson(r), o = await this.getShareMapping(e), a = await this.cache.httpGetJson(
|
|
2870
|
+
"/infra/public/json/sharing-rights.json"
|
|
2871
|
+
), c = Object.keys(i.users.checked).map((d) => i.users.visibles.find(
|
|
2872
|
+
(A) => A.id === d
|
|
2873
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2874
|
+
const g = this.getActionsAvailableFor(
|
|
2875
|
+
{ id: d.id, type: "user" },
|
|
2876
|
+
i,
|
|
2877
|
+
o
|
|
2878
|
+
);
|
|
2879
|
+
return {
|
|
2880
|
+
id: d.id,
|
|
2881
|
+
type: "user",
|
|
2882
|
+
displayName: d.username,
|
|
2883
|
+
profile: d.profile,
|
|
2884
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
|
|
2885
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
|
|
2886
|
+
actions: g.map((m) => {
|
|
2887
|
+
const b = a[m];
|
|
2888
|
+
return {
|
|
2889
|
+
displayName: m,
|
|
2890
|
+
id: m,
|
|
2891
|
+
priority: b.priority
|
|
2892
|
+
};
|
|
2893
|
+
})
|
|
2894
|
+
};
|
|
2895
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), h = Object.keys(i.groups.checked).map((d) => i.groups.visibles.find(
|
|
2896
|
+
(A) => A.id === d
|
|
2897
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2898
|
+
const g = this.getActionsAvailableFor(
|
|
2899
|
+
{ id: d.id, type: "group" },
|
|
2900
|
+
i,
|
|
2901
|
+
o
|
|
2902
|
+
);
|
|
2903
|
+
return {
|
|
2904
|
+
id: d.id,
|
|
2905
|
+
type: "group",
|
|
2906
|
+
displayName: d.name,
|
|
2907
|
+
profile: void 0,
|
|
2908
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
|
|
2909
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
|
|
2910
|
+
actions: g.map((m) => {
|
|
2911
|
+
const b = a[m];
|
|
2912
|
+
return {
|
|
2913
|
+
displayName: m,
|
|
2914
|
+
id: m,
|
|
2915
|
+
priority: b.priority
|
|
2916
|
+
};
|
|
2917
|
+
})
|
|
2918
|
+
};
|
|
2919
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), l = [...c, ...h], E = i.groups.visibles.map(
|
|
2920
|
+
({ groupDisplayName: d, id: g, name: A }) => ({
|
|
2921
|
+
displayName: d || A,
|
|
2922
|
+
id: g
|
|
2923
|
+
})
|
|
2924
|
+
), p = i.users.visibles.map(
|
|
2925
|
+
({ id: d, profile: g, username: A, firstName: m, lastName: b, login: C }) => ({
|
|
2926
|
+
displayName: A,
|
|
2927
|
+
firstName: m,
|
|
2928
|
+
lastName: b,
|
|
2929
|
+
login: C,
|
|
2930
|
+
profile: g,
|
|
2931
|
+
id: d
|
|
2932
|
+
})
|
|
2933
|
+
);
|
|
2934
|
+
return {
|
|
2935
|
+
rights: l,
|
|
2936
|
+
visibleBookmarks: s,
|
|
2937
|
+
visibleGroups: E,
|
|
2938
|
+
visibleUsers: p
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
async saveRights(e, t, s) {
|
|
2942
|
+
const r = await this.getShareMapping(e), i = {
|
|
2943
|
+
bookmarks: {},
|
|
2944
|
+
groups: {},
|
|
2945
|
+
users: {}
|
|
2946
|
+
};
|
|
2947
|
+
for (const c of s) {
|
|
2948
|
+
const h = c.actions.map((E) => r[E.id]).reduce((E, p) => Array.isArray(p) ? [...E, ...p] : E, []), l = [...new Set(h)];
|
|
2949
|
+
l.length > 0 && (c.type === "user" ? i.users[c.id] = l : c.type === "group" ? i.groups[c.id] = l : i.bookmarks[c.id] = l);
|
|
2950
|
+
}
|
|
2951
|
+
const o = `/${e}/share/resource/${t}`;
|
|
2952
|
+
return this.cache.clearCache(`/${e}/share/json/${t}?search=`), await this.http.putJson(o, i);
|
|
2953
|
+
}
|
|
2954
|
+
async getActionsForApp(e) {
|
|
2955
|
+
const t = await this.cache.httpGetJson(
|
|
2956
|
+
"/infra/public/json/sharing-rights.json"
|
|
2957
|
+
), s = await this.getShareMapping(e);
|
|
2958
|
+
return Object.keys(t).map((i) => {
|
|
2959
|
+
const o = t[i];
|
|
2960
|
+
return {
|
|
2961
|
+
displayName: i,
|
|
2962
|
+
id: i,
|
|
2963
|
+
priority: o.priority,
|
|
2964
|
+
requires: o.requires
|
|
2965
|
+
};
|
|
2966
|
+
}).filter((i) => {
|
|
2967
|
+
var o;
|
|
2968
|
+
return ((o = s[i.id]) == null ? void 0 : o.length) > 0;
|
|
2969
|
+
}).sort((i, o) => i.priority - o.priority);
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
const defaultMappers = {
|
|
2973
|
+
csv: function({ type: u, extension: e }) {
|
|
2974
|
+
return MimeTypeUtils.INSTANCE.isCsvLike(u, e);
|
|
2975
|
+
},
|
|
2976
|
+
doc: function({ type: u, extension: e }) {
|
|
2977
|
+
return MimeTypeUtils.INSTANCE.isWordLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("wordprocessing") !== -1;
|
|
2978
|
+
},
|
|
2979
|
+
xls: function({ type: u, extension: e }) {
|
|
2980
|
+
return MimeTypeUtils.INSTANCE.isExcelLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("spreadsheet") !== -1 || u.indexOf("ms-excel") !== -1;
|
|
2981
|
+
},
|
|
2982
|
+
img: function({ type: u }) {
|
|
2983
|
+
return u.indexOf("image") !== -1;
|
|
2984
|
+
},
|
|
2985
|
+
pdf: function({ type: u }) {
|
|
2986
|
+
return u.indexOf("pdf") !== -1 || u === "application/x-download";
|
|
2987
|
+
},
|
|
2988
|
+
ppt: function({ type: u, extension: e }) {
|
|
2989
|
+
return MimeTypeUtils.INSTANCE.isPowerpointLike(u, e) ? !0 : u.indexOf("document") !== -1 && u.indexOf("presentation") !== -1 || u.indexOf("powerpoint") !== -1;
|
|
2990
|
+
},
|
|
2991
|
+
txt: function({ type: u, extension: e }) {
|
|
2992
|
+
return MimeTypeUtils.INSTANCE.isTxtLike(u, e);
|
|
2993
|
+
},
|
|
2994
|
+
md: function({ type: u, extension: e }) {
|
|
2995
|
+
return MimeTypeUtils.INSTANCE.isMdLike(u, e);
|
|
2996
|
+
},
|
|
2997
|
+
video: function({ type: u }) {
|
|
2998
|
+
return u.indexOf("video") !== -1;
|
|
2999
|
+
},
|
|
3000
|
+
audio: function({ type: u }) {
|
|
3001
|
+
return u.indexOf("audio") !== -1;
|
|
3002
|
+
},
|
|
3003
|
+
zip: function({ type: u }) {
|
|
3004
|
+
return u.indexOf("zip") !== -1 || u.indexOf("rar") !== -1 || u.indexOf("tar") !== -1 || u.indexOf("7z") !== -1;
|
|
3005
|
+
}
|
|
3006
|
+
}, R = class R {
|
|
3007
|
+
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
3008
|
+
static getRole(e) {
|
|
3009
|
+
var t, s;
|
|
3010
|
+
return R.role(
|
|
3011
|
+
(t = e.metadata) == null ? void 0 : t["content-type"],
|
|
3012
|
+
!1,
|
|
3013
|
+
(s = e.metadata) == null ? void 0 : s.extension
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
3017
|
+
static role(e, t = !1, s) {
|
|
3018
|
+
if (s && (s = s.trim()), !e) return "unknown";
|
|
3019
|
+
this.roleMappers || console.warn("[DocumentHelper.role] should not have empty roles", this);
|
|
3020
|
+
const r = { type: e, previewRole: t, extension: s };
|
|
3021
|
+
for (const i of this.roleMappers) {
|
|
3022
|
+
const o = i(r);
|
|
3023
|
+
if (o)
|
|
3024
|
+
return o;
|
|
3025
|
+
}
|
|
3026
|
+
return "unknown";
|
|
3027
|
+
}
|
|
3028
|
+
};
|
|
3029
|
+
// FIXME add edumedia support
|
|
3030
|
+
n(R, "roleMappers", [
|
|
3031
|
+
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
3032
|
+
]);
|
|
3033
|
+
let DocumentHelper = R;
|
|
3034
|
+
class WorkspaceService {
|
|
3035
|
+
constructor(e) {
|
|
3036
|
+
this.context = e;
|
|
3037
|
+
}
|
|
3038
|
+
get http() {
|
|
3039
|
+
return this.context.http();
|
|
3040
|
+
}
|
|
3041
|
+
extractMetadata(e) {
|
|
3042
|
+
const t = e.name || "", s = t.split("."), r = e.type || "application/octet-stream", i = s.length > 1 ? s[s.length - 1] : "", o = {
|
|
3043
|
+
"content-type": r,
|
|
3044
|
+
filename: t,
|
|
3045
|
+
size: e.size,
|
|
3046
|
+
extension: i,
|
|
3047
|
+
role: DocumentHelper.role(r, !1, i)
|
|
3048
|
+
}, a = t.replace("." + o.extension, ""), c = o.extension ? a + "." + o.extension : a;
|
|
3049
|
+
return { basename: a, fullname: c, metadata: o };
|
|
3050
|
+
}
|
|
3051
|
+
async saveFile(e, t) {
|
|
3052
|
+
const { fullname: s, metadata: r } = this.extractMetadata(e), i = new FormData();
|
|
3053
|
+
i.append("file", e, s);
|
|
3054
|
+
const o = [];
|
|
3055
|
+
((t == null ? void 0 : t.visibility) === "public" || (t == null ? void 0 : t.visibility) === "protected") && o.push(`${t.visibility}=true`), t != null && t.application && o.push(`application=${t.application}`), r.role === "img" && o.push("quality=1"), t != null && t.parentId && o.push(`parentId=${t.parentId}`);
|
|
3056
|
+
const a = await this.http.postFile(
|
|
3057
|
+
`/workspace/document?${o.join("&")}`,
|
|
3058
|
+
i
|
|
3059
|
+
);
|
|
3060
|
+
if (this.http.isResponseError())
|
|
3061
|
+
throw this.http.latestResponse.statusText;
|
|
3062
|
+
return a;
|
|
3063
|
+
}
|
|
3064
|
+
async updateFile(e, t, s) {
|
|
3065
|
+
const { fullname: r, metadata: i } = this.extractMetadata(t), o = new FormData();
|
|
3066
|
+
o.append("file", t, r);
|
|
3067
|
+
const a = [];
|
|
3068
|
+
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}`);
|
|
3069
|
+
const c = await this.http.putFile(
|
|
3070
|
+
`/workspace/document/${e}?${a.join("&")}`,
|
|
3071
|
+
o
|
|
3072
|
+
);
|
|
3073
|
+
if (this.http.isResponseError())
|
|
3074
|
+
throw this.http.latestResponse.statusText;
|
|
3075
|
+
return c;
|
|
3076
|
+
}
|
|
3077
|
+
async deleteFile(e) {
|
|
3078
|
+
const t = e.map((s) => s._id);
|
|
3079
|
+
if (t.length == 0)
|
|
3080
|
+
Promise.resolve(null);
|
|
3081
|
+
else if (await this.http.deleteJson("/workspace/documents", {
|
|
3082
|
+
ids: t
|
|
3083
|
+
}), this.http.isResponseError())
|
|
3084
|
+
throw this.http.latestResponse.statusText;
|
|
3085
|
+
}
|
|
3086
|
+
async acceptDocuments(e) {
|
|
3087
|
+
const t = await this.context.session().getUser();
|
|
3088
|
+
return (s) => s.deleted && s.trasher ? (t == null ? void 0 : t.userId) == s.trasher : !0;
|
|
3089
|
+
}
|
|
3090
|
+
async searchDocuments(e) {
|
|
3091
|
+
const t = e.filter !== "external" || e.parentId ? await this.http.get("/workspace/documents", {
|
|
3092
|
+
queryParams: { ...e, _: (/* @__PURE__ */ new Date()).getTime() }
|
|
3093
|
+
}) : [], s = await this.acceptDocuments(e);
|
|
3094
|
+
return t.filter(s);
|
|
3095
|
+
}
|
|
3096
|
+
async listDocuments(e, t) {
|
|
3097
|
+
return this.searchDocuments({ filter: e, parentId: t, includeall: !0 });
|
|
3098
|
+
}
|
|
3099
|
+
/**
|
|
3100
|
+
* Duplicate and transfers documents if needed to a different folder with the specified application and visibility.
|
|
3101
|
+
* @param documents - The array of documents to transfer.
|
|
3102
|
+
* @param application - The application to associate with the transferred documents.
|
|
3103
|
+
* @param visibility - The visibility of the transferred documents. Defaults to "protected".
|
|
3104
|
+
* @returns A Promise that resolves to an array of transferred WorkspaceElements.
|
|
3105
|
+
*/
|
|
3106
|
+
async transferDocuments(e, t, s = "protected") {
|
|
3107
|
+
const r = [];
|
|
3108
|
+
if (e.forEach((i) => {
|
|
3109
|
+
(s === "public" && !i.public || !i.public && !i.protected) && r.push(i);
|
|
3110
|
+
}), r.length > 0) {
|
|
3111
|
+
const i = await this.http.post(
|
|
3112
|
+
"/workspace/documents/transfer",
|
|
3113
|
+
{
|
|
3114
|
+
application: t,
|
|
3115
|
+
visibility: s,
|
|
3116
|
+
ids: r.map((o) => o._id)
|
|
3117
|
+
}
|
|
3118
|
+
);
|
|
3119
|
+
if (this.http.isResponseError())
|
|
3120
|
+
throw this.http.latestResponse.statusText;
|
|
3121
|
+
return r.forEach((o, a) => {
|
|
3122
|
+
const c = e.findIndex(
|
|
3123
|
+
(h) => h._id === o._id
|
|
3124
|
+
);
|
|
3125
|
+
0 <= c && c < e.length && (e[c] = i[a]);
|
|
3126
|
+
}), e.filter((o) => !!o);
|
|
3127
|
+
}
|
|
3128
|
+
return e;
|
|
3129
|
+
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Get the URL of the thumbnail of a workspace element (or its URL),
|
|
3132
|
+
* or `null` if none exists or can be created.
|
|
3133
|
+
*/
|
|
3134
|
+
getThumbnailUrl(e, t = 0, s = 0) {
|
|
3135
|
+
var i, o;
|
|
3136
|
+
const r = t > 0 || s > 0 ? `${t}x${s}` : "120x120";
|
|
3137
|
+
if (typeof e == "string")
|
|
3138
|
+
return e.includes("data:image") || e.includes("thumbnail") ? e : `${e}${e.includes("?") ? "&" : "?"}thumbnail=${r}`;
|
|
3139
|
+
{
|
|
3140
|
+
const a = `/workspace/${e.public ? "pub/" : ""}document/${e._id}?thumbnail=`, c = e.thumbnails;
|
|
3141
|
+
if ((o = (i = e.metadata) == null ? void 0 : i["content-type"]) != null && o.includes("video")) {
|
|
3142
|
+
const h = c && Object.keys(c).length > 0 ? Object.keys(c)[0] : null;
|
|
3143
|
+
return h ? a + h : null;
|
|
3144
|
+
} else
|
|
3145
|
+
return a + r;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3102
3149
|
let ATTag;
|
|
3103
3150
|
class AnalyticsService {
|
|
3104
|
-
constructor(
|
|
3105
|
-
this.context =
|
|
3151
|
+
constructor(u) {
|
|
3152
|
+
this.context = u;
|
|
3106
3153
|
}
|
|
3107
3154
|
get http() {
|
|
3108
3155
|
return this.context.http();
|
|
@@ -3115,7 +3162,7 @@ class AnalyticsService {
|
|
|
3115
3162
|
* @param locationPath
|
|
3116
3163
|
* @param app
|
|
3117
3164
|
*/
|
|
3118
|
-
async trackPageLoad(
|
|
3165
|
+
async trackPageLoad(u, e) {
|
|
3119
3166
|
const [t] = await Promise.all([
|
|
3120
3167
|
// get Xiti configuration
|
|
3121
3168
|
this.getXitiConfig(e.name.toLowerCase()),
|
|
@@ -3125,7 +3172,7 @@ class AnalyticsService {
|
|
|
3125
3172
|
if (!t || !ATInternet) return;
|
|
3126
3173
|
let s = t.LIBELLE_SERVICE.default || null;
|
|
3127
3174
|
for (const r in t.LIBELLE_SERVICE)
|
|
3128
|
-
if (r !== "default" &&
|
|
3175
|
+
if (r !== "default" && u.indexOf(r) >= 0) {
|
|
3129
3176
|
s = t.LIBELLE_SERVICE[r];
|
|
3130
3177
|
break;
|
|
3131
3178
|
}
|
|
@@ -3152,7 +3199,7 @@ class AnalyticsService {
|
|
|
3152
3199
|
level2: t.STRUCT_UAI
|
|
3153
3200
|
}), ATTag.dispatch();
|
|
3154
3201
|
}
|
|
3155
|
-
async getXitiConfig(
|
|
3202
|
+
async getXitiConfig(u) {
|
|
3156
3203
|
const [e, t] = await Promise.all([
|
|
3157
3204
|
this.http.get("/analyticsConf"),
|
|
3158
3205
|
//FIXME change servers config to only keep the "all-in-one" query to /analyticsConf.
|
|
@@ -3160,7 +3207,7 @@ class AnalyticsService {
|
|
|
3160
3207
|
]);
|
|
3161
3208
|
if (!(e != null && e.type))
|
|
3162
3209
|
throw ERROR_CODE.MALFORMED_DATA;
|
|
3163
|
-
return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t,
|
|
3210
|
+
return t != null && t.active && (e.xiti = await this.getXitiTrackingParams(t, u)), e.xiti;
|
|
3164
3211
|
}
|
|
3165
3212
|
async loadXitiScript() {
|
|
3166
3213
|
if (typeof ATInternet > "u") {
|
|
@@ -3172,13 +3219,13 @@ class AnalyticsService {
|
|
|
3172
3219
|
eval(response);
|
|
3173
3220
|
}
|
|
3174
3221
|
}
|
|
3175
|
-
async getXitiTrackingParams(
|
|
3176
|
-
if (!
|
|
3222
|
+
async getXitiTrackingParams(u, e) {
|
|
3223
|
+
if (!u.structureMap || !e) return;
|
|
3177
3224
|
const t = await this.session.getUser(), s = await this.session.getUserProfile();
|
|
3178
3225
|
let r;
|
|
3179
3226
|
if (!(t != null && t.structures)) return;
|
|
3180
3227
|
for (const h of t.structures) {
|
|
3181
|
-
const l =
|
|
3228
|
+
const l = u.structureMap[h];
|
|
3182
3229
|
if (l && l.collectiviteId && l.UAI) {
|
|
3183
3230
|
r = l;
|
|
3184
3231
|
break;
|
|
@@ -3187,8 +3234,8 @@ class AnalyticsService {
|
|
|
3187
3234
|
if (!r || !r.active) return;
|
|
3188
3235
|
const i = await configure.Platform.apps.getPublicConf(e);
|
|
3189
3236
|
if (!i) return;
|
|
3190
|
-
const
|
|
3191
|
-
if (!
|
|
3237
|
+
const o = i.xiti;
|
|
3238
|
+
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
3192
3239
|
function a(h) {
|
|
3193
3240
|
let l = "";
|
|
3194
3241
|
for (let E = 0; E < h.length; E++)
|
|
@@ -3203,15 +3250,15 @@ class AnalyticsService {
|
|
|
3203
3250
|
Guest: "AUTRE"
|
|
3204
3251
|
};
|
|
3205
3252
|
return {
|
|
3206
|
-
LIBELLE_SERVICE:
|
|
3253
|
+
LIBELLE_SERVICE: o.LIBELLE_SERVICE,
|
|
3207
3254
|
// Which property of LIBELLE_SERVICE to use depends on the frontend.
|
|
3208
|
-
TYPE:
|
|
3209
|
-
OUTIL:
|
|
3255
|
+
TYPE: o.OUTIL ? "TIERS" : "NATIF",
|
|
3256
|
+
OUTIL: o.OUTIL ? o.OUTIL : "",
|
|
3210
3257
|
STRUCT_ID: r.collectiviteId,
|
|
3211
3258
|
STRUCT_UAI: r.UAI,
|
|
3212
|
-
PROJET: r.projetId ? r.projetId :
|
|
3213
|
-
EXPLOITANT:
|
|
3214
|
-
PLATFORME: r.plateformeId ? r.plateformeId :
|
|
3259
|
+
PROJET: r.projetId ? r.projetId : u.ID_PROJET,
|
|
3260
|
+
EXPLOITANT: u.ID_EXPLOITANT,
|
|
3261
|
+
PLATFORME: r.plateformeId ? r.plateformeId : u.ID_PLATEFORME,
|
|
3215
3262
|
ID_PERSO: a(t.userId),
|
|
3216
3263
|
PROFILE: s && s.length > 0 ? c[s[0]] ?? "" : ""
|
|
3217
3264
|
};
|
|
@@ -3235,7 +3282,7 @@ const w = class w {
|
|
|
3235
3282
|
async getVideoConf() {
|
|
3236
3283
|
var t;
|
|
3237
3284
|
const e = await this.conf.getPublicConf(
|
|
3238
|
-
APP$
|
|
3285
|
+
APP$4.VIDEO
|
|
3239
3286
|
);
|
|
3240
3287
|
return {
|
|
3241
3288
|
maxWeight: (e == null ? void 0 : e["max-videosize-mbytes"]) ?? w.MAX_WEIGHT,
|
|
@@ -3260,13 +3307,13 @@ const w = class w {
|
|
|
3260
3307
|
throw new Error("Invalid video file.");
|
|
3261
3308
|
if (!e.filename)
|
|
3262
3309
|
throw new Error("Invalid video filename");
|
|
3263
|
-
const i = `${e.browser.name} ${e.browser.version}`,
|
|
3264
|
-
|
|
3310
|
+
const i = `${e.browser.name} ${e.browser.version}`, o = new FormData();
|
|
3311
|
+
o.append("device", e.device || ""), o.append("browser", i), o.append("url", e.url), o.append("app", t), o.append("file", e.file, e.filename), o.append("weight", "" + e.file.size), o.append("captation", "" + s);
|
|
3265
3312
|
let a = `/video/encode?captation=${s}`;
|
|
3266
3313
|
r && (a += `&duration=${r}`);
|
|
3267
3314
|
const c = await this.http.post(
|
|
3268
3315
|
a,
|
|
3269
|
-
|
|
3316
|
+
o,
|
|
3270
3317
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
3271
3318
|
);
|
|
3272
3319
|
if (c.state == "running") {
|
|
@@ -3296,8 +3343,8 @@ const w = class w {
|
|
|
3296
3343
|
throw new Error("Video cannot be uploaded.");
|
|
3297
3344
|
}
|
|
3298
3345
|
};
|
|
3299
|
-
|
|
3300
|
-
|
|
3346
|
+
n(w, "MAX_WEIGHT", 50), // in Mbytes. Applies to uploaded videos.
|
|
3347
|
+
n(w, "MAX_DURATION", 3);
|
|
3301
3348
|
let VideoService = w;
|
|
3302
3349
|
class EmbedderService {
|
|
3303
3350
|
constructor(e) {
|
|
@@ -3334,9 +3381,9 @@ class EmbedderService {
|
|
|
3334
3381
|
urlIsFromPattern(e, t) {
|
|
3335
3382
|
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
3336
3383
|
let i = !0;
|
|
3337
|
-
const
|
|
3384
|
+
const o = t.match(s) || [], a = [];
|
|
3338
3385
|
return (t.match(r) || []).forEach((h, l) => {
|
|
3339
|
-
h.includes("ignore") || a.push(
|
|
3386
|
+
h.includes("ignore") || a.push(o[l]);
|
|
3340
3387
|
}), a.forEach((h) => {
|
|
3341
3388
|
if (!e.includes(h)) {
|
|
3342
3389
|
i = !1;
|
|
@@ -3367,7 +3414,7 @@ class EmbedderService {
|
|
|
3367
3414
|
for (const s of e.url)
|
|
3368
3415
|
if (this.urlIsFromPattern(t, s)) {
|
|
3369
3416
|
const r = new RegExp("{[a-zA-Z0-9_.]+}", "g"), i = s.match(r) || [];
|
|
3370
|
-
let
|
|
3417
|
+
let o = e.embed;
|
|
3371
3418
|
for (const a of i) {
|
|
3372
3419
|
let c = s.split(a)[0];
|
|
3373
3420
|
const h = c.split("}");
|
|
@@ -3378,9 +3425,9 @@ class EmbedderService {
|
|
|
3378
3425
|
const E = s.split(a)[1].split("{")[0];
|
|
3379
3426
|
E && (l = l.split(E)[0]);
|
|
3380
3427
|
const p = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
|
|
3381
|
-
|
|
3428
|
+
o = o.replace(p, l);
|
|
3382
3429
|
}
|
|
3383
|
-
return
|
|
3430
|
+
return o;
|
|
3384
3431
|
}
|
|
3385
3432
|
return "";
|
|
3386
3433
|
}
|
|
@@ -3393,7 +3440,7 @@ class AbstractBehaviourService {
|
|
|
3393
3440
|
//-----------------
|
|
3394
3441
|
//--- Utilities ---
|
|
3395
3442
|
//-----------------
|
|
3396
|
-
|
|
3443
|
+
n(this, "_cache");
|
|
3397
3444
|
this.context = e, this._cache = new CacheService(this.context);
|
|
3398
3445
|
}
|
|
3399
3446
|
getApplication() {
|
|
@@ -3427,14 +3474,14 @@ class AbstractBehaviourService {
|
|
|
3427
3474
|
class ActualitesBehaviour extends AbstractBehaviourService {
|
|
3428
3475
|
constructor() {
|
|
3429
3476
|
super(...arguments);
|
|
3430
|
-
|
|
3431
|
-
|
|
3477
|
+
n(this, "APP", "actualites");
|
|
3478
|
+
n(this, "RESOURCE", "actualites");
|
|
3432
3479
|
}
|
|
3433
3480
|
async loadResources() {
|
|
3434
3481
|
return (await this.httpGet(
|
|
3435
3482
|
"/actualites/linker/infos"
|
|
3436
3483
|
)).map((s) => {
|
|
3437
|
-
|
|
3484
|
+
let r;
|
|
3438
3485
|
return s.thread_icon ? r = s.thread_icon + "?thumbnail=48x48" : r = "/img/icons/glyphicons_036_file.png", this.dataToResource({
|
|
3439
3486
|
title: s.title + " [" + s.thread_title + "]",
|
|
3440
3487
|
ownerName: s.username,
|
|
@@ -3451,24 +3498,24 @@ class ActualitesBehaviour extends AbstractBehaviourService {
|
|
|
3451
3498
|
class BlogBehaviour extends AbstractBehaviourService {
|
|
3452
3499
|
constructor() {
|
|
3453
3500
|
super(...arguments);
|
|
3454
|
-
|
|
3455
|
-
|
|
3501
|
+
n(this, "APP", "blog");
|
|
3502
|
+
n(this, "RESOURCE", "blog");
|
|
3456
3503
|
}
|
|
3457
3504
|
loadResources() {
|
|
3458
3505
|
return new Promise(async (t, s) => {
|
|
3459
3506
|
try {
|
|
3460
3507
|
const r = await this.httpGet("/blog/linker"), i = [];
|
|
3461
|
-
r.forEach((
|
|
3462
|
-
|
|
3463
|
-
const a =
|
|
3464
|
-
owner:
|
|
3465
|
-
ownerName:
|
|
3466
|
-
title: c.title + " [" +
|
|
3467
|
-
_id: `${
|
|
3468
|
-
icon:
|
|
3469
|
-
path: `/blog/id/${
|
|
3470
|
-
shared: !!(
|
|
3471
|
-
modified:
|
|
3508
|
+
r.forEach((o) => {
|
|
3509
|
+
o.thumbnail ? o.thumbnail = o.thumbnail + "?thumbnail=48x48" : o.thumbnail = "/img/illustrations/blog.svg";
|
|
3510
|
+
const a = o.fetchPosts.map((c) => this.dataToResource({
|
|
3511
|
+
owner: o.author.userId,
|
|
3512
|
+
ownerName: o.author.username,
|
|
3513
|
+
title: c.title + " [" + o.title + "]",
|
|
3514
|
+
_id: `${o._id}#${c._id}`,
|
|
3515
|
+
icon: o.thumbnail,
|
|
3516
|
+
path: `/blog/id/${o._id}/post/${c._id}`,
|
|
3517
|
+
shared: !!(o.shared && o.shared.length >= 0),
|
|
3518
|
+
modified: o.modified
|
|
3472
3519
|
}));
|
|
3473
3520
|
i.push(...a);
|
|
3474
3521
|
}), t(i);
|
|
@@ -3481,8 +3528,8 @@ class BlogBehaviour extends AbstractBehaviourService {
|
|
|
3481
3528
|
class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
3482
3529
|
constructor() {
|
|
3483
3530
|
super(...arguments);
|
|
3484
|
-
|
|
3485
|
-
|
|
3531
|
+
n(this, "APP", "collaborativewall");
|
|
3532
|
+
n(this, "RESOURCE", "collaborativewall");
|
|
3486
3533
|
}
|
|
3487
3534
|
async loadResources() {
|
|
3488
3535
|
return (await this.httpGet(
|
|
@@ -3504,14 +3551,14 @@ class CollaborativewallBehaviour extends AbstractBehaviourService {
|
|
|
3504
3551
|
class CommunityBehaviour extends AbstractBehaviourService {
|
|
3505
3552
|
constructor() {
|
|
3506
3553
|
super(...arguments);
|
|
3507
|
-
|
|
3508
|
-
|
|
3554
|
+
n(this, "APP", "community");
|
|
3555
|
+
n(this, "RESOURCE", "community");
|
|
3509
3556
|
}
|
|
3510
3557
|
async loadResources() {
|
|
3511
3558
|
return (await this.httpGet(
|
|
3512
3559
|
"/community/listallpages"
|
|
3513
3560
|
)).map((s) => {
|
|
3514
|
-
|
|
3561
|
+
let r;
|
|
3515
3562
|
return typeof s.thumbnail > "u" || s.thumbnail === "" ? r = "/img/icons/glyphicons_036_file.png" : r = s.thumbnail + "?thumbnail=48x48", this.dataToResource({
|
|
3516
3563
|
title: s.name,
|
|
3517
3564
|
icon: r,
|
|
@@ -3529,23 +3576,24 @@ class CommunityBehaviour extends AbstractBehaviourService {
|
|
|
3529
3576
|
class ExercizerBehaviour extends AbstractBehaviourService {
|
|
3530
3577
|
constructor() {
|
|
3531
3578
|
super(...arguments);
|
|
3532
|
-
|
|
3533
|
-
|
|
3579
|
+
n(this, "APP", "exercizer");
|
|
3580
|
+
n(this, "RESOURCE", "exercizer");
|
|
3534
3581
|
}
|
|
3535
3582
|
async loadResources() {
|
|
3536
3583
|
return (await this.httpGet(
|
|
3537
3584
|
"/exercizer/subjects-scheduled"
|
|
3538
3585
|
)).map((s) => {
|
|
3539
3586
|
const r = s.picture ? s.picture + "?thumbnail=48x48" : "/img/illustrations/exercizer.svg";
|
|
3540
|
-
let i,
|
|
3541
|
-
|
|
3587
|
+
let i, o = !1;
|
|
3588
|
+
const a = JSON.parse(s.scheduled_at);
|
|
3589
|
+
return a.groupList.length > 0 ? (o = !0, i = a.groupList[0].name) : a.userList.length > 0 ? (o = !0, i = a.userList[0].name) : i = "", a.groupList.length + a.userList.length > 1 && (i += "..."), this.dataToResource({
|
|
3542
3590
|
title: s.title,
|
|
3543
3591
|
owner: s.owner,
|
|
3544
3592
|
ownerName: i,
|
|
3545
3593
|
icon: r,
|
|
3546
3594
|
path: "/exercizer#/linker/" + s.id,
|
|
3547
3595
|
_id: "" + s.id,
|
|
3548
|
-
shared:
|
|
3596
|
+
shared: o,
|
|
3549
3597
|
modified: s.modified
|
|
3550
3598
|
});
|
|
3551
3599
|
});
|
|
@@ -3554,8 +3602,8 @@ class ExercizerBehaviour extends AbstractBehaviourService {
|
|
|
3554
3602
|
class FormulaireBehaviour extends AbstractBehaviourService {
|
|
3555
3603
|
constructor() {
|
|
3556
3604
|
super(...arguments);
|
|
3557
|
-
|
|
3558
|
-
|
|
3605
|
+
n(this, "APP", "formulaire");
|
|
3606
|
+
n(this, "RESOURCE", "formulaire");
|
|
3559
3607
|
}
|
|
3560
3608
|
async loadResources() {
|
|
3561
3609
|
return (await this.httpGet(
|
|
@@ -3575,8 +3623,8 @@ class FormulaireBehaviour extends AbstractBehaviourService {
|
|
|
3575
3623
|
class ForumBehaviour extends AbstractBehaviourService {
|
|
3576
3624
|
constructor() {
|
|
3577
3625
|
super(...arguments);
|
|
3578
|
-
|
|
3579
|
-
|
|
3626
|
+
n(this, "APP", "forum");
|
|
3627
|
+
n(this, "RESOURCE", "forum");
|
|
3580
3628
|
}
|
|
3581
3629
|
async loadResources() {
|
|
3582
3630
|
return (await this.httpGet("/forum/categories")).map(
|
|
@@ -3596,8 +3644,8 @@ class ForumBehaviour extends AbstractBehaviourService {
|
|
|
3596
3644
|
class HomeworksBehaviour extends AbstractBehaviourService {
|
|
3597
3645
|
constructor() {
|
|
3598
3646
|
super(...arguments);
|
|
3599
|
-
|
|
3600
|
-
|
|
3647
|
+
n(this, "APP", "homeworks");
|
|
3648
|
+
n(this, "RESOURCE", "homeworks");
|
|
3601
3649
|
}
|
|
3602
3650
|
async loadResources() {
|
|
3603
3651
|
return (await this.httpGet("/homeworks/list")).filter((t) => t.owner && t.trashed === 0).map((t) => this.dataToResource({
|
|
@@ -3615,8 +3663,8 @@ class HomeworksBehaviour extends AbstractBehaviourService {
|
|
|
3615
3663
|
class MagnetoBehaviour extends AbstractBehaviourService {
|
|
3616
3664
|
constructor() {
|
|
3617
3665
|
super(...arguments);
|
|
3618
|
-
|
|
3619
|
-
|
|
3666
|
+
n(this, "APP", "magneto");
|
|
3667
|
+
n(this, "RESOURCE", "magneto");
|
|
3620
3668
|
}
|
|
3621
3669
|
async loadResources() {
|
|
3622
3670
|
const { all: t } = await this.httpGet(
|
|
@@ -3637,8 +3685,8 @@ class MagnetoBehaviour extends AbstractBehaviourService {
|
|
|
3637
3685
|
class MindmapBehaviour extends AbstractBehaviourService {
|
|
3638
3686
|
constructor() {
|
|
3639
3687
|
super(...arguments);
|
|
3640
|
-
|
|
3641
|
-
|
|
3688
|
+
n(this, "APP", "mindmap");
|
|
3689
|
+
n(this, "RESOURCE", "mindmap");
|
|
3642
3690
|
}
|
|
3643
3691
|
async loadResources() {
|
|
3644
3692
|
return (await this.httpGet("/mindmap/list/all")).map(
|
|
@@ -3658,13 +3706,13 @@ class MindmapBehaviour extends AbstractBehaviourService {
|
|
|
3658
3706
|
class PagesBehaviour extends AbstractBehaviourService {
|
|
3659
3707
|
constructor() {
|
|
3660
3708
|
super(...arguments);
|
|
3661
|
-
|
|
3662
|
-
|
|
3709
|
+
n(this, "APP", "pages");
|
|
3710
|
+
n(this, "RESOURCE", "pages");
|
|
3663
3711
|
}
|
|
3664
3712
|
async loadResources() {
|
|
3665
3713
|
const t = await this.httpGet("/pages/list/all"), s = [];
|
|
3666
3714
|
return t.forEach((r) => {
|
|
3667
|
-
var
|
|
3715
|
+
var o;
|
|
3668
3716
|
const i = r.thumbnail ? r.thumbnail + "?thumbnail=48x48" : "/img/illustrations/pages.svg";
|
|
3669
3717
|
s.push(
|
|
3670
3718
|
this.dataToResource({
|
|
@@ -3677,7 +3725,7 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3677
3725
|
shared: typeof r.shared < "u",
|
|
3678
3726
|
modified: r.modified
|
|
3679
3727
|
})
|
|
3680
|
-
), (
|
|
3728
|
+
), (o = r.pages) == null || o.forEach((a) => {
|
|
3681
3729
|
s.push(
|
|
3682
3730
|
this.dataToResource({
|
|
3683
3731
|
title: a.title,
|
|
@@ -3697,8 +3745,8 @@ class PagesBehaviour extends AbstractBehaviourService {
|
|
|
3697
3745
|
class PollBehaviour extends AbstractBehaviourService {
|
|
3698
3746
|
constructor() {
|
|
3699
3747
|
super(...arguments);
|
|
3700
|
-
|
|
3701
|
-
|
|
3748
|
+
n(this, "APP", "poll");
|
|
3749
|
+
n(this, "RESOURCE", "poll");
|
|
3702
3750
|
}
|
|
3703
3751
|
async loadResources() {
|
|
3704
3752
|
return (await this.httpGet("/poll/list/all")).map((s) => {
|
|
@@ -3719,8 +3767,8 @@ class PollBehaviour extends AbstractBehaviourService {
|
|
|
3719
3767
|
class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
3720
3768
|
constructor() {
|
|
3721
3769
|
super(...arguments);
|
|
3722
|
-
|
|
3723
|
-
|
|
3770
|
+
n(this, "APP", "scrapbook");
|
|
3771
|
+
n(this, "RESOURCE", "scrapbook");
|
|
3724
3772
|
}
|
|
3725
3773
|
async loadResources() {
|
|
3726
3774
|
return (await this.httpGet(
|
|
@@ -3743,25 +3791,25 @@ class ScrapbookBehaviour extends AbstractBehaviourService {
|
|
|
3743
3791
|
class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
3744
3792
|
constructor() {
|
|
3745
3793
|
super(...arguments);
|
|
3746
|
-
|
|
3747
|
-
|
|
3794
|
+
n(this, "APP", "timelinegenerator");
|
|
3795
|
+
n(this, "RESOURCE", "timelinegenerator");
|
|
3748
3796
|
}
|
|
3749
3797
|
loadResources() {
|
|
3750
3798
|
return new Promise(async (t, s) => {
|
|
3751
3799
|
try {
|
|
3752
3800
|
const i = (await this.httpGet(
|
|
3753
3801
|
"/timelinegenerator/timelines"
|
|
3754
|
-
)).map((
|
|
3755
|
-
const a =
|
|
3802
|
+
)).map((o) => {
|
|
3803
|
+
const a = o.icon || "/img/illustrations/timeline-default.png";
|
|
3756
3804
|
return this.dataToResource({
|
|
3757
|
-
title:
|
|
3758
|
-
ownerName:
|
|
3759
|
-
owner:
|
|
3805
|
+
title: o.headline,
|
|
3806
|
+
ownerName: o.owner.displayName,
|
|
3807
|
+
owner: o.owner.userId,
|
|
3760
3808
|
icon: a,
|
|
3761
|
-
path: "/timelinegenerator#/view/" +
|
|
3762
|
-
_id:
|
|
3763
|
-
shared: typeof
|
|
3764
|
-
modified:
|
|
3809
|
+
path: "/timelinegenerator#/view/" + o._id,
|
|
3810
|
+
_id: o._id,
|
|
3811
|
+
shared: typeof o.shared < "u",
|
|
3812
|
+
modified: o.modified
|
|
3765
3813
|
});
|
|
3766
3814
|
});
|
|
3767
3815
|
t(i);
|
|
@@ -3774,8 +3822,8 @@ class TimelinegeneratorBehaviour extends AbstractBehaviourService {
|
|
|
3774
3822
|
class WikiBehaviour extends AbstractBehaviourService {
|
|
3775
3823
|
constructor() {
|
|
3776
3824
|
super(...arguments);
|
|
3777
|
-
|
|
3778
|
-
|
|
3825
|
+
n(this, "APP", "wiki");
|
|
3826
|
+
n(this, "RESOURCE", "wiki");
|
|
3779
3827
|
}
|
|
3780
3828
|
async loadResources() {
|
|
3781
3829
|
return (await this.httpGet(
|
|
@@ -3798,15 +3846,15 @@ class WikiBehaviour extends AbstractBehaviourService {
|
|
|
3798
3846
|
class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
3799
3847
|
constructor() {
|
|
3800
3848
|
super(...arguments);
|
|
3801
|
-
|
|
3802
|
-
|
|
3849
|
+
n(this, "APP", "workspace");
|
|
3850
|
+
n(this, "RESOURCE", "workspace");
|
|
3803
3851
|
}
|
|
3804
3852
|
loadResources({ search: t, asset_id: s }) {
|
|
3805
3853
|
return new Promise(async (r, i) => {
|
|
3806
3854
|
try {
|
|
3807
|
-
let
|
|
3808
|
-
s && s.length ?
|
|
3809
|
-
const c = (await this.httpGet(
|
|
3855
|
+
let o = "/workspace/documents?filter=all&hierarchical=true";
|
|
3856
|
+
s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
|
|
3857
|
+
const c = (await this.httpGet(o)).filter((h) => !h.deleted).map((h) => {
|
|
3810
3858
|
const l = h.metadata["content-type"] && h.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${h._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
3811
3859
|
return this.dataToResource({
|
|
3812
3860
|
title: h.name,
|
|
@@ -3820,8 +3868,8 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
3820
3868
|
});
|
|
3821
3869
|
});
|
|
3822
3870
|
r(c);
|
|
3823
|
-
} catch (
|
|
3824
|
-
i(
|
|
3871
|
+
} catch (o) {
|
|
3872
|
+
i(o);
|
|
3825
3873
|
}
|
|
3826
3874
|
});
|
|
3827
3875
|
}
|
|
@@ -3837,7 +3885,7 @@ const y = class y {
|
|
|
3837
3885
|
e.session().getUser()
|
|
3838
3886
|
]);
|
|
3839
3887
|
i != null && i.apps && (r != null && r.length) && (this.resourceProducingApps = r.filter(
|
|
3840
|
-
(
|
|
3888
|
+
(o) => i.apps.some((a) => a.address.includes(o))
|
|
3841
3889
|
));
|
|
3842
3890
|
} catch (r) {
|
|
3843
3891
|
console.warn("Failed to load resource-producing apps:", r);
|
|
@@ -3914,13 +3962,13 @@ const y = class y {
|
|
|
3914
3962
|
//
|
|
3915
3963
|
// STATIC REGISTRY
|
|
3916
3964
|
//
|
|
3917
|
-
|
|
3918
|
-
|
|
3965
|
+
n(y, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
3966
|
+
n(y, "findBehaviour", y.registry.findService.bind(y.registry)), n(y, "hasBehaviour", y.registry.isRegistered.bind(y.registry)), n(y, "resourceProducingApps", []);
|
|
3919
3967
|
let SnipletsService = y;
|
|
3920
3968
|
const SEND_ALL = "*";
|
|
3921
3969
|
class WebBroker {
|
|
3922
3970
|
constructor(e) {
|
|
3923
|
-
|
|
3971
|
+
n(this, "subscription");
|
|
3924
3972
|
this.odeServices = e;
|
|
3925
3973
|
}
|
|
3926
3974
|
get http() {
|
|
@@ -3952,10 +4000,10 @@ class WebBroker {
|
|
|
3952
4000
|
}
|
|
3953
4001
|
class DataService {
|
|
3954
4002
|
constructor(e) {
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
4003
|
+
n(this, "_webBroker");
|
|
4004
|
+
n(this, "app");
|
|
4005
|
+
n(this, "user");
|
|
4006
|
+
n(this, "profile");
|
|
3959
4007
|
this.odeServices = e;
|
|
3960
4008
|
}
|
|
3961
4009
|
get conf() {
|
|
@@ -3989,12 +4037,12 @@ class DataService {
|
|
|
3989
4037
|
addUserInfos(e) {
|
|
3990
4038
|
return this.user && (e.userId = this.user.userId, e.structure = this.user.structureNames[0]), this.profile && (e.profil = this.profile[0]), e;
|
|
3991
4039
|
}
|
|
3992
|
-
trackVideoSave(e, t, s, r, i,
|
|
4040
|
+
trackVideoSave(e, t, s, r, i, o, a) {
|
|
3993
4041
|
const c = this.addUserInfos({
|
|
3994
4042
|
"event-type": "VIDEO_SAVE",
|
|
3995
4043
|
module: "video",
|
|
3996
4044
|
video_id: e,
|
|
3997
|
-
browser:
|
|
4045
|
+
browser: o,
|
|
3998
4046
|
duration: Math.round(t),
|
|
3999
4047
|
weight: s,
|
|
4000
4048
|
source: r ? "CAPTURED" : "UPLOADED",
|
|
@@ -4003,7 +4051,7 @@ class DataService {
|
|
|
4003
4051
|
this.app && (c["override-module"] = this.app), a && (c.device_type = a), this.trackWebEvent(c);
|
|
4004
4052
|
}
|
|
4005
4053
|
trackVideoRead(e, t, s, r, i) {
|
|
4006
|
-
const
|
|
4054
|
+
const o = this.addUserInfos({
|
|
4007
4055
|
"event-type": "VIDEO_READ",
|
|
4008
4056
|
module: "video",
|
|
4009
4057
|
video_id: e,
|
|
@@ -4011,7 +4059,7 @@ class DataService {
|
|
|
4011
4059
|
source: t ? "CAPTURED" : "UPLOADED",
|
|
4012
4060
|
url: s
|
|
4013
4061
|
});
|
|
4014
|
-
this.app && (
|
|
4062
|
+
this.app && (o["override-module"] = this.app), i && (o.device_type = i), this.trackWebEvent(o);
|
|
4015
4063
|
}
|
|
4016
4064
|
trackSpeechAndText(e) {
|
|
4017
4065
|
const t = this.addUserInfos({
|
|
@@ -4117,20 +4165,20 @@ class AudienceService {
|
|
|
4117
4165
|
}
|
|
4118
4166
|
class OdeServices {
|
|
4119
4167
|
constructor() {
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4168
|
+
n(this, "_analytics");
|
|
4169
|
+
n(this, "_cache");
|
|
4170
|
+
n(this, "_conf");
|
|
4171
|
+
n(this, "_data");
|
|
4172
|
+
n(this, "_directory");
|
|
4173
|
+
n(this, "_http");
|
|
4174
|
+
n(this, "_idiom");
|
|
4175
|
+
n(this, "_notify");
|
|
4176
|
+
n(this, "_rights");
|
|
4177
|
+
n(this, "_session");
|
|
4178
|
+
n(this, "_share");
|
|
4179
|
+
n(this, "_video");
|
|
4180
|
+
n(this, "_workspace");
|
|
4181
|
+
n(this, "_embedder");
|
|
4134
4182
|
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);
|
|
4135
4183
|
}
|
|
4136
4184
|
initialize() {
|
|
@@ -4263,9 +4311,9 @@ class TransportFrameworkFactory {
|
|
|
4263
4311
|
return transport;
|
|
4264
4312
|
}
|
|
4265
4313
|
}
|
|
4266
|
-
const isActionAvailable = (
|
|
4314
|
+
const isActionAvailable = (u, e) => {
|
|
4267
4315
|
const t = e == null ? void 0 : e.filter(
|
|
4268
|
-
(s) => s.id ===
|
|
4316
|
+
(s) => s.id === u && s.available
|
|
4269
4317
|
);
|
|
4270
4318
|
return t && t.length > 0;
|
|
4271
4319
|
}, firstLevelWidgets = [
|
|
@@ -4332,10 +4380,10 @@ const isActionAvailable = (o, e) => {
|
|
|
4332
4380
|
class WidgetFramework {
|
|
4333
4381
|
constructor() {
|
|
4334
4382
|
//-------------------------------------
|
|
4335
|
-
|
|
4336
|
-
|
|
4383
|
+
n(this, "_initialized");
|
|
4384
|
+
n(this, "_widgets", []);
|
|
4337
4385
|
////////////////////////////////////// USER PREFERENCES
|
|
4338
|
-
|
|
4386
|
+
n(this, "_userPrefs", {});
|
|
4339
4387
|
}
|
|
4340
4388
|
initialize(e, t) {
|
|
4341
4389
|
return this._initialized || (this._initialized = new Promisified(), notify.onSessionReady().promise.then((s) => {
|
|
@@ -4346,8 +4394,8 @@ class WidgetFramework {
|
|
|
4346
4394
|
var i;
|
|
4347
4395
|
(i = this._initialized) == null || i.resolve();
|
|
4348
4396
|
}).catch((i) => {
|
|
4349
|
-
var
|
|
4350
|
-
(
|
|
4397
|
+
var o;
|
|
4398
|
+
(o = this._initialized) == null || o.reject();
|
|
4351
4399
|
})) : (r = this._initialized) == null || r.reject();
|
|
4352
4400
|
})), this._initialized.promise;
|
|
4353
4401
|
}
|
|
@@ -4388,9 +4436,9 @@ class WidgetFramework {
|
|
|
4388
4436
|
position: c.platformConf.position
|
|
4389
4437
|
}), 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);
|
|
4390
4438
|
});
|
|
4391
|
-
const
|
|
4439
|
+
const o = new Idiom();
|
|
4392
4440
|
this._widgets = this._widgets.sort((c, h) => {
|
|
4393
|
-
const l =
|
|
4441
|
+
const l = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${h.platformConf.name}`).toLowerCase();
|
|
4394
4442
|
return l < E ? -1 : l > E ? 1 : 0;
|
|
4395
4443
|
});
|
|
4396
4444
|
});
|
|
@@ -4399,8 +4447,8 @@ class WidgetFramework {
|
|
|
4399
4447
|
class Widget {
|
|
4400
4448
|
//-------------------------------------
|
|
4401
4449
|
constructor(e) {
|
|
4402
|
-
|
|
4403
|
-
|
|
4450
|
+
n(this, "_schoolConf", {});
|
|
4451
|
+
n(this, "_userPref");
|
|
4404
4452
|
this._platformConf = e, this._userPref = null;
|
|
4405
4453
|
}
|
|
4406
4454
|
get platformConf() {
|
|
@@ -4459,7 +4507,7 @@ class WidgetFrameworkFactory {
|
|
|
4459
4507
|
}
|
|
4460
4508
|
export {
|
|
4461
4509
|
ACTION,
|
|
4462
|
-
APP$
|
|
4510
|
+
APP$4 as APP,
|
|
4463
4511
|
BOOLEAN_FILTER,
|
|
4464
4512
|
ConfigurationFrameworkFactory,
|
|
4465
4513
|
DocumentHelper,
|