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