@openui5/sap.ui.documentation 1.118.0 → 1.119.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/THIRDPARTY.txt +2 -2
- package/package.json +7 -7
- package/src/sap/ui/documentation/.library +1 -1
- package/src/sap/ui/documentation/Search.js +32 -22
- package/src/sap/ui/documentation/library.js +2 -2
- package/src/sap/ui/documentation/messagebundle.properties +28 -5
- package/src/sap/ui/documentation/messagebundle_ar.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_bg.properties +19 -7
- package/src/sap/ui/documentation/messagebundle_ca.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_cs.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_cy.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_da.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_de.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_el.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_en.properties +15 -3
- package/src/sap/ui/documentation/messagebundle_en_GB.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_es.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_es_MX.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_et.properties +16 -4
- package/src/sap/ui/documentation/messagebundle_fi.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_fr.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_fr_CA.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_hi.properties +19 -7
- package/src/sap/ui/documentation/messagebundle_hr.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_hu.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_id.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_it.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_iw.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_ja.properties +20 -8
- package/src/sap/ui/documentation/messagebundle_kk.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_ko.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_lt.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_lv.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_ms.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_nl.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_no.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_pl.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_pt.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_pt_PT.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_ro.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_ru.properties +18 -6
- package/src/sap/ui/documentation/messagebundle_sh.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_sk.properties +19 -7
- package/src/sap/ui/documentation/messagebundle_sl.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_sv.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_th.properties +26 -14
- package/src/sap/ui/documentation/messagebundle_tr.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_uk.properties +22 -10
- package/src/sap/ui/documentation/messagebundle_vi.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_zh_CN.properties +17 -5
- package/src/sap/ui/documentation/messagebundle_zh_TW.properties +18 -6
- package/src/sap/ui/documentation/sdk/Component.js +0 -24
- package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +7 -0
- package/src/sap/ui/documentation/sdk/controller/App.controller.js +1534 -1658
- package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +31 -14
- package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +1 -2
- package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/util/ThemePicker.js +11 -3
- package/src/sap/ui/documentation/sdk/css/style.css +0 -4
- package/src/sap/ui/documentation/sdk/images/ui5-logo-dark.svg +22 -0
- package/src/sap/ui/documentation/sdk/images/ui5-logo-light.svg +22 -0
- package/src/sap/ui/documentation/sdk/manifest.json +6 -0
- package/src/sap/ui/documentation/sdk/model/theme-parameters.json +4 -0
- package/src/sap/ui/documentation/sdk/view/App.view.xml +312 -192
- package/src/sap/ui/documentation/sdk/view/Footer.fragment.xml +1 -1
- package/src/sap/ui/documentation/themes/base/Documentation.less +361 -0
- package/src/sap/ui/documentation/themes/base/Search.less +16 -12
- package/src/sap/ui/documentation/themes/sap_horizon/library.source.less +1 -2
- package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +1 -2
- package/src/sap/ui/documentation/sdk/view/FeedbackDialog.fragment.xml +0 -87
- package/src/sap/ui/documentation/themes/sap_horizon/Search.less +0 -3
- package/src/sap/ui/documentation/themes/sap_horizon_dark/Search.less +0 -3
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/ui/events/KeyCodes",
|
|
9
8
|
"sap/ui/thirdparty/jquery",
|
|
10
9
|
"sap/ui/documentation/sdk/controller/BaseController",
|
|
11
10
|
"sap/ui/documentation/sdk/controller/util/NewsInfo",
|
|
@@ -18,12 +17,9 @@ sap.ui.define([
|
|
|
18
17
|
"sap/ui/core/Fragment",
|
|
19
18
|
"sap/base/util/UriParameters",
|
|
20
19
|
"sap/ui/documentation/library",
|
|
21
|
-
"sap/ui/core/IconPool",
|
|
22
|
-
"sap/m/MessageBox",
|
|
23
20
|
"sap/m/library",
|
|
24
21
|
"sap/base/Log",
|
|
25
22
|
"sap/base/util/Version",
|
|
26
|
-
"sap/ui/core/syncStyleClass",
|
|
27
23
|
"sap/ui/core/Core",
|
|
28
24
|
"sap/ui/util/openWindow",
|
|
29
25
|
"sap/ui/documentation/sdk/model/formatter",
|
|
@@ -34,8 +30,7 @@ sap.ui.define([
|
|
|
34
30
|
"sap/ui/documentation/sdk/util/Resources",
|
|
35
31
|
'sap/base/util/LoaderExtensions',
|
|
36
32
|
"sap/ui/documentation/sdk/controller/util/ThemePicker"
|
|
37
|
-
], function(
|
|
38
|
-
KeyCodes,
|
|
33
|
+
], function (
|
|
39
34
|
jQuery,
|
|
40
35
|
BaseController,
|
|
41
36
|
NewsInfo,
|
|
@@ -48,12 +43,9 @@ sap.ui.define([
|
|
|
48
43
|
Fragment,
|
|
49
44
|
UriParameters,
|
|
50
45
|
library,
|
|
51
|
-
IconPool,
|
|
52
|
-
MessageBox,
|
|
53
46
|
mobileLibrary,
|
|
54
47
|
Log,
|
|
55
48
|
Version,
|
|
56
|
-
syncStyleClass,
|
|
57
49
|
Core,
|
|
58
50
|
openWindow,
|
|
59
51
|
globalFormatter,
|
|
@@ -65,1849 +57,1733 @@ sap.ui.define([
|
|
|
65
57
|
LoaderExtensions,
|
|
66
58
|
ThemePicker
|
|
67
59
|
) {
|
|
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
|
-
iCounter = 0;
|
|
118
|
-
aNodes = [];
|
|
119
|
-
while (aOriginalArr[i] && aOriginalArr[i].groupTitle && aOriginalArr[i].groupTitle === sCurrGroupTitle) {
|
|
120
|
-
aNodes.push(aOriginalArr[i]);
|
|
121
|
-
iCounter++;
|
|
122
|
-
i++;
|
|
123
|
-
}
|
|
124
|
-
i--;
|
|
125
|
-
aResultArr.push({
|
|
126
|
-
"groupTitle": sCurrGroupTitle,
|
|
127
|
-
"version": sCurrGroupTitle + " (" + iCounter + " versions)",
|
|
128
|
-
"nodes": aNodes,
|
|
129
|
-
"path": aNodes[0].path
|
|
130
|
-
});
|
|
60
|
+
"use strict";
|
|
61
|
+
|
|
62
|
+
var getResourcePath = function (sResource) {
|
|
63
|
+
return ResourcesUtil.getResourcesVersion() && !self['sap-ui-documentation-config']
|
|
64
|
+
? window.origin + sResource
|
|
65
|
+
: ResourcesUtil.getResourceOriginPath(sResource);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var MAIN_WEB_PAGE_TITLE = "Demo Kit - \uFFFD SDK",
|
|
69
|
+
WEB_PAGE_TITLE = {
|
|
70
|
+
topic: "Documentation - " + MAIN_WEB_PAGE_TITLE,
|
|
71
|
+
api: "API Reference - " + MAIN_WEB_PAGE_TITLE,
|
|
72
|
+
controls: "Samples - " + MAIN_WEB_PAGE_TITLE,
|
|
73
|
+
demoapps: "Demo Apps - " + MAIN_WEB_PAGE_TITLE,
|
|
74
|
+
tools: "Tools - " + MAIN_WEB_PAGE_TITLE,
|
|
75
|
+
home: MAIN_WEB_PAGE_TITLE
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var URLHelper = mobileLibrary.URLHelper,
|
|
79
|
+
SplitAppMode = mobileLibrary.SplitAppMode,
|
|
80
|
+
sNeoAppJsonPath = getResourcePath("/neo-app.json"), /* Load neo-app.json always from root URL */
|
|
81
|
+
sVersionOverviewJsonPath = getResourcePath("/versionoverview.json"), /* Load versionoverview.json always from root URL */
|
|
82
|
+
ABOUT_TEXT = "about",
|
|
83
|
+
CHANGE_VERSION_TEXT = "change_version",
|
|
84
|
+
CHANGE_SETTINGS_TEXT = "settings",
|
|
85
|
+
CHANGE_COOKIE_PREFERENCES_TEXT = "cookie_preferences",
|
|
86
|
+
DEMOKIT_DEFAULT_LANGUAGE = "en",
|
|
87
|
+
DEMOKIT_CONFIGURATION_LANGUAGE = "language",
|
|
88
|
+
DEMOKIT_CONFIGURATION_APPEARANCE = "appearance",
|
|
89
|
+
SITEMAP = "sitemap";
|
|
90
|
+
|
|
91
|
+
return BaseController.extend("sap.ui.documentation.sdk.controller.App", {
|
|
92
|
+
formatter: globalFormatter,
|
|
93
|
+
|
|
94
|
+
_arrToTreeConverter: function () {
|
|
95
|
+
var aNodes,
|
|
96
|
+
aOriginalArr = this._aNeoAppVersions.slice(),
|
|
97
|
+
aResultArr = [],
|
|
98
|
+
iCounter = 0,
|
|
99
|
+
sCurrGroupTitle = "";
|
|
100
|
+
|
|
101
|
+
for (var i = 0; i < aOriginalArr.length; i++) {
|
|
102
|
+
sCurrGroupTitle = aOriginalArr[i].groupTitle;
|
|
103
|
+
iCounter = 0;
|
|
104
|
+
aNodes = [];
|
|
105
|
+
while (aOriginalArr[i] && aOriginalArr[i].groupTitle && aOriginalArr[i].groupTitle === sCurrGroupTitle) {
|
|
106
|
+
aNodes.push(aOriginalArr[i]);
|
|
107
|
+
iCounter++;
|
|
108
|
+
i++;
|
|
131
109
|
}
|
|
110
|
+
i--;
|
|
111
|
+
aResultArr.push({
|
|
112
|
+
"groupTitle": sCurrGroupTitle,
|
|
113
|
+
"version": sCurrGroupTitle + " (" + iCounter + " versions)",
|
|
114
|
+
"nodes": aNodes,
|
|
115
|
+
"path": aNodes[0].path
|
|
116
|
+
});
|
|
117
|
+
}
|
|
132
118
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
119
|
+
return aResultArr;
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
onInit: function () {
|
|
123
|
+
BaseController.prototype.onInit.call(this);
|
|
124
|
+
|
|
125
|
+
var oViewModel = new JSONModel({
|
|
126
|
+
busy: false,
|
|
127
|
+
delay: 0,
|
|
128
|
+
device: Device,
|
|
129
|
+
bPhoneSize: false,
|
|
130
|
+
bDesktopSize: false,
|
|
131
|
+
bShowVersionSwitchButton: false,
|
|
132
|
+
bDarkThemeActive: false,
|
|
133
|
+
bLandscape: Device.orientation.landscape,
|
|
134
|
+
bHasMaster: false,
|
|
135
|
+
bSearchMode: false,
|
|
136
|
+
bHideTopicSection: !!window['sap-ui-documentation-hideTopicSection'],
|
|
137
|
+
bHideApiSection: !!window['sap-ui-documentation-hideApiSection'],
|
|
138
|
+
sAboutInfoSAPUI5: "Looking for the Demo Kit for a specific SAPUI5 version? " +
|
|
151
139
|
"Check at <a href = 'https://ui5.sap.com/versionoverview.html'>https://ui5.sap.com/versionoverview.html</a> " +
|
|
152
140
|
"which versions are available. " +
|
|
153
141
|
"You can view the version-specific Demo Kit by adding the version number to the URL, e.g. " +
|
|
154
142
|
"<a href='https://ui5.sap.com/1.71.46/'>https://ui5.sap.com/1.71.46/</a>",
|
|
155
|
-
|
|
143
|
+
sAboutInfoOpenUI5: "Looking for the Demo Kit for a specific OpenUI5 version? " +
|
|
156
144
|
"Check at <a href = 'https://sdk.openui5.org/versionoverview.html'>https://sdk.openui5.org/versionoverview.html</a> " +
|
|
157
145
|
"which versions are available. " +
|
|
158
146
|
"You can view the version-specific Demo Kit by adding the version number to the URL, e.g. " +
|
|
159
147
|
"<a href='https://sdk.openui5.org/1.71.46/'>https://sdk.openui5.org/1.71.46/</a>"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var oComponent = this.getOwnerComponent(),
|
|
163
|
-
oController = this;
|
|
148
|
+
});
|
|
164
149
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.MENU_LINKS_MAP = {
|
|
168
|
-
"copyright": "https://www.sap.com/corporate/en/legal/copyright.html",
|
|
169
|
-
"trademark": "https://www.sap.com/corporate/en/legal/trademark.html",
|
|
170
|
-
"disclaimer": "https://help.sap.com/viewer/disclaimer",
|
|
171
|
-
"sitemap": "sitemap"
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
jQuery.extend(this.MENU_LINKS_MAP, BaseController.LEGAL_LINKS);
|
|
175
|
-
|
|
176
|
-
this.getOwnerComponent().loadVersionInfo().then(function () {
|
|
177
|
-
var sProduct;
|
|
178
|
-
if (this.getModel("versionData").getProperty("/isOpenUI5")) {
|
|
179
|
-
sProduct = "OPENUI5";
|
|
180
|
-
} else {
|
|
181
|
-
sProduct = "SAPUI5";
|
|
182
|
-
}
|
|
183
|
-
MAIN_WEB_PAGE_TITLE = MAIN_WEB_PAGE_TITLE.replace("\uFFFD", sProduct);
|
|
184
|
-
Object.keys(WEB_PAGE_TITLE).forEach(function(sKey) {
|
|
185
|
-
WEB_PAGE_TITLE[sKey] = WEB_PAGE_TITLE[sKey].replace("\uFFFD", sProduct);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
if (this._sKey) {
|
|
189
|
-
this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[this._sKey]);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
}.bind(this));
|
|
150
|
+
var oComponent = this.getOwnerComponent(),
|
|
151
|
+
oController = this;
|
|
193
152
|
|
|
194
|
-
|
|
195
|
-
this.setModel(this._oNewsModel, "news");
|
|
153
|
+
ThemePicker.init(oController);
|
|
196
154
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
this._oView = this.getView();
|
|
204
|
-
|
|
205
|
-
this.setModel(oViewModel, "appView");
|
|
206
|
-
|
|
207
|
-
this.oHeader = this._oView.byId("headerToolbar");
|
|
208
|
-
|
|
209
|
-
this.oRouter = this.getRouter();
|
|
210
|
-
|
|
211
|
-
this._aNeoAppVersions = [];
|
|
212
|
-
|
|
213
|
-
this._selectHeader = this._oView.byId("selectHeader");
|
|
214
|
-
this._tabHeader = this._oView.byId("tabHeader");
|
|
215
|
-
|
|
216
|
-
this._oConfigUtil = this.getOwnerComponent().getConfigUtil();
|
|
217
|
-
this._oCookieNames = this._oConfigUtil.COOKIE_NAMES;
|
|
218
|
-
this._sLocalStorageNewsName = this._oConfigUtil.LOCAL_STORAGE_NAMES['OLD_NEWS_IDS'];
|
|
155
|
+
this.MENU_LINKS_MAP = {
|
|
156
|
+
"copyright": "https://www.sap.com/corporate/en/legal/copyright.html",
|
|
157
|
+
"trademark": "https://www.sap.com/corporate/en/legal/trademark.html",
|
|
158
|
+
"disclaimer": "https://help.sap.com/viewer/disclaimer",
|
|
159
|
+
"sitemap": "sitemap"
|
|
160
|
+
};
|
|
219
161
|
|
|
220
|
-
|
|
162
|
+
jQuery.extend(this.MENU_LINKS_MAP, BaseController.LEGAL_LINKS);
|
|
221
163
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.
|
|
164
|
+
this.getOwnerComponent().loadVersionInfo().then(function () {
|
|
165
|
+
var sProduct;
|
|
166
|
+
if (this.getModel("versionData").getProperty("/isOpenUI5")) {
|
|
167
|
+
sProduct = "OPENUI5";
|
|
168
|
+
} else {
|
|
169
|
+
sProduct = "SAPUI5";
|
|
170
|
+
}
|
|
171
|
+
MAIN_WEB_PAGE_TITLE = MAIN_WEB_PAGE_TITLE.replace("\uFFFD", sProduct);
|
|
172
|
+
Object.keys(WEB_PAGE_TITLE).forEach(function (sKey) {
|
|
173
|
+
WEB_PAGE_TITLE[sKey] = WEB_PAGE_TITLE[sKey].replace("\uFFFD", sProduct);
|
|
174
|
+
});
|
|
225
175
|
|
|
226
|
-
|
|
227
|
-
|
|
176
|
+
if (this._sKey) {
|
|
177
|
+
this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[this._sKey]);
|
|
178
|
+
}
|
|
228
179
|
|
|
229
|
-
|
|
180
|
+
}.bind(this));
|
|
230
181
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
182
|
+
// Config routes
|
|
183
|
+
this.oRouter = this.getRouter();
|
|
184
|
+
this.oRouter.attachRouteMatched(this.onRouteChange.bind(this));
|
|
185
|
+
this.oRouter.attachBypassed(this.onRouteNotFound.bind(this));
|
|
235
186
|
|
|
236
|
-
|
|
237
|
-
|
|
187
|
+
// Store product version information
|
|
188
|
+
this._aNeoAppVersions = [];
|
|
238
189
|
|
|
239
|
-
|
|
190
|
+
// Set app view models
|
|
191
|
+
this._oView = this.getView();
|
|
192
|
+
this.setModel(oViewModel, "appView");
|
|
240
193
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
this._updateMessagesModel(data);
|
|
244
|
-
}
|
|
194
|
+
this._oNewsModel = new JSONModel();
|
|
195
|
+
this.setModel(this._oNewsModel, "news");
|
|
245
196
|
|
|
246
|
-
|
|
197
|
+
this._oSupportedLangModel = new JSONModel();
|
|
198
|
+
this.setModel(this._oSupportedLangModel, "supportedLanguages");
|
|
247
199
|
|
|
248
|
-
|
|
249
|
-
this._applyCookiesConfiguration(this._aConfiguration);
|
|
250
|
-
} else {
|
|
251
|
-
this._applyDefaultConfiguration(this._aConfiguration);
|
|
252
|
-
}
|
|
200
|
+
this.setModel(new JSONModel(), "messagesData");
|
|
253
201
|
|
|
254
|
-
|
|
202
|
+
// Store references of the control tree
|
|
203
|
+
this._demoKitPage = this.byId("demoKitPage");
|
|
204
|
+
this._demoKitSubHeader = this.byId("demoKitSubHeader");
|
|
205
|
+
this._demoKitSideNavigation = this.byId("demoKitSideNavigation");
|
|
206
|
+
this._demoKitSplitApp = this.byId("splitApp");
|
|
255
207
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
}.bind(this));
|
|
208
|
+
// Adjust focus handling for the detail nav container
|
|
209
|
+
// (the default behavior would be to focus the first focusable element)
|
|
210
|
+
// Which in our case is the footer links fragment which causes the page to scroll down on mobile devices
|
|
211
|
+
this._demoKitSplitApp._oDetailNav.setAutoFocus(false);
|
|
262
212
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
213
|
+
// attach to the afterMasterClose event of the splitApp to be able to toggle the button state on clicking anywhere
|
|
214
|
+
this._demoKitSplitApp.attachEvent("afterMasterClose", function (oEvent) {
|
|
215
|
+
oViewModel.setProperty("/bIsShownMaster", false);
|
|
216
|
+
}, this);
|
|
266
217
|
|
|
267
|
-
|
|
268
|
-
|
|
218
|
+
// Init version info
|
|
219
|
+
this._requestVersionInfo();
|
|
220
|
+
// Init search
|
|
221
|
+
this.initSearch();
|
|
222
|
+
// Since the searchfield is open by default on desktop devices, we need to load the search index
|
|
223
|
+
SearchUtil.init();
|
|
269
224
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
iVisibleMessagesCount = 0;
|
|
225
|
+
// Init survey
|
|
226
|
+
this.setSurveyModelData();
|
|
273
227
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
});
|
|
228
|
+
// Subscribe to events
|
|
229
|
+
this.bus = Core.getEventBus();
|
|
230
|
+
this.bus.subscribe("newsChanged", "onDemoKitNewsChanged", this._syncNewsModelWithNewsInfo, this);
|
|
231
|
+
this.bus.subscribe("themeChanged", "onThemeChanged", this._onThemeChanged, this);
|
|
279
232
|
|
|
280
|
-
|
|
233
|
+
// Init cookie settings
|
|
234
|
+
this._oConfigUtil = this.getOwnerComponent().getConfigUtil();
|
|
235
|
+
this._oCookieNames = this._oConfigUtil.COOKIE_NAMES;
|
|
236
|
+
this._sLocalStorageNewsName = this._oConfigUtil.LOCAL_STORAGE_NAMES['OLD_NEWS_IDS'];
|
|
281
237
|
|
|
282
|
-
|
|
238
|
+
NewsInfo.prepareNewsData(this._oConfigUtil);
|
|
283
239
|
|
|
284
|
-
|
|
240
|
+
this._createConfigurationBasedOnURIInput();
|
|
285
241
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
242
|
+
if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1" && this._aConfiguration.length > 0) {
|
|
243
|
+
this._applyCookiesConfiguration(this._aConfiguration);
|
|
244
|
+
} else {
|
|
245
|
+
this._applyDefaultConfiguration(this._aConfiguration);
|
|
246
|
+
}
|
|
289
247
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
// such as Dialog and Popover.
|
|
294
|
-
jQuery(document.body).addClass(this.getOwnerComponent().getContentDensityClass());
|
|
248
|
+
oComponent.getCookiesManagement().then(function (oCookieMgmtComponent) {
|
|
249
|
+
oCookieMgmtComponent.enable(oComponent.getRootControl());
|
|
250
|
+
});
|
|
295
251
|
|
|
296
|
-
|
|
252
|
+
// Handle page resize
|
|
253
|
+
ResizeHandler.register(this._demoKitPage, this.onPageResize.bind(this));
|
|
254
|
+
},
|
|
297
255
|
|
|
298
|
-
|
|
299
|
-
|
|
256
|
+
onBeforeRendering: function () {
|
|
257
|
+
Device.orientation.detachHandler(this._onOrientationChange, this);
|
|
258
|
+
},
|
|
300
259
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
},
|
|
260
|
+
onAfterRendering: function () {
|
|
261
|
+
// apply content density mode to the body tag
|
|
262
|
+
// in order to get the controls in the static area styled correctly,
|
|
263
|
+
// such as Dialog and Popover.
|
|
264
|
+
jQuery(document.body).addClass(this.getOwnerComponent().getContentDensityClass());
|
|
307
265
|
|
|
308
|
-
|
|
266
|
+
Device.orientation.attachHandler(this._onOrientationChange, this);
|
|
309
267
|
|
|
310
|
-
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
268
|
+
this._syncNewsModelWithNewsInfo();
|
|
313
269
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
sKey = oTabToSelect ? oTabToSelect.getKey() : "home",
|
|
318
|
-
oViewModel = this.getModel("appView"),
|
|
319
|
-
bPhoneSize = oViewModel.getProperty("/bPhoneSize"),
|
|
320
|
-
bSearchMode = oViewModel.getProperty("/bSearchMode"),
|
|
321
|
-
bPhone = Device.system.phone,
|
|
322
|
-
bHasMaster = this.getOwnerComponent().getConfigUtil().hasMasterView(sRouteName),
|
|
323
|
-
oMasterView,
|
|
324
|
-
sMasterViewId;
|
|
270
|
+
// Adds additional class in order to manipulate the version switch button content in the header
|
|
271
|
+
this._adjustVersionSwitchButton();
|
|
272
|
+
},
|
|
325
273
|
|
|
326
|
-
|
|
274
|
+
onExit: function () {
|
|
275
|
+
Device.orientation.detachHandler(this._onOrientationChange, this);
|
|
327
276
|
|
|
328
|
-
|
|
277
|
+
if (this.highlighter) {
|
|
278
|
+
this.highlighter.destroy();
|
|
279
|
+
}
|
|
280
|
+
},
|
|
329
281
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
282
|
+
onRouteChange: function (oEvent) {
|
|
283
|
+
if (!this.oRouter.getRoute(oEvent.getParameter("name"))._oConfig.target) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
333
286
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
287
|
+
var oMasterView,
|
|
288
|
+
sMasterViewId,
|
|
289
|
+
bPhone = Device.system.phone,
|
|
290
|
+
sRouteName = oEvent.getParameter("name"),
|
|
291
|
+
sTabId = this.oRouter.getRoute(sRouteName)._oConfig.target[0] + "Tab",
|
|
292
|
+
oTabToSelect = this._oView.byId(sTabId),
|
|
293
|
+
sKey = oTabToSelect ? oTabToSelect.getKey() : "home",
|
|
294
|
+
oViewModel = this.getModel("appView"),
|
|
295
|
+
bHasMaster = this.getOwnerComponent().getConfigUtil().hasMasterView(sRouteName);
|
|
339
296
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
oViewModel.setProperty("/bIsShownMaster", false);
|
|
343
|
-
this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[sKey]);
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
toggleMaster: function(oEvent) {
|
|
347
|
-
var bPressed = oEvent.getParameter("pressed"),
|
|
348
|
-
bPhone = Device.system.phone,
|
|
349
|
-
oSplitApp = this.byId("splitApp"),
|
|
350
|
-
isShowHideMode = oSplitApp.getMode() === SplitAppMode.ShowHideMode,
|
|
351
|
-
isHideMode = oSplitApp.getMode() === SplitAppMode.HideMode,
|
|
352
|
-
sMasterViewId = this.getModel("appView").getProperty("/sMasterViewId"),
|
|
353
|
-
fnToggle;
|
|
354
|
-
|
|
355
|
-
if (!bPhone && (isShowHideMode || isHideMode)) {
|
|
356
|
-
fnToggle = (bPressed) ? oSplitApp.showMaster : oSplitApp.hideMaster;
|
|
357
|
-
fnToggle.call(oSplitApp);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
297
|
+
this._setHeaderSelectedKey(sKey);
|
|
298
|
+
this._setSelectedSectionTitle(sKey);
|
|
360
299
|
|
|
361
|
-
|
|
362
|
-
if (bPhone) {
|
|
363
|
-
if (bPressed) {
|
|
364
|
-
oSplitApp.to(sMasterViewId);
|
|
365
|
-
} else {
|
|
366
|
-
oSplitApp.backDetail();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
},
|
|
300
|
+
oViewModel.setProperty("/bHasMaster", bHasMaster);
|
|
370
301
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
302
|
+
if (bPhone && bHasMaster) { // on phone we need the id of the master view (for navigation)
|
|
303
|
+
oMasterView = this.getOwnerComponent().getConfigUtil().getMasterView(sRouteName);
|
|
304
|
+
sMasterViewId = oMasterView && oMasterView.getId();
|
|
305
|
+
oViewModel.setProperty("/sMasterViewId", sMasterViewId);
|
|
306
|
+
}
|
|
374
307
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
308
|
+
// hide master on route change
|
|
309
|
+
this._demoKitSplitApp.hideMaster();
|
|
310
|
+
oViewModel.setProperty("/bIsShownMaster", false);
|
|
311
|
+
this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[sKey]);
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
toggleMaster: function (oEvent) {
|
|
315
|
+
var oViewModel = this.getModel("appView"),
|
|
316
|
+
sMasterViewId = oViewModel.getProperty("/sMasterViewId"),
|
|
317
|
+
isShowHideMode = this._demoKitSplitApp.getMode() === SplitAppMode.ShowHideMode,
|
|
318
|
+
isHideMode = this._demoKitSplitApp.getMode() === SplitAppMode.HideMode,
|
|
319
|
+
bPhone = Device.system.phone,
|
|
320
|
+
bPressed = oEvent.getParameter("pressed"),
|
|
321
|
+
fnToggle;
|
|
322
|
+
|
|
323
|
+
if (!bPhone && (isShowHideMode || isHideMode)) {
|
|
324
|
+
fnToggle = (bPressed) ? this._demoKitSplitApp.showMaster : this._demoKitSplitApp.hideMaster;
|
|
325
|
+
fnToggle.call(this._demoKitSplitApp);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
379
328
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
329
|
+
// on phone there is no master-detail pair, but a single navContainer => so navigate within this navContainer
|
|
330
|
+
if (bPhone) {
|
|
331
|
+
if (bPressed) {
|
|
332
|
+
this._demoKitSplitApp.to(sMasterViewId);
|
|
383
333
|
} else {
|
|
384
|
-
this.
|
|
385
|
-
|
|
386
|
-
this._setHeaderSelectedKey("home");
|
|
334
|
+
this._demoKitSplitApp.backDetail();
|
|
387
335
|
}
|
|
388
|
-
}
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* This function handles the navigation logic for different sections,
|
|
341
|
+
* including handling special cases for specific keys and devices.
|
|
342
|
+
*
|
|
343
|
+
* @param {Object} oEvent - The event object.
|
|
344
|
+
* @returns {void}
|
|
345
|
+
*/
|
|
346
|
+
navigateToSection: function (oEvent) {
|
|
347
|
+
var sKey = oEvent.getParameter("key") || oEvent.getParameter("item").getKey(),
|
|
348
|
+
bEventFiredFromSideNavigation = oEvent.getSource().isA("sap.tnt.SideNavigation");
|
|
349
|
+
|
|
350
|
+
if (this._getHeaderSubMenuItemKeys().includes(sKey)) {
|
|
351
|
+
this._headerItemSelectHandler(sKey);
|
|
352
|
+
return; // stay on the same page
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// close the side navigation on phone devices
|
|
356
|
+
if (Device.system.phone && bEventFiredFromSideNavigation) {
|
|
357
|
+
this.onSideNavigationButtonPress();
|
|
358
|
+
}
|
|
389
359
|
|
|
390
|
-
|
|
391
|
-
this.getRouter().navTo(
|
|
392
|
-
}
|
|
360
|
+
if (sKey && sKey !== "home") {
|
|
361
|
+
this.getRouter().navTo(sKey, {});
|
|
362
|
+
} else {
|
|
363
|
+
this.getRouter().navTo("welcome", {});
|
|
364
|
+
this._setHeaderSelectedKey("home");
|
|
365
|
+
}
|
|
366
|
+
},
|
|
393
367
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
368
|
+
navigateToNews: function () {
|
|
369
|
+
this.getRouter().navTo("news");
|
|
370
|
+
},
|
|
397
371
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
Fragment.load({
|
|
402
|
-
name: "sap.ui.documentation.sdk.view.NewsPopover",
|
|
403
|
-
controller: this
|
|
404
|
-
}).then(function(oPopover) {
|
|
405
|
-
oView.addDependent(oPopover);
|
|
406
|
-
this._oNewsPopover = oPopover;
|
|
407
|
-
this._oNewsPopover.openBy(oButton);
|
|
408
|
-
}.bind(this));
|
|
409
|
-
} else {
|
|
410
|
-
this._oNewsPopover.openBy(oButton);
|
|
411
|
-
}
|
|
412
|
-
},
|
|
372
|
+
onNewsButtonPress: function (oEvent) {
|
|
373
|
+
var oButton = oEvent.getSource(),
|
|
374
|
+
oView = this.getView();
|
|
413
375
|
|
|
414
|
-
|
|
415
|
-
this._oNewsPopover.close();
|
|
376
|
+
if (this._oNewsModel.getProperty("/newsCount") === 0) {
|
|
416
377
|
this.navigateToNews();
|
|
417
|
-
}
|
|
378
|
+
} else if (!this._oNewsPopover) {
|
|
379
|
+
Fragment.load({
|
|
380
|
+
name: "sap.ui.documentation.sdk.view.NewsPopover",
|
|
381
|
+
controller: this
|
|
382
|
+
}).then(function (oPopover) {
|
|
383
|
+
oView.addDependent(oPopover);
|
|
384
|
+
this._oNewsPopover = oPopover;
|
|
385
|
+
this._oNewsPopover.openBy(oButton);
|
|
386
|
+
}.bind(this));
|
|
387
|
+
} else {
|
|
388
|
+
this._oNewsPopover.openBy(oButton);
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
handleShowAllPress: function () {
|
|
393
|
+
this._oNewsPopover.close();
|
|
394
|
+
this.navigateToNews();
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
handleDismissAllPress: function () {
|
|
398
|
+
NewsInfo.moveAllNewItemsToOld();
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
handleNewsItemClose: function (oEvent) {
|
|
402
|
+
var oItem = oEvent.getSource(),
|
|
403
|
+
iItemCustomId = oItem.getCustomData()[0].getValue(),
|
|
404
|
+
oItemInfoInItemsProperty = this._oNewsModel.getProperty("/items").find(function (oItem) {
|
|
405
|
+
return oItem.id === iItemCustomId;
|
|
406
|
+
});
|
|
418
407
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
},
|
|
408
|
+
NewsInfo.moveNewItemToOld(oItemInfoInItemsProperty);
|
|
409
|
+
},
|
|
422
410
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
oItemInfoInItemsProperty = this._oNewsModel.getProperty("/items").find(function(oItem){
|
|
427
|
-
return oItem.id === iItemCustomId;
|
|
428
|
-
});
|
|
411
|
+
handleVisitNewsLink: function (oEvent) {
|
|
412
|
+
var oItem = oEvent.getSource(),
|
|
413
|
+
sItemLink = oItem.getCustomData()[0].getValue();
|
|
429
414
|
|
|
430
|
-
|
|
431
|
-
|
|
415
|
+
URLHelper.redirect(sItemLink, true);
|
|
416
|
+
},
|
|
432
417
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
418
|
+
_syncNewsModelWithNewsInfo: function () {
|
|
419
|
+
var aNewsInfoCopy,
|
|
420
|
+
sPreparationFailureMessage = NewsInfo.getPreparationFailureMessage();
|
|
436
421
|
|
|
437
|
-
|
|
438
|
-
|
|
422
|
+
if (!sPreparationFailureMessage) {
|
|
423
|
+
aNewsInfoCopy = NewsInfo.getNewNewsArray().slice();
|
|
424
|
+
this._oNewsModel.setProperty("/items", aNewsInfoCopy);
|
|
425
|
+
this._oNewsModel.setProperty("/newsCount", aNewsInfoCopy.length);
|
|
426
|
+
}
|
|
439
427
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
sPreparationFailureMessage = NewsInfo.getPreparationFailureMessage();
|
|
428
|
+
this._oNewsModel.setProperty("/newsPreparationFailureMessage", sPreparationFailureMessage);
|
|
429
|
+
},
|
|
443
430
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this._oNewsModel.setProperty("/newsCount", aNewsInfoCopy.length);
|
|
448
|
-
}
|
|
431
|
+
onMenuButtonItemSelected: function (oEvent) {
|
|
432
|
+
var sTargetText = oEvent.getParameter("item").getKey(),
|
|
433
|
+
sTarget = this.MENU_LINKS_MAP[sTargetText];
|
|
449
434
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
} else if (ThemePicker._getTheme()[sTargetText]) {
|
|
470
|
-
this._updateAppearance(sTargetText);
|
|
471
|
-
} else if (sTarget === SITEMAP) {
|
|
472
|
-
this.onSiteMapPress();
|
|
473
|
-
} else if (sTarget) {
|
|
474
|
-
URLHelper.redirect(sTarget, true);
|
|
475
|
-
}
|
|
476
|
-
this.sTarget = sTarget;
|
|
477
|
-
},
|
|
435
|
+
if (sTargetText === ABOUT_TEXT) {
|
|
436
|
+
this.aboutDialogOpen();
|
|
437
|
+
} else if (sTargetText === CHANGE_SETTINGS_TEXT) {
|
|
438
|
+
this.settingsDialogOpen();
|
|
439
|
+
} else if (sTargetText === CHANGE_COOKIE_PREFERENCES_TEXT) {
|
|
440
|
+
this.getOwnerComponent().getCookiesManagement().then(function (oCookieMgmtComponent) {
|
|
441
|
+
oCookieMgmtComponent.cookieSettingsDialogOpen({ showCookieDetails: true }, this.getView());
|
|
442
|
+
}.bind(this));
|
|
443
|
+
} else if (sTargetText === CHANGE_VERSION_TEXT) {
|
|
444
|
+
this.onChangeVersionButtonPress();
|
|
445
|
+
} else if (ThemePicker._getTheme()[sTargetText]) {
|
|
446
|
+
this._updateAppearance(sTargetText);
|
|
447
|
+
} else if (sTarget === SITEMAP) {
|
|
448
|
+
this.onSiteMapPress();
|
|
449
|
+
} else if (sTarget) {
|
|
450
|
+
URLHelper.redirect(sTarget, true);
|
|
451
|
+
}
|
|
452
|
+
this.sTarget = sTarget;
|
|
453
|
+
},
|
|
478
454
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
455
|
+
createSearchPopover: function () {
|
|
456
|
+
var PlacementType = mobileLibrary.PlacementType,
|
|
457
|
+
searchInput = this.getView().byId("searchControl"),
|
|
458
|
+
oPopover = new ResponsivePopover({
|
|
483
459
|
showArrow: false,
|
|
484
460
|
showHeader: false,
|
|
485
461
|
contentWidth: "600px",
|
|
486
462
|
placement: PlacementType.Vertical,
|
|
487
463
|
horizontalScrolling: false,
|
|
488
464
|
initialFocus: this.getView().byId("searchControl-searchField")
|
|
489
|
-
})
|
|
490
|
-
.addStyleClass("sapMSltPicker-CTX");
|
|
465
|
+
}).addStyleClass("sapMSltPicker-CTX");
|
|
491
466
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
467
|
+
// implement the same <code>open</code> function as in the dialog
|
|
468
|
+
// to allow the controller open the search picker regardless its type (popover or dialog)
|
|
469
|
+
oPopover.open = function () {
|
|
470
|
+
oPopover.openBy(searchInput);
|
|
471
|
+
};
|
|
497
472
|
|
|
498
|
-
|
|
473
|
+
this.getView().addDependent(oPopover);
|
|
474
|
+
|
|
475
|
+
return oPopover;
|
|
476
|
+
},
|
|
477
|
+
|
|
478
|
+
createSearchPicker: function () {
|
|
479
|
+
var oPicker = Device.system.phone ? this.createSearchDialog() : this.createSearchPopover();
|
|
480
|
+
this.createSearchPickerContent().then(function (oContent) {
|
|
481
|
+
oPicker.addContent(oContent);
|
|
482
|
+
});
|
|
483
|
+
return oPicker;
|
|
484
|
+
},
|
|
485
|
+
|
|
486
|
+
createSearchDialog: function () {
|
|
487
|
+
var dialog,
|
|
488
|
+
originalValue,
|
|
489
|
+
dialogSearchField,
|
|
490
|
+
customHeader,
|
|
491
|
+
okButton,
|
|
492
|
+
closeButton,
|
|
493
|
+
bSearchRequested;
|
|
494
|
+
|
|
495
|
+
var oInput = this.getView().byId("searchControl");
|
|
496
|
+
|
|
497
|
+
// Helper functions
|
|
498
|
+
function handleDialogButtonPress() {
|
|
499
|
+
var sCurrentSearchValue = oInput.getValue();
|
|
500
|
+
|
|
501
|
+
if (sCurrentSearchValue !== originalValue) {
|
|
502
|
+
oInput._updateValue(sCurrentSearchValue);
|
|
503
|
+
oInput.fireLiveChange({ newValue: sCurrentSearchValue });
|
|
504
|
+
} else {
|
|
505
|
+
oInput.fireLiveChange({ newValue: originalValue });
|
|
506
|
+
}
|
|
499
507
|
|
|
500
|
-
|
|
501
|
-
|
|
508
|
+
dialog.close();
|
|
509
|
+
oInput._toggleOpen(false);
|
|
510
|
+
}
|
|
502
511
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
originalValue,
|
|
514
|
-
dialogSearchField,
|
|
515
|
-
customHeader,
|
|
516
|
-
okButton,
|
|
517
|
-
closeButton,
|
|
518
|
-
bSearchRequested;
|
|
519
|
-
|
|
520
|
-
var oInput = this.getView().byId("searchControl");
|
|
521
|
-
|
|
522
|
-
// use sap.ui.require to avoid circular dependency between the SearchField and Suggest
|
|
523
|
-
dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
|
|
524
|
-
liveChange : function (oEvent) {
|
|
525
|
-
var value = oEvent.getParameter("newValue");
|
|
526
|
-
oInput._updateValue(value);
|
|
527
|
-
oInput.fireLiveChange({newValue: value});
|
|
528
|
-
},
|
|
529
|
-
search : function (oEvent) {
|
|
530
|
-
if (!oEvent.getParameter("clearButtonPressed")) {
|
|
531
|
-
dialog.close();
|
|
532
|
-
bSearchRequested = true;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
});
|
|
512
|
+
function moveCursorToEnd(el) {
|
|
513
|
+
if (typeof el.selectionStart == "number") {
|
|
514
|
+
el.selectionStart = el.selectionEnd = el.value.length;
|
|
515
|
+
} else if (typeof el.createTextRange != "undefined") {
|
|
516
|
+
el.focus();
|
|
517
|
+
var range = el.createTextRange();
|
|
518
|
+
range.collapse(false);
|
|
519
|
+
range.select();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
536
522
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
523
|
+
// use sap.ui.require to avoid circular dependency between the SearchField and Suggest
|
|
524
|
+
dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
|
|
525
|
+
liveChange: function (oEvent) {
|
|
526
|
+
var value = oEvent.getParameter("newValue");
|
|
527
|
+
oInput._updateValue(value);
|
|
528
|
+
oInput.fireLiveChange({ newValue: value });
|
|
529
|
+
},
|
|
530
|
+
search: function (oEvent) {
|
|
531
|
+
if (!oEvent.getParameter("clearButtonPressed")) {
|
|
541
532
|
dialog.close();
|
|
542
|
-
|
|
533
|
+
bSearchRequested = true;
|
|
543
534
|
}
|
|
544
|
-
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
545
537
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
538
|
+
closeButton = new Button({
|
|
539
|
+
icon: "sap-icon://decline",
|
|
540
|
+
press: function () {
|
|
541
|
+
handleDialogButtonPress();
|
|
542
|
+
}
|
|
543
|
+
});
|
|
549
544
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
dialog.close();
|
|
554
|
-
}
|
|
555
|
-
});
|
|
545
|
+
customHeader = new Toolbar({
|
|
546
|
+
content: [dialogSearchField, closeButton]
|
|
547
|
+
});
|
|
556
548
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
el.focus();
|
|
562
|
-
var range = el.createTextRange();
|
|
563
|
-
range.collapse(false);
|
|
564
|
-
range.select();
|
|
565
|
-
}
|
|
549
|
+
okButton = new Button({
|
|
550
|
+
text: Core.getLibraryResourceBundle("sap.m").getText("MSGBOX_OK"),
|
|
551
|
+
press: function () {
|
|
552
|
+
handleDialogButtonPress();
|
|
566
553
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
dialog = new (sap.ui.require('sap/m/Dialog'))({
|
|
557
|
+
stretch: true,
|
|
558
|
+
customHeader: customHeader,
|
|
559
|
+
beginButton: okButton,
|
|
560
|
+
beforeClose: function () {
|
|
561
|
+
oInput._bSuggestionSuppressed = true;
|
|
562
|
+
},
|
|
563
|
+
beforeOpen: function () {
|
|
564
|
+
originalValue = oInput.getValue();
|
|
565
|
+
dialogSearchField._updateValue(originalValue);
|
|
566
|
+
bSearchRequested = false; // reset flag
|
|
567
|
+
},
|
|
568
|
+
afterOpen: function () {
|
|
569
|
+
var $input = dialogSearchField.$().find('input');
|
|
570
|
+
$input.trigger("focus");
|
|
571
|
+
moveCursorToEnd($input.get(0));
|
|
572
|
+
},
|
|
573
|
+
afterClose: function (oEvent) {
|
|
574
|
+
if (bSearchRequested) { // fire the search event if not cancelled
|
|
575
|
+
oInput.fireSearch({
|
|
576
|
+
query: oInput.getValue(),
|
|
577
|
+
clearButtonPressed: false
|
|
578
|
+
});
|
|
592
579
|
}
|
|
593
|
-
});
|
|
594
580
|
|
|
595
|
-
|
|
581
|
+
oInput._toggleOpen(false);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
596
584
|
|
|
597
|
-
|
|
598
|
-
},
|
|
585
|
+
this.getView().addDependent(dialog);
|
|
599
586
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
this.oPicker = this.createSearchPicker();
|
|
603
|
-
}
|
|
587
|
+
return dialog;
|
|
588
|
+
},
|
|
604
589
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
590
|
+
openSearchPicker: function () {
|
|
591
|
+
if (!this.oPicker) {
|
|
592
|
+
this.oPicker = this.createSearchPicker();
|
|
593
|
+
}
|
|
609
594
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
595
|
+
if (!this.oPicker.isOpen()) {
|
|
596
|
+
this.oPicker.open();
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
|
|
600
|
+
createSearchPickerContent: function () {
|
|
601
|
+
return Fragment.load({
|
|
602
|
+
name: "sap.ui.documentation.sdk.view.GlobalSearchPicker",
|
|
603
|
+
controller: this
|
|
604
|
+
}).then(function (oContent) {
|
|
605
|
+
|
|
606
|
+
var oShortList = Core.byId("shortList"),
|
|
607
|
+
oController = this,
|
|
608
|
+
sSearchQuery;
|
|
609
|
+
|
|
610
|
+
oShortList.addEventDelegate({
|
|
611
|
+
onAfterRendering: function () {
|
|
612
|
+
var oConfig = {
|
|
613
|
+
useExternalStyles: false,
|
|
614
|
+
shouldBeObserved: true,
|
|
615
|
+
isCaseSensitive: false
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
oController.highlighter = new Highlighter(oShortList.getDomRef(), oConfig);
|
|
619
|
+
sSearchQuery = oController.getModel("searchData").getProperty("/query");
|
|
620
|
+
sSearchQuery && oController.highlighter.highlight(sSearchQuery);
|
|
621
|
+
oShortList.removeEventDelegate(this);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
634
624
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
625
|
+
return oContent;
|
|
626
|
+
}.bind(this));
|
|
627
|
+
},
|
|
638
628
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
629
|
+
initSearch: function () {
|
|
630
|
+
// set the search data to custom search`s suggestions
|
|
631
|
+
var oModel = this.getModel("searchData"),
|
|
642
632
|
oSectionToRoutesMap = {
|
|
643
633
|
"topics": ["topic", "topicId", "subTopicId"],
|
|
644
634
|
"entity": ["sample", "controlsMaster", "controls", "code", "entity"],
|
|
645
635
|
"apiref": ["api", "apiSpecialRoute", "apiId"]
|
|
646
636
|
};
|
|
647
637
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
638
|
+
// update current section on navigate
|
|
639
|
+
this.oRouter.attachRouteMatched(function () {
|
|
640
|
+
oModel.setProperty("/preferencedCategory", null);
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
Object.keys(oSectionToRoutesMap).forEach(function (sSectionKey) {
|
|
644
|
+
var aRoutes = oSectionToRoutesMap[sSectionKey];
|
|
645
|
+
aRoutes.forEach(function (sRoute) {
|
|
646
|
+
this.oRouter.getRoute(sRoute).attachPatternMatched(function () {
|
|
647
|
+
oModel.setProperty("/preferencedCategory", sSectionKey);
|
|
648
|
+
});
|
|
659
649
|
}.bind(this));
|
|
660
|
-
}
|
|
650
|
+
}.bind(this));
|
|
651
|
+
},
|
|
661
652
|
|
|
662
|
-
|
|
663
|
-
|
|
653
|
+
getSearchPickerTitle: function (oContext) {
|
|
654
|
+
var getMessageBundle = Core.getLibraryResourceBundle("sap.ui.documentation"),
|
|
664
655
|
sTitle;
|
|
665
656
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
657
|
+
switch (this.getModel("searchData").getProperty("/preferencedCategory")) {
|
|
658
|
+
case "topics":
|
|
659
|
+
sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_DOCUMENTATION");
|
|
660
|
+
break;
|
|
661
|
+
case "apiref":
|
|
662
|
+
sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_API_REFERENCE");
|
|
663
|
+
break;
|
|
664
|
+
case "entity":
|
|
665
|
+
sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_SAMPLES");
|
|
666
|
+
break;
|
|
667
|
+
default:
|
|
668
|
+
sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_ALL");
|
|
669
|
+
}
|
|
679
670
|
|
|
680
|
-
|
|
681
|
-
|
|
671
|
+
return sTitle;
|
|
672
|
+
},
|
|
682
673
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
674
|
+
formatSuggestionTitle: function (sTitle, sSummary) {
|
|
675
|
+
var sFormatted = sTitle || "";
|
|
676
|
+
if (sSummary) {
|
|
677
|
+
sFormatted += ": " + sSummary;
|
|
678
|
+
}
|
|
679
|
+
return sFormatted;
|
|
680
|
+
},
|
|
681
|
+
|
|
682
|
+
onSearchResultsSummaryPress: function (oEvent) {
|
|
683
|
+
var sCategory = oEvent.oSource.data("category");
|
|
684
|
+
this.navToSearchResults(sCategory);
|
|
685
|
+
},
|
|
686
|
+
|
|
687
|
+
onSearchPickerItemPress: function (oEvent) {
|
|
688
|
+
var contextPath = oEvent.oSource.getBindingContextPath(),
|
|
689
|
+
oDataItem = this.getModel("searchData").getProperty(contextPath);
|
|
690
|
+
if (oDataItem.external) {
|
|
691
|
+
openWindow(new URL(oDataItem.path, document.baseURI).href);
|
|
692
|
+
} else {
|
|
693
|
+
this.getRouter().parsePath(oDataItem.path);
|
|
694
|
+
}
|
|
695
|
+
this.oPicker.close();
|
|
696
|
+
},
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Updates the appearance of the Demo Kit depending of the incoming appearance keyword.
|
|
700
|
+
* If the keyword is "auto" the appearance will be updated to light or dark depending on the
|
|
701
|
+
* user's OS settings.
|
|
702
|
+
*
|
|
703
|
+
* @param {string} sKey the appearance keyword
|
|
704
|
+
* @param {object} oComponent the component where the theme will be changed
|
|
705
|
+
* @private
|
|
706
|
+
*/
|
|
707
|
+
_updateAppearance: function (sKey) {
|
|
708
|
+
var oComponent = this;
|
|
709
|
+
ThemePicker._updateAppearance(sKey, oComponent);
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Creates configuration for the application regarding the URI input.
|
|
714
|
+
*
|
|
715
|
+
* @private
|
|
716
|
+
*/
|
|
717
|
+
_createConfigurationBasedOnURIInput: function () {
|
|
718
|
+
var oUriParams = UriParameters.fromQuery(window.location.search);
|
|
719
|
+
this._aConfiguration = [];
|
|
720
|
+
|
|
721
|
+
if (!(oUriParams.has('sap-ui-language') || oUriParams.has('sap-language'))) {
|
|
722
|
+
this._aConfiguration.push(DEMOKIT_CONFIGURATION_LANGUAGE);
|
|
723
|
+
}
|
|
730
724
|
|
|
731
|
-
|
|
732
|
-
|
|
725
|
+
if (!(oUriParams.has('sap-ui-theme') || oUriParams.has('sap-theme'))) {
|
|
726
|
+
this._aConfiguration.push(DEMOKIT_CONFIGURATION_APPEARANCE);
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Applies configuration for the application regarding the default values.
|
|
732
|
+
*
|
|
733
|
+
* @private
|
|
734
|
+
*/
|
|
735
|
+
_applyDefaultConfiguration: function () {
|
|
736
|
+
this._aConfiguration.forEach(function (sConf) {
|
|
737
|
+
if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
|
|
738
|
+
Core.getConfiguration().setLanguage(DEMOKIT_DEFAULT_LANGUAGE);
|
|
739
|
+
} else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
|
|
740
|
+
this._updateAppearance(ThemePicker._getTheme().auto);
|
|
733
741
|
}
|
|
734
|
-
},
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
+
}, this);
|
|
743
|
+
|
|
744
|
+
this._oSupportedLangModel.setProperty("/selectedLang", Core.getConfiguration().getLanguage());
|
|
745
|
+
},
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Applies configuration for the application regarding the cookies.
|
|
749
|
+
*
|
|
750
|
+
* @private
|
|
751
|
+
*/
|
|
752
|
+
_applyCookiesConfiguration: function () {
|
|
753
|
+
var sCookieValue, sConf, i;
|
|
754
|
+
|
|
755
|
+
for (i = 0; i < this._aConfiguration.length; i++) {
|
|
756
|
+
sConf = this._aConfiguration[i];
|
|
757
|
+
sCookieValue = this._oConfigUtil.getCookieValue(sConf);
|
|
758
|
+
|
|
759
|
+
if (sCookieValue !== "") {
|
|
742
760
|
if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
|
|
743
|
-
|
|
761
|
+
this._setSelectedLanguage(sCookieValue);
|
|
744
762
|
} else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
|
|
745
|
-
this._updateAppearance(
|
|
763
|
+
this._updateAppearance(sCookieValue);
|
|
746
764
|
}
|
|
747
|
-
}, this);
|
|
748
|
-
|
|
749
|
-
this._oSupportedLangModel.setProperty("/selectedLang", Core.getConfiguration().getLanguage());
|
|
750
|
-
},
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* Applies configuration for the application regarding the cookies.
|
|
754
|
-
* @private
|
|
755
|
-
*/
|
|
756
|
-
_applyCookiesConfiguration: function () {
|
|
757
|
-
var sCookieValue, sConf, i;
|
|
758
|
-
|
|
759
|
-
for (i = 0; i < this._aConfiguration.length; i++) {
|
|
760
|
-
sConf = this._aConfiguration[i];
|
|
761
|
-
sCookieValue = this._oConfigUtil.getCookieValue(sConf);
|
|
762
|
-
|
|
763
|
-
if (sCookieValue !== "") {
|
|
764
|
-
if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
|
|
765
|
-
this._setSelectedLanguage(sCookieValue);
|
|
766
|
-
} else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
|
|
767
|
-
this._updateAppearance(sCookieValue);
|
|
768
|
-
}
|
|
769
765
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
766
|
+
// If we have available value for the given cookie we remove it from the configuration array.
|
|
767
|
+
this._aConfiguration.splice(i, 1);
|
|
768
|
+
i--;
|
|
774
769
|
}
|
|
770
|
+
}
|
|
775
771
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
772
|
+
// If we still have configurations which are not set by their cookie values, we apply their default values.
|
|
773
|
+
if (this._aConfiguration.length > 0) {
|
|
774
|
+
this._applyDefaultConfiguration();
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Helper for function for preparing the data for the SupportedLangModel.
|
|
780
|
+
*
|
|
781
|
+
* @private
|
|
782
|
+
* @returns {Object[]} Array of objects containg the needed data for the SupportedLangModel
|
|
783
|
+
*/
|
|
784
|
+
_prepareSupportedLangModelData: function () {
|
|
785
|
+
return Core.getConfiguration().getLanguagesDeliveredWithCore().reduce(function (result, sLangAbbreviation) {
|
|
786
|
+
var langName,
|
|
787
|
+
sLang = sLangAbbreviation,
|
|
788
|
+
sLangRegion = sLangAbbreviation;
|
|
789
|
+
|
|
790
|
+
if (typeof sLangAbbreviation === "string" && sLangAbbreviation.length > 0) {
|
|
791
|
+
|
|
792
|
+
switch (sLangAbbreviation) {
|
|
793
|
+
case "sh": //Serbian
|
|
794
|
+
sLang = "sr_Latn";
|
|
795
|
+
break;
|
|
796
|
+
case "no": //Norwegian
|
|
797
|
+
sLang = "nb"; // Bokmål
|
|
798
|
+
break;
|
|
799
|
+
case "iw": // Israel
|
|
800
|
+
// Hebrew
|
|
801
|
+
sLang = "he";
|
|
802
|
+
sLangRegion = "he";
|
|
803
|
+
break;
|
|
804
|
+
case "zh_TW": // Taiwan
|
|
805
|
+
// Chinese Traditional
|
|
806
|
+
sLangRegion = "zh_Hant";
|
|
807
|
+
break;
|
|
808
|
+
case "zh_CN": // People's Republic of China
|
|
809
|
+
// Chinese Simplified
|
|
810
|
+
sLangRegion = "zh_Hans";
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
816
813
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
814
|
+
result.push(new Promise(function (resolve, reject) {
|
|
815
|
+
LoaderExtensions.loadResource("sap/ui/core/cldr/" + sLang + ".json", { async: true })
|
|
816
|
+
.then(function (locale) {
|
|
817
|
+
langName = locale.languages[sLangRegion];
|
|
821
818
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
});
|
|
819
|
+
resolve({
|
|
820
|
+
"text": typeof langName === 'string' ? langName.charAt(0).toUpperCase() + langName.substring(1) : "Unknown",
|
|
821
|
+
"key": sLangAbbreviation
|
|
826
822
|
});
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
return result;
|
|
831
|
-
}, []);
|
|
832
|
-
},
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Sets the selected language code abbreviation
|
|
836
|
-
* @param {string} sLanguage language code abbreviation
|
|
837
|
-
* @private
|
|
838
|
-
*/
|
|
839
|
-
_setSelectedLanguage: function(sLanguage) {
|
|
840
|
-
this._oSupportedLangModel.setProperty("/selectedLang", sLanguage);
|
|
841
|
-
Core.getConfiguration().setLanguage(sLanguage);
|
|
842
|
-
if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1") {
|
|
843
|
-
this._oConfigUtil.setCookie(DEMOKIT_CONFIGURATION_LANGUAGE, sLanguage);
|
|
823
|
+
});
|
|
824
|
+
}));
|
|
844
825
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
826
|
+
|
|
827
|
+
return result;
|
|
828
|
+
}, []);
|
|
829
|
+
},
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Sets the selected language code abbreviation
|
|
833
|
+
*
|
|
834
|
+
* @param {string} sLanguage language code abbreviation
|
|
835
|
+
* @private
|
|
836
|
+
*/
|
|
837
|
+
_setSelectedLanguage: function (sLanguage) {
|
|
838
|
+
this._oSupportedLangModel.setProperty("/selectedLang", sLanguage);
|
|
839
|
+
Core.getConfiguration().setLanguage(sLanguage);
|
|
840
|
+
if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1") {
|
|
841
|
+
this._oConfigUtil.setCookie(DEMOKIT_CONFIGURATION_LANGUAGE, sLanguage);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
if (this._sKey) {
|
|
845
|
+
this._setSelectedSectionTitle(this._sKey);
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Gets the selected language code abbreviation
|
|
851
|
+
*
|
|
852
|
+
* @private
|
|
853
|
+
* @returns {string} sLanguage language code abbreviation
|
|
854
|
+
*/
|
|
855
|
+
_getSelectedLanguage: function () {
|
|
856
|
+
return this._oSupportedLangModel.getProperty("/selectedLang");
|
|
857
|
+
},
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Opens the settings dialog
|
|
861
|
+
*
|
|
862
|
+
* @public
|
|
863
|
+
*/
|
|
864
|
+
settingsDialogOpen: function () {
|
|
865
|
+
var oModel;
|
|
866
|
+
|
|
867
|
+
if (!this._oSettingsDialog) {
|
|
868
|
+
Fragment.load({
|
|
869
|
+
name: "sap.ui.documentation.sdk.view.globalSettingsDialog",
|
|
870
|
+
controller: this
|
|
871
|
+
}).then(function (oDialog) {
|
|
872
|
+
// connect dialog to the root view of this component (models, lifecycle)
|
|
873
|
+
this._oView.addDependent(oDialog);
|
|
874
|
+
this._oSettingsDialog = oDialog;
|
|
875
|
+
Core.byId("LanguageSelect").setSelectedKey(this._getSelectedLanguage());
|
|
876
|
+
this._oSettingsDialog.open();
|
|
877
|
+
}.bind(this));
|
|
878
|
+
} else {
|
|
879
|
+
this._oSettingsDialog.open();
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
if (!this._oSupportedLangModel.getProperty("/langs")) {
|
|
883
|
+
oModel = this._oSupportedLangModel;
|
|
884
|
+
oModel.setProperty("/selectBusy", true);
|
|
885
|
+
Promise.all(this._prepareSupportedLangModelData()).then(function (result) {
|
|
886
|
+
oModel.setProperty("/selectBusy", false);
|
|
887
|
+
oModel.setProperty("/langs", result);
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Closes the settings dialog
|
|
894
|
+
*
|
|
895
|
+
* @public
|
|
896
|
+
*/
|
|
897
|
+
handleCloseAppSettings: function () {
|
|
898
|
+
this._oSettingsDialog.close();
|
|
899
|
+
},
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* Saves settings from the settings dialog
|
|
903
|
+
*
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
handleSaveAppSettings: function () {
|
|
907
|
+
var sLanguage = Core.byId('LanguageSelect').getSelectedKey();
|
|
908
|
+
|
|
909
|
+
this._oSettingsDialog.close();
|
|
910
|
+
|
|
911
|
+
// handle settings change
|
|
912
|
+
this._applyAppConfiguration(sLanguage);
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Apply content configuration
|
|
917
|
+
*
|
|
918
|
+
* @param {string} sLanguage language code abbreviation
|
|
919
|
+
* @private
|
|
920
|
+
*/
|
|
921
|
+
_applyAppConfiguration: function (sLanguage) {
|
|
922
|
+
this._setSelectedLanguage(sLanguage);
|
|
923
|
+
},
|
|
924
|
+
|
|
925
|
+
getAboutDialog: function () {
|
|
926
|
+
return new Promise(function (resolve, reject) {
|
|
927
|
+
if (!this._oAboutDialog) {
|
|
864
928
|
Fragment.load({
|
|
865
|
-
|
|
929
|
+
id: "aboutDialogFragment",
|
|
930
|
+
name: "sap.ui.documentation.sdk.view.AboutDialog",
|
|
866
931
|
controller: this
|
|
867
932
|
}).then(function (oDialog) {
|
|
868
|
-
|
|
869
|
-
this._oView.addDependent(
|
|
870
|
-
this.
|
|
871
|
-
Core.byId("LanguageSelect").setSelectedKey(this._getSelectedLanguage());
|
|
872
|
-
this._oSettingsDialog.open();
|
|
933
|
+
this._oAboutDialog = oDialog;
|
|
934
|
+
this._oView.addDependent(this._oAboutDialog);
|
|
935
|
+
resolve(this._oAboutDialog);
|
|
873
936
|
}.bind(this));
|
|
874
937
|
} else {
|
|
875
|
-
this.
|
|
938
|
+
resolve(this._oAboutDialog);
|
|
876
939
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
940
|
+
}.bind(this));
|
|
941
|
+
},
|
|
942
|
+
|
|
943
|
+
aboutDialogOpen: function () {
|
|
944
|
+
this.getAboutDialog().then(function (oDialog) {
|
|
945
|
+
oDialog.getContent()[0].backToTop(); // reset the nav container to the first page
|
|
946
|
+
oDialog.open();
|
|
947
|
+
});
|
|
948
|
+
},
|
|
949
|
+
|
|
950
|
+
aboutDialogClose: function (oEvent) {
|
|
951
|
+
this.getAboutDialog().then(function (oDialog) {
|
|
952
|
+
oDialog.close();
|
|
953
|
+
});
|
|
954
|
+
},
|
|
955
|
+
|
|
956
|
+
onAboutVersionDetails: function (oEvent) {
|
|
957
|
+
var oViewModel = this.getModel("appView"),
|
|
958
|
+
oViewModelData = oViewModel.getData(),
|
|
959
|
+
that = this;
|
|
960
|
+
|
|
961
|
+
library._loadAllLibInfo("", "_getLibraryInfo", "", function (aLibs, oLibInfos) {
|
|
962
|
+
var data = {};
|
|
963
|
+
var oLibInfo = library._getLibraryInfoSingleton();
|
|
964
|
+
|
|
965
|
+
for (var i = 0, l = aLibs.length; i < l; i++) {
|
|
966
|
+
aLibs[i] = oLibInfos[aLibs[i]];
|
|
967
|
+
aLibs[i].libDefaultComponent = oLibInfo._getDefaultComponent(aLibs[i]);
|
|
885
968
|
}
|
|
886
|
-
},
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Closes the settings dialog
|
|
890
|
-
* @public
|
|
891
|
-
*/
|
|
892
|
-
handleCloseAppSettings: function () {
|
|
893
|
-
this._oSettingsDialog.close();
|
|
894
|
-
},
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Saves settings from the settings dialog
|
|
898
|
-
* @public
|
|
899
|
-
*/
|
|
900
|
-
handleSaveAppSettings: function () {
|
|
901
|
-
var sLanguage = Core.byId('LanguageSelect').getSelectedKey();
|
|
902
|
-
|
|
903
|
-
this._oSettingsDialog.close();
|
|
904
|
-
|
|
905
|
-
// handle settings change
|
|
906
|
-
this._applyAppConfiguration(sLanguage);
|
|
907
|
-
},
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Apply content configuration
|
|
911
|
-
* @param {string} sLanguage language code abbreviation
|
|
912
|
-
* @private
|
|
913
|
-
*/
|
|
914
|
-
_applyAppConfiguration: function(sLanguage){
|
|
915
|
-
this._setSelectedLanguage(sLanguage);
|
|
916
|
-
},
|
|
917
|
-
|
|
918
|
-
getAboutDialog: function () {
|
|
919
|
-
return new Promise(function (resolve, reject) {
|
|
920
|
-
if (!this._oAboutDialog) {
|
|
921
|
-
Fragment.load({
|
|
922
|
-
id: "aboutDialogFragment",
|
|
923
|
-
name: "sap.ui.documentation.sdk.view.AboutDialog",
|
|
924
|
-
controller: this
|
|
925
|
-
}).then(function (oDialog) {
|
|
926
|
-
this._oAboutDialog = oDialog;
|
|
927
|
-
this._oView.addDependent(this._oAboutDialog);
|
|
928
|
-
resolve(this._oAboutDialog);
|
|
929
|
-
}.bind(this));
|
|
930
|
-
} else {
|
|
931
|
-
resolve(this._oAboutDialog);
|
|
932
|
-
}
|
|
933
|
-
}.bind(this));
|
|
934
|
-
},
|
|
935
969
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
aboutDialogClose: function (oEvent) {
|
|
944
|
-
this.getAboutDialog().then(function (oDialog) {
|
|
945
|
-
oDialog.close();
|
|
946
|
-
});
|
|
947
|
-
},
|
|
970
|
+
data.libs = aLibs;
|
|
971
|
+
oViewModelData.oVersionInfo = data;
|
|
972
|
+
oViewModel.setData(oViewModelData);
|
|
973
|
+
that.setModel(oViewModel, "appView");
|
|
974
|
+
});
|
|
948
975
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
976
|
+
var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
|
|
977
|
+
oDetailPage = Fragment.byId("aboutDialogFragment", "aboutDetail");
|
|
978
|
+
oNavCon.to(oDetailPage);
|
|
979
|
+
},
|
|
953
980
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
981
|
+
onAboutThirdParty: function (oEvent) {
|
|
982
|
+
var oViewModel = this.getModel("appView"),
|
|
983
|
+
oViewModelData = oViewModel.getData(),
|
|
984
|
+
that = this;
|
|
957
985
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
986
|
+
library._loadAllLibInfo("", "_getThirdPartyInfo", function (aLibs, oLibInfos) {
|
|
987
|
+
if (!aLibs) {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
var data = {};
|
|
991
|
+
data.thirdparty = [];
|
|
992
|
+
for (var j = 0; j < aLibs.length; j++) {
|
|
993
|
+
var oData = oLibInfos[aLibs[j]];
|
|
994
|
+
for (var i = 0; i < oData.libs.length; i++) {
|
|
995
|
+
var oOpenSourceLib = oData.libs[i];
|
|
996
|
+
oOpenSourceLib._lib = aLibs[j];
|
|
997
|
+
data.thirdparty.push(oOpenSourceLib);
|
|
961
998
|
}
|
|
999
|
+
}
|
|
962
1000
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
that.setModel(oViewModel, "appView");
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
|
|
970
|
-
oDetailPage = Fragment.byId("aboutDialogFragment", "aboutDetail");
|
|
971
|
-
oNavCon.to(oDetailPage);
|
|
972
|
-
},
|
|
973
|
-
|
|
974
|
-
onAboutThirdParty: function (oEvent) {
|
|
975
|
-
var oViewModel = this.getModel("appView"),
|
|
976
|
-
oViewModelData = oViewModel.getData(),
|
|
977
|
-
that = this;
|
|
1001
|
+
data.thirdparty.sort(function (a, b) {
|
|
1002
|
+
var aName = (a.displayName || "").toUpperCase();
|
|
1003
|
+
var bName = (b.displayName || "").toUpperCase();
|
|
978
1004
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
for (var j = 0; j < aLibs.length; j++) {
|
|
986
|
-
var oData = oLibInfos[aLibs[j]];
|
|
987
|
-
for (var i = 0; i < oData.libs.length; i++) {
|
|
988
|
-
var oOpenSourceLib = oData.libs[i];
|
|
989
|
-
oOpenSourceLib._lib = aLibs[j];
|
|
990
|
-
data.thirdparty.push(oOpenSourceLib);
|
|
991
|
-
}
|
|
1005
|
+
if (aName > bName) {
|
|
1006
|
+
return 1;
|
|
1007
|
+
} else if (aName < bName) {
|
|
1008
|
+
return -1;
|
|
1009
|
+
} else {
|
|
1010
|
+
return 0;
|
|
992
1011
|
}
|
|
1012
|
+
});
|
|
993
1013
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (aName > bName){
|
|
999
|
-
return 1;
|
|
1000
|
-
} else if (aName < bName){
|
|
1001
|
-
return -1;
|
|
1002
|
-
} else {
|
|
1003
|
-
return 0;
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1014
|
+
oViewModelData.oThirdPartyInfo = data;
|
|
1015
|
+
oViewModel.setData(oViewModelData);
|
|
1016
|
+
that.setModel(oViewModel, "appView");
|
|
1017
|
+
});
|
|
1006
1018
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1019
|
+
var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
|
|
1020
|
+
oDetailPage = Fragment.byId("aboutDialogFragment", "aboutThirdParty");
|
|
1021
|
+
oNavCon.to(oDetailPage);
|
|
1022
|
+
},
|
|
1011
1023
|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
name: "sap.ui.documentation.sdk.view.ReleaseDialog",
|
|
1023
|
-
controller: this
|
|
1024
|
-
}).then(function (oDialog) {
|
|
1025
|
-
this._oReleaseDialog = oDialog;
|
|
1026
|
-
this._oView.addDependent(this._oReleaseDialog);
|
|
1027
|
-
resolve(this._oReleaseDialog);
|
|
1028
|
-
}
|
|
1029
|
-
.bind(this));
|
|
1030
|
-
} else {
|
|
1024
|
+
_getReleaseDialog: function () {
|
|
1025
|
+
return new Promise(function (resolve) {
|
|
1026
|
+
if (!this._oReleaseDialog) {
|
|
1027
|
+
Fragment.load({
|
|
1028
|
+
id: "releaseDialogFragment",
|
|
1029
|
+
name: "sap.ui.documentation.sdk.view.ReleaseDialog",
|
|
1030
|
+
controller: this
|
|
1031
|
+
}).then(function (oDialog) {
|
|
1032
|
+
this._oReleaseDialog = oDialog;
|
|
1033
|
+
this._oView.addDependent(this._oReleaseDialog);
|
|
1031
1034
|
resolve(this._oReleaseDialog);
|
|
1032
1035
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1036
|
+
.bind(this));
|
|
1037
|
+
} else {
|
|
1038
|
+
resolve(this._oReleaseDialog);
|
|
1039
|
+
}
|
|
1040
|
+
}.bind(this));
|
|
1041
|
+
},
|
|
1042
|
+
|
|
1043
|
+
_getNotesView: function () {
|
|
1044
|
+
var oNotesModel;
|
|
1045
|
+
return new Promise(function (resolve) {
|
|
1046
|
+
if (!this._oNotesView) {
|
|
1047
|
+
oNotesModel = new JSONModel();
|
|
1048
|
+
Fragment.load({
|
|
1049
|
+
id: "notesView",
|
|
1050
|
+
name: "sap.ui.documentation.sdk.view.ReleaseNotesView",
|
|
1051
|
+
controller: this
|
|
1052
|
+
}).then(function (oView) {
|
|
1053
|
+
this._oNotesView = oView;
|
|
1054
|
+
this._oNotesView.setModel(oNotesModel);
|
|
1051
1055
|
resolve(this._oNotesView);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
sVersion = oEvent.getSource().data("version"),
|
|
1059
|
-
sLibrary = oEvent.getSource().data("library"),
|
|
1060
|
-
oDialogModel = new JSONModel();
|
|
1061
|
-
|
|
1062
|
-
Promise.all([this._getReleaseDialog(), this._getNotesView()]).then(function (aResult) {
|
|
1063
|
-
var oReleaseDialog = aResult[0],
|
|
1064
|
-
oNotesView = aResult[1],
|
|
1065
|
-
oNotesViewData = {};
|
|
1066
|
-
|
|
1067
|
-
oLibInfo._getReleaseNotes(sLibrary, sVersion, function(oRelNotes, sVersion) {
|
|
1068
|
-
var oDialogData = {};
|
|
1069
|
-
|
|
1070
|
-
if (oRelNotes && oRelNotes[sVersion] && oRelNotes[sVersion].notes && oRelNotes[sVersion].notes.length > 0) {
|
|
1071
|
-
oNotesViewData = oRelNotes[sVersion];
|
|
1072
|
-
} else {
|
|
1073
|
-
oDialogData.noData = true;
|
|
1074
|
-
}
|
|
1075
|
-
oNotesView.getModel().setData(oNotesViewData);
|
|
1076
|
-
oDialogData.library = sLibrary;
|
|
1077
|
-
oDialogModel.setData(oDialogData);
|
|
1078
|
-
});
|
|
1079
|
-
|
|
1080
|
-
oReleaseDialog.setModel(oDialogModel);
|
|
1081
|
-
oReleaseDialog.addContent(oNotesView);
|
|
1082
|
-
oReleaseDialog.open();
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
},
|
|
1056
|
+
}.bind(this));
|
|
1057
|
+
} else {
|
|
1058
|
+
resolve(this._oNotesView);
|
|
1059
|
+
}
|
|
1060
|
+
}.bind(this));
|
|
1061
|
+
},
|
|
1086
1062
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1063
|
+
onReleaseDialogOpen: function (oEvent) {
|
|
1064
|
+
var oLibInfo = library._getLibraryInfoSingleton(),
|
|
1065
|
+
sVersion = oEvent.getSource().data("version"),
|
|
1066
|
+
sLibrary = oEvent.getSource().data("library"),
|
|
1067
|
+
oDialogModel = new JSONModel();
|
|
1092
1068
|
|
|
1093
|
-
|
|
1094
|
-
var
|
|
1095
|
-
|
|
1096
|
-
|
|
1069
|
+
Promise.all([this._getReleaseDialog(), this._getNotesView()]).then(function (aResult) {
|
|
1070
|
+
var oReleaseDialog = aResult[0],
|
|
1071
|
+
oNotesView = aResult[1],
|
|
1072
|
+
oNotesViewData = {};
|
|
1097
1073
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
oDialog.open();
|
|
1101
|
-
});
|
|
1102
|
-
},
|
|
1074
|
+
oLibInfo._getReleaseNotes(sLibrary, sVersion, function (oRelNotes, sVersion) {
|
|
1075
|
+
var oDialogData = {};
|
|
1103
1076
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1077
|
+
if (oRelNotes && oRelNotes[sVersion] && oRelNotes[sVersion].notes && oRelNotes[sVersion].notes.length > 0) {
|
|
1078
|
+
oNotesViewData = oRelNotes[sVersion];
|
|
1079
|
+
} else {
|
|
1080
|
+
oDialogData.noData = true;
|
|
1081
|
+
}
|
|
1082
|
+
oNotesView.getModel().setData(oNotesViewData);
|
|
1083
|
+
oDialogData.library = sLibrary;
|
|
1084
|
+
oDialogModel.setData(oDialogData);
|
|
1107
1085
|
});
|
|
1108
|
-
},
|
|
1109
|
-
|
|
1110
|
-
onChangeVersionDialogSearch: function (oEvent) {
|
|
1111
|
-
var sSearchedValue = oEvent.getParameter("newValue"),
|
|
1112
|
-
oFilter = new Filter("version", FilterOperator.Contains, sSearchedValue),
|
|
1113
|
-
oTree = Core.byId("versionList"),
|
|
1114
|
-
oBinding = oTree.getBinding("items");
|
|
1115
1086
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
}
|
|
1087
|
+
oReleaseDialog.setModel(oDialogModel);
|
|
1088
|
+
oReleaseDialog.addContent(oNotesView);
|
|
1089
|
+
oReleaseDialog.open();
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
},
|
|
1093
|
+
|
|
1094
|
+
onReleaseDialogClose: function (oEvent) {
|
|
1095
|
+
this._getReleaseDialog().then(function (oDialog) {
|
|
1096
|
+
oDialog.close();
|
|
1097
|
+
});
|
|
1098
|
+
},
|
|
1099
|
+
|
|
1100
|
+
onAboutNavBack: function (oEvent) {
|
|
1101
|
+
var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon");
|
|
1102
|
+
oNavCon.back();
|
|
1103
|
+
},
|
|
1104
|
+
|
|
1105
|
+
onChangeVersionButtonPress: function () {
|
|
1106
|
+
this.getVersionSwitchDialog().then(function (oDialog) {
|
|
1107
|
+
oDialog.open();
|
|
1108
|
+
});
|
|
1109
|
+
},
|
|
1110
|
+
|
|
1111
|
+
onCloseVersionDialog: function () {
|
|
1112
|
+
this.getVersionSwitchDialog().then(function (oDialog) {
|
|
1113
|
+
oDialog.close();
|
|
1114
|
+
});
|
|
1115
|
+
},
|
|
1116
|
+
|
|
1117
|
+
onChangeVersionDialogSearch: function (oEvent) {
|
|
1118
|
+
var sSearchedValue = oEvent.getParameter("newValue"),
|
|
1119
|
+
oFilter = new Filter("version", FilterOperator.Contains, sSearchedValue),
|
|
1120
|
+
oTree = Core.byId("versionList"),
|
|
1121
|
+
oBinding = oTree.getBinding("items");
|
|
1122
|
+
|
|
1123
|
+
oBinding.filter([oFilter]);
|
|
1124
|
+
|
|
1125
|
+
// If only one branch of the version info tree is currently left after filtering
|
|
1126
|
+
if (oBinding.getChildCount() === 1) {
|
|
1127
|
+
// expand the only branch of the version info tree
|
|
1128
|
+
oBinding.expand(0);
|
|
1129
|
+
} else {
|
|
1130
|
+
// collapse all of the branches of the version info tree
|
|
1131
|
+
oTree.collapseAll();
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
|
|
1135
|
+
onHeaderLogoPress: function () {
|
|
1136
|
+
this._demoKitPage.setSideExpanded(false);
|
|
1137
|
+
this.oRouter.navTo("welcome", {});
|
|
1138
|
+
},
|
|
1139
|
+
|
|
1140
|
+
onSiteMapPress: function () {
|
|
1141
|
+
this.oRouter.navTo("sitemap", {});
|
|
1142
|
+
},
|
|
1143
|
+
|
|
1144
|
+
onLatestVersionItemPress: function () {
|
|
1145
|
+
if (ResourcesUtil.getResourcesVersion()) {
|
|
1146
|
+
window.sessionStorage.removeItem("versionPrefixPath");
|
|
1147
|
+
window.location.reload();
|
|
1148
|
+
} else {
|
|
1149
|
+
window.location.href = "/";
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1127
1152
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1153
|
+
onVersionItemPress: function (oEvent) {
|
|
1154
|
+
var oSelectedItem = Core.byId("versionList").getSelectedItem(),
|
|
1155
|
+
oCustomData = oSelectedItem.getCustomData()[0];
|
|
1131
1156
|
|
|
1132
|
-
|
|
1133
|
-
this.oRouter.navTo("sitemap", {});
|
|
1134
|
-
},
|
|
1157
|
+
if (oCustomData && oCustomData.getKey() === "path") {
|
|
1135
1158
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
window.sessionStorage.removeItem("versionPrefixPath");
|
|
1159
|
+
if (ResourcesUtil.getHasProxy()) {
|
|
1160
|
+
window.sessionStorage.setItem("versionPrefixPath", oCustomData.getValue());
|
|
1139
1161
|
window.location.reload();
|
|
1140
1162
|
} else {
|
|
1141
|
-
window.location.href =
|
|
1163
|
+
window.location.href = oCustomData.getValue(); // Domain relative redirect
|
|
1142
1164
|
}
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
onVersionItemPress: function (oEvent) {
|
|
1146
|
-
var oSelectedItem = Core.byId("versionList").getSelectedItem(),
|
|
1147
|
-
oCustomData = oSelectedItem.getCustomData()[0];
|
|
1148
|
-
|
|
1149
|
-
if (oCustomData && oCustomData.getKey() === "path") {
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1150
1167
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
return new Promise(function (resolve) {
|
|
1162
|
-
if (!this._oChangeVersionDialog) {
|
|
1163
|
-
Fragment.load({
|
|
1164
|
-
name: "sap.ui.documentation.sdk.view.ChangeVersionDialog",
|
|
1165
|
-
controller: this
|
|
1166
|
-
}).then(function (oDialog) {
|
|
1167
|
-
this._oChangeVersionDialog = oDialog;
|
|
1168
|
-
this._oChangeVersionDialog.setModel(this._buildVersionDialogModel());
|
|
1169
|
-
this._oView.addDependent(this._oChangeVersionDialog);
|
|
1170
|
-
resolve(this._oChangeVersionDialog);
|
|
1171
|
-
}.bind(this));
|
|
1172
|
-
} else {
|
|
1168
|
+
getVersionSwitchDialog: function () {
|
|
1169
|
+
return new Promise(function (resolve) {
|
|
1170
|
+
if (!this._oChangeVersionDialog) {
|
|
1171
|
+
Fragment.load({
|
|
1172
|
+
name: "sap.ui.documentation.sdk.view.ChangeVersionDialog",
|
|
1173
|
+
controller: this
|
|
1174
|
+
}).then(function (oDialog) {
|
|
1175
|
+
this._oChangeVersionDialog = oDialog;
|
|
1176
|
+
this._oChangeVersionDialog.setModel(this._buildVersionDialogModel());
|
|
1177
|
+
this._oView.addDependent(this._oChangeVersionDialog);
|
|
1173
1178
|
resolve(this._oChangeVersionDialog);
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
this._oFeedbackDialog = oDialog;
|
|
1226
|
-
this._oView.addDependent(this._oFeedbackDialog);
|
|
1227
|
-
resolve(this._oFeedbackDialog);
|
|
1228
|
-
}.bind(this));
|
|
1229
|
-
} else {
|
|
1230
|
-
resolve(this._oFeedbackDialog);
|
|
1231
|
-
}
|
|
1232
|
-
}.bind(this));
|
|
1233
|
-
},
|
|
1234
|
-
|
|
1235
|
-
extendFeedbackDialog: function (oFeedbackDialog) {
|
|
1236
|
-
var that = this,
|
|
1237
|
-
oResourceBundle = this.getModel("i18n").getResourceBundle();
|
|
1238
|
-
|
|
1239
|
-
oFeedbackDialog.textInput = Fragment.byId("feedbackDialogFragment", "feedbackInput");
|
|
1240
|
-
oFeedbackDialog.contextCheckBox = Fragment.byId("feedbackDialogFragment", "pageContext");
|
|
1241
|
-
oFeedbackDialog.contextData = Fragment.byId("feedbackDialogFragment", "contextData");
|
|
1242
|
-
oFeedbackDialog.ratingStatus = Fragment.byId("feedbackDialogFragment", "ratingStatus");
|
|
1243
|
-
oFeedbackDialog.ratingStatus.value = 0;
|
|
1244
|
-
oFeedbackDialog.sendButton = Fragment.byId("feedbackDialogFragment", "sendButton");
|
|
1245
|
-
oFeedbackDialog.ratingBar = [
|
|
1246
|
-
{
|
|
1247
|
-
button : Fragment.byId("feedbackDialogFragment", "excellent"),
|
|
1248
|
-
status : "Excellent",
|
|
1249
|
-
displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_EXCELLENT")
|
|
1250
|
-
},
|
|
1251
|
-
{
|
|
1252
|
-
button : Fragment.byId("feedbackDialogFragment", "good"),
|
|
1253
|
-
status : "Good",
|
|
1254
|
-
displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_GOOD")
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
button : Fragment.byId("feedbackDialogFragment", "average"),
|
|
1258
|
-
status : "Average",
|
|
1259
|
-
displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_AVERAGE")
|
|
1260
|
-
},
|
|
1261
|
-
{
|
|
1262
|
-
button : Fragment.byId("feedbackDialogFragment", "poor"),
|
|
1263
|
-
status : "Poor",
|
|
1264
|
-
displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_POOR")
|
|
1265
|
-
},
|
|
1266
|
-
{
|
|
1267
|
-
button : Fragment.byId("feedbackDialogFragment", "veryPoor"),
|
|
1268
|
-
status : "Very Poor",
|
|
1269
|
-
displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_VERY_POOR")
|
|
1270
|
-
}
|
|
1271
|
-
];
|
|
1272
|
-
oFeedbackDialog.reset = function () {
|
|
1273
|
-
this.sendButton.setEnabled(false);
|
|
1274
|
-
this.textInput.setValue("");
|
|
1275
|
-
this.contextCheckBox.setSelected(true);
|
|
1276
|
-
this.ratingStatus.setText("");
|
|
1277
|
-
this.ratingStatus.setState("None");
|
|
1278
|
-
this.ratingStatus.value = 0;
|
|
1279
|
-
this.contextData.setVisible(false);
|
|
1280
|
-
this.ratingBar.forEach(function(oRatingBarElement){
|
|
1281
|
-
if (oRatingBarElement.button.getPressed()) {
|
|
1282
|
-
oRatingBarElement.button.setPressed(false);
|
|
1283
|
-
}
|
|
1284
|
-
});
|
|
1285
|
-
};
|
|
1286
|
-
oFeedbackDialog.updateContextData = function() {
|
|
1287
|
-
var sVersion = that._getUI5Version(),
|
|
1288
|
-
sUI5Distribution = that._getUI5Distribution();
|
|
1289
|
-
|
|
1290
|
-
if (this.contextCheckBox.getSelected()) {
|
|
1291
|
-
this.contextData.setValue("Location: " + that._getCurrentPageRelativeURL() + "\n" + sUI5Distribution + " Version: " + sVersion);
|
|
1292
|
-
} else {
|
|
1293
|
-
this.contextData.setValue(sUI5Distribution + " Version: " + sVersion);
|
|
1294
|
-
}
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
oFeedbackDialog.updateContextData();
|
|
1179
|
+
}.bind(this));
|
|
1180
|
+
} else {
|
|
1181
|
+
resolve(this._oChangeVersionDialog);
|
|
1182
|
+
}
|
|
1183
|
+
}.bind(this));
|
|
1184
|
+
},
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Custom comparison function, which is used when sorting group titles by minor version in the change version dialog
|
|
1188
|
+
*
|
|
1189
|
+
* @param sGroupTitleA
|
|
1190
|
+
* @param sGroupTitleB
|
|
1191
|
+
* @returns {number}
|
|
1192
|
+
*/
|
|
1193
|
+
versionSwitchCustomComparator: function (sGroupTitleA, sGroupTitleB) {
|
|
1194
|
+
return Version(sGroupTitleA).compareTo(Version(sGroupTitleB));
|
|
1195
|
+
},
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Determines whether or not to show the version change button
|
|
1199
|
+
*
|
|
1200
|
+
* @private
|
|
1201
|
+
*/
|
|
1202
|
+
_updateVersionSwitchVisibility: function () {
|
|
1203
|
+
this.getModel("appView").setProperty("/bShowVersionSwitchButton", !!this._aNeoAppVersions.length);
|
|
1204
|
+
},
|
|
1205
|
+
|
|
1206
|
+
_buildVersionDialogModel: function () {
|
|
1207
|
+
var oChangeVersionDialogModel = new JSONModel();
|
|
1208
|
+
oChangeVersionDialogModel.setSizeLimit(1000);
|
|
1209
|
+
oChangeVersionDialogModel.setData(this._aNeoAppVersions);
|
|
1210
|
+
oChangeVersionDialogModel.setData(this._arrToTreeConverter(this._aNeoAppVersions));
|
|
1211
|
+
return oChangeVersionDialogModel;
|
|
1212
|
+
},
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* Opens the Qualtrics UX survey when the feedback button is pressed.
|
|
1216
|
+
* There are two available surveys - a short one (all year round), and quarterly survey.
|
|
1217
|
+
*
|
|
1218
|
+
* Depending on the number of available surveys:
|
|
1219
|
+
* - Directly opens the short survey in a new tab.
|
|
1220
|
+
* - If a long, quarterly survey is available, opens a popover with links for both.
|
|
1221
|
+
*
|
|
1222
|
+
* @param {sap.ui.base.Event} oEvent The feedback/menu button's press event
|
|
1223
|
+
* @param {boolean} bMenu Whether the pressed button is hidden in the 'About' menu
|
|
1224
|
+
*/
|
|
1225
|
+
launchSurvey: function (oEvent, bMenu) {
|
|
1226
|
+
var oTarget = this.byId(!bMenu ? "surveyButton" : "aboutMenuButton"),
|
|
1227
|
+
oView = this.getView(),
|
|
1228
|
+
oViewModel = this.getModel("appView"),
|
|
1229
|
+
bShowLongSurvey = oViewModel.getProperty("/bShowLongSurvey");
|
|
1298
1230
|
|
|
1299
|
-
|
|
1300
|
-
|
|
1231
|
+
if (!bShowLongSurvey) {
|
|
1232
|
+
this.shortSurveyRedirect();
|
|
1233
|
+
} else if (!this._oSurveyPopover) {
|
|
1234
|
+
Fragment.load({
|
|
1235
|
+
name: "sap.ui.documentation.sdk.view.SurveyPopover",
|
|
1236
|
+
controller: this
|
|
1237
|
+
}).then(function (oPopover) {
|
|
1238
|
+
oView.addDependent(oPopover);
|
|
1239
|
+
this._oSurveyPopover = oPopover;
|
|
1301
1240
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
*/
|
|
1305
|
-
feedbackDialogOpen: function () {
|
|
1306
|
-
this.getFeedbackDialog().then(function (oFeedbackDialog) {
|
|
1307
|
-
oFeedbackDialog.updateContextData();
|
|
1308
|
-
if (!oFeedbackDialog.isOpen()) {
|
|
1309
|
-
syncStyleClass("sapUiSizeCompact", this.getView(), oFeedbackDialog);
|
|
1310
|
-
oFeedbackDialog.open();
|
|
1241
|
+
if (Device.system.phone) {
|
|
1242
|
+
this.addSurveyPopoverCloseBtn();
|
|
1311
1243
|
}
|
|
1312
|
-
}.bind(this));
|
|
1313
|
-
},
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
* Opens the Qualtrics UX survey when the feedback button is pressed.
|
|
1317
|
-
* There are two available surveys - a short one (all year round), and quarterly survey.
|
|
1318
|
-
*
|
|
1319
|
-
* Depending on the number of available surveys:
|
|
1320
|
-
* - Directly opens the short survey in a new tab.
|
|
1321
|
-
* - If a long, quarterly survey is available, opens a popover with links for both.
|
|
1322
|
-
*
|
|
1323
|
-
* @param {sap.ui.base.Event} oEvent The feedback/menu button's press event
|
|
1324
|
-
* @param {boolean} bMenu Whether the pressed button is hidden in the 'About' menu
|
|
1325
|
-
*/
|
|
1326
|
-
launchSurvey: function (oEvent, bMenu) {
|
|
1327
|
-
var oTarget = this.byId(!bMenu ? "surveyButton" : "aboutMenuButton"),
|
|
1328
|
-
oView = this.getView(),
|
|
1329
|
-
oViewModel = this.getModel("appView"),
|
|
1330
|
-
bShowLongSurvey = oViewModel.getProperty("/bShowLongSurvey");
|
|
1331
|
-
|
|
1332
|
-
if (!bShowLongSurvey) {
|
|
1333
|
-
this.shortSurveyRedirect();
|
|
1334
|
-
} else if (!this._oSurveyPopover) {
|
|
1335
|
-
Fragment.load({
|
|
1336
|
-
name: "sap.ui.documentation.sdk.view.SurveyPopover",
|
|
1337
|
-
controller: this
|
|
1338
|
-
}).then(function (oPopover) {
|
|
1339
|
-
oView.addDependent(oPopover);
|
|
1340
|
-
this._oSurveyPopover = oPopover;
|
|
1341
|
-
|
|
1342
|
-
if (Device.system.phone) {
|
|
1343
|
-
this.addSurveyPopoverCloseBtn();
|
|
1344
|
-
}
|
|
1345
1244
|
|
|
1346
|
-
this._oSurveyPopover.openBy(oTarget);
|
|
1347
|
-
}.bind(this));
|
|
1348
|
-
} else {
|
|
1349
1245
|
this._oSurveyPopover.openBy(oTarget);
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1246
|
+
}.bind(this));
|
|
1247
|
+
} else {
|
|
1248
|
+
this._oSurveyPopover.openBy(oTarget);
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* Closes the survey popover on mobile.
|
|
1254
|
+
*
|
|
1255
|
+
* @param {sap.ui.base.Event} oEvent The close button's press event
|
|
1256
|
+
*/
|
|
1257
|
+
closeSurveyPopover: function (oEvent) {
|
|
1258
|
+
this._oSurveyPopover.close();
|
|
1259
|
+
},
|
|
1260
|
+
|
|
1261
|
+
shortSurveyRedirect: function () {
|
|
1262
|
+
var sQueryParams = "?Release_version=" + this._getUI5Version()
|
|
1263
|
+
+ "&Source=" + this._getUI5Distribution()
|
|
1264
|
+
+ "&Type=" + this._getUI5VersionType()
|
|
1265
|
+
+ "&product=SAPUI5%2FOpenUI5"
|
|
1266
|
+
+ "&product_filter=UI5"
|
|
1267
|
+
+ "&cluster=BTP"
|
|
1268
|
+
+ "&page=" + encodeURIComponent(document.location.href);
|
|
1269
|
+
|
|
1270
|
+
var sProdURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_byI4QeS7Ic2Psyi" + sQueryParams,
|
|
1271
|
+
sDevURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_3Epqk1MLAUQVrwy" + sQueryParams,
|
|
1272
|
+
bProd = !this.getModel("versionData").getProperty("/isDevEnv");
|
|
1273
|
+
|
|
1274
|
+
// This survey could be displayed in a Qualtrics intercept
|
|
1275
|
+
// dialog in the future, instead of a new tab
|
|
1276
|
+
URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
|
|
1277
|
+
},
|
|
1278
|
+
|
|
1279
|
+
longSurveyRedirect: function () {
|
|
1280
|
+
var sBaseUrl = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_7X5P63Zg5zXC5zE",
|
|
1281
|
+
sQueryParams = "?product=SAPUI5%2FOpenUI5"
|
|
1366
1282
|
+ "&product_filter=UI5"
|
|
1367
1283
|
+ "&cluster=BTP"
|
|
1368
|
-
+ "&page=" + encodeURIComponent(document.location.href)
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
var
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
bDateInSpan = false,
|
|
1400
|
-
sLastAvailableDate;
|
|
1401
|
-
|
|
1402
|
-
aDateSpans.forEach(function (aDateSpan) {
|
|
1403
|
-
var dMinDate = aDateSpan[0],
|
|
1404
|
-
dMaxDate = aDateSpan[1];
|
|
1405
|
-
|
|
1406
|
-
if (dCurrentDate >= dMinDate && dCurrentDate <= dMaxDate) {
|
|
1407
|
-
bDateInSpan = true;
|
|
1408
|
-
sLastAvailableDate = dMaxDate.toLocaleDateString();
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
});
|
|
1284
|
+
+ "&page=" + encodeURIComponent(document.location.href),
|
|
1285
|
+
sProdURL = sBaseUrl + sQueryParams,
|
|
1286
|
+
sDevURL = sBaseUrl + sQueryParams + "&Q_CHL=preview&Q_SurveyVersionID=current",
|
|
1287
|
+
bProd = !this.getModel("versionData").getProperty("/isDevEnv");
|
|
1288
|
+
|
|
1289
|
+
URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
|
|
1290
|
+
},
|
|
1291
|
+
|
|
1292
|
+
setSurveyModelData: function () {
|
|
1293
|
+
var oViewModel = this.getModel("appView"),
|
|
1294
|
+
dCurrentDate = new Date(),
|
|
1295
|
+
iCurrentYear = dCurrentDate.getFullYear(),
|
|
1296
|
+
aDateSpans = [
|
|
1297
|
+
[new Date(iCurrentYear, 1, 1), new Date(iCurrentYear, 1, 21)], // Feb 1-21
|
|
1298
|
+
[new Date(iCurrentYear, 4, 1), new Date(iCurrentYear, 4, 21)], // May 1-21
|
|
1299
|
+
[new Date(iCurrentYear, 7, 1), new Date(iCurrentYear, 7, 21)], // Aug 1-21
|
|
1300
|
+
[new Date(iCurrentYear, 10, 1), new Date(iCurrentYear, 10, 21)] // Nov 1-21
|
|
1301
|
+
],
|
|
1302
|
+
bDateInSpan = false,
|
|
1303
|
+
sLastAvailableDate;
|
|
1304
|
+
|
|
1305
|
+
aDateSpans.forEach(function (aDateSpan) {
|
|
1306
|
+
var dMinDate = aDateSpan[0],
|
|
1307
|
+
dMaxDate = aDateSpan[1];
|
|
1308
|
+
|
|
1309
|
+
if (dCurrentDate >= dMinDate && dCurrentDate <= dMaxDate) {
|
|
1310
|
+
bDateInSpan = true;
|
|
1311
|
+
sLastAvailableDate = dMaxDate.toLocaleDateString();
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1412
1315
|
|
|
1413
|
-
|
|
1316
|
+
oViewModel.setProperty("/bShowLongSurvey", bDateInSpan);
|
|
1414
1317
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
});
|
|
1427
|
-
|
|
1428
|
-
this._oSurveyPopover.setEndButton(oCloseButton);
|
|
1429
|
-
},
|
|
1430
|
-
|
|
1431
|
-
/**
|
|
1432
|
-
* Event handler for the send feedback button
|
|
1433
|
-
*/
|
|
1434
|
-
onFeedbackDialogSendPress: function () {
|
|
1435
|
-
this.getFeedbackDialog().then(this.onFeedbackDialogSend.bind(this));
|
|
1436
|
-
},
|
|
1437
|
-
|
|
1438
|
-
onFeedbackDialogSend: function(oFeedbackDialog) {
|
|
1439
|
-
var sVersion = this._getFullVersion(),
|
|
1440
|
-
oVersionInfo = Version(sVersion),
|
|
1441
|
-
oResourceBundle = this.getModel("i18n").getResourceBundle(),
|
|
1442
|
-
data = {
|
|
1443
|
-
"text": oFeedbackDialog.textInput.getValue(),
|
|
1444
|
-
"rating": oFeedbackDialog.ratingStatus.value,
|
|
1445
|
-
"major": oVersionInfo.getMajor(),
|
|
1446
|
-
"minor": oVersionInfo.getMinor(),
|
|
1447
|
-
"patch": oVersionInfo.getPatch(),
|
|
1448
|
-
"distribution": this._getUI5Distribution(),
|
|
1449
|
-
"snapshot": oVersionInfo.getSuffix().indexOf("SNAPSHOT") > -1,
|
|
1450
|
-
"url": this._getCurrentURL(),
|
|
1451
|
-
"page": this._getCurrentPageRelativeURL(),
|
|
1452
|
-
"pageContext": oFeedbackDialog.contextCheckBox.getSelected()
|
|
1453
|
-
};
|
|
1454
|
-
|
|
1455
|
-
// send feedback
|
|
1456
|
-
oFeedbackDialog.setBusyIndicatorDelay(0);
|
|
1457
|
-
oFeedbackDialog.setBusy(true);
|
|
1458
|
-
|
|
1459
|
-
jQuery.ajax({
|
|
1460
|
-
url: FEEDBACK_URL,
|
|
1461
|
-
type: "POST",
|
|
1462
|
-
contentType: "application/json",
|
|
1463
|
-
data: JSON.stringify(data)
|
|
1464
|
-
}).
|
|
1465
|
-
done(
|
|
1466
|
-
function () {
|
|
1467
|
-
MessageBox.success(oResourceBundle.getText("FEEDBACK_DIALOG_TEXT_SUCCESS"), {
|
|
1468
|
-
title: oResourceBundle.getText("FEEDBACK_DIALOG_TITLE_SUCCESS")
|
|
1469
|
-
});
|
|
1470
|
-
oFeedbackDialog.reset();
|
|
1471
|
-
oFeedbackDialog.close();
|
|
1472
|
-
oFeedbackDialog.setBusy(false);
|
|
1473
|
-
}
|
|
1474
|
-
).
|
|
1475
|
-
fail(
|
|
1476
|
-
function (oRequest, sStatus, sError) {
|
|
1477
|
-
var sErrorDetails = sError; // + "\n" + oRequest.responseText;
|
|
1478
|
-
MessageBox.error(oResourceBundle.getText("FEEDBACK_DIALOG_TEXT_ERROR") + sErrorDetails, {
|
|
1479
|
-
title: oResourceBundle.getText("FEEDBACK_DIALOG_TITLE_ERROR")
|
|
1480
|
-
});
|
|
1481
|
-
oFeedbackDialog.setBusy(false);
|
|
1482
|
-
}
|
|
1483
|
-
);
|
|
1484
|
-
},
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* Event handler for the cancel feedback button
|
|
1488
|
-
*/
|
|
1489
|
-
onFeedbackDialogCancel: function () {
|
|
1490
|
-
this.getFeedbackDialog().then(function(oFeedbackDialog) {
|
|
1491
|
-
oFeedbackDialog.reset();
|
|
1492
|
-
oFeedbackDialog.close();
|
|
1493
|
-
});
|
|
1494
|
-
},
|
|
1495
|
-
|
|
1496
|
-
/**
|
|
1497
|
-
* Event handler for the toggle context link
|
|
1498
|
-
*/
|
|
1499
|
-
onShowHideContextData: function () {
|
|
1500
|
-
this.getFeedbackDialog().then(function(oFeedbackDialog) {
|
|
1501
|
-
oFeedbackDialog.contextData.setVisible(!oFeedbackDialog.contextData.getVisible());
|
|
1502
|
-
});
|
|
1503
|
-
},
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* Event handler for the context selection checkbox
|
|
1507
|
-
*/
|
|
1508
|
-
onContextSelect: function() {
|
|
1509
|
-
this.getFeedbackDialog().then(function(oFeedbackDialog) {
|
|
1510
|
-
oFeedbackDialog.updateContextData();
|
|
1511
|
-
});
|
|
1512
|
-
},
|
|
1513
|
-
|
|
1514
|
-
/**
|
|
1515
|
-
* Event handler for the rating to update the label and the data
|
|
1516
|
-
* @param {sap.ui.base.Event} oEvent
|
|
1517
|
-
*/
|
|
1518
|
-
onPressRatingButton: function(oEvent) {
|
|
1519
|
-
var oPressedButton = oEvent.getSource();
|
|
1520
|
-
|
|
1521
|
-
this.getFeedbackDialog().then(function(oFeedbackDialog) {
|
|
1522
|
-
oFeedbackDialog.ratingBar.forEach(function(oRatingBarElement) {
|
|
1523
|
-
if (oPressedButton !== oRatingBarElement.button) {
|
|
1524
|
-
oRatingBarElement.button.setPressed(false);
|
|
1525
|
-
} else {
|
|
1526
|
-
if (!oRatingBarElement.button.getPressed()) {
|
|
1527
|
-
setRatingStatus(oFeedbackDialog, "None", "", 0);
|
|
1528
|
-
} else {
|
|
1529
|
-
switch (oRatingBarElement.status) {
|
|
1530
|
-
case "Excellent":
|
|
1531
|
-
setRatingStatus(oFeedbackDialog, "Success", oRatingBarElement.displayStatus, 5);
|
|
1532
|
-
break;
|
|
1533
|
-
case "Good":
|
|
1534
|
-
setRatingStatus(oFeedbackDialog, "Success", oRatingBarElement.displayStatus, 4);
|
|
1535
|
-
break;
|
|
1536
|
-
case "Average":
|
|
1537
|
-
setRatingStatus(oFeedbackDialog, "None", oRatingBarElement.displayStatus, 3);
|
|
1538
|
-
break;
|
|
1539
|
-
case "Poor":
|
|
1540
|
-
setRatingStatus(oFeedbackDialog, "Warning", oRatingBarElement.displayStatus, 2);
|
|
1541
|
-
break;
|
|
1542
|
-
case "Very Poor":
|
|
1543
|
-
setRatingStatus(oFeedbackDialog, "Error", oRatingBarElement.displayStatus, 1);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
});
|
|
1318
|
+
if (bDateInSpan) {
|
|
1319
|
+
oViewModel.setProperty("/sLongSurveyLastDate", sLastAvailableDate);
|
|
1320
|
+
}
|
|
1321
|
+
},
|
|
1322
|
+
|
|
1323
|
+
addSurveyPopoverCloseBtn: function () {
|
|
1324
|
+
var oResourceBundle = this.getModel("i18n").getResourceBundle(),
|
|
1325
|
+
fCloseBtnHandler = this.closeSurveyPopover.bind(this),
|
|
1326
|
+
oCloseButton = new Button({
|
|
1327
|
+
text: oResourceBundle.getText("SURVEY_POPOVER_CLOSE_BTN"),
|
|
1328
|
+
press: fCloseBtnHandler
|
|
1548
1329
|
});
|
|
1549
1330
|
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
oFeedbackDialog.ratingStatus.setText(sText);
|
|
1553
|
-
oFeedbackDialog.ratingStatus.value = iValue;
|
|
1554
|
-
if (iValue) {
|
|
1555
|
-
oFeedbackDialog.sendButton.setEnabled(true);
|
|
1556
|
-
} else {
|
|
1557
|
-
oFeedbackDialog.sendButton.setEnabled(false);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
},
|
|
1331
|
+
this._oSurveyPopover.setEndButton(oCloseButton);
|
|
1332
|
+
},
|
|
1561
1333
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
if (!sQuery) {
|
|
1565
|
-
return;
|
|
1566
|
-
}
|
|
1567
|
-
this.getRouter().navTo("search", {searchParam: sQuery}, false);
|
|
1568
|
-
this.oPicker.close();
|
|
1569
|
-
},
|
|
1334
|
+
onSearch: function (oEvent) {
|
|
1335
|
+
var sQuery = encodeURIComponent(oEvent.getParameter("query"));
|
|
1570
1336
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1337
|
+
if (!sQuery) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1574
1340
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1341
|
+
this.getRouter().navTo("search", { searchParam: sQuery }, false);
|
|
1342
|
+
this.oPicker.close();
|
|
1343
|
+
},
|
|
1578
1344
|
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1345
|
+
navToSearchResults: function (sCategory) {
|
|
1346
|
+
var sQuery = this.getModel("searchData").getProperty("/query"),
|
|
1347
|
+
oRouterParams = { searchParam: sQuery };
|
|
1584
1348
|
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
}
|
|
1349
|
+
if (!sQuery) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
if (sCategory) {
|
|
1354
|
+
oRouterParams["?options"] = {
|
|
1355
|
+
category: sCategory
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1588
1358
|
|
|
1589
|
-
|
|
1590
|
-
|
|
1359
|
+
this.getRouter().navTo("search", oRouterParams, true);
|
|
1360
|
+
this.oPicker.close();
|
|
1361
|
+
},
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Handles the live change event of the search field.
|
|
1365
|
+
* Performs a search based on the entered query and updates the search results.
|
|
1366
|
+
* If the query is empty, hides the search picker.
|
|
1367
|
+
*
|
|
1368
|
+
* @param {Object} oEvent - The live change event object.
|
|
1369
|
+
* @returns {void}
|
|
1370
|
+
*/
|
|
1371
|
+
onSearchLiveChange: function (oEvent) {
|
|
1372
|
+
var oModel = this.getModel("searchData"),
|
|
1591
1373
|
sQuery = oEvent.getParameter("newValue"),
|
|
1592
1374
|
sPreferencedCategory = oModel.getProperty("/preferencedCategory"),
|
|
1593
1375
|
bIncludeDeprecated = oModel.getProperty("/includeDeprecated");
|
|
1594
1376
|
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1377
|
+
// Handle the case when the user deletes the query and the search picker is open
|
|
1378
|
+
// Only on desktop, because on mobile we don't want to close the picker
|
|
1379
|
+
if (!sQuery && Device.system.desktop) {
|
|
1380
|
+
if (this.oPicker.isOpen()) {
|
|
1381
|
+
this.oPicker.close();
|
|
1599
1382
|
}
|
|
1600
1383
|
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
preferencedCategory: sPreferencedCategory,
|
|
1604
|
-
includeDeprecated: bIncludeDeprecated
|
|
1605
|
-
}).then(function(result) {
|
|
1606
|
-
oModel.setProperty("/matches", result.matches);
|
|
1607
|
-
});
|
|
1608
|
-
},
|
|
1609
|
-
|
|
1610
|
-
onHeaderResize: function (oEvent) {
|
|
1611
|
-
var iWidth = oEvent.size.width,
|
|
1612
|
-
bPhoneSize = Device.system.phone || iWidth < Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[0],
|
|
1613
|
-
oViewModel = this.getModel("appView"),
|
|
1614
|
-
bSearchMode = oViewModel.getProperty("/bSearchMode");
|
|
1615
|
-
|
|
1616
|
-
// Check for a change in "bPhoneSize" property in order to
|
|
1617
|
-
// reduce number of method calls
|
|
1618
|
-
if (bPhoneSize !== oViewModel.getProperty("/bPhoneSize")) {
|
|
1619
|
-
oViewModel.setProperty("/bPhoneSize", bPhoneSize);
|
|
1620
|
-
this._updateVersionSwitchVisibility();
|
|
1621
|
-
this._tabHeader.setVisible(!bPhoneSize);
|
|
1622
|
-
this._selectHeader.setVisible(bPhoneSize);
|
|
1623
|
-
}
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1624
1386
|
|
|
1625
|
-
|
|
1626
|
-
// set to false if search is opened for correct calculation of the search width.
|
|
1627
|
-
if (bSearchMode) {
|
|
1628
|
-
this._selectHeader.setVisible(false);
|
|
1629
|
-
}
|
|
1630
|
-
},
|
|
1387
|
+
this.openSearchPicker();
|
|
1631
1388
|
|
|
1632
|
-
|
|
1633
|
-
this.
|
|
1634
|
-
}
|
|
1389
|
+
if (this.highlighter) {
|
|
1390
|
+
this.highlighter.highlight(sQuery);
|
|
1391
|
+
}
|
|
1635
1392
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1393
|
+
oModel.setProperty("/query", sQuery);
|
|
1394
|
+
SearchUtil.search(sQuery, {
|
|
1395
|
+
preferencedCategory: sPreferencedCategory,
|
|
1396
|
+
includeDeprecated: bIncludeDeprecated
|
|
1397
|
+
}).then(function (result) {
|
|
1398
|
+
oModel.setProperty("/matches", result.matches);
|
|
1399
|
+
});
|
|
1400
|
+
},
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Handles the resize event of the page.
|
|
1404
|
+
*
|
|
1405
|
+
* This function adjusts the view model properties based on the page width,
|
|
1406
|
+
* and performs additional actions for a better user experience.
|
|
1407
|
+
*
|
|
1408
|
+
* @param {Object} oEvent - The resize event object.
|
|
1409
|
+
* @returns {void}
|
|
1410
|
+
*/
|
|
1411
|
+
onPageResize: function (oEvent) {
|
|
1412
|
+
var iWidth = oEvent.size.width,
|
|
1413
|
+
bDesktopSize = iWidth >= Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[1], // 1024px
|
|
1414
|
+
bPhoneSize = iWidth < Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[0], // 600px
|
|
1415
|
+
oViewModel = this.getModel("appView");
|
|
1416
|
+
|
|
1417
|
+
if (bPhoneSize !== oViewModel.getProperty("/bPhoneSize")) {
|
|
1418
|
+
oViewModel.setProperty("/bPhoneSize", bPhoneSize);
|
|
1419
|
+
|
|
1420
|
+
// When page is resized from desktop to phone size, hide side navigation initially for better UX
|
|
1421
|
+
this._demoKitPage.setSideExpanded(false);
|
|
1422
|
+
}
|
|
1655
1423
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
}
|
|
1659
|
-
} else if (bPhoneSize) {
|
|
1660
|
-
this._selectHeader.setVisible(true);
|
|
1661
|
-
}
|
|
1662
|
-
},
|
|
1663
|
-
|
|
1664
|
-
/**
|
|
1665
|
-
* Register Feedback rating icons
|
|
1666
|
-
* @private
|
|
1667
|
-
*/
|
|
1668
|
-
_registerFeedbackRatingIcons: function () {
|
|
1669
|
-
IconPool.addIcon("icon-face-very-bad", "FeedbackRatingFaces", {
|
|
1670
|
-
fontFamily: "FeedbackRatingFaces",
|
|
1671
|
-
content: "E086",
|
|
1672
|
-
suppressMirroring: true
|
|
1673
|
-
});
|
|
1674
|
-
IconPool.addIcon("icon-face-bad", "FeedbackRatingFaces", {
|
|
1675
|
-
fontFamily: "FeedbackRatingFaces",
|
|
1676
|
-
content: "E087",
|
|
1677
|
-
suppressMirroring: true
|
|
1678
|
-
});
|
|
1679
|
-
IconPool.addIcon("icon-face-neutral", "FeedbackRatingFaces", {
|
|
1680
|
-
fontFamily: "FeedbackRatingFaces",
|
|
1681
|
-
content: "E089",
|
|
1682
|
-
suppressMirroring: true
|
|
1683
|
-
});
|
|
1684
|
-
IconPool.addIcon("icon-face-happy", "FeedbackRatingFaces", {
|
|
1685
|
-
fontFamily: "FeedbackRatingFaces",
|
|
1686
|
-
content: "E08B",
|
|
1687
|
-
suppressMirroring: true
|
|
1688
|
-
});
|
|
1689
|
-
IconPool.addIcon("icon-face-very-happy", "FeedbackRatingFaces", {
|
|
1690
|
-
fontFamily: "FeedbackRatingFaces",
|
|
1691
|
-
content: "E08C",
|
|
1692
|
-
suppressMirroring: true
|
|
1693
|
-
});
|
|
1694
|
-
},
|
|
1695
|
-
|
|
1696
|
-
_getCurrentYear: function () {
|
|
1697
|
-
return new Date().getFullYear();
|
|
1698
|
-
},
|
|
1699
|
-
|
|
1700
|
-
_getCurrentQuarter: function () {
|
|
1701
|
-
var oDate = new Date(),
|
|
1702
|
-
iMonth = oDate.getMonth(),
|
|
1703
|
-
iQuarter = Math.floor(iMonth / 3) + 1;
|
|
1704
|
-
|
|
1705
|
-
return iQuarter;
|
|
1706
|
-
},
|
|
1707
|
-
|
|
1708
|
-
/**
|
|
1709
|
-
* Filters versions in the given JSON object that have passed their end of cloud maintenance date.
|
|
1710
|
-
* @function
|
|
1711
|
-
* @param {Object} oVersionOverviewJson - A JSON object containing version information.
|
|
1712
|
-
* @returns {Array} An array of versions that have not passed their end of cloud maintenance date.
|
|
1713
|
-
*/
|
|
1714
|
-
_filterVersionsPastEOCP: function (oVersionOverviewJson) {
|
|
1715
|
-
var aVersions = oVersionOverviewJson.patches;
|
|
1716
|
-
|
|
1717
|
-
return aVersions.filter(function (oVersion) {
|
|
1718
|
-
var sVersionEOCP = oVersion.extended_eocp || oVersion.eocp || "";
|
|
1719
|
-
// Handle the case when eocp is not defined and include it in the list
|
|
1720
|
-
if (!sVersionEOCP) {
|
|
1721
|
-
return true;
|
|
1722
|
-
}
|
|
1723
|
-
// Handle the case when eocp is not in the "quarter/year" format (e.g., "To Be Determined")
|
|
1724
|
-
// Treat it as if it hasn't passed its end of cloud maintenance date and include it in the list
|
|
1725
|
-
var isQuarterYearFormat = /^Q[1-4]\/\d{4}$/i.test(sVersionEOCP);
|
|
1726
|
-
if (!isQuarterYearFormat) {
|
|
1727
|
-
return true;
|
|
1728
|
-
}
|
|
1729
|
-
// Otherwise, check if the version has passed its end of cloud maintenance date
|
|
1730
|
-
var iQuarter = Number(sVersionEOCP.substring(1, 2)),
|
|
1731
|
-
iYear = Number(sVersionEOCP.substring(3));
|
|
1424
|
+
if (bDesktopSize !== oViewModel.getProperty("/bDesktopSize")) {
|
|
1425
|
+
oViewModel.setProperty("/bDesktopSize", bDesktopSize);
|
|
1732
1426
|
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
}.bind(this));
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
_processVersionOverview: function(oVersionOverviewJson) {
|
|
1739
|
-
var aVersions = oVersionOverviewJson.versions,
|
|
1740
|
-
aResult = [];
|
|
1741
|
-
|
|
1742
|
-
if (Array.isArray(aVersions)) {
|
|
1743
|
-
aVersions = aVersions.filter(function(oVersion) {
|
|
1744
|
-
return !!oVersion.hidden;
|
|
1745
|
-
}).forEach(function(oVersion) {
|
|
1746
|
-
var aHiddenVersions = oVersion.hidden.split(",").map(function(sVersion) {
|
|
1747
|
-
return sVersion.trim();
|
|
1748
|
-
});
|
|
1427
|
+
setTimeout(function () {
|
|
1428
|
+
this._updateSearchFieldState();
|
|
1429
|
+
}.bind(this), 0);
|
|
1430
|
+
}
|
|
1431
|
+
},
|
|
1749
1432
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1433
|
+
onSideNavigationButtonPress: function () {
|
|
1434
|
+
this._demoKitPage.setSideExpanded(!this._demoKitPage.getSideExpanded());
|
|
1435
|
+
},
|
|
1753
1436
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1437
|
+
_onOrientationChange: function () {
|
|
1438
|
+
this.getModel("appView").setProperty("/bLandscape", Device.orientation.landscape);
|
|
1439
|
+
},
|
|
1756
1440
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
|
|
1761
|
-
aRoutes = [];
|
|
1441
|
+
onToggleSearchMode: function (oEvent) {
|
|
1442
|
+
var bSearchMode = oEvent.getParameter("isOpen"),
|
|
1443
|
+
oViewModel = this.getModel("appView");
|
|
1762
1444
|
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1445
|
+
// This flag is used to hide action buttons when search is opened
|
|
1446
|
+
oViewModel.setProperty("/bSearchMode", bSearchMode);
|
|
1447
|
+
|
|
1448
|
+
if (bSearchMode) {
|
|
1449
|
+
setTimeout(function () {
|
|
1450
|
+
if (Device.system.desktop) {
|
|
1451
|
+
this._oView.byId("searchControl").getAggregation("_searchField").getFocusDomRef().focus();
|
|
1452
|
+
} else {
|
|
1453
|
+
this.openSearchPicker();
|
|
1454
|
+
}
|
|
1455
|
+
}.bind(this), 0);
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
|
|
1459
|
+
_getCurrentYear: function () {
|
|
1460
|
+
return new Date().getFullYear();
|
|
1461
|
+
},
|
|
1462
|
+
|
|
1463
|
+
_getCurrentQuarter: function () {
|
|
1464
|
+
var oDate = new Date(),
|
|
1465
|
+
iMonth = oDate.getMonth(),
|
|
1466
|
+
iQuarter = Math.floor(iMonth / 3) + 1;
|
|
1467
|
+
|
|
1468
|
+
return iQuarter;
|
|
1469
|
+
},
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Filters versions in the given JSON object that have passed their end of cloud maintenance date.
|
|
1473
|
+
*
|
|
1474
|
+
* @param {Object} oVersionOverviewJson - A JSON object containing version information.
|
|
1475
|
+
* @returns {Array} An array of versions that have not passed their end of cloud maintenance date.
|
|
1476
|
+
*/
|
|
1477
|
+
_filterVersionsPastEOCP: function (oVersionOverviewJson) {
|
|
1478
|
+
var aVersions = oVersionOverviewJson.patches;
|
|
1479
|
+
|
|
1480
|
+
return aVersions.filter(function (oVersion) {
|
|
1481
|
+
var sVersionEOCP = oVersion.extended_eocp || oVersion.eocp || "";
|
|
1482
|
+
// Handle the case when eocp is not defined and include it in the list
|
|
1483
|
+
if (!sVersionEOCP) {
|
|
1484
|
+
return true;
|
|
1485
|
+
}
|
|
1486
|
+
// Handle the case when eocp is not in the "quarter/year" format (e.g., "To Be Determined")
|
|
1487
|
+
// Treat it as if it hasn't passed its end of cloud maintenance date and include it in the list
|
|
1488
|
+
var isQuarterYearFormat = /^Q[1-4]\/\d{4}$/i.test(sVersionEOCP);
|
|
1489
|
+
if (!isQuarterYearFormat) {
|
|
1490
|
+
return true;
|
|
1766
1491
|
}
|
|
1492
|
+
// Otherwise, check if the version has passed its end of cloud maintenance date
|
|
1493
|
+
var iQuarter = Number(sVersionEOCP.substring(1, 2)),
|
|
1494
|
+
iYear = Number(sVersionEOCP.substring(3));
|
|
1495
|
+
|
|
1496
|
+
return iYear > this._getCurrentYear() ||
|
|
1497
|
+
iYear === this._getCurrentYear() && iQuarter >= this._getCurrentQuarter();
|
|
1498
|
+
}.bind(this));
|
|
1499
|
+
},
|
|
1500
|
+
|
|
1501
|
+
_processVersionOverview: function (oVersionOverviewJson) {
|
|
1502
|
+
var aVersions = oVersionOverviewJson.versions,
|
|
1503
|
+
aResult = [];
|
|
1504
|
+
|
|
1505
|
+
if (Array.isArray(aVersions)) {
|
|
1506
|
+
aVersions = aVersions.filter(function (oVersion) {
|
|
1507
|
+
return !!oVersion.hidden;
|
|
1508
|
+
}).forEach(function (oVersion) {
|
|
1509
|
+
var aHiddenVersions = oVersion.hidden.split(",").map(function (sVersion) {
|
|
1510
|
+
return sVersion.trim();
|
|
1511
|
+
});
|
|
1767
1512
|
|
|
1768
|
-
|
|
1513
|
+
aResult = aResult.concat(aHiddenVersions);
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1769
1516
|
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
aRoutes.pop();
|
|
1517
|
+
return aResult;
|
|
1518
|
+
},
|
|
1773
1519
|
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}
|
|
1520
|
+
_processNeoAppJSON: function (oNeoAppJson) {
|
|
1521
|
+
var oVersionModel = this.getModel("versionData"),
|
|
1522
|
+
bIsInternal = oVersionModel.getProperty("/isInternal"),
|
|
1523
|
+
bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
|
|
1524
|
+
aRoutes = [];
|
|
1780
1525
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1526
|
+
if (!(oNeoAppJson && oNeoAppJson.routes)) {
|
|
1527
|
+
Log.warning("No versions were found");
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1784
1530
|
|
|
1785
|
-
|
|
1786
|
-
oVersionSummary.patchVersion = oVersion.getPatch(); // E.g: Extract 5 from "1.52.5"
|
|
1787
|
-
oVersionSummary.groupTitle = oVersion.getMajor() + "." + oVersion.getMinor(); // E.g: Extract "1.52" from "1.52.5"
|
|
1788
|
-
oVersionSummary.version = oVersion.toString();
|
|
1789
|
-
oVersionSummary.path = oRoute.path;
|
|
1531
|
+
aRoutes = oNeoAppJson.routes;
|
|
1790
1532
|
|
|
1791
|
-
|
|
1533
|
+
// Current version would be displayed for a second time as the last element,
|
|
1534
|
+
// therefore we should skip it to avoid duplicate items in the dialog.
|
|
1535
|
+
aRoutes.pop();
|
|
1536
|
+
|
|
1537
|
+
// Store needed data
|
|
1538
|
+
if (!bIsInternal && !bIsSnapshotVersion) {
|
|
1539
|
+
aRoutes = aRoutes.filter(function (oRoute) {
|
|
1540
|
+
return oRoute.target.version.indexOf("-beta") === -1;
|
|
1792
1541
|
});
|
|
1542
|
+
}
|
|
1793
1543
|
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1544
|
+
aRoutes = aRoutes.map(function (oRoute) {
|
|
1545
|
+
var oVersion = Version(oRoute.target.version),
|
|
1546
|
+
oVersionSummary = {};
|
|
1547
|
+
|
|
1548
|
+
// Add the following properties, in order use them for grouping later
|
|
1549
|
+
oVersionSummary.patchVersion = oVersion.getPatch(); // E.g: Extract 5 from "1.52.5"
|
|
1550
|
+
oVersionSummary.groupTitle = oVersion.getMajor() + "." + oVersion.getMinor(); // E.g: Extract "1.52" from "1.52.5"
|
|
1551
|
+
oVersionSummary.version = oVersion.toString();
|
|
1552
|
+
oVersionSummary.path = oRoute.path;
|
|
1553
|
+
|
|
1554
|
+
return oVersionSummary;
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
return aRoutes;
|
|
1558
|
+
},
|
|
1559
|
+
|
|
1560
|
+
_requestVersionInfo: function () {
|
|
1561
|
+
Promise.all([
|
|
1562
|
+
jQuery.ajax(sNeoAppJsonPath),
|
|
1563
|
+
jQuery.ajax(sVersionOverviewJsonPath)
|
|
1564
|
+
]).then(
|
|
1565
|
+
// Success
|
|
1566
|
+
function (oValues) {
|
|
1567
|
+
var aNeoAppVersions = this._processNeoAppJSON(oValues[0]),
|
|
1568
|
+
aHiddenValues = this._processVersionOverview(oValues[1]),
|
|
1569
|
+
aFilteredVersionsEOCP = this._filterVersionsPastEOCP(oValues[1]);
|
|
1570
|
+
|
|
1571
|
+
if (Array.isArray(aNeoAppVersions)) {
|
|
1572
|
+
aNeoAppVersions = aNeoAppVersions.filter(function (oVersion) {
|
|
1573
|
+
return aHiddenValues.indexOf(oVersion.version) === -1;
|
|
1574
|
+
});
|
|
1812
1575
|
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
});
|
|
1576
|
+
// Filters "aNeoAppVersions" array by removing elements
|
|
1577
|
+
// that don't have a matching version in "aFilteredVersionsEOCP" array.
|
|
1578
|
+
aNeoAppVersions = aNeoAppVersions.filter(function (oVersion) {
|
|
1579
|
+
return aFilteredVersionsEOCP.find(function (oFilteredVersion) {
|
|
1580
|
+
return oFilteredVersion.version === oVersion.version;
|
|
1819
1581
|
});
|
|
1582
|
+
});
|
|
1820
1583
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
}
|
|
1829
|
-
}.bind(this),
|
|
1830
|
-
// Error
|
|
1831
|
-
function() {
|
|
1832
|
-
Log.warning("No neo-app.json or versionoverview.json was detected");
|
|
1584
|
+
this._aNeoAppVersions = aNeoAppVersions;
|
|
1585
|
+
// Make version select visible
|
|
1586
|
+
this._updateVersionSwitchVisibility();
|
|
1587
|
+
this.getModel("versionData").setProperty("/latestVersion", this._aNeoAppVersions[0].version);
|
|
1588
|
+
} else {
|
|
1589
|
+
this._aNeoAppVersions = [];
|
|
1590
|
+
Log.warning("No multi-version environment detected");
|
|
1833
1591
|
}
|
|
1834
|
-
)
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
return this.getModel("versionData").getProperty("/fullVersion");
|
|
1839
|
-
},
|
|
1840
|
-
|
|
1841
|
-
_getUI5Version: function () {
|
|
1842
|
-
return ResourcesUtil.getResourcesVersion() ?
|
|
1843
|
-
window.sessionStorage.getItem("versionPrefixPath") : this.getModel("versionData").getProperty("/version");
|
|
1844
|
-
},
|
|
1845
|
-
|
|
1846
|
-
_getUI5VersionGav: function () {
|
|
1847
|
-
return this.getModel("versionData").getProperty("/versionGav");
|
|
1848
|
-
},
|
|
1849
|
-
|
|
1850
|
-
_getUI5Distribution: function () {
|
|
1851
|
-
var sVersionGav = this._getUI5VersionGav();
|
|
1852
|
-
var sUI5Distribution = "SAPUI5";
|
|
1853
|
-
if (sVersionGav && /openui5/i.test(sVersionGav)) {
|
|
1854
|
-
sUI5Distribution = "OpenUI5";
|
|
1855
|
-
}
|
|
1856
|
-
return sUI5Distribution;
|
|
1857
|
-
},
|
|
1858
|
-
|
|
1859
|
-
_getUI5VersionType: function() {
|
|
1860
|
-
var oVersionModel = this.getModel("versionData"),
|
|
1861
|
-
bIsInternal = oVersionModel.getProperty("/isInternal"),
|
|
1862
|
-
bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
|
|
1863
|
-
sVersionType;
|
|
1864
|
-
|
|
1865
|
-
switch (true) {
|
|
1866
|
-
case bIsSnapshotVersion && bIsInternal:
|
|
1867
|
-
sVersionType = "InternalSnapshot";
|
|
1868
|
-
break;
|
|
1869
|
-
case bIsInternal:
|
|
1870
|
-
sVersionType = "Internal";
|
|
1871
|
-
break;
|
|
1872
|
-
case bIsSnapshotVersion:
|
|
1873
|
-
sVersionType = "Snapshot";
|
|
1874
|
-
break;
|
|
1875
|
-
default:
|
|
1876
|
-
sVersionType = "Release";
|
|
1592
|
+
}.bind(this),
|
|
1593
|
+
// Error
|
|
1594
|
+
function () {
|
|
1595
|
+
Log.warning("No neo-app.json or versionoverview.json was detected");
|
|
1877
1596
|
}
|
|
1597
|
+
);
|
|
1598
|
+
},
|
|
1599
|
+
|
|
1600
|
+
_getFullVersion: function () {
|
|
1601
|
+
return this.getModel("versionData").getProperty("/fullVersion");
|
|
1602
|
+
},
|
|
1603
|
+
|
|
1604
|
+
_getUI5Version: function () {
|
|
1605
|
+
return ResourcesUtil.getResourcesVersion()
|
|
1606
|
+
? window.sessionStorage.getItem("versionPrefixPath")
|
|
1607
|
+
: this.getModel("versionData").getProperty("/version");
|
|
1608
|
+
},
|
|
1609
|
+
|
|
1610
|
+
_getUI5VersionGav: function () {
|
|
1611
|
+
return this.getModel("versionData").getProperty("/versionGav");
|
|
1612
|
+
},
|
|
1613
|
+
|
|
1614
|
+
_getUI5Distribution: function () {
|
|
1615
|
+
var sVersionGav = this._getUI5VersionGav(),
|
|
1616
|
+
sUI5Distribution = "SAPUI5";
|
|
1617
|
+
|
|
1618
|
+
if (sVersionGav && /openui5/i.test(sVersionGav)) {
|
|
1619
|
+
sUI5Distribution = "OpenUI5";
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
return sUI5Distribution;
|
|
1623
|
+
},
|
|
1624
|
+
|
|
1625
|
+
_getUI5VersionType: function () {
|
|
1626
|
+
var oVersionModel = this.getModel("versionData"),
|
|
1627
|
+
bIsInternal = oVersionModel.getProperty("/isInternal"),
|
|
1628
|
+
bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
|
|
1629
|
+
sVersionType;
|
|
1630
|
+
|
|
1631
|
+
switch (true) {
|
|
1632
|
+
case bIsSnapshotVersion && bIsInternal:
|
|
1633
|
+
sVersionType = "InternalSnapshot";
|
|
1634
|
+
break;
|
|
1635
|
+
case bIsInternal:
|
|
1636
|
+
sVersionType = "Internal";
|
|
1637
|
+
break;
|
|
1638
|
+
case bIsSnapshotVersion:
|
|
1639
|
+
sVersionType = "Snapshot";
|
|
1640
|
+
break;
|
|
1641
|
+
default:
|
|
1642
|
+
sVersionType = "Release";
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
return sVersionType;
|
|
1646
|
+
},
|
|
1647
|
+
|
|
1648
|
+
_getCurrentPageRelativeURL: function () {
|
|
1649
|
+
var currentLocation = window.location;
|
|
1650
|
+
return currentLocation.pathname + currentLocation.hash + currentLocation.search;
|
|
1651
|
+
},
|
|
1652
|
+
|
|
1653
|
+
_getCurrentURL: function () {
|
|
1654
|
+
var currentLocation = window.location;
|
|
1655
|
+
return currentLocation.href;
|
|
1656
|
+
},
|
|
1657
|
+
|
|
1658
|
+
_setHeaderSelectedKey: function (sKey) {
|
|
1659
|
+
this._demoKitSubHeader.setSelectedKey(sKey);
|
|
1660
|
+
this._demoKitSideNavigation.setSelectedKey(sKey);
|
|
1661
|
+
this._sKey = sKey;
|
|
1662
|
+
},
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* Handles the theme changed event.
|
|
1666
|
+
*
|
|
1667
|
+
* @param {string} sChannelId - The channel ID of the event.
|
|
1668
|
+
* @param {string} sEventId - The event ID.
|
|
1669
|
+
* @param {Object} oData - The data associated with the event.
|
|
1670
|
+
* @returns {void}
|
|
1671
|
+
*/
|
|
1672
|
+
_onThemeChanged: function (sChannelId, sEventId, oData) {
|
|
1673
|
+
var oViewModel = this.getModel("appView"),
|
|
1674
|
+
sActiveTheme = oData.sThemeActive,
|
|
1675
|
+
bDarkThemeActive = sActiveTheme && (sActiveTheme.includes("dark") || sActiveTheme.includes("hcb"));
|
|
1676
|
+
|
|
1677
|
+
oViewModel.setProperty("/bDarkThemeActive", bDarkThemeActive);
|
|
1678
|
+
},
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* Updates the state of the search field.
|
|
1682
|
+
* Expand/collapse the search field depending on the screen size.
|
|
1683
|
+
* Hide/show header button actions if the search field is expanded/collapsed.
|
|
1684
|
+
*
|
|
1685
|
+
* @returns {void}
|
|
1686
|
+
*/
|
|
1687
|
+
_updateSearchFieldState: function () {
|
|
1688
|
+
var oViewModel = this.getModel("appView"),
|
|
1689
|
+
bDesktopSize = oViewModel.getProperty("/bDesktopSize"),
|
|
1690
|
+
oClosingButton = this.byId("searchControl").getAggregation("_closingButton");
|
|
1691
|
+
|
|
1692
|
+
if (bDesktopSize) {
|
|
1693
|
+
oViewModel.setProperty("/bSearchMode", false);
|
|
1694
|
+
oClosingButton.setVisible(false);
|
|
1695
|
+
} else {
|
|
1696
|
+
oClosingButton.setVisible(true);
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* Retrieves the keys of sub-menu items from 'Tools' drop-down menu.
|
|
1702
|
+
*
|
|
1703
|
+
* @returns {Array} An array containing the keys of the sub-menu items.
|
|
1704
|
+
*/
|
|
1705
|
+
_getHeaderSubMenuItemKeys: function () {
|
|
1706
|
+
var aSubHeaderSubmenuItemKeys = [];
|
|
1707
|
+
|
|
1708
|
+
this._demoKitSubHeader.getTabFilters()
|
|
1709
|
+
.find(function (oTab) {
|
|
1710
|
+
return oTab.getId().includes("toolsTab");
|
|
1711
|
+
})
|
|
1712
|
+
.getItems().forEach(function (oItem) {
|
|
1713
|
+
aSubHeaderSubmenuItemKeys.push(oItem.getKey());
|
|
1714
|
+
});
|
|
1878
1715
|
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
.split(",").filter(function(id) { return id !== ''; }),
|
|
1901
|
-
oCustomData = oEvent.getSource().getCustomData().find(function(oCustomData) {
|
|
1902
|
-
return oCustomData.getKey() === "messageID";
|
|
1903
|
-
}),
|
|
1904
|
-
oId = oCustomData.getValue();
|
|
1905
|
-
|
|
1906
|
-
aMessageCookie.push(oId);
|
|
1907
|
-
this._oConfigUtil.setCookie(this._oCookieNames["DEMOKIT_IMPORTANT_MESSAGES_READ"], aMessageCookie.join(","));
|
|
1908
|
-
|
|
1909
|
-
this._updateMessagesModel(this.getModel("messagesData").getData());
|
|
1716
|
+
return aSubHeaderSubmenuItemKeys;
|
|
1717
|
+
},
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* Event handler for selecting a sub-menu item from 'Tools' drop-down menu.
|
|
1721
|
+
* Opens a new tab with the corresponding URL.
|
|
1722
|
+
*
|
|
1723
|
+
* @param {string} sKey - The key of the selected item.
|
|
1724
|
+
* @returns {void}
|
|
1725
|
+
*/
|
|
1726
|
+
_headerItemSelectHandler: function (sKey) {
|
|
1727
|
+
var items = [
|
|
1728
|
+
{ key: "fioriTools", url: "https://help.sap.com/viewer/product/SAP_FIORI_tools/Latest/en-US" },
|
|
1729
|
+
{ key: "iconExplorer", url: "test-resources/sap/m/demokit/iconExplorer/webapp/index.html" },
|
|
1730
|
+
{ key: "ui5Inspector", url: "https://sap.github.io/ui5-inspector/" },
|
|
1731
|
+
{ key: "ui5Tooling", url: "https://sap.github.io/ui5-tooling/stable/" }
|
|
1732
|
+
];
|
|
1733
|
+
|
|
1734
|
+
var selectedItem = items.find(function (item) { return item.key === sKey; });
|
|
1735
|
+
if (selectedItem) {
|
|
1736
|
+
URLHelper.redirect(selectedItem.url, true);
|
|
1910
1737
|
}
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1738
|
+
},
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Sets the selected section title based on the provided key.
|
|
1742
|
+
*
|
|
1743
|
+
* @param {string} sKey - The key of the selected section.
|
|
1744
|
+
* @returns {void}
|
|
1745
|
+
*/
|
|
1746
|
+
_setSelectedSectionTitle: function (sKey) {
|
|
1747
|
+
var oViewModel = this.getModel("appView"),
|
|
1748
|
+
oResourceBundle = this.getModel("i18n").getResourceBundle();
|
|
1749
|
+
|
|
1750
|
+
var items = [
|
|
1751
|
+
{ key: "home", text: oResourceBundle.getText("APP_TABHEADER_ITEM_HOME") },
|
|
1752
|
+
{ key: "topic", text: oResourceBundle.getText("APP_TABHEADER_ITEM_DOCUMENTATION") },
|
|
1753
|
+
{ key: "api", text: oResourceBundle.getText("APP_TABHEADER_ITEM_API_REFERENCE") },
|
|
1754
|
+
{ key: "controls", text: oResourceBundle.getText("APP_TABHEADER_ITEM_SAMPLES") },
|
|
1755
|
+
{ key: "demoapps", text: oResourceBundle.getText("APP_TABHEADER_ITEM_DEMO_APPS") },
|
|
1756
|
+
{ key: "tools", text: oResourceBundle.getText("APP_TABHEADER_ITEM_TOOLS") }
|
|
1757
|
+
];
|
|
1758
|
+
|
|
1759
|
+
var selectedItem = items.find(function (item) { return item.key === sKey; });
|
|
1760
|
+
oViewModel.setProperty("/selectedSectionTitle", selectedItem.text);
|
|
1761
|
+
},
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Tweak the appearance of the version switch button.
|
|
1765
|
+
* This function adds a CSS class to the button's text content DOM element
|
|
1766
|
+
* to customize its styling after rendering.
|
|
1767
|
+
*
|
|
1768
|
+
* @returns {void} This function does not return a value.
|
|
1769
|
+
*/
|
|
1770
|
+
_adjustVersionSwitchButton: function () {
|
|
1771
|
+
var oVersionSwitchButton = this.byId("versionSwitchButton");
|
|
1772
|
+
|
|
1773
|
+
if (oVersionSwitchButton) {
|
|
1774
|
+
oVersionSwitchButton.addEventDelegate({
|
|
1775
|
+
onAfterRendering: function () {
|
|
1776
|
+
var oVersionSwitchButtonDomRef = oVersionSwitchButton.getDomRef(),
|
|
1777
|
+
oVersionSwitchButtonTextContentDomRef = oVersionSwitchButtonDomRef.querySelector(".sapMBtnContent");
|
|
1778
|
+
|
|
1779
|
+
if (oVersionSwitchButtonTextContentDomRef) {
|
|
1780
|
+
if (!oVersionSwitchButtonTextContentDomRef.classList.contains("sapUiDemoKitHeaderActionsVersionSwitchTextContent")) {
|
|
1781
|
+
oVersionSwitchButtonTextContentDomRef.classList.add("sapUiDemoKitHeaderActionsVersionSwitchTextContent");
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
});
|
|
1789
|
+
});
|