_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q19300
train
function ({name, type, className, text=name, local=false, hrefAppend=""}) { let sLink; // handling module's if (className !== undefined && (/^module:/.test(name) || /^module:/.test(className))) { name = name.replace(/^module:/, ""); } name = encodeURIComponent(name); className = encodeURIComponent(className); // Build the link sLink = type ? `${className}/${type}/${name}` : name; if (hrefAppend) { sLink += hrefAppend; } if (local) { return `<a target="_self" class="jsdoclink scrollTo${type === `events` ? `Event` : `Method`}" data-sap-ui-target="${name}" href="#/api/${sLink}">${text}</a>`; } return `<a target="_self" class="jsdoclink" href="#/api/${sLink}">${text}</a>`; }
javascript
{ "resource": "" }
q19301
train
function (sDescription, aReferences) { var iLen, i; // format references if (aReferences && aReferences.length > 0) { sDescription += "<br><br><span>Documentation links:</span><ul>"; iLen = aReferences.length; for (i = 0; i < iLen; i++) { // We treat references as links but as they may not be defined as such we enforce it if needed if (/{@link.*}/.test(aReferences[i])) { sDescription += "<li>" + aReferences[i] + "</li>"; } else { sDescription += "<li>{@link " + aReferences[i] + "}</li>"; } } sDescription += "</ul>"; } // Calling formatDescription so it could handle further formatting return this.formatDescription(sDescription); }
javascript
{ "resource": "" }
q19302
train
function (description, deprecatedText, deprecatedSince) { if (!description && !deprecatedText && !deprecatedSince) { return ""; } var result = description || ""; if (deprecatedSince || deprecatedText) { // Note: sapUiDocumentationDeprecated - transformed to sapUiDeprecated to keep json file size low result += "<span class=\"sapUiDeprecated\"><br>"; result += this.formatDeprecated(deprecatedSince, deprecatedText); result += "</span>"; } result = this._preProcessLinksInTextBlock(result); return result; }
javascript
{ "resource": "" }
q19303
train
function (sSince, sDescription, sEntityType) { var aResult; // Build deprecation message // Note: there may be no since or no description text available aResult = ["Deprecated"]; if (sSince) { aResult.push(" as of version " + sSince); } if (sDescription) { // Evaluate code blocks - Handle <code>...</code> pattern sDescription = sDescription.replace(/<code>(\S+)<\/code>/gi, function (sMatch, sCodeEntity) { return ['<em>', sCodeEntity, '</em>'].join(""); } ); // Evaluate links in the deprecation description aResult.push(". " + this._preProcessLinksInTextBlock(sDescription, true)); } return aResult.join(""); }
javascript
{ "resource": "" }
q19304
train
function (oSymbol, bCalledOnConstructor) { var bHeaderDocuLinkFound = false, bUXGuidelinesLinkFound = false, aReferences = [], entity = bCalledOnConstructor? oSymbol.constructor.references : oSymbol.references; const UX_GUIDELINES_BASE_URL = "https://experience.sap.com/fiori-design-web/"; if (entity && entity.length > 0) { entity.forEach(function (sReference) { var aParts; // Docu link - For the header we take into account only the first link that matches one of the patterns if (!bHeaderDocuLinkFound) { // Handled patterns: // * topic:59a0e11712e84a648bb990a1dba76bc7 // * {@link topic:59a0e11712e84a648bb990a1dba76bc7} // * {@link topic:59a0e11712e84a648bb990a1dba76bc7 Link text} aParts = sReference.match(/^{@link\s+topic:(\w{32})(\s.+)?}$|^topic:(\w{32})$/); if (aParts) { if (aParts[3]) { // Link is of type topic:GUID oSymbol.docuLink = aParts[3]; oSymbol.docuLinkText = oSymbol.basename; } else if (aParts[1]) { // Link of type {@link topic:GUID} or {@link topic:GUID Link text} oSymbol.docuLink = aParts[1]; oSymbol.docuLinkText = aParts[2] ? aParts[2] : oSymbol.basename; } bHeaderDocuLinkFound = true; return; } } // Fiori link - Handled patterns: // * fiori:flexible-column-layout // * fiori:/flexible-column-layout/ // * fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ // * {@link fiori:flexible-column-layout} // * {@link fiori:/flexible-column-layout/} // * {@link fiori:/flexible-column-layout/ Flexible Column Layout} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/} // * {@link fiori:https://experience.sap.com/fiori-design-web/flexible-column-layout/ Flexible Column Layout} aParts = sReference.match(/^(?:{@link\s)?fiori:(?:https:\/\/experience\.sap\.com\/fiori-design-web\/)?\/?(\S+\b)\/?\s?(.*[^\s}])?}?$/); if (aParts) { let [, sTarget, sTargetName] = aParts; if (bCalledOnConstructor && !bUXGuidelinesLinkFound) { // Extract first found UX Guidelines link as primary oSymbol.uxGuidelinesLink = UX_GUIDELINES_BASE_URL + sTarget; oSymbol.uxGuidelinesLinkText = sTargetName ? sTargetName : oSymbol.basename; bUXGuidelinesLinkFound = true; return; } else { // BCP: 1870155880 - Every consecutive "fiori:" link should be handled as a normal link sReference = "{@link " + UX_GUIDELINES_BASE_URL + sTarget + (sTargetName ? " " + sTargetName : "") + "}"; } } aReferences.push(sReference); }); bCalledOnConstructor? oSymbol.constructor.references = aReferences : oSymbol.references = aReferences; } else { bCalledOnConstructor? oSymbol.constructor.references = [] : oSymbol.references = []; } }
javascript
{ "resource": "" }
q19305
train
function(oEntity) { if (oEntity.references && Array.isArray(oEntity.references)) { oEntity.references = oEntity.references.map(sReference => { return `<li>${sReference}</li>`; }); if (!oEntity.description) { // If there is no method description - references should be the first line of it oEntity.description = ''; } else { oEntity.description += '<br><br>'; } oEntity.description += `References: <ul>${oEntity.references.join("")}</ul>`; } }
javascript
{ "resource": "" }
q19306
train
function (aMethods) { var fnCreateTypesArr = function (sTypes) { return sTypes.split("|").map(function (sType) { return {value: sType} }); }; var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty]; oProperty.depth = iDepth; // Handle types if (oProperty.type) { oProperty.types = fnCreateTypesArr(oProperty.type); } // Phone name - available only for parameters oProperty.phoneName = [aPhoneName.join("."), oProperty.name].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name])); // Keep file size in check delete oProperty.type; }); // Keep file size in check delete oParameter.parameterProperties; } }; aMethods.forEach(function (oMethod) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (oMethod.parameters) { oMethod.parameters.forEach(function (oParameter) { if (oParameter.type) { oParameter.types = fnCreateTypesArr(oParameter.type); } // Keep file size in check delete oParameter.type; // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data oMethod.parameters = aParameters; } // Handle return values if (oMethod.returnValue && oMethod.returnValue.type) { // Handle types oMethod.returnValue.types = fnCreateTypesArr(oMethod.returnValue.type); } }); }
javascript
{ "resource": "" }
q19307
train
function (aEvents) { var fnExtractParameterProperties = function (oParameter, aParameters, iDepth, aPhoneName) { if (oParameter.parameterProperties) { Object.keys(oParameter.parameterProperties).forEach(function (sProperty) { var oProperty = oParameter.parameterProperties[sProperty], sPhoneTypeSuffix; oProperty.depth = iDepth; // Phone name - available only for parameters sPhoneTypeSuffix = oProperty.type === "array" ? "[]" : ""; oProperty.phoneName = [aPhoneName.join("."), (oProperty.name + sPhoneTypeSuffix)].join("."); // Add property to parameter array as we need a simple structure aParameters.push(oProperty); // Handle child parameterProperties fnExtractParameterProperties(oProperty, aParameters, (iDepth + 1), aPhoneName.concat([oProperty.name + sPhoneTypeSuffix])); }); // Keep file size in check delete oParameter.parameterProperties; } }; aEvents.forEach(function (aEvents) { // New array to hold modified parameters var aParameters = []; // Handle parameters if (aEvents.parameters) { aEvents.parameters.forEach(function (oParameter) { // Add the parameter before the properties aParameters.push(oParameter); // Handle Parameter Properties // Note: We flatten the structure fnExtractParameterProperties(oParameter, aParameters, 1, [oParameter.name]); }); // Override the old data aEvents.parameters = aParameters; } }); }
javascript
{ "resource": "" }
q19308
train
function (aParameters) { // New array to hold modified parameters var aNodes = [], processNode = function (oNode, sPhoneName, iDepth, aNodes) { // Handle phone name oNode.phoneName = sPhoneName ? [sPhoneName, oNode.name].join(".") : oNode.name; // Depth oNode.depth = iDepth; // Add to array aNodes.push(oNode); // Handle nesting if (oNode.parameterProperties) { Object.keys(oNode.parameterProperties).forEach(function (sNode) { processNode(oNode.parameterProperties[sNode], oNode.phoneName, (iDepth + 1), aNodes); }); } delete oNode.parameterProperties; }; aParameters.forEach(function (oParameter) { // Handle Parameter Properties // Note: We flatten the structure processNode(oParameter, undefined, 0, aNodes); }); return aNodes; }
javascript
{ "resource": "" }
q19309
train
function (oNode) { // if there are subnodes added to the current node -> traverse them first (added nodes are at the top, before any children) if (oNode.addedSubtrees.length > 0 && !oNode.nodeState.collapsed) { // an added subtree can be either a deep or a flat tree (depending on the addContexts) call for (var j = 0; j < oNode.addedSubtrees.length; j++) { var oSubtreeHandle = oNode.addedSubtrees[j]; fnTraverseAddedSubtree(oNode, oSubtreeHandle); if (oRecursionBreaker.broken) { return; } } } }
javascript
{ "resource": "" }
q19310
train
function (oNode, oSubtreeHandle) { var oSubtree = oSubtreeHandle._getSubtree(); if (oSubtreeHandle) { // subtree is flat if (Array.isArray(oSubtree)) { if (oSubtreeHandle._oSubtreeRoot) { // jump to a certain position in the flat structure and map the nodes fnTraverseFlatSubtree(oSubtree, oSubtreeHandle._oSubtreeRoot.serverIndex, oSubtreeHandle._oSubtreeRoot, oSubtreeHandle._oSubtreeRoot.originalLevel || 0, oNode.level + 1); } else { // newly added nodes fnTraverseFlatSubtree(oSubtree, null, null, 0, oNode.level + 1); } } else { // subtree is deep oSubtreeHandle._oSubtreeRoot.level = oNode.level + 1; fnTraverseDeepSubtree(oSubtreeHandle._oSubtreeRoot, false, oSubtreeHandle._oNewParentNode, -1, oSubtreeHandle._oSubtreeRoot); } } }
javascript
{ "resource": "" }
q19311
train
function (oNode, bIgnore, oParent, iPositionInParent, oIgnoreRemoveForNode) { // ignore node if it was already mapped or is removed (except if it was reinserted, denoted by oIgnoreRemoveForNode) if (!bIgnore) { if (!oNode.nodeState.removed || oIgnoreRemoveForNode == oNode) { fnMap(oNode, oRecursionBreaker, "positionInParent", iPositionInParent, oParent); if (oRecursionBreaker.broken) { return; } } } fnCheckNodeForAddedSubtrees(oNode); if (oRecursionBreaker.broken) { return; } // if the node also has children AND is expanded, dig deeper if (oNode && oNode.children && oNode.nodeState.expanded) { for (var i = 0; i < oNode.children.length; i++) { var oChildNode = oNode.children[i]; // Make sure that the level of all child nodes are adapted to the parent level, // this is necessary if the parent node was placed in a different leveled subtree. // Ignore removed nodes, which are not re-inserted. // Re-inserted deep nodes will be regarded in fnTraverseAddedSubtree. if (oChildNode && !oChildNode.nodeState.removed && !oChildNode.nodeState.reinserted) { oChildNode.level = oNode.level + 1; } // only dive deeper if we have a gap (entry which has to be loaded) or a defined node is NOT removed if (oChildNode && !oChildNode.nodeState.removed) { fnTraverseDeepSubtree(oChildNode, false, oNode, i, oIgnoreRemoveForNode); } else if (!oChildNode) { fnMap(oChildNode, oRecursionBreaker, "positionInParent", i, oNode); } if (oRecursionBreaker.broken) { return; } } } }
javascript
{ "resource": "" }
q19312
train
function (oNode) { if (oNode) { if (oNode.nodeState.selected && !oNode.isArtificial) { aResultContexts.push(oNode.context); } } }
javascript
{ "resource": "" }
q19313
train
function(mode) { if (!mode || (mode !== 'src' && mode !== 'target')) { mode = 'src'; } grunt.option('port', 0); // use random port // listen to the connect server startup grunt.event.on('connect.*.listening', function(hostname, port) { // 0.0.0.0 does not work in windows if (hostname === '0.0.0.0') { hostname = 'localhost'; } // set baseUrl (using hostname / port from connect task) grunt.config(['selenium_qunit', 'options', 'baseUrl'], 'http://' + hostname + ':' + port); // run selenium task grunt.task.run(['selenium_qunit:run']); }); // cleanup and start connect server grunt.task.run([ 'clean:surefire-reports', 'openui5_connect:' + mode ]); }
javascript
{ "resource": "" }
q19314
train
function(id) { var cleared = running[id] != null; if (cleared) { running[id] = null; } return cleared; }
javascript
{ "resource": "" }
q19315
train
function(left, top, animate) { var self = this; var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft; var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop; self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate); }
javascript
{ "resource": "" }
q19316
train
function (vTargets, vData, sTitleTarget) { var oSequencePromise = Promise.resolve(); return this._display(vTargets, vData, sTitleTarget, oSequencePromise); }
javascript
{ "resource": "" }
q19317
train
function (oTargetInfo, vData, oSequencePromise, oTargetCreateInfo) { var sName = oTargetInfo.name, oTarget = this.getTarget(sName); if (oTarget !== undefined) { return oTarget._display(vData, oSequencePromise, oTargetCreateInfo); } else { var sErrorMessage = "The target with the name \"" + sName + "\" does not exist!"; Log.error(sErrorMessage, this); return Promise.resolve({ name: sName, error: sErrorMessage }); } }
javascript
{ "resource": "" }
q19318
initializeLanguage
train
function initializeLanguage(sLanguage, oConfig, resolve) { Log.info( "[UI5 Hyphenation] Initializing third-party module for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation.initialize()" ); window.hyphenopoly.initializeLanguage(oConfig) .then(onLanguageInitialized.bind(this, sLanguage, resolve)); }
javascript
{ "resource": "" }
q19319
onLanguageInitialized
train
function onLanguageInitialized(sLanguage, resolve, hyphenateMethod) { oHyphenateMethods[sLanguage] = hyphenateMethod; oHyphenationInstance.bIsInitialized = true; if (aLanguagesQueue.length > 0) { aLanguagesQueue.forEach(function (oElement) { initializeLanguage(oElement.sLanguage, oElement.oConfig, oElement.resolve); }); aLanguagesQueue = []; } oHyphenationInstance.bLoading = false; resolve( getLanguageFromPattern(sLanguage) ); }
javascript
{ "resource": "" }
q19320
prepareConfig
train
function prepareConfig(sLanguage, oConfig) { //Creating default configuration var oConfigurationForLanguage = { "require": [sLanguage], "hyphen": "\u00AD", "leftmin": 3, // The minimum of chars to remain on the old line. "rightmin": 3,// The minimum of chars to go on the new line "compound": "all", // factory-made -> fac-tory-[ZWSP]made "path": jQuery.sap.getResourcePath("sap/ui/thirdparty/hyphenopoly") }; // we are passing only 3 properties to hyphenopoly: hyphen, exceptions and minWordLength if (oConfig) { if ("hyphen" in oConfig) { oConfigurationForLanguage.hyphen = oConfig.hyphen; } if ("minWordLength" in oConfig) { oConfigurationForLanguage.minWordLength = oConfig.minWordLength; } if ("exceptions" in oConfig) { Log.info( "[UI5 Hyphenation] Add hyphenation exceptions '" + JSON.stringify(oConfig.exceptions) + "' for language " + getLanguageDisplayName(sLanguage), "sap.ui.core.hyphenation.Hyphenation" ); // transform "exceptions: {word1: "w-o-r-d-1", word2: "w-o-r-d-2"}" to "exceptions: {en-us: 'w-o-r-d-1,w-o-r-d-2'}" var aWordsExceptions = []; Object.keys(oConfig.exceptions).forEach(function(sWord) { aWordsExceptions.push(oConfig.exceptions[sWord]); }); if (aWordsExceptions.length > 0) { oConfigurationForLanguage.exceptions = {}; oConfigurationForLanguage.exceptions[sLanguage] = aWordsExceptions.join(", "); } } } return oConfigurationForLanguage; }
javascript
{ "resource": "" }
q19321
getLanguage
train
function getLanguage(sLang) { var oLocale; if (sLang) { oLocale = new Locale(sLang); } else { oLocale = sap.ui.getCore().getConfiguration().getLocale(); } var sLanguage = oLocale.getLanguage().toLowerCase(); // adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files) switch (sLanguage) { case "en": sLanguage = "en-us"; break; case "nb": sLanguage = "nb-no"; break; case "no": sLanguage = "nb-no"; break; case "el": sLanguage = "el-monoton"; break; } return sLanguage; }
javascript
{ "resource": "" }
q19322
getLanguageDisplayName
train
function getLanguageDisplayName(sPatternName) { var sLang = getLanguageFromPattern(sPatternName); if (mLanguageNamesInEnglish.hasOwnProperty(sLang)) { return "'" + mLanguageNamesInEnglish[sLang] + "' (code:'" + sLang + "')"; } else { return "'" + sLang + "'"; } }
javascript
{ "resource": "" }
q19323
line
train
function line(buffer, right, border, label, content) { buffer.push("<tr class='sapUiSelectable'><td class='sapUiSupportTechInfoBorder sapUiSelectable'><label class='sapUiSupportLabel sapUiSelectable'>", encodeXML(label), "</label><br>"); var ctnt = content; if (jQuery.isFunction(content)) { ctnt = content(buffer) || ""; } buffer.push(encodeXML(ctnt)); buffer.push("</td></tr>"); }
javascript
{ "resource": "" }
q19324
setupDialog
train
function setupDialog() { // setup e2e values as log level and content if (dialog.traceXml) { dialog.$(e2eTraceConst.taContent).text(dialog.traceXml); } if (dialog.e2eLogLevel) { dialog.$(e2eTraceConst.selLevel).val(dialog.e2eLogLevel); } fillPanelContent(controlIDs.dvLoadedModules, oData.modules); // bind button Start event dialog.$(e2eTraceConst.btnStart).one("tap", function () { dialog.e2eLogLevel = dialog.$(e2eTraceConst.selLevel).val(); dialog.$(e2eTraceConst.btnStart).addClass("sapUiSupportRunningTrace").text("Running..."); dialog.traceXml = ""; dialog.$(e2eTraceConst.taContent).text(""); sap.ui.core.support.trace.E2eTraceLib.start(dialog.e2eLogLevel, function (traceXml) { dialog.traceXml = traceXml; }); // show info message about the E2E trace activation sap.m.MessageToast.show(e2eTraceConst.infoText, {duration: e2eTraceConst.infoDuration}); //close the dialog, but keep it for later use dialog.close(); }); }
javascript
{ "resource": "" }
q19325
getDialog
train
function getDialog() { if (dialog) { return dialog; } var Dialog = sap.ui.requireSync("sap/m/Dialog"); var Button = sap.ui.requireSync("sap/m/Button"); sap.ui.requireSync("sap/ui/core/HTML"); sap.ui.requireSync("sap/m/MessageToast"); sap.ui.requireSync("sap/ui/core/support/trace/E2eTraceLib"); dialog = new Dialog({ title: "Technical Information", horizontalScrolling: true, verticalScrolling: true, stretch: Device.system.phone, buttons: [ new Button({ text: "Close", press: function () { dialog.close(); } }) ], afterOpen: function () { Support.off(); }, afterClose: function () { Support.on(); } }).addStyleClass("sapMSupport"); return dialog; }
javascript
{ "resource": "" }
q19326
onTouchStart
train
function onTouchStart(oEvent) { if (oEvent.touches) { var currentTouches = oEvent.touches.length; if (Device.browser.mobile && (Device.browser.name === Device.browser.BROWSER.INTERNET_EXPLORER ||// TODO remove after 1.62 version Device.browser.name === Device.browser.BROWSER.EDGE)) { windowsPhoneTouches = currentTouches; } if (currentTouches > maxFingersAllowed) { document.removeEventListener('touchend', onTouchEnd); return; } switch (currentTouches) { case holdFingersNumber: startTime = Date.now(); document.addEventListener('touchend', onTouchEnd); break; case maxFingersAllowed: if (startTime) { timeDiff = Date.now() - startTime; lastTouchUID = oEvent.touches[currentTouches - 1].identifier; } break; } } }
javascript
{ "resource": "" }
q19327
createExtendedRenderer
train
function createExtendedRenderer(sName, oRendererInfo) { assert(this != null, 'BaseRenderer must be a non-null object'); assert(typeof sName === 'string' && sName, 'Renderer.extend must be called with a non-empty name for the new renderer'); assert(oRendererInfo == null || (isPlainObject(oRendererInfo) && Object.keys(oRendererInfo).every(function(key) { return oRendererInfo[key] !== undefined; })), 'oRendererInfo can be omitted or must be a plain object without any undefined property values'); var oChildRenderer = Object.create(this); // subclasses should expose the modern signature variant only oChildRenderer.extend = createExtendedRenderer; jQuery.extend(oChildRenderer, oRendererInfo); // expose the renderer globally ObjectPath.set(sName, oChildRenderer); return oChildRenderer; }
javascript
{ "resource": "" }
q19328
nextFallbackLocale
train
function nextFallbackLocale(sLocale) { // there is no fallback for the 'raw' locale or for null/undefined if ( !sLocale ) { return null; } // special (legacy) handling for zh_HK: try zh_TW (for Traditional Chinese) first before falling back to 'zh' if ( sLocale === "zh_HK" ) { return "zh_TW"; } // if there are multiple segments (separated by underscores), remove the last one var p = sLocale.lastIndexOf('_'); if ( p >= 0 ) { return sLocale.slice(0,p); } // invariant: only a single segment, must be a language // for any language but 'en', fallback to 'en' first before falling back to the 'raw' language (empty string) return sLocale !== 'en' ? 'en' : ''; }
javascript
{ "resource": "" }
q19329
splitUrl
train
function splitUrl(sUrl) { var m = rUrl.exec(sUrl); if ( !m || A_VALID_FILE_TYPES.indexOf( m[2] ) < 0 ) { throw new Error("resource URL '" + sUrl + "' has unknown type (should be one of " + A_VALID_FILE_TYPES.join(",") + ")"); } return { url : sUrl, prefix : m[1], ext : m[2], query: m[4], hash: (m[5] || ""), suffix : m[2] + (m[3] || "") }; }
javascript
{ "resource": "" }
q19330
_isComplexType
train
function _isComplexType (mProperty) { if (mProperty && mProperty.type) { if (mProperty.type.toLowerCase().indexOf("edm") !== 0) { return true; } } return false; }
javascript
{ "resource": "" }
q19331
_getODataPropertiesOfModel
train
function _getODataPropertiesOfModel(oElement, sAggregationName) { var oModel = oElement.getModel(); var mData = { property: [], navigationProperty: [], navigationEntityNames: [] }; if (oModel) { var sModelName = oModel.getMetadata().getName(); if (sModelName === "sap.ui.model.odata.ODataModel" || sModelName === "sap.ui.model.odata.v2.ODataModel") { var oMetaModel = oModel.getMetaModel(); return oMetaModel.loaded().then(function(){ var sBindingContextPath = _getBindingPath(oElement, sAggregationName); if (sBindingContextPath) { var oMetaModelContext = oMetaModel.getMetaContext(sBindingContextPath); var mODataEntity = oMetaModelContext.getObject(); var oDefaultAggregation = oElement.getMetadata().getAggregation(); if (oDefaultAggregation) { var oBinding = oElement.getBindingInfo(oDefaultAggregation.name); var oTemplate = oBinding && oBinding.template; if (oTemplate) { var sPath = oElement.getBindingPath(oDefaultAggregation.name); var oODataAssociationEnd = oMetaModel.getODataAssociationEnd(mODataEntity, sPath); var sFullyQualifiedEntityName = oODataAssociationEnd && oODataAssociationEnd.type; if (sFullyQualifiedEntityName) { var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); mODataEntity = oEntityType; } } } mData.property = mODataEntity.property || []; mData.property = _expandComplexProperties(mData.property, oMetaModel, mODataEntity); mData.property = _filterInvisibleProperties(mData.property, oElement, sAggregationName); if (mODataEntity.navigationProperty){ mData.navigationProperty = mODataEntity.navigationProperty; mODataEntity.navigationProperty.forEach(function(oNavProp){ var sFullyQualifiedEntityName = ( oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name) && oMetaModel.getODataAssociationEnd(mODataEntity, oNavProp.name).type ); var oEntityType = oMetaModel.getODataEntityType(sFullyQualifiedEntityName); if (oEntityType && oEntityType.name){ if (mData.navigationEntityNames.indexOf(oEntityType.name) === -1){ mData.navigationEntityNames.push(oEntityType.name); } } }); } } return mData; }); } } return Promise.resolve(mData); }
javascript
{ "resource": "" }
q19332
_checkForDuplicateLabels
train
function _checkForDuplicateLabels(oInvisibleElement, aODataProperties) { return aODataProperties.some(function(oDataProperty) { return oDataProperty.fieldLabel === oInvisibleElement.fieldLabel; }); }
javascript
{ "resource": "" }
q19333
_hasNavigationBindings
train
function _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) { var bNavigationInBindingPath = _hasBindings(aBindingPaths) && aBindingPaths.some(function (sPath) { var aParts = sPath.trim().replace(/^\//gi, '').split('/'); if (aParts.length > 1) { return aNavigationProperties.indexOf(aParts.shift()) !== -1; } }); // BindingContextPath : "/SEPMRA_C_PD_Supplier('100000001')" // NavigationEntityName : "SEPMRA_C_PD_Supplier" var bNavigationInEntity = aBindingContextPaths.some(function(sContextPath){ sContextPath = sContextPath.match(/^\/?([A-Za-z0-9_]+)/)[0]; return (aNavigationEntityNames.indexOf(sContextPath) >= 0); }); return bNavigationInBindingPath || bNavigationInEntity; }
javascript
{ "resource": "" }
q19334
_findODataProperty
train
function _findODataProperty(aBindingPaths, aODataProperties) { return aODataProperties.filter(function (oDataProperty) { return aBindingPaths.indexOf(oDataProperty.bindingPath) !== -1; }).pop(); }
javascript
{ "resource": "" }
q19335
_enhanceInvisibleElement
train
function _enhanceInvisibleElement(oInvisibleElement, mODataOrCustomItem) { // mODataOrCustomItem.fieldLabel - oData, mODataOrCustomItem.label - custom oInvisibleElement.originalLabel = mODataOrCustomItem.fieldLabel || mODataOrCustomItem.label; // mODataOrCustomItem.quickInfo - oData, mODataOrCustomItem.tooltip - custom oInvisibleElement.quickInfo = mODataOrCustomItem.quickInfo || mODataOrCustomItem.tooltip; // mODataOrCustomItem.name - oData oInvisibleElement.name = mODataOrCustomItem.name; // oInvisibleElement.fieldLabel has the current label if (oInvisibleElement.fieldLabel !== oInvisibleElement.originalLabel) { oInvisibleElement.renamedLabel = true; } if (mODataOrCustomItem.referencedComplexPropertyName) { oInvisibleElement.referencedComplexPropertyName = mODataOrCustomItem.referencedComplexPropertyName; } }
javascript
{ "resource": "" }
q19336
_checkAndEnhanceODataProperty
train
function _checkAndEnhanceODataProperty(oInvisibleElement, aODataProperties, aNavigationProperties, aNavigationEntityNames, mBindingPaths) { var aBindingPaths = mBindingPaths.bindingPaths, aBindingContextPaths = mBindingPaths.bindingContextPaths, mODataProperty; return ( // include it if the field has no bindings (bindings can be added in runtime) !_hasBindings(aBindingPaths) // include it if some properties got binding through valid navigations of the current Model || _hasNavigationBindings(aBindingPaths, aNavigationProperties, aNavigationEntityNames, aBindingContextPaths) // looking for a corresponding OData property, if it exists oInvisibleElement is being enhanced // with extra data from it || ( (mODataProperty = _findODataProperty(aBindingPaths, aODataProperties)) && (_enhanceInvisibleElement(oInvisibleElement, mODataProperty) || true) ) ); }
javascript
{ "resource": "" }
q19337
train
function(oElement, mActions){ var oModel = oElement.getModel(); var mRevealData = mActions.reveal; var mAddODataProperty = mActions.addODataProperty; var mCustom = mActions.custom; var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mActions.aggregation; return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aODataNavigationProperties = mData.navigationProperty.map(function (mNavigation) { return mNavigation.name; }); var aODataNavigationEntityNames = mData.navigationEntityNames; aODataProperties = _checkForComplexDuplicates(aODataProperties); var aAllElementData = []; var aInvisibleElements = mRevealData.elements || []; aInvisibleElements.forEach(function(mInvisibleElement) { var oInvisibleElement = mInvisibleElement.element; var mAction = mInvisibleElement.action; var bIncludeElement = true; var mBindingPathCollection = {}; oInvisibleElement.fieldLabel = ElementUtil.getLabelForElement(oInvisibleElement, mAction.getLabel); // BCP: 1880498671 if (mAddODataProperty) { if (_getBindingPath(oElement, sAggregationName) === _getBindingPath(oInvisibleElement, sAggregationName)) { //TODO fix with stashed type support mBindingPathCollection = BindingsExtractor.collectBindingPaths(oInvisibleElement, oModel); oInvisibleElement.duplicateComplexName = _checkForDuplicateLabels(oInvisibleElement, aODataProperties); //Add information from the oDataProperty to the InvisibleProperty if available; //if oData is available and the element is not present in it, do not include it //Example use case: custom field which was hidden and then removed from system //should not be available for adding after the removal if (aODataProperties.length > 0){ bIncludeElement = _checkAndEnhanceODataProperty( oInvisibleElement, aODataProperties, aODataNavigationProperties, aODataNavigationEntityNames, mBindingPathCollection); } } else if (BindingsExtractor.getBindings(oInvisibleElement, oModel).length > 0) { bIncludeElement = false; } } if (mCustom && bIncludeElement) { mCustom.items.forEach(function(oCustomItem) { _assignCustomItemIds(oElement.getParent().getId(), oCustomItem); if (oCustomItem.itemId === oInvisibleElement.getId()) { _enhanceInvisibleElement(oInvisibleElement, oCustomItem); } }); } if (bIncludeElement) { aAllElementData.push({ element : oInvisibleElement, action : mAction, bindingPathCollection: mBindingPathCollection }); } }); return aAllElementData; }) .then(function(aAllElementData) { return aAllElementData.map(_elementToAdditionalElementInfo); }); }
javascript
{ "resource": "" }
q19338
train
function (oElement, mAction) { var oDefaultAggregation = oElement.getMetadata().getAggregation(); var sAggregationName = oDefaultAggregation ? oDefaultAggregation.name : mAction.action.aggregation; var oModel = oElement.getModel(); return Promise.resolve() .then(function () { return _getODataPropertiesOfModel(oElement, sAggregationName); }) .then(function(mData) { var aODataProperties = mData.property; var aRelevantElements = _getRelevantElements(oElement, mAction.relevantContainer, sAggregationName); var aBindings = []; aRelevantElements.forEach(function(oElement){ aBindings = aBindings.concat(BindingsExtractor.getBindings(oElement, oModel)); }); var fnFilter = mAction.action.filter ? mAction.action.filter : function() {return true;}; aODataProperties = aODataProperties.filter(function(oDataProperty) { var bHasBindingPath = false; if (aBindings){ bHasBindingPath = aBindings.some(function(vBinding) { return ( jQuery.isPlainObject(vBinding) ? vBinding.parts[0].path : !!vBinding.getPath && vBinding.getPath() ) === oDataProperty.bindingPath; }); } return !bHasBindingPath && fnFilter(mAction.relevantContainer, oDataProperty); }); aODataProperties = _checkForComplexDuplicates(aODataProperties); return aODataProperties; }) .then(function(aUnboundODataProperties) { return aUnboundODataProperties.map(_oDataPropertyToAdditionalElementInfo); }); }
javascript
{ "resource": "" }
q19339
train
function( prop ) { if ( !prop ) { return; } return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); }
javascript
{ "resource": "" }
q19340
validStyle
train
function validStyle( prop, value, check_vend ) { var div = document.createElement( 'div' ), uc = function( txt ) { return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 ); }, vend_pref = function( vend ) { if( vend === "" ) { return ""; } else { return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-"; } }, check_style = function( vend ) { var vend_prop = vend_pref( vend ) + prop + ": " + value + ";", uc_vend = uc( vend ), propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) ); div.setAttribute( "style", vend_prop ); if ( !!div.style[ propStyle ] ) { ret = true; } }, check_vends = check_vend ? check_vend : vendors, ret; for( var i = 0; i < check_vends.length; i++ ) { check_style( check_vends[i] ); } return !!ret; }
javascript
{ "resource": "" }
q19341
handler
train
function handler() { // Get the current orientation. var orientation = get_orientation(); if ( orientation !== last_orientation ) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger( event_name ); } }
javascript
{ "resource": "" }
q19342
train
function( event ) { // SAP MODIFICATION: if jQuery event is created programatically there's no originalEvent property. Therefore the existence of event.originalEvent needs to be checked. var data = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; return { time: ( new Date() ).getTime(), coords: [ data.pageX, data.pageY ], origin: $( event.target ) }; }
javascript
{ "resource": "" }
q19343
stopHandler
train
function stopHandler( event ) { $this.unbind( touchMoveEvent, moveHandler ) .unbind( touchStopEvent, stopHandler ); if ( start && stop ) { $.event.special.swipe.handleSwipe( start, stop ); } start = stop = undefined; }
javascript
{ "resource": "" }
q19344
parseDecimal
train
function parseDecimal(sValue) { var aMatches; if (typeof sValue !== "string") { return undefined; } aMatches = rDecimal.exec(sValue); if (!aMatches) { return undefined; } return { sign: aMatches[1] === "-" ? -1 : 1, integerLength: aMatches[2].length, // remove trailing decimal zeroes and poss. the point afterwards abs: aMatches[2] + aMatches[3].replace(rTrailingZeroes, "") .replace(rTrailingDecimal, "") }; }
javascript
{ "resource": "" }
q19345
decimalCompare
train
function decimalCompare(sValue1, sValue2) { var oDecimal1, oDecimal2, iResult; if (sValue1 === sValue2) { return 0; } oDecimal1 = parseDecimal(sValue1); oDecimal2 = parseDecimal(sValue2); if (!oDecimal1 || !oDecimal2) { return NaN; } if (oDecimal1.sign !== oDecimal2.sign) { return oDecimal1.sign > oDecimal2.sign ? 1 : -1; } // So they have the same sign. // If the number of integer digits equals, we can simply compare the strings iResult = simpleCompare(oDecimal1.integerLength, oDecimal2.integerLength) || simpleCompare(oDecimal1.abs, oDecimal2.abs); return oDecimal1.sign * iResult; }
javascript
{ "resource": "" }
q19346
train
function(sId) { var sNamespace = this.getMetadata().getNamespace(); sId = sNamespace + "." + sId; return this.base ? this.base.byId(sId) : undefined; }
javascript
{ "resource": "" }
q19347
train
function() { var mMethods = {}; var oMetadata = this.getMetadata(); var aPublicMethods = oMetadata.getAllPublicMethods(); aPublicMethods.forEach(function(sMethod) { var fnFunction = this[sMethod]; if (typeof fnFunction === 'function') { mMethods[sMethod] = function() { var tmp = fnFunction.apply(this, arguments); return (tmp instanceof ControllerExtension) ? tmp.getInterface() : tmp; }.bind(this); } //} }.bind(this)); this.getInterface = function() { return mMethods; }; return mMethods; }
javascript
{ "resource": "" }
q19348
Version
train
function Version(versionStr) { var match = rVersion.exec(versionStr) || []; function norm(v) { v = parseInt(v); return isNaN(v) ? 0 : v; } Object.defineProperty(this, "major", { enumerable: true, value: norm(match[0]) }); Object.defineProperty(this, "minor", { enumerable: true, value: norm(match[1]) }); Object.defineProperty(this, "patch", { enumerable: true, value: norm(match[2]) }); Object.defineProperty(this, "suffix", { enumerable: true, value: String(match[3] || "") }); }
javascript
{ "resource": "" }
q19349
getConstructorDescription
train
function getConstructorDescription(symbol) { var description = symbol.description; var tags = symbol.tags; if ( tags ) { for (var i = 0; i < tags.length; i++) { if ( tags[i].title === "ui5-settings" && tags[i].text) { description += "\n</p><p>\n" + tags[i].text; break; } } } return description; }
javascript
{ "resource": "" }
q19350
toPersian
train
function toPersian(oGregorian) { var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day); return d2j(iJulianDayNumber); }
javascript
{ "resource": "" }
q19351
toGregorian
train
function toGregorian(oPersian) { var iJulianDayNumber = j2d(oPersian.year, oPersian.month + 1, oPersian.day); return d2g(iJulianDayNumber); }
javascript
{ "resource": "" }
q19352
createDemoAppData
train
function createDemoAppData(oDemoAppMetadata, sLibUrl, sLibNamespace) { // transform simple demo app link to a configuration object var aLinks = []; // transform link object to a bindable array of objects if (jQuery.isPlainObject(oDemoAppMetadata.links)) { aLinks = Object.keys(oDemoAppMetadata.links).map(function (sKey) { return { name: sKey, ref: oDemoAppMetadata.links[sKey] }; }); } var oApp = { lib : oDemoAppMetadata.namespace || sLibNamespace, name : oDemoAppMetadata.text, icon : oDemoAppMetadata.icon, desc : oDemoAppMetadata.desc, config : oDemoAppMetadata.config, teaser : oDemoAppMetadata.teaser, category : oDemoAppMetadata.category, ref : (oDemoAppMetadata.resolve === "lib" ? sLibUrl : "") + oDemoAppMetadata.ref, links : aLinks }; return oApp; }
javascript
{ "resource": "" }
q19353
train
function(oPosition) { var oPos = oPosition.getComputedPosition(); var addStyle = function(oPosition, aBuffer, sPos, sVal){ if (sVal) { aBuffer.push(sPos + ":" + sVal + ";"); } }; var aBuffer = []; addStyle(oPosition, aBuffer, "top", oPos.top); addStyle(oPosition, aBuffer, "bottom", oPos.bottom); addStyle(oPosition, aBuffer, "left", oPos.left); addStyle(oPosition, aBuffer, "right", oPos.right); addStyle(oPosition, aBuffer, "width", oPos.width); addStyle(oPosition, aBuffer, "height", oPos.height); return aBuffer.join(""); }
javascript
{ "resource": "" }
q19354
logUnsupportedPropertyInSelect
train
function logUnsupportedPropertyInSelect(sPath, sSelectedProperty, oDimensionOrMeasure) { var sDimensionOrMeasure = oDimensionOrMeasure instanceof sap.ui.model.analytics.odata4analytics.Dimension ? "dimension" : "measure"; if (oDimensionOrMeasure.getName() === sSelectedProperty) { oLogger.warning("Ignored the 'select' binding parameter, because it contains" + " the " + sDimensionOrMeasure + " property '" + sSelectedProperty + "' which is not contained in the analytical info (see updateAnalyticalInfo)", sPath); } else { oLogger.warning("Ignored the 'select' binding parameter, because the property '" + sSelectedProperty + "' is associated with the " + sDimensionOrMeasure + " property '" + oDimensionOrMeasure.getName() + "' which is not contained in the analytical" + " info (see updateAnalyticalInfo)", sPath); } }
javascript
{ "resource": "" }
q19355
trimAndCheckForDuplicates
train
function trimAndCheckForDuplicates(aSelect, sPath) { var sCurrentProperty, bError = false, i, n; // replace all white-spaces before and after the value for (i = 0, n = aSelect.length; i < n; i++) { aSelect[i] = aSelect[i].trim(); } // check for duplicate entries and remove from list for (i = aSelect.length - 1; i >= 0; i--) { sCurrentProperty = aSelect[i]; if (aSelect.indexOf(sCurrentProperty) !== i) { // found duplicate oLogger.warning("Ignored the 'select' binding parameter, because it" + " contains the property '" + sCurrentProperty + "' multiple times", sPath); aSelect.splice(i, 1); bError = true; } } return bError; }
javascript
{ "resource": "" }
q19356
train
function(sGroupId, iAutoExpandGroupsToLevel, iStartIndex, iLength) { var iLevel = that._getGroupIdLevel(sGroupId); if (iLevel == iAutoExpandGroupsToLevel) { var aContext = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLastLoadedIndex = iStartIndex + aContext.length - 1; if (aContext.length >= iLength) { return oNO_MISSING_MEMBER; } else if (that.mFinalLength[sGroupId]) { if (aContext.length >= that.mLength[sGroupId]) { return { groupId_Missing: null, length_Missing: iLength - aContext.length }; // group completely loaded, but some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex + 1, length_Missing: iLength - aContext.length }; // loading must start here } } // deepest expansion level not yet reached, so traverse groups in depth-first order var aContext2 = that._getLoadedContextsForGroup(sGroupId, iStartIndex, iLength); var iLength_Missing = iLength, iLastLoadedIndex2 = iStartIndex + aContext2.length - 1; for (var i = -1, oContext; (oContext = aContext2[++i]) !== undefined; ) { iLength_Missing--; // count the current context var oGroupExpansionFirstMember = calculateRequiredSubGroupExpansion(that._getGroupIdFromContext(oContext, iLevel + 1), iAutoExpandGroupsToLevel, 0, iLength_Missing); if (oGroupExpansionFirstMember.groupId_Missing == null) { if (oGroupExpansionFirstMember.length_Missing == 0) { return oGroupExpansionFirstMember; // finished - everything is loaded } else { iLength_Missing = oGroupExpansionFirstMember.length_Missing; } } else { return oGroupExpansionFirstMember; // loading must start here } if (iLength_Missing == 0) { break; } } if (that.mFinalLength[sGroupId] || iLength_Missing == 0) { return { groupId_Missing: null, length_Missing: iLength_Missing }; // group completely loaded; maybe some members are still missing } else { return { groupId_Missing: sGroupId, startIndex_Missing: iLastLoadedIndex2 + 1, length_Missing: iLength_Missing }; // loading must start here } }
javascript
{ "resource": "" }
q19357
train
function(sType, oEvent) { if (!bHandleEvent) { return; } // we need mapping of the different event types to get the correct target var oMappedEvent = oEvent.type == "touchend" ? oEvent.changedTouches[0] : oEvent.touches[0]; // create the synthetic event var newEvent = oDocument.createEvent('MouseEvent'); // trying to create an actual TouchEvent will create an error newEvent.initMouseEvent(sType, true, true, window, oEvent.detail, oMappedEvent.screenX, oMappedEvent.screenY, oMappedEvent.clientX, oMappedEvent.clientY, oEvent.ctrlKey, oEvent.shiftKey, oEvent.altKey, oEvent.metaKey, oEvent.button, oEvent.relatedTarget); newEvent.isSynthetic = true; // Timeout needed. Do not interrupt the native event handling. window.setTimeout(function() { oTarget.dispatchEvent(newEvent); }, 0); }
javascript
{ "resource": "" }
q19358
train
function(oEvent) { var oTouches = oEvent.touches, oTouch; bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent)); bIsMoved = false; if (bHandleEvent) { oTouch = oTouches[0]; // As we are only interested in the first touch target, we remember it oTarget = oTouch.target; if (oTarget.nodeType === 3) { // no text node oTarget = oTarget.parentNode; } // Remember the start position of the first touch to determine if a click was performed or not. iStartX = oTouch.clientX; iStartY = oTouch.clientY; fireMouseEvent("mousedown", oEvent); } }
javascript
{ "resource": "" }
q19359
train
function(oEvent) { var oTouch; if (bHandleEvent) { oTouch = oEvent.touches[0]; // Check if the finger is moved. When the finger was moved, no "click" event is fired. if (Math.abs(oTouch.clientX - iStartX) > 10 || Math.abs(oTouch.clientY - iStartY) > 10) { bIsMoved = true; } if (bIsMoved) { // Fire "mousemove" event only when the finger was moved. This is to prevent unwanted movements. fireMouseEvent("mousemove", oEvent); } } }
javascript
{ "resource": "" }
q19360
train
function() { var aVariantManagementReferences = Object.keys(this.oData); aVariantManagementReferences.forEach(function(sVariantManagementReference) { var mPropertyBag = { variantManagementReference: sVariantManagementReference, currentVariantReference: this.oData[sVariantManagementReference].currentVariant || this.oData[sVariantManagementReference].defaultVariant , newVariantReference: true // since new variant is not known - true will lead to no new changes for variant switch }; var mChangesToBeSwitched = this.oChangePersistence.loadSwitchChangesMapForComponent(mPropertyBag); this._oVariantSwitchPromise = this._oVariantSwitchPromise .then(this.oFlexController.revertChangesOnControl.bind(this.oFlexController, mChangesToBeSwitched.changesToBeReverted, this.oAppComponent)) .then(function() { delete this.oData[sVariantManagementReference]; delete this.oVariantController.getChangeFileContent()[sVariantManagementReference]; this._ensureStandardVariantExists(sVariantManagementReference); }.bind(this)); }.bind(this)); //re-initialize hash register and remove existing parameters VariantUtil.initializeHashRegister.call(this); this.updateHasherEntry({ parameters: [] }); return this._oVariantSwitchPromise; }
javascript
{ "resource": "" }
q19361
getReportHtml
train
function getReportHtml(oData) { return getResources().then(function () { var styles = [], scripts = [], html = '', i, template = {}, reportContext = {}; for (i = 0; i < arguments.length; i++) { switch (arguments[i].type) { case 'template': html = arguments[i].content; break; case 'css': styles.push(arguments[i].content); break; case 'js': scripts.push(arguments[i].content); break; } } template = Handlebars.compile(html); reportContext = { technicalInfo: oData.technical, issues: oData.issues, appInfo: oData.application, rules: oData.rules, rulePreset: oData.rulePreset, metadata: { title: oData.name + ' Analysis Results', title_TechnicalInfo: 'Technical Information', title_Issues: 'Issues', title_AppInfo: 'Application Information', title_SelectedRules: 'Available and (<span class="checked"></span>) Selected Rules', timestamp: new Date(), scope: oData.scope, analysisDuration: oData.analysisDuration, analysisDurationTitle: oData.analysisDurationTitle, styles: styles, scripts: scripts } }; return template(reportContext); }); }
javascript
{ "resource": "" }
q19362
downloadReportZip
train
function downloadReportZip(oData) { this.getReportHtml(oData).done(function (html) { var report = '<!DOCTYPE HTML><html><head><title>Report</title></head><body><div id="sap-report-content">' + html + '</div></body></html>'; var issues = { 'issues': oData.issues }; var appInfos = { 'appInfos': oData.application }; var technicalInfo = { 'technicalInfo': oData.technical }; var archiver = new Archiver(); archiver.add('technicalInfo.json', technicalInfo, 'json'); archiver.add('issues.json', issues, 'json'); archiver.add('appInfos.json', appInfos, 'json'); archiver.add('report.html', report); archiver.add('abap.json', oData.abap, 'json'); archiver.download("SupportAssistantReport"); archiver.clear(); }); }
javascript
{ "resource": "" }
q19363
openReport
train
function openReport(oData) { // Create a hidden anchor. Open window outside of the promise otherwise browsers blocks the window.open. var content = ''; var a = jQuery('<a style="display: none;"/>'); a.on('click', function () { var reportWindow = window.open('', '_blank'); jQuery(reportWindow.document).ready(function () { // Sometimes document.write overwrites the document html and sometimes it appends to it so we need a wrapper div. if (reportWindow.document.getElementById('sap-report-content')) { reportWindow.document.getElementById('sap-report-content').innerHtml = content; } else { reportWindow.document.write('<div id="sap-report-content">' + content + '</div>'); } reportWindow.document.title = 'Report'; }); }); jQuery('body').append(a); this.getReportHtml(oData).then(function (html) { content = html; a[0].click(); a.remove(); }); }
javascript
{ "resource": "" }
q19364
train
function(oHandle) { var that = this, $this = jQuery(this), oAdditionalConfig = { domRef: that, eventName: sSimEventName, sapEventName: sSapSimEventName, eventHandle: oHandle }; var fnHandlerWrapper = function(oEvent) { fnHandler(oEvent, oAdditionalConfig); }; oHandle.__sapSimulatedEventHandler = fnHandlerWrapper; for (var i = 0; i < aOrigEvents.length; i++) { $this.on(aOrigEvents[i], fnHandlerWrapper); } }
javascript
{ "resource": "" }
q19365
train
function(oHandle) { var $this = jQuery(this); var fnHandler = oHandle.__sapSimulatedEventHandler; $this.removeData(sHandlerKey + oHandle.guid); for (var i = 0; i < aOrigEvents.length; i++) { jQuery.event.remove(this, aOrigEvents[i], fnHandler); } }
javascript
{ "resource": "" }
q19366
train
function () { var oCore = sap.ui.getCore(); var oAlreadyLoadedLibraries = oCore.getLoadedLibraries(); var aPromises = []; jQuery.each(oAlreadyLoadedLibraries, function (sLibraryName, oLibrary) { if (oLibrary.extensions && oLibrary.extensions.flChangeHandlers) { aPromises.push(this._registerFlexChangeHandlers(oLibrary.extensions.flChangeHandlers)); } }.bind(this)); oCore.attachLibraryChanged(this._handleLibraryRegistrationAfterFlexLibraryIsLoaded.bind(this)); return Promise.all(aPromises); }
javascript
{ "resource": "" }
q19367
URLWhitelistEntry
train
function URLWhitelistEntry(protocol, host, port, path){ if (protocol) { this.protocol = protocol.toUpperCase(); } if (host) { this.host = host.toUpperCase(); } this.port = port; this.path = path; }
javascript
{ "resource": "" }
q19368
train
function (aButtons) { var iButtonsEnabled = this._getNumberOfEnabledButtons(aButtons); if (iButtonsEnabled !== 0) { this._hideDisabledButtons(aButtons); } this._iButtonsVisible = this._hideButtonsInOverflow(aButtons); if (this._iButtonsVisible === this.getMaxButtonsDisplayed() && this._iButtonsVisible !== aButtons.length) { this._replaceLastVisibleButtonWithOverflowButton(aButtons); } else if (iButtonsEnabled < aButtons.length - 1 && iButtonsEnabled !== 0) { this.addOverflowButton(); } iButtonsEnabled = null; }
javascript
{ "resource": "" }
q19369
train
function (aButtons) { this._iFirstVisibleButtonIndex = 0; aButtons.forEach(function (oButton) { oButton.setVisible(true); oButton._bInOverflow = true; }); }
javascript
{ "resource": "" }
q19370
train
function (aButtons) { var iButtonsEnabled = 0; for (var i = 0; i < aButtons.length; i++) { if (aButtons[i].getEnabled()) { iButtonsEnabled++; if (!this._iFirstVisibleButtonIndex) { this._iFirstVisibleButtonIndex = i; } } } return iButtonsEnabled; }
javascript
{ "resource": "" }
q19371
train
function (aButtons) { var iVisibleButtons = 0; aButtons.forEach(function (oButton) { oButton.setVisible(oButton.getEnabled()); if (oButton.getEnabled()) { iVisibleButtons++; } }); return iVisibleButtons; }
javascript
{ "resource": "" }
q19372
train
function (aButtons) { var iVisibleButtons = 0; for (var i = 0; i < aButtons.length; i++) { if (iVisibleButtons < this.getMaxButtonsDisplayed() && aButtons[i].getVisible()) { iVisibleButtons++; } else { aButtons[i].setVisible(false); } } return iVisibleButtons; }
javascript
{ "resource": "" }
q19373
train
function (aButtons) { for (var i = aButtons.length - 1; i >= 0; i--) { if (aButtons[i].getVisible()) { aButtons[i].setVisible(false); this.addOverflowButton(); return; } } }
javascript
{ "resource": "" }
q19374
train
function (oSource, bContextMenu) { this.getPopover().setShowArrow(true); var sOverlayId = (oSource.getId && oSource.getId()) || oSource.getAttribute("overlay"); var sFakeDivId = "contextMenuFakeDiv"; // get Dimensions of Overlay and Viewport var oOverlayDimensions = this._getOverlayDimensions(sOverlayId); var oViewportDimensions = this._getViewportDimensions(); this._oContextMenuPosition.x = this._oContextMenuPosition.x || parseInt(oOverlayDimensions.left + 20); this._oContextMenuPosition.y = this._oContextMenuPosition.y || parseInt(oOverlayDimensions.top + 20); // if the Overlay is near the top position of the Viewport, the Popover makes wrong calculation for positioning it. // The MiniMenu has been placed above the Overlay even if there has not been enough place. // Therefore we have to calculate the top position and also consider the high of the Toolbar (46 Pixels). var iFakeDivTop = oOverlayDimensions.top - 50 > oViewportDimensions.top ? 0 : oViewportDimensions.top - (oOverlayDimensions.top - 50); // place a Target DIV (for the moment at wrong position) jQuery("#" + sFakeDivId).remove(); jQuery("#" + sOverlayId).append("<div id=\"" + sFakeDivId + "\" overlay=\"" + sOverlayId + "\" style = \"position: absolute; top: " + iFakeDivTop + "px; left: 0px;\" />"); var oFakeDiv = document.getElementById(sFakeDivId); // place the Popover invisible this.getPopover().setContentWidth(undefined); this.getPopover().setContentHeight(undefined); this.getPopover().openBy(oFakeDiv); // get Dimensions of Popover var oPopoverDimensions = this._getPopoverDimensions(!bContextMenu); // check if vertical scrolling should be done if (oPopoverDimensions.height >= oViewportDimensions.height * 2 / 3) { this.getPopover().setVerticalScrolling(true); oPopoverDimensions.height = (oViewportDimensions.height * 2 / 3).toFixed(0); this.getPopover().setContentHeight(oPopoverDimensions.height + "px"); } else { this.getPopover().setVerticalScrolling(false); this.getPopover().setContentHeight(undefined); } // check if horizontal size is too big if (oPopoverDimensions.width > 400) { oPopoverDimensions.width = 400; this.getPopover().setContentWidth("400px"); } else { this.getPopover().setContentWidth(undefined); } // calculate exact position var oPosition = {}; if (bContextMenu) { oPosition = this._placeAsExpandedContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } else { oPosition = this._placeAsCompactContextMenu(this._oContextMenuPosition, oPopoverDimensions, oViewportDimensions); } oPosition.top -= oOverlayDimensions.top; oPosition.left -= oOverlayDimensions.left; oPosition.top = (oPosition.top < 0) ? 0 : oPosition.top; oPosition.left = (oPosition.left < 0) ? 0 : oPosition.left; // set the correct position to the target DIV oFakeDiv.style.top = oPosition.top.toFixed(0) + "px"; oFakeDiv.style.left = oPosition.left.toFixed(0) + "px"; sOverlayId = null; return oFakeDiv; }
javascript
{ "resource": "" }
q19375
train
function (bWithArrow) { var oPopover = {}; var bCompact = this._bCompactMode; var fArrowHeight = this._getArrowHeight(bCompact); var iBaseFontsize = this._getBaseFontSize(); this._iFirstVisibleButtonIndex = null; oPopover.height = parseInt(jQuery("#" + this.getPopover().getId()).css("height")) || 40; oPopover.width = parseInt(jQuery("#" + this.getPopover().getId()).css("width")) || 80; if (bWithArrow) { var iArr = iBaseFontsize * fArrowHeight; if (iArr) { oPopover.height += iArr; oPopover.width += iArr; } } return oPopover; }
javascript
{ "resource": "" }
q19376
train
function (bCompact) { if (sap.ui.Device.browser.internet_explorer || sap.ui.Device.browser.edge) { return bCompact ? 0.5 : 0.5; } else { return bCompact ? 0.5625 : 0.5625; } }
javascript
{ "resource": "" }
q19377
train
function (sOverlayId) { var oOverlayDimensions = jQuery("#" + sOverlayId).rect(); oOverlayDimensions.right = oOverlayDimensions.left + oOverlayDimensions.width; oOverlayDimensions.bottom = oOverlayDimensions.top + oOverlayDimensions.height; return oOverlayDimensions; }
javascript
{ "resource": "" }
q19378
train
function () { var oViewport = {}; oViewport.width = window.innerWidth; oViewport.height = window.innerHeight; oViewport.top = parseInt(jQuery(".type_standalone").css("height")) || 0; oViewport.bottom = oViewport.top + oViewport.height; return oViewport; }
javascript
{ "resource": "" }
q19379
train
function() { var sOverflowButtonId = "OVERFLOW_BUTTON", oButtonOptions = { icon: "sap-icon://overflow", type: "Transparent", enabled: true, press: this._onOverflowPress.bind(this), layoutData: new FlexItemData({}) }; return this._addButton(sOverflowButtonId, oButtonOptions); }
javascript
{ "resource": "" }
q19380
train
function(oButtonItem, fnContextMenuHandler, aElementOverlays) { var fnHandler = function(oEvent) { this.bOpen = false; this.bOpenNew = false; fnContextMenuHandler(this); }; var sText = typeof oButtonItem.text === "function" ? oButtonItem.text(aElementOverlays[0]) : oButtonItem.text; var bEnabled = typeof oButtonItem.enabled === "function" ? oButtonItem.enabled(aElementOverlays) : oButtonItem.enabled; var oButtonOptions = { icon: this._getIcon(oButtonItem.icon), text: sText, tooltip: sText, type: "Transparent", enabled: bEnabled, press: fnHandler, layoutData: new FlexItemData({}) }; return this._addButton(oButtonItem.id, oButtonOptions); }
javascript
{ "resource": "" }
q19381
train
function (bExplicitClose) { if (this.getPopover()) { if (bExplicitClose) { this.getPopover(true).close(); this.getPopover(false).close(); } // deletes the overflow button if there is one if (this.getProperty("buttons").length > this.getProperty("maxButtonsDisplayed")) { this.setProperty("buttons", this.getProperty("buttons").splice(0, this.getProperty("buttons").length - 1)); this.getFlexbox().removeItem(this.getButtons().length - 1); } } return this; }
javascript
{ "resource": "" }
q19382
train
function (iIndex) { this.setProperty("buttons", this.getProperty("buttons").splice(iIndex, 1)); this.getFlexbox(true).removeItem(iIndex); return this.getFlexbox(false).removeItem(iIndex); }
javascript
{ "resource": "" }
q19383
train
function (_aButtons, fnContextMenuHandler, aElementOverlays) { this.removeAllButtons(); _aButtons.forEach(function (oButton) { this.addMenuButton(oButton, fnContextMenuHandler, aElementOverlays); }.bind(this)); }
javascript
{ "resource": "" }
q19384
train
function (oEvent) { if (document.activeElement) { var sId = document.activeElement.id; switch (oEvent.key) { case "ArrowRight": this._changeFocusOnButtons(sId); break; case "ArrowLeft": this._changeFocusOnButtons(sId, true); break; case "ArrowUp": this._changeFocusOnButtons(sId, true); break; case "ArrowDown": this._changeFocusOnButtons(sId); break; default: break; } } }
javascript
{ "resource": "" }
q19385
train
function (sId, bPrevious) { this.getButtons().some(function (oButton, iIndex, aArray) { if (sId === oButton.getId()) { if (bPrevious) { this._setFocusOnPreviousButton(aArray, iIndex); } else { this._setFocusOnNextButton(aArray, iIndex); } return true; } }.bind(this)); }
javascript
{ "resource": "" }
q19386
train
function (aButtons, iIndex) { for (var i0 = iIndex - 1; i0 >= 0; i0--) { if (this._setFocusOnButton(aButtons[i0])) { return; } } for (var i1 = aButtons.length - 1; i1 >= iIndex; i1--) { if (this._setFocusOnButton(aButtons[i1])) { return; } } }
javascript
{ "resource": "" }
q19387
fnIsValidForMove
train
function fnIsValidForMove(oOverlay, bOnRegistration) { var bValid = false, oDesignTimeMetadata = oOverlay.getDesignTimeMetadata(), oParentElementOverlay = oOverlay.getParentElementOverlay(); if (!oDesignTimeMetadata || !oParentElementOverlay) { return false; } var oRelevantContainer = oOverlay.getRelevantContainer(); var oRelevantContainerOverlay = OverlayRegistry.getOverlay(oRelevantContainer); if (!oRelevantContainerOverlay) { return false; } bValid = this.isMoveAvailableOnRelevantContainer(oOverlay); if (bValid) { bValid = this.oBasePlugin.hasStableId(oOverlay) && this.oBasePlugin.hasStableId(oParentElementOverlay) && this.oBasePlugin.hasStableId(oRelevantContainerOverlay); } // element is only valid for move if it can be moved to somewhere else if (bValid) { var aOverlays = OverlayUtil.findAllUniqueAggregationOverlaysInContainer(oOverlay, oRelevantContainerOverlay); var aValidAggregationOverlays = aOverlays.filter(function(oAggregationOverlay) { return this.checkTargetZone(oAggregationOverlay, oOverlay, bOnRegistration); }.bind(this)); if (aValidAggregationOverlays.length < 1) { bValid = false; } else if (aValidAggregationOverlays.length === 1) { var aVisibleOverlays = aValidAggregationOverlays[0].getChildren().filter(function(oChildOverlay) { var oChildElement = oChildOverlay.getElement(); // At least one sibling has to be visible and still attached to the parent // In some edge cases, the child element is not available anymore (element already got destroyed) return (oChildElement && oChildElement.getVisible() && oChildElement.getParent()); }); bValid = aVisibleOverlays.length > 1; } } return bValid; }
javascript
{ "resource": "" }
q19388
train
function(iStartIndex) { // check in the sections which where loaded for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) { var oSection = that._mLoadedSections[sNodeId][i]; // try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) { return true; } } // check requested sections where we still wait for an answer }
javascript
{ "resource": "" }
q19389
train
function (sKey) { var aFiltered = FilterProcessor.apply([sKey], oCombinedFilter, function(vRef, sPath) { var oContext = that.oModel.getContext('/' + vRef); return that.oModel.getProperty(sPath, oContext); }); return aFiltered.length > 0; }
javascript
{ "resource": "" }
q19390
train
function(sKey, sPath) { oContext = that.oModel.getContext('/' + sKey); return that.oModel.getProperty(sPath, oContext); }
javascript
{ "resource": "" }
q19391
train
function(oRuleDef, oRuleset) { oRuleDef = TableSupportHelper.normalizeRule(oRuleDef); var sResult = oRuleset.addRule(oRuleDef); if (sResult != "success") { Log.warning("Support Rule '" + oRuleDef.id + "' for library sap.ui.table not applied: " + sResult); } }
javascript
{ "resource": "" }
q19392
train
function(oIssueManager, sText, sSeverity, sControlId) { oIssueManager.addIssue({ severity: sSeverity || Severity.Medium, details: sText, context: {id: sControlId || "WEBPAGE"} }); }
javascript
{ "resource": "" }
q19393
train
function(oScope, bVisibleOnly, sType) { var mElements = oScope.getElements(); var aResult = []; for (var n in mElements) { var oElement = mElements[n]; if (oElement.isA(sType)) { if (bVisibleOnly && oElement.getDomRef() || !bVisibleOnly) { aResult.push(oElement); } } } return aResult; }
javascript
{ "resource": "" }
q19394
train
function(fnFilter, fnCheck) { var aLog = Log.getLogEntries(); //oScope.getLoggedObjects(); /*getLoggedObjects returns only log entries with supportinfo*/ var oLogEntry; for (var i = 0; i < aLog.length; i++) { oLogEntry = aLog[i]; if (fnFilter(oLogEntry)) { if (fnCheck(oLogEntry)) { return; } } } }
javascript
{ "resource": "" }
q19395
train
function(oThis, oEvent){ oThis.fireRefineSearch({ query: oThis._sSearchQuery, changedAttribute: oEvent.getParameter("attribute"), allSelectedAttributes: oEvent.getParameter("allAttributes") }); }
javascript
{ "resource": "" }
q19396
train
function () { var pInstanceCreation, oMsr = startMeasurements("_getInstance"), that = this; pInstanceCreation = new Promise(function (resolve, reject) { var oInstance; Log.debug("Cache Manager: Initialization..."); if (!CacheManager._instance) { oInstance = that._findImplementation(); Measurement.start(S_MSR_INIT_IMPLEMENTATION, "CM", S_MSR_CAT_CACHE_MANAGER); oInstance.init().then(resolveCacheManager, reject); Measurement.end(S_MSR_INIT_IMPLEMENTATION, "CM"); } else { resolveCacheManager(CacheManager._instance); } function resolveCacheManager(instance) { CacheManager._instance = instance; oMsr.endAsync(); Log.debug("Cache Manager initialized with implementation [" + CacheManager._instance.name + "], resolving _getInstance promise"); resolve(instance); } }); oMsr.endSync(); return pInstanceCreation; }
javascript
{ "resource": "" }
q19397
train
function (key, value) { var pSet, oMsr = startMeasurements("set", key); Log.debug("Cache Manager: Setting value of type[" + typeof value + "] with key [" + key + "]"); pSet = this._callInstanceMethod("set", arguments).then(function callInstanceHandler() { Log.debug("Cache Manager: Setting key [" + key + "] completed successfully"); oMsr.endAsync(); //nothing to return, just logging. }, function (e) { Log.error("Cache Manager: Setting key [" + key + "] failed. Error:" + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pSet; }
javascript
{ "resource": "" }
q19398
train
function (key) { var pGet, oMsr = startMeasurements("get", key); Log.debug("Cache Manager: Getting key [" + key + "]"); pGet = this._callInstanceMethod("get", arguments).then(function callInstanceHandler(v) { Log.debug("Cache Manager: Getting key [" + key + "] done"); oMsr.endAsync(); return v; }, function (e) { Log.debug("Cache Manager: Getting key [" + key + "] failed. Error: " + e); oMsr.endAsync(); throw e; }); oMsr.endSync(); return pGet; }
javascript
{ "resource": "" }
q19399
train
function (key) { var pHas, oMsr = startMeasurements("has", key); Log.debug("Cache Manager: has key [" + key + "] called"); pHas = this._callInstanceMethod("has", arguments).then(function callInstanceHandler(result) { oMsr.endAsync(); Log.debug("Cache Manager: has key [" + key + "] returned " + result); return result; }); oMsr.endSync(); return pHas; }
javascript
{ "resource": "" }