-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathSandbox.js
133 lines (108 loc) · 4.06 KB
/
Sandbox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
var Sandbox = function (core, moduleId) {
var getPageSpecificData = function () {
return core.PageData.getPageData(moduleId);
};
var defaults = {
DROPDOWN_FIRST_SELECT_OPTION: ''
};
return {
getPageSpecificData:getPageSpecificData,
notify: function () {
return core.Communication.notify.apply(core.Communication, arguments);
},
addListener: function (topic, callback, context) {
core.Communication.addListener(topic, callback, context);
},
removeListener: function (topic, callback) {
core.Communication.removeListener(topic, callback);
},
removeAllListeners: function (context) {
core.Communication.removeAllListenersForContext(context);
},
// requestData = {
// name: urlMapping
// data: data to send to the server - optional
// context: callback context - optional
// success: callback function (response) - optional
// failure: callback function (error message) - optional
// }
request: function(data) {
core.Ajax.request(data, moduleId);
},
getRequestQueue:function() {
return core.Ajax.getRequestQueue();
},
// called from authentication error module before resending requests
clearRequestQueue:function() {
core.Ajax.clearRequestQueue();
},
attachRequestHeader: function(key, value) {
core.Ajax.attachRequestHeader(key, value);
},
cancelRequests: function () {
core.Ajax.cancelRequests(moduleId);
},
bind: function (viewModel) {
return core.DataBinding.applyBinding(moduleId, viewModel);
},
unbind: function () {
return core.DataBinding.removeBinding(moduleId);
},
getObservable: function () {
return core.Observable.getObservable();
},
getDomManipulation: function () {
return core.DomManipulation.getDom();
},
startModuleGroup: function (moduleGroupName) {
core.ModuleGrouping.start(moduleGroupName);
},
stopModuleGroup: function (moduleGroupName) {
core.ModuleGrouping.stop(moduleGroupName);
},
openDialog: function (dialogClosedCallback, dialogOpenCallback) {
core.DomManipulation.openDialog(moduleId, dialogClosedCallback, dialogOpenCallback);
},
closeDialog: function () {
core.DomManipulation.closeDialog(moduleId);
},
activateControl: function (controlId) {
core.Controls.activate(controlId);
},
createUrlForFileDownload: function (flatParameterArray) {
return core.UrlUtilities.createUrlForFileDownload(flatParameterArray);
},
destroyControl: function (controlId) {
core.Controls.destroy(controlId);
},
sendControlMessage: function (controlId, message, parameters) {
core.Controls.sendMessage(controlId, { name: message, parameters: parameters });
},
sendControlMessages: function (controlId, messages) {
core.Controls.sendMessage(controlId, messages);
},
setDocumentTitle: function (newTitle) {
core.DomManipulation.setDocumentTitle(newTitle);
},
consoleLog: function (message) {
core.Error.consoleLog(message);
},
getSingleton: function (singletonId) {
return core.Singleton.getSingleton(singletonId);
},
openPostRequestPage: function (postModel) {
postModel.params.viewDate = getPageSpecificData().currentViewDate,
core.OpenPostRequestPage.requestPage(postModel);
},
storageHasNativeSupport: core.Storage.hasNativeSupport,
storageSetItem: core.Storage.setItem,
storageGetItem: core.Storage.getItem,
storageSetObject: core.Storage.setObject,
storageGetObject: core.Storage.getObject,
storageRemoveItem: core.Storage.removeItem,
storageClear: core.Storage.clear,
storageFindKeys: core.Storage.findKeys,
storageGetKeys: core.Storage.getKeys,
defaults:defaults
};
};