This commit is contained in:
2024-11-05 10:47:20 -07:00
parent c801b1ff51
commit 5315c47fcd
276 changed files with 2990 additions and 6370 deletions

View File

@@ -208,29 +208,25 @@ Sys.Extended.UI.AccordionBehavior = function(element) {
// has content at div 2i+1).
Sys.Extended.UI.AccordionBehavior.initializeBase(this, [element]);
// The _selectedIndex variable is used to track the currently visible content
// pane. It is persisted via ClientState so that it can be restored on PostBack.
// If 0 <= _selectedIndex < _panes.Length is not true, then no pane is selected
// (and they all appear collapsed). While any index outside the bounds of the
// _panes array indicates that no pane is selected, we don't automatically set
// the value to a sentinel like -1 (especially on the server) because it's
// possible for additional panes to be added at any time. We abstract this
// problem using the getPane() function which returns the selected pane when
// it's called with no arguments (and returns null when the current selected
// index is invalid).
///<summary>
/// The _selectedIndex variable is used to track the currently visible content
/// pane. It is persisted via ClientState so that it can be restored on PostBack.
/// If 0 <= _selectedIndex < _panes.Length is not true, then no pane is selected
/// (and they all appear collapsed). While any index outside the bounds of the
/// _panes array indicates that no pane is selected, we don't automatically set
/// the value to a sentinel like -1 (especially on the server) because it's
/// possible for additional panes to be added at any time. We abstract this
/// problem using the getPane() function which returns the selected pane when
/// it's called with no arguments (and returns null when the current selected
/// index is invalid).
/// The index of a pane selected to display its content.
///</summary>
///<getter>get_selectedIndex</getter>
///<setter>set_selectedIndex</setter>
///<member name="cP:AjaxControlToolkit.Accordion.selectedIndex" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.selectedIndex" />
this._selectedIndex = 0;
///<summary>
/// Panes count.
///</summary>
///<getter>getCount</getter>
///<member name="cM:AjaxControlToolkit.Accordion.count" />
// The _panes array represents the collection of Accordion panes. Each element of
// the array is an object of the form {header, content, animation} corresponding
// to that pane's header section, content section, and the animation used to open
@@ -251,58 +247,58 @@ Sys.Extended.UI.AccordionBehavior = function(element) {
this._panes = [];
///<summary>
/// Whether or not to fade the accordion panes when transitioning
/// True - to use the fading transition effect for Accordion panes, false - for standard transitions.
///</summary>
///<getter>get_fadeTransitions</getter>
///<setter>set_fadeTransitions</setter>
///<member name="cP:AjaxControlToolkit.Accordion.fadeTransitions" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.fadeTransitions" />
this._fadeTransitions = false;
///<summary>
/// Length of time to transition between Accordion sections in
/// milleseconds. The default value is 250ms.
/// The number of milliseconds a transition effect takes to complete.
/// The default value is 250ms.
///</summary>
///<getter>get_transitionDuration</getter>
///<setter>set_transitionDuration</setter>
///<member name="cP:AjaxControlToolkit.Accordion.transitionDuration" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.transitionDuration" />
this._duration = 0.25;
///<summary>
/// A number of steps per second in transition animations.
/// The number of steps per second in transition animations.
/// The default value is 30 frames per second.
///</summary>
///<getter>get_framesPerSecond</getter>
///<setter>set_framesPerSecond</setter>
///<member name="cP:AjaxControlToolkit.Accordion.framesPerSecond" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.framesPerSecond" />
this._framesPerSecond = 30;
///<summary>
/// Determines how to control resizing of the Accordion.
/// If it is set to None, then the Accordion can grow as large or as small as necessary.
/// If it is set to Limit, then the Accordion will always be less than or equal to its available space.
/// If it is set to Fill, then it will always be equal to its available space.
/// Controls how the Accordion changes its size to occupy space on a web page.
///</summary>
///<remarks>
/// If set to None, the Accordion grows/shrinks vertically without restriction when its pane is expanded/collapsed; this can cause other elements on a web page to move up and down with it.
/// If set to Limit, the Accordion never grows larger than the value specified by its Height property; this will cause the Accordion content to scroll if it is too large to be displayed.
/// If set to Fill, the Accordion always keeps the same size as its Height property. This will cause the content to be expanded or shrunk if it isn't of the right size.
///</remarks>
///<getter>get_autoSize</getter>
///<member name="cP:AjaxControlToolkit.Accordion.autoSize" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.autoSize" />
this._autoSize = Sys.Extended.UI.AutoSize.None;
///<summary>
/// Whether or not clicking the header will close the currently opened pane (which
/// leaves all the Accordion's panes closed).
/// True - to force the Accordion to always have one pane expanded, false - to enable end-users to close all panes.
///</summary>
///<getter>get_requireOpenedPane</getter>
///<setter>set_requireOpenedPane</setter>
///<member name="cP:AjaxControlToolkit.Accordion.requireOpenedPane" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.requireOpenedPane" />
this._requireOpenedPane = true;
///<summary>
/// Whether or not we suppress the client-side click handlers of any elements
/// (including server controls like Button or HTML elements like anchor) in the header
/// sections of the Accordion.
/// A Boolean value specifying whether the Accordion control will not be interrupted by the default click event of the anchor tag specified in the header element's template.
/// If set to true, this property prevents any client event handler that may interrupt the activity of the Accordion control.
///</summary>
///<getter>get_suppressHeaderPostbacks</getter>
///<setter>set_suppressHeaderPostbacks</setter>
///<member name="cP:AjaxControlToolkit.Accordion.suppressHeaderPostbacks" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.suppressHeaderPostbacks" />
this._suppressHeaderPostbacks = false;
// Size of all the headers
@@ -313,19 +309,19 @@ Sys.Extended.UI.AccordionBehavior = function(element) {
this._headerClickHandler = null;
///<summary>
/// The _headerSelectedCssClass is the css class applied to the selected header.
/// The name of the CSS class applied to headers.
///</summary>
///<getter>get_headerCssClass</getter>
///<setter>set_headerCssClass</setter>
///<member name="cP:AjaxControlToolkit.Accordion.headerCssClass" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.headerCssClass" />
this._headerCssClass = '';
///<summary>
/// The _headerSelectedCssClass is the css class applied to the selected header.
/// The name of the CSS class applied to the selected header.
///</summary>
///<getter>get_headerSelectedCssClass</getter>
///<setter>get_headerSelectedCssClass</setter>
///<member name="cP:AjaxControlToolkit.Accordion.headerSelectedCssClass" />
///<member name="cP:AjaxControlToolkit.AccordionExtender.headerSelectedCssClass" />
this._headerSelectedCssClass = '';
// The _resizeHandler is a reference to the global event handler used to patch
@@ -334,6 +330,8 @@ Sys.Extended.UI.AccordionBehavior = function(element) {
// Check the browser version and document mode to see if IE8 in standards-compliant mode is used
this._isIE8InStandardMode = (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version > 7 && Sys.Browser.documentMode != 0);
this._paneHeaderClassNames = [];
}
Sys.Extended.UI.AccordionBehavior.prototype = {
// The initialize function is responsible for getting the selected index from
@@ -415,13 +413,12 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
},
///<summary>
/// Create a new Accordion pane given references to its header and content divs
/// and add it to the _panes collection. We also wrap the content div in a new
/// container div, add a click handler to the header div, etc.
/// Creates a new Accordion pane and adds it to the Panes collection.
/// The method provides references to the created pane's header and content DIVs.
///</summary>
/// <param name="header" type="Object">header element of the new Accordion pane</param>
/// <param name="content" type="Object">content element of the new Accordion pane</param>
/// <member name="cM:AjaxControlToolkit.Accordion.addPane" />
/// <member name="cM:AjaxControlToolkit.AccordionExtender.addPane" />
addPane: function(header, content) {
// New pane object added to the end of the Accordion's pane collection. The pane
// is an object of the form {header, content, animation} corresponding to that
@@ -467,6 +464,8 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
// Add the new pane at the bottom of the accordion
Array.add(this._panes, pane);
this._paneHeaderClassNames.push(pane.header.className);
// Setup the layout attributes for the pane so that it will be in a proper opened or
// closed state (we don't bother setting the opacity of the wrapper with
// $common.setElementOpacity(wrapper, selected ? 1 : 0); because it will
@@ -637,7 +636,9 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
}
}
pane.header.className = this._selectedIndex === index ? (this._headerSelectedCssClass || this._headerCssClass) : this._headerCssClass;
pane.header.className = this._selectedIndex === index
? (this._headerSelectedCssClass || this._headerCssClass)
: (this._paneHeaderClassNames[index] || this._headerCssClass);
},
_addResizeHandler: function() {
@@ -813,7 +814,7 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
//This sets the header CSS class to the non-selected case.
if(lastPane) {
lastPane.header.className = this._headerCssClass;
lastPane.header.className = this._paneHeaderClassNames[lastIndex] || this._headerCssClass;
}
//This sets the selected header CSS class if available.
@@ -1099,9 +1100,9 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
},
///<summary>
/// Fires when an Accordion pane is clicked, but before Accordion changes the pane.
/// Fires after a pane header is clicked but before the Accordion changes the selected pane.
///</summary>
///<member name="cE:AjaxControlToolkit.Accordion.selectedIndexChanging" />
///<member name="cE:AjaxControlToolkit.AccordionExtender.selectedIndexChanging" />
///<event add="add_selectedIndexChanging" remove="remove_selectedIndexChanging" raise="raise_selectedIndexChanging" />
add_selectedIndexChanging: function(handler) {
this.get_events().addHandler('selectedIndexChanging', handler);
@@ -1121,9 +1122,9 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
},
///<summary>
/// Fires when an Accordion pane is clicked, but after Accordion changes the pane.
/// Fires after a pane header is clicked and the Accordion changes the selected pane.
///</summary>
///<member name="cE:AjaxControlToolkit.Accordion.selectedIndexChanged" />
///<member name="cE:AjaxControlToolkit.AccordionExtender.selectedIndexChanged" />
///<event add="add_selectedIndexChanged" remove="remove_selectedIndexChanged" raise="raise_selectedIndexChanged" />
add_selectedIndexChanged: function(handler) {
this.get_events().addHandler('selectedIndexChanged', handler);
@@ -1143,12 +1144,12 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
},
/// <summary>
/// Get a specific Accordion pane given its index. If no index is provided, get the currently selected pane.
/// Returns an Accordion pane specified by its index. If no index is provided, the currently selected pane is returned.
/// </summary>
/// <param name="index" type="Number">index of the desired Accordion pane. If the index is not provided, we use
/// the currently selected index. In the event the provided index (or the currently
/// selected index) is outside the bounds of the panes collection, we return null.</param>
/// <member name="cM:AjaxControlToolkit.Accordion.getPane" />
/// <member name="cM:AjaxControlToolkit.AccordionExtender.getPane" />
getPane: function(index) {
if(index === undefined || index === null) {
index = this._selectedIndex;
@@ -1161,9 +1162,9 @@ Sys.Extended.UI.AccordionBehavior.prototype = {
},
///<summary>
/// Panes count.
/// Returns the total number of panes.
///</summary>
/// <member name="cM:AjaxControlToolkit.Accordion.getCount" />
/// <member name="cM:AjaxControlToolkit.AccordionExtender.getCount" />
getCount: function() {
return this._panes ? this._panes.length : 0;
},

View File

@@ -2,6 +2,11 @@
// Utils
Sys.Extended.UI.AjaxFileUpload.Utils = function() {
function getExtension(filename) {
var extensionStartIndex = filename.lastIndexOf('.') + 1;
return extensionStartIndex ? filename.substring(extensionStartIndex) : "";
}
this.generateGuid = function() {
var result, i, j;
@@ -41,7 +46,7 @@ Sys.Extended.UI.AjaxFileUpload.Utils = function() {
}
}
return encodeURIComponent(result);
return result;
};
this.getFileType = function(file) {
@@ -49,7 +54,7 @@ Sys.Extended.UI.AjaxFileUpload.Utils = function() {
throw 'file must defined or not null';
if(!file.value && file.name)
return file.name.substring(file.name.lastIndexOf('.') + 1);
return getExtension(file.name);
if(file.value)
file = file.value;
@@ -57,7 +62,7 @@ Sys.Extended.UI.AjaxFileUpload.Utils = function() {
if(typeof (file) !== "string")
throw "can't resolve file type.";
return file.substring(file.lastIndexOf('.') + 1);
return getExtension(file);
};
this.sizeToString = function(bytes) {
@@ -155,18 +160,19 @@ Sys.Extended.UI.AjaxFileUpload.Item.prototype = {
});
this._fileName = utils.getFileName(file);
var fileNameToDisplay = decodeURIComponent(this._fileName);
var htmlEncode = Sys.Extended.UI.htmlEncode;
if(isHtml5Support) {
this._fileSize = file.size;
var fType = file.type ? '<span class="filetype">(' + file.type + ')</span>' : '';
fileInfoText.innerHTML = '<span class="filename">' + fileNameToDisplay + '</span> '
var fType = file.type ? '<span class="filetype">(' + htmlEncode(file.type) + ')</span>' : '';
fileInfoText.innerHTML = '<span class="filename">' + htmlEncode(this._fileName) + '</span> '
+ fType
+ ' - <span class="filesize">' + utils.sizeToString(file.size) + '</span> ';
this._fileType = file.type;
} else {
fileInfoText.innerHTML = '<span class="filename">' + fileNameToDisplay + '</span>';
fileInfoText.innerHTML = '<span class="filename">' + htmlEncode(this._fileName) + '</span>';
this._fileType = utils.getFileType(file);
}
@@ -302,13 +308,19 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
};
if(control.fileTypeIsValid(fileItem.type)) {
control.addFileToQueue(fileItem);
this.createInputFileElement();
} else {
if(!control.fileTypeIsValid(fileItem.type)) {
control.confirmFileIsInvalid(fileItem);
return;
}
if(control.fileSizeExceeded(fileItem.value.size)) {
control.confirmFileIsTooLarge(fileItem);
return;
}
control.addFileToQueue(fileItem);
this.createInputFileElement();
};
this.createInputFileElement = function() {
@@ -331,7 +343,8 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
zIndex: 0,
cursor: 'pointer',
position: 'absolute'
}
},
multiple: true
}
}, currentInputFile.parentNode);
@@ -374,7 +387,12 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
// only add 1 file input element to be uploaded
form.appendChild(inputElement);
form.setAttribute("action", control._uploadUrl + '?contextKey=' + control.get_id() + '&fileId=' + control._currentFileId + '&fileName=' + fileItem._fileName + '&usePoll=' + (control.get_serverPollingSupport() ? "true" : "false"));
form.setAttribute("action", control.get_uploadHandlerPath()
+ '?contextKey=' + control.get_contextKey()
+ '&controlID=' + control.get_id()
+ '&fileId=' + control._currentFileId
+ '&fileName=' + encodeURIComponent(fileItem._fileName)
+ '&usePoll=' + (control.get_serverPollingSupport() ? "true" : "false"));
// upload it now
form.submit();
@@ -389,7 +407,12 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
if(xhrPoll)
xhrPoll.abort();
xhr.open("POST", '?contextKey=' + control.get_id() + "&cancel=1&guid=" + control._currentFileId, true);
xhr.open("POST",
'?contextKey=' + control.get_contextKey()
+ '&controlID=' + control.get_id()
+ '&cancel=1&guid=' + control._currentFileId
+ self.getQueryString(), true);
xhr.onreadystatechange = function() {
self.setThrobber(false);
if(xhr.readyState == 4) {
@@ -405,6 +428,10 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
xhr.send(null);
},
this.getQueryString = function() {
return "&" + window.location.search.replace("?", "");
},
this.createIFrame = function() {
var name = this._iframeName,
@@ -486,7 +513,10 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
if(!value || !control._currentFileId)
return;
xhrPoll.open("GET", '?contextKey=' + control.get_id() + "&poll=1&guid=" + control._currentFileId, true);
xhrPoll.open("GET",
'?contextKey=' + control.get_contextKey()
+ '&controlID=' + control.get_id()
+ '&poll=1&guid=' + control._currentFileId, true);
xhrPoll.send(null);
};
@@ -516,13 +546,16 @@ Sys.Extended.UI.AjaxFileUpload.Processor = function(control, elements) {
this.raiseUploadError = function(xhr) {
control.raise_uploadError(xhr);
control.setFileStatus(control._currentFileId, 'error', Sys.Extended.UI.Resources.AjaxFileUpload_error);
if(xhrPoll)
xhrPoll.abort();
control._currentFileId = null;
};
this.resetUI = function() {
control.setFileStatus(control._currentFileId, 'error', Sys.Extended.UI.Resources.AjaxFileUpload_error);
};
};
// ProcessorHtml5
@@ -557,7 +590,16 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
this.onFileDroppedHandler = function(e) {
e.stopPropagation();
e.preventDefault();
if(!control.get_enabled())
return;
this.addFilesToQueue(e.dataTransfer.files);
if (control.get_autoStartUpload()) {
control.startUpload();
}
};
this.onFileDragOverHandler = function(e) {
@@ -568,11 +610,15 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
this.onFileSelectedHandler = function(e) {
this.addFilesToQueue(e.target.files);
this.createInputFileElement();
if (control.get_autoStartUpload()) {
control.startUpload();
}
};
this.createInputFileElement = function() {
var currentInputFile = elements.inputFile;
delete currentInputFile;
// create new input file element in same location
@@ -587,7 +633,8 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
zIndex: 0,
cursor: 'pointer',
position: 'absolute'
}
},
multiple: true
}
}, currentInputFile.parentNode);
@@ -607,10 +654,10 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
// #endregion
this.addFilesToQueue = function(files) {
// Validate and generate file item from HTML5 files.
this.addFilesToQueue = function (files) {
for(var i = 0; i < files.length; i++) {
// Validate and generate file item from HTML5 files.
for (var i = 0; i < files.length; i++) {
var blob = files[i],
slices = 0;
@@ -630,12 +677,19 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
};
// validate it, add it if it's OK
if(control.fileTypeIsValid(fileItem.type)) {
if(!control.addFileToQueue(fileItem))
break;
} else {
if(!control.fileTypeIsValid(fileItem.type)) {
control.confirmFileIsInvalid(fileItem);
continue;
}
if(control.fileSizeExceeded(fileItem.value.size))
{
control.confirmFileIsTooLarge(fileItem);
continue;
}
if(!control.addFileToQueue(fileItem))
break;
}
// reset input file value so 'change' event can be fired again with same file name.
@@ -668,6 +722,15 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
}
};
this.resetUI = function() {
$common.setVisible(elements.progressBarContainer, false);
$common.setVisible(control._elements.uploadOrCancelButton, false);
var fileItem = control.getNextFile();
fileItem._isUploaded = true;
fileItem._isUploading = false;
},
this.upload = function(fileItem) {
if(!control._isUploading)
return;
@@ -680,7 +743,6 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
// preparing upload data
var blob = fileItem.get_inputElementValue(),
fileName = fileItem._fileName,
chunked = fileItem._slices && (fileItem._slices > 0),
firstChunk = fileItem._sliceIndex == 0;
@@ -701,7 +763,15 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
xhrReq.addEventListener("load", xhrDelegate(this.onUploadCompleteHandler), false);
xhrReq.addEventListener("error", xhrDelegate(this.onUploadFailedHandler), false);
xhrReq.addEventListener("abort", xhrDelegate(this.onUploadCanceledHandler), false);
xhrReq.open("POST", control._uploadUrl + '?contextKey=' + control.get_id() + '&fileId=' + id + '&fileName=' + fileName + '&chunked=' + (chunked ? "true" : "false") + '&firstChunk=' + firstChunk, true);
xhrReq.open("POST",
control.get_uploadHandlerPath()
+ '?contextKey=' + control.get_contextKey()
+ '&controlID=' + control.get_id()
+ '&fileId=' + id
+ '&fileName=' + encodeURIComponent(fileItem._fileName)
+ '&chunked=' + (chunked ? "true" : "false")
+ '&firstChunk=' + firstChunk, true);
form.append("act-file-data", blob);
xhrReq.send(form);
};
@@ -761,7 +831,7 @@ Sys.Extended.UI.AjaxFileUpload.ProcessorHtml5 = function(control, elements) {
// set statuses as uploaded
fileItem.setStatus('uploaded', Sys.Extended.UI.Resources.AjaxFileUpload_Uploaded);
control.setStatusMessage(String.format(Sys.Extended.UI.Resources.AjaxFileUpload_UploadingHtml5File,
file.name, utils.sizeToString(file.size)));
Sys.Extended.UI.htmlEncode(file.name), utils.sizeToString(file.size)));
// finalizing and upload next file
control.doneAndUploadNextFile(fileItem);
@@ -896,13 +966,24 @@ Sys.Extended.UI.AjaxFileUpload.Control = function(element) {
this._postBackUrl = null;
/// <summary>
/// How AjaxFileUpload displays a progress bar.
/// Specifies how AjaxFileUpload uploads files.
/// If set to Auto or Client and the client browser supports HTML 5, AjaxFileUpload uploads files using AJAX requests.
/// If set to Server or the browser does not support HTML 5, AjaxFileUpload uploads files by posting the HTML form.
/// The default is Auto.
/// </summary>
/// <getter>get_mode</getter>
/// <setter>set_mode</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.mode" />
this._mode = 0;
/// <summary>
/// Whether or not automatically start upload files after drag/drop or select in file dialog. The default is false
/// </summary>
/// <getter>get_autoStartUpload</getter>
/// <setter>set_autoStartUpload</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.autoStartUpload" />
this._autoStartUpload = false;
/// <summary>
/// Whether or not AjaxFileUpload supports server polling.
/// </summary>
@@ -947,8 +1028,37 @@ Sys.Extended.UI.AjaxFileUpload.Control = function(element) {
this._clearFileListAfterUpload = false;
// fields
this._uploadUrl = 'AjaxFileUploadHandler.axd';
/// <summary>
/// Whether or not to use absolute path for AjaxFileUploadHandler
/// </summary>
/// <getter>get_useAbsoluteHandlerPath</getter>
/// <setter>set_useAbsoluteHandlerPath</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.useAbsoluteHandlerPath" />
this._useAbsoluteHandlerPath = true;
/// <summary>
/// The maximum size of a file to be uploaded in Kbytes.
/// A non-positive value means the size is unlimited.
/// </summary>
/// <getter>get_maxFileSize</getter>
/// <setter>set_maxFileSize</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.maxFileSize" />
this._maxFileSize = 0;
/// <summary>
/// The path to the upload handler.
/// </summary>
/// <getter>get_uploadHandlerPath</getter>
/// <setter>set_uploadHandlerPath</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.uploadHandlerPath" />
this._uploadHandlerPath = '';
/// <summary>
/// Whether the control is enabled.
/// </summary>
/// <getter>get_enabled</getter>
/// <setter>set_enabled</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.enabled" />
this._enabled = true;
this._useHtml5Support = false;
this._elements = null;
this._processor = null;
@@ -1055,6 +1165,10 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
},
_onUploadOrCancelButtonClickedHandler: function(e) {
var files = this._filesInQueue;
if(!this.validateFiles(files))
return;
if(!files.length) {
alert(Sys.Extended.UI.Resources.AjaxFileUpload_SelectFileToUpload);
return;
@@ -1083,8 +1197,11 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
var xhr = new XMLHttpRequest(),
self = this;
xhr.open("POST", '?contextKey=' + this.get_id()
+ "&start=1&queue=" + this._filesInQueue.length);
xhr.open("POST",
'?contextKey=' + this.get_contextKey()
+ '&controlID=' + this.get_id()
+ '&start=1&queue=' + this._filesInQueue.length
+ this.getQueryString());
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.status == 200) {
@@ -1092,6 +1209,7 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
self.raise_uploadStart(Sys.Serialization.JavaScriptSerializer.deserialize(xhr.responseText));
} else {
self.raise_uploadError(xhr);
self.setFileStatus(fileItem, 'error', Sys.Extended.UI.Resources.AjaxFileUpload_error);
throw "Failed to starting upload.";
}
}
@@ -1111,6 +1229,30 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
}
},
/// <summary>
/// Validates files in queue before uploading.
/// Returns true if validation is passed, otherwise false
/// </summary>
/// <member name="cM:AjaxControlToolkit.AjaxFileUpload.validateFiles" />
/// <param name="files" type="Object">An array of files in the upload queue</param>
validateFiles: function(files)
{
return true;
},
/// <summary>
/// Manually starts upload process
/// </summary>
/// <member name="cM:AjaxControlToolkit.AjaxFileUpload.startUpload" />
startUpload: function () {
if (this._isUploading || !this._filesInQueue.length) {
return;
}
this._onUploadOrCancelButtonClickedHandler();
},
/// <summary>
/// If set to true, it will set the control state to enabled (ready to upload),
/// otherwise the control will be disabled and the button state turns to the Cancel button.
@@ -1147,10 +1289,13 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
self = this,
currentFile = this._filesInQueue[this._currentQueueIndex - 1];
xhr.open("POST", '?contextKey=' + this.get_id()
+ "&complete=1&queue=" + this._filesInQueue.length
+ "&uploaded=" + (this._currentQueueIndex - (currentFile._isUploaded ? 0 : 1))
+ "&reason=" + (this._canceled ? "cancel" : "done"));
xhr.open("POST",
'?contextKey=' + this.get_contextKey()
+ '&controlID=' + this.get_id()
+ '&complete=1&queue=' + this._filesInQueue.length
+ '&uploaded=' + (this._currentQueueIndex - (currentFile._isUploaded ? 0 : 1))
+ '&reason=' + (this._canceled ? "cancel" : "done")
+ this.getQueryString());
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
@@ -1158,12 +1303,13 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
self.raise_uploadCompleteAll(Sys.Serialization.JavaScriptSerializer.deserialize(xhr.responseText));
} else {
self.raise_uploadError(xhr);
self.setFileStatus(fileItem, 'error', Sys.Extended.UI.Resources.AjaxFileUpload_error);
throw "Failed to completing upload.";
}
}
};
xhr.send(null);
if(this.get_clearFileListAfterUpload()) {
for(var i = 0; i < this._filesInQueue.length; i += 1) {
var item = this._filesInQueue[i];
@@ -1272,16 +1418,43 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
return false;
},
/// <summary>
/// Checks if the file size is larger than the upload size limit.
/// </summary>
/// <member name="cM:AjaxControlToolkit.AjaxFileUpload.fileSizeExceeded" />
/// <param name="fileSize" type="Number">File size in bytes</param>
fileSizeExceeded: function(fileSize) {
if(this.get_maxFileSize() <= 0)
return false;
return fileSize > this.getMaxFileSizeInBytes();
},
/// <summary>
/// Sends alert to a user that the file type is not acceptable. The processor uses this method after validation.
/// </summary>
/// <member name="cM:AjaxControlToolkit.AjaxFileUpload.confirmFileIsInvalid" />
/// <param name="fileItem" type="Object">File trying to be added to queue</param>
/// <param name="fileItem" type="Object">A file attempting to be added to the upload queue.</param>
confirmFileIsInvalid: function(fileItem) {
var utils = new Sys.Extended.UI.AjaxFileUpload.Utils();
alert(String.format(Sys.Extended.UI.Resources.AjaxFileUpload_WrongFileType, utils.getFileName(fileItem.value), fileItem.type));
},
/// <summary>
/// Sends alert to a user that the file size is too large. The processor uses this method after validation.
/// </summary>
/// <member name="cM:AjaxControlToolkit.AjaxFileUpload.confirmFileIsTooLarge" />
/// <param name="fileItem" type="Object">A file attempting to be added to the upload queue.</param>
confirmFileIsTooLarge: function(fileItem) {
var utils = new Sys.Extended.UI.AjaxFileUpload.Utils();
alert(String.format(Sys.Extended.UI.Resources.AjaxFileUpload_TooLargeFile, utils.getFileName(fileItem.value), this.get_maxFileSize()));
},
getMaxFileSizeInBytes: function()
{
return this.get_maxFileSize() * 1024;
},
/// <summary>
/// Marks fileItem as uploaded, and uploads the next file in a queue.
/// </summary>
@@ -1292,10 +1465,15 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
var xhr = new XMLHttpRequest(),
self = this;
xhr.open("POST", "?contextKey=" + this.get_id() + "&done=1&guid=" + fileItem._id, true);
xhr.open("POST",
'?contextKey=' + this.get_contextKey()
+ '&controlID=' + this.get_id()
+ '&done=1&guid=' + fileItem._id
+ this.getQueryString(), true);
xhr.onreadystatechange = function(e) {
if(xhr.readyState == 4) {
if(xhr.status == 200) {
if(xhr.status == 200 && xhr.responseText != "") {
// Mark as done and invoke event handler
self.raise_uploadComplete(Sys.Serialization.JavaScriptSerializer.deserialize(xhr.responseText));
@@ -1311,7 +1489,11 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
}
}
};
xhr.send(null);
xhr.send();
},
getQueryString: function() {
return "&" + window.location.search.replace("?", "");
},
/// <summary>
@@ -1349,7 +1531,7 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
this._currentQueueIndex = Array.indexOf(this._filesInQueue, fileItem) + 1;
this.setFileStatus(fileItem, 'uploading', Sys.Extended.UI.Resources.AjaxFileUpload_Uploading);
this.setStatusMessage('Uploading ' + this._currentQueueIndex + ' of ' + this._filesInQueue.length + ' file(s)');
this.setStatusMessage(String.format(Sys.Extended.UI.Resources.AjaxFileUpload_UploadingFileInQueue, this._currentQueueIndex, this._filesInQueue.length));
},
/// <summary>
@@ -1419,6 +1601,13 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
this._mode = value;
},
get_autoStartUpload: function () {
return this._autoStartUpload;
},
set_autoStartUpload: function (value) {
this._autoStartUpload = value;
},
get_serverPollingSupport: function() {
return this._serverPollingSupport;
},
@@ -1449,7 +1638,7 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
/// <summary>
/// Whether or not to hide the file upload list container after uploading finished
/// </summary
/// </summary>
/// <getter>get_clearQueueContainerAfterUpload</getter>
/// <setter>set_clearQueueContainerAfterUpload</setter>
/// <member name="cP:AjaxControlToolkit.AjaxFileUpload.clearQueueContainerAfterUpload" />
@@ -1460,6 +1649,33 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
this._clearFileListAfterUpload = value;
},
get_useAbsoluteHandlerPath: function() {
return this._useAbsoluteHandlerPath;
},
set_useAbsoluteHandlerPath: function(value) {
this._useAbsoluteHandlerPath = value;
},
get_maxFileSize: function() {
return this._maxFileSize;
},
set_maxFileSize: function(value) {
this._maxFileSize = value;
},
get_uploadHandlerPath: function () {
return this._uploadHandlerPath;
},
set_uploadHandlerPath: function (value) {
this._uploadHandlerPath = value;
},
get_enabled: function () {
return this.enabled;
},
set_enabled: function (value) {
this.enabled = value;
},
/// <summary>
/// Occurs when the file upload starts
/// </summary>
@@ -1570,8 +1786,11 @@ Sys.Extended.UI.AjaxFileUpload.Control.prototype = {
eh(this, e);
}
this._processor.resetUI();
this._canceled = false;
this._isUploading = false;
this._isUploaded = true;
this.enableControls(true);
},

View File

@@ -212,8 +212,8 @@ Sys.Extended.UI.Animation.AnimationBehavior.prototype = {
/// <summary>
/// Generic OnMouseOver Animation's behavior
/// </summary>
/// <getter>get_onLoadBehavior</getter>
/// <member name="cP:AjaxControlToolkit.AnimationExtender.onLoadBehavior" />
/// <getter>get_onMouseOverBehavior</getter>
/// <member name="cP:AjaxControlToolkit.AnimationExtender.onMouseOverBehavior" />
get_onMouseOverBehavior: function() {
return this._onMouseOver;
},
@@ -379,8 +379,8 @@ Sys.Extended.UI.Animation.AnimationBehavior.prototype = {
/// <summary>
/// Generic OnHoverOut Animation's behavior
/// </summary>
/// <getter>get_onHoverOverBehavior</getter>
/// <member name="cP:AjaxControlToolkit.AnimationExtender.onHoverOverBehavior" />
/// <getter>get_onHoverOutBehavior</getter>
/// <member name="cP:AjaxControlToolkit.AnimationExtender.onHoverOutBehavior" />
get_onHoverOutBehavior: function() {
return this._onHoverOut;
},

File diff suppressed because it is too large Load Diff

View File

@@ -38,9 +38,9 @@ Sys.Extended.UI.AsyncFileUpload = function(element) {
/// <summary>
/// A name of the form.
/// </summary>
/// <getter>get_postBackUrl</getter>
/// <setter>set_postBackUrl</setter>
/// <member name="cP:AjaxControlToolkit.AsyncFileUpload.postBackUrl" />
/// <getter>get_formName</getter>
/// <setter>set_formName</setter>
/// <member name="cP:AjaxControlToolkit.AsyncFileUpload.formName" />
this._formName = "";
this._iframe = null;
this._waitTimer = null;
@@ -139,13 +139,7 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
set_postBackUrl: function(value) {
this._postBackUrl = value;
},
/// <summary>
/// Name of the form
/// </summary>
/// <getter>get_formName</getter>
/// <setter>set_formName</setter>
/// <member name="cP:AjaxControlToolkit.AsyncFileUpload.formName" />
get_formName: function() {
return this._formName;
},
@@ -379,7 +373,7 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
var mainForm = document.getElementById(this._formName);
this._removeTimer();
this.setThrobber(false);
mainForm.target = "_top";
this._restoreFormTarget(mainForm);
mainForm.action = this._postBackUrl;
var length;
var contentType = "";
@@ -428,7 +422,7 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
var url = this._postBackUrl;
url += url.indexOf("?") === -1 ? "?" : "&";
mainForm.action = url + 'AsyncFileUploadID=' + this.get_element().id + '&rnd=' + Math.random().toString().replace(/\./g, "");
mainForm.target = this._iframeName;
this._changeFormTarget(mainForm);
cleanup = false;
this.setThrobber(true);
setTimeout(function() {
@@ -491,7 +485,7 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
}
this._removeTimer();
mainForm.target = "_top";
this._restoreFormTarget(mainForm);
mainForm.action = this._postBackUrl;
if(this.get_completeBackColor() != "") {
if(this._innerTB != null) {
@@ -506,7 +500,7 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
}
catch(ex) {
this._removeTimer();
mainForm.target = "_top";
this._restoreFormTarget(mainForm);
mainForm.action = this._postBackUrl;
this._onError(ex.message);
}
@@ -532,6 +526,16 @@ Sys.Extended.UI.AsyncFileUpload.prototype = {
setTimeout(function() { uploader._onError(Sys.Extended.UI.Resources.AsyncFileUpload_UploadingProblem); }, 0);
this._waitTimer = null;
}
},
_changeFormTarget: function(form) {
this._mainFormOldTarget = form.target;
form.target = this._iframeName;
},
_restoreFormTarget: function(form) {
form.target = this._mainFormOldTarget;
this._mainFormOldTarget = undefined;
}
}

View File

@@ -99,6 +99,7 @@ Sys.Extended.UI.AutoCompleteBehavior = function(element) {
this._focusHandler = null;
this._blurHandler = null;
this._bodyClickHandler = null;
this._clickHandler = null;
this._completionListBlurHandler = null;
this._keyDownHandler = null;
this._mouseDownHandler = null;
@@ -188,6 +189,7 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
this._mouseOverHandler = Function.createDelegate(this, this._onListMouseOver);
this._completionListBlurHandler = Function.createDelegate(this, this._onCompletionListBlur);
this._bodyClickHandler = Function.createDelegate(this, this._onCompletionListBlur);
this._clickHandler = Function.createDelegate(this, this._onInputClick);
this._timer = new Sys.Timer();
@@ -244,6 +246,7 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
$removeHandler(element, "focus", this._focusHandler);
$removeHandler(element, "blur", this._blurHandler);
$removeHandler(element, "keydown", this._keyDownHandler);
$removeHandler(element, "click", this._clickHandler);
$removeHandler(this._completionListElement, 'blur', this._completionListBlurHandler);
$removeHandler(this._completionListElement, 'mousedown', this._mouseDownHandler);
$removeHandler(this._completionListElement, 'mouseup', this._mouseUpHandler);
@@ -258,6 +261,7 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
this._tickHandler = null;
this._focusHandler = null;
this._blurHandler = null;
this._clickHandler = null;
this._keyDownHandler = null;
this._completionListBlurHandler = null;
this._mouseDownHandler = null;
@@ -277,6 +281,7 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
$addHandler(element, "focus", this._focusHandler);
$addHandler(element, "blur", this._blurHandler);
$addHandler(element, "keydown", this._keyDownHandler);
$addHandler(element, "click", this._clickHandler);
},
initializeCompletionList: function(element) {
@@ -307,6 +312,16 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
$addHandler(document.body, 'click', this._bodyClickHandler);
},
_onInputClick: function(e) {
if(!e)
e = window.event;
if(e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
},
_currentCompletionWord: function() {
var element = this.get_element();
var elementValue = element.value;
@@ -708,7 +723,10 @@ Sys.Extended.UI.AutoCompleteBehavior.prototype = {
} else {
element.value = newText;
}
$common.tryFireEvent(element, "change");
// In Chrome and Firefox, this event is triggered automatically
if ($common.isMsBrowser() || $common.isAppleBrowser())
$common.tryFireEvent(element, "change");
this.raise_itemSelected(new Sys.Extended.UI.AutoCompleteItemEventArgs(item, text, item ? item._value : null));
@@ -1281,4 +1299,4 @@ Sys.Extended.UI.AutoCompleteItemEventArgs.prototype = {
this._value = value;
}
}
Sys.Extended.UI.AutoCompleteItemEventArgs.registerClass('Sys.Extended.UI.AutoCompleteItemEventArgs', Sys.EventArgs);
Sys.Extended.UI.AutoCompleteItemEventArgs.registerClass('Sys.Extended.UI.AutoCompleteItemEventArgs', Sys.EventArgs);

View File

@@ -534,7 +534,8 @@ Sys.Extended.UI.BalloonPopupControlBehavior.prototype = {
do {
_elementLeftPosition += e.offsetLeft;
_elementTopPosition += e.offsetTop;
} while(e = e.offsetParent);
e = e.offsetParent;
} while(e);
}
var _pageTopPosition = this.posTop();

View File

@@ -2,9 +2,6 @@
Sys.Extended.UI.BarChart = function(element) {
Sys.Extended.UI.BarChart.initializeBase(this, [element]);
var id = this.get_id();
id = id.replace("_ctl00", "");
this._parentDiv = document.getElementById(id + "__ParentDiv");
this._chartWidth = '300';
this._chartHeight = '200';
@@ -18,6 +15,7 @@ Sys.Extended.UI.BarChart = function(element) {
this._valueAxisLineColor = '';
this._categoryAxisLineColor = '';
this._baseLineColor = '';
this._container = null;
// variables
this.yMax = 0;
@@ -51,6 +49,8 @@ Sys.Extended.UI.BarChart.prototype = {
if(this._valueAxisLines == 0) {
this._valueAxisLines = 9;
}
this._parentDiv = this.get_container();
if(this._chartType == Sys.Extended.UI.BarChartType.Column || this._chartType == Sys.Extended.UI.BarChartType.StackedColumn)
this.generateColumnChart();
@@ -349,9 +349,7 @@ Sys.Extended.UI.BarChart.prototype = {
svgContents = svgContents + '<stop offset="100%" id="LinearGradient3"></stop></linearGradient>';
svgContents = svgContents + '</defs>';
svgContents = svgContents + String.format('<path fill="none" stroke-opacity="1" fill-opacity="1" stroke-linejoin="round" stroke-linecap="square" d="M5 {0} {1} {0} {1} {2} 5 {2} z"/>', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
svgContents = svgContents + String.format('<path id="ChartBackGround" stroke="" d="M0 0 {0} 0 {0} {1} 0 {1} z"/>', this._chartWidth, this._chartHeight);
svgContents = svgContents + String.format('<path fill="#ffffff" stroke-opacity="1" fill-opacity="0" stroke-linejoin="round" stroke-linecap="square" stroke="" d="M5 {0} {1} {0} {1} {2} 5 {2} z" />', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
svgContents = svgContents + String.format('<rect id="ChartBackGround" width="{0}" height="{1}" style="opacity: 0"/>', this._chartWidth, this._chartHeight);
return svgContents;
},
@@ -840,7 +838,14 @@ Sys.Extended.UI.BarChart.prototype = {
},
set_baseLineColor: function(value) {
this._baseLineColor = value;
}
},
get_container: function () {
return this._container;
},
set_container: function (value) {
this._container = value;
},
};
Sys.Extended.UI.BarChart.registerClass("Sys.Extended.UI.BarChart", Sys.Extended.UI.ControlBase);

View File

@@ -306,15 +306,24 @@ Sys.Extended.UI.ControlBase = function(element) {
this._onerror$delegate = Function.createDelegate(this, this._onerror);
}
Sys.Extended.UI.ControlBase.__doPostBack = function(eventTarget, eventArgument) {
Sys.Extended.UI.ControlBase._execOnSubmitCollection = function() {
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
for (var i = 0; i < Sys.Extended.UI.ControlBase.onsubmitCollection.length; i++) {
Sys.Extended.UI.ControlBase.onsubmitCollection[i]();
}
}
}
Sys.Extended.UI.ControlBase.__doPostBack = function(eventTarget, eventArgument) {
Sys.Extended.UI.ControlBase._execOnSubmitCollection();
Function.createDelegate(window, Sys.Extended.UI.ControlBase.__doPostBackSaved)(eventTarget, eventArgument);
}
Sys.Extended.UI.ControlBase.__doPostBackWithOptions = function(options) {
Sys.Extended.UI.ControlBase._execOnSubmitCollection();
Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved(options);
}
Sys.Extended.UI.ControlBase.prototype = {
initialize: function() {
Sys.Extended.UI.ControlBase.callBaseMethod(this, "initialize");
@@ -328,6 +337,10 @@ Sys.Extended.UI.ControlBase.prototype = {
window.__doPostBack = Sys.Extended.UI.ControlBase.__doPostBack;
Sys.Extended.UI.ControlBase.onsubmitCollection = new Array();
}
if (!Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved) {
Sys.Extended.UI.ControlBase.__doPostBackWithOptionsSaved = window.WebForm_DoPostBackWithOptions;
window.WebForm_DoPostBackWithOptions = Sys.Extended.UI.ControlBase.__doPostBackWithOptions;
}
Array.add(Sys.Extended.UI.ControlBase.onsubmitCollection, this._onsubmit$delegate);
} else {
$addHandler(document.forms[0], "submit", this._onsubmit$delegate);
@@ -400,4 +413,14 @@ Sys.Extended.UI.ControlBase.prototype = {
}
}
Sys.Extended.UI.ControlBase.registerClass("Sys.Extended.UI.ControlBase", Sys.UI.Control);
Sys.Extended.UI.ControlBase.registerClass("Sys.Extended.UI.ControlBase", Sys.UI.Control);
var isUnminified = /param/.test(function(param) { });
Sys.Extended.Deprecated = function(oldMethodName, properMethodName) {
if(isUnminified && window.console && console.warn)
if(arguments.length == 1)
console.warn(oldMethodName + " is deprecated.");
else
console.warn(oldMethodName + " is deprecated. Use " + properMethodName + " instead.");
}

View File

@@ -264,7 +264,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
set_startDate: function(value) {
// The property of the start date for range
if(this._startDate != value) {
this._startDate = new Date(value);
this._startDate = this._parseDateSortableFormat(value);
this.raisePropertyChanged('startDate');
}
},
@@ -274,7 +274,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
},
set_endDate: function(value) {
if(this._endDate != value) {
this._endDate = new Date(value);
this._endDate = this._parseDateSortableFormat(value);
this.raisePropertyChanged('endDate');
}
},
@@ -324,7 +324,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
},
set_selectedDate: function(value) {
if(value && (String.isInstanceOfType(value)) && (value.length != 0)) {
value = Date.fromISO(value);
value = this._parseDateSortableFormat(value);
}
if(this._selectedDate != value) {
@@ -332,7 +332,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
this._selectedDateChanging = true;
var text = "";
if(value) {
text = this._convertToLocal(value).localeFormat(this._format);
text = value.localeFormat(this._format);
// If we don't clear the time then we transfer the time from the
// textbox to the selected value
@@ -344,12 +344,12 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
if(tbvalue) {
if(value != tbvalue.getDateOnly()) {
// Transfer time from textbox to selected value
value.setUTCHours(tbvalue.getUTCHours());
value.setUTCMinutes(tbvalue.getUTCMinutes());
value.setUTCSeconds(tbvalue.getUTCSeconds());
value.setUTCMilliseconds(tbvalue.getUTCMilliseconds());
value.setHours(tbvalue.getHours());
value.setMinutes(tbvalue.getMinutes());
value.setSeconds(tbvalue.getSeconds());
value.setMilliseconds(tbvalue.getMilliseconds());
text = this._convertToLocal(value).localeFormat(this._format);
text = value.localeFormat(this._format);
}
}
}
@@ -385,7 +385,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
if(this._visibleDate != value) {
this._switchMonth(value, !this._isOpen);
this._switchView(value, Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom, !this._isOpen);
this.raisePropertyChanged("visibleDate");
}
},
@@ -683,7 +683,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
this._popupBehavior.show();
if(this._firstPopUp) {
this._switchMonth(null, true);
this._switchView(null, Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom, true);
switch(this._defaultView) {
case Sys.Extended.UI.CalendarDefaultView.Months:
this._switchMode("months", true);
@@ -995,7 +995,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
},
_isInDateRange: function(date, part) {
_isInDateRange: function(date, part, switchMode) {
switch(part) {
case "d":
if((this._startDate) && (this._getDateOnly(date) < this._getDateOnly(this._startDate))) { return false; }
@@ -1006,111 +1006,73 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
if((this._endDate) && (this._getMonthOnly(date) > this._getMonthOnly(this._endDate))) { return false; }
break;
case "y":
if((this._startDate) && (date.getUTCFullYear() < this._startDate.getUTCFullYear())) { return false; }
if((this._endDate) && (date.getUTCFullYear() > this._endDate.getUTCFullYear())) { return false; }
if((this._startDate) && (date.getFullYear() < this._startDate.getFullYear())) { return false; }
if((this._endDate) && (date.getFullYear() > this._endDate.getFullYear())) { return false; }
break;
case "yy":
var startYear = date.getUTCFullYear();
var endYear = date.getUTCFullYear() + 9;
if (this._startDate && this._endDate) {
if (startYear < this._startDate.getUTCFullYear()
&&
endYear > this._endDate.getUTCFullYear())
return true;
return false;
}
else {
if(this._startDate && this._endDate) {
return this._isInYearsDateRange(date, switchMode);
} else {
if(!this._startDate && !this._endDate)
return true;
if (this._startDate && endYear > this._startDate.getUTCFullYear())
var startYear = this._getRangeStartYear(date);
if(this._endDate && startYear < this._endDate.getFullYear())
return true;
if (this._endDate && startYear < this._endDate.getUTCFullYear())
var endYear = this._getRangeEndYear(date);
if (this._startDate && endYear > this._startDate.getFullYear())
return true;
return false;
}
break;
}
return true;
},
_isInNextDateRange: function (date, part) {
switch (part) {
case "d":
if ((this._startDate) && (this._getDateOnly(date) > this._getDateOnly(this._startDate))) { return false; }
break;
case "M":
if ((this._startDate) && (this._getMonthOnly(date) > this._getMonthOnly(this._startDate))) { return false; }
break;
case "y":
if ((this._startDate) && (date.getUTCFullYear() > this._startDate.getUTCFullYear())) { return false; }
break;
case "yy":
var startYear = date.getUTCFullYear();
var endYear = date.getUTCFullYear();
if ((this._startDate) && (date.getUTCFullYear() > this._startDate.getUTCFullYear())) { return false; }
break;
_isInYearsDateRange: function(date, switchMode) {
var startYear = this._getRangeStartYear(date);
var endYear = this._getRangeEndYear(date);
switch(switchMode) {
case Sys.Extended.UI.CalendarSwitchViewMode.PreviousRange:
if(endYear > this._startDate.getFullYear())
return true;
return false;
case Sys.Extended.UI.CalendarSwitchViewMode.NextRange:
if(startYear < this._endDate.getFullYear())
return true;
return false;
case Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom:
if(startYear > this._startDate.getFullYear()
&&
endYear < this._endDate.getFullYear())
return true;
return false;
default:
throw Error.invalidOperation();
}
return true;
},
_isInPrevDateRange: function (date, part) {
switch (part) {
case "d":
if ((this._endDate) && (this._getDateOnly(date) < this._getDateOnly(this._endDate))) { return false; }
break;
case "M":
if ((this._endDate) && (this._getMonthOnly(date) < this._getMonthOnly(this._endDate))) { return false; }
break;
case "y":
if ((this._endDate) && (date.getUTCFullYear() < this._endDate.getUTCFullYear())) { return false; }
break;
case "yy":
var startYear = date.getUTCFullYear();
var endYear = date.getUTCFullYear() + 9;
_getRangeStartYear: function(date) {
return date.getFullYear();
},
if (this._startDate || this._endDate)
{
if (startYear < this._startDate.getUTCFullYear()
&&
endYear > this._endDate.getUTCFullYear())
return true;
}
break;
}
return true;
_getRangeEndYear: function(date) {
return date.getFullYear() + 9;
},
_getDateOnly: function(date) {
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
},
_getMonthOnly: function(date) {
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
},
_convertToUTC: function(value) {
// Converts a local date such as 1/1/2007 into 1/1/2007 GMT without adjusting for time zone
if(value) {
value = new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
}
return value;
},
_convertToLocal: function(value) {
// Converts a UTC date such as 1/1/2007 GMT into 1/1/2007 without adjusting for time zone
var result = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
// Handle daylight savings time offset (The first hour of September 25 becomes the last hour of September 24 when DST starts)
if(result.getDate() != value.getUTCDate()) {
result = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours() + 1, value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
}
return result;
return new Date(date.getFullYear(), date.getMonth(), 1);
},
_performLayout: function() {
@@ -1129,12 +1091,12 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
case "days":
var firstDayOfWeek = this._getFirstDayOfWeek();
var daysToBacktrack = visibleDate.getUTCDay() - firstDayOfWeek;
var daysToBacktrack = visibleDate.getDay() - firstDayOfWeek;
if(daysToBacktrack <= 0)
daysToBacktrack += 7;
var startDate = new Date(visibleDate);
startDate.setUTCDate(startDate.getUTCDate() - daysToBacktrack);
startDate.setDate(startDate.getDate() - daysToBacktrack);
var currentDate = new Date(startDate);
for(var i = 0; i < 7; i++) {
@@ -1151,8 +1113,8 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
if(dayCell.firstChild) {
dayCell.removeChild(dayCell.firstChild);
}
dayCell.appendChild(document.createTextNode(currentDate.getUTCDate()));
dayCell.title = this._convertToLocal(currentDate).localeFormat("D");
dayCell.appendChild(document.createTextNode(currentDate.getDate()));
dayCell.title = currentDate.localeFormat("D");
dayCell.date = currentDate;
$common.removeCssClasses(dayCell.parentNode, ["ajax__calendar_other", "ajax__calendar_active", "ajax__calendar_today"]);
@@ -1165,17 +1127,17 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
currentDate = new Date(currentDate);
currentDate.setUTCDate(currentDate.getUTCDate() + 1);
currentDate.setDate(currentDate.getDate() + 1);
}
}
this._prevArrow.date = new Date(Date.UTC(visibleDate.getUTCFullYear(), visibleDate.getUTCMonth() - 1, 1));
this._nextArrow.date = new Date(Date.UTC(visibleDate.getUTCFullYear(), visibleDate.getUTCMonth() + 1, 1));
this._prevArrow.date = new Date(visibleDate.getFullYear(), visibleDate.getMonth() - 1, 1);
this._nextArrow.date = new Date(visibleDate.getFullYear(), visibleDate.getMonth() + 1, 1);
if(this._title.firstChild) {
this._title.removeChild(this._title.firstChild);
}
this._title.appendChild(document.createTextNode(this._convertToLocal(visibleDate).localeFormat(this.get_daysModeTitleFormat())));
this._title.appendChild(document.createTextNode(visibleDate.localeFormat(this.get_daysModeTitleFormat())));
this._title.date = visibleDate;
break;
@@ -1184,8 +1146,8 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
var row = this._monthsBody.rows[i];
for(var j = 0; j < row.cells.length; j++) {
var cell = row.cells[j].firstChild;
cell.date = new Date(Date.UTC(visibleDate.getUTCFullYear(), cell.month, 1));
cell.title = this._convertToLocal(cell.date).localeFormat("Y");
cell.date = new Date(visibleDate.getFullYear(), cell.month, 1);
cell.title = cell.date.localeFormat("Y");
if(!this._isInDateRange(cell.date, "M")) {
$common.removeCssClasses(cell.parentNode, ["ajax__calendar_other", "ajax__calendar_active"]);
@@ -1203,20 +1165,20 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
this._title.removeChild(this._title.firstChild);
}
this._title.appendChild(document.createTextNode(this._convertToLocal(visibleDate).localeFormat("yyyy")));
this._title.appendChild(document.createTextNode(visibleDate.localeFormat("yyyy")));
this._title.date = visibleDate;
this._prevArrow.date = new Date(Date.UTC(visibleDate.getUTCFullYear() - 1, 0, 1));
this._nextArrow.date = new Date(Date.UTC(visibleDate.getUTCFullYear() + 1, 0, 1));
this._prevArrow.date = new Date(visibleDate.getFullYear() - 1, 0, 1);
this._nextArrow.date = new Date(visibleDate.getFullYear() + 1, 0, 1);
break;
case "years":
var minYear = (Math.floor(visibleDate.getUTCFullYear() / 10) * 10);
var minYear = (Math.floor(visibleDate.getFullYear() / 10) * 10);
for(var i = 0; i < this._yearsBody.rows.length; i++) {
var row = this._yearsBody.rows[i];
for(var j = 0; j < row.cells.length; j++) {
var cell = row.cells[j].firstChild;
cell.date = new Date(Date.UTC(minYear + cell.year, 0, 1));
cell.date = new Date(minYear + cell.year, 0, 1);
if(cell.firstChild) {
cell.removeChild(cell.lastChild);
} else {
@@ -1241,8 +1203,8 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
this._title.appendChild(document.createTextNode(minYear.toString() + "-" + (minYear + 9).toString()));
this._title.date = visibleDate;
this._prevArrow.date = new Date(Date.UTC(minYear - 10, 0, 1));
this._nextArrow.date = new Date(Date.UTC(minYear + 10, 0, 1));
this._prevArrow.date = new Date(minYear - 10, 0, 1);
this._nextArrow.date = new Date(minYear + 10, 0, 1);
break;
}
@@ -1256,7 +1218,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
Sys.UI.DomElement.addCssClass(this._today.parentNode, "ajax__calendar_invalid");
}
this._today.date = this._convertToUTC(todaysDate);
this._today.date = todaysDate;
},
_ensureCalendar: function() {
@@ -1299,7 +1261,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
elt.dispatchEvent(e);
}
},
_switchMonth: function(date, dontAnimate) {
_switchView: function(date, switchMode, dontAnimate) {
// Switches the visible month in the days view
// param name "date" of type "Date" is the visible date to switch to
// param name "dontAnimate" of type "Boolean" prevents animation from occuring if the control is animated
@@ -1310,7 +1272,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
// Check if can switch month depending on the startDate and endDAte
if(date && !this._canSwitchMonth(date)) {
if(date && !this._canSwitchMonth(date, switchMode)) {
return;
}
@@ -1320,219 +1282,96 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
if(this._animated && !dontAnimate) {
this._isAnimating = true;
var newElement = this._modes[this._mode];
var oldElement = newElement.cloneNode(true);
this._body.appendChild(oldElement);
if(visibleDate > date) {
// animating down
// the newIndex element is the top
// the oldIndex element is the bottom (visible)
// move in, fade in
$common.setLocation(newElement, { x: -162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(newElement);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(0);
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(oldElement);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(this._width);
} else {
// animating up
// the oldIndex element is the top (visible)
// the newIndex element is the bottom
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(oldElement);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(0);
// move in, fade in
$common.setLocation(newElement, { x: 162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(newElement);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(this._width);
}
this._visibleDate = date;
this.invalidate();
var endHandler = Function.createDelegate(this, function() {
this._body.removeChild(oldElement);
oldElement = null;
this._isAnimating = false;
this._modeChangeAnimation.remove_ended(endHandler);
});
this._modeChangeAnimation.add_ended(endHandler);
this._modeChangeAnimation.play();
this._animateViewSwitch(date, visibleDate);
} else {
this._visibleDate = date;
this.invalidate();
}
},
_switchNextRange: function(date, dontAnimate) {
// Switches the visible month in the days view
// param name "date" of type "Date" is the visible date to switch to
// param name "dontAnimate" of type "Boolean" prevents animation from occuring if the control is animated
// Check _isAnimating to make sure we don't animate horizontally and vertically at the same time
if(this._isAnimating) {
return;
}
_animateViewSwitch: function(date, visibleDate) {
this._isAnimating = true;
// Check if can switch month depending on the startDate and endDAte
if(date && !this._canSwitchNextRange(date)) {
return;
}
var newElement = this._modes[this._mode];
var oldElement = newElement.cloneNode(true);
this._body.appendChild(oldElement);
if(visibleDate > date) {
this._switchRange(date, dontAnimate);
},
_switchPrevRange: function (date, dontAnimate) {
// Switches the visible month in the days view
// param name "date" of type "Date" is the visible date to switch to
// param name "dontAnimate" of type "Boolean" prevents animation from occuring if the control is animated
// animating down
// the newIndex element is the top
// the oldIndex element is the bottom (visible)
// Check _isAnimating to make sure we don't animate horizontally and vertically at the same time
if (this._isAnimating) {
return;
}
// move in, fade in
$common.setLocation(newElement, { x: -162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(newElement);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(0);
// Check if can switch month depending on the startDate and endDAte
if (date && !this._canSwitchPrevRange(date)) {
return;
}
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(oldElement);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(this._width);
this._switchRange(date, dontAnimate);
},
_switchRange: function (date, dontAnimate)
{
var visibleDate = this._getEffectiveVisibleDate();
if((date && date.getFullYear() == visibleDate.getFullYear() && date.getMonth() == visibleDate.getMonth())) {
dontAnimate = true;
}
if(this._animated && !dontAnimate) {
this._isAnimating = true;
var newElement = this._modes[this._mode];
var oldElement = newElement.cloneNode(true);
this._body.appendChild(oldElement);
if(visibleDate > date) {
// animating down
// the newIndex element is the top
// the oldIndex element is the bottom (visible)
// move in, fade in
$common.setLocation(newElement, { x: -162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(newElement);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(0);
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(oldElement);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(this._width);
} else {
// animating up
// the oldIndex element is the top (visible)
// the newIndex element is the bottom
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(oldElement);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(0);
// move in, fade in
$common.setLocation(newElement, { x: 162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(newElement);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(this._width);
}
this._visibleDate = date;
this.invalidate();
var endHandler = Function.createDelegate(this, function() {
this._body.removeChild(oldElement);
oldElement = null;
this._isAnimating = false;
this._modeChangeAnimation.remove_ended(endHandler);
});
this._modeChangeAnimation.add_ended(endHandler);
this._modeChangeAnimation.play();
} else {
this._visibleDate = date;
this.invalidate();
}
},
// animating up
// the oldIndex element is the top (visible)
// the newIndex element is the bottom
_canSwitchMonth: function(date) {
// move out, fade out
$common.setLocation(oldElement, { x: 0, y: 0 });
$common.setVisible(oldElement, true);
this._modeChangeMoveTopOrLeftAnimation.set_propertyKey("left");
this._modeChangeMoveTopOrLeftAnimation.set_target(oldElement);
this._modeChangeMoveTopOrLeftAnimation.set_endValue(-this._width);
this._modeChangeMoveTopOrLeftAnimation.set_startValue(0);
// move in, fade in
$common.setLocation(newElement, { x: 162, y: 0 });
$common.setVisible(newElement, true);
this._modeChangeMoveBottomOrRightAnimation.set_propertyKey("left");
this._modeChangeMoveBottomOrRightAnimation.set_target(newElement);
this._modeChangeMoveBottomOrRightAnimation.set_endValue(0);
this._modeChangeMoveBottomOrRightAnimation.set_startValue(this._width);
}
this._visibleDate = date;
this.invalidate();
var endHandler = Function.createDelegate(this, function() {
this._body.removeChild(oldElement);
oldElement = null;
this._isAnimating = false;
this._modeChangeAnimation.remove_ended(endHandler);
});
this._modeChangeAnimation.add_ended(endHandler);
this._modeChangeAnimation.play();
},
_canSwitchMonth: function(date, switchMode) {
switch(this._mode) {
case "days":
if(!this._isInDateRange(date, "M")) {
if(!this._isInDateRange(date, "M", switchMode)) {
return false;
}
break;
case "months":
if(!this._isInDateRange(date, "y")) {
if(!this._isInDateRange(date, "y", switchMode)) {
return false;
}
break;
case "years":
if(!this._isInDateRange(date, "yy")) {
if(!this._isInDateRange(date, "yy", switchMode)) {
return false;
}
break;
}
return true;
},
_canSwitchNextRange: function (date) {
switch (this._mode) {
case "days":
return this._isInNextDateRange(date, "M");
case "months":
return this._isInNextDateRange(date, "y");
case "years":
return this._isInNextDateRange(date, "yy");
}
},
_canSwitchPrevRange: function (date) {
switch (this._mode) {
case "days":
return this._isInPrevDateRange(date, "M");
case "months":
return this._isInPrevDateRange(date, "y");
case "years":
return this._isInPrevDateRange(date, "yy");
}
},
},
_switchMode: function(mode, dontAnimate) {
// Switches the visible view from "days" to "months" to "years"
// param name "mode" of type "String" is the view mode to switch to
@@ -1619,13 +1458,13 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
if(!value) return false;
switch(part) {
case 'd':
if(date.getUTCDate() != value.getUTCDate()) return false;
if(date.getDate() != value.getDate()) return false;
// goto case 'M';
case 'M':
if(date.getUTCMonth() != value.getUTCMonth()) return false;
if(date.getMonth() != value.getMonth()) return false;
// goto case 'y';
case 'y':
if(date.getUTCFullYear() != value.getUTCFullYear()) return false;
if(date.getFullYear() != value.getFullYear()) return false;
break;
}
return true;
@@ -1639,18 +1478,18 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
var value = this._getEffectiveVisibleDate();
switch(part) {
case 'd':
return (date.getUTCFullYear() != value.getUTCFullYear() || date.getUTCMonth() != value.getUTCMonth());
return (date.getFullYear() != value.getFullYear() || date.getMonth() != value.getMonth());
case 'M':
return false;
case 'y':
var minYear = (Math.floor(value.getUTCFullYear() / 10) * 10);
return date.getUTCFullYear() < minYear || (minYear + 10) <= date.getUTCFullYear();
var minYear = (Math.floor(value.getFullYear() / 10) * 10);
return date.getFullYear() < minYear || (minYear + 10) <= date.getFullYear();
}
return false;
},
_isTodaysDate: function(date) {
return this._getDateOnly(this._convertToUTC(this.get_todaysDate())).valueOf() === this._getDateOnly(date).valueOf();
return this._getDateOnly(this.get_todaysDate()).valueOf() === this._getDateOnly(date).valueOf();
},
_getCssClass: function(date, part) {
@@ -1676,12 +1515,23 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
if(value == null)
value = this.get_todaysDate();
if (this._endDate && value > this._endDate)
value = this._endDate;
else if (this._startDate && value < this._startDate)
value = this._startDate;
value = new Date(value);
value.setUTCDate(1);
value.setDate(1);
return this._getDateOnly(value);
},
getMonthStartDate: function(date)
{
var value = new Date(date);
value.setDate(1);
return this._getDateOnly(value);
},
_getFirstDayOfWeek: function() {
// Gets the first day of the week
@@ -1696,7 +1546,9 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
var value = null;
if(text) {
value = this._convertToUTC(Date.parseLocale(text, this.get_format()));
value = Date.parseLocale(text, this.get_format());
if(value && value.getFullYear() < 100)
value.setYear(value.getFullYear());
}
if(isNaN(value)) {
value = null;
@@ -1726,7 +1578,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
var value = this._parseTextValue(this._textbox.get_Value());
this._selectedDate = value;
if(this._isOpen) {
this._switchMonth(this._selectedDate, this._selectedDate == null);
this._switchView(this._selectedDate, Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom, this._selectedDate == null);
}
}
},
@@ -1817,10 +1669,10 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
Sys.UI.DomElement.removeCssClass(target.parentNode, "ajax__calendar_hover");
switch(target.mode) {
case "prev":
this._switchMonth(target.date);
this._switchView(target.date, Sys.Extended.UI.CalendarSwitchViewMode.PreviousRange);
break;
case "next":
this._switchMonth(target.date);
this._switchView(target.date, Sys.Extended.UI.CalendarSwitchViewMode.NextRange);
break;
case "title":
switch(this._mode) {
@@ -1829,7 +1681,7 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
break;
case "month":
if(target.month == visibleDate.getUTCMonth()) {
if(target.month == visibleDate.getMonth()) {
this._switchMode("days");
} else {
this._visibleDate = target.date;
@@ -1846,13 +1698,13 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
break;
case "day":
this.set_selectedDate(target.date);
this._switchMonth(target.date);
this._switchView(target.date, Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom);
this._blur.post(true);
this.raise_dateSelectionChanged();
break;
case "today":
this.set_selectedDate(target.date);
this._switchMonth(target.date);
this._switchView(target.date, Sys.Extended.UI.CalendarSwitchViewMode.RangeZoom);
this._blur.post(true);
this.raise_dateSelectionChanged();
break;
@@ -1901,31 +1753,38 @@ Sys.Extended.UI.CalendarBehavior.prototype = {
}
// make sure we clean up the flag due to issues with alert/alt-tab/etc
this._popupMouseDown = false;
},
_parseDateSortableFormat: function (dateString) {
var dateParts = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.?(\d{0,7})?/.exec(dateString);
return new Date(
dateParts[1],
dateParts[2] - 1,
dateParts[3],
dateParts[4],
dateParts[5],
dateParts[6]);
}
}
Sys.Extended.UI.CalendarBehavior.registerClass("Sys.Extended.UI.CalendarBehavior", Sys.Extended.UI.BehaviorBase);
Sys.Extended.UI.CalendarPosition = function() {
// Position of the popup relative to the target control
throw Error.invalidOperation();
}
Sys.Extended.UI.CalendarPosition.prototype = {
Sys.Extended.UI.CalendarPosition = {
BottomLeft: 0,
BottomRight: 1,
TopLeft: 2,
TopRight: 3,
Right: 4,
Left: 5
}
Sys.Extended.UI.CalendarPosition.registerEnum('Sys.Extended.UI.CalendarPosition');
};
Sys.Extended.UI.CalendarDefaultView = function() {
// Choices for default view of the calendar when it first pops up.
throw Error.invalidOperation();
}
Sys.Extended.UI.CalendarDefaultView.prototype = {
Sys.Extended.UI.CalendarDefaultView = {
Days: 0,
Months: 1,
Years: 2
}
Sys.Extended.UI.CalendarDefaultView.registerEnum('Sys.Extended.UI.CalendarDefaultView');
};
Sys.Extended.UI.CalendarSwitchViewMode = {
PreviousRange: 0,
NextRange: 1,
RangeZoom: 2
};

View File

@@ -129,6 +129,14 @@ Sys.Extended.UI.CascadingDropDownBehavior = function(e) {
/// <member name="cP:AjaxControlToolkit.CascadingDropDown.enableAtLoading" />
this._enableAtLoading = false;
/// <summary>
/// Always clear selected item when parent value changes.
/// </summary>
/// <getter>get_clearSelectedItemOnParentChange</getter>
/// <setter>set_clearSelectedItemOnParentChange</setter>
/// <member name="cP:AjaxControlToolkit.CascadingDropDown.clearSelectedItemOnParentChange" />
this._clearSelectedItemOnParentChange = false;
// Variables
this._parentElement = null;
this._changeHandler = null;
@@ -329,7 +337,7 @@ Sys.Extended.UI.CascadingDropDownBehavior.prototype = {
}
}
else {
if(list && (Sys.Browser.agent !== Sys.Browser.Safari) && (Sys.Browser.agent !== Sys.Browser.Opera)) {
if(list && (Sys.Browser.agent !== Sys.Browser.Firefox) && (Sys.Browser.agent !== Sys.Browser.Safari) && (Sys.Browser.agent !== Sys.Browser.Opera)) {
// Fire the onchange event for the control to notify any listeners of the change
if(document.createEvent) {
var onchangeEvent = document.createEvent('HTMLEvents');
@@ -372,6 +380,9 @@ Sys.Extended.UI.CascadingDropDownBehavior.prototype = {
// "evt" - set by the browser when called as an event handler (unused here)
// "inInit" - whether this is being called from the initialize method
if(this.get_clearSelectedItemOnParentChange())
this.set_selectedValue('', '');
var e = this.get_element();
// Create the known category/value pairs string for sending to the helper web service
@@ -715,6 +726,16 @@ Sys.Extended.UI.CascadingDropDownBehavior.prototype = {
}
},
get_clearSelectedItemOnParentChange: function() {
return this._clearSelectedItemOnParentChange;
},
set_clearSelectedItemOnParentChange: function(value) {
if(this._clearSelectedItemOnParentChange != value) {
this._clearSelectedItemOnParentChange = value;
this.raisePropertyChanged('clearSelectedItemOnParentChange');
}
},
/// <summary>
/// Fires when selection is changed.
/// </summary>

View File

@@ -171,7 +171,7 @@ Sys.Extended.UI.CollapsiblePanelBehavior.prototype = {
},
/// <summary>
/// Event handler to epxand or collapse the panel (based on its current state)
/// Event handler to expand or collapse the panel (based on its current state)
/// This is the public function that should be called instead of _toggle if
/// you wish to programmatically open and close the collapsible panel
/// </summary>

View File

@@ -9,6 +9,7 @@ Sys.Extended.UI.ColorPickerBehavior = function(element) {
this._sample = null;
this._cssClass = "ajax__colorPicker";
this._popupPosition = Sys.Extended.UI.PositioningMode.BottomLeft;
this._paletteStyle = Sys.Extended.UI.ColorPickerPaletteStyle.Default;
this._selectedColor = null;
this._enabled = true;
@@ -223,6 +224,23 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
}
},
/// <summary>
/// The Sys.Extended.UI.PaletteStyle object that represents which color palette is used.
/// The default is Default.
/// </summary>
/// <getter>get_paletteStyle</getter>
/// <setter>set_paletteStyle</setter>
/// <member name="cP:AjaxControlToolkit.ColorPickerExtender.paletteStyle" />
get_paletteStyle: function () {
return this._paletteStyle;
},
set_paletteStyle: function (value) {
if (this._paletteStyle !== value) {
this._paletteStyle = value;
this.raisePropertyChanged('paletteStyle');
}
},
/// <summary>
/// Fires when color selection is changed.
/// </summary>
@@ -343,14 +361,14 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
if (!this._isOpen) {
var eventArgs = new Sys.CancelEventArgs();
this.raiseShowing(eventArgs);
this.raise_showing(eventArgs);
if (eventArgs.get_cancel()) {
return;
}
this._isOpen = true;
this._popupBehavior.show();
this.raiseShown();
this.raise_shown();
}
},
@@ -361,7 +379,7 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
hide: function() {
if (this._isOpen) {
var eventArgs = new Sys.CancelEventArgs();
this.raiseHiding(eventArgs);
this.raise_hiding(eventArgs);
if (eventArgs.get_cancel()) {
return;
}
@@ -370,7 +388,7 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
this._popupBehavior.hide();
}
this._isOpen = false;
this.raiseHidden();
this.raise_hidden();
// make sure we clean up the flag due to issues with alert/alt-tab/etc
this._popupMouseDown = false;
@@ -434,34 +452,76 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
properties: { id: id + "_colorsBody" }
}, this._colorsTable);
var rgb = ['00', '99', '33', '66', 'FF', 'CC'], color, cssColor;
var l = rgb.length;
switch (this._paletteStyle) {
case Sys.Extended.UI.ColorPickerPaletteStyle.Default:
var rgb = ['00', '99', '33', '66', 'FF', 'CC'], color, cssColor;
var l = rgb.length;
for (var r = 0; r < l; r++) {
var colorsRow = $common.createElementFromTemplate({ nodeName: "tr" }, this._colorsBody);
for (var g = 0; g < l; g++) {
if (g === 3) {
colorsRow = $common.createElementFromTemplate({ nodeName: "tr" }, this._colorsBody);
for (var r = 0; r < l; r++) {
var colorsRow = $common.createElementFromTemplate({ nodeName: "tr" }, this._colorsBody);
for (var g = 0; g < l; g++) {
if (g === 3) {
colorsRow = $common.createElementFromTemplate({ nodeName: "tr" }, this._colorsBody);
}
for (var b = 0; b < l; b++) {
color = rgb[r] + rgb[g] + rgb[b];
this._createColorCell(color, colorsRow);
}
}
}
for (var b = 0; b < l; b++) {
color = rgb[r] + rgb[g] + rgb[b];
cssColor = '#' + color;
var colorCell = $common.createElementFromTemplate({ nodeName: "td" }, colorsRow);
var colorDiv = $common.createElementFromTemplate({
nodeName: "div",
properties: {
id: id + "_color_" + color,
color: color,
title: cssColor,
style: { backgroundColor: cssColor },
innerHTML: "&nbsp;"
},
events: this._cell$delegates
}, colorCell);
}
}
break;
case Sys.Extended.UI.ColorPickerPaletteStyle.Continuous:
var step = 100 / 12;
for(var l = 0; l <= 100; l = l + step) {
var colorsRow = $common.createElementFromTemplate({ nodeName: "tr" }, this._colorsBody);
for (var h = 0; h < 360; h = h + 20) {
rgb = this._hslToRgb(h / 360, 1, l / 100);
color = this._rgbToHex(rgb[0], rgb[1], rgb[2]);
this._createColorCell(color, colorsRow);
}
}
break;
}
},
_rgbToHex: function(r, g, b){
function padHex(n){
var nHex = n.toString(16);
return (n < 16) ? ("0" + nHex) : nHex;
}
return padHex(r) + padHex(g) + padHex(b);
},
_hslToRgb: function(h, s, l){
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
var r = this._hue2rgb(p, q, h + 1 / 3);
var g = this._hue2rgb(p, q, h);
var b = this._hue2rgb(p, q, h - 1 / 3);
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
},
_hue2rgb: function(p, q, t){
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
},
_createColorCell: function (color, colorsRow) {
var cssColor = '#' + color;
var colorCell = $common.createElementFromTemplate({ nodeName: "td" }, colorsRow);
$common.createElementFromTemplate({
nodeName: "div",
properties: {
color: color,
title: cssColor,
style: { backgroundColor: cssColor },
innerHTML: "&nbsp;"
},
events: this._cell$delegates
}, colorCell);
},
_ensureColorPicker: function() {
if (!this._container) {
@@ -614,4 +674,9 @@ Sys.Extended.UI.ColorPickerBehavior.prototype = {
this._popupMouseDown = false;
}
}
Sys.Extended.UI.ColorPickerBehavior.registerClass('Sys.Extended.UI.ColorPickerBehavior', Sys.Extended.UI.BehaviorBase);
Sys.Extended.UI.ColorPickerBehavior.registerClass('Sys.Extended.UI.ColorPickerBehavior', Sys.Extended.UI.BehaviorBase);
Sys.Extended.UI.ColorPickerPaletteStyle = {
Default: 0,
Continuous: 1
}

View File

@@ -184,14 +184,10 @@ Sys.Extended.UI.ComboBox.prototype = {
"click": this._textBoxClickHandler,
"focus": this._textBoxFocusHandler,
"blur": this._textBoxBlurHandler,
"keypress": this._textBoxKeyPressHandler
"keypress": this._textBoxKeyPressHandler,
"keydown": this._textBoxKeyDownHandler
}, this);
if (Sys.Browser.agent == Sys.Browser.InternetExplorer || Sys.Browser.agent === Sys.Browser.Safari
|| Sys.Browser.agent === Sys.Browser.WebKit) {
$addHandler(this.get_textBoxControl(), "keydown", this._textBoxKeyDownHandler);
}
$addHandlers(this.get_buttonControl(),
{
'click': this._buttonClickHandler,
@@ -243,10 +239,6 @@ Sys.Extended.UI.ComboBox.prototype = {
// zero margins & padding (helps particularly in firefox)
if (style.padding == '')
style.padding = '0px';
// button is originally hidden to reduce screen flicker
this._buttonControl.style.visibility = 'visible';
},
initializeOptionList: function () {
@@ -259,7 +251,7 @@ Sys.Extended.UI.ComboBox.prototype = {
var optionListControl = this.get_optionListControl();
// force inline display on Safari by moving the list to the bottom of the form.
if (Sys.Browser.agent === Sys.Browser.Safari || Sys.Browser.agent === Sys.Browser.WebKit) {
if (Sys.Browser.agent === Sys.Browser.Safari) {
//this.get_element().removeChild(optionListControl);
var parentOfOptionList = optionListControl.parentNode;
if (parentOfOptionList != null)
@@ -499,7 +491,8 @@ Sys.Extended.UI.ComboBox.prototype = {
x = textBoxBounds.x - (listBounds.width - textBoxBounds.width);
}
Sys.UI.DomElement.setLocation(optionListControl, x, y);
if($common.getCurrentStyle(this.get_textBoxControl(), "position", "") == "absolute")
Sys.UI.DomElement.setLocation(optionListControl, x, y);
// enforce default scroll
this._ensureHighlightedIndex();
@@ -960,9 +953,8 @@ Sys.Extended.UI.ComboBox.prototype = {
liElement.style.backgroundColor = 'Highlight';
liElement.style.color = 'HighlightText';
}
else {
liElement.className = this.get_listItemHoverCssClass;
}
else
liElement.className = this.get_listItemHoverCssClass();
}
// unselect previously highlighted item
@@ -1090,7 +1082,8 @@ Sys.Extended.UI.ComboBox.prototype = {
if (this._highlightedIndex >= 0) {
this.get_textBoxControl().value = this._optionListItems[this._highlightedIndex].text;
this.set_selectedIndex(this._highlightedIndex);
__doPostBack(this.get_element().id, '');
if(this.get_autoPostBack())
__doPostBack(this.get_element().id, '');
}
this._popupBehavior.hide();
e.preventDefault();
@@ -1240,33 +1233,6 @@ Sys.Extended.UI.ComboBox.prototype = {
return true;
}
}
else if (Sys.Browser.agent == Sys.Browser.WebKit) {
// allow special funky apple webkit keypresses
if (code == 8 // BACKSPACE in Safari 3
|| code == 9 // TAB in Safari 3
|| code == 19 // PAUSE BREAK Safari 3
|| code == 33 // PAGEUP in Safari 3
|| code == 34 // PAGEDOWN in Safari 3
|| code == 35 // END in Safari 3
|| code == 36 // HOME in Safari 3
|| code == 37 // ARROWLEFT in Safari 3
|| code == 39 // ARROWRIGHT in Safari 3
|| code == 45 // INSERT in Safari 3
|| code == 46 // DELETE in Safari 3
|| code == 91 // WINDOWS LEFT Safari 3
|| code == 92 // WINDOWS RIGHT Safari 3
|| code == 93 // MENU Safari 3
|| code == 113 // F2 Safari 3
|| code == 115 // F4 Safari 3
|| code == 118 // F7 Safari 3
|| code == 119 // F8 Safari 3
|| code == 120 // F9 Safari 3
|| code == 122 // F11 Safari 3
|| code == 145 // SCROLL LOCK Safari 3
)
return true;
}
else if (Sys.Browser.agent != Sys.Browser.InternetExplorer) {
// allow kepress events triggered by FF & Opera
@@ -1472,7 +1438,7 @@ Sys.Extended.UI.ComboBox.prototype = {
}
// typedCharacter, textBoxValue, selectionPrefix, selectionSuffix, selectionTextFirst
info.typedCharacter = String.fromCharCode(e.charCode);
info.typedCharacter = String.fromCharCode(e.rawEvent.charCode || e.rawEvent.keyCode);
info.textBoxValue = textBox.value;
info.selectionPrefix = (info.textBoxValue.length >= info.selectionStart)
? info.textBoxValue.substring(0, info.selectionStart)
@@ -1744,10 +1710,17 @@ Sys.Extended.UI.ComboBox.prototype = {
return parseInt(selectedIndex);
},
set_selectedIndex: function (value) {
if (this.get_hiddenFieldControl().value !== value.toString()) {
if(this.get_hiddenFieldControl().value !== value.toString()) {
var oldIndex = +this.get_hiddenFieldControl().value;
this.get_hiddenFieldControl().value = value.toString();
this._ensureSelectedIndex();
this.raisePropertyChanged('selectedIndex');
this.raise_selectedIndexChanged({
oldIndex: oldIndex,
newIndex: value
});
}
},
@@ -1842,6 +1815,24 @@ Sys.Extended.UI.ComboBox.prototype = {
this.raisePropertyChanged('listItemHoverCssClass');
}
},
/// <summary>
/// An event handler rised when selected index changed
/// </summary>
/// <member name="cE:AjaxControlToolkit.ComboBox.selectedIndexChanged" />
/// <event add="add_selectedIndexChanged" remove="remove_selectedIndexChanged" raise="raise_selectedIndexChanged" />
add_selectedIndexChanged: function(handler) {
this.get_events().addHandler("selectedIndexChanged", handler);
},
remove_selectedIndexChanged: function(handler) {
this.get_events().removeHandler("selectedIndexChanged", handler);
},
raise_selectedIndexChanged: function(eventArgs) {
var handler = this.get_events().getHandler('selectedIndexChanged');
if(handler) {
handler(this, eventArgs);
}
}
};
Sys.Extended.UI.ComboBox.registerClass('Sys.Extended.UI.ComboBox', Sys.UI.Control);

View File

@@ -299,37 +299,4 @@ Sys.Extended.UI.FirstDayOfWeek.prototype = {
Saturday : 6,
Default : 7
}
Sys.Extended.UI.FirstDayOfWeek.registerEnum("Sys.Extended.UI.FirstDayOfWeek");
(function(){
var D= new Date('2011-06-02T09:34:29+02:00');
if(!D || +D!== 1307000069000){
Date.fromISO= function(s){
var day, tz,
rx=/^(\d{4}\-\d\d\-\d\d([tT ][\d:\.]*)?)([zZ]|([+\-])(\d\d):(\d\d))?$/,
p= rx.exec(s) || [];
if(p[1]){
day= p[1].split(/\D/);
for(var i= 0, L= day.length; i<L; i++){
day[i]= parseInt(day[i], 10) || 0;
};
day[1]-= 1;
day= new Date(Date.UTC.apply(Date, day));
if(!day.getDate()) return NaN;
if(p[5]){
tz= (parseInt(p[5], 10)*60);
if(p[6]) tz+= parseInt(p[6], 10);
if(p[4]== '+') tz*= -1;
if(tz) day.setUTCMinutes(day.getUTCMinutes()+ tz);
}
return day;
}
return NaN;
}
}
else{
Date.fromISO= function(s){
return new Date(s);
}
}
})()
Sys.Extended.UI.FirstDayOfWeek.registerEnum("Sys.Extended.UI.FirstDayOfWeek");

View File

@@ -110,7 +110,7 @@ Sys.Extended.UI._CommonToolkitScripts.prototype = {
// "element" - DOM element
// "point" - Point object (of the form {x,y})
Sys.UI.DomElement.setLocation(element, point.x, point.y);
Sys.UI.DomElement.setLocation(element, Math.round(point.x), Math.round(point.y));
},
getContentSize: function(element) {
@@ -1008,6 +1008,28 @@ Sys.Extended.UI._CommonToolkitScripts.prototype = {
element.innerText = text;
else
element.textContent = text;
},
isMsBrowser: function () {
var edge = /edge/i.test(navigator.userAgent);
return Sys.Browser.agent === Sys.Browser.InternetExplorer
|| Sys.Browser.agent === null
|| edge;
},
isAppleBrowser: function () {
var ios = /iphone|ipad/i.test(navigator.userAgent);
var desktopSafari = window.safari && /Safari/.test(safari.pushNotification);
return ios || desktopSafari;
},
isInternetExplorer: function () {
if (Sys.Browser.agent == Sys.Browser.InternetExplorer //pre IE 11
||
(Sys.Browser.agent == null && Sys.Browser.name == "Netscape" && Sys.Browser.version == 5)) // IE 11
return true;
return false;
}
}
@@ -1231,16 +1253,6 @@ Sys.Extended.UI.ScrollBars.prototype = {
}
Sys.Extended.UI.ScrollBars.registerEnum("Sys.Extended.UI.ScrollBars", false);
var isUnminified = /param/.test(function(param) {});
Sys.Extended.Deprecated = function (oldMethodName, properMethodName) {
if (isUnminified && console && console.warn)
if(arguments.length == 1)
console.warn(oldMethodName + " is deprecated.");
else
console.warn(oldMethodName + " is deprecated. Use " + properMethodName + " instead.");
}
Sys.Extended.UI.zIndex = function() {};
Sys.Extended.UI.zIndex.BubbleChartTooltip = 10000;
Sys.Extended.UI.zIndex.ComboBoxList = 10000;
@@ -1251,4 +1263,13 @@ Sys.Extended.UI.zIndex.ModalPopupBackground = 10000;
Sys.Extended.UI.zIndex.PasswordStrengthTextDisplay = 10001;
Sys.Extended.UI.zIndex.Popup = 1000;
Sys.Extended.UI.zIndex.SeadragonContainer = 99999999;
Sys.Extended.UI.zIndex.SliderDragHandle = 999;
Sys.Extended.UI.zIndex.SliderDragHandle = 999;
Sys.Extended.UI.htmlEncode = function(text) {
return String(text)
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
};

View File

@@ -119,8 +119,8 @@ Sys.Extended.UI.ConfirmButtonBehavior.prototype = {
throw Error.argument('displayModalPopupID', String.format(Sys.Extended.UI.Resources.CollapsiblePanel_NoControlID, this._displayModalPopupID));
// Hook into ModalPopupBehavior for the confirm result
mpe.set_OnOkScript("$find('" + this.get_id() + "')._handleConfirmDialogCompletion(true);");
mpe.set_OnCancelScript("$find('" + this.get_id() + "')._handleConfirmDialogCompletion(false);");
mpe.set_onOkScript("$find('" + this.get_id() + "')._handleConfirmDialogCompletion(true);");
mpe.set_onCancelScript("$find('" + this.get_id() + "')._handleConfirmDialogCompletion(false);");
// Show the ModalPopupBehavior
mpe.show();

View File

@@ -34,6 +34,7 @@ Sys.Extended.UI.DragDropList = function(associatedElement) {
this._originalParent = null;
this._originalNextSibling = null;
this._originalZIndex = null;
this._originalOpacity = null;
this._currentContext = null;
this._data = null;
@@ -93,6 +94,7 @@ Sys.Extended.UI.DragDropList.prototype = {
this._dragVisual.style.width = dragObject.offsetWidth + "px";
this._dragVisual.style.height = dragObject.offsetHeight + "px";
this._originalOpacity = this._dragVisual.style.opacity;
this._dragVisual.style.opacity = "0.4";
this._dragVisual.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(opacity=0.4);";
this._originalZIndex = this._dragVisual.style.zIndex;
@@ -112,14 +114,6 @@ Sys.Extended.UI.DragDropList.prototype = {
dragVisualContainer.appendChild(this._dragVisual);
var newOffset = Sys.Extended.UI.DragDropManager._getInstance().getScrollOffset(dragObject, true);
if(oldOffset.x !== newOffset.x || oldOffset.y !== newOffset.y) {
var diff = Sys.Extended.UI.DragDropManager._getInstance().subtractPoints(oldOffset, newOffset);
var location = Sys.Extended.UI.DragDropManager._getInstance().subtractPoints(currentLocation, diff);
$common.setLocation(dragVisualContainer, location);
}
return dragVisualContainer;
},
@@ -169,13 +163,19 @@ Sys.Extended.UI.DragDropList.prototype = {
if(this._dragMode === Sys.Extended.UI.DragMode.Copy) {
this._floatContainerInstance.removeChild(this._dragVisual);
} else {
// NOTE: There seems to be a cursor issue in Mozilla when setting the opacity to 1. We
// can work around this by setting the opacity to anything lower than 1 instead.
this._dragVisual.style.opacity = "0.999";
//_dragVisual.style.opacity = "1";
this._dragVisual.style.filter = "";
this._dragVisual.style.zIndex = this._originalZIndex ? this._originalZIndex : 0;
if(this._originalOpacity === "") {
this._dragVisual.style.removeProperty("opacity");
} else {
this._dragVisual.style.opacity = this._originalOpacity;
}
if(this._originalZIndex === "") {
this._dragVisual.style.removeProperty("z-index");
} else {
this._dragVisual.style.zIndex = this._originalZIndex;
}
// restore the height/width of the drag visual.
//

View File

@@ -118,15 +118,12 @@ Sys.Extended.UI.FilteredTextBoxBehavior.prototype = {
(evt.ctrlKey /* Control keys */))
return;
if(evt.rawEvent.keyIdentifier) {
if("keyIdentifier" in evt.rawEvent) {
// Safari
// Note (Garbin): used the underlying rawEvent insted of the DomEvent instance.
if(evt.rawEvent.ctrlKey || evt.rawEvent.altKey || evt.rawEvent.metaKey)
return;
if(evt.rawEvent.keyIdentifier.substring(0, 2) != "U+")
return;
scanCode = evt.rawEvent.charCode;
if(scanCode == 63272 /* Delete */)
return;
@@ -179,7 +176,7 @@ Sys.Extended.UI.FilteredTextBoxBehavior.prototype = {
// Else if it was decided that it shouldn't be allowed,
// raise the Filtered event and return false to filter the key
this.raiseFiltered(new Sys.Extended.UI.FilteredTextBoxEventArgs(key));
this.raise_filtered(new Sys.Extended.UI.FilteredTextBoxEventArgs(key));
return false;
},

View File

@@ -1772,7 +1772,9 @@ Sys.Extended.UI.HtmlEditor.DesignPanel.prototype = {
var node = range.startContainer,
pos = range.startOffset;
if(node.ownerDocument.id != "EditorDocument")
if(node.ownerDocument.id != "EditorDocument"
&&
node.ownerDocument.uniqueID.substring(0, 6) != "ms__id")
return false;
if((range.startContainer.nodeType == 1 && range.startContainer.tagName.toUpperCase() == "TR") ||

View File

@@ -339,7 +339,6 @@ Sys.Extended.UI.HtmlEditor.DesignPanelEventHandler = function(ev) {
Sys.Extended.UI.HtmlEditor._stopEvent(ev);
return false;
break;
case "x":
if(this.isShadowed()) {
Sys.Extended.UI.HtmlEditor._stopEvent(ev);
@@ -441,14 +440,12 @@ Sys.Extended.UI.HtmlEditor.DesignPanelEventHandler = function(ev) {
Sys.Extended.UI.HtmlEditor._stopEvent(ev);
return false;
break;
case "0": // test KEY
var str1 = "Your browser:\n\n" + navigator.userAgent;
alert(str1);
Sys.Extended.UI.HtmlEditor._stopEvent(ev);
return false;
break;
case "9":
if(!Sys.Extended.UI.HtmlEditor.isIE) {
var sel = editor._getSelection(),
@@ -491,7 +488,6 @@ Sys.Extended.UI.HtmlEditor.DesignPanelEventHandler = function(ev) {
Sys.Extended.UI.HtmlEditor._stopEvent(ev);
return false;
break;
}
}
if(cmd) {

View File

@@ -9,7 +9,7 @@ Sys.Extended.UI.HtmlEditor.TrimAll = function(value) {
};
Sys.Extended.UI.HtmlEditor.isIE = (Sys.Browser.agent == Sys.Browser.InternetExplorer);
Sys.Extended.UI.HtmlEditor.isSafari = (Sys.Browser.agent == Sys.Browser.Safari);
Sys.Extended.UI.HtmlEditor.isSafari = (Sys.Browser.agent == Sys.Browser.Safari || (Sys.Browser.agent == null && Sys.Browser.version == 5 && Sys.Browser.name == "Netscape"));
Sys.Extended.UI.HtmlEditor.isOpera = (Sys.Browser.agent == Sys.Browser.Opera);
Sys.Extended.UI.HtmlEditor.tryReplaceRgb = function(value) {

View File

@@ -20,7 +20,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
/// <getter>get_isDirty</getter>
/// <member name="cP:AjaxControlToolkit.HtmlEditorExtender.isDirty" />
this._isDirty = false;
this._viewMode = 'content';
this._lastMode = Sys.Extended.UI.HtmlEditorExtenderMode.Content;
/// <summary>
/// Determines whether or not to display a source view tab/button to see the source view of HtmlEditorExtender
@@ -30,6 +30,14 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
/// <member name="cP:AjaxControlToolkit.HtmlEditorExtender.displaySourceTab" />
this._displaySourceTab = false;
/// <summary>
/// Determines whether or not to display a preview tab/button providing access to HtmlEditorExtender<65>s preview
/// </summary>
/// <getter>get_displayPreviewTab</getter>
/// <setter>set_displayPreviewTab</setter>
/// <member name="cP:AjaxControlToolkit.HtmlEditorExtender.displayPreviewTab" />
this._displayPreviewTab = false;
/// <summary>
/// Button width in pixels
/// </summary>
@@ -119,6 +127,18 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_source']
};
this._buttonPreviewTemplate = {
nodeName: 'input',
properties: {
type: 'button',
style: {
width: this._ButtonWidth + 'px',
height: this._ButtonHeight + 'px'
}
},
cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_preview']
};
this._textboxTemplate = {
nodeName: 'input',
properties: {
@@ -145,15 +165,15 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
cssClasses: ['ajax__html_editor_extender_buttoncontainer']
};
this._topButtonContainerTemplate2 = {
this._bottomButtonsContainerTemplate = {
nodeName: 'div',
properties: {
id: id + '_ExtenderButtonContainer2',
id: id + '_ExtenderModeButtonContainer',
style: {
clear: 'both'
}
},
cssClasses: ['ajax__html_editor_extender_buttoncontainer2']
cssClasses: ['ajax__html_editor_extender_modebuttonscontainer']
};
// variables
@@ -168,14 +188,16 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
this._toolbarButtons = null;
this._editableDiv = null;
this._sourceViewDiv = null;
this._previewDiv = null;
this._topButtonContainer = null;
this._topButtonContainer2 = null;
this._bottomButtonsContainer = null;
this._buttons = [];
this._requested_buttons = new Array();
this._colorPicker = null;
this._txtBoxForColor = null;
this._contentViewButton = null;
this._sourceViewButton = null;
this._previewButton = null;
this._popupDiv = null;
this._btnDone = null;
this._btnCancel = null;
@@ -187,6 +209,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior = function(element) {
this._contentViewClickDelegate = null;
this._sourceViewClickDelegate = null;
this._sourceViewDivOnBlurDelegate = null;
this._previewClickDelegate = null;
this._imageCancelClickDelegate = null;
// Hook into the ASP.NET WebForm_OnSubmit function to encode html tags prior to submission
@@ -203,15 +226,20 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
HtmlEditorExtender_editableDivs[HtmlEditorExtender_editableDivs.length] = this;
this._button_list = new Array();
var focused = this._element === document.activeElement;
this._createContainer();
this._createTopButtonContainer();
this._createButton();
this._createEditableDiv();
if(this.get_displaySourceTab()) {
if(this.get_displaySourceTab())
this._createSourceViewDiv();
this._createTopButtonContainer2();
}
if(this.get_displayPreviewTab())
this._createPreviewDiv();
if(this._hasMultipleTabs())
this._createBottomButtonsContainer();
// get form that contains textbox
var formElement = this._textbox._element.parentNode;
@@ -247,9 +275,14 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
this._editableDivOnFocusDelegate = Function.createDelegate(this, this._editableDiv_onfocus);
this._btnClickDelegate = Function.createDelegate(this, this._executeCommand);
if(this.get_displaySourceTab()) {
this._contentViewClickDelegate = Function.createDelegate(this, this._contentView_click);
if(this.get_displaySourceTab())
this._sourceViewClickDelegate = Function.createDelegate(this, this._sourceView_click);
if(this.get_displayPreviewTab())
this._previewClickDelegate = Function.createDelegate(this, this._preview_click);
if(this._hasMultipleTabs()) {
this._contentViewClickDelegate = Function.createDelegate(this, this._contentView_click);
this._sourceViewDivOnBlurDelegate = Function.createDelegate(this, this._sourceViewDiv_onblur);
}
@@ -259,11 +292,19 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
$addHandler(this._editableDiv, 'focus', this._editableDivOnFocusDelegate, true);
$addHandler(this._topButtonContainer, 'click', this._btnClickDelegate, true);
if(this.get_displaySourceTab()) {
$addHandler(this._contentViewButton, 'click', this._contentViewClickDelegate, true);
if(this.get_displaySourceTab())
$addHandler(this._sourceViewButton, 'click', this._sourceViewClickDelegate, true);
if(this.get_displayPreviewTab())
$addHandler(this._previewButton, 'click', this._previewClickDelegate, true);
if(this._hasMultipleTabs()) {
$addHandler(this._contentViewButton, 'click', this._contentViewClickDelegate, true);
$addHandler(this._sourceViewDiv, 'blur', this._sourceViewDivOnBlurDelegate, true);
}
if(focused)
this._editableDiv.focus();
},
_dispose: function() {
@@ -272,9 +313,14 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
$removeHandler(this._editableDiv, 'focus', this._editableDivOnFocusDelegate);
$removeHandler(this._topButtonContainer, 'click', this._btnClickDelegate);
if(this.get_displaySourceTab()) {
$removeHandler(this._contentViewButton, 'click', this._contentViewClickDelegate);
if(this.get_displaySourceTab())
$removeHandler(this._sourceViewButton, 'click', this._sourceViewClickDelegate);
if(this.get_displayPreviewTab())
$removeHandler(this.previewButton, 'click', this._previewClickDelegate);
if(this._hasMultipleTabs()) {
$removeHandler(this._contentViewButton, 'click', this._contentViewClickDelegate);
$removeHandler(this._sourceViewDiv, 'blur', this._sourceViewDivOnBlurDelegate);
}
@@ -284,6 +330,10 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
Sys.Extended.UI.HtmlEditorExtenderBehavior.callBaseMethod(this, 'dispose');
},
_hasMultipleTabs: function(){
return this.get_displaySourceTab() || this.get_displayPreviewTab();
},
_createContainer: function() {
var e = this.get_element();
this._container = $common.createElementFromTemplate(this._containerTemplate, e.parentNode);
@@ -306,6 +356,8 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
},
_createButton: function() {
var self = this;
var isIE = Sys.Browser.agent == Sys.Browser.InternetExplorer;
for(i = 0; i < this._toolbarButtons.length; i++) {
var _btn;
@@ -353,7 +405,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
change: function(e) {
var value = this.options[this.selectedIndex].value;
setTimeout(function() {
document.execCommand("fontname", false, value);
self.setFontFamily(value);
}, 200);
}
}
@@ -425,7 +477,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
change: function(e) {
var value = this.options[this.selectedIndex].value;
setTimeout(function() {
document.execCommand("fontsize", false, value);
self.setFontSize(value);
}, 200);
}
}
@@ -527,36 +579,45 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
this._backColor.setAttribute('unselectable', 'on');
} else {
var map = {
Copy: 1,
Cut: 1,
Paste: 1
};
_btn = $common.createElementFromTemplate({
nodeName: 'input',
properties: {
type: 'button',
id: this._id + this._toolbarButtons[i].CommandName,
name: this._toolbarButtons[i].CommandName,
title: this._toolbarButtons[i].Tooltip,
style: {
width: '23px',
height: '21px'
}
},
cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName]
}, this._topButtonContainer);
_btn.setAttribute('unselectable', 'on');
if(Sys.Browser.agent != Sys.Browser.InternetExplorer && map[this._toolbarButtons[i].CommandName]) {
// don't render button
} else {
_btn = $common.createElementFromTemplate({
nodeName: 'input',
properties: {
type: 'button',
id: this._id + this._toolbarButtons[i].CommandName,
name: this._toolbarButtons[i].CommandName,
title: this._toolbarButtons[i].Tooltip,
style: {
width: '23px',
height: '21px'
}
},
cssClasses: ['ajax__html_editor_extender_button ajax__html_editor_extender_' + this._toolbarButtons[i].CommandName]
}, this._topButtonContainer);
_btn.setAttribute('unselectable', 'on');
}
Array.add(this._buttons, _btn);
}
}
},
setFontFamily: function(fontFamilyName) {
this._executeStyleWithCssCommand();
document.execCommand("fontname", false, fontFamilyName);
},
setFontSize: function(fontSize) {
this._executeStyleWithCssCommand();
document.execCommand("fontsize", false, fontSize);
},
_executeStyleWithCssCommand: function(){
var styleWithCssCmdName = 'styleWithCSS';
var isStyleWithCssCommandAvailable = document.queryCommandSupported(styleWithCssCmdName);
if(isStyleWithCssCommandAvailable)
document.execCommand(styleWithCssCmdName, false, true);
},
_createEditableDiv: function() {
var id = this.get_id(),
height;
@@ -585,17 +646,22 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
cssClasses: ['ajax__html_editor_extender_texteditor']
}, this._container);
this._textbox._element.value = this._textbox._element.value.replace('&#x26;amp&#x3B;', '&#x26;');
this._textbox._element.value = this._textbox._element.value.replace(/&amp;/g, '&');
this._editableDiv.innerHTML = this._textbox._element.value;
this._oldContents = this._editableDiv.innerHTML;
$common.setVisible(this._textbox._element, false);
},
_createTopButtonContainer2: function() {
this._topButtonContainer2 = $common.createElementFromTemplate(this._topButtonContainerTemplate2, this._container);
this._contentViewButton = $common.createElementFromTemplate(this._buttonContentTemplate, this._topButtonContainer2);
this._sourceViewButton = $common.createElementFromTemplate(this._buttonSourceTemplate, this._topButtonContainer2);
_createBottomButtonsContainer: function() {
this._bottomButtonsContainer = $common.createElementFromTemplate(this._bottomButtonsContainerTemplate, this._container);
this._contentViewButton = $common.createElementFromTemplate(this._buttonContentTemplate, this._bottomButtonsContainer);
if(this.get_displaySourceTab())
this._sourceViewButton = $common.createElementFromTemplate(this._buttonSourceTemplate, this._bottomButtonsContainer);
if(this.get_displayPreviewTab())
this._previewButton = $common.createElementFromTemplate(this._buttonPreviewTemplate, this._bottomButtonsContainer);
},
_createSourceViewDiv: function() {
@@ -619,6 +685,26 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
$common.setVisible(this._sourceViewDiv, false);
},
_createPreviewDiv: function () {
var id = this.get_id(),
height = this._container.clientHeight - 25;
this._previewDiv = $common.createElementFromTemplate({
nodeName: 'div',
properties: {
id: id + '_ExtenderPreview',
style: {
height: height + 'px',
overflow: 'auto',
clear: 'both'
}
},
cssClasses: ['ajax__html_editor_extender_texteditor']
}, this._container);
$common.setVisible(this._previewDiv, false);
},
_editableDiv_onblur: function() {
this._textbox._element.value = this._encodeHtml();
this._isFocusInEditableDiv = false;
@@ -652,54 +738,89 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
this._editableDiv.innerHTML = this._textbox._element.value;
},
_contentView_click: function() {
if(this._viewMode != 'content') {
$common.setVisible(this._topButtonContainer, true);
$common.setVisible(this._editableDiv, true);
_contentView_click: function () {
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Content)
return;
if(this._sourceViewDiv.textContent != undefined)
this._editableDiv.innerHTML = this._sourceViewDiv.textContent;
else
this._editableDiv.innerHTML = this._sourceViewDiv.innerText;
$common.setVisible(this._topButtonContainer, true);
$common.setVisible(this._editableDiv, true);
this._oldContents = this._editableDiv.innerHTML;
$common.setVisible(this._sourceViewDiv, false);
this._viewMode = 'content';
}
if(this._sourceViewDiv.textContent != undefined)
this._editableDiv.innerHTML = this._sourceViewDiv.textContent;
else
this._editableDiv.innerHTML = this._sourceViewDiv.innerText;
this._oldContents = this._editableDiv.innerHTML;
$common.setVisible(this._sourceViewDiv, false);
$common.setVisible(this._previewDiv, false);
this._lastMode = Sys.Extended.UI.HtmlEditorExtenderMode.Content;
},
_sourceView_click: function() {
if(this._viewMode != 'source') {
$common.setVisible(this._sourceViewDiv, true);
_sourceView_click: function () {
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Source)
return;
$common.setVisible(this._sourceViewDiv, true);
this._copyContentToSource();
this._oldContents = this._editableDiv.innerHTML;
$common.setVisible(this._editableDiv, false);
$common.setVisible(this._topButtonContainer, false);
$common.setVisible(this._previewDiv, false);
this._lastMode = Sys.Extended.UI.HtmlEditorExtenderMode.Source;
},
_preview_click: function () {
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Preview)
return;
$common.setVisible(this._previewDiv, true);
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Content)
this._copyContentToSource();
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Source) {
if(this._sourceViewDiv.textContent != undefined)
this._sourceViewDiv.textContent = this._editableDiv.innerHTML;
this._previewDiv.innerHTML = this._sourceViewDiv.textContent;
else
this._sourceViewDiv.innerText = this._editableDiv.innerHTML;
this._oldContents = this._editableDiv.innerHTML;
$common.setVisible(this._editableDiv, false);
$common.setVisible(this._topButtonContainer, false);
this._viewMode = 'source';
this._previewDiv.innerHTML = this._sourceViewDiv.innerText;
}
if(this._lastMode === Sys.Extended.UI.HtmlEditorExtenderMode.Content)
this._previewDiv.innerHTML = this._editableDiv.innerHTML;
$common.setVisible(this._editableDiv, false);
$common.setVisible(this._sourceViewDiv, false);
$common.setVisible(this._topButtonContainer, false);
this._lastMode = Sys.Extended.UI.HtmlEditorExtenderMode.Preview;
},
_copyContentToSource: function() {
var html = this._editableDiv.innerHTML;
if(/^\s*$/.test(this._editableDiv.innerText)
&& this._editableDiv.innerHTML === "<br>")
html = "";
if(this._sourceViewDiv.textContent != undefined)
this._sourceViewDiv.textContent = this.cleanHtml(html);
else
this._sourceViewDiv.innerText = this.cleanHtml(html);
},
cleanHtml: function(html) {
return html.replace(/<br>/g, "<br />");
},
_btnCancel_click: function() {
this._popupBehavior.hide();
},
_attributes: {
style: 'st_yle_',
size: 'si_ze_',
color: 'co_lor_',
face: 'fa_ce_',
align: 'al_ign_'
},
_rgbToHex: function(s) {
var a = /rgb\s?\(\s?(\d+)\s?,\s?(\d+)\s?,\s?(\d+)\s?\)/.exec(s);
return '#' + (parseInt(a[3], 10) | (parseInt(a[2], 10) << 8) | (parseInt(a[1], 10) << 16)).toString(16);
return '#' + ("000000" + (parseInt(a[3], 10) | (parseInt(a[2], 10) << 8) | (parseInt(a[1], 10) << 16)).toString(16)).substr(-6);
},
_encodeHtml: function() {
@@ -708,22 +829,6 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
elements = this._editableDiv.getElementsByTagName('*'),
element;
for(var i = 0; element = elements[i]; i++) {
try {
element.className = '';
element.removeAttribute('class');
} catch(ex) { }
try {
element.id = '';
element.removeAttribute('id');
} catch(ex) { }
try {
element.removeAttribute('width');
} catch(ex) { }
}
var html = this._editableDiv.innerHTML;
if(isIE) {
//force attributes to be double quoted
@@ -770,40 +875,18 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
},
_editableDiv_submit: function() {
var char = 0,
selection = null;
setTimeout(function() {
if(this._editableDiv != null)
this._editableDiv.focus();
}, 0);
if(Sys.Browser.agent != Sys.Browser.Firefox) {
if(document.selection) {
selection = document.selection.createRange();
selection.moveStart('character', char);
selection.select();
} else {
selection = window.getSelection();
if(this._editableDiv.firstChild !== null)
selection.collapse(this._editableDiv.firstChild, char);
}
}
this._textbox._element.value = this._encodeHtml();
},
_isHtmlElement: function (obj) {
_isHtmlElement: function(obj) {
if(obj instanceof HTMLElement)
return true;
return false;
},
isValidTarget: function(target)
{
if (target.name == undefined
isValidTarget: function(target) {
if(target.name == undefined
||
target.name == ""
||
@@ -813,22 +896,40 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
return true;
},
isSimpleTextDecoration: function(commandName) {
if(commandName)
return commandName.toLowerCase() == "bold"
|| commandName.toLowerCase() == "italic"
|| commandName.toLowerCase() == "underline";
return false;
},
_executeCommand: function(command) {
if(!this.isValidTarget(command.target))
return;
var selection = this._getSelection();
if(selection != null) {
var isEditDivChild = this._isDescendantOrSelf(this._editableDiv, selection.commonAncestorContainer);
if(!isEditDivChild)
return;
}
var isFireFox = Sys.Browser.agent == Sys.Browser.Firefox,
isWebKit = Sys.Browser.agent == Sys.Browser.Safari,
isIE = (Sys.Browser.agent == Sys.Browser.InternetExplorer || Sys.Browser.agent == null),
delcolorPicker_onchange = Function.createDelegate(this, this._colorPicker_onchange);
if(isFireFox)
document.execCommand('styleWithCSS', false, false);
if(!this.isSimpleTextDecoration(command.target.name))
this._executeStyleWithCssCommand();
var map = {
JustifyRight: 1,
JustifyLeft: 1,
JustifyCenter: 1,
JustifyFull: 1,
Indent: 1,
Outdent: 1
};
@@ -904,7 +1005,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
document.execCommand(command.target.name, false, null);
}
} else if(command.target.name == 'InsertImage') {
// if focus in not at editable div then dom error occurs
// if focus in not at editable div then dom error occurs
if(!this._isFocusInEditableDiv)
this._editableDiv.focus();
@@ -929,6 +1030,21 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
left: '',
opacity: '1'
});
} else if(command.target.name == 'CleanWord') {
this._editableDiv.innerHTML = this.cleanWordHtml(this._editableDiv.innerHTML);
} else if(command.target.name == 'Indent') {
if(isIE)
document.execCommand(command.target.name, false, null);
else {
var selectionHtml = this._getSelectionHtml();
var indentedHtml = "<blockquote style=\"margin: 0 0 0 40px; border: none; padding: 0px;\"><div>" + selectionHtml + "</div></blockquote>";
document.execCommand("insertHTML", false, indentedHtml);
}
} else if(command.target.name == 'InsertHorizontalRule') {
if(isWebKit)
document.execCommand("insertHTML", false, "<hr />");
else
document.execCommand(command.target.name, false, null);
} else {
document.execCommand(command.target.name, false, null);
}
@@ -938,28 +1054,86 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
_colorPicker_onchange: function(e) {
this.restoreSelection();
if(/backcolor/i.test(this._commandName)) {
this.setColor(this._commandName, "#" + e._selectedColor);
},
setColor: function(commandName, color) {
if(/backcolor/i.test(commandName)) {
var isFireFox = Sys.Browser.agent == Sys.Browser.Firefox;
if(isFireFox) {
document.execCommand('stylewithcss', false, true);
document.execCommand("hilitecolor", false, "#" + e._selectedColor);
document.execCommand("hilitecolor", false, color);
document.execCommand('stylewithcss', false, false);
} else {
document.execCommand("backcolor", false, "#" + e._selectedColor);
document.execCommand("backcolor", false, color);
}
} else
document.execCommand(this._commandName, false, "#" + e._selectedColor);
} else {
document.execCommand('stylewithcss', false, true);
document.execCommand(commandName, false, color);
}
},
/// <summary>
/// Saves selected text
/// </summary>
/// <member name="cM:AjaxControlToolkit.HtmlEditorExtender.saveSelection" />
saveSelection: function () {
saveSelection: function() {
if(!(this instanceof Sys.Extended.UI.HtmlEditorExtenderBehavior))
return;
this._savedRange = this._getSelection();
},
_getSelection: function() {
if(window.getSelection) //non IE Browsers
this._savedRange = window.getSelection().rangeCount && window.getSelection().getRangeAt(0);
return window.getSelection().rangeCount && window.getSelection().getRangeAt(0);
else if(document.selection) //IE
this._savedRange = document.selection.createRange();
return document.selection.createRange();
return null;
},
_getSelectionHtml: function() {
var userSelection;
if(window.getSelection) {
userSelection = window.getSelection();
if(userSelection.getRangeAt)
var range = userSelection.getRangeAt(0);
else {
var range = document.createRange();
range.setStart(userSelection.anchorNode, userSelection.anchorOffset);
range.setEnd(userSelection.focusNode, userSelection.focusOffset);
}
var clonedSelection = range.cloneContents();
var div = document.createElement('div');
div.appendChild(clonedSelection);
return div.innerHTML;
} else if(document.selection) {
userSelection = document.selection.createRange();
return userSelection.htmlText;
} else
return '';
},
_isDescendantOrSelf: function(parent, child) {
if(!parent)
return false;
if(!child)
return false;
if(parent == child)
return true;
var node = child.parentNode;
while(node != null) {
if(node == parent)
return true;
node = node.parentNode;
}
return false;
},
/// <summary>
@@ -990,6 +1164,63 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
}
},
cleanWordHtml: function(html) {
html = this._cleanOP(html);
html = this._cleanMSO(html);
html = this._cleanStyleAttr(html);
html = this._cleanLangAttr(html);
html = this._cleanXmlNamespaceTags(html);
html = this._cleanComments(html);
html = this._cleanFontFamily(html);
html = this._cleanSpan(html);
html = this._cleanB(html);
return html;
},
_cleanOP: function(html) {
html = html.replace(/<o:p>\s*<\/o:p>/g, '');
html = html.replace(/<o:p>[\s\S]*?<\/o:p>/g, '&nbsp;');
return html;
},
_cleanMSO: function(html) {
return html.replace(/\s*mso-[^:]+:[^;"]+;?/gi, '');
},
_cleanFontFamily: function(html) {
return html.replace(/\s*FONT-FAMILY:[^;"]*;?/gi, '');
},
_cleanSpan: function(html) {
html = html.replace(/<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi, '&nbsp;');
html = html.replace(/<SPAN\s*[^>]*><\/SPAN>/gi, '');
html = html.replace(/<SPAN\s*>([\s\S]*?)<\/SPAN>/gi, '$1');
html = html.replace(/<span>\s*<\/span>/gi, '');
return html;
},
_cleanStyleAttr: function(html) {
return html.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3");
},
_cleanLangAttr: function(html) {
return html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
},
_cleanXmlNamespaceTags: function(html) {
return html.replace(/<\/?\w+:[^>]*>/gi, '');
},
_cleanComments: function(html) {
return html.replace(/<\!--[\s\S]*?-->/g, '');
},
_cleanB: function(html) {
html = html.replace(/<b>\s*&nbsp;\s*<\/b>/gi, '');
html = html.replace(/<b>\s*<\/b>/gi, '');
return html;
},
_elementVisible: function(obj, flag) {
if(obj.tagName == 'FORM')
return;
@@ -1035,7 +1266,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
}
},
get_buttonWidth: function () {
get_buttonWidth: function() {
return this._ButtonWidth;
},
get_ButtonWidth: function() {
@@ -1043,8 +1274,8 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
return this.get_buttonWidth();
},
set_buttonWidth: function (value) {
if (this._ButtonWidth != value) {
set_buttonWidth: function(value) {
if(this._ButtonWidth != value) {
this._ButtonWidth = value;
this.raisePropertyChanged('ButtonWidth');
}
@@ -1057,7 +1288,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
get_buttonHeight: function() {
return this._ButtonHeight;
},
get_ButtonHeight: function () {
get_ButtonHeight: function() {
Sys.Extended.Deprecated("get_ButtonHeight()", "get_buttonHeight()");
return this.get_buttonHeight();
},
@@ -1068,12 +1299,12 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
this.raisePropertyChanged('ButtonHeight');
}
},
set_ButtonHeight: function (value) {
set_ButtonHeight: function(value) {
Sys.Extended.Deprecated("set_ButtonHeight(value)", "set_buttonHeight(value)");
this.set_buttonHeight();
},
get_toolbarButtons: function () {
get_toolbarButtons: function() {
return this._toolbarButtons;
},
get_ToolbarButtons: function() {
@@ -1087,7 +1318,7 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
this.raisePropertyChanged('ToolbarButtons');
}
},
set_ToolbarButtons: function (value) {
set_ToolbarButtons: function(value) {
Sys.Extended.Deprecated("set_ToolbarButtons(value)", "set_ToolbarButtons(value)");
this.set_toolbarButtons(value);
},
@@ -1103,6 +1334,17 @@ Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype = {
}
},
get_displayPreviewTab: function () {
return this._displayPreviewTab;
},
set_displayPreviewTab: function (value) {
if(this._displayPreviewTab != value) {
this._displayPreviewTab = value;
this.raisePropertyChanged('DisplayPreviewTab');
}
},
/// <summary>
/// Fires when text change occurs
/// </summary>
@@ -1188,4 +1430,10 @@ ajaxClientUploadComplete = function(sender, e) {
htmlEditorExtender._savedRange.insertNode(node);
}
}
};
Sys.Extended.UI.HtmlEditorExtenderMode = {
Content: 0,
Source: 1,
Preview: 2
};

View File

@@ -211,6 +211,9 @@ Sys.Extended.UI.LineChart.prototype = {
this.roundedTickRange = Math.ceil(unroundedTickSize / pow10x) * pow10x;
}
if(this.roundedTickRange == 0)
this.roundedTickRange = 1;
this.startX = this.startX + (this.roundedTickRange * 10 * this._valueAxisLines / 10).toString().length * this.charLength;
},
@@ -441,7 +444,7 @@ Sys.Extended.UI.LineChart.prototype = {
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<circle id="Dot{2}" cx="{0}" cy="{1}" r="4" style="fill:{3};stroke:{3}" onmouseover="ShowTooltip(this, evt, {4}, \'{5}\')" onmouseout="HideTooltip(this, evt)"></circle>', me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor, yVal, me._areaDataLabel) + String.format('<text id="LegendText" x="{0}" y="{1}">{2}</text></svg>', me.startX + (me.xInterval * index) + (me.xInterval * 20 / 100), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)) - 7.5, displayValues ? yVal : "");
} else {
if(index > 0)
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<circle id="Dot{2}" cx="{0}" cy="{1}" r="4" style="fill:{3};stroke:{3}" onmouseover="ShowTooltip(this, evt, {4}, \'{5}\')" onmouseout="HideTooltip(this, evt)"></circle>', me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor, yVal, me._areaDataLabel) + String.format('<path d="M{0} {1} {2} {3}" id="Line{4}" style="fill:{5};stroke:{5}"></path></svg>', lastStartX[j], lastStartY[j], me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor) + String.format('<text id="LegendText" x="{0}" y="{1}">{2}</text></svg>', me.startX + (me.xInterval * index) + (me.xInterval * 20 / 100), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)) + 7.5, displayValues ? yVal : "");
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<circle id="Dot{2}" cx="{0}" cy="{1}" r="4" style="fill:{3};stroke:{3}" onmouseover="ShowTooltip(this, evt, {4}, \'{5}\')" onmouseout="HideTooltip(this, evt)"></circle>', me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor, yVal, me._areaDataLabel) + String.format('<path d="M{0} {1} {2} {3}" id="Line{4}" style="fill:{5};stroke:{5}"></path>', lastStartX[j], lastStartY[j], me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor) + String.format('<text id="LegendText" x="{0}" y="{1}">{2}</text></svg>', me.startX + (me.xInterval * index) + (me.xInterval * 20 / 100), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)) + 7.5, displayValues ? yVal : "");
else
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<circle id="Dot{2}" cx="{0}" cy="{1}" r="4" style="fill:{3};stroke:{3}" onmouseover="ShowTooltip(this, evt, {4}, \'{5}\')" onmouseout="HideTooltip(this, evt)"></circle>', me.startX + (me.xInterval * index) + (me.xInterval / 2), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)), j + 1, me._series[j].LineColor, yVal, me._areaDataLabel) + String.format('<text id="LegendText" x="{0}" y="{1}">{2}</text></svg>', me.startX + (me.xInterval * index) + (me.xInterval * 20 / 100), me.startY - Math.round(yVal * (me.yInterval / me.roundedTickRange)) + 7.5, displayValues ? yVal : "");
}

View File

@@ -301,7 +301,7 @@ Sys.Extended.UI.ListSearchBehavior.prototype = {
// Returns true if the specified charCode is a key rather than a normal (displayable) character
// Walking through Sys.UI.Keys won't work -- Ampersand is code 38 which matches
if(Sys.Browser.agent == Sys.Browser.Firefox && e.rawEvent.keyCode)
if(Sys.Browser.agent == Sys.Browser.Firefox && Sys.Browser.version < 66 && e.rawEvent.keyCode)
return false;
if(Sys.Browser.agent == Sys.Browser.Opera && e.rawEvent.which == 0)

View File

@@ -154,6 +154,7 @@ Sys.Extended.UI.Resources = {
"Tabs_OwnerExpected": "owner must be set before initialize",
"Tabs_PropertySetAfterInitialization": "{0} cannot be changed after initialization",
"Tabs_PropertySetBeforeInitialization": "{0} cannot be changed before initialization",
"Tabs_UnknownTheme": "Theme {0} cannot be converted to a CSS class",
"ValidatorCallout_DefaultErrorMessage": "This control is invalid",
"MultiHandleSlider_CssHeightWidthRequired": "You must specify a CSS width and height for all handle styles as well as the rail.",
"AsyncFileUpload_InternalErrorMessage": "The AsyncFileUpload control has encountered an error with the uploader in this page. Please refresh the page and try again.",
@@ -172,6 +173,7 @@ Sys.Extended.UI.Resources = {
"AjaxFileUpload_SelectFileToUpload": "Please select file(s) to upload.",
"AjaxFileUpload_Pending": "pending",
"AjaxFileUpload_FileInQueue": "{0} file(s) in queue.",
"AjaxFileUpload_UploadingFileInQueue": "Uploading {0} of {1} file(s)",
"AjaxFileUpload_UploadingHtml5File": "Uploading file: {0} of size {1} bytes.",
"AjaxFileUpload_UploadingInputFile": "Uploading file: {0}.",
"AjaxFileUpload_UploadError": "An Error occured during file upload.",
@@ -185,7 +187,8 @@ Sys.Extended.UI.Resources = {
"AjaxFileUpload_Canceled": "cancelled",
"AjaxFileUpload_error": "error",
"AjaxFileUpload_MaxNumberOfFilesExceeded": "Maximum number of files exceeded",
"AjaxFileUpload_WrongFileType": "Can\u0027t add file \u0027{0}\u0027 to upload list. File with type \u0027{1}\u0027 is not allowed"
"AjaxFileUpload_WrongFileType": "Can\u0027t add file \u0027{0}\u0027 to upload list. File with type \u0027{1}\u0027 is not allowed",
"AjaxFileUpload_TooLargeFile": "The \u0027{0}\u0027 file size exceeds the {1} Kbytes limit."
};
Type.registerNamespace('Sys.Extended.UI.Localization');

View File

@@ -1,3 +1,29 @@
Sys.Extended.UI.Localization["pl"] = {
"Calendar_Today": "Dzisiaj: {0}"
"Calendar_Today": "Dzisiaj: {0}",
"AjaxFileUpload_DropFiles": "Przeciągnij tutaj pliki",
"AjaxFileUpload_AllFilesUploaded": "Wszystkie pliki przesłane.",
"AjaxFileUpload_SelectFile": "Wybierz plik",
"AjaxFileUpload_Remove": "Usuń",
"AjaxFileUpload_Upload": "Prześlij",
"AjaxFileUpload_Cancel": "Anuluj",
"AjaxFileUpload_FileList": "Lista przesłanych plików:",
"AjaxFileUpload_SelectFileToUpload": "Wybierz plik(i) do przesłania.",
"AjaxFileUpload_Pending": "oczekuje",
"AjaxFileUpload_FileInQueue": "Plików w kolejce: {0}",
"AjaxFileUpload_UploadingFileInQueue": "Przesyłam {0} z {1} plików",
"AjaxFileUpload_UploadingHtml5File": "Przesyłanie pliku: {0} z {1} bajtów.",
"AjaxFileUpload_UploadingInputFile": "Przesyłanie pliku: {0}.",
"AjaxFileUpload_UploadError": "W trakcie przesyłania pliku wystąpił błąd.",
"AjaxFileUpload_DefaultError": "Błąd przesyłania pliku.",
"AjaxFileUpload_UploadedPercentage": "przesłano {0} %",
"AjaxFileUpload_Uploading": "Przesyłam",
"AjaxFileUpload_Uploaded": "Przesłano",
"AjaxFileUpload_Cancelling": "Anulowanie...",
"AjaxFileUpload_CancellingUpload": "Anulowanie przesyłania...",
"AjaxFileUpload_UploadCanceled": "Przesyłanie pliku anulowane.",
"AjaxFileUpload_Canceled": "anulowano",
"AjaxFileUpload_error": "błąd",
"AjaxFileUpload_MaxNumberOfFilesExceeded": "Wybrano zbyt dużo plików do przesyłania",
"AjaxFileUpload_WrongFileType": "Nie można dodać pliku \u0027{0}\u0027 do listy przesyłania. Pliki z roszerzeniem \u0027{1}\u0027 są niedozwolone.",
"AjaxFileUpload_TooLargeFile": "Plik \u0027{0}\u0027 przekracza maksymalny rozmiar {1} Kbajtów."
};

View File

@@ -236,11 +236,6 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
this._focusHandler = null;
}
if(this._focusHandler) {
$removeHandler(e, "focus", this._focusHandler);
this._focusHandler = null;
}
if(this._blurHandler) {
$removeHandler(e, "blur", this._blurHandler);
this._blurHandler = null;
@@ -547,29 +542,8 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
this._insertContent(c, logiccur);
curpos = this._getNextPosition(logiccur + 1);
} else {
var wrapper = Sys.Extended.UI.TextBoxWrapper.get_Wrapper(this.get_element()),
ClearText = this._getClearMask(wrapper.get_Value());
if(ClearText != "") {
var pospt = ClearText.indexOf(this.get_cultureDecimalPlaceholder());
if(pospt != -1) {
var intnum = ClearText.substring(0, pospt);
if(intnum == "0" || intnum == "-0") {
this.setSelectionRange(this._LogicLastInt - 1, this._LogicLastInt);
this._deleteTextSelection();
curpos = this._LogicLastInt;
this.setSelectionRange(curpos, curpos);
}
}
}
if(ClearText == "" && c == "0") {
curpos = this._LogicLastInt;
} else {
this._insertContentRight(c);
curpos = this._LogicLastInt;
}
this._insertContentRight(c);
curpos = this._LogicLastInt;
}
}
}
@@ -711,7 +685,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
// Execute Navigator on Mask
_ExecuteNav: function(evt, scanCode) {
if(evt.type == "keydown") {
if(this._isInternetExplorer()) {
if($common.isInternetExplorer()) {
// ctrl v
if((scanCode == 86 || scanCode == 118) && !evt.shiftKey && evt.ctrlKey && !evt.altKey) {
this._SetCancelEvent(evt);
@@ -730,7 +704,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
}
}
if(!this._isInternetExplorer() || evt.type == "keypress") {
if (!$common.isInternetExplorer() || evt.type == "keypress") {
// Shift Ins
if(evt.rawEvent.shiftKey && !evt.rawEvent.ctrlKey && !evt.rawEvent.altKey && evt.rawEvent.keyCode == 45) {
// at opera assume Ins = "-" not execute Shift-Ins
@@ -983,7 +957,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
arr_num[0] = arr_num[0].substring(0, arr_num[0].length - 1);
ClearText = arr_num[0];
if(arr_num.length = 2)
if(arr_num.length == 2)
ClearText += this.get_cultureDecimalPlaceholder() + arr_num[1];
} else {
ClearText = ClearText.substring(0, ClearText.length - 1);
@@ -1082,16 +1056,6 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
return arr;
},
_isInternetExplorer: function ()
{
if (Sys.Browser.agent == Sys.Browser.InternetExplorer //pre IE 11
||
(Sys.Browser.agent == null && Sys.Browser.name == "Netscape" && Sys.Browser.version == 5)) // IE 11
return true;
return false;
},
// Paste clip board
_ShowModalClipBoardInput: function() {
var clip = prompt(this._clipboardText, "");
@@ -1105,7 +1069,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
iniSel = -1,
fimSel = -1;
if(this._isInternetExplorer()) {
if ($common.isInternetExplorer()) {
value = window.clipboardData.getData("Text");
} else {
// save current values because lost focus
@@ -1444,16 +1408,19 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
m_mask = m_mask.split(":");
if(curpos <= 1) {
type = "H";
newcur = 3 + this._LogicFirstPos + QtdDt;
} else if(curpos >= 2 && curpos <= 4 && m_mask.length == 2) {
newcur = this._LogicFirstPos + QtdDt + 3;
} else if(curpos == 2 && m_mask.length == 2) {
type = "M";
newcur = QtdDt + this._LogicFirstPos;
newcur = this._LogicFirstPos + QtdDt + 3;
} else if (curpos >= 3 && curpos <= 5 && m_mask.length == 2) {
type = "M";
newcur = this._LogicFirstPos + QtdDt;
} else if(curpos >= 2 && curpos <= 4 && m_mask.length == 3) {
type = "M";
newcur = 6 + this._LogicFirstPos + QtdDt;
newcur = this._LogicFirstPos + QtdDt + 6;
} else if(m_mask.length == 3) {
type = "S";
newcur = QtdDt + this._LogicFirstPos;
newcur = this._LogicFirstPos + QtdDt;
}
if(type == "")
@@ -1949,6 +1916,10 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
this.loadValue(value, this._LogicLastPos);
this._inputDirection = Sys.Extended.UI.MaskedEditInputDirections.LeftToRight;
} else {
if(!this.get_clearMaskOnLostFocus() && this._LogicFirstPos > 0) {
// https://github.com/DevExpress/AjaxControlToolkit/issues/493
value = value.substr(this._LogicFirstPos);
}
this.loadValue(value, this._LogicFirstPos);
}
} else if(this._inputDirection == Sys.Extended.UI.MaskedEditInputDirections.RightToLeft && value != "") {
@@ -1985,7 +1956,33 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
containsAMPMLetters: function(value, index)
{
var currentAMPMtext = value.substring(index);
},
getMaskCharPositions: function()
{
var maskCharPositions = [];
var mask = this.get_clearMaskOnLostFocus() ? this.getVisibleMask() : this._LogicMaskConv;
for (var i = 0; i < mask.length; i++) {
var char = mask[i];
if (this.isMaskChar(char))
maskCharPositions.push(i);
}
return maskCharPositions;
},
getVisibleMask: function()
{
var clearedMask = this.replaceAll(this._LogicMaskConv, this._LogicPrompt, "");
clearedMask = this.replaceAll(clearedMask, this._LogicEscape, "");
return clearedMask;
},
isMaskChar: function(char)
{
var maskChars = "9L$CAN?";
return maskChars.indexOf(char) == -1;
},
// Load initial value in mask
@@ -1995,6 +1992,8 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
var wrapper = Sys.Extended.UI.TextBoxWrapper.get_Wrapper(this.get_element());
wrapper.set_Value(this._EmptyMask);
var maskCharPositions = this.getMaskCharPositions();
if(this._inputDirection == Sys.Extended.UI.MaskedEditInputDirections.LeftToRight) {
for(i = 0 ; i < parseInt(value.length, 10) ; i++) {
var c = value.substring(i, i + 1);
@@ -2049,7 +2048,18 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
}
}
} else {
for(i = parseInt(value.length, 10) ; i > 0 ; i--) {
var valueLength = value.length;
var maskLength = this.get_clearMaskOnLostFocus() ? this.getVisibleMask().length : this._EmptyMask.length;
maskCharPositions.splice(0, maskLength - valueLength);
for (i = parseInt(value.length, 10) ; i > 0 ; i--) {
if (!this.get_clearMaskOnLostFocus()
&& this._maskType === Sys.Extended.UI.MaskedEditType.Number
&& maskCharPositions.indexOf(i - 1) != -1)
continue;
var c = value.substring(i - 1, i);
if(this._maskType == Sys.Extended.UI.MaskedEditType.Number && this._acceptNegative != Sys.Extended.UI.MaskedEditShowSymbol.None && "+-".indexOf(c) != -1) {
@@ -2059,14 +2069,15 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
this.insertSignal(c);
}
if(this._processKey(logicPosition, c))
if (this._processKey(logicPosition, c)) {
this._insertContent(c, logicPosition);
logicPosition = this._getPreviousPosition(logicPosition - 1);
}
oldLogicPosition = logicPosition;
logicPosition = this._getPreviousPosition(logicPosition - 1);
//oldLogicPosition = logicPosition;
if(this._maskType === Sys.Extended.UI.MaskedEditType.Number && logicPosition === oldLogicPosition)
break;
//if(this._maskType === Sys.Extended.UI.MaskedEditType.Number && logicPosition === oldLogicPosition)
// break;
}
}
}
@@ -2511,7 +2522,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
var m_arrDateLD,
m_arrDate;
m_arrDate = this._filter(input.split(this.get_CultureDatePlaceholder()), function (element) {
m_arrDate = this._filter(input.split(this.get_cultureDatePlaceholder()), function (element) {
return element != "";
});
m_arrDate = this._map(m_arrDate, function (element) {
@@ -2519,9 +2530,9 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
});
if(loadFirst) {
m_arrDateLD = input.split(this.get_CultureDatePlaceholder());
if(this.get_UserDateFormat() != Sys.Extended.UI.MaskedEditUserDateFormat.None) {
if(this.get_UserDateFormat() == Sys.Extended.UI.MaskedEditUserDateFormat.DayMonthYear)
m_arrDateLD = input.split(this.get_cultureDatePlaceholder());
if(this.get_userDateFormat() != Sys.Extended.UI.MaskedEditUserDateFormat.None) {
if(this.get_userDateFormat() == Sys.Extended.UI.MaskedEditUserDateFormat.DayMonthYear)
this._cultureDateFormat = 'DMY';
if(this.get_userDateFormat() == Sys.Extended.UI.MaskedEditUserDateFormat.DayYearMonth)
this._cultureDateFormat = 'DYM';
@@ -2798,7 +2809,7 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
}
}
if(arr_num.length = 2) {
if(arr_num.length == 2) {
masktext += this.get_cultureDecimalPlaceholder() + arr_num[1];
this._LogicTextMask += this.get_cultureDecimalPlaceholder() + arr_log[1];
}
@@ -3143,6 +3154,34 @@ Sys.Extended.UI.MaskedEditBehavior.prototype = {
this._EmptyMask = masktext;
},
replaceAll: function(string, find, replace) {
return string.split(find).join(replace);
},
getTextWithoutMask: function(text)
{
var clearedMask = this.replaceAll(this._LogicMask, this._LogicPrompt, "");
clearedMask = this.replaceAll(clearedMask, this._LogicEscape, "");
var clearedText = "";
for (var charPos = 0; charPos < text.length; charPos++) {
var currentChar = text[charPos];
if (currentChar == clearedMask[0]) {
clearedMask = clearedMask.substring(1);
} else
clearedText += currentChar;
}
return clearedText;
},
isDataCharacter: function(char)
{
return char == this._LogicEscape || char == this._LogicPrompt;
},
// return text without mask but with placeholders
_getClearMask: function(masktext) {
var i = 0,

View File

@@ -73,30 +73,8 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
this._dragHandleElement = $get(this._popupDragHandleControlID);
this._popupElement = $get(this._popupControlID);
if(this._dropShadow) {
this._foregroundElement = document.createElement('div');
this._foregroundElement.id = this.get_id() + '_foregroundElement';
this._popupElement.parentNode.appendChild(this._foregroundElement);
this._foregroundElement.appendChild(this._popupElement);
} else {
this._foregroundElement = this._popupElement;
}
this._backgroundElement = document.createElement('div');
this._backgroundElement.id = this.get_id() + '_backgroundElement';
this._backgroundElement.style.display = 'none';
this._backgroundElement.style.position = 'fixed';
this._backgroundElement.style.left = '0px';
this._backgroundElement.style.top = '0px';
// Want zIndex to big enough that the background sits above everything else
// CSS 2.1 defines no bounds for the <integer> type, so pick arbitrarily
if(this._backgroundCssClass)
this._backgroundElement.className = this._backgroundCssClass;
this._foregroundElement.parentNode.appendChild(this._backgroundElement);
this._foregroundElement.style.display = 'none';
this._foregroundElement.style.position = 'fixed';
this._createDomElements();
this._showHandler = Function.createDelegate(this, this._onShow);
$addHandler(this.get_element(), 'click', this._showHandler);
@@ -184,7 +162,55 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(this, 'dispose');
},
_createDomElements: function() {
if(this._dropShadow) {
this._foregroundElement = document.createElement('div');
this._foregroundElement.id = this.get_id() + '_foregroundElement';
this._popupElement.parentNode.appendChild(this._foregroundElement);
this._foregroundElement.appendChild(this._popupElement);
} else {
this._foregroundElement = this._popupElement;
}
this._backgroundElement = document.createElement('div');
this._backgroundElement.setAttribute('data-act-control-type', 'modalPopupBackground');
this._backgroundElement.id = this.get_id() + '_backgroundElement';
this._backgroundElement.style.display = 'none';
this._backgroundElement.style.position = 'fixed';
this._backgroundElement.style.left = '0px';
this._backgroundElement.style.top = '0px';
if(this._backgroundCssClass)
this._backgroundElement.className = this._backgroundCssClass;
this._foregroundElement.parentNode.appendChild(this._backgroundElement);
this._foregroundElement.style.display = 'none';
this._foregroundElement.style.position = 'fixed';
this._setZIndex();
},
_setZIndex: function() {
var topModalPopupBackgroundZIndex = parseInt(this._findTopModalPopupBackgroundZIndex());
// Want zIndex to big enough that the background sits above everything else
// CSS 2.1 defines no bounds for the <integer> type, so pick arbitrarily
this._backgroundElement.style.zIndex = topModalPopupBackgroundZIndex ? parseInt(topModalPopupBackgroundZIndex + 1) : parseInt(Sys.Extended.UI.zIndex.ModalPopupBackground);
this._foregroundElement.style.zIndex = parseInt($common.getCurrentStyle(this._backgroundElement, 'zIndex', this._backgroundElement.style.zIndex)) + 1;
},
_findTopModalPopupBackgroundZIndex: function () {
var lastPopup = this._getLastPopup();
return lastPopup ? lastPopup._backgroundElement.style.zIndex : undefined;
},
_getLastPopup: function () {
var popups = Sys.Extended.UI.ModalPopupBehavior.popups;
return popups.length ? popups[popups.length - 1] : undefined;
},
_attachPopup: function() {
Sys.Extended.UI.ModalPopupBehavior.popups.push(this);
if(this._dropShadow && !this._dropShadowBehavior)
this._dropShadowBehavior = $create(Sys.Extended.UI.DropShadowBehavior, {}, null, null, this._popupElement);
@@ -217,6 +243,9 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
this._dropShadowBehavior.dispose();
this._dropShadowBehavior = null;
}
if(this._getLastPopup() == this)
Sys.Extended.UI.ModalPopupBehavior.popups.pop();
},
_onShow: function(e) {
@@ -296,14 +325,11 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
this._isAnimationJustEnded = false;
}
var zindex = 10000 + (Sys.Extended.UI.ModalPopupBehavior._openCount++ * 1000);
this._showing = true;
this._backgroundElement.style.zIndex = zindex;
this._foregroundElement.style.zIndex = zindex + 1;
this.populate();
this._attachPopup();
this._setZIndex();
this._backgroundElement.style.display = '';
this._foregroundElement.style.display = '';
this._popupElement.style.display = '';
@@ -324,7 +350,6 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
}
}
// Disable TAB
this.disableTab();
@@ -454,7 +479,6 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
_hideImplementation: function() {
// Internal implementation to hide the modal dialog
Sys.Extended.UI.ModalPopupBehavior._openCount--;
this._backgroundElement.style.display = 'none';
this._foregroundElement.style.display = 'none';
@@ -476,14 +500,20 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
var xCoord = 0;
var yCoord = 0;
if(this._xCoordinate < 0) {
var foregroundelementwidth = this._foregroundElement.offsetWidth ? this._foregroundElement.offsetWidth : this._foregroundElement.scrollWidth;
var foregroundelementwidth = this._getForegroundElementWidth();
xCoord = ((clientWidth - foregroundelementwidth) / 2);
// workaround for drag behavior which calls setlocation which in turn
// changes the position of the panel to be absolute and requiring us
// to add the scrollLeft so that it is positioned correctly.
if(this._foregroundElement.style.position == 'absolute')
xCoord += scrollLeft;
if(this._foregroundElement.style.position == 'absolute') {
var parentPopup = this._getParentPopup();
if(parentPopup)
xCoord = (parentPopup._getForegroundElementWidth() - foregroundelementwidth) / 2;
else
xCoord += scrollLeft;
}
this._foregroundElement.style.left = xCoord + 'px';
} else {
@@ -497,14 +527,20 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
}
if(this._yCoordinate < 0) {
var foregroundelementheight = this._foregroundElement.offsetHeight ? this._foregroundElement.offsetHeight : this._foregroundElement.scrollHeight;
var foregroundelementheight = this._getForegroundElementHeight();
yCoord = ((clientHeight - foregroundelementheight) / 2);
// workaround for drag behavior which calls setlocation which in turn
// changes the position of the panel to be absolute and requiring us
// to add the scrollLeft so that it is positioned correctly.
if(this._foregroundElement.style.position == 'absolute')
yCoord += scrollTop;
if(this._foregroundElement.style.position == 'absolute') {
var parentPopup = this._getParentPopup();
if(parentPopup)
yCoord = (parentPopup._getForegroundElementHeight() - foregroundelementheight) / 2;
else
yCoord += scrollTop;
}
this._foregroundElement.style.top = yCoord + 'px';
} else {
@@ -530,6 +566,41 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
this._layoutBackgroundElement();
},
_getForegroundElementWidth: function (){
return this._foregroundElement.offsetWidth ? this._foregroundElement.offsetWidth : this._foregroundElement.scrollWidth;
},
_getForegroundElementHeight: function() {
return this._foregroundElement.offsetHeight ? this._foregroundElement.offsetHeight : this._foregroundElement.scrollHeight;
},
_getParentPopup: function () {
var el = this._foregroundElement;
var otherForegrounds = this._getOtherForegrounds();
while(el.parentNode) {
el = el.parentNode;
var index = Array.indexOf(otherForegrounds, el)
if(index !== -1)
return Sys.Extended.UI.ModalPopupBehavior.popups[index];
}
return null;
},
_getOtherForegrounds: function () {
var foregrounds = [];
var popups = Sys.Extended.UI.ModalPopupBehavior.popups;
for(var i = 0; i < popups.length; i++)
foregrounds.push(popups[i]._foregroundElement);
return foregrounds;
},
_layoutForegroundElement: function(xCoord, yCoord) {
// Set the correct location of the foreground element to ensure that it is absolutely
// positioned with respect to the browser. This is just a workaround for IE 6 since
@@ -887,7 +958,7 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
},
set_OnOkScript: function(value) {
Sys.Extended.Deprecated("set_OnOkScript(value)", "set_onOkScript(value)");
this.set_onOkScript(value);
this.set_onOkScript(value);
},
/// <summary>
@@ -1116,7 +1187,6 @@ Sys.Extended.UI.ModalPopupBehavior.prototype = {
};
Sys.Extended.UI.ModalPopupBehavior.registerClass('Sys.Extended.UI.ModalPopupBehavior', Sys.Extended.UI.DynamicPopulateBehaviorBase);
Sys.Extended.UI.ModalPopupBehavior._openCount = 0;
Sys.Extended.UI.ModalPopupBehavior.invokeViaServer = function(behaviorID, show) {
// This static function (that is intended to be called from script emitted
@@ -1132,3 +1202,5 @@ Sys.Extended.UI.ModalPopupBehavior.invokeViaServer = function(behaviorID, show)
behavior.hide();
}
};
Sys.Extended.UI.ModalPopupBehavior.popups = [];

View File

@@ -537,11 +537,12 @@ Sys.Extended.UI.PagingBulletedListBehavior.prototype = {
},
set_clientSort: function(value) {
if(this._clientSortValue != value) {
// Clear ClientState to set 0 index
this.set_ClientState("0;" + this.get_indexSize() + ";" + this.get_maxItemPerPage() + ";" + value);
this._clientSortValue = value;
if(this.get_isInitialized()) {
// Clear ClientState to set 0 index
this.set_ClientState("0;" + this.get_indexSize() + ";" + this.get_maxItemPerPage() + ";" + value);
if(this._clientSortValue)
this._tabValueObject.sort(this.liElementSortText);
else

View File

@@ -471,7 +471,7 @@ Sys.Extended.UI.PasswordStrengthExtenderBehavior.prototype = {
// Casing Criteria
// Does it contain lowercase AND uppercase Text
if(this._requiresUpperAndLowerCaseCharacters == true ||
(typeof (this._requiresUpperAndLowerCaseCharacters) == 'String' && Boolean.parse(this._requiresUpperAndLowerCaseCharacters) == true)) {
(typeof (this._requiresUpperAndLowerCaseCharacters) == 'string' && Boolean.parse(this._requiresUpperAndLowerCaseCharacters) == true)) {
var lowercaseRegex = new RegExp("[a-z]", "g");
var uppercaseRegex = new RegExp("[A-Z]", "g");

View File

@@ -44,9 +44,7 @@ Sys.Extended.UI.PieChart.prototype = {
svgContents = svgContents + '<stop offset="25%" id="RadialGradient2"></stop>';
svgContents = svgContents + '<stop offset="100%" id="RadialGradient3"></stop></RadialGradient>';
svgContents = svgContents + '</defs>';
svgContents = svgContents + String.format('<path fill="none" stroke-opacity="1" fill-opacity="1" stroke-linejoin="round" stroke-linecap="square" d="M5 {0} {1} {0} {1} {2} 5 {2} z"/>', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
svgContents = svgContents + String.format('<path id="ChartBackGround" stroke="" d="M0 0 {0} 0 {0} {1} 0 {1} z"/>', this._chartWidth, this._chartHeight);
svgContents = svgContents + String.format('<path fill="#ffffff" stroke-opacity="1" fill-opacity="0" stroke-linejoin="round" stroke-linecap="square" stroke="" d="M5 {0} {1} {0} {1} {2} 5 {2} z" />', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
svgContents = svgContents + String.format('<rect id="ChartBackGround" width="{0}" height="{1}" style="opacity: 0"/>', this._chartWidth, this._chartHeight);
// Set Title of Chart
svgContents = svgContents + String.format('<text x="{0}" y="{1}" id="ChartTitle" style="fill:{3}">{2}</text>', parseInt(this._chartWidth) / 2 - (this._chartTitle.length * this.charLength), parseInt(this._chartHeight) * 5 / 100, this._chartTitle, this._chartTitleColor);
@@ -119,11 +117,18 @@ Sys.Extended.UI.PieChart.prototype = {
for(var i = 0; i < this._pieChartClientValues.length; i++)
totalValue = totalValue + Math.abs(parseFloat(this._pieChartClientValues[i].Data));
var drawCircle = this.isSingleValueEqualsTotal(totalValue);
if (drawCircle) {
var strokeColor = this.getStrokeColor(totalValue);
var color = this.getColor(totalValue);
}
this._parentDiv.innerHTML = svgContents;
this.drawSegments(this, 0, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc);
this.drawSegments(this, 0, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc, drawCircle, color, strokeColor);
},
drawSegments: function (me, index, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc) {
drawSegments: function (me, index, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc, drawCircle, color, strokeColor) {
var absClientValues = Math.abs(parseFloat(me._pieChartClientValues[index].Data));
categoryValue = categoryValue + absClientValues;
angle = (categoryValue / totalValue) * 360;
@@ -132,8 +137,8 @@ Sys.Extended.UI.PieChart.prototype = {
textRadAngle = textRadAngle * (Math.PI / 180);
endX = parseFloat(Math.sin(radAngle) * radius);
endY = parseFloat(Math.cos(radAngle) * radius);
textX = parseFloat(Math.sin(textRadAngle) * (radius + 10));
textY = parseFloat(Math.cos(textRadAngle) * (radius + 10));
textX = parseFloat((drawCircle ? 0 : Math.sin(textRadAngle)) * (radius + 10));
textY = parseFloat((drawCircle ? -1 : Math.cos(textRadAngle)) * (radius + 10));
textX = (startX + textX) > startX ? startX + textX : (startX + textX) - (me._pieChartClientValues[index].Data.toString().length * this.charLength);
textY = (startY + (-1 * textY)) < startY ? startY + (-1 * textY) : startY + (-1 * textY) + 10;
@@ -143,7 +148,37 @@ Sys.Extended.UI.PieChart.prototype = {
else {
arc = 0;
}
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<g><path id="Segment{8}" d="M{0} {1} A {2} {2} 0 {3},1 {4} {5} L {6} {7} z" style="stroke:{10};fill:{9};"></path>', lastEndX, lastEndY, radius, arc, startX + endX, startY + (-1 * endY), startX, startY, index + 1, me._pieChartClientValues[index].PieChartValueColor, me._pieChartClientValues[index].PieChartValueStrokeColor) + String.format('<text fill="#000000" style="font: 11px Arial,Helvetica,sans-serif" fill-opacity="1" y="{1}" x="{0}">{2}</text></g>', textX, textY, me._pieChartClientValues[index].Data) + '</svg>';
me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '')
+ (drawCircle ?
String.format('<g><circle cx="{0}" cy="{1}" r="{2}" stroke="{3}" fill="{4}" />',
startX,
startY,
radius,
strokeColor,
color)
: String.format('<g><path id="Segment{8}" d="M{0} {1} A {2} {2} 0 {3},1 {4} {5} L {6} {7} z" style="stroke:{10};fill:{9};"></path>',
lastEndX,
lastEndY,
radius,
arc,
startX + endX,
startY + (-1 * endY),
startX,
startY,
index + 1,
me._pieChartClientValues[index].PieChartValueColor,
me._pieChartClientValues[index].PieChartValueStrokeColor))
+ (me._pieChartClientValues[index].Data || drawCircle ?
String.format('<text fill="#000000" style="font: 11px Arial,Helvetica,sans-serif" fill-opacity="1" y="{1}" x="{0}">{2}</text></g>',
textX,
textY,
drawCircle ? totalValue : me._pieChartClientValues[index].Data)
: "")
+ '</svg>';
if (drawCircle)
return;
lastEndX = startX + endX;
lastEndY = startY + (-1 * endY);
@@ -151,8 +186,31 @@ Sys.Extended.UI.PieChart.prototype = {
if(index < me._pieChartClientValues.length) // if the counter < series length, call the loop function
setTimeout(function() {
me.drawSegments(me, index, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc);
}, 400);
me.drawSegments(me, index, drawCircle ? 0 : categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc, drawCircle, color, strokeColor);
}, me._pieChartClientValues[index].Data == 0 ? 0 : 400);
},
isSingleValueEqualsTotal: function (totalValue) {
for (var i = 0; i < this._pieChartClientValues.length; i++) {
if (this._pieChartClientValues[i].Data == totalValue)
return true;
}
return false;
},
getStrokeColor: function (totalValue) {
for (var i = 0; i < this._pieChartClientValues.length; i++) {
if (this._pieChartClientValues[i].Data == totalValue)
return this._pieChartClientValues[i].PieChartValueStrokeColor;
}
},
getColor: function (totalValue) {
for (var i = 0; i < this._pieChartClientValues.length; i++) {
if (this._pieChartClientValues[i].Data == totalValue)
return this._pieChartClientValues[i].PieChartValueColor;
}
},
/// <summary>

View File

@@ -90,7 +90,9 @@ Sys.Extended.UI.RatingBehavior.prototype = {
return;
if(this._ratingValue != this._currentRating)
this.set_rating(this._currentRating);
this._setRatingCore(this._currentRating, true);
else
this.doCallback(true);
},
_onStarMouseOver: function(e) {
@@ -221,7 +223,7 @@ Sys.Extended.UI.RatingBehavior.prototype = {
remove_mouseOver: function(handler) {
this.get_events().removeHandler("mouseOver", handler);
},
raise_mouseOver: function(ratingTmp) {
raise_mouseOver: function(rating_tmp) {
var handler = this.get_events().getHandler("mouseOver");
if(handler)
@@ -237,7 +239,7 @@ Sys.Extended.UI.RatingBehavior.prototype = {
this.remove_mouseOver(handler);
},
raiseMouseOver: function(rating_tmp) {
Sys.Extended.Deprecated("raiseMouseOver(rating_tmp)", "raise_mouseOver(ratingTmp)");
Sys.Extended.Deprecated("raiseMouseOver(rating_tmp)", "raise_mouseOver(rating_tmp)");
this.raise_mouseOver(rating_tmp);
},
@@ -490,6 +492,21 @@ Sys.Extended.UI.RatingBehavior.prototype = {
this.set_waitingStarCssClass(value);
},
doCallback: function(fromUI)
{
if (this._isServerControl) {
this._waitingMode(true);
var args = Number(!!fromUI) + ";" + this._currentRating + ";" + this._tag,
id = this._callbackID;
if (this._autoPostBack)
__doPostBack(id, args);
else
WebForm_DoCallback(id, args, this._receiveServerData, this, this._onError, true)
}
},
/// <summary>
/// A current rating value
/// </summary>
@@ -507,6 +524,10 @@ Sys.Extended.UI.RatingBehavior.prototype = {
return this._ratingValue;
},
set_rating: function(value) {
this._setRatingCore(value);
},
_setRatingCore: function(value, fromUI) {
if(this._ratingValue != value) {
this._ratingValue = value;
this._currentRating = value;
@@ -522,17 +543,7 @@ Sys.Extended.UI.RatingBehavior.prototype = {
this.raisePropertyChanged('rating');
this.raise_rated(this._currentRating);
if(this._isServerControl) {
this._waitingMode(true);
var args = this._currentRating + ";" + this._tag,
id = this._callbackID;
if(this._autoPostBack)
__doPostBack(id, args);
else
WebForm_DoCallback(id, args, this._receiveServerData, this, this._onError, true)
}
this.doCallback(fromUI);
}
}
},
@@ -650,4 +661,4 @@ Sys.Extended.UI.RatingCallbackResultEventArgs.prototype = {
}
}
Sys.Extended.UI.RatingCallbackResultEventArgs.registerClass('Sys.Extended.UI.RatingCallbackResultEventArgs', Sys.EventArgs);
Sys.Extended.UI.RatingCallbackResultEventArgs.registerClass('Sys.Extended.UI.RatingCallbackResultEventArgs', Sys.EventArgs);

View File

@@ -1345,54 +1345,7 @@ Sys.Extended.UI.Seadragon.Viewer.prototype = {
_onContainerEnter: function(tracker, position, buttonDownElmt, buttonDownAny) {
this._mouseInside = true;
this._abortControlsAutoHide();
},
_updateOnce: function() {
if(!this.source)
return;
this.profiler.beginUpdate();
var containerSize = Seadragon.Utils.getElementSize(this._container);
if(!containerSize.equals(this._prevContainerSize)) {
this.viewport.resize(containerSize, true); // maintain image position
this._prevContainerSize = containerSize;
this._raiseEvent("resize", this);
}
var animated = this.viewport.update();
if(!this._animating && animated) {
// we weren't animating, and now we did ==> animation start
this._raiseEvent("animationstart", self);
this._abortControlsAutoHide();
}
if(animated) {
// viewport moved
this.drawer.update();
this._raiseEvent("animation", self);
} else if(this._forceRedraw || this.drawer.needsUpdate()) {
// need to load or blend images, etc.
this.drawer.update();
this._forceRedraw = false;
} else {
// no changes, so preload images, etc.
this.drawer.idle();
}
if(this._animating && !animated) {
// we were animating, and now we're not anymore ==> animation finish
this._raiseEvent("animationfinish", this);
// if the mouse has left the container, begin fading controls
if(!this._mouseInside)
this._beginControlsAutoHide();
}
this._animating = animated;
this.profiler.endUpdate();
},
},
_onClose: function() {
// TODO need destroy() methods to prevent leaks? check for null if so.
@@ -3003,20 +2956,7 @@ Sys.Extended.UI.Seadragon.Drawer.prototype = {
this._container.style.textAlign = "left"; // explicit left-align
this._container.appendChild(this._canvas);
},
_compareTiles: function(prevBest, tile) {
// figure out if this tile is better than the previous best tile...
// note that if there is no prevBest, this is automatically better.
if(!prevBest)
return tile;
if(tile.visibility > prevBest.visibility)
return tile;
else if(tile.visibility == prevBest.visibility)
if(tile.distance < prevBest.distance)
return tile;
return prevBest;
},
_getNumTiles: function(level) {
if(!this._cacheNumTiles[level])
this._cacheNumTiles[level] = this._source.getNumTiles(level);

View File

@@ -624,7 +624,7 @@ Sys.Extended.UI.SliderBehavior.prototype = {
},
/// <summary>
/// Slider dra mode
/// Slider drag mode
/// </summary>
/// <getter>dragMode</getter>
/// <member name="cP:AjaxControlToolkit.SliderExtender.dragMode" />
@@ -639,7 +639,6 @@ Sys.Extended.UI.SliderBehavior.prototype = {
onDrag: function() {
var dragHandleBounds = this._getBoundsInternal(this._dragHandle);
var handleBounds = this._getHandleBounds();
var sliderBounds = this._getRailBounds();
var handlePosition;

View File

@@ -1,5 +1,13 @@
Type.registerNamespace("Sys.Extended.UI");
Sys.Extended.UI.TabCssTheme = function() { }
Sys.Extended.UI.TabCssTheme.prototype = {
None: 0,
XP: 1,
Plain: 2
}
Sys.Extended.UI.TabCssTheme.registerEnum("Sys.Extended.UI.TabCssTheme", true);
Sys.Extended.UI.TabStripPlacement = function() { }
Sys.Extended.UI.TabStripPlacement.prototype = {
Top: 0,
@@ -26,6 +34,7 @@ Sys.Extended.UI.TabContainer = function(element) {
this._activeTabIndex = -1;
this._scrollBars = Sys.Extended.UI.ScrollBars.None;
this._tabs = null;
this._cssTheme = Sys.Extended.UI.TabCssTheme.XP;
this._header = null;
this._body = null;
this._loaded = false;
@@ -232,6 +241,7 @@ Sys.Extended.UI.TabContainer.prototype = {
// default classes
$common.addCssClasses(elt, [
this._getCssThemeClass(this.get_cssTheme()),
"ajax__tab_container",
"ajax__tab_default"
]);
@@ -247,6 +257,30 @@ Sys.Extended.UI.TabContainer.prototype = {
Sys.Extended.UI.TabContainer.callBaseMethod(this, "dispose");
},
get_cssTheme: function()
{
return this._cssTheme;
},
set_cssTheme: function(value)
{
this._cssTheme = value;
},
_getCssThemeClass: function(theme)
{
switch(theme)
{
case Sys.Extended.UI.TabCssTheme.None:
return "";
case Sys.Extended.UI.TabCssTheme.XP:
return "ajax__tab_xp";
case Sys.Extended.UI.TabCssTheme.Plain:
return "ajax__tab_plain";
default:
throw Error.argument('theme', String.format(Sys.Extended.UI.Resources.Tabs_UnknownTheme, type.getName()));
}
},
/// <summary>
/// Returns TabContainer's first tab
/// </summary>
@@ -855,7 +889,6 @@ Sys.Extended.UI.TabPanel.prototype = {
_deactivate: function() {
$common.setVisible(this.get_element(), false);
Sys.UI.DomElement.addCssClass(this._tab, "ajax__tab_disabled");
Sys.UI.DomElement.removeCssClass(this._tab, "ajax__tab_active");
},

View File

@@ -182,7 +182,7 @@ Sys.Extended.UI.TextBoxWatermarkBehavior.prototype = {
return;
var classList = this.get_element().className.split();
if(classList.indexOf(this._watermarkCssClass) === -1) {
if (Array.indexOf(classList, this._watermarkCssClass) === -1) {
classList.push(this._watermarkCssClass);
this.get_element().className = classList.join(" ");
}

View File

@@ -13,6 +13,9 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior = function(element) {
this._pageLoadedHandler = null;
this._alwaysFinishOnUpdatingAnimation = null;
this._triggerControlsClientID = null;
this._updatePanelID = "";
this._updatePanelClientID = "";
this._childrenAsTriggers = false;
};
Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
initialize: function() {
@@ -67,8 +70,8 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this, '_partialUpdateBeginRequest', [sender, beginRequestEventArgs]);
if(!this._postBackPending) {
if(this._triggerControlsClientID.indexOf(sender._activeElement.id) != -1)
{
if(this._isTriggeredByTriggerControl(beginRequestEventArgs._postBackElement.id)
|| this._isTriggeredByChildControl(sender, beginRequestEventArgs)) {
this._postBackPending = true;
this._onUpdated.quit();
this._onUpdating.play();
@@ -76,6 +79,30 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
}
},
_isTriggeredByTriggerControl: function(postBackElementID) {
return this._triggerControlsClientID.length
&& this._triggerControlsClientID.indexOf(postBackElementID) != -1;
},
_isTriggeredByChildControl: function (sender, beginRequestEventArgs) {
if(!this.get_childrenAsTriggers())
return false;
if(!beginRequestEventArgs._updatePanelsToUpdate)
return false;
if(beginRequestEventArgs._updatePanelsToUpdate.indexOf(this.get_updatePanelID()) === -1)
return false;
var panelIndex = sender._updatePanelIDs.indexOf(this.get_updatePanelID());
if(!sender._updatePanelHasChildrenAsTriggers[panelIndex])
return false;
var postBackElement = document.getElementById(beginRequestEventArgs._postBackElement.id);
return postBackElement.parentElement.id === this.get_updatePanelClientID();
},
_pageLoaded: function(sender, args) {
// Method that will be called when a partial update (via an UpdatePanel) finishes
// "sender" - sender
@@ -86,7 +113,7 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
var element = this.get_element();
var panels = args.get_panelsUpdated();
for(var i = 0; i < panels.length; i++) {
if(panels[i].parentNode == element)
if(panels[i].parentNode == element) {
if(this._alwaysFinishOnUpdatingAnimation) {
this._tryAndStopOnUpdating();
}
@@ -94,7 +121,8 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
this._onUpdating.quit();
this._onUpdated.play();
}
break;
break;
}
}
}
},
@@ -218,7 +246,7 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
/// <setter>set_triggerControlsClientID</setter>
/// <member name="cP:AjaxControlToolkit.UpdatePanelAnimationExtender.triggerControlsClientID" />
get_triggerControlsClientID: function() {
return this._triggerControlsClientID;;
return this._triggerControlsClientID;
},
set_triggerControlsClientID: function(value) {
if(this._triggerControlsClientID != value) {
@@ -234,6 +262,55 @@ Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = {
set_TriggerControlsClientID: function(value) {
Sys.Extended.Deprecated("set_TriggerControlsClientID(value)", "set_triggerControlsClientID(value)");
this.set_triggerControlsClientID(value);
},
/// <summary>
/// ID of the target update panel
/// </summary>
/// <getter>get_updatePanelID</getter>
/// <setter>set_updatePanelID</setter>
/// <member name="cP:AjaxControlToolkit.UpdatePanelAnimationExtender.updatePanelID" />
get_updatePanelID: function () {
return this._updatePanelID;
},
set_updatePanelID: function (value) {
if(this._updatePanelID != value) {
this._updatePanelID = value;
this.raisePropertyChanged('updatePanelID');
}
},
/// <summary>
/// Client ID of the target update panel
/// </summary>
/// <getter>get_updatePanelClientID</getter>
/// <setter>set_updatePanelClientID</setter>
/// <member name="cP:AjaxControlToolkit.UpdatePanelAnimationExtender.updatePanelClientID" />
get_updatePanelClientID: function () {
return this._updatePanelClientID;
},
set_updatePanelClientID: function (value) {
if(this._updatePanelClientID != value) {
this._updatePanelClientID = value;
this.raisePropertyChanged('updatePanelClientID');
}
},
/// <summary>
/// An optional property that enables update panel animation
/// if the postback is caused by a panel's immediate children
/// </summary>
/// <getter>get_childrenAsTriggers</getter>
/// <setter>set_childrenAsTriggers</setter>
/// <member name="cP:AjaxControlToolkit.UpdatePanelAnimationExtender.childrenAsTriggers" />
get_childrenAsTriggers: function () {
return this._childrenAsTriggers;
},
set_childrenAsTriggers: function (value) {
if(this._childrenAsTriggers != value) {
this._childrenAsTriggers = value;
this.raisePropertyChanged('childrenAsTriggers');
}
}
};
Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.registerClass('Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior', Sys.Extended.UI.BehaviorBase);

View File

@@ -26,19 +26,14 @@ Sys.Extended.UI.ValidatorCalloutBehavior = function Sys$Extended$UI$ValidatorCal
this._isBuilt = false;
this._focusHandler = Function.createDelegate(this, this._onfocus);
this._closeClickHandler = Function.createDelegate(this, this._oncloseClick);
this._originalValidationMethodOverriden = false;
Sys.Application.add_load(this._loadHandler);
};
Sys.Extended.UI.ValidatorCalloutBehavior.prototype = {
initialize: function() {
Sys.Extended.UI.ValidatorCalloutBehavior.callBaseMethod(this, 'initialize');
var elt = this.get_element();
// Override the evaluation method of the current validator
if(elt.evaluationfunction) {
this._originalValidationMethod = Function.createDelegate(elt, elt.evaluationfunction);
this._validationMethodOverride = Function.createDelegate(this, this._onvalidate);
elt.evaluationfunction = this._validationMethodOverride;
}
// Check for failed server-side validation (indicated by non-empty ClientState)
var clientState = this.get_ClientState();
@@ -47,16 +42,76 @@ Sys.Extended.UI.ValidatorCalloutBehavior.prototype = {
// Apply HightLightCssClass for failed server-side validation
if(this._highlightCssClass)
Sys.UI.DomElement.addCssClass(this._elementToValidate, this._highlightCssClass);
this.show();
}
},
_loadHandler: function(app, args) {
var components = args.get_components();
for(var i = 0; i < components.length; i++) {
var component = components[i];
if(component instanceof Sys.Extended.UI.ValidatorCalloutBehavior) {
component.attachToValidator();
}
}
},
attachToValidator: function() {
var element = this.get_element();
var self = this;
if(!this._originalValidationMethodOverriden) {
if(window.jQuery) {
window.jQuery(function($) {
$(function() {
self.checkPageValidators(element);
});
});
}
else
self.overrideEvaluationFunction(element);
this._originalValidationMethodOverriden = true;
}
},
checkPageValidators: function(element) {
if(typeof (Page_Validators) === "undefined")
return;
for(i = 0; i < Page_Validators.length; i++) {
var validator = Page_Validators[i];
if(validator.ValidatorCalloutBehavior !== this)
continue;
if(typeof (validator.evaluationfunction) === "function") {
element.evaluationfunction = validator.evaluationfunction;
this.overrideEvaluationFunction(element);
break;
}
}
},
overrideEvaluationFunction: function(element) {
// Override the evaluation method of the current validator
if(element.evaluationfunction) {
this._originalValidationMethod = Function.createDelegate(element, element.evaluationfunction);
this._validationMethodOverride = Function.createDelegate(this, this._onvalidate);
element.evaluationfunction = this._validationMethodOverride;
element.removeAttribute("data-val-evaluationfunction");
}
},
_ensureCallout: function() {
if(!this._isBuilt) {
var elt = this.get_element();
// create the DOM elements
var elementToValidate = this._elementToValidate = $get(elt.controltovalidate);
var elementToValidate = this._elementToValidate = $get(elt.controltovalidate != null ? elt.controltovalidate : elt.getAttribute('data-val-controltovalidate'));
var popupTableBody = document.createElement("tbody");
var popupTableRow = document.createElement("tr");
var calloutCell = document.createElement("td");
@@ -214,7 +269,7 @@ Sys.Extended.UI.ValidatorCalloutBehavior.prototype = {
{},
null,
this._popupTable);
if(this._popupPosition == Sys.Extended.UI.ValidatorCalloutPosition.TopLeft)
this._popupBehavior.set_positioningMode(Sys.Extended.UI.PositioningMode.TopLeft);
else if(this._popupPosition == Sys.Extended.UI.ValidatorCalloutPosition.TopRight)
@@ -277,7 +332,8 @@ Sys.Extended.UI.ValidatorCalloutBehavior.prototype = {
},
_getErrorMessage: function() {
return this.get_element().errormessage || Sys.Extended.UI.Resources.ValidatorCallout_DefaultErrorMessage;
var element = this.get_element();
return element.errormessage || element.getAttribute('data-val-errormessage') || Sys.Extended.UI.Resources.ValidatorCallout_DefaultErrorMessage;
},
/// <summary>