sp-jsom-node
Version:
SharePoint JavaScript Object Model for Node.js
1,412 lines (1,190 loc) • 383 kB
JavaScript
//***********IMPORTANT!!!! READ THIS!!!!!!***********************************
//Don't add script in this file! Only function alias is allowed in this file!
//***************************************************************************
Type.registerNamespace('Srch');
Srch.EventType = function() {}
Srch.EventType.prototype = {
none: 0,
queryReady: 1,
queryIssuing: 2,
batchQueryIssuing: 3,
resultReady: 4,
batchResultReady: 5,
queryStateChanged: 6,
resultRendered: 7,
preLoad: 8,
load: 9,
postLoad: 10
}
Srch.EventType.registerEnum('Srch.EventType', false);
Srch.MessageLevel = function() {}
Srch.MessageLevel.prototype = {
information: 0,
warning: 1,
error: 2
}
Srch.MessageLevel.registerEnum('Srch.MessageLevel', false);
Srch.UserActionType = function() {}
Srch.UserActionType.prototype = {
search: 0,
pageNext: 1,
pagePrev: 2,
refine: 3,
sort: 4,
filterLanguage: 5
}
Srch.UserActionType.registerEnum('Srch.UserActionType', false);
Srch.DateTimeKind = function() {}
Srch.DateTimeKind.prototype = {
unspecified: 0,
utc: 1,
local: 2
}
Srch.DateTimeKind.registerEnum('Srch.DateTimeKind', false);
Srch.ClientControl = function Srch_ClientControl(elem) {
this.$$d_serverTemplateScriptsCallback = Function.createDelegate(this, this.serverTemplateScriptsCallback);
this.$$d_clickHandler = Function.createDelegate(this, this.clickHandler);
this.$$d_scriptApplication_PostLoad = Function.createDelegate(this, this.scriptApplication_PostLoad);
this.$$d_scriptApplication_Load = Function.createDelegate(this, this.scriptApplication_Load);
this.$$d_scriptApplication_PreLoad = Function.createDelegate(this, this.scriptApplication_PreLoad);
this.listenedEvents = [];
this.serverTemplateScriptsToLoad = [];
this.$c_2 = [];
this.$1L_2 = [];
Srch.ClientControl.initializeBase(this, [ elem ]);
}
Srch.ClientControl.get_isLoadingSearchCenterUrl = function Srch_ClientControl$get_isLoadingSearchCenterUrl() {
return Srch.ClientControl.$q;
}
Srch.ClientControl.set_isLoadingSearchCenterUrl = function Srch_ClientControl$set_isLoadingSearchCenterUrl(value) {
Srch.ClientControl.$q = value;
return value;
}
Srch.ClientControl.toggleMessageDetails = function Srch_ClientControl$toggleMessageDetails(messageContainer) {
var $v_0 = messageContainer.children;
if (Srch.U.n($v_0)) {
return false;
}
for (var $v_1 = 0; $v_1 < $v_0.length; $v_1++) {
var $v_2 = $v_0[$v_1];
if ($v_2.style.display === 'none') {
$v_2.style.display = '';
}
else {
$v_2.style.display = 'none';
}
}
return false;
}
Srch.ClientControl.$3X = function Srch_ClientControl$$3X($p0) {
return $p0.showForViewerUsers;
}
Srch.ClientControl.prototype = {
alternateRenderer: null,
alternateRenderContext: null,
$1H_2: null,
$17_2: null,
$1G_2: null,
loaded: false,
get_nextUniqueId: function Srch_ClientControl$get_nextUniqueId() {
this.$3Z_2++;
return this.get_id() + this.$3Z_2;
},
$3Z_2: 0,
get_renderTemplateId: function Srch_ClientControl$get_renderTemplateId() {
return this.$24_2;
},
set_renderTemplateId: function Srch_ClientControl$set_renderTemplateId(value) {
this.$24_2 = value;
return value;
},
$24_2: '',
get_delayLoadTemplateScripts: function Srch_ClientControl$get_delayLoadTemplateScripts() {
return this.$10_2;
},
set_delayLoadTemplateScripts: function Srch_ClientControl$set_delayLoadTemplateScripts(value) {
this.$10_2 = value;
return value;
},
$10_2: true,
get_states: function Srch_ClientControl$get_states() {
if (!this.$2C_2) {
this.$2C_2 = {};
}
return this.$2C_2;
},
set_states: function Srch_ClientControl$set_states(value) {
this.$2C_2 = value;
return value;
},
$2C_2: null,
get_messages: function Srch_ClientControl$get_messages() {
return this.$1A_2;
},
set_messages: function Srch_ClientControl$set_messages(value) {
if (!Srch.U.n(value) && value.length > 0) {
this.$1A_2 = [];
for (var $v_0 = 0; $v_0 < value.length; $v_0++) {
var $v_1 = value[$v_0];
if (!Srch.U.n($v_1)) {
Srch.U.appendArray(this.$1A_2, Srch.ControlMessage.getIfControlMessage($v_1));
}
}
}
else {
this.$1A_2 = value;
}
return value;
},
$1A_2: null,
get_showDataErrors: function Srch_ClientControl$get_showDataErrors() {
return this.$31_2;
},
set_showDataErrors: function Srch_ClientControl$set_showDataErrors(value) {
this.$31_2 = value;
return value;
},
$31_2: false,
get_alternateErrorMessage: function Srch_ClientControl$get_alternateErrorMessage() {
return this.$t_2;
},
set_alternateErrorMessage: function Srch_ClientControl$set_alternateErrorMessage(value) {
this.$t_2 = value;
return value;
},
$t_2: null,
get_isInitialLoad: function Srch_ClientControl$get_isInitialLoad() {
return !this.loaded;
},
$41_2: false,
$2J_2: null,
get_resultsPageAddress: function Srch_ClientControl$get_resultsPageAddress() {
return this.$2J_2;
},
set_resultsPageAddress: function Srch_ClientControl$set_resultsPageAddress(value) {
this.$2J_2 = value;
return value;
},
initialize: function Srch_ClientControl$initialize() {
this.$1_2('Initialize', '');
Srch.ScriptApplicationManager.get_current().registerClientControl(this);
this.$1H_2 = this.$$d_scriptApplication_PreLoad;
Srch.ScriptApplicationManager.get_current().add_preLoad(this.$1H_2);
this.$17_2 = this.$$d_scriptApplication_Load;
Srch.ScriptApplicationManager.get_current().add_load(this.$17_2);
this.$1G_2 = this.$$d_scriptApplication_PostLoad;
Srch.ScriptApplicationManager.get_current().add_postLoad(this.$1G_2);
if (!Srch.U.n(this.get_element())) {
$addHandler(this.get_element(), 'click', this.$$d_clickHandler);
}
if (!Srch.ClientControl.$q) {
Srch.ClientControl.$q = true;
Srch.U.getSearchCenterUrl(true);
}
if (this.$41_2) {
this.$5V_2();
}
Sys.Component.prototype.initialize.call(this);
},
$5V_2: function Srch_ClientControl$$5V_2() {
var $v_0 = SP.PageContextInfo.get_siteServerRelativeUrl();
var $v_1 = '/_api/search/resultspageaddress';
var $v_2 = ($v_0 && $v_0 !== '/') ? $v_0 + $v_1 : $v_1;
var $v_3 = new XMLHttpRequest();
$v_3.open('GET', $v_2, true);
$v_3.setRequestHeader('Accept', 'application/json;odata=verbose');
var $$t_7 = this;
$v_3.onreadystatechange = function() {
if ($v_3.readyState === 4) {
if ($v_3.status === 200) {
var $v_4 = Sys.Serialization.JavaScriptSerializer.deserialize($v_3.responseText);
var $v_5 = $v_4['d'];
if (Srch.U.n($v_5)) {
Srch.U.trace(null, 'GetResultsPageAddress', 'No data recieved from _api/search/resultspageaddress');
}
var $v_6 = $v_5['resultspageaddress'];
if (!Srch.U.w($v_6)) {
$$t_7.$2J_2 = $v_6;
}
}
}
};
$v_3.send(null);
},
dispose: function Srch_ClientControl$dispose() {
var $v_0 = new SP.CScope('ClientControl.Dispose');
$v_0.start();
this.$1_2('Dispose', '');
try {
if (!Srch.U.n(this.get_element())) {
$clearHandlers(this.get_element());
}
if (!Srch.U.n(this.listenedEvents)) {
for (var $v_1 = 0; $v_1 < this.listenedEvents.length; $v_1++) {
var $v_2 = this.listenedEvents[$v_1];
if (!Srch.U.n($v_2)) {
$v_2.dispose();
}
}
this.listenedEvents = null;
}
if (!Srch.U.n(this.$1H_2)) {
Srch.ScriptApplicationManager.get_current().remove_preLoad(this.$1H_2);
this.$1H_2 = null;
}
if (!Srch.U.n(this.$17_2)) {
Srch.ScriptApplicationManager.get_current().remove_load(this.$17_2);
this.$17_2 = null;
}
if (!Srch.U.n(this.$1G_2)) {
Srch.ScriptApplicationManager.get_current().remove_postLoad(this.$1G_2);
this.$1G_2 = null;
}
}
finally {
Sys.Component.prototype.dispose.call(this);
}
$v_0.stop();
},
renderControl: function Srch_ClientControl$renderControl(listData, dp) {
this.$1_2('RenderControl', '');
var $v_0 = new SP.CScope('ClientControl.RenderControl');
$v_0.start();
Srch.U.ensureNotNullOrUndefined(this.get_element(), this, 'RenderControl', 'this.Element');
if (Srch.U.n(this.alternateRenderContext)) {
this.alternateRenderContext = {};
}
var $v_1 = {};
if (!Srch.U.n(this.alternateRenderer)) {
$v_1 = this.alternateRenderContext;
this.alternateRenderContext['ListData'] = listData;
this.alternateRenderContext['ClientControl'] = this;
this.alternateRenderContext['DataProvider'] = dp;
this.alternateRenderContext['ScriptApplicationManager'] = Srch.ScriptApplicationManager.get_current();
this.invokeAlternateRender(this.alternateRenderer, this.get_element(), this.alternateRenderContext);
}
else {
$v_1['ResolveTemplate'] = Srch.U.resolveRenderTemplate;
$v_1['ListData'] = listData;
$v_1['ClientControl'] = this;
$v_1['DataProvider'] = dp;
$v_1['ScriptApplicationManager'] = Srch.ScriptApplicationManager.get_current();
this.invokeClientRenderer(this.get_element(), $v_1);
}
this.processDataProviderErrors(dp);
this.processRenderingErrorMessages($v_1);
this.displayControlMessages();
$v_0.stop();
},
processDataProviderErrors: function Srch_ClientControl$processDataProviderErrors(dataProviderToProcess) {
if (!Srch.U.n(dataProviderToProcess) && !Srch.U.n(dataProviderToProcess.get_messages()) && dataProviderToProcess.get_messages().length > 0) {
this.processDataErrorMessages(dataProviderToProcess.get_messages());
}
},
scriptApplication_PreLoad: function Srch_ClientControl$scriptApplication_PreLoad(sender, e) {
this.$1_2('ScriptApplication_PreLoad', 'ClientControl');
if (this.$10_2) {
Srch.U.appendScriptsToLoad(this.serverTemplateScriptsToLoad, this.$24_2);
}
},
scriptApplication_Load: function Srch_ClientControl$scriptApplication_Load(sender, e) {
this.$1_2('ScriptApplication_Load', 'ClientControl');
},
scriptApplication_PostLoad: function Srch_ClientControl$scriptApplication_PostLoad(sender, e) {
this.$1_2('ScriptApplication_PostLoad', 'ClientControl');
this.loaded = true;
},
loadServerTemplateScripts: function Srch_ClientControl$loadServerTemplateScripts() {
this.$1_2('LoadServerTemplateScripts', 'Trying to load server template scripts...');
return this.loadRenderTemplateScripts(this.serverTemplateScriptsToLoad, this.$$d_serverTemplateScriptsCallback, this.$$d_serverTemplateScriptsCallback, -1, false);
},
serverTemplateScriptsCallback: function Srch_ClientControl$serverTemplateScriptsCallback() {
this.$1_2('ServerTemplateScriptsCallback', 'ServerTemplateScriptsCallback');
this.serverTemplateScriptsToLoad = [];
},
loadRenderTemplateScripts: function Srch_ClientControl$loadRenderTemplateScripts(scriptReferences, success, failure, timeout, loadStandAloneCustomScripts) {
this.$1_2('LoadRenderTemplateScripts', 'Loading render template scripts...');
var $$t_7 = this, $$t_8 = this;
if (Srch.U.loadScripts(scriptReferences, function($p1_0) {
$$t_7.$5y_2($p1_0, success, failure, timeout);
}, function($p1_0) {
$$t_8.$5x_2($p1_0, failure);
}, timeout)) {
return true;
}
this.$1_2('LoadRenderTemplateScripts', 'Did not discover new render template script to load.');
if (loadStandAloneCustomScripts) {
return this.$4T_2(success, failure, timeout);
}
else {
this.$1_2('LoadRenderTemplateScripts', 'Skip loading custom scripts.');
return false;
}
},
$5y_2: function Srch_ClientControl$$5y_2($p0, $p1, $p2, $p3) {
this.$1_2('RenderTemplateScriptsLoaded', 'All render template scripts loaded.');
Srch.U.registerLoadedScripts($p0);
if (this.$4T_2($p1, $p2, $p3)) {
return;
}
$p1();
},
$5x_2: function Srch_ClientControl$$5x_2($p0, $p1) {
this.$1_2('RenderTemplateScriptsFailed', 'Loading render template scripts faild.');
this.$4b_2($p0);
$p1();
},
$4T_2: function Srch_ClientControl$$4T_2($p0, $p1, $p2) {
this.$1_2('LoadCustomScripts', 'Loading custom scripts...');
if (!Srch.U.n(Srch.ScriptApplicationManager.get_current().$1Z_1)) {
var $v_0 = [];
var $$dict_4 = Srch.ScriptApplicationManager.get_current().$1Z_1;
for (var $$key_5 in $$dict_4) {
var $v_1 = { key: $$key_5, value: $$dict_4[$$key_5] };
var $v_2 = $v_1.key;
if (!Srch.U.e($v_2)) {
var $v_3 = $v_2.trim().toLowerCase();
if ($v_3.endsWith('.css')) {
$v_3 = Srch.U.urlTokenExpansion($v_3);
Srch.U.traceFormatted(null, 'LoadCustomScripts', 'Found custom css:\'{0}\'', $v_3);
if (Srch.U.n(Srch.ScriptApplicationManager.get_current().$18_1[$v_3])) {
registerCssLink($v_3);
Srch.U.traceFormatted(null, 'LoadCustomScripts', 'Registering css \'{0}\' as loaded', $v_3);
Srch.ScriptApplicationManager.get_current().$18_1[$v_3] = false;
}
}
else {
Srch.U.appendScriptsToLoad($v_0, $v_2);
}
}
}
var $$t_B = this, $$t_C = this;
if (Srch.U.loadScripts($v_0, function($p1_0) {
$$t_B.$5I_2($p1_0, $p0);
}, function($p1_0) {
$$t_C.$5H_2($p1_0, $p1);
}, $p2)) {
return true;
}
}
this.$1_2('LoadCustomScripts', 'Did not discover new custom script to load.');
return false;
},
$5I_2: function Srch_ClientControl$$5I_2($p0, $p1) {
this.$1_2('CustomScriptsLoaded', 'All custom scripts loaded.');
Srch.U.registerLoadedScripts($p0);
$p1();
},
$5H_2: function Srch_ClientControl$$5H_2($p0, $p1) {
this.$1_2('CustomScriptsFailed', 'Loading custom scripts failed.');
var $v_0 = this.$4b_2($p0);
var $v_1 = String.format(SP.Utilities.HttpUtility.htmlEncode(Srch.Res.u_ScriptLoadFail), $v_0);
var $v_2 = SP.Utilities.HttpUtility.htmlEncode(Srch.Res.u_ScriptLoadFailForViewer);
var $v_3 = new Srch.ControlMessage(null, 2, 0, 'ResourceLoadException', $v_1, $v_2, null, null, false, true, false);
Srch.U.appendArray(this.get_messages(), $v_3);
$p1();
},
$4b_2: function Srch_ClientControl$$4b_2($p0) {
var $v_0 = '<ul>';
if (!Srch.U.n($p0)) {
for (var $v_1 = 0; $v_1 < $p0.length; $v_1++) {
var $v_2 = $p0[$v_1];
if (!Srch.U.w($v_2)) {
this.$3_2('ProcessLoadFailedScripts', 'Loading script \'{0}\' failed.', $v_2);
$v_0 += '<li>' + SP.Utilities.HttpUtility.htmlEncode($v_2) + '</li>';
}
}
}
$v_0 += '</ul>';
return $v_0;
},
invokeAlternateRender: function Srch_ClientControl$invokeAlternateRender(callback, container, ctx) {
var $v_0 = new SP.CScope('ClientControl.InvokeAlternateRender');
$v_0.start();
if (!Srch.U.n(callback)) {
callback(container, ctx);
}
$v_0.stop();
},
invokeClientRenderer: function Srch_ClientControl$invokeClientRenderer(node, ctx) {
var $v_0 = new SP.CScope('ClientControl.InvokeClientRenderer');
$v_0.start();
SPClientRenderer.Render(node, ctx);
$v_0.stop();
},
$K_2: null,
$5M_2: function Srch_ClientControl$$5M_2() {
if (Srch.U.n(this.$K_2) && !Srch.U.n(this.get_element())) {
this.$K_2 = document.createElement('div');
this.$K_2.style.display = 'none';
var $v_0 = this.get_element().parentNode;
$v_0.insertBefore(this.$K_2, this.get_element());
}
},
processDataErrorMessages: function Srch_ClientControl$processDataErrorMessages(dataErrorsList) {
if (!Srch.U.n(dataErrorsList) && Srch.U.isArray(dataErrorsList)) {
for (var $$arr_1 = dataErrorsList, $$len_2 = $$arr_1.length, $$idx_3 = 0; $$idx_3 < $$len_2; ++$$idx_3) {
var $v_0 = $$arr_1[$$idx_3];
Srch.U.appendArray(this.$c_2, $v_0);
}
}
},
processRenderingErrorMessages: function Srch_ClientControl$processRenderingErrorMessages(ctx) {
var $v_0 = ctx['Errors'];
if (!Srch.U.n($v_0) && Srch.U.isArray($v_0)) {
for (var $$arr_2 = $v_0, $$len_3 = $$arr_2.length, $$idx_4 = 0; $$idx_4 < $$len_3; ++$$idx_4) {
var $v_1 = $$arr_2[$$idx_4];
Srch.U.appendArray(this.$1L_2, Srch.ControlMessage.getFromException($v_1));
}
ctx['Errors'] = null;
}
},
hasMessages: function Srch_ClientControl$hasMessages() {
var $v_0 = Srch.U.$3O();
return (!!this.get_messages() && this.get_messages().length > 0) || (!!this.$c_2 && this.$c_2.length > 0) || (!!this.$1L_2 && this.$1L_2.length > 0) || (!!$v_0 && $v_0.length > 0);
},
updateDisplayControlWithNewMessages: function Srch_ClientControl$updateDisplayControlWithNewMessages() {
this.$4A_2(true);
},
displayControlMessages: function Srch_ClientControl$displayControlMessages() {
this.$4A_2(false);
},
$4A_2: function Srch_ClientControl$$4A_2($p0) {
var $v_0 = this.$5O_2(this.get_messages(), this.$c_2, this.$1L_2, Srch.U.$3O(), $p0);
if (!Srch.U.w($v_0) || !$p0) {
var $v_1 = this.$V_2.length > 0 || this.$Z_2.length > 0 || this.$c_2.length > 0;
this.$5M_2();
if (!Srch.U.w($v_0)) {
this.$K_2.innerHTML = $v_0;
this.$K_2.style.display = '';
}
else {
this.$K_2.innerHTML = '';
this.$K_2.style.display = 'none';
}
this.setControlElementVisibility(!$v_1);
}
this.$c_2 = [];
this.$1L_2 = [];
Srch.U.$60();
},
setControlElementVisibility: function Srch_ClientControl$setControlElementVisibility(showElement) {
if (!Srch.U.n(this.get_element())) {
this.get_element().style.display = (showElement) ? '' : 'none';
}
},
clickHandler: function Srch_ClientControl$clickHandler(evt) {
if (!Srch.U.n(evt) && !Srch.U.n(evt.target)) {
var $v_0 = Srch.U.getParentAttributeByName(evt.target, 'clicktype');
if (!Srch.U.e($v_0)) {
Srch.U.logClick(evt.target, $v_0);
}
var $v_1 = Srch.U.getParentElementByName(evt.target, 'A');
if (!Srch.U.n($v_1)) {
var $v_2 = $v_1.href;
if (!Srch.U.n($v_2)) {
var $v_3 = $v_1.protocol;
var $v_4 = $v_1.hostname;
if ((!Srch.U.n($v_2)) && (!Srch.U.n($v_3)) && (!Srch.U.n($v_4)) && (!Srch.U.n(window.self.location)) && ($v_3 === window.self.location.protocol) && ($v_4.toLowerCase() === window.self.location.hostname.toLowerCase())) {
var $v_5 = ajaxNavigate.get_href();
var $v_6 = $v_5.indexOf('#');
if ($v_6 !== -1) {
$v_5 = $v_5.substring(0, $v_6);
}
Srch.U.setCookie('WOPISessionContext', $v_5, null, null, '/', false);
var $v_7 = $v_1.getAttribute('openApp');
if (!Srch.U.e($v_7)) {
if (TypeofFullName('navigator.msLaunchUri') === 'function') {
var $v_9 = $v_7 + ':ofv|u|' + $v_2.trim();
var $$t_E = this;
navigator.msLaunchUri($v_9, null, function() {
window.self.location.href = $v_2;
});
Srch.U.cancelEventEx(evt, true, false);
return;
}
}
var $v_8 = $v_1.getAttribute('openControl');
if (!Srch.U.e($v_8)) {
try {
if (window.self.ActiveXObject) {
var $v_A = null;
try {
$v_A = new ActiveXObject('AcroPDF.PDF');
}
catch ($v_B) {
}
if (Srch.U.n($v_A)) {
$v_A = new ActiveXObject($v_8);
}
if (!Srch.U.n($v_A)) {
if ($v_8 === 'PdfFile.OpenDocuments') {
$v_2 = $v_2.split('#')[0];
}
if ($v_A.ViewDocument2(window.self, $v_2)) {
Srch.U.cancelEventEx(evt, true, false);
return;
}
}
}
}
catch ($v_C) {
}
}
}
}
}
}
},
$5k_2: function Srch_ClientControl$$5k_2($p0) {
return this.$3W_2($p0) || Srch.ClientControl.$3X($p0);
},
$3W_2: function Srch_ClientControl$$3W_2($p0) {
return Srch.U.isPageInEditMode() || (!$p0.showInEditModeOnly && this.$62_2());
},
$62_2: function Srch_ClientControl$$62_2() {
var $v_0 = Srch.ScriptApplicationManager.get_current().states['showAdminDetails'];
if (Srch.U.n($v_0)) {
return true;
}
return $v_0;
},
$5j_2: function Srch_ClientControl$$5j_2($p0) {
return (Srch.ClientControl.$3X($p0) && !Srch.U.w($p0.messageDetailsForViewers)) || (this.$3W_2($p0) && !Srch.U.w($p0.messageDetails));
},
$V_2: null,
$Z_2: null,
$15_2: null,
$1v_2: 0,
$W_2: '',
$14_2: false,
$2m_2: function Srch_ClientControl$$2m_2($p0, $p1) {
if (Srch.U.n(this.$1A_2)) {
return false;
}
var $v_0 = false;
for (var $$arr_3 = $p0, $$len_4 = $$arr_3.length, $$idx_5 = 0; $$idx_5 < $$len_4; ++$$idx_5) {
var $v_1 = $$arr_3[$$idx_5];
if (this.$5k_2($v_1)) {
if (this.$1v_2 < $v_1.level) {
this.$1v_2 = $v_1.level;
if (Srch.U.n($v_1.header)) {
if (!Srch.U.n(this.$t_2) && !Srch.U.w(Srch.U.trimExtraSpaces(this.$t_2))) {
this.$W_2 = this.$t_2;
}
else {
this.$W_2 = Srch.U.loadResource('cc_err_WebPartErrorMessageDisplayHeader');
if (Srch.U.w(this.$W_2)) {
this.$W_2 = 'Sorry, search isn\'t working right now. Try back a bit later';
}
}
}
else {
this.$W_2 = $v_1.header;
}
}
if ($v_1.level === 2 || $v_1.level === 1) {
$p1.push($v_1);
this.$1_2('ProcessCategoryMessages', $v_1.toString());
}
else if (!$v_1.level) {
this.$15_2.push($v_1);
}
if (!$v_0 && this.$5j_2($v_1)) {
this.$14_2 = true;
$v_0 = true;
}
else if (!this.$14_2 && !Srch.U.w($v_1.correlationID)) {
this.$14_2 = true;
}
}
}
return $v_0;
},
$36_2: null,
$5O_2: function Srch_ClientControl$$5O_2($p0, $p1, $p2, $p3, $p4) {
this.$36_2 = {};
if (!$p4) {
this.$V_2 = [];
this.$Z_2 = [];
this.$15_2 = [];
this.$14_2 = false;
this.$1v_2 = 0;
this.$W_2 = '';
this.$2m_2($p0, this.$V_2);
}
if (this.$31_2) {
this.$2m_2($p1, this.$V_2);
}
var $v_0 = this.$2m_2($p2, this.$Z_2);
$v_0 = !!($v_0 | this.$2m_2($p3, this.$Z_2));
var $v_1 = new Sys.StringBuilder();
if (!Srch.U.n(this.$15_2) && this.$15_2.length > 0) {
$v_1.append('<div class=\"ms-status-msg ms-status-blue\">');
this.$1o_2 = true;
this.$3K_2($v_1, this.$15_2);
$v_1.append('</div>');
}
if ((!Srch.U.n(this.$V_2) && this.$V_2.length > 0) || (!Srch.U.n(this.$Z_2) && this.$Z_2.length > 0)) {
$v_1.append('<h2 class=\"ms-search-header, ms-srch-error-header\">' + SP.Utilities.HttpUtility.htmlEncode(this.$W_2) + '</h2>');
if (this.$14_2) {
var $v_2 = Srch.U.$B('cc_err_ShowMessageDetails', false);
if (Srch.U.w($v_2)) {
$v_2 = 'SHOW DETAILS';
}
var $v_3 = Srch.U.$B('cc_err_HideMessageDetails', false);
if (Srch.U.w($v_3)) {
$v_3 = 'HIDE DETAILS';
}
var $v_4 = 'ms-status-red';
if (this.$1v_2 === 1) {
$v_4 = 'ms-status-yellow';
}
$v_1.append(String.format(Srch.ClientControl.$4Y, SP.Utilities.HttpUtility.htmlEncode($v_2), SP.Utilities.HttpUtility.htmlEncode($v_3), $v_4));
this.$1o_2 = true;
this.$3K_2($v_1, this.$V_2);
if ($v_0) {
this.$5P_2($v_1);
this.$3K_2($v_1, this.$Z_2);
}
$v_1.append('</div></div>');
}
}
return $v_1.toString();
},
$5P_2: function Srch_ClientControl$$5P_2($p0) {
this.$3J_2($p0);
var $v_0 = Srch.U.$B('cc_err_RenderingErrorMessageDisplayHeader', false);
if (Srch.U.w($v_0)) {
$v_0 = '<strong>Display Error:</strong> The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.';
}
$p0.append(String.format(Srch.ClientControl.$1w, $v_0));
},
$3K_2: function Srch_ClientControl$$3K_2($p0, $p1) {
for (var $$arr_2 = $p1, $$len_3 = $$arr_2.length, $$idx_4 = 0; $$idx_4 < $$len_3; ++$$idx_4) {
var $v_0 = $$arr_2[$$idx_4];
if (this.$3W_2($v_0) && !Srch.U.w($v_0.messageDetails)) {
var $v_1 = ($v_0.encodeDetails) ? SP.Utilities.HttpUtility.htmlEncode($v_0.messageDetails) : $v_0.messageDetails;
this.$44_2($p0, String.format(Srch.ClientControl.$1w, $v_1));
}
else if (Srch.ClientControl.$3X($v_0) && !Srch.U.w($v_0.messageDetailsForViewers)) {
var $v_2 = ($v_0.encodeDetails) ? SP.Utilities.HttpUtility.htmlEncode($v_0.messageDetailsForViewers) : $v_0.messageDetailsForViewers;
this.$44_2($p0, String.format(Srch.ClientControl.$1w, $v_2));
}
this.$5N_2($p0, $v_0.correlationID);
}
},
$5N_2: function Srch_ClientControl$$5N_2($p0, $p1) {
if (!Srch.U.w($p1)) {
this.$3J_2($p0);
var $v_0 = Srch.U.$B('cc_err_CorrelationIdMessage', false);
if (Srch.U.w($v_0)) {
$v_0 = '<strong>Correlation ID:</strong> {0}';
}
$p0.append(String.format(Srch.ClientControl.$1w, String.format($v_0, $p1)));
}
},
$44_2: function Srch_ClientControl$$44_2($p0, $p1) {
if (!this.$36_2[$p1]) {
this.$36_2[$p1] = true;
this.$3J_2($p0);
$p0.append($p1);
return true;
}
return false;
},
$1o_2: false,
$3J_2: function Srch_ClientControl$$3J_2($p0) {
if (this.$1o_2) {
this.$1o_2 = false;
}
else {
$p0.append('<br />');
}
},
$1_2: function Srch_ClientControl$$1_2($p0, $p1) {
Srch.U.trace(this, $p0, $p1);
},
$3_2: function Srch_ClientControl$$3_2($p0, $p1) {
var $p2 = [];
for (var $$pai_3 = 2; $$pai_3 < arguments.length; ++$$pai_3) {
$p2[$$pai_3 - 2] = arguments[$$pai_3];
}
Srch.U.traceFormatted.apply(null, [ this, $p0, $p1 ].concat($p2));
}
}
Srch.DataProvider = function Srch_DataProvider(elem) {
this.$$d_$5b_3 = Function.createDelegate(this, this.$5b_3);
this.$$d_$65_3 = Function.createDelegate(this, this.$65_3);
this.$$d_searchBox_BatchResultReady = Function.createDelegate(this, this.searchBox_BatchResultReady);
this.$$d_searchBox_BatchQueryIssuing = Function.createDelegate(this, this.searchBox_BatchQueryIssuing);
this.$$d_searchBox_QueryReady = Function.createDelegate(this, this.searchBox_QueryReady);
this.$$d_displayControl_QueryReady = Function.createDelegate(this, this.displayControl_QueryReady);
this.$$d_$52_3 = Function.createDelegate(this, this.$52_3);
this.$2E_3 = [];
this.$3i_3 = SP.Guid.get_empty();
this.$2_3 = Srch.QueryState.$5R();
this.$2e_3 = new Srch.QueryState();
this.$1l_3 = -1;
this.$1s_3 = -1;
this.$2G_3 = -1;
Srch.DataProvider.initializeBase(this, [ elem ]);
}
Srch.DataProvider.$4L = function Srch_DataProvider$$4L($p0, $p1) {
if (!Srch.U.n($p0) && !Srch.U.n($p0.queryStateUpdateOption) && $p0.queryStateUpdateOption !== -1) {
return $p0.queryStateUpdateOption;
}
return $p1;
}
Srch.DataProvider.prototype = {
$26_3: false,
$20_3: 0,
$s_3: null,
$3V_3: false,
$3U_3: false,
get_$25_3: function Srch_DataProvider$get_$25_3() {
return this.$3i_3.toString() + this.$5_3;
},
get_$4Z_3: function Srch_DataProvider$get_$4Z_3() {
this.$3i_3 = SP.Guid.newGuid();
return this.get_$25_3();
},
get_currentQueryState: function Srch_DataProvider$get_currentQueryState() {
return this.$2_3;
},
get_sourceID: function Srch_DataProvider$get_sourceID() {
return this.$1Q_3;
},
set_sourceID: function Srch_DataProvider$set_sourceID(value) {
this.$1Q_3 = value;
return value;
},
$1Q_3: '',
get_sourceName: function Srch_DataProvider$get_sourceName() {
return this.$1S_3;
},
set_sourceName: function Srch_DataProvider$set_sourceName(value) {
this.$1S_3 = value;
return value;
},
$1S_3: '',
get_sourceLevel: function Srch_DataProvider$get_sourceLevel() {
return this.$1R_3;
},
set_sourceLevel: function Srch_DataProvider$set_sourceLevel(value) {
this.$1R_3 = value;
return value;
},
$1R_3: '',
get_collapseSpecification: function Srch_DataProvider$get_collapseSpecification() {
return this.$1U_3;
},
set_collapseSpecification: function Srch_DataProvider$set_collapseSpecification(value) {
this.$1U_3 = value;
return value;
},
$1U_3: '',
get_queryGroupName: function Srch_DataProvider$get_queryGroupName() {
return this.$5_3;
},
set_queryGroupName: function Srch_DataProvider$set_queryGroupName(value) {
this.$5_3 = value;
return value;
},
$5_3: '',
get_queryPropertiesTemplateUrl: function Srch_DataProvider$get_queryPropertiesTemplateUrl() {
return this.$22_3;
},
set_queryPropertiesTemplateUrl: function Srch_DataProvider$set_queryPropertiesTemplateUrl(value) {
this.$22_3 = value;
return value;
},
$22_3: '',
get_queryTemplate: function Srch_DataProvider$get_queryTemplate() {
return this.$l_3;
},
set_queryTemplate: function Srch_DataProvider$set_queryTemplate(value) {
this.$l_3 = value;
return value;
},
$l_3: '{searchboxquery}',
get_fallbackSort: function Srch_DataProvider$get_fallbackSort() {
return this.$1n_3;
},
set_fallbackSort: function Srch_DataProvider$set_fallbackSort(value) {
this.$1n_3 = value;
return value;
},
$1n_3: null,
get_rankRules: function Srch_DataProvider$get_rankRules() {
return this.$m_3;
},
set_rankRules: function Srch_DataProvider$set_rankRules(value) {
this.$m_3 = value;
return value;
},
$m_3: null,
get_initialQueryState: function Srch_DataProvider$get_initialQueryState() {
return this.$2e_3;
},
set_initialQueryState: function Srch_DataProvider$set_initialQueryState(value) {
this.$2e_3.copyFrom(value, 0);
if (value.l <= 0) {
this.$2e_3.l = this.get_effectiveQueryLanguage();
}
return value;
},
get_initialResult: function Srch_DataProvider$get_initialResult() {
return this.$f_3;
},
set_initialResult: function Srch_DataProvider$set_initialResult(value) {
this.$f_3 = value;
return value;
},
$f_3: '',
get_initialResultRef: function Srch_DataProvider$get_initialResultRef() {
return this.$g_3;
},
set_initialResultRef: function Srch_DataProvider$set_initialResultRef(value) {
this.$g_3 = value;
return value;
},
$g_3: null,
get_initialResultObject: function Srch_DataProvider$get_initialResultObject() {
var $v_0 = null;
var $v_1 = new SP.CScope('DataProvider.InitialResultObject');
$v_1.start();
if (!Srch.U.e(this.$f_3)) {
this.$1_2('InitialResultObject', 'Deserializing InitialResult json string');
try {
$v_0 = Srch.ParseJSONUtil.parseObjectFromJsonString(this.$f_3);
$v_1.stop();
return $v_0;
}
catch ($v_2) {
this.$3_2('InitialResultObject', 'Could not deserialize json string: {0} error: {1}', this.$f_3, $v_2.message);
}
}
else if (Srch.U.e(this.$f_3) && !Srch.U.e(this.$g_3) && typeof(this.$g_3) !== 'undefined') {
this.$3_2('InitialResultObject', 'Processing server generated JSON obect literal for InitialResultRef: {0}', this.$g_3);
$v_0 = eval(this.$g_3);
Srch.ParseJSONUtil.evaluateTokensInJsonObject($v_0);
return $v_0;
}
$v_1.stop();
return null;
},
get_batched: function Srch_DataProvider$get_batched() {
return this.$u_3;
},
set_batched: function Srch_DataProvider$set_batched(value) {
this.$u_3 = value;
return value;
},
$u_3: true,
get_active: function Srch_DataProvider$get_active() {
return this.$R_3;
},
set_active: function Srch_DataProvider$set_active(value) {
this.$R_3 = value;
return value;
},
$R_3: true,
get_bypassResultTypes: function Srch_DataProvider$get_bypassResultTypes() {
return this.bypassResultTypes;
},
set_bypassResultTypes: function Srch_DataProvider$set_bypassResultTypes(value) {
this.bypassResultTypes = value;
return value;
},
bypassResultTypes: false,
get_processBestBets: function Srch_DataProvider$get_processBestBets() {
return this.processBestBets;
},
set_processBestBets: function Srch_DataProvider$set_processBestBets(value) {
this.processBestBets = value;
return value;
},
processBestBets: true,
get_processPersonalFavorites: function Srch_DataProvider$get_processPersonalFavorites() {
return this.$27_3;
},
set_processPersonalFavorites: function Srch_DataProvider$set_processPersonalFavorites(value) {
this.$27_3 = value;
return value;
},
$27_3: true,
get_resultsPerPage: function Srch_DataProvider$get_resultsPerPage() {
return this.$p_3;
},
set_resultsPerPage: function Srch_DataProvider$set_resultsPerPage(value) {
this.$p_3 = value;
return value;
},
$p_3: 10,
get_selectedRefiners: function Srch_DataProvider$get_selectedRefiners() {
return this.$O_3;
},
set_selectedRefiners: function Srch_DataProvider$set_selectedRefiners(value) {
this.$O_3 = value;
return value;
},
$O_3: null,
get_selectedProperties: function Srch_DataProvider$get_selectedProperties() {
return this.$b_3;
},
set_selectedProperties: function Srch_DataProvider$set_selectedProperties(value) {
this.$b_3 = value;
return value;
},
$b_3: null,
get_hitHighlightedProperties: function Srch_DataProvider$get_hitHighlightedProperties() {
return this.$X_3;
},
set_hitHighlightedProperties: function Srch_DataProvider$set_hitHighlightedProperties(value) {
this.$X_3 = value;
return value;
},
$X_3: null,
get_fallbackLanguage: function Srch_DataProvider$get_fallbackLanguage() {
return this.$1l_3;
},
set_fallbackLanguage: function Srch_DataProvider$set_fallbackLanguage(value) {
this.$1l_3 = value;
return value;
},
get_fallbackRankingModelID: function Srch_DataProvider$get_fallbackRankingModelID() {
return this.$1m_3;
},
set_fallbackRankingModelID: function Srch_DataProvider$set_fallbackRankingModelID(value) {
this.$1m_3 = value;
return value;
},
$1m_3: '',
get_fallbackRefinementFilters: function Srch_DataProvider$get_fallbackRefinementFilters() {
return this.$3I_3;
},
set_fallbackRefinementFilters: function Srch_DataProvider$set_fallbackRefinementFilters(value) {
this.$3I_3 = Srch.U.$2R(value, Srch.RefinementCategory);
return value;
},
$3I_3: null,
get_availableSorts: function Srch_DataProvider$get_availableSorts() {
return this.$S_3;
},
set_availableSorts: function Srch_DataProvider$set_availableSorts(value) {
this.$S_3 = value;
return value;
},
$S_3: null,
get_contextualScopeUrl: function Srch_DataProvider$get_contextualScopeUrl() {
return this.$1V_3;
},
set_contextualScopeUrl: function Srch_DataProvider$set_contextualScopeUrl(value) {
this.$1V_3 = value;
return value;
},
$1V_3: '',
get_totalRows: function Srch_DataProvider$get_totalRows() {
return this.$8_3;
},
$8_3: 0,
get_rowCount: function Srch_DataProvider$get_rowCount() {
return this.$M_3;
},
$M_3: 0,
get_refinementInfo: function Srch_DataProvider$get_refinementInfo() {
return this.$n_3;
},
$n_3: null,
get_entityInfo: function Srch_DataProvider$get_entityInfo() {
return this.$U_3;
},
$U_3: null,
get_enableStemming: function Srch_DataProvider$get_enableStemming() {
return this.$1j_3;
},
set_enableStemming: function Srch_DataProvider$set_enableStemming(value) {
this.$1j_3 = value;
return value;
},
$1j_3: true,
get_enablePhonetic: function Srch_DataProvider$get_enablePhonetic() {
return this.$1h_3;
},
set_enablePhonetic: function Srch_DataProvider$set_enablePhonetic(value) {
this.$1h_3 = value;
return value;
},
$1h_3: false,
get_enableNicknames: function Srch_DataProvider$get_enableNicknames() {
return this.$1f_3;
},
set_enableNicknames: function Srch_DataProvider$set_enableNicknames(value) {
this.$1f_3 = value;
return value;
},
$1f_3: false,
get_trimDuplicates: function Srch_DataProvider$get_trimDuplicates() {
return this.$2H_3;
},
set_trimDuplicates: function Srch_DataProvider$set_trimDuplicates(value) {
this.$2H_3 = value;
return value;
},
$2H_3: true,
get_enableInterleaving: function Srch_DataProvider$get_enableInterleaving() {
return this.$1e_3;
},
set_enableInterleaving: function Srch_DataProvider$set_enableInterleaving(value) {
this.$1e_3 = value;
return value;
},
$1e_3: true,
get_enableQueryRules: function Srch_DataProvider$get_enableQueryRules() {
return this.$1i_3;
},
set_enableQueryRules: function Srch_DataProvider$set_enableQueryRules(value) {
this.$1i_3 = value;
return value;
},
$1i_3: true,
get_enableOrderingHitHighlightedProperty: function Srch_DataProvider$get_enableOrderingHitHighlightedProperty() {
return this.$1g_3;
},
set_enableOrderingHitHighlightedProperty: function Srch_DataProvider$set_enableOrderingHitHighlightedProperty(value) {
this.$1g_3 = value;
return value;
},
$1g_3: false,
get_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$get_hitHighlightedMultivaluePropertyLimit() {
return this.$1s_3;
},
set_hitHighlightedMultivaluePropertyLimit: function Srch_DataProvider$set_hitHighlightedMultivaluePropertyLimit(value) {
this.$1s_3 = value;
return value;
},
get_properties: function Srch_DataProvider$get_properties() {
if (!this.$1u_3) {
this.$1u_3 = {};
}
return this.$1u_3;
},
set_properties: function Srch_DataProvider$set_properties(value) {
this.$1u_3 = value;
return value;
},
$1u_3: null,
get_clientType: function Srch_DataProvider$get_clientType() {
return this.$2M_3;
},
set_clientType: function Srch_DataProvider$set_clientType(value) {
this.$2M_3 = value;
return value;
},
$2M_3: '',
get_clientFunction: function Srch_DataProvider$get_clientFunction() {
return this.$2L_3;
},
set_clientFunction: function Srch_DataProvider$set_clientFunction(value) {
this.$2L_3 = value;
return value;
},
$2L_3: '',
get_clientFunctionDetails: function Srch_DataProvider$get_clientFunctionDetails() {
return this.$3A_3;
},
set_clientFunctionDetails: function Srch_DataProvider$set_clientFunctionDetails(value) {
this.$3A_3 = value;
return value;
},
$3A_3: '',
get_maxPagesAfterCurrent: function Srch_DataProvider$get_maxPagesAfterCurrent() {
return this.$Y_3;
},
set_maxPagesAfterCurrent: function Srch_DataProvider$set_maxPagesAfterCurrent(value) {
this.$Y_3 = value;
return value;
},
$Y_3: 0,
get_userAction: function Srch_DataProvider$get_userAction() {
return this.$Q_3;
},
set_userAction: function Srch_DataProvider$set_userAction(value) {
this.$Q_3 = value;
return value;
},
$Q_3: 0,
get_queryCount: function Srch_DataProvider$get_queryCount() {
return this.$21_3;
},
set_queryCount: function Srch_DataProvider$set_queryCount(value) {
this.$21_3 = value;
return value;
},
$21_3: 0,
get_resultsUrl: function Srch_DataProvider$get_resultsUrl() {
if (!this.$2w_3) {
return ajaxNavigate.get_href();
}
return this.$2w_3;
},
set_resultsUrl: function Srch_DataProvider$set_resultsUrl(value) {
this.$2w_3 = value;
return value;
},
$2w_3: null,
get_upScopeUrl: function Srch_DataProvider$get_upScopeUrl() {
var $v_0 = Srch.ScriptApplicationManager.get_current().states['searchCenterUrl'];
if (!Srch.U.e($v_0)) {
$v_0 = Srch.U.concatUrl(Srch.U.replaceUrlTokens($v_0), String.format('results.aspx?k={0}', SP.Utilities.HttpUtility.urlKeyValueEncode(this.$2_3.k)));
}
return $v_0;
},
get_effectiveQueryLanguage: function Srch_DataProvider$get_effectiveQueryLanguage() {
var $v_0 = -1;
var $v_1 = '';
if ($v_0 < 1 && this.$1l_3 > 0) {
$v_0 = this.$1l_3;
$v_1 = ' from fallback language...';
}
if ($v_0 < 1 && this.$2_3.l > 0) {
$v_0 = this.$2_3.l;
$v_1 = ' from query state...';
}
if ($v_0 < 1) {
var $v_2 = this.get_queryDateTimeCulture();
if ($v_2 > 0) {
$v_0 = $v_2;
$v_1 = ' from querytimeculture language...';
}
}
if ($v_0 < 1) {
var $v_3 = Srch.ScriptApplicationManager.get_current().states['languages'];
if (!Srch.U.n($v_3) && $v_3.length > 0) {
var $v_4 = $v_3[0];
if (!Srch.U.n($v_4)) {
$v_0 = $v_4.id;
$v_1 = ' from default user preference language...';
}
}
}
if ($v_0 < 1) {
var $v_5 = Srch.ScriptApplicationManager.get_current().states['browserLanguage'];
if ($v_5 > 0) {
$v_0 = $v_5;
$v_1 = ' from browser language...';
}
}
this.$3_2('GetLanguage', 'Setting query language to \'{0}\'' + $v_1, $v_0);
return $v_0;
},
get_queryDateTimeCulture: function Srch_DataProvider$get_queryDateTimeCulture() {
return Srch.ScriptApplicationManager.get_current().states['QueryDateTimeCulture'];
},
get_effectiveLanguageDisplayName: function Srch_DataProvider$get_effectiveLanguageDisplayName() {
return Srch.ScriptApplicationManager.get_current().getDisplayNameByLanguageID(this.get_effectiveQueryLanguage());
},
get_$5K_3: function Srch_DataProvider$get_$5K_3() {
var $v_0 = null;
var $v_1 = 'Not using explicit sort...'