@cartesianui/js 1.0.0 → 2.1.0
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/README.md +2 -2
- package/{axis.d.ts → cartesian.d.ts} +5 -5
- package/{axis.js → cartesian.js} +303 -268
- package/cartesian.message.swal.min.js +1 -0
- package/cartesian.min.js +1 -0
- package/cartesian.moment.min.js +1 -0
- package/cartesian.notification.swal.min.js +1 -0
- package/cartesian.ui.freeze.min.js +1 -0
- package/package.json +49 -48
- package/axis.message.swal.min.js +0 -1
- package/axis.min.js +0 -1
- package/axis.moment.min.js +0 -1
- package/axis.notification.swal.min.js +0 -1
- package/axis.ui.freeze.min.js +0 -1
package/{axis.js → cartesian.js}
RENAMED
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var axis = axis || {};
|
|
1
|
+
var cartesian = cartesian || {};
|
|
4
2
|
(function () {
|
|
5
|
-
|
|
3
|
+
cartesian.tenancy = cartesian.tenancy || {};
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
cartesian.tenancy.isEnabled = false;
|
|
6
|
+
cartesian.tenancy.headerAttribute = 'Cartesian-Host';
|
|
7
|
+
cartesian.tenancy.ignoreFeatureCheckForHostUsers = false;
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
cartesian.tenancy.sides = {
|
|
12
10
|
TENANT: 1,
|
|
13
11
|
HOST: 2,
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
cartesian.tenancy.tenantIdCookieName = "Cartesian.TenantId";
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
cartesian.tenancy.setTenantIdCookie = function (tenantId) {
|
|
19
17
|
if (tenantId) {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
cartesian.utils.setCookieValue(
|
|
19
|
+
cartesian.tenancy.tenantIdCookieName,
|
|
22
20
|
tenantId.toString(),
|
|
23
21
|
new Date(new Date().getTime() + 5 * 365 * 86400000), //5 years
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
cartesian.appPath,
|
|
23
|
+
cartesian.domain
|
|
26
24
|
);
|
|
27
25
|
} else {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
cartesian.utils.deleteCookie(
|
|
27
|
+
cartesian.tenancy.tenantIdCookieName,
|
|
28
|
+
cartesian.appPath
|
|
31
29
|
);
|
|
32
30
|
}
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
var value =
|
|
33
|
+
cartesian.tenancy.getTenantIdCookie = function () {
|
|
34
|
+
var value = cartesian.utils.getCookieValue(cartesian.tenancy.tenantIdCookieName);
|
|
37
35
|
if (!value) {
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
@@ -42,26 +40,26 @@ var axis = axis || {};
|
|
|
42
40
|
};
|
|
43
41
|
})();
|
|
44
42
|
|
|
45
|
-
var
|
|
43
|
+
var cartesian = cartesian || {};
|
|
46
44
|
(function () {
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
cartesian.localization = cartesian.localization || {};
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
cartesian.localization.languages = [];
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
cartesian.localization.currentLanguage = {};
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
cartesian.localization.sources = [];
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
cartesian.localization.values = {};
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
sourceName = sourceName ||
|
|
56
|
+
cartesian.localization.localize = function (key, sourceName) {
|
|
57
|
+
sourceName = sourceName || cartesian.localization.defaultSourceName;
|
|
60
58
|
|
|
61
|
-
var source =
|
|
59
|
+
var source = cartesian.localization.values[sourceName];
|
|
62
60
|
|
|
63
61
|
if (!source) {
|
|
64
|
-
|
|
62
|
+
cartesian.log.warn("Could not find localization source: " + sourceName);
|
|
65
63
|
return key;
|
|
66
64
|
}
|
|
67
65
|
|
|
@@ -74,67 +72,104 @@ var axis = axis || {};
|
|
|
74
72
|
copiedArguments.splice(1, 1);
|
|
75
73
|
copiedArguments[0] = value;
|
|
76
74
|
|
|
77
|
-
return
|
|
75
|
+
return cartesian.utils.formatString.apply(this, copiedArguments);
|
|
78
76
|
};
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
cartesian.localization.getSource = function (sourceName) {
|
|
81
79
|
return function (key) {
|
|
82
80
|
var copiedArguments = Array.prototype.slice.call(arguments, 0);
|
|
83
81
|
copiedArguments.splice(1, 0, sourceName);
|
|
84
|
-
return
|
|
82
|
+
return cartesian.localization.localize.apply(this, copiedArguments);
|
|
85
83
|
};
|
|
86
84
|
};
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
cartesian.localization.isCurrentCulture = function (name) {
|
|
89
87
|
return (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
cartesian.localization.currentCulture &&
|
|
89
|
+
cartesian.localization.currentCulture.name &&
|
|
90
|
+
cartesian.localization.currentCulture.name.indexOf(name) == 0
|
|
93
91
|
);
|
|
94
92
|
};
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
cartesian.localization.defaultSourceName = undefined;
|
|
95
|
+
cartesian.localization.web = cartesian.localization.getSource("web");
|
|
98
96
|
})();
|
|
99
97
|
|
|
100
|
-
// Implements Authorization API that simplifies usage of authorization scripts generated by
|
|
101
|
-
var
|
|
98
|
+
// Implements Authorization API that simplifies usage of authorization scripts generated by Cartesian.
|
|
99
|
+
var cartesian = cartesian || {};
|
|
102
100
|
(function () {
|
|
103
|
-
|
|
101
|
+
cartesian.auth = cartesian.auth || {};
|
|
102
|
+
|
|
103
|
+
cartesian.auth.allPermissions = cartesian.auth.allPermissions || {};
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
cartesian.auth.grantedPermissions = cartesian.auth.grantedPermissions || {};
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
cartesian.auth.assignedRoles = cartesian.auth.assignedRoles || [];
|
|
108
108
|
|
|
109
|
-
//Deprecated. Use
|
|
110
|
-
|
|
111
|
-
return
|
|
109
|
+
//Deprecated. Use cartesian.auth.isGranted instead.
|
|
110
|
+
cartesian.auth.hasPermission = function (permissionName) {
|
|
111
|
+
return cartesian.auth.isGranted.apply(this, arguments);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
//Deprecated. Use
|
|
115
|
-
|
|
116
|
-
return
|
|
114
|
+
//Deprecated. Use cartesian.auth.isAnyGranted instead.
|
|
115
|
+
cartesian.auth.hasAnyOfPermissions = function () {
|
|
116
|
+
return cartesian.auth.isAnyGranted.apply(this, arguments);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
//Deprecated. Use
|
|
120
|
-
|
|
121
|
-
return
|
|
119
|
+
//Deprecated. Use cartesian.auth.areAllGranted instead.
|
|
120
|
+
cartesian.auth.hasAllOfPermissions = function () {
|
|
121
|
+
return cartesian.auth.areAllGranted.apply(this, arguments);
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
cartesian.auth.isGranted = function (permissionName) {
|
|
125
125
|
return (
|
|
126
|
-
(
|
|
127
|
-
(
|
|
126
|
+
(cartesian.auth.allPermissions[permissionName] !== undefined && cartesian.auth.grantedPermissions[permissionName] !== undefined ) ||
|
|
127
|
+
(cartesian.auth.allPermissions.indexOf(permissionName) !== -1 && cartesian.auth.grantedPermissions.indexOf(permissionName) !== -1)
|
|
128
128
|
);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
cartesian.auth.isAnyGranted = function () {
|
|
132
|
+
if (!arguments || arguments.length <= 0) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
137
|
+
if (cartesian.auth.isGranted(arguments[i])) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return false;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
cartesian.auth.areAllGranted = function () {
|
|
146
|
+
if (!arguments || arguments.length <= 0) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
151
|
+
if (!cartesian.auth.isGranted(arguments[i])) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return true;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
cartesian.auth.hasRole = function (roleName) {
|
|
160
|
+
if (!roleName) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return cartesian.auth.assignedRoles.indexOf(roleName) !== -1;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
cartesian.auth.hasAnyRole = function () {
|
|
132
167
|
if (!arguments || arguments.length <= 0) {
|
|
133
168
|
return true;
|
|
134
169
|
}
|
|
135
170
|
|
|
136
171
|
for (var i = 0; i < arguments.length; i++) {
|
|
137
|
-
if (
|
|
172
|
+
if (cartesian.auth.hasRole(arguments[i])) {
|
|
138
173
|
return true;
|
|
139
174
|
}
|
|
140
175
|
}
|
|
@@ -142,13 +177,13 @@ var axis = axis || {};
|
|
|
142
177
|
return false;
|
|
143
178
|
};
|
|
144
179
|
|
|
145
|
-
|
|
180
|
+
cartesian.auth.hasAllRoles = function () {
|
|
146
181
|
if (!arguments || arguments.length <= 0) {
|
|
147
182
|
return true;
|
|
148
183
|
}
|
|
149
184
|
|
|
150
185
|
for (var i = 0; i < arguments.length; i++) {
|
|
151
|
-
if (!
|
|
186
|
+
if (!cartesian.auth.hasRole(arguments[i])) {
|
|
152
187
|
return false;
|
|
153
188
|
}
|
|
154
189
|
}
|
|
@@ -156,60 +191,60 @@ var axis = axis || {};
|
|
|
156
191
|
return true;
|
|
157
192
|
};
|
|
158
193
|
|
|
159
|
-
|
|
194
|
+
cartesian.auth.tokenCookieName = "Cartesian.AuthToken";
|
|
160
195
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
196
|
+
cartesian.auth.setToken = function (authToken, expireDate) {
|
|
197
|
+
cartesian.utils.setCookieValue(
|
|
198
|
+
cartesian.auth.tokenCookieName,
|
|
164
199
|
authToken,
|
|
165
200
|
expireDate,
|
|
166
|
-
|
|
167
|
-
|
|
201
|
+
cartesian.appPath,
|
|
202
|
+
cartesian.domain
|
|
168
203
|
);
|
|
169
204
|
};
|
|
170
205
|
|
|
171
|
-
|
|
172
|
-
return
|
|
206
|
+
cartesian.auth.getToken = function () {
|
|
207
|
+
return cartesian.utils.getCookieValue(cartesian.auth.tokenCookieName);
|
|
173
208
|
};
|
|
174
209
|
|
|
175
|
-
|
|
176
|
-
|
|
210
|
+
cartesian.auth.clearToken = function () {
|
|
211
|
+
cartesian.auth.setToken();
|
|
177
212
|
};
|
|
178
213
|
|
|
179
|
-
|
|
214
|
+
cartesian.auth.refreshTokenCookieName = "Cartesian.AuthRefreshToken";
|
|
180
215
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
216
|
+
cartesian.auth.setRefreshToken = function (refreshToken, expireDate) {
|
|
217
|
+
cartesian.utils.setCookieValue(
|
|
218
|
+
cartesian.auth.refreshTokenCookieName,
|
|
184
219
|
refreshToken,
|
|
185
220
|
expireDate,
|
|
186
|
-
|
|
187
|
-
|
|
221
|
+
cartesian.appPath,
|
|
222
|
+
cartesian.domain
|
|
188
223
|
);
|
|
189
224
|
};
|
|
190
225
|
|
|
191
|
-
|
|
192
|
-
return
|
|
226
|
+
cartesian.auth.getRefreshToken = function () {
|
|
227
|
+
return cartesian.utils.getCookieValue(cartesian.auth.refreshTokenCookieName);
|
|
193
228
|
};
|
|
194
229
|
|
|
195
|
-
|
|
196
|
-
|
|
230
|
+
cartesian.auth.clearRefreshToken = function () {
|
|
231
|
+
cartesian.auth.setRefreshToken();
|
|
197
232
|
};
|
|
198
233
|
})();
|
|
199
234
|
|
|
200
|
-
var
|
|
235
|
+
var cartesian = cartesian || {};
|
|
201
236
|
(function () {
|
|
202
|
-
//Implements Features API that simplifies usage of feature scripts generated by
|
|
203
|
-
|
|
237
|
+
//Implements Features API that simplifies usage of feature scripts generated by Cartesian.
|
|
238
|
+
cartesian.features = cartesian.features || {};
|
|
204
239
|
|
|
205
|
-
|
|
240
|
+
cartesian.features.allFeatures = cartesian.features.allFeatures || {};
|
|
206
241
|
|
|
207
|
-
|
|
208
|
-
return
|
|
242
|
+
cartesian.features.get = function (name) {
|
|
243
|
+
return cartesian.features.allFeatures[name];
|
|
209
244
|
};
|
|
210
245
|
|
|
211
|
-
|
|
212
|
-
var feature =
|
|
246
|
+
cartesian.features.getValue = function (name) {
|
|
247
|
+
var feature = cartesian.features.get(name);
|
|
213
248
|
if (feature == undefined) {
|
|
214
249
|
return undefined;
|
|
215
250
|
}
|
|
@@ -217,19 +252,19 @@ var axis = axis || {};
|
|
|
217
252
|
return feature.value;
|
|
218
253
|
};
|
|
219
254
|
|
|
220
|
-
|
|
221
|
-
var value =
|
|
255
|
+
cartesian.features.isEnabled = function (name) {
|
|
256
|
+
var value = cartesian.features.getValue(name);
|
|
222
257
|
return value == "true" || value == "True";
|
|
223
258
|
};
|
|
224
259
|
})();
|
|
225
260
|
|
|
226
|
-
var
|
|
261
|
+
var cartesian = cartesian || {};
|
|
227
262
|
(function (define) {
|
|
228
263
|
define(["jquery"], function ($) {
|
|
229
264
|
// Notification - Defines Notification API, not implements it
|
|
230
|
-
|
|
265
|
+
cartesian.notifications = cartesian.notifications || {};
|
|
231
266
|
|
|
232
|
-
|
|
267
|
+
cartesian.notifications.severity = {
|
|
233
268
|
INFO: 0,
|
|
234
269
|
SUCCESS: 1,
|
|
235
270
|
WARN: 2,
|
|
@@ -237,47 +272,47 @@ var axis = axis || {};
|
|
|
237
272
|
FATAL: 4,
|
|
238
273
|
};
|
|
239
274
|
|
|
240
|
-
|
|
275
|
+
cartesian.notifications.userNotificationState = {
|
|
241
276
|
UNREAD: 0,
|
|
242
277
|
READ: 1,
|
|
243
278
|
};
|
|
244
279
|
|
|
245
|
-
|
|
280
|
+
cartesian.notifications.getUserNotificationStateAsString = function (
|
|
246
281
|
userNotificationState
|
|
247
282
|
) {
|
|
248
283
|
switch (userNotificationState) {
|
|
249
|
-
case
|
|
284
|
+
case cartesian.notifications.userNotificationState.READ:
|
|
250
285
|
return "READ";
|
|
251
|
-
case
|
|
286
|
+
case cartesian.notifications.userNotificationState.UNREAD:
|
|
252
287
|
return "UNREAD";
|
|
253
288
|
default:
|
|
254
|
-
|
|
289
|
+
cartesian.log.warn(
|
|
255
290
|
"Unknown user notification state value: " + userNotificationState
|
|
256
291
|
);
|
|
257
292
|
return "?";
|
|
258
293
|
}
|
|
259
294
|
};
|
|
260
295
|
|
|
261
|
-
|
|
296
|
+
cartesian.notifications.getUiNotifyFuncBySeverity = function (severity) {
|
|
262
297
|
switch (severity) {
|
|
263
|
-
case
|
|
264
|
-
return
|
|
265
|
-
case
|
|
266
|
-
return
|
|
267
|
-
case
|
|
268
|
-
return
|
|
269
|
-
case
|
|
270
|
-
return
|
|
271
|
-
case
|
|
298
|
+
case cartesian.notifications.severity.SUCCESS:
|
|
299
|
+
return cartesian.notify.success;
|
|
300
|
+
case cartesian.notifications.severity.WARN:
|
|
301
|
+
return cartesian.notify.warn;
|
|
302
|
+
case cartesian.notifications.severity.ERROR:
|
|
303
|
+
return cartesian.notify.error;
|
|
304
|
+
case cartesian.notifications.severity.FATAL:
|
|
305
|
+
return cartesian.notify.error;
|
|
306
|
+
case cartesian.notifications.severity.INFO:
|
|
272
307
|
default:
|
|
273
|
-
return
|
|
308
|
+
return cartesian.notify.info;
|
|
274
309
|
}
|
|
275
310
|
};
|
|
276
311
|
|
|
277
|
-
|
|
312
|
+
cartesian.notifications.messageFormatters = {};
|
|
278
313
|
|
|
279
|
-
|
|
280
|
-
"
|
|
314
|
+
cartesian.notifications.messageFormatters[
|
|
315
|
+
"Cartesian.Notifications.MessageNotificationData"
|
|
281
316
|
] = function (userNotification) {
|
|
282
317
|
return (
|
|
283
318
|
userNotification.notification.data.message ||
|
|
@@ -285,13 +320,13 @@ var axis = axis || {};
|
|
|
285
320
|
);
|
|
286
321
|
};
|
|
287
322
|
|
|
288
|
-
|
|
289
|
-
"
|
|
323
|
+
cartesian.notifications.messageFormatters[
|
|
324
|
+
"Cartesian.Notifications.LocalizableMessageNotificationData"
|
|
290
325
|
] = function (userNotification) {
|
|
291
326
|
var message =
|
|
292
327
|
userNotification.notification.data.message ||
|
|
293
328
|
userNotification.notification.data.properties.Message;
|
|
294
|
-
var localizedMessage =
|
|
329
|
+
var localizedMessage = cartesian.localization.localize(
|
|
295
330
|
message.name,
|
|
296
331
|
message.sourceName
|
|
297
332
|
);
|
|
@@ -322,23 +357,23 @@ var axis = axis || {};
|
|
|
322
357
|
return localizedMessage;
|
|
323
358
|
};
|
|
324
359
|
|
|
325
|
-
|
|
360
|
+
cartesian.notifications.getFormattedMessageFromUserNotification = function (
|
|
326
361
|
userNotification
|
|
327
362
|
) {
|
|
328
363
|
var formatter =
|
|
329
|
-
|
|
364
|
+
cartesian.notifications.messageFormatters[
|
|
330
365
|
userNotification.notification.data.type
|
|
331
366
|
];
|
|
332
367
|
if (!formatter) {
|
|
333
|
-
|
|
368
|
+
cartesian.log.warn(
|
|
334
369
|
"No message formatter defined for given data type: " +
|
|
335
370
|
userNotification.notification.data.type
|
|
336
371
|
);
|
|
337
372
|
return "?";
|
|
338
373
|
}
|
|
339
374
|
|
|
340
|
-
if (!
|
|
341
|
-
|
|
375
|
+
if (!cartesian.utils.isFunction(formatter)) {
|
|
376
|
+
cartesian.log.warn(
|
|
342
377
|
"Message formatter should be a function! It is invalid for data type: " +
|
|
343
378
|
userNotification.notification.data.type
|
|
344
379
|
);
|
|
@@ -348,39 +383,39 @@ var axis = axis || {};
|
|
|
348
383
|
return formatter(userNotification);
|
|
349
384
|
};
|
|
350
385
|
|
|
351
|
-
|
|
386
|
+
cartesian.notifications.showUiNotifyForUserNotification = function (
|
|
352
387
|
userNotification,
|
|
353
388
|
options
|
|
354
389
|
) {
|
|
355
|
-
var message =
|
|
390
|
+
var message = cartesian.notifications.getFormattedMessageFromUserNotification(
|
|
356
391
|
userNotification
|
|
357
392
|
);
|
|
358
|
-
var uiNotifyFunc =
|
|
393
|
+
var uiNotifyFunc = cartesian.notifications.getUiNotifyFuncBySeverity(
|
|
359
394
|
userNotification.notification.severity
|
|
360
395
|
);
|
|
361
396
|
uiNotifyFunc(message, undefined, options);
|
|
362
397
|
};
|
|
363
398
|
|
|
364
399
|
// Notify - Defines Notification API, not implements it
|
|
365
|
-
|
|
400
|
+
cartesian.notify = cartesian.notify || {};
|
|
366
401
|
|
|
367
|
-
|
|
368
|
-
|
|
402
|
+
cartesian.notify.success = function (message, title, options) {
|
|
403
|
+
cartesian.log.warn("cartesian.notify.success is not implemented!");
|
|
369
404
|
};
|
|
370
405
|
|
|
371
|
-
|
|
372
|
-
|
|
406
|
+
cartesian.notify.info = function (message, title, options) {
|
|
407
|
+
cartesian.log.warn("cartesian.notify.info is not implemented!");
|
|
373
408
|
};
|
|
374
409
|
|
|
375
|
-
|
|
376
|
-
|
|
410
|
+
cartesian.notify.warn = function (message, title, options) {
|
|
411
|
+
cartesian.log.warn("cartesian.notify.warn is not implemented!");
|
|
377
412
|
};
|
|
378
413
|
|
|
379
|
-
|
|
380
|
-
|
|
414
|
+
cartesian.notify.error = function (message, title, options) {
|
|
415
|
+
cartesian.log.warn("cartesian.notify.error is not implemented!");
|
|
381
416
|
};
|
|
382
417
|
|
|
383
|
-
return
|
|
418
|
+
return cartesian;
|
|
384
419
|
});
|
|
385
420
|
})(
|
|
386
421
|
typeof define === "function" && define.amd
|
|
@@ -389,16 +424,16 @@ var axis = axis || {};
|
|
|
389
424
|
if (typeof module !== "undefined" && module.exports) {
|
|
390
425
|
module.exports = factory(require("jquery"));
|
|
391
426
|
} else {
|
|
392
|
-
window.
|
|
427
|
+
window.cartesian = factory(window.jQuery);
|
|
393
428
|
}
|
|
394
429
|
}
|
|
395
430
|
);
|
|
396
431
|
|
|
397
|
-
var
|
|
432
|
+
var cartesian = cartesian || {};
|
|
398
433
|
(function () {
|
|
399
|
-
|
|
434
|
+
cartesian.log = cartesian.log || {};
|
|
400
435
|
|
|
401
|
-
|
|
436
|
+
cartesian.log.levels = {
|
|
402
437
|
DEBUG: 1,
|
|
403
438
|
INFO: 2,
|
|
404
439
|
WARN: 3,
|
|
@@ -406,57 +441,57 @@ var axis = axis || {};
|
|
|
406
441
|
FATAL: 5,
|
|
407
442
|
};
|
|
408
443
|
|
|
409
|
-
|
|
444
|
+
cartesian.log.level = cartesian.log.levels.DEBUG;
|
|
410
445
|
|
|
411
|
-
|
|
446
|
+
cartesian.log.log = function (logObject, logLevel) {
|
|
412
447
|
if (!window.console || !window.console.log) {
|
|
413
448
|
return;
|
|
414
449
|
}
|
|
415
450
|
|
|
416
|
-
if (logLevel != undefined && logLevel <
|
|
451
|
+
if (logLevel != undefined && logLevel < cartesian.log.level) {
|
|
417
452
|
return;
|
|
418
453
|
}
|
|
419
454
|
};
|
|
420
455
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
456
|
+
cartesian.log.debug = function (logObject) {
|
|
457
|
+
cartesian.log.log("DEBUG: ", cartesian.log.levels.DEBUG);
|
|
458
|
+
cartesian.log.log(logObject, cartesian.log.levels.DEBUG);
|
|
424
459
|
};
|
|
425
460
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
461
|
+
cartesian.log.info = function (logObject) {
|
|
462
|
+
cartesian.log.log("INFO: ", cartesian.log.levels.INFO);
|
|
463
|
+
cartesian.log.log(logObject, cartesian.log.levels.INFO);
|
|
429
464
|
};
|
|
430
465
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
466
|
+
cartesian.log.warn = function (logObject) {
|
|
467
|
+
cartesian.log.log("WARN: ", cartesian.log.levels.WARN);
|
|
468
|
+
cartesian.log.log(logObject, cartesian.log.levels.WARN);
|
|
434
469
|
};
|
|
435
470
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
471
|
+
cartesian.log.error = function (logObject) {
|
|
472
|
+
cartesian.log.log("ERROR: ", cartesian.log.levels.ERROR);
|
|
473
|
+
cartesian.log.log(logObject, cartesian.log.levels.ERROR);
|
|
439
474
|
};
|
|
440
475
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
476
|
+
cartesian.log.fatal = function (logObject) {
|
|
477
|
+
cartesian.log.log("FATAL: ", cartesian.log.levels.FATAL);
|
|
478
|
+
cartesian.log.log(logObject, cartesian.log.levels.FATAL);
|
|
444
479
|
};
|
|
445
480
|
})();
|
|
446
481
|
|
|
447
|
-
var
|
|
482
|
+
var cartesian = cartesian || {};
|
|
448
483
|
(function (define) {
|
|
449
484
|
define(["jquery"], function ($) {
|
|
450
485
|
|
|
451
486
|
// Messages API - Defines Messages API, not implements it
|
|
452
|
-
|
|
487
|
+
cartesian.message = cartesian.message || {};
|
|
453
488
|
|
|
454
489
|
var showMessage = function (message, title, options) {
|
|
455
490
|
alert((title || "") + " " + message);
|
|
456
491
|
|
|
457
492
|
if (!$) {
|
|
458
|
-
|
|
459
|
-
"
|
|
493
|
+
cartesian.log.warn(
|
|
494
|
+
"cartesian.message can not return promise since jQuery is not defined!"
|
|
460
495
|
);
|
|
461
496
|
return null;
|
|
462
497
|
}
|
|
@@ -466,35 +501,35 @@ var axis = axis || {};
|
|
|
466
501
|
});
|
|
467
502
|
};
|
|
468
503
|
|
|
469
|
-
|
|
470
|
-
|
|
504
|
+
cartesian.message.info = function (message, title, options) {
|
|
505
|
+
cartesian.log.warn("cartesian.message.info is not implemented!");
|
|
471
506
|
return showMessage(message, title, options);
|
|
472
507
|
};
|
|
473
508
|
|
|
474
|
-
|
|
475
|
-
|
|
509
|
+
cartesian.message.success = function (message, title, options) {
|
|
510
|
+
cartesian.log.warn("cartesian.message.success is not implemented!");
|
|
476
511
|
return showMessage(message, title, options);
|
|
477
512
|
};
|
|
478
513
|
|
|
479
|
-
|
|
480
|
-
|
|
514
|
+
cartesian.message.warn = function (message, title, options) {
|
|
515
|
+
cartesian.log.warn("cartesian.message.warn is not implemented!");
|
|
481
516
|
return showMessage(message, title, options);
|
|
482
517
|
};
|
|
483
518
|
|
|
484
|
-
|
|
485
|
-
|
|
519
|
+
cartesian.message.error = function (message, title, options) {
|
|
520
|
+
cartesian.log.warn("cartesian.message.error is not implemented!");
|
|
486
521
|
return showMessage(message, title, options);
|
|
487
522
|
};
|
|
488
523
|
|
|
489
|
-
|
|
490
|
-
|
|
524
|
+
cartesian.message.confirm = function (message, title, callback, options) {
|
|
525
|
+
cartesian.log.warn("cartesian.message.confirm is not implemented!");
|
|
491
526
|
|
|
492
527
|
var result = confirm(message);
|
|
493
528
|
callback && callback(result);
|
|
494
529
|
|
|
495
530
|
if (!$) {
|
|
496
|
-
|
|
497
|
-
"
|
|
531
|
+
cartesian.log.warn(
|
|
532
|
+
"cartesian.message can not return promise since jQuery is not defined!"
|
|
498
533
|
);
|
|
499
534
|
return null;
|
|
500
535
|
}
|
|
@@ -504,7 +539,7 @@ var axis = axis || {};
|
|
|
504
539
|
});
|
|
505
540
|
};
|
|
506
541
|
|
|
507
|
-
return
|
|
542
|
+
return cartesian;
|
|
508
543
|
});
|
|
509
544
|
})(
|
|
510
545
|
typeof define === "function" && define.amd
|
|
@@ -513,37 +548,37 @@ var axis = axis || {};
|
|
|
513
548
|
if (typeof module !== "undefined" && module.exports) {
|
|
514
549
|
module.exports = factory(require("jquery"));
|
|
515
550
|
} else {
|
|
516
|
-
window.
|
|
551
|
+
window.cartesian = factory(window.jQuery);
|
|
517
552
|
}
|
|
518
553
|
}
|
|
519
554
|
);
|
|
520
555
|
|
|
521
|
-
var
|
|
556
|
+
var cartesian = cartesian || {};
|
|
522
557
|
(function () {
|
|
523
|
-
|
|
558
|
+
cartesian.ui = cartesian.ui || {};
|
|
524
559
|
|
|
525
560
|
// UI Block - Defines UI Block API, not implements it
|
|
526
|
-
|
|
527
|
-
|
|
561
|
+
cartesian.ui.block = function (elm) {
|
|
562
|
+
cartesian.log.warn("cartesian.ui.block is not implemented!");
|
|
528
563
|
};
|
|
529
564
|
|
|
530
|
-
|
|
531
|
-
|
|
565
|
+
cartesian.ui.unblock = function (elm) {
|
|
566
|
+
cartesian.log.warn("cartesian.ui.unblock is not implemented!");
|
|
532
567
|
};
|
|
533
568
|
|
|
534
569
|
// UI BUSY - Defines UI Busy API, not implements it
|
|
535
|
-
|
|
536
|
-
|
|
570
|
+
cartesian.ui.setBusy = function (elm, text, delay) {
|
|
571
|
+
cartesian.log.warn("cartesian.ui.setBusy is not implemented!");
|
|
537
572
|
};
|
|
538
573
|
|
|
539
|
-
|
|
540
|
-
|
|
574
|
+
cartesian.ui.clearBusy = function (elm, delay) {
|
|
575
|
+
cartesian.log.warn("cartesian.ui.clearBusy is not implemented!");
|
|
541
576
|
};
|
|
542
577
|
})();
|
|
543
578
|
|
|
544
|
-
var
|
|
579
|
+
var cartesian = cartesian || {};
|
|
545
580
|
(function () {
|
|
546
|
-
|
|
581
|
+
cartesian.event = (function () {
|
|
547
582
|
var _callbacks = {};
|
|
548
583
|
|
|
549
584
|
var on = function (eventName, callback) {
|
|
@@ -597,18 +632,18 @@ var axis = axis || {};
|
|
|
597
632
|
})();
|
|
598
633
|
})();
|
|
599
634
|
|
|
600
|
-
var
|
|
635
|
+
var cartesian = cartesian || {};
|
|
601
636
|
(function (define) {
|
|
602
637
|
define(["jquery"], function ($) {
|
|
603
|
-
|
|
638
|
+
cartesian.utils = cartesian.utils || {};
|
|
604
639
|
|
|
605
640
|
/* Creates a name namespace.
|
|
606
641
|
* Example:
|
|
607
|
-
* var taskService =
|
|
608
|
-
* taskService will be equal to
|
|
642
|
+
* var taskService = cartesian.utils.createNamespace(cartesian, 'services.task');
|
|
643
|
+
* taskService will be equal to cartesian.services.task
|
|
609
644
|
* first argument (root) must be defined first
|
|
610
645
|
************************************************************/
|
|
611
|
-
|
|
646
|
+
cartesian.utils.createNamespace = function (root, ns) {
|
|
612
647
|
var parts = ns.split(".");
|
|
613
648
|
for (var i = 0; i < parts.length; i++) {
|
|
614
649
|
if (typeof root[parts[i]] == "undefined") {
|
|
@@ -624,18 +659,18 @@ var axis = axis || {};
|
|
|
624
659
|
/* Find and replaces a string (search) to another string (replacement) in
|
|
625
660
|
* given string (str).
|
|
626
661
|
* Example:
|
|
627
|
-
*
|
|
662
|
+
* cartesian.utils.replaceAll('This is a test string', 'is', 'X') = 'ThX X a test string'
|
|
628
663
|
************************************************************/
|
|
629
|
-
|
|
664
|
+
cartesian.utils.replaceAll = function (str, search, replacement) {
|
|
630
665
|
var fix = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
631
666
|
return str.replace(new RegExp(fix, "g"), replacement);
|
|
632
667
|
};
|
|
633
668
|
|
|
634
669
|
/* Formats a string just like string.format in C#.
|
|
635
670
|
* Example:
|
|
636
|
-
*
|
|
671
|
+
* cartesian.utils.formatString('Hello {0}','Tuana') = 'Hello Tuana'
|
|
637
672
|
************************************************************/
|
|
638
|
-
|
|
673
|
+
cartesian.utils.formatString = function () {
|
|
639
674
|
if (arguments.length < 1) {
|
|
640
675
|
return null;
|
|
641
676
|
}
|
|
@@ -644,13 +679,13 @@ var axis = axis || {};
|
|
|
644
679
|
|
|
645
680
|
for (var i = 1; i < arguments.length; i++) {
|
|
646
681
|
var placeHolder = "{" + (i - 1) + "}";
|
|
647
|
-
str =
|
|
682
|
+
str = cartesian.utils.replaceAll(str, placeHolder, arguments[i]);
|
|
648
683
|
}
|
|
649
684
|
|
|
650
685
|
return str;
|
|
651
686
|
};
|
|
652
687
|
|
|
653
|
-
|
|
688
|
+
cartesian.utils.toPascalCase = function (str) {
|
|
654
689
|
if (!str || !str.length) {
|
|
655
690
|
return str;
|
|
656
691
|
}
|
|
@@ -662,7 +697,7 @@ var axis = axis || {};
|
|
|
662
697
|
return str.charAt(0).toUpperCase() + str.substr(1);
|
|
663
698
|
};
|
|
664
699
|
|
|
665
|
-
|
|
700
|
+
cartesian.utils.toCamelCase = function (str) {
|
|
666
701
|
if (!str || !str.length) {
|
|
667
702
|
return str;
|
|
668
703
|
}
|
|
@@ -674,7 +709,7 @@ var axis = axis || {};
|
|
|
674
709
|
return str.charAt(0).toLowerCase() + str.substr(1);
|
|
675
710
|
};
|
|
676
711
|
|
|
677
|
-
|
|
712
|
+
cartesian.utils.truncateString = function (str, maxLength) {
|
|
678
713
|
if (!str || !str.length || str.length <= maxLength) {
|
|
679
714
|
return str;
|
|
680
715
|
}
|
|
@@ -682,7 +717,7 @@ var axis = axis || {};
|
|
|
682
717
|
return str.substr(0, maxLength);
|
|
683
718
|
};
|
|
684
719
|
|
|
685
|
-
|
|
720
|
+
cartesian.utils.truncateStringWithPostfix = function (str, maxLength, postfix) {
|
|
686
721
|
postfix = postfix || "...";
|
|
687
722
|
|
|
688
723
|
if (!str || !str.length || str.length <= maxLength) {
|
|
@@ -696,7 +731,7 @@ var axis = axis || {};
|
|
|
696
731
|
return str.substr(0, maxLength - postfix.length) + postfix;
|
|
697
732
|
};
|
|
698
733
|
|
|
699
|
-
|
|
734
|
+
cartesian.utils.isFunction = function (obj) {
|
|
700
735
|
if ($) {
|
|
701
736
|
//Prefer to use jQuery if possible
|
|
702
737
|
return $.isFunction(obj);
|
|
@@ -711,7 +746,7 @@ var axis = axis || {};
|
|
|
711
746
|
* where name is query string parameter name and value is it's value.
|
|
712
747
|
* includeQuestionMark is true by default.
|
|
713
748
|
*/
|
|
714
|
-
|
|
749
|
+
cartesian.utils.buildQueryString = function (
|
|
715
750
|
parameterInfos,
|
|
716
751
|
includeQuestionMark
|
|
717
752
|
) {
|
|
@@ -783,14 +818,14 @@ var axis = axis || {};
|
|
|
783
818
|
|
|
784
819
|
/**
|
|
785
820
|
* Sets a cookie value for given key.
|
|
786
|
-
* This is a simple implementation created to be used by
|
|
821
|
+
* This is a simple implementation created to be used by Cartesian.
|
|
787
822
|
* Please use a complete cookie library if you need.
|
|
788
823
|
* @param {string} key
|
|
789
824
|
* @param {string} value
|
|
790
825
|
* @param {Date} expireDate (optional). If not specified the cookie will expire at the end of session.
|
|
791
826
|
* @param {string} path (optional)
|
|
792
827
|
*/
|
|
793
|
-
|
|
828
|
+
cartesian.utils.setCookieValue = function (
|
|
794
829
|
key,
|
|
795
830
|
value,
|
|
796
831
|
expireDate,
|
|
@@ -820,12 +855,12 @@ var axis = axis || {};
|
|
|
820
855
|
|
|
821
856
|
/**
|
|
822
857
|
* Gets a cookie with given key.
|
|
823
|
-
* This is a simple implementation created to be used by
|
|
858
|
+
* This is a simple implementation created to be used by Cartesian.
|
|
824
859
|
* Please use a complete cookie library if you need.
|
|
825
860
|
* @param {string} key
|
|
826
861
|
* @returns {string} Cookie value or null
|
|
827
862
|
*/
|
|
828
|
-
|
|
863
|
+
cartesian.utils.getCookieValue = function (key) {
|
|
829
864
|
var equalities = document.cookie.split("; ");
|
|
830
865
|
for (var i = 0; i < equalities.length; i++) {
|
|
831
866
|
if (!equalities[i]) {
|
|
@@ -847,12 +882,12 @@ var axis = axis || {};
|
|
|
847
882
|
|
|
848
883
|
/**
|
|
849
884
|
* Deletes cookie for given key.
|
|
850
|
-
* This is a simple implementation created to be used by
|
|
885
|
+
* This is a simple implementation created to be used by Cartesian.
|
|
851
886
|
* Please use a complete cookie library if you need.
|
|
852
887
|
* @param {string} key
|
|
853
888
|
* @param {string} path (optional)
|
|
854
889
|
*/
|
|
855
|
-
|
|
890
|
+
cartesian.utils.deleteCookie = function (key, path) {
|
|
856
891
|
var cookieValue = encodeURIComponent(key) + "=";
|
|
857
892
|
|
|
858
893
|
cookieValue =
|
|
@@ -872,13 +907,13 @@ var axis = axis || {};
|
|
|
872
907
|
* @param {string} url
|
|
873
908
|
* @returns {string}
|
|
874
909
|
*/
|
|
875
|
-
|
|
910
|
+
cartesian.utils.getDomain = function (url) {
|
|
876
911
|
var domainRegex = /(https?:){0,1}\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i;
|
|
877
912
|
var matches = domainRegex.exec(url);
|
|
878
913
|
return matches && matches[2] ? matches[2] : "";
|
|
879
914
|
};
|
|
880
915
|
|
|
881
|
-
return
|
|
916
|
+
return cartesian;
|
|
882
917
|
});
|
|
883
918
|
})(
|
|
884
919
|
typeof define === "function" && define.amd
|
|
@@ -887,16 +922,16 @@ var axis = axis || {};
|
|
|
887
922
|
if (typeof module !== "undefined" && module.exports) {
|
|
888
923
|
module.exports = factory(require("jquery"));
|
|
889
924
|
} else {
|
|
890
|
-
window.
|
|
925
|
+
window.cartesian = factory(window.jQuery);
|
|
891
926
|
}
|
|
892
927
|
}
|
|
893
928
|
);
|
|
894
929
|
|
|
895
|
-
var
|
|
930
|
+
var cartesian = cartesian || {};
|
|
896
931
|
(function () {
|
|
897
|
-
|
|
932
|
+
cartesian.timing = cartesian.timing || {};
|
|
898
933
|
|
|
899
|
-
|
|
934
|
+
cartesian.timing.utcClockProvider = (function () {
|
|
900
935
|
var toUtc = function (date) {
|
|
901
936
|
return Date.UTC(
|
|
902
937
|
date.getUTCFullYear(),
|
|
@@ -930,7 +965,7 @@ var axis = axis || {};
|
|
|
930
965
|
};
|
|
931
966
|
})();
|
|
932
967
|
|
|
933
|
-
|
|
968
|
+
cartesian.timing.localClockProvider = (function () {
|
|
934
969
|
var toLocal = function (date) {
|
|
935
970
|
return new Date(
|
|
936
971
|
date.getFullYear(),
|
|
@@ -963,7 +998,7 @@ var axis = axis || {};
|
|
|
963
998
|
};
|
|
964
999
|
})();
|
|
965
1000
|
|
|
966
|
-
|
|
1001
|
+
cartesian.timing.unspecifiedClockProvider = (function () {
|
|
967
1002
|
var now = function () {
|
|
968
1003
|
return new Date();
|
|
969
1004
|
};
|
|
@@ -980,56 +1015,56 @@ var axis = axis || {};
|
|
|
980
1015
|
};
|
|
981
1016
|
})();
|
|
982
1017
|
|
|
983
|
-
|
|
1018
|
+
cartesian.timing.convertToUserTimezone = function (date) {
|
|
984
1019
|
var localTime = date.getTime();
|
|
985
1020
|
var utcTime = localTime + date.getTimezoneOffset() * 60000;
|
|
986
1021
|
var targetTime =
|
|
987
1022
|
parseInt(utcTime) +
|
|
988
|
-
parseInt(
|
|
1023
|
+
parseInt(cartesian.timing.timeZoneInfo.server.currentUtcOffsetInMilliseconds);
|
|
989
1024
|
return new Date(targetTime);
|
|
990
1025
|
};
|
|
991
1026
|
})();
|
|
992
1027
|
|
|
993
|
-
var
|
|
1028
|
+
var cartesian = cartesian || {};
|
|
994
1029
|
(function () {
|
|
995
|
-
|
|
1030
|
+
cartesian.clock = cartesian.clock || {};
|
|
996
1031
|
|
|
997
|
-
|
|
998
|
-
if (
|
|
999
|
-
return
|
|
1032
|
+
cartesian.clock.now = function () {
|
|
1033
|
+
if (cartesian.clock.provider) {
|
|
1034
|
+
return cartesian.clock.provider.now();
|
|
1000
1035
|
}
|
|
1001
1036
|
|
|
1002
1037
|
return new Date();
|
|
1003
1038
|
};
|
|
1004
1039
|
|
|
1005
|
-
|
|
1006
|
-
if (
|
|
1007
|
-
return
|
|
1040
|
+
cartesian.clock.normalize = function (date) {
|
|
1041
|
+
if (cartesian.clock.provider) {
|
|
1042
|
+
return cartesian.clock.provider.normalize(date);
|
|
1008
1043
|
}
|
|
1009
1044
|
|
|
1010
1045
|
return date;
|
|
1011
1046
|
};
|
|
1012
1047
|
|
|
1013
|
-
|
|
1048
|
+
cartesian.clock.provider = cartesian.timing.unspecifiedClockProvider;
|
|
1014
1049
|
})();
|
|
1015
1050
|
|
|
1016
|
-
var
|
|
1051
|
+
var cartesian = cartesian || {};
|
|
1017
1052
|
(function () {
|
|
1018
|
-
|
|
1019
|
-
|
|
1053
|
+
cartesian.security = cartesian.security || {};
|
|
1054
|
+
cartesian.security.antiForgery = cartesian.security.antiForgery || {};
|
|
1020
1055
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1056
|
+
cartesian.security.antiForgery.tokenCookieName = "XSRF-TOKEN";
|
|
1057
|
+
cartesian.security.antiForgery.tokenHeaderName = "X-XSRF-TOKEN";
|
|
1023
1058
|
|
|
1024
|
-
|
|
1025
|
-
return
|
|
1059
|
+
cartesian.security.antiForgery.getToken = function () {
|
|
1060
|
+
return cartesian.utils.getCookieValue(cartesian.security.antiForgery.tokenCookieName);
|
|
1026
1061
|
};
|
|
1027
1062
|
|
|
1028
|
-
|
|
1063
|
+
cartesian.security.antiForgery.shouldSendToken = function (settings) {
|
|
1029
1064
|
if (settings.crossDomain === undefined || settings.crossDomain === null) {
|
|
1030
1065
|
return (
|
|
1031
|
-
|
|
1032
|
-
|
|
1066
|
+
cartesian.utils.getDomain(location.href) ===
|
|
1067
|
+
cartesian.utils.getDomain(settings.url)
|
|
1033
1068
|
);
|
|
1034
1069
|
}
|
|
1035
1070
|
|
|
@@ -1037,64 +1072,64 @@ var axis = axis || {};
|
|
|
1037
1072
|
};
|
|
1038
1073
|
})();
|
|
1039
1074
|
|
|
1040
|
-
var
|
|
1075
|
+
var cartesian = cartesian || {};
|
|
1041
1076
|
(function () {
|
|
1042
1077
|
// Current application root path (including virtual directory if exists).
|
|
1043
|
-
|
|
1044
|
-
|
|
1078
|
+
cartesian.appPath = cartesian.appPath || "/";
|
|
1079
|
+
cartesian.pageLoadTime = new Date();
|
|
1045
1080
|
|
|
1046
|
-
// Converts given path to absolute path using
|
|
1047
|
-
|
|
1081
|
+
// Converts given path to absolute path using cartesian.appPath variable.
|
|
1082
|
+
cartesian.toAbsAppPath = function (path) {
|
|
1048
1083
|
if (path.indexOf("/") == 0) {
|
|
1049
1084
|
path = path.substring(1);
|
|
1050
1085
|
}
|
|
1051
|
-
return
|
|
1086
|
+
return cartesian.appPath + path;
|
|
1052
1087
|
};
|
|
1053
1088
|
})();
|
|
1054
1089
|
|
|
1055
|
-
var
|
|
1090
|
+
var cartesian = cartesian || {};
|
|
1056
1091
|
(function () {
|
|
1057
|
-
|
|
1092
|
+
cartesian.session = cartesian.session || {};
|
|
1058
1093
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1094
|
+
cartesian.session.userId = false;
|
|
1095
|
+
cartesian.session.isAdmin = false;
|
|
1096
|
+
cartesian.session.hostId = false;
|
|
1097
|
+
cartesian.session.tenantId = false;
|
|
1098
|
+
cartesian.session.side = cartesian.tenancy.sides.TENANT; //1: Tenant, 2: Host
|
|
1064
1099
|
|
|
1065
|
-
|
|
1066
|
-
if (
|
|
1100
|
+
cartesian.session.isHostAdmin = function () {
|
|
1101
|
+
if (cartesian.session.hostId && cartesian.session.isAdmin) {
|
|
1067
1102
|
return true;
|
|
1068
1103
|
}
|
|
1069
1104
|
|
|
1070
1105
|
return false;
|
|
1071
1106
|
};
|
|
1072
1107
|
|
|
1073
|
-
|
|
1074
|
-
if (
|
|
1108
|
+
cartesian.session.isTenantAdmin = function () {
|
|
1109
|
+
if (cartesian.session.tenantId && cartesian.session.isAdmin) {
|
|
1075
1110
|
return true;
|
|
1076
1111
|
}
|
|
1077
1112
|
|
|
1078
1113
|
return false;
|
|
1079
1114
|
};
|
|
1080
1115
|
|
|
1081
|
-
|
|
1082
|
-
if (
|
|
1116
|
+
cartesian.session.isUserLogged = function () {
|
|
1117
|
+
if (cartesian.session.userId) {
|
|
1083
1118
|
return true;
|
|
1084
1119
|
}
|
|
1085
1120
|
return false;
|
|
1086
1121
|
};
|
|
1087
1122
|
|
|
1088
|
-
|
|
1089
|
-
if(
|
|
1123
|
+
cartesian.session.isHostSide = function () {
|
|
1124
|
+
if(cartesian.session.side === cartesian.tenancy.sides.HOST) {
|
|
1090
1125
|
return true;
|
|
1091
1126
|
}
|
|
1092
1127
|
|
|
1093
1128
|
return false;
|
|
1094
1129
|
}
|
|
1095
1130
|
|
|
1096
|
-
|
|
1097
|
-
if(
|
|
1131
|
+
cartesian.session.isTenantSide = function () {
|
|
1132
|
+
if(cartesian.session.side === cartesian.tenancy.sides.TENANT) {
|
|
1098
1133
|
return true;
|
|
1099
1134
|
}
|
|
1100
1135
|
|
|
@@ -1103,23 +1138,23 @@ var axis = axis || {};
|
|
|
1103
1138
|
|
|
1104
1139
|
})();
|
|
1105
1140
|
|
|
1106
|
-
var
|
|
1141
|
+
var cartesian = cartesian || {};
|
|
1107
1142
|
(function () {
|
|
1108
|
-
// Implements Settings API that simplifies usage of setting scripts generated by
|
|
1109
|
-
|
|
1143
|
+
// Implements Settings API that simplifies usage of setting scripts generated by Cartesian.
|
|
1144
|
+
cartesian.setting = cartesian.setting || {};
|
|
1110
1145
|
|
|
1111
|
-
|
|
1146
|
+
cartesian.setting.values = cartesian.setting.values || {};
|
|
1112
1147
|
|
|
1113
|
-
|
|
1114
|
-
return
|
|
1148
|
+
cartesian.setting.get = function (name) {
|
|
1149
|
+
return cartesian.setting.values[name];
|
|
1115
1150
|
};
|
|
1116
1151
|
|
|
1117
|
-
|
|
1118
|
-
var value =
|
|
1152
|
+
cartesian.setting.getBoolean = function (name) {
|
|
1153
|
+
var value = cartesian.setting.get(name);
|
|
1119
1154
|
return value == "true" || value == "True";
|
|
1120
1155
|
};
|
|
1121
1156
|
|
|
1122
|
-
|
|
1123
|
-
return parseInt(
|
|
1157
|
+
cartesian.setting.getInt = function (name) {
|
|
1158
|
+
return parseInt(cartesian.setting.values[name]);
|
|
1124
1159
|
};
|
|
1125
1160
|
})();
|