XML 地图");
frameDoc.close();
}
this._ignoreTimer = false;
this._currentEntry = entry;
if (this._historyFrame || this._historyPointIsNew) {
var currentHash = this.get_stateString();
if (entry !== currentHash) {
var loc = document.location;
if (loc.href.length - loc.hash.length + entry.length > 2048) {
throw Error.invalidOperation(String.format(Sys.Res.urlTooLong, 2048));
}
window.location.hash = entry;
this._currentEntry = this.get_stateString();
if ((typeof(title) !== 'undefined') && (title !== null)) {
document.title = title;
}
}
}
this._historyPointIsNew = false;
}
}
};
$prototype._updateHiddenField = function _Application$_updateHiddenField(value) {
if (this._clientId) {
var serverStateField = document.getElementById(this._clientId);
if (serverStateField) {
serverStateField.value = value;
}
}
};
if (!window.XMLHttpRequest) {
window.XMLHttpRequest = function window$XMLHttpRequest() {
var ex, progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ];
for (var i = 0, l = progIDs.length; i < l; i++) {
try {
return new ActiveXObject(progIDs[i]);
}
catch (ex) {
}
}
return null;
}
}
Type.registerNamespace('Sys.Net');
$type = Sys.Net.WebRequestExecutor = function WebRequestExecutor() {
///
Base class for WebRequestExecutors which handle the actual execution of a WebRequest
if (arguments.length !== 0) throw Error.parameterCount();
this._webRequest = null;
this._resultObject = null;
}
$type.prototype = {
get_started: function WebRequestExecutor$get_started() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_responseAvailable: function WebRequestExecutor$get_responseAvailable() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_timedOut: function WebRequestExecutor$get_timedOut() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_aborted: function WebRequestExecutor$get_aborted() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_responseData: function WebRequestExecutor$get_responseData() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_statusCode: function WebRequestExecutor$get_statusCode() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_statusText: function WebRequestExecutor$get_statusText() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
get_xml: function WebRequestExecutor$get_xml() {
///
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
executeRequest: function WebRequestExecutor$executeRequest() {
///
Begins execution of the request.
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
abort: function WebRequestExecutor$abort() {
///
Aborts the request.
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
getAllResponseHeaders: function WebRequestExecutor$getAllResponseHeaders() {
///
Returns all the responses header.
if (arguments.length !== 0) throw Error.parameterCount();
throw Error.notImplemented();
},
getResponseHeader: function WebRequestExecutor$getResponseHeader(header) {
///
Returns a response header.
///
The requested header.
var e = Function._validateParams(arguments, [
{name: "header", type: String}
]);
if (e) throw e;
throw Error.notImplemented();
},
get_webRequest: function WebRequestExecutor$get_webRequest() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._webRequest;
},
_set_webRequest: function WebRequestExecutor$_set_webRequest(value) {
if (this.get_started()) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest'));
}
this._webRequest = value;
},
get_object: function WebRequestExecutor$get_object() {
///
The JSON eval'd response.
if (arguments.length !== 0) throw Error.parameterCount();
var result = this._resultObject;
if (!result) {
this._resultObject = result = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData());
}
return result;
}
}
$type.registerClass('Sys.Net.WebRequestExecutor');
Sys.Net.XMLDOM = function XMLDOM(markup) {
///
Creates an XML document from an XML string.
///
The XML string to parse.
var e = Function._validateParams(arguments, [
{name: "markup", type: String}
]);
if (e) throw e;
if (!window.DOMParser) {
var ex, progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
for (var i = 0, l = progIDs.length; i < l; i++) {
try {
var xmlDOM = new ActiveXObject(progIDs[i]);
xmlDOM.async = false;
xmlDOM.loadXML(markup);
xmlDOM.setProperty('SelectionLanguage', 'XPath');
return xmlDOM;
}
catch (ex) {
}
}
}
else {
try {
var domParser = new window.DOMParser();
return domParser.parseFromString(markup, 'text/xml');
}
catch (ex) {
}
}
return null;
}
$type = Sys.Net.XMLHttpExecutor = function XMLHttpExecutor() {
///
XMLHttpExecutor
if (arguments.length !== 0) throw Error.parameterCount();
Sys.Net.XMLHttpExecutor.initializeBase(this);
var _this = this;
this._onReadyStateChange = (function () {
/*
readyState values:
0 = uninitialized
1 = loading
2 = loaded
3 = interactive
4 = complete
*/
if (_this._xmlHttpRequest.readyState === 4 /*complete*/) {
try {
if (typeof(_this._xmlHttpRequest.status) === "undefined") {
return;
}
}
catch(ex) {
return;
}
_this._clearTimer();
_this._responseAvailable = true;
_this._webRequest.completed(Sys.EventArgs.Empty);
if (_this._xmlHttpRequest) {
_this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
_this._xmlHttpRequest = null;
}
}
});
this._clearTimer = (function() {
if (_this._timer) {
window.clearTimeout(_this._timer);
_this._timer = null;
}
});
this._onTimeout = (function() {
if (!_this._responseAvailable) {
_this._clearTimer();
_this._timedOut = true;
var xhr = _this._xmlHttpRequest;
xhr.onreadystatechange = Function.emptyMethod;
xhr.abort();
_this._webRequest.completed(Sys.EventArgs.Empty);
_this._xmlHttpRequest = null;
}
});
}
$type.prototype = {
get_timedOut: function XMLHttpExecutor$get_timedOut() {
///
True if the executor has timed out.
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._timedOut;
},
get_started: function XMLHttpExecutor$get_started() {
///
True if the executor has started.
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._started;
},
get_responseAvailable: function XMLHttpExecutor$get_responseAvailable() {
///
True if a response is available.
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._responseAvailable;
},
get_aborted: function XMLHttpExecutor$get_aborted() {
///
True if the executor has been aborted.
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._aborted;
},
executeRequest: function XMLHttpExecutor$executeRequest() {
///
Invokes the request.
if (arguments.length !== 0) throw Error.parameterCount();
var request = this.get_webRequest();
this._webRequest = request;
if (this._started) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest'));
}
if (!this._webRequest) {
throw Error.invalidOperation(Sys.Res.nullWebRequest);
}
var body = request.get_body();
var headers = request.get_headers();
var xhr = new XMLHttpRequest();
this._xmlHttpRequest = xhr;
xhr.onreadystatechange = this._onReadyStateChange;
var verb = request.get_httpVerb();
xhr.open(verb, request.getResolvedUrl(), true /*async*/);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
if (headers) {
for (var header in headers) {
var val = headers[header];
if (typeof(val) !== "function")
xhr.setRequestHeader(header, val);
}
}
if (verb.toLowerCase() === "post") {
if ((headers === null) || !headers['Content-Type']) {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
}
if (!body) {
body = "";
}
}
var timeout = request.get_timeout();
if (timeout > 0) {
this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout);
}
xhr.send(body);
this._started = true;
},
getResponseHeader: function XMLHttpExecutor$getResponseHeader(header) {
///
Returns a response header.
///
The requested header.
///
The value of the header.
var e = Function._validateParams(arguments, [
{name: "header", type: String}
]);
if (e) throw e;
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader'));
}
var er, result;
try {
result = this._xmlHttpRequest.getResponseHeader(header);
} catch (er) {
}
if (!result) result = "";
return result;
},
getAllResponseHeaders: function XMLHttpExecutor$getAllResponseHeaders() {
///
Returns all the responses header.
///
The text of all the headers.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders'));
}
return this._xmlHttpRequest.getAllResponseHeaders();
},
get_responseData: function XMLHttpExecutor$get_responseData() {
///
The text of the response.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData'));
}
return this._xmlHttpRequest.responseText;
},
get_statusCode: function XMLHttpExecutor$get_statusCode() {
///
The status code of the response.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode'));
}
var ex, result = 0;
try {
result = this._xmlHttpRequest.status;
}
catch(ex) {
}
return result;
},
get_statusText: function XMLHttpExecutor$get_statusText() {
///
The status text of the repsonse.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText'));
}
return this._xmlHttpRequest.statusText;
},
get_xml: function XMLHttpExecutor$get_xml() {
///
The response in xml format.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._responseAvailable) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml'));
}
if (!this._xmlHttpRequest) {
throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml'));
}
var xhr = this._xmlHttpRequest;
var xml = xhr.responseXML;
if (!xml || !xml.documentElement) {
xml = Sys.Net.XMLDOM(xhr.responseText);
if (!xml || !xml.documentElement)
return null;
}
else if (navigator.userAgent.indexOf('MSIE') !== -1) {
xml.setProperty('SelectionLanguage', 'XPath');
}
if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" &&
xml.documentElement.tagName === "parsererror") {
return null;
}
if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") {
return null;
}
return xml;
},
abort: function XMLHttpExecutor$abort() {
///
Aborts the request.
if (arguments.length !== 0) throw Error.parameterCount();
if (!this._started) {
throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart);
}
if (this._aborted || this._responseAvailable || this._timedOut)
return;
this._aborted = true;
this._clearTimer();
var xhr = this._xmlHttpRequest;
if (xhr && !this._responseAvailable) {
xhr.onreadystatechange = Function.emptyMethod;
xhr.abort();
this._xmlHttpRequest = null;
this._webRequest.completed(Sys.EventArgs.Empty);
}
}
}
$type.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor);
$type = Sys.Net._WebRequestManager = function _WebRequestManager() {
///
if (arguments.length !== 0) throw Error.parameterCount();
this._defaultExecutorType = "Sys.Net.XMLHttpExecutor";
}
$type.prototype = {
add_invokingRequest: function _WebRequestManager$add_invokingRequest(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "invokingRequest", handler);
},
remove_invokingRequest: function _WebRequestManager$remove_invokingRequest(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "invokingRequest", handler);
},
add_completedRequest: function _WebRequestManager$add_completedRequest(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "completedRequest", handler);
},
remove_completedRequest: function _WebRequestManager$remove_completedRequest(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "completedRequest", handler);
},
get_defaultTimeout: function _WebRequestManager$get_defaultTimeout() {
///
The default timeout for requests in milliseconds.
if (arguments.length !== 0) throw Error.parameterCount();
return this._defaultTimeout || 0;
},
set_defaultTimeout: function _WebRequestManager$set_defaultTimeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
}
this._defaultTimeout = value;
},
get_defaultExecutorType: function _WebRequestManager$get_defaultExecutorType() {
///
The default executor type name.
if (arguments.length !== 0) throw Error.parameterCount();
return this._defaultExecutorType;
},
set_defaultExecutorType: function _WebRequestManager$set_defaultExecutorType(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._defaultExecutorType = value;
},
executeRequest: function _WebRequestManager$executeRequest(webRequest) {
///
Executes a request.
///
The webRequest to execute.
var e = Function._validateParams(arguments, [
{name: "webRequest", type: Sys.Net.WebRequest}
]);
if (e) throw e;
var executor = webRequest.get_executor();
if (!executor) {
var er, failed;
try {
var executorType = window.eval(this._defaultExecutorType);
executor = new executorType();
}
catch (er) {
failed = true;
}
if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) {
throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType));
}
webRequest.set_executor(executor);
}
if (!executor.get_aborted()) {
var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest);
Sys.Observer.raiseEvent(this, "invokingRequest", evArgs);
if (!evArgs.get_cancel()) {
executor.executeRequest();
}
}
}
}
$type.registerClass('Sys.Net._WebRequestManager');
Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager();
$type = Sys.Net.NetworkRequestEventArgs = function NetworkRequestEventArgs(webRequest) {
///
This class is raised by the WebRequestManager when a WebRequest is about to be executed.
///
The identifier for the event.
var e = Function._validateParams(arguments, [
{name: "webRequest", type: Sys.Net.WebRequest}
]);
if (e) throw e;
Sys.Net.NetworkRequestEventArgs.initializeBase(this);
this._webRequest = webRequest;
}
$type.prototype = {
get_webRequest: function NetworkRequestEventArgs$get_webRequest() {
///
The request about to be executed.
if (arguments.length !== 0) throw Error.parameterCount();
return this._webRequest;
}
}
$type.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs);
$type = Sys.Net.WebRequest = function WebRequest() {
///
WebRequest class
if (arguments.length !== 0) throw Error.parameterCount();
this._url = "";
this._headers = { };
this._body = null;
this._userContext = null;
this._httpVerb = null;
}
$type.prototype = {
add_completed: function WebRequest$add_completed(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.addEventHandler(this, "completed", handler);
},
remove_completed: function WebRequest$remove_completed(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
Sys.Observer.removeEventHandler(this, "completed", handler);
},
completed: function WebRequest$completed(eventArgs) {
///
The completed method should be called when the request is completed.
///
The event args to raise the event with.
var e = Function._validateParams(arguments, [
{name: "eventArgs", type: Sys.EventArgs}
]);
if (e) throw e;
function raise(source, sender, eventName) {
var handler = Sys.Observer._getContext(source, true).events.getHandler(eventName);
if (handler) {
handler(sender, eventArgs);
}
}
raise(Sys.Net.WebRequestManager, this._executor, "completedRequest");
raise(this, this._executor, "completed");
Sys.Observer.clearEventHandlers(this, "completed");
},
get_url: function WebRequest$get_url() {
///
The url.
if (arguments.length !== 0) throw Error.parameterCount();
return this._url;
},
set_url: function WebRequest$set_url(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._url = value;
},
get_headers: function WebRequest$get_headers() {
///
The headers dictionary for the request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._headers;
},
get_httpVerb: function WebRequest$get_httpVerb() {
///
The httpVerb for the request.
if (arguments.length !== 0) throw Error.parameterCount();
if (this._httpVerb === null) {
if (this._body === null) {
return "GET";
}
return "POST";
}
return this._httpVerb;
},
set_httpVerb: function WebRequest$set_httpVerb(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
if (value.length === 0) {
throw Error.argument('value', Sys.Res.invalidHttpVerb);
}
this._httpVerb = value;
},
get_body: function WebRequest$get_body() {
///
The body of the request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._body;
},
set_body: function WebRequest$set_body(value) {
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
if (e) throw e;
this._body = value;
},
get_userContext: function WebRequest$get_userContext() {
///
The userContext of the request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._userContext;
},
set_userContext: function WebRequest$set_userContext(value) {
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
if (e) throw e;
this._userContext = value;
},
get_executor: function WebRequest$get_executor() {
///
The executor for the request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._executor || null;
},
set_executor: function WebRequest$set_executor(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]);
if (e) throw e;
if (this._executor && this._executor.get_started()) {
throw Error.invalidOperation(Sys.Res.setExecutorAfterActive);
}
this._executor = value;
value._set_webRequest(this);
},
get_timeout: function WebRequest$get_timeout() {
///
The timeout in milliseconds for the request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._timeout || Sys.Net.WebRequestManager.get_defaultTimeout();
},
set_timeout: function WebRequest$set_timeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},
getResolvedUrl: function WebRequest$getResolvedUrl() {
///
The getResolvedUrl method returns the url resolved against the base url of the page if set.
///
The resolved url for the request.
if (arguments.length !== 0) throw Error.parameterCount();
return Sys.Net.WebRequest._resolveUrl(this._url);
},
invoke: function WebRequest$invoke() {
///
Invokes the request
if (arguments.length !== 0) throw Error.parameterCount();
if (this._invokeCalled) {
throw Error.invalidOperation(Sys.Res.invokeCalledTwice);
}
Sys.Net.WebRequestManager.executeRequest(this);
this._invokeCalled = true;
}
}
$type._resolveUrl = function WebRequest$_resolveUrl(url, baseUrl) {
if (url && url.indexOf('://') > 0) {
return url;
}
if (!baseUrl || !baseUrl.length) {
var baseElement = Sys.get('base');
if (baseElement && baseElement.href && baseElement.href.length) {
baseUrl = baseElement.href;
}
else {
baseUrl = document.URL;
}
}
var qsStart = baseUrl.indexOf('?');
if (qsStart > 0) {
baseUrl = baseUrl.substr(0, qsStart);
}
qsStart = baseUrl.indexOf('#');
if (qsStart > 0) {
baseUrl = baseUrl.substr(0, qsStart);
}
baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1);
if (!url || !url.length) {
return baseUrl;
}
if (url.charAt(0) === '/') {
var slashslash = baseUrl.indexOf('://');
if (slashslash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl1);
}
var nextSlash = baseUrl.indexOf('/', slashslash + 3);
if (nextSlash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl2);
}
return baseUrl.substr(0, nextSlash) + url;
}
else {
var lastSlash = baseUrl.lastIndexOf('/');
if (lastSlash === -1) {
throw Error.argument("baseUrl", Sys.Res.badBaseUrl3);
}
return baseUrl.substr(0, lastSlash+1) + url;
}
}
$type._createQueryString = function WebRequest$_createQueryString(queryString, encodeMethod, addParams) {
encodeMethod = encodeMethod || encodeURIComponent;
var i = 0, obj, val, arg, sb = new Sys.StringBuilder();
if (queryString) {
for (arg in queryString) {
obj = queryString[arg];
if (typeof(obj) === "function") continue;
val = Sys.Serialization.JavaScriptSerializer.serialize(obj);
if (i++) {
sb.append('&');
}
sb.append(arg);
sb.append('=');
sb.append(encodeMethod(val));
}
}
if (addParams) {
if (i) {
sb.append('&');
}
sb.append(addParams);
}
return sb.toString();
}
$type._createUrl = function WebRequest$_createUrl(url, queryString, addParams) {
if (!queryString && !addParams) {
return url;
}
var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams);
return qs.length
? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs
: url;
}
$type.registerClass('Sys.Net.WebRequest');
Type.registerNamespace('Sys.Net');
$type = Sys.Net.WebServiceProxy = function WebServiceProxy() {
var type = Object.getType(this);
if (type._staticInstance && (typeof(type._staticInstance.get_enableJsonp) === "function")) {
this._jsonp = (type._staticInstance.get_enableJsonp());
}
}
$type.prototype = {
get_timeout: function WebServiceProxy$get_timeout() {
///
The timeout in milliseconds for the service.
if (arguments.length !== 0) throw Error.parameterCount();
return this._timeout || 0;
},
set_timeout: function WebServiceProxy$set_timeout(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
if (e) throw e;
if (value < 0) {
throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout);
}
this._timeout = value;
},
get_defaultUserContext: function WebServiceProxy$get_defaultUserContext() {
///
The default userContext for this service.
if (arguments.length !== 0) throw Error.parameterCount();
return (typeof(this._userContext) === "undefined") ? null : this._userContext;
},
set_defaultUserContext: function WebServiceProxy$set_defaultUserContext(value) {
var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]);
if (e) throw e;
this._userContext = value;
},
get_defaultSucceededCallback: function WebServiceProxy$get_defaultSucceededCallback() {
///
Returns the default succeededCallback for this service.
if (arguments.length !== 0) throw Error.parameterCount();
return this._succeeded || null;
},
set_defaultSucceededCallback: function WebServiceProxy$set_defaultSucceededCallback(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
if (e) throw e;
this._succeeded = value;
},
get_defaultFailedCallback: function WebServiceProxy$get_defaultFailedCallback() {
///
Returns the default failedCallback for this service.
if (arguments.length !== 0) throw Error.parameterCount();
return this._failed || null;
},
set_defaultFailedCallback: function WebServiceProxy$set_defaultFailedCallback(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]);
if (e) throw e;
this._failed = value;
},
get_enableJsonp: function WebServiceProxy$get_enableJsonp() {
///
Specifies whether the service supports JSONP for cross domain calling.
if (arguments.length !== 0) throw Error.parameterCount();
return !!this._jsonp;
},
set_enableJsonp: function WebServiceProxy$set_enableJsonp(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
if (e) throw e;
this._jsonp = value;
},
get_path: function WebServiceProxy$get_path() {
///
The path to this service.
if (arguments.length !== 0) throw Error.parameterCount();
return this._path || null;
},
set_path: function WebServiceProxy$set_path(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._path = value;
},
get_jsonpCallbackParameter: function WebServiceProxy$get_jsonpCallbackParameter() {
///
Specifies the parameter name that contains the callback function name for a JSONP request.
if (arguments.length !== 0) throw Error.parameterCount();
return this._callbackParameter || "callback";
},
set_jsonpCallbackParameter: function WebServiceProxy$set_jsonpCallbackParameter(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._callbackParameter = value;
},
_invoke: function WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) {
///
///
Path to the webservice
///
Method to invoke
///
Controls whether requests use HttpGet
///
Method args.
///
Success callback
///
Failure callback
///
Success callback
///
Returns the request that was sent
var e = Function._validateParams(arguments, [
{name: "servicePath", type: String},
{name: "methodName", type: String},
{name: "useGet", type: Boolean},
{name: "params"},
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
{name: "userContext", mayBeNull: true, optional: true}
]);
if (e) throw e;
onSuccess = onSuccess || this.get_defaultSucceededCallback();
onFailure = onFailure || this.get_defaultFailedCallback();
if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext();
return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter());
}
}
$type.registerClass('Sys.Net.WebServiceProxy');
$type.invoke = function WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) {
///
///
Path to the webservice
///
Method to invoke
///
Controls whether requests use HttpGet
///
Method args.
///
Success callback
///
Failure callback
///
Success callback
///
Timeout in milliseconds
///
Whether to use JSONP if the servicePath is for a different domain (default is true).
///
The name of the callback parameter for JSONP request (default is callback).
///
Returns the request that was sent (null for JSONP requests).
var e = Function._validateParams(arguments, [
{name: "servicePath", type: String},
{name: "methodName", type: String, mayBeNull: true, optional: true},
{name: "useGet", type: Boolean, mayBeNull: true, optional: true},
{name: "params", mayBeNull: true, optional: true},
{name: "onSuccess", type: Function, mayBeNull: true, optional: true},
{name: "onFailure", type: Function, mayBeNull: true, optional: true},
{name: "userContext", mayBeNull: true, optional: true},
{name: "timeout", type: Number, mayBeNull: true, optional: true},
{name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true},
{name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true}
]);
if (e) throw e;
var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null,
tempCallback, jsonp = schemeHost && (schemeHost.length === 3) &&
((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host));
useGet = jsonp || useGet;
if (jsonp) {
jsonpCallbackParameter = jsonpCallbackParameter || "callback";
tempCallback = "_jsonp" + Sys._jsonp++;
}
if (!params) params = {};
var urlParams = params;
if (!useGet || !urlParams) urlParams = {};
var error, timeoutcookie = null, body = null,
url = Sys.Net.WebRequest._createUrl(methodName
? (servicePath+"/"+encodeURIComponent(methodName))
: servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null);
if (jsonp) {
function jsonpComplete(data, statusCode) {
if (timeoutcookie !== null) {
window.clearTimeout(timeoutcookie);
timeoutcookie = null;
}
delete Sys[tempCallback];
tempCallback = null;
if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) {
if (onFailure) {
error = new Sys.Net.WebServiceError(false,
data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName),
data.StackTrace || null,
data.ExceptionType || null,
data);
error._statusCode = statusCode;
onFailure(error, userContext, methodName);
}
else {
if (data.StackTrace && data.Message) {
error = data.StackTrace + "-- " + data.Message;
}
else {
error = data.StackTrace || data.Message;
}
error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error);
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
}
}
else if (onSuccess) {
onSuccess(data, userContext, methodName);
}
}
Sys[tempCallback] = jsonpComplete;
Sys._loadJsonp(url, function() {
if (tempCallback) {
jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1);
}
});
return null;
}
var request = new Sys.Net.WebRequest();
request.set_url(url);
request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
if (!useGet) {
body = Sys.Serialization.JavaScriptSerializer.serialize(params);
if (body === "{}") body = "";
}
request.set_body(body);
request.add_completed(onComplete);
if (timeout > 0) request.set_timeout(timeout);
request.invoke();
function onComplete(response, eventArgs) {
if (response.get_responseAvailable()) {
var ex, statusCode = response.get_statusCode();
var result = null;
var isJson;
try {
var contentType = response.getResponseHeader("Content-Type");
isJson = contentType.startsWith("application/json");
result = isJson ? response.get_object() :
(contentType.startsWith("text/xml") ? response.get_xml() : response.get_responseData());
}
catch (ex) {
}
var error = response.getResponseHeader("jsonerror");
var errorObj = (error === "true");
if (errorObj) {
if (result) {
result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result);
}
}
else if (isJson) {
result = (!result || (typeof(result.d) === "undefined")) ? result : result.d;
}
if (((statusCode < 200) || (statusCode >= 300)) || errorObj) {
if (onFailure) {
if (!result || !errorObj) {
result = new Sys.Net.WebServiceError(false /*timedout*/, String.format(Sys.Res.webServiceFailedNoMsg, methodName));
}
result._statusCode = statusCode;
onFailure(result, userContext, methodName);
}
else {
if (result && errorObj) {
error = result.get_exceptionType() + "-- " + result.get_message();
}
else {
error = response.get_responseData();
}
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
}
}
else if (onSuccess) {
onSuccess(result, userContext, methodName);
}
}
else {
var timedOut = response.get_timedOut(),
msg = String.format((timedOut ? Sys.Res.webServiceTimedOut : Sys.Res.webServiceFailedNoMsg), methodName);
if (onFailure) {
onFailure(new Sys.Net.WebServiceError(timedOut, msg, "", ""), userContext, methodName);
}
else {
throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg);
}
}
}
return request;
}
$type._createFailedError = function WebServiceProxy$_createFailedError(methodName, errorMessage) {
var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage;
var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName });
e.popStackFrame();
return e;
}
$type._defaultFailedCallback = function WebServiceProxy$_defaultFailedCallback(err, methodName) {
var error = err.get_exceptionType() + "-- " + err.get_message();
throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error));
}
$type._generateTypedConstructor = function WebServiceProxy$_generateTypedConstructor(type) {
return function(properties) {
if (properties) {
for (var name in properties) {
this[name] = properties[name];
}
}
this.__type = type;
}
}
Sys._jsonp = 0;
$type._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;
Sys._loadJsonp = function _loadJsonp(src, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
var attachEvent = script.attachEvent;
function onEvent() {
if (!attachEvent || /loaded|complete/.test(script.readyState)) {
if (attachEvent) {
script.detachEvent("onreadystatechange", onEvent);
}
else {
script.removeEventListener("load", onEvent, false);
script.removeEventListener("error", onEvent, false);
}
callback.apply(script);
script = null;
}
}
if (attachEvent) {
script.attachEvent("onreadystatechange", onEvent);
}
else {
script.addEventListener("load", onEvent, false);
script.addEventListener("error", onEvent, false);
}
Sys.get("head").appendChild(script);
}
$type = Sys.Net.WebServiceError = function WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) {
///
Represents a webservice error
///
Whether the service timed out.
///
The error message.
///
The stack trace of the error.
///
The server exception type.
///
The raw error information.
var e = Function._validateParams(arguments, [
{name: "timedOut", type: Boolean},
{name: "message", type: String, mayBeNull: true},
{name: "stackTrace", type: String, mayBeNull: true, optional: true},
{name: "exceptionType", type: String, mayBeNull: true, optional: true},
{name: "errorObject", type: Object, mayBeNull: true, optional: true}
]);
if (e) throw e;
this._timedOut = timedOut;
this._message = message;
this._stackTrace = stackTrace;
this._exceptionType = exceptionType;
this._errorObject = errorObject;
this._statusCode = -1;
}
$type.prototype = {
get_timedOut: function WebServiceError$get_timedOut() {
///
Whether the service failed due to timeout.
if (arguments.length !== 0) throw Error.parameterCount();
return this._timedOut;
},
get_statusCode: function WebServiceError$get_statusCode() {
///
Int representing the status of the response.
if (arguments.length !== 0) throw Error.parameterCount();
return this._statusCode;
},
get_message: function WebServiceError$get_message() {
///
Error message
if (arguments.length !== 0) throw Error.parameterCount();
return this._message;
},
get_stackTrace: function WebServiceError$get_stackTrace() {
///
Stack trace of the error.
if (arguments.length !== 0) throw Error.parameterCount();
return this._stackTrace || "";
},
get_exceptionType: function WebServiceError$get_exceptionType() {
///
Exception type of the error.
if (arguments.length !== 0) throw Error.parameterCount();
return this._exceptionType || "";
},
get_errorObject: function WebServiceError$get_errorObject() {
///
The raw error object returned by the service.
if (arguments.length !== 0) throw Error.parameterCount();
return this._errorObject || null;
}
}
$type.registerClass('Sys.Net.WebServiceError');
Type.registerNamespace("Sys.Services");
var ns = Sys.Services;
var service = "Service",
role = "Role",
auth = "Authentication",
profile = "Profile";
function setPath(path) {
this._path = path;
}
ns[auth+service] = {
set_path: setPath,
_setAuthenticated: function(auth) {
this._auth = auth;
}
};
ns["_" + auth + service] = {};
ns[profile + service] = { set_path: setPath };
ns["_" + profile + service] = {};
ns.ProfileGroup = function ns$ProfileGroup(properties) {
this._propertygroup = properties;
}
ns[role + service] = { set_path: setPath };
ns["_" + role + service] = {};
Sys._domLoaded();
}
if (Sys.loader) {
Sys.loader.registerScript("MicrosoftAjax", null, execute);
}
else {
execute();
}
})(window, window.Sys);
var $get, $create, $addHandler, $addHandlers, $clearHandlers;
Type.registerNamespace('Sys');
Sys.Res={
"argumentInteger":"Value must be an integer.",
"argumentType":"Object cannot be converted to the required type.",
"argumentNull":"Value cannot be null.",
"scriptAlreadyLoaded":"The script \u0027{0}\u0027 has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.",
"scriptDependencyNotFound":"The script \u0027{0}\u0027 failed to load because it is dependent on script \u0027{1}\u0027.",
"formatBadFormatSpecifier":"Format specifier was invalid.",
"requiredScriptReferenceNotIncluded":"\u0027{0}\u0027 requires that you have included a script reference to \u0027{1}\u0027.",
"webServiceFailedNoMsg":"The server method \u0027{0}\u0027 failed.",
"argumentDomElement":"Value must be a DOM element.",
"actualValue":"Actual value was {0}.",
"enumInvalidValue":"\u0027{0}\u0027 is not a valid value for enum {1}.",
"scriptLoadFailed":"The script \u0027{0}\u0027 could not be loaded.",
"parameterCount":"Parameter count mismatch.",
"cannotDeserializeEmptyString":"Cannot deserialize empty string.",
"formatInvalidString":"Input string was not in a correct format.",
"argument":"Value does not fall within the expected range.",
"cannotDeserializeInvalidJson":"Cannot deserialize. The data does not correspond to valid JSON.",
"cannotSerializeNonFiniteNumbers":"Cannot serialize non finite numbers.",
"argumentUndefined":"Value cannot be undefined.",
"webServiceInvalidReturnType":"The server method \u0027{0}\u0027 returned an invalid type. Expected type: {1}",
"servicePathNotSet":"The path to the web service has not been set.",
"argumentTypeWithTypes":"Object of type \u0027{0}\u0027 cannot be converted to type \u0027{1}\u0027.",
"paramName":"Parameter name: {0}",
"nullReferenceInPath":"Null reference while evaluating data path: \u0027{0}\u0027.",
"format":"One of the identified items was in an invalid format.",
"assertFailedCaller":"Assertion Failed: {0}\r\nat {1}",
"argumentOutOfRange":"Specified argument was out of the range of valid values.",
"webServiceTimedOut":"The server method \u0027{0}\u0027 timed out.",
"notImplemented":"The method or operation is not implemented.",
"assertFailed":"Assertion Failed: {0}",
"invalidOperation":"Operation is not valid due to the current state of the object.",
"breakIntoDebugger":"{0}\r\n\r\nBreak into debugger?",
"invokeCalledTwice":"Cannot call invoke more than once.",
"argumentTypeName":"Value is not the name of an existing type.",
"cantBeCalledAfterDispose":"Can\u0027t be called after dispose.",
"webServiceFailed":"The server method \u0027{0}\u0027 failed with the following error: {1}",
"componentCantSetIdAfterAddedToApp":"The id property of a component can\u0027t be set after it\u0027s been added to the Application object.",
"behaviorDuplicateName":"A behavior with name \u0027{0}\u0027 already exists or it is the name of an existing property on the target element.",
"notATypeName":"Value is not a valid type name.",
"elementNotFound":"An element with id \u0027{0}\u0027 could not be found.",
"stateMustBeStringDictionary":"The state object can only have null and string fields.",
"invalidExecutorType":"Could not create a valid Sys.Net.WebRequestExecutor from: {0}.",
"boolTrueOrFalse":"Value must be \u0027true\u0027 or \u0027false\u0027.",
"cannotCallBeforeResponse":"Cannot call {0} when responseAvailable is false.",
"scriptLoadFailedNoHead":"ScriptLoader requires pages to contain a \u003chead\u003e element.",
"stringFormatInvalid":"The format string is invalid.",
"referenceNotFound":"Component \u0027{0}\u0027 was not found.",
"enumReservedName":"\u0027{0}\u0027 is a reserved name that can\u0027t be used as an enum value name.",
"circularParentChain":"The chain of control parents can\u0027t have circular references.",
"namespaceContainsNonObject":"Object {0} already exists and is not an object.",
"undefinedEvent":"\u0027{0}\u0027 is not an event.",
"invalidTimeout":"Value must be greater than or equal to zero.",
"cannotAbortBeforeStart":"Cannot abort when executor has not started.",
"observableConflict":"Object already contains a member with the name \u0027{0}\u0027.",
"invalidHttpVerb":"httpVerb cannot be set to an empty or null string.",
"nullWebRequest":"Cannot call executeRequest with a null webRequest.",
"historyCannotEnableHistory":"Cannot set enableHistory after initialization.",
"eventHandlerInvalid":"Handler was not added through the Sys.UI.DomEvent.addHandler method.",
"scriptLoadFailedDebug":"The script \u0027{0}\u0027 failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \u0027Display a notification about every script error\u0027 under advanced settings.",
"propertyNotWritable":"\u0027{0}\u0027 is not a writable property.",
"enumInvalidValueName":"\u0027{0}\u0027 is not a valid name for an enum value.",
"cannotCallOnceStarted":"Cannot call {0} once started.",
"controlAlreadyDefined":"A control is already associated with the element.",
"addHandlerCantBeUsedForError":"Can\u0027t add a handler for the error event using this method. Please set the window.onerror property instead.",
"badBaseUrl1":"Base URL does not contain ://.",
"badBaseUrl2":"Base URL does not contain another /.",
"badBaseUrl3":"Cannot find last / in base URL.",
"setExecutorAfterActive":"Cannot set executor after it has become active.",
"cantAddNonFunctionhandler":"Can\u0027t add a handler that is not a function.",
"invalidNameSpace":"Value is not a valid namespace identifier.",
"notAnInterface":"Value is not a valid interface.",
"eventHandlerNotFunction":"Handler must be a function.",
"propertyNotAnArray":"\u0027{0}\u0027 is not an Array property.",
"namespaceContainsClass":"Object {0} already exists as a class, enum, or interface.",
"typeRegisteredTwice":"Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.",
"cantSetNameAfterInit":"The name property can\u0027t be set on this object after initialization.",
"historyMissingFrame":"For the history feature to work in IE, the page must have an iFrame element with id \u0027__historyFrame\u0027 pointed to a page that gets its title from the \u0027title\u0027 query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.",
"appDuplicateComponent":"Two components with the same id \u0027{0}\u0027 can\u0027t be added to the application.",
"historyCannotAddHistoryPointWithHistoryDisabled":"A history point can only be added if enableHistory is set to true.",
"expectedElementOrId":"Value must be a DOM element or DOM element id.",
"selectorNotFound":"An element with selector \u0027{0}\u0027 could not be found.",
"cannotCallOutsideHandler":"Cannot call {0} outside of a completed event handler.",
"methodNotFound":"No method found with name \u0027{0}\u0027.",
"arrayParseBadFormat":"Value must be a valid string representation for an array. It must start with a \u0027[\u0027 and end with a \u0027]\u0027.",
"cannotSerializeObjectWithCycle":"Cannot serialize object with cyclic reference within child properties.",
"stateFieldNameInvalid":"State field names must not contain any \u0027=\u0027 characters.",
"stringFormatBraceMismatch":"The format string contains an unmatched opening or closing brace.",
"enumValueNotInteger":"An enumeration definition can only contain integer values.",
"propertyNullOrUndefined":"Cannot set the properties of \u0027{0}\u0027 because it returned a null value.",
"expectedDomElementOrSelector":"\u0027{0}\u0027 must be a DOM element or DOM element selector.",
"argumentDomNode":"Value must be a DOM element or a text node.",
"componentCantSetIdTwice":"The id property of a component can\u0027t be set more than once.",
"createComponentOnDom":"Value must be null for Components that are not Controls or Behaviors.",
"createNoDom":"Value must not be null for Controls and Behaviors.",
"cantAddWithoutId":"Can\u0027t add a component that doesn\u0027t have an id.",
"urlTooLong":"The history state must be small enough to not make the url larger than {0} characters.",
"notObservable":"Instances of type \u0027{0}\u0027 cannot be observed.",
"badTypeName":"Value is not the name of the type being registered or the name is a reserved word."
};