From fd0b26af453fedf4528eaf4114914a6e5b7bc685 Mon Sep 17 00:00:00 2001 From: patdenice Date: Thu, 25 Sep 2008 15:10:39 +0000 Subject: - Add all jQuery UI files (for future use) in stable version (1.5.2). - Use jQuery cluetip plugin for new plugins page. - Remove old CSS tooltip rules. git-svn-id: http://piwigo.org/svn/trunk@2587 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/template/goto/default-layout.css | 55 +- admin/template/goto/plugins_new.tpl | 19 +- admin/template/goto/plugins_update.tpl | 22 +- template-common/lib/plugins/jquery.cluetip.js | 543 +++++++ .../lib/plugins/jquery.cluetip.packed.js | 1 + template-common/lib/plugins/jquery.dimensions.js | 119 ++ .../lib/plugins/jquery.dimensions.packed.js | 1 + template-common/lib/ui/ui.accordion.js | 9 +- template-common/lib/ui/ui.accordion.packed.js | 2 +- template-common/lib/ui/ui.core.js | 33 +- template-common/lib/ui/ui.core.packed.js | 2 +- template-common/lib/ui/ui.datepicker.js | 1533 ++++++++++++++++++++ template-common/lib/ui/ui.datepicker.packed.js | 2 + template-common/lib/ui/ui.dialog.js | 497 +++++++ template-common/lib/ui/ui.dialog.packed.js | 2 + template-common/lib/ui/ui.draggable.js | 562 +++++++ template-common/lib/ui/ui.draggable.packed.js | 2 + template-common/lib/ui/ui.droppable.js | 281 ++++ template-common/lib/ui/ui.droppable.packed.js | 2 + template-common/lib/ui/ui.resizable.js | 770 ++++++++++ template-common/lib/ui/ui.resizable.packed.js | 2 + template-common/lib/ui/ui.selectable.js | 264 ++++ template-common/lib/ui/ui.selectable.packed.js | 2 + template-common/lib/ui/ui.slider.js | 440 ++++++ template-common/lib/ui/ui.slider.packed.js | 2 + template-common/lib/ui/ui.tabs.js | 599 ++++++++ template-common/lib/ui/ui.tabs.packed.js | 2 + 27 files changed, 5692 insertions(+), 76 deletions(-) create mode 100644 template-common/lib/plugins/jquery.cluetip.js create mode 100644 template-common/lib/plugins/jquery.cluetip.packed.js create mode 100644 template-common/lib/plugins/jquery.dimensions.js create mode 100644 template-common/lib/plugins/jquery.dimensions.packed.js create mode 100644 template-common/lib/ui/ui.datepicker.js create mode 100644 template-common/lib/ui/ui.datepicker.packed.js create mode 100644 template-common/lib/ui/ui.dialog.js create mode 100644 template-common/lib/ui/ui.dialog.packed.js create mode 100644 template-common/lib/ui/ui.draggable.js create mode 100644 template-common/lib/ui/ui.draggable.packed.js create mode 100644 template-common/lib/ui/ui.droppable.js create mode 100644 template-common/lib/ui/ui.droppable.packed.js create mode 100644 template-common/lib/ui/ui.resizable.js create mode 100644 template-common/lib/ui/ui.resizable.packed.js create mode 100644 template-common/lib/ui/ui.selectable.js create mode 100644 template-common/lib/ui/ui.selectable.packed.js create mode 100644 template-common/lib/ui/ui.slider.js create mode 100644 template-common/lib/ui/ui.slider.packed.js create mode 100644 template-common/lib/ui/ui.tabs.js create mode 100644 template-common/lib/ui/ui.tabs.packed.js diff --git a/admin/template/goto/default-layout.css b/admin/template/goto/default-layout.css index f9f30ec1e..401b0928f 100644 --- a/admin/template/goto/default-layout.css +++ b/admin/template/goto/default-layout.css @@ -205,38 +205,6 @@ top: 0; left: 60px; /*position where enlarged image should offset horizontally */ } - -/* Tooltips*/ -.tooltip { - position: relative; -} - -.tooltip SPAN { - display: none; -} - -.tooltip:hover { - cursor: pointer; - z-index: 500; -} - -.tooltip:hover SPAN { - display: inline; - position: absolute; - top: 30px; - left: -50px; - width: 400px; - - font-size: 11px; - text-decoration: none; - text-align: justify; - background-color: #FFFFCC; - color: #444444; - - padding: 10px; - border: 1px solid Black; -} - BODY { margin: 5px; padding: 0; @@ -531,4 +499,25 @@ LEGEND.tagLetterLegend { TABLE.tagLetterContent { width:100%; font-size:80%; - border-collapse : collapse; } + border-collapse : collapse; +} + +/* jQuery tooltips */ +.cluetip-default #cluetip-outer { + position: relative; + border: 1px solid #111111; + color: #dddddd; + background-color: #222222; + text-align: left; +} +.cluetip-default h3#cluetip-title { + margin: 0 0 5px; + padding: 8px; + color: #666666; + background-color: #d3d3d3; + font-size: 1.1em; + font-weight: bold; +} +.cluetip-default #cluetip-inner { + padding: 10px; +} diff --git a/admin/template/goto/plugins_new.tpl b/admin/template/goto/plugins_new.tpl index bfa9dde5c..33515f30c 100644 --- a/admin/template/goto/plugins_new.tpl +++ b/admin/template/goto/plugins_new.tpl @@ -1,3 +1,16 @@ +{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} +{known_script id="jquery.dimensions" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.dimensions.packed.js"} +{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.cluetip.packed.js"} + + +

{'Plugins'|@translate}

@@ -21,10 +34,8 @@ {foreach from=$plugins item=plugin name=plugins_loop} - {$plugin.EXT_NAME} - {$plugin.EXT_DESC} - {$plugin.VERSION} - {$plugin.VER_DESC} + {$plugin.EXT_NAME} + {$plugin.VERSION} {$plugin.DATE} {$plugin.AUTHOR} {'plugins_auto_install'|@translate} diff --git a/admin/template/goto/plugins_update.tpl b/admin/template/goto/plugins_update.tpl index 77173f92e..4d9742651 100644 --- a/admin/template/goto/plugins_update.tpl +++ b/admin/template/goto/plugins_update.tpl @@ -1,3 +1,16 @@ +{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} +{known_script id="jquery.dimensions" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.dimensions.packed.js"} +{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.cluetip.packed.js"} + + +

{'Plugins'|@translate}

@@ -16,11 +29,9 @@ {foreach from=$plugins_not_uptodate item=plugin name=plugins_loop} - {$plugin.EXT_NAME} - {$plugin.EXT_DESC} + {$plugin.EXT_NAME} {$plugin.VERSION} - {$plugin.NEW_VERSION} - {$plugin.NEW_VER_DESC} + {$plugin.NEW_VERSION} {'plugins_auto_update'|@translate} / {'plugins_download'|@translate} @@ -41,8 +52,7 @@ {foreach from=$plugins_uptodate item=plugin name=plugins_loop} - {$plugin.NAME} - {$plugin.EXT_DESC} + {$plugin.NAME} {$plugin.VERSION} {/foreach} diff --git a/template-common/lib/plugins/jquery.cluetip.js b/template-common/lib/plugins/jquery.cluetip.js new file mode 100644 index 000000000..83727910c --- /dev/null +++ b/template-common/lib/plugins/jquery.cluetip.js @@ -0,0 +1,543 @@ +/* + * jQuery clueTip plugin + * Version 0.9.8 (05/22/2008) + * @requires jQuery v1.1.4+ + * @requires Dimensions plugin (for jQuery versions < 1.2.5) + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ +;(function($) { +/* + * @name clueTip + * @type jQuery + * @cat Plugins/tooltip + * @return jQuery + * @author Karl Swedberg + * + * @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com) + * @credit Thanks to the following people for their many and varied contributions: + Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer + * @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-) + */ + + /** + * + * Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element. + * By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents. + * If a "title" attribute is specified, its value is used as the clueTip's heading. + * The attribute to be used for both the body and the heading of the clueTip is user-configurable. + * Optionally, the clueTip's body can display content from an element on the same page. + * * Just indicate the element's id (e.g. "#some-id") in the rel attribute. + * Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated. + * * The string before the first instance of the delimiter is set as the clueTip's heading. + * * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body. + * The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below... + * + * + * @example $('#tip).cluetip(); + * @desc This is the most basic clueTip. It displays a 275px-wide clueTip on mouseover of the element with an ID of "tip." On mouseout of the element, the clueTip is hidden. + * + * + * @example $('a.clue').cluetip({ + * hoverClass: 'highlight', + * sticky: true, + * closePosition: 'bottom', + * closeText: 'close', + * truncate: 60, + * ajaxSettings: { + * type: 'POST' + * } + * }); + * @desc Displays a clueTip on mouseover of all elements with class="clue". The hovered element gets a class of "highlight" added to it (so that it can be styled appropriately. This is esp. useful for non-anchor elements.). The clueTip is "sticky," which means that it will not be hidden until the user either clicks on its "close" text/graphic or displays another clueTip. The "close" text/graphic is set to diplay at the bottom of the clueTip (default is top) and display an image rather than the default "Close" text. Moreover, the body of the clueTip is truncated to the first 60 characters, which are followed by an ellipsis (...). Finally, the clueTip retrieves the content using POST rather than the $.ajax method's default "GET." + * + * More examples can be found at http://plugins.learningjquery.com/cluetip/demo/ + * + * Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/ + */ + + var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount; + $.fn.cluetip = function(js, options) { + if (typeof js == 'object') { + options = js; + js = null; + } + return this.each(function(index) { + var $this = $(this); + + // support metadata plugin (v1.0 and 2.0) + var opts = $.extend(false, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {}); + + // start out with no contents (for ajax activation) + var cluetipContents = false; + var cluezIndex = parseInt(opts.cluezIndex, 10)-1; + var isActive = false, closeOnDelay = 0; + + // create the cluetip divs + if (!$('#cluetip').length) { + $cluetipInner = $('
'); + $cluetipTitle = $('

'); + $cluetipOuter = $('
').append($cluetipInner).prepend($cluetipTitle); + $cluetip = $('
').css({zIndex: opts.cluezIndex}) + .append($cluetipOuter).append('
')[insertionType](insertionElement).hide(); + $('
').css({position: 'absolute', zIndex: cluezIndex-1}) + .insertBefore('#cluetip').hide(); + $cluetip.css({position: 'absolute', zIndex: cluezIndex}); + $cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1}); + $cluetipArrows = $('
').css({zIndex: cluezIndex+1}).appendTo('#cluetip'); + } + var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0; + if (!$dropShadow) { + $dropShadow = $([]); + for (var i=0; i < dropShadowSteps; i++) { + $dropShadow = $dropShadow.add($('
').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i})); + }; + $dropShadow.css({position: 'absolute', backgroundColor: '#000'}) + .prependTo($cluetip); + } + var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass; + if (!tipAttribute && !opts.splitTitle && !js) return true; + // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip + if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); } + var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10); + // vertical measurement variables + var tipHeight, wHeight; + var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px'; + var sTop, linkTop, posY, tipY, mouseY, baseline; + // horizontal measurement variables + var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10); + var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps; + var linkWidth = this.offsetWidth; + var linkLeft, posX, tipX, mouseX, winWidth; + + // parse the title + var tipParts; + var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : ''; + if (opts.splitTitle) { + if(tipTitle == undefined) {tipTitle = '';} + tipParts = tipTitle.split(opts.splitTitle); + tipTitle = tipParts.shift(); + } + var localContent; + +/*************************************** +* ACTIVATION +****************************************/ + +//activate clueTip + var activate = function(event) { + if (!opts.onActivate($this)) { + return false; + } + isActive = true; + $cluetip.removeClass().css({width: tipInnerWidth}); + if (tipAttribute == $this.attr('href')) { + $this.css('cursor', opts.cursor); + } + $this.attr('title',''); + if (opts.hoverClass) { + $this.addClass(opts.hoverClass); + } + linkTop = posY = $this.offset().top; + linkLeft = $this.offset().left; + mouseX = event.pageX; + mouseY = event.pageY; + if ($this[0].tagName.toLowerCase() != 'area') { + sTop = $(document).scrollTop(); + winWidth = $(window).width(); + } +// position clueTip horizontally + if (opts.positionBy == 'fixed') { + posX = linkWidth + linkLeft + lOffset; + $cluetip.css({left: posX}); + } else { + posX = (linkWidth > linkLeft && linkLeft > tipWidth) + || linkLeft + linkWidth + tipWidth + lOffset > winWidth + ? linkLeft - tipWidth - lOffset + : linkWidth + linkLeft + lOffset; + if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse + if (mouseX + 20 + tipWidth > winWidth) { + $cluetip.addClass(' cluetip-' + ctClass); + posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2); + } else { + posX = mouseX + lOffset; + } + } + var pY = posX < 0 ? event.pageY + tOffset : event.pageY; + $cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)}); + } + wHeight = $(window).height(); + +/*************************************** +* load a string from cluetip method's first argument +***************************************/ + if (js) { + $cluetipInner.html(js); + cluetipShow(pY); + } +/*************************************** +* load the title attribute only (or user-selected attribute). +* clueTip title is the string before the first delimiter +* subsequent delimiters place clueTip body text on separate lines +***************************************/ + + else if (tipParts) { + var tpl = tipParts.length; + for (var i=0; i < tpl; i++){ + if (i == 0) { + $cluetipInner.html(tipParts[i]); + } else { + $cluetipInner.append('
' + tipParts[i] + '
'); + } + }; + cluetipShow(pY); + } +/*************************************** +* load external file via ajax +***************************************/ + + else if (!opts.local && tipAttribute.indexOf('#') != 0) { + if (cluetipContents && opts.ajaxCache) { + $cluetipInner.html(cluetipContents); + cluetipShow(pY); + } + else { + var ajaxSettings = opts.ajaxSettings; + ajaxSettings.url = tipAttribute; + ajaxSettings.beforeSend = function() { + $cluetipOuter.children().empty(); + if (opts.waitImage) { + $('#cluetip-waitimage') + .css({top: mouseY+20, left: mouseX+20}) + .show(); + } + }; + ajaxSettings.error = function() { + if (isActive) { + $cluetipInner.html('sorry, the contents could not be loaded'); + } + }; + ajaxSettings.success = function(data) { + cluetipContents = opts.ajaxProcess(data); + if (isActive) { + $cluetipInner.html(cluetipContents); + } + }; + ajaxSettings.complete = function() { + imgCount = $('#cluetip-inner img').length; + if (imgCount && !$.browser.opera) { + $('#cluetip-inner img').load(function() { + imgCount--; + if (imgCount<1) { + $('#cluetip-waitimage').hide(); + if (isActive) cluetipShow(pY); + } + }); + } else { + $('#cluetip-waitimage').hide(); + if (isActive) cluetipShow(pY); + } + }; + $.ajax(ajaxSettings); + } + +/*************************************** +* load an element from the same page +***************************************/ + } else if (opts.local){ + var $localContent = $(tipAttribute + ':first'); + var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('
').children().clone(true) : $localContent.html(); + $.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip); + cluetipShow(pY); + } + }; + +// get dimensions and options for cluetip and prepare it to be shown + var cluetipShow = function(bpY) { + $cluetip.addClass('cluetip-' + ctClass); + + if (opts.truncate) { + var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...'; + $cluetipInner.html($truncloaded); + } + function doNothing() {}; //empty function + tipTitle ? $cluetipTitle.show().html(tipTitle) : (opts.showTitle) ? $cluetipTitle.show().html(' ') : $cluetipTitle.hide(); + if (opts.sticky) { + var $closeLink = $('
' + opts.closeText + '
'); + (opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner); + $closeLink.click(function() { + cluetipClose(); + return false; + }); + if (opts.mouseOutClose) { + if ($.fn.hoverIntent && opts.hoverIntent) { + $cluetip.hoverIntent({ + over: doNothing, + timeout: opts.hoverIntent.timeout, + out: function() { $closeLink.trigger('click'); } + }); + } else { + $cluetip.hover(doNothing, + function() {$closeLink.trigger('click'); }); + } + } else { + $cluetip.unbind('mouseout'); + } + } +// now that content is loaded, finish the positioning + var direction = ''; + $cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight}); + tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10); + tipY = posY; + baseline = sTop + wHeight; + if (opts.positionBy == 'fixed') { + tipY = posY - opts.dropShadowSteps + tOffset; + } else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') { + if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) { + tipY = mouseY - tipHeight - tOffset; + direction = 'top'; + } else { + tipY = mouseY + tOffset; + direction = 'bottom'; + } + } else if ( posY + tipHeight + tOffset > baseline ) { + tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset; + } else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") { + tipY = bpY - tOffset; + } else { + tipY = posY - opts.dropShadowSteps; + } + if (direction == '') { + posX < linkLeft ? direction = 'left' : direction = 'right'; + } + $cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass); + if (opts.arrows) { // set up arrow positioning to align with element + var bgY = (posY - tipY - opts.dropShadowSteps); + $cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show(); + } else { + $cluetipArrows.hide(); + } + +// (first hide, then) ***SHOW THE CLUETIP*** + $dropShadow.hide(); + $cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed); + if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show(); + if ($.fn.bgiframe) { $cluetip.bgiframe(); } + // trigger the optional onShow function + if (opts.delayedClose > 0) { + closeOnDelay = setTimeout(cluetipClose, opts.delayedClose); + } + opts.onShow($cluetip, $cluetipInner); + + }; + +/*************************************** + =INACTIVATION +-------------------------------------- */ + var inactivate = function() { + isActive = false; + $('#cluetip-waitimage').hide(); + if (!opts.sticky || (/click|toggle/).test(opts.activation) ) { + cluetipClose(); +clearTimeout(closeOnDelay); + }; + if (opts.hoverClass) { + $this.removeClass(opts.hoverClass); + } + $('.cluetip-clicked').removeClass('cluetip-clicked'); + }; +// close cluetip and reset some things + var cluetipClose = function() { + $cluetipOuter + .parent().hide().removeClass().end() + .children().empty(); + if (tipTitle) { + $this.attr(opts.titleAttribute, tipTitle); + } + $this.css('cursor',''); + if (opts.arrows) $cluetipArrows.css({top: ''}); + }; + +/*************************************** + =BIND EVENTS +-------------------------------------- */ + // activate by click + if ( (/click|toggle/).test(opts.activation) ) { + $this.click(function(event) { + if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) { + activate(event); + $('.cluetip-clicked').removeClass('cluetip-clicked'); + $this.addClass('cluetip-clicked'); + + } else { + inactivate(event); + + } + this.blur(); + return false; + }); + // activate by focus; inactivate by blur + } else if (opts.activation == 'focus') { + $this.focus(function(event) { + activate(event); + }); + $this.blur(function(event) { + inactivate(event); + }); + // activate by hover + // clicking is returned false if cluetip url is same as href url + } else { + $this.click(function() { + if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) { + return false; + } + }); + //set up mouse tracking + var mouseTracks = function(evt) { + if (opts.tracking == true) { + var trackX = posX - evt.pageX; + var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY; + $this.mousemove(function(evt) { + $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY }); + }); + } + }; + if ($.fn.hoverIntent && opts.hoverIntent) { + $this.mouseover(function() {$this.attr('title',''); }) + .hoverIntent({ + sensitivity: opts.hoverIntent.sensitivity, + interval: opts.hoverIntent.interval, + over: function(event) { + activate(event); + mouseTracks(event); + }, + timeout: opts.hoverIntent.timeout, + out: function(event) {inactivate(event); $this.unbind('mousemove');} + }); + } else { + $this.hover(function(event) { + activate(event); + mouseTracks(event); + }, function(event) { + inactivate(event); + $this.unbind('mousemove'); + }); + } + } + }); + }; + +/* + * options for clueTip + * + * each one can be explicitly overridden by changing its value. + * for example: $.fn.cluetip.defaults.width = 200; + * would change the default width for all clueTips to 200. + * + * each one can also be overridden by passing an options map to the cluetip method. + * for example: $('a.example').cluetip({width: 200}); + * would change the default width to 200 for clueTips invoked by a link with class of "example" + * + */ + + $.fn.cluetip.defaults = { // set up default options + width: 275, // The width of the clueTip + height: 'auto', // The height of the clueTip + cluezIndex: 97, // Sets the z-index style property of the clueTip + positionBy: 'auto', // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed' + topOffset: 15, // Number of px to offset clueTip from top of invoking element + leftOffset: 15, // Number of px to offset clueTip from left of invoking element + local: false, // Whether to use content from the same page for the clueTip's body + hideLocal: true, // If local option is set to true, this determines whether local content + // to be shown in clueTip should be hidden at its original location + attribute: 'rel', // the attribute to be used for fetching the clueTip's body content + titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title + splitTitle: '', // A character used to split the title attribute into the clueTip title and divs + // within the clueTip body. more info below [6] + showTitle: true, // show title bar of the clueTip, even if title attribute not set + cluetipClass: 'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass. + hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout + waitImage: true, // whether to show a "loading" img, which is set in jquery.cluetip.css + cursor: 'help', + arrows: false, // if true, displays arrow on appropriate side of clueTip + dropShadow: true, // set to false if you don't want the drop-shadow effect on the clueTip + dropShadowSteps: 6, // adjusts the size of the drop shadow + sticky: false, // keep visible until manually closed + mouseOutClose: false, // close when clueTip is moused out + activation: 'hover', // set to 'click' to force user to click to show clueTip + // set to 'focus' to show on focus of a form element and hide on blur + clickThrough: false, // if true, and activation is not 'click', then clicking on link will take user to the link's href, + // even if href and tipAttribute are equal + tracking: false, // if true, clueTip will track mouse movement (experimental) + delayedClose: 0, // close clueTip on a timed delay (experimental) + closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title' + closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips + truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs + + // effect and speed for opening clueTips + fx: { + open: 'show', // can be 'show' or 'slideDown' or 'fadeIn' + openSpeed: '' + }, + + // settings for when hoverIntent plugin is used + hoverIntent: { + sensitivity: 3, + interval: 50, + timeout: 0 + }, + + // function to run just before clueTip is shown. + onActivate: function(e) {return true;}, + + // function to run just after clueTip is shown. + onShow: function(ct, c){}, + + // whether to cache results of ajax request to avoid unnecessary hits to server + ajaxCache: true, + + // process data retrieved via xhr before it's displayed + ajaxProcess: function(data) { + data = data.replace(//g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,''); + return data; + }, + + // can pass in standard $.ajax() parameters, not including error, complete, success, and url + ajaxSettings: { + dataType: 'html' + }, + debug: false + }; + + +/* + * Global defaults for clueTips. Apply to all calls to the clueTip plugin. + * + * @example $.cluetip.setup({ + * insertionType: 'prependTo', + * insertionElement: '#container' + * }); + * + * @property + * @name $.cluetip.setup + * @type Map + * @cat Plugins/tooltip + * @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter' + * @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip. + * + */ + + var insertionType = 'appendTo', insertionElement = 'body'; + $.cluetip = {}; + $.cluetip.setup = function(options) { + if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) { + insertionType = options.insertionType; + } + if (options && options.insertionElement) { + insertionElement = options.insertionElement; + } + }; + +})(jQuery); diff --git a/template-common/lib/plugins/jquery.cluetip.packed.js b/template-common/lib/plugins/jquery.cluetip.packed.js new file mode 100644 index 000000000..99b15f30c --- /dev/null +++ b/template-common/lib/plugins/jquery.cluetip.packed.js @@ -0,0 +1 @@ +;(function($){var $cluetip,$cluetipInner,$cluetipOuter,$cluetipTitle,$cluetipArrows,$dropShadow,imgCount;$.fn.cluetip=function(js,options){if(typeof js=='object'){options=js;js=null}return this.each(function(index){var $this=$(this);var opts=$.extend(false,{},$.fn.cluetip.defaults,options||{},$.metadata?$this.metadata():$.meta?$this.data():{});var cluetipContents=false;var cluezIndex=parseInt(opts.cluezIndex,10)-1;var isActive=false,closeOnDelay=0;if(!$('#cluetip').length){$cluetipInner=$('
');$cluetipTitle=$('

');$cluetipOuter=$('
').append($cluetipInner).prepend($cluetipTitle);$cluetip=$('
').css({zIndex:opts.cluezIndex}).append($cluetipOuter).append('
')[insertionType](insertionElement).hide();$('
').css({position:'absolute',zIndex:cluezIndex-1}).insertBefore('#cluetip').hide();$cluetip.css({position:'absolute',zIndex:cluezIndex});$cluetipOuter.css({position:'relative',zIndex:cluezIndex+1});$cluetipArrows=$('
').css({zIndex:cluezIndex+1}).appendTo('#cluetip')}var dropShadowSteps=(opts.dropShadow)?+opts.dropShadowSteps:0;if(!$dropShadow){$dropShadow=$([]);for(var i=0;i').css({zIndex:cluezIndex-i-1,opacity:.1,top:1+i,left:1+i}))};$dropShadow.css({position:'absolute',backgroundColor:'#000'}).prependTo($cluetip)}var tipAttribute=$this.attr(opts.attribute),ctClass=opts.cluetipClass;if(!tipAttribute&&!opts.splitTitle&&!js)return true;if(opts.local&&opts.hideLocal){$(tipAttribute+':first').hide()}var tOffset=parseInt(opts.topOffset,10),lOffset=parseInt(opts.leftOffset,10);var tipHeight,wHeight;var defHeight=isNaN(parseInt(opts.height,10))?'auto':(/\D/g).test(opts.height)?opts.height:opts.height+'px';var sTop,linkTop,posY,tipY,mouseY,baseline;var tipInnerWidth=isNaN(parseInt(opts.width,10))?275:parseInt(opts.width,10);var tipWidth=tipInnerWidth+(parseInt($cluetip.css('paddingLeft'))||0)+(parseInt($cluetip.css('paddingRight'))||0)+dropShadowSteps;var linkWidth=this.offsetWidth;var linkLeft,posX,tipX,mouseX,winWidth;var tipParts;var tipTitle=(opts.attribute!='title')?$this.attr(opts.titleAttribute):'';if(opts.splitTitle){if(tipTitle==undefined){tipTitle=''}tipParts=tipTitle.split(opts.splitTitle);tipTitle=tipParts.shift()}var localContent;var activate=function(event){if(!opts.onActivate($this)){return false}isActive=true;$cluetip.removeClass().css({width:tipInnerWidth});if(tipAttribute==$this.attr('href')){$this.css('cursor',opts.cursor)}$this.attr('title','');if(opts.hoverClass){$this.addClass(opts.hoverClass)}linkTop=posY=$this.offset().top;linkLeft=$this.offset().left;mouseX=event.pageX;mouseY=event.pageY;if($this[0].tagName.toLowerCase()!='area'){sTop=$(document).scrollTop();winWidth=$(window).width()}if(opts.positionBy=='fixed'){posX=linkWidth+linkLeft+lOffset;$cluetip.css({left:posX})}else{posX=(linkWidth>linkLeft&&linkLeft>tipWidth)||linkLeft+linkWidth+tipWidth+lOffset>winWidth?linkLeft-tipWidth-lOffset:linkWidth+linkLeft+lOffset;if($this[0].tagName.toLowerCase()=='area'||opts.positionBy=='mouse'||linkWidth+tipWidth>winWidth){if(mouseX+20+tipWidth>winWidth){$cluetip.addClass(' cluetip-'+ctClass);posX=(mouseX-tipWidth-lOffset)>=0?mouseX-tipWidth-lOffset-parseInt($cluetip.css('marginLeft'),10)+parseInt($cluetipInner.css('marginRight'),10):mouseX-(tipWidth/2)}else{posX=mouseX+lOffset}}var pY=posX<0?event.pageY+tOffset:event.pageY;$cluetip.css({left:(posX>0&&opts.positionBy!='bottomTop')?posX:(mouseX+(tipWidth/2)>winWidth)?winWidth/2-tipWidth/2:Math.max(mouseX-(tipWidth/2),0)})}wHeight=$(window).height();if(js){$cluetipInner.html(js);cluetipShow(pY)}else if(tipParts){var tpl=tipParts.length;for(var i=0;i'+tipParts[i]+'')}};cluetipShow(pY)}else if(!opts.local&&tipAttribute.indexOf('#')!=0){if(cluetipContents&&opts.ajaxCache){$cluetipInner.html(cluetipContents);cluetipShow(pY)}else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show()}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('sorry, the contents could not be loaded')}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents)}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;if(imgCount&&!$.browser.opera){$('#cluetip-inner img').load(function(){imgCount--;if(imgCount<1){$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY)}})}else{$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY)}};$.ajax(ajaxSettings)}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('
').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY)}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded)}function doNothing(){};tipTitle?$cluetipTitle.show().html(tipTitle):(opts.showTitle)?$cluetipTitle.show().html(' '):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('');(opts.closePosition=='bottom')?$closeLink.appendTo($cluetipInner):(opts.closePosition=='title')?$closeLink.prependTo($cluetipTitle):$closeLink.prependTo($cluetipInner);$closeLink.click(function(){cluetipClose();return false});if(opts.mouseOutClose){if($.fn.hoverIntent&&opts.hoverIntent){$cluetip.hoverIntent({over:doNothing,timeout:opts.hoverIntent.timeout,out:function(){$closeLink.trigger('click')}})}else{$cluetip.hover(doNothing,function(){$closeLink.trigger('click')})}}else{$cluetip.unbind('mouseout')}}var direction='';$cluetipOuter.css({overflow:defHeight=='auto'?'visible':'auto',height:defHeight});tipHeight=defHeight=='auto'?Math.max($cluetip.outerHeight(),$cluetip.height()):parseInt(defHeight,10);tipY=posY;baseline=sTop+wHeight;if(opts.positionBy=='fixed'){tipY=posY-opts.dropShadowSteps+tOffset}else if((posXmouseX)||opts.positionBy=='bottomTop'){if(posY+tipHeight+tOffset>baseline&&mouseY-sTop>tipHeight+tOffset){tipY=mouseY-tipHeight-tOffset;direction='top'}else{tipY=mouseY+tOffset;direction='bottom'}}else if(posY+tipHeight+tOffset>baseline){tipY=(tipHeight>=wHeight)?sTop:baseline-tipHeight-tOffset}else if($this.css('display')=='block'||$this[0].tagName.toLowerCase()=='area'||opts.positionBy=="mouse"){tipY=bpY-tOffset}else{tipY=posY-opts.dropShadowSteps}if(direction==''){posX=0&&bgY>0)?bgY+'px':/(left|right)/.test(direction)?0:''}).show()}else{$cluetipArrows.hide()}$dropShadow.hide();$cluetip.hide()[opts.fx.open](opts.fx.open!='show'&&opts.fx.openSpeed);if(opts.dropShadow)$dropShadow.css({height:tipHeight,width:tipInnerWidth}).show();if($.fn.bgiframe){$cluetip.bgiframe()}if(opts.delayedClose>0){closeOnDelay=setTimeout(cluetipClose,opts.delayedClose)}opts.onShow($cluetip,$cluetipInner)};var inactivate=function(){isActive=false;$('#cluetip-waitimage').hide();if(!opts.sticky||(/click|toggle/).test(opts.activation)){cluetipClose();clearTimeout(closeOnDelay)};if(opts.hoverClass){$this.removeClass(opts.hoverClass)}$('.cluetip-clicked').removeClass('cluetip-clicked')};var cluetipClose=function(){$cluetipOuter.parent().hide().removeClass().end().children().empty();if(tipTitle){$this.attr(opts.titleAttribute,tipTitle)}$this.css('cursor','');if(opts.arrows)$cluetipArrows.css({top:''})};if((/click|toggle/).test(opts.activation)){$this.click(function(event){if($cluetip.is(':hidden')||!$this.is('.cluetip-clicked')){activate(event);$('.cluetip-clicked').removeClass('cluetip-clicked');$this.addClass('cluetip-clicked')}else{inactivate(event)}this.blur();return false})}else if(opts.activation=='focus'){$this.focus(function(event){activate(event)});$this.blur(function(event){inactivate(event)})}else{$this.click(function(){if($this.attr('href')&&$this.attr('href')==tipAttribute&&!opts.clickThrough){return false}});var mouseTracks=function(evt){if(opts.tracking==true){var trackX=posX-evt.pageX;var trackY=tipY?tipY-evt.pageY:posY-evt.pageY;$this.mousemove(function(evt){$cluetip.css({left:evt.pageX+trackX,top:evt.pageY+trackY})})}};if($.fn.hoverIntent&&opts.hoverIntent){$this.mouseover(function(){$this.attr('title','')}).hoverIntent({sensitivity:opts.hoverIntent.sensitivity,interval:opts.hoverIntent.interval,over:function(event){activate(event);mouseTracks(event)},timeout:opts.hoverIntent.timeout,out:function(event){inactivate(event);$this.unbind('mousemove')}})}else{$this.hover(function(event){activate(event);mouseTracks(event)},function(event){inactivate(event);$this.unbind('mousemove')})}}})};$.fn.cluetip.defaults={width:275,height:'auto',cluezIndex:97,positionBy:'auto',topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:'rel',titleAttribute:'title',splitTitle:'',showTitle:true,cluetipClass:'default',hoverClass:'',waitImage:true,cursor:'help',arrows:false,dropShadow:true,dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:'hover',clickThrough:false,tracking:false,delayedClose:0,closePosition:'top',closeText:'Close',truncate:0,fx:{open:'show',openSpeed:''},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(e){return true},onShow:function(ct,c){},ajaxCache:true,ajaxProcess:function(data){data=data.replace(//g,'').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');return data},ajaxSettings:{dataType:'html'},debug:false};var insertionType='appendTo',insertionElement='body';$.cluetip={};$.cluetip.setup=function(options){if(options&&options.insertionType&&(options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){insertionType=options.insertionType}if(options&&options.insertionElement){insertionElement=options.insertionElement}}})(jQuery); \ No newline at end of file diff --git a/template-common/lib/plugins/jquery.dimensions.js b/template-common/lib/plugins/jquery.dimensions.js new file mode 100644 index 000000000..de6b39a91 --- /dev/null +++ b/template-common/lib/plugins/jquery.dimensions.js @@ -0,0 +1,119 @@ +/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * $LastChangedDate$ + * $Rev$ + * + * Version: 1.2 + * + * Requires: jQuery 1.2+ + */ + +(function($){ + +$.dimensions = { + version: '1.2' +}; + +// Create innerHeight, innerWidth, outerHeight and outerWidth methods +$.each( [ 'Height', 'Width' ], function(i, name){ + + // innerHeight and innerWidth + $.fn[ 'inner' + name ] = function() { + if (!this[0]) return; + + var torl = name == 'Height' ? 'Top' : 'Left', // top or left + borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right + + return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr); + }; + + // outerHeight and outerWidth + $.fn[ 'outer' + name ] = function(options) { + if (!this[0]) return; + + var torl = name == 'Height' ? 'Top' : 'Left', // top or left + borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right + + options = $.extend({ margin: false }, options || {}); + + var val = this.is(':visible') ? + this[0]['offset' + name] : + num( this, name.toLowerCase() ) + + num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width') + + num(this, 'padding' + torl) + num(this, 'padding' + borr); + + return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0); + }; +}); + +// Create scrollLeft and scrollTop methods +$.each( ['Left', 'Top'], function(i, name) { + $.fn[ 'scroll' + name ] = function(val) { + if (!this[0]) return; + + return val != undefined ? + + // Set the scroll offset + this.each(function() { + this == window || this == document ? + window.scrollTo( + name == 'Left' ? val : $(window)[ 'scrollLeft' ](), + name == 'Top' ? val : $(window)[ 'scrollTop' ]() + ) : + this[ 'scroll' + name ] = val; + }) : + + // Return the scroll offset + this[0] == window || this[0] == document ? + self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] || + $.boxModel && document.documentElement[ 'scroll' + name ] || + document.body[ 'scroll' + name ] : + this[0][ 'scroll' + name ]; + }; +}); + +$.fn.extend({ + position: function() { + var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results; + + if (elem) { + // Get *real* offsetParent + offsetParent = this.offsetParent(); + + // Get correct offsets + offset = this.offset(); + parentOffset = offsetParent.offset(); + + // Subtract element margins + offset.top -= num(elem, 'marginTop'); + offset.left -= num(elem, 'marginLeft'); + + // Add offsetParent borders + parentOffset.top += num(offsetParent, 'borderTopWidth'); + parentOffset.left += num(offsetParent, 'borderLeftWidth'); + + // Subtract the two offsets + results = { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + } + + return results; + }, + + offsetParent: function() { + var offsetParent = this[0].offsetParent; + while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') ) + offsetParent = offsetParent.offsetParent; + return $(offsetParent); + } +}); + +function num(el, prop) { + return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0; +}; + +})(jQuery); \ No newline at end of file diff --git a/template-common/lib/plugins/jquery.dimensions.packed.js b/template-common/lib/plugins/jquery.dimensions.packed.js new file mode 100644 index 000000000..79cb5a099 --- /dev/null +++ b/template-common/lib/plugins/jquery.dimensions.packed.js @@ -0,0 +1 @@ +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{})) \ No newline at end of file diff --git a/template-common/lib/ui/ui.accordion.js b/template-common/lib/ui/ui.accordion.js index 4df9edea9..2cf014b8e 100644 --- a/template-common/lib/ui/ui.accordion.js +++ b/template-common/lib/ui/ui.accordion.js @@ -111,7 +111,7 @@ function completed(cancel) { overflow: "" }); } - instance.trigger('change', null, options.data); + $(this).triggerHandler("accordionchange", [$.event.fix({type: 'accordionchange', target: instance.element[0]}), options.data], options.change); } function toggle(toShow, toHide, data, clickedActive, down) { @@ -201,11 +201,12 @@ function clickHandler(event) { // find elements to show and hide var toShow = clicked.next(), toHide = options.active.next(), + //data = [clicked, options.active, toShow, toHide], data = { options: options, - newHeader: clickedActive && !options.alwaysOpen ? $([]) : clicked, + newHeader: clicked, oldHeader: options.active, - newContent: clickedActive && !options.alwaysOpen ? $([]) : toShow, + newContent: toShow, oldContent: toHide }, down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] ); @@ -217,7 +218,7 @@ function clickHandler(event) { }; function findActive(headers, selector) { - return selector + return selector != undefined ? typeof selector == "number" ? headers.filter(":eq(" + selector + ")") : headers.not(headers.not(selector)) diff --git a/template-common/lib/ui/ui.accordion.packed.js b/template-common/lib/ui/ui.accordion.packed.js index 649527fc3..70b95d682 100644 --- a/template-common/lib/ui/ui.accordion.packed.js +++ b/template-common/lib/ui/ui.accordion.packed.js @@ -1,2 +1,2 @@ -eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(E){E.2f("d.5",{2e:4(){7 G=2.c;3(G.2d){7 J=2.e.13("a").m(G.1c);3(J.1p){3(J.m(G.o).1p){G.6=J}w{G.6=J.k().k().2c();J.v("2b")}}}G.8=2.e.13(G.o);G.6=C(G.8,G.6);3(E.U.15){2.e.13("a").l("2a","1")}3(!2.e.29("d-5")){2.e.v("d-5");E("<1o 1n=\'d-5-28\'/>").27(G.8);E("<1o 1n=\'d-5-26\'/>").25(G.8);G.8.v("d-5-o").24("23","0")}7 I;3(G.1k){I=2.e.k().b();G.8.O(4(){I-=E(2).1l()});7 H=0;G.8.h().O(4(){H=T.1m(H,E(2).22()-E(2).b())}).b(I-H)}w{3(G.g){I=0;G.8.h().O(4(){I=T.1m(I,E(2).1l())}).b(I)}}G.8.10(G.6||"").h().V();G.6.k().R().v(G.t);3(G.Z){2.e.21((G.Z)+".5",F)}},S:4(G){F.11(2.e[0],{12:C(2.c.8,G)[0]})},20:4(){2.c.8.h().l("1Z","");3(2.c.1k||2.c.g){2.c.8.h().l("b","")}E.1Y(2.e[0],"5");2.e.1X("d-5").1W(".5")}});4 B(H,G){9 4(){9 H.1V(G,1U)}}4 D(I){3(!E.p(2,"5")){9}7 G=E.p(2,"5");7 H=G.c;H.n=I?0:--H.n;3(H.n){9}3(H.1T){H.f.1S(H.i).l({b:"",18:""})}G.1R("1Q",1P,H.p)}4 A(G,K,L,J,M){7 I=E.p(2,"5").c;I.f=G;I.i=K;I.p=L;7 H=B(D,2);I.n=K.P()===0?G.P():K.P();3(I.Q){3(!I.j&&J){E.d.5.X[I.Q]({f:x([]),i:K,s:H,z:M,g:I.g})}w{E.d.5.X[I.Q]({f:G,i:K,s:H,z:M,g:I.g})}}w{3(!I.j&&J){G.1O()}w{K.V();G.W()}H(Y)}}4 F(L){7 J=E.p(2,"5").c;3(J.1N){9 u}3(!L.12&&!J.j){J.6.k().R().1j(J.t);7 I=J.6.h(),M={c:J,1i:x([]),1h:J.6,1g:x([]),1f:I},G=(J.6=E([]));A.11(2,G,I,M);9 u}7 K=E(L.12);K=E(K.1M(J.o)[0]||K);7 H=K[0]==J.6[0];3(J.n||(J.j&&H)){9 u}3(!K.1L(J.o)){9}J.6.k().R().1j(J.t);3(!H){K.k().R().v(J.t)}7 G=K.h(),I=J.6.h(),M={c:J,1i:H&&!J.j?E([]):K,1h:J.6,1g:H&&!J.j?E([]):G,1f:I},N=J.8.1e(J.6[0])>J.8.1e(K[0]);J.6=H?E([]):K;A.11(2,G,I,M,H,N);9 u}4 C(H,G){9 G?1K G=="1J"?H.m(":1d("+G+")"):H.10(H.10(G)):G===u?E([]):H.m(":1d(0)")}E.19(E.d.5,{1I:{t:"1H",j:Y,Q:"y",Z:"1G",o:"a",g:Y,n:0,1c:4(){9 2.1b.1a()==1F.1b.1a()}},X:{y:4(G,I){G=E.19({r:"14",q:1E},G,I);3(!G.i.P()){G.f.16({b:"W"},G);9}7 H=G.i.b(),J=G.f.b(),K=J/H;G.f.l({b:0,18:"17"}).W();G.i.m(":17").O(G.s).1D().m(":1C").16({b:"V"},{1B:4(L){7 M=(H-L)*K;3(E.U.15||E.U.1A){M=T.1z(M)}G.f.b(M)},q:G.q,r:G.r,s:4(){3(!G.g){G.f.l("b","1y")}G.s()}})},1x:4(G){2.y(G,{r:G.z?"1w":"14",q:G.z?1v:1u})},1t:4(G){2.y(G,{r:"1s",q:1r})}}});E.1q.S=4(G){9 2.5("S",G)}})(x)',62,140,'||this|if|function|accordion|active|var|headers|return||height|options|ui|element|toShow|autoHeight|next|toHide|alwaysOpen|parent|css|filter|running|header|data|duration|easing|complete|selectedClass|false|addClass|else|jQuery|slide|down|||||||||||||||each|size|animated|andSelf|activate|Math|browser|hide|show|animations|true|event|not|call|target|find|swing|msie|animate|hidden|overflow|extend|toLowerCase|href|navigationFilter|eq|index|oldContent|newContent|oldHeader|newHeader|toggleClass|fillSpace|outerHeight|max|class|span|length|fn|700|easeinout|easeslide|200|1000|bounceout|bounceslide|auto|ceil|opera|step|visible|end|300|location|click|selected|defaults|number|typeof|is|parents|disabled|toggle|null|change|trigger|add|clearStyle|arguments|apply|unbind|removeClass|removeData|display|destroy|bind|innerHeight|tabindex|attr|appendTo|right|insertBefore|left|hasClass|zoom|current|prev|navigation|init|widget'.split('|'),0,{})) +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(E){E.2i("e.5",{2h:4(){7 G=2.c;3(G.2g){7 J=2.d.13("a").l(G.1c);3(J.1q){3(J.l(G.n).1q){G.6=J}w{G.6=J.j().j().2f();J.v("2e")}}}G.8=2.d.13(G.n);G.6=C(G.8,G.6);3(E.W.15){2.d.13("a").k("2d","1")}3(!2.d.2c("e-5")){2.d.v("e-5");E("<1p 1o=\'e-5-2b\'/>").2a(G.8);E("<1p 1o=\'e-5-29\'/>").28(G.8);G.8.v("e-5-n").27("26","0")}7 I;3(G.1l){I=2.d.j().b();G.8.O(4(){I-=E(2).1m()});7 H=0;G.8.h().O(4(){H=V.1n(H,E(2).25()-E(2).b())}).b(I-H)}w{3(G.g){I=0;G.8.h().O(4(){I=V.1n(I,E(2).1m())}).b(I)}}G.8.11(G.6||"").h().X();G.6.j().S().v(G.t);3(G.Q){2.d.24((G.Q)+".5",F)}},U:4(G){F.12(2.d[0],{T:C(2.c.8,G)[0]})},23:4(){2.c.8.h().k("22","");3(2.c.1l||2.c.g){2.c.8.h().k("b","")}E.21(2.d[0],"5");2.d.20("e-5").1Z(".5")}});4 B(H,G){9 4(){9 H.1Y(G,1X)}}4 D(I){3(!E.o(2,"5")){9}7 G=E.o(2,"5");7 H=G.c;H.m=I?0:--H.m;3(H.m){9}3(H.1W){H.f.1V(H.i).k({b:"",18:""})}E(2).1U("1k",[E.Q.1T({1S:"1k",T:G.d[0]}),H.o],H.1R)}4 A(G,K,L,J,M){7 I=E.o(2,"5").c;I.f=G;I.i=K;I.o=L;7 H=B(D,2);I.m=K.P()===0?G.P():K.P();3(I.R){3(!I.s&&J){E.e.5.Z[I.R]({f:x([]),i:K,r:H,z:M,g:I.g})}w{E.e.5.Z[I.R]({f:G,i:K,r:H,z:M,g:I.g})}}w{3(!I.s&&J){G.1Q()}w{K.X();G.Y()}H(10)}}4 F(L){7 J=E.o(2,"5").c;3(J.1P){9 u}3(!L.T&&!J.s){J.6.j().S().1j(J.t);7 I=J.6.h(),M={c:J,1i:x([]),1h:J.6,1g:x([]),1f:I},G=(J.6=E([]));A.12(2,G,I,M);9 u}7 K=E(L.T);K=E(K.1O(J.n)[0]||K);7 H=K[0]==J.6[0];3(J.m||(J.s&&H)){9 u}3(!K.1N(J.n)){9}J.6.j().S().1j(J.t);3(!H){K.j().S().v(J.t)}7 G=K.h(),I=J.6.h(),M={c:J,1i:K,1h:J.6,1g:G,1f:I},N=J.8.1e(J.6[0])>J.8.1e(K[0]);J.6=H?E([]):K;A.12(2,G,I,M,H,N);9 u}4 C(H,G){9 G!=1M?1L G=="1K"?H.l(":1d("+G+")"):H.11(H.11(G)):G===u?E([]):H.l(":1d(0)")}E.19(E.e.5,{1J:{t:"1I",s:10,R:"y",Q:"1H",n:"a",g:10,m:0,1c:4(){9 2.1b.1a()==1G.1b.1a()}},Z:{y:4(G,I){G=E.19({q:"14",p:1F},G,I);3(!G.i.P()){G.f.16({b:"Y"},G);9}7 H=G.i.b(),J=G.f.b(),K=J/H;G.f.k({b:0,18:"17"}).Y();G.i.l(":17").O(G.r).1E().l(":1D").16({b:"X"},{1C:4(L){7 M=(H-L)*K;3(E.W.15||E.W.1B){M=V.1A(M)}G.f.b(M)},p:G.p,q:G.q,r:4(){3(!G.g){G.f.k("b","1z")}G.r()}})},1y:4(G){2.y(G,{q:G.z?"1x":"14",p:G.z?1w:1v})},1u:4(G){2.y(G,{q:"1t",p:1s})}}});E.1r.U=4(G){9 2.5("U",G)}})(x)',62,143,'||this|if|function|accordion|active|var|headers|return||height|options|element|ui|toShow|autoHeight|next|toHide|parent|css|filter|running|header|data|duration|easing|complete|alwaysOpen|selectedClass|false|addClass|else|jQuery|slide|down|||||||||||||||each|size|event|animated|andSelf|target|activate|Math|browser|hide|show|animations|true|not|call|find|swing|msie|animate|hidden|overflow|extend|toLowerCase|href|navigationFilter|eq|index|oldContent|newContent|oldHeader|newHeader|toggleClass|accordionchange|fillSpace|outerHeight|max|class|span|length|fn|700|easeinout|easeslide|200|1000|bounceout|bounceslide|auto|ceil|opera|step|visible|end|300|location|click|selected|defaults|number|typeof|undefined|is|parents|disabled|toggle|change|type|fix|triggerHandler|add|clearStyle|arguments|apply|unbind|removeClass|removeData|display|destroy|bind|innerHeight|tabindex|attr|appendTo|right|insertBefore|left|hasClass|zoom|current|prev|navigation|init|widget'.split('|'),0,{})) diff --git a/template-common/lib/ui/ui.core.js b/template-common/lib/ui/ui.core.js index 5cb669800..3d2e63873 100644 --- a/template-common/lib/ui/ui.core.js +++ b/template-common/lib/ui/ui.core.js @@ -1,5 +1,5 @@ /* - * jQuery UI 1.6b + * jQuery UI 1.5.2 * * Copyright (c) 2008 Paul Bakaus (ui.jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) @@ -9,11 +9,6 @@ */ ;(function($) { -// This adds a selector to check if data exists. -jQuery.extend(jQuery.expr[':'], { - data: "jQuery.data(a, m[3])" -}); - $.ui = { plugin: { add: function(module, option, set) { @@ -52,23 +47,15 @@ $.ui = { return $.ui.cssCache[name]; }, disableSelection: function(el) { - $(el).attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart', function() { return false; }); + $(el).attr('unselectable', 'on').css('MozUserSelect', 'none'); }, enableSelection: function(el) { - $(el).attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart'); + $(el).attr('unselectable', 'off').css('MozUserSelect', ''); }, hasScroll: function(e, a) { - var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', - has = false; - - if (e[scroll] > 0) { return true; } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - e[scroll] = 1; - has = (e[scroll] > 0); - e[scroll] = 0; + var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; + if (e[scroll] > 0) return true; e[scroll] = 1; + has = e[scroll] > 0 ? true : false; e[scroll] = 0; return has; } }; @@ -121,7 +108,6 @@ $.widget = function(name, prototype) { var self = this; this.widgetName = name; - this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace + '-' + name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, options); @@ -165,13 +151,6 @@ $.widget.prototype = { }, disable: function() { this.setData('disabled', true); - }, - - trigger: function(type, e, data) { - var eventName = (type == this.widgetEventPrefix - ? type : this.widgetEventPrefix + type); - e = e || $.event.fix({ type: eventName, target: this.element[0] }); - return this.element.triggerHandler(eventName, [e, data], this.options[type]); } }; diff --git a/template-common/lib/ui/ui.core.packed.js b/template-common/lib/ui/ui.core.packed.js index b0428002d..2dbda4f5a 100644 --- a/template-common/lib/ui/ui.core.packed.js +++ b/template-common/lib/ui/ui.core.packed.js @@ -1,2 +1,2 @@ -eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(C){v.16(v.2C[":"],{r:"v.r(a, m[3])"});C.d={2B:{11:4(E,F,H){7 G=C.d[E].q;1C(7 D 2A H){G.O[D]=G.O[D]||[];G.O[D].2z([F,H[D]])}},1u:4(D,F,E){7 H=D.O[F];6(!H){5}1C(7 G=0;G\').1q(D).f({2v:"2u",2t:"-1B",1v:"-1B",2s:"2r"}).2q("1A");C.d.t[D]=!!((!(/2p|2o/).u(E.f("2n"))||(/^[1-9]/).u(E.f("2m"))||(/^[1-9]/).u(E.f("2l"))||!(/1y/).u(E.f("2k"))||!(/2j|2i\\(0, 0, 0, 0\\)/).u(E.f("2h"))));2g{C("1A").1z(0).2f(E.1z(0))}2e(F){}5 C.d.t[D]},2d:4(D){C(D).l("k","1n").f("1x","1y").h("1w",4(){5 8})},2c:4(D){C(D).l("k","2b").f("1x","").z("1w")},2a:4(G,E){7 D=(E&&E=="1v")?"29":"28",F=8;6(G[D]>0){5 i}G[D]=1;F=(G[D]>0);G[D]=0;5 F}};7 B=C.17.M;C.17.M=4(){C("*",2).11(2).1o("M");5 B.N(2,1t)};4 A(E,F,G){7 D=C[E][F].27||[];D=(13 D=="12"?D.18(/,?\\s+/):D);5(C.26(G,D)!=-1)}C.o=4(E,D){7 F=E.18(".")[0];E=E.18(".")[1];C.17[E]=4(J){7 H=(13 J=="12"),I=25.q.24.1u(1t,1);6(H&&A(F,E,J)){7 G=C.r(2[0],E);5(G?G[J].N(G,I):23)}5 2.22(4(){7 K=C.r(2,E);6(H&&K&&C.21(K[J])){K[J].N(K,I)}20{6(!H){C.r(2,E,1Z C[F][E](2,J))}}})};C[F][E]=4(I,H){7 G=2;2.g=E;2.14=C[F][E].1Y||E;2.1p=F+"-"+E;2.c=C.16({},C.o.w,C[F][E].w,H);2.b=C(I).h("p."+E,4(L,J,K){5 G.p(J,K)}).h("15."+E,4(K,J){5 G.15(J)}).h("M",4(){5 G.1r()});2.1s()};C[F][E].q=C.16({},C.o.q,D)};C.o.q={1s:4(){},1r:4(){2.b.1X(2.g)},15:4(D){5 2.c[D]},p:4(D,E){2.c[D]=E;6(D=="n"){2.b[E?"1q":"1W"](2.1p+"-n")}},1V:4(){2.p("n",8)},1U:4(){2.p("n",i)},1T:4(E,G,F){7 D=(E==2.14?E:2.14+E);G=G||C.1S.1R({1Q:D,10:2.b[0]});5 2.b.1o(D,[G,F],2.c[E])}};C.o.w={n:8};C.d.1a={1P:4(){7 D=2;2.b.h("1O."+2.g,4(E){5 D.1l(E)});6(C.Z.Y){2.1m=2.b.l("k");2.b.l("k","1n")}2.1N=8},1M:4(){2.b.z("."+2.g);(C.Z.Y&&2.b.l("k",2.1m))},1l:4(F){(2.e&&2.j(F));2.y=F;7 E=2,G=(F.1L==1),D=(13 2.c.Q=="12"?C(F.10).1K().11(F.10).1J(2.c.Q).1k:8);6(!G||D||!2.1b(F)){5 i}2.x=!2.c.P;6(!2.x){2.1I=1H(4(){E.x=i},2.c.P)}6(2.V(F)&&2.T(F)){2.e=(2.S(F)!==8);6(!2.e){F.1G();5 i}}2.X=4(H){5 E.1j(H)};2.W=4(H){5 E.j(H)};C(1i).h("1h."+2.g,2.X).h("1g."+2.g,2.W);5 8},1j:4(D){6(C.Z.Y&&!D.1F){5 2.j(D)}6(2.e){2.R(D);5 8}6(2.V(D)&&2.T(D)){2.e=(2.S(2.y,D)!==8);(2.e?2.R(D):2.j(D))}5!2.e},j:4(D){C(1i).z("1h."+2.g,2.X).z("1g."+2.g,2.W);6(2.e){2.e=8;2.1c(D)}5 8},V:4(D){5(U.1E(U.1e(2.y.1f-D.1f),U.1e(2.y.1d-D.1d))>=2.c.19)},T:4(D){5 2.x},S:4(D){},R:4(D){},1c:4(D){},1b:4(D){5 i}};C.d.1a.w={Q:1D,19:1,P:0}})(v)',62,163,'||this||function|return|if|var|false|||element|options|ui|_mouseStarted|css|widgetName|bind|true|mouseUp|unselectable|attr||disabled|widget|setData|prototype|data||cssCache|test|jQuery|defaults|_mouseDelayMet|_mouseDownEvent|unbind|||||||||||||remove|apply|plugins|delay|cancel|mouseDrag|mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|_mouseMoveDelegate|msie|browser|target|add|string|typeof|widgetEventPrefix|getData|extend|fn|split|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|length|mouseDown|_mouseUnselectable|on|triggerHandler|widgetBaseClass|addClass|destroy|init|arguments|call|left|selectstart|MozUserSelect|none|get|body|5000px|for|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|filter|parents|which|mouseDestroy|started|mousedown|mouseInit|type|fix|event|trigger|disable|enable|removeClass|removeData|eventPrefix|new|else|isFunction|each|undefined|slice|Array|inArray|getter|scrollTop|scrollLeft|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|top|absolute|position|gen|class|div|push|in|plugin|expr'.split('|'),0,{})) +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(C){C.8={2r:{V:3(E,F,H){6 G=C.8[E].o;1v(6 D 2q H){G.w[D]=G.w[D]||[];G.w[D].2p([F,H[D]])}},1p:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G\').1k(D).d({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.p[D]=!!((!(/2f|2e/).h(E.d("2d"))||(/^[1-9]/).h(E.d("2c"))||(/^[1-9]/).h(E.d("2b"))||!(/1r/).h(E.d("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.d("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.p[D]},23:3(D){C(D).k("j","1i").d("1q","1r")},22:3(D){C(D).k("j","21").d("1q","")},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 f}G[D]=1;F=G[D]>0?f:7;G[D]=0;4 F}};6 B=C.10.u;C.10.u=3(){C("*",2).V(2).1X("u");4 B.v(2,1o)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(X D=="W"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.m=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(X J=="W"),I=1U.o.1T.1p(1o,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].v(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].v(K,I)}1P{5(!H){C.Z(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1j=F+"-"+E;2.a=C.1n({},C.m.q,C[F][E].q,H);2.c=C(I).g("n."+E,3(L,J,K){4 G.n(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("u",3(){4 G.1l()});2.1m()};C[F][E].o=C.1n({},C.m.o,D)};C.m.o={1m:3(){},1l:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},n:3(D,E){2.a[D]=E;5(D=="l"){2.c[E?"1k":"1M"](2.1j+"-l")}},1L:3(){2.n("l",7)},1K:3(){2.n("l",f)}};C.m.q={l:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1g(E)});5(C.U.T){2.1h=2.c.k("j");2.c.k("j","1i")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.k("j",2.1h))},1g:3(F){(2.b&&2.i(F));2.t=F;6 E=2,G=(F.1F==1),D=(X 2.a.y=="W"?C(F.1f).1E().V(F.1f).1D(2.a.y).1e:7);5(!G||D||!2.15(F)){4 f}2.r=!2.a.x;5(!2.r){2.1C=1B(3(){E.r=f},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 f}}2.S=3(H){4 E.1d(H)};2.Q=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.S).g("1a."+2.e,2.Q);4 7},1d:3(D){5(C.U.T&&!D.1z){4 2.i(D)}5(2.b){2.z(D);4 7}5(2.P(D)&&2.N(D)){2.b=(2.M(2.t,D)!==7);(2.b?2.z(D):2.i(D))}4!2.b},i:3(D){C(1c).R("1b."+2.e,2.S).R("1a."+2.e,2.Q);5(2.b){2.b=7;2.16(D)}4 7},P:3(D){4(O.1y(O.18(2.t.19-D.19),O.18(2.t.17-D.17))>=2.a.13)},N:3(D){4 2.r},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 f}};C.8.14.q={y:1x,13:1,x:0}})(1w)',62,152,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|css|widgetName|true|bind|test|mouseUp|unselectable|attr|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet||_mouseDownEvent|remove|apply|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|add|string|typeof|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|length|target|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|MozUserSelect|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|filter|parents|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|triggerHandler|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|class|div|push|in|plugin'.split('|'),0,{})) diff --git a/template-common/lib/ui/ui.datepicker.js b/template-common/lib/ui/ui.datepicker.js new file mode 100644 index 000000000..2ddca2889 --- /dev/null +++ b/template-common/lib/ui/ui.datepicker.js @@ -0,0 +1,1533 @@ +/* + * jQuery UI Datepicker + * + * Copyright (c) 2006, 2007, 2008 Marc Grabanski + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Datepicker + * + * Depends: + * ui.core.js + * + * Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au). + */ + +(function($) { // hide the namespace + +var PROP_NAME = 'datepicker'; + +/* Date picker manager. + Use the singleton instance of this class, $.datepicker, to interact with the date picker. + Settings for (groups of) date pickers are maintained in an instance object, + allowing multiple different settings on the same page. */ + +function Datepicker() { + this.debug = false; // Change this to true to start debugging + this._curInst = null; // The current instance in use + this._disabledInputs = []; // List of date picker inputs that have been disabled + this._datepickerShowing = false; // True if the popup picker is showing , false if not + this._inDialog = false; // True if showing within a "dialog", false if not + this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division + this._appendClass = 'ui-datepicker-append'; // The name of the append marker class + this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class + this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class + this._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class + this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class + this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + clearText: 'Clear', // Display text for clear link + clearStatus: 'Erase the current date', // Status text for clear link + closeText: 'Close', // Display text for close link + closeStatus: 'Close without change', // Status text for close link + prevText: '<Prev', // Display text for previous month link + prevStatus: 'Show the previous month', // Status text for previous month link + nextText: 'Next>', // Display text for next month link + nextStatus: 'Show the next month', // Status text for next month link + currentText: 'Today', // Display text for current month link + currentStatus: 'Show the current month', // Status text for current month link + monthNames: ['January','February','March','April','May','June', + 'July','August','September','October','November','December'], // Names of months for drop-down and formatting + monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting + monthStatus: 'Show a different month', // Status text for selecting a month + yearStatus: 'Show a different year', // Status text for selecting a year + weekHeader: 'Wk', // Header for the week of the year column + weekStatus: 'Week of the year', // Status text for the week of the year column + dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting + dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday + dayStatus: 'Set DD as first week day', // Status text for the day of the week selection + dateStatus: 'Select DD, M d', // Status text for the date selection + dateFormat: 'mm/dd/yy', // See format options on parseDate + firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... + initStatus: 'Select a date', // Initial Status text on opening + isRTL: false // True if right-to-left language, false if left-to-right + }; + this._defaults = { // Global defaults for all the date picker instances + showOn: 'focus', // 'focus' for popup on focus, + // 'button' for trigger button, or 'both' for either + showAnim: 'show', // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + defaultDate: null, // Used when field is blank: actual date, + // +/-number for offset from today, null for today + appendText: '', // Display text following the input box, e.g. showing the format + buttonText: '...', // Text for trigger button + buttonImage: '', // URL for trigger button image + buttonImageOnly: false, // True if the image appears alone, false if it appears on a button + closeAtTop: true, // True to have the clear/close at the top, + // false to have them at the bottom + mandatory: false, // True to hide the Clear link, false to include it + hideIfNoPrevNext: false, // True to hide next/previous month links + // if not applicable, false to just disable them + navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + gotoCurrent: false, // True if today link goes back to current selection instead + changeMonth: true, // True if month can be selected directly, false if only prev/next + changeYear: true, // True if year can be selected directly, false if only prev/next + yearRange: '-10:+10', // Range of years to display in drop-down, + // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn) + changeFirstDay: true, // True to click on day name to change, false to remain as set + highlightWeek: false, // True to highlight the selected week + showOtherMonths: false, // True to show dates in other months, false to leave blank + showWeeks: false, // True to show week of the year, false to omit + calculateWeek: this.iso8601Week, // How to calculate the week of the year, + // takes a Date and returns the number of the week for it + shortYearCutoff: '+10', // Short year values < this are in the current century, + // > this are in the previous century, + // string value starting with '+' for current year + value + showStatus: false, // True to show status bar at bottom, false to not show it + statusForDate: this.dateStatus, // Function to provide status text for a date - + // takes date and instance as parameters, returns display text + minDate: null, // The earliest selectable date, or null for no limit + maxDate: null, // The latest selectable date, or null for no limit + duration: 'normal', // Duration of display/closure + beforeShowDay: null, // Function that takes a date and returns an array with + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', + // [2] = cell title (optional), e.g. $.datepicker.noWeekends + beforeShow: null, // Function that takes an input field and + // returns a set of custom settings for the date picker + onSelect: null, // Define a callback function when a date is selected + onChangeMonthYear: null, // Define a callback function when the month or year is changed + onClose: null, // Define a callback function when the datepicker is closed + numberOfMonths: 1, // Number of months to show at a time + stepMonths: 1, // Number of months to step back/forward + rangeSelect: false, // Allows for selecting a date range on one date picker + rangeSeparator: ' - ', // Text between two dates in a range + altField: '', // Selector for an alternate field to store selected dates into + altFormat: '' // The date format to use for the alternate field + }; + $.extend(this._defaults, this.regional['']); + this.dpDiv = $(''); +} + +$.extend(Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ + markerClassName: 'hasDatepicker', + + /* Debug logging (if enabled). */ + log: function () { + if (this.debug) + console.log.apply('', arguments); + }, + + /* Override the default settings for all instances of the date picker. + @param settings object - the new settings to use as defaults (anonymous object) + @return the manager object */ + setDefaults: function(settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* Attach the date picker to a jQuery selection. + @param target element - the target input field or division or span + @param settings object - the new settings to use for this date picker instance (anonymous) */ + _attachDatepicker: function(target, settings) { + // check for settings on the control itself - in namespace 'date:' + var inlineSettings = null; + for (attrName in this._defaults) { + var attrValue = target.getAttribute('date:' + attrName); + if (attrValue) { + inlineSettings = inlineSettings || {}; + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + var nodeName = target.nodeName.toLowerCase(); + var inline = (nodeName == 'div' || nodeName == 'span'); + if (!target.id) + target.id = 'dp' + new Date().getTime(); + var inst = this._newInst($(target), inline); + inst.settings = $.extend({}, settings || {}, inlineSettings || {}); + if (nodeName == 'input') { + this._connectDatepicker(target, inst); + } else if (inline) { + this._inlineDatepicker(target, inst); + } + }, + + /* Create a new instance object. */ + _newInst: function(target, inline) { + return {id: target[0].id, input: target, // associated target + selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection + drawMonth: 0, drawYear: 0, // month being drawn + inline: inline, // is datepicker inline or not + dpDiv: (!inline ? this.dpDiv : // presentation div + $('
'))}; + }, + + /* Attach the date picker to an input field. */ + _connectDatepicker: function(target, inst) { + var input = $(target); + if (input.hasClass(this.markerClassName)) + return; + var appendText = this._get(inst, 'appendText'); + var isRTL = this._get(inst, 'isRTL'); + if (appendText) + input[isRTL ? 'before' : 'after']('' + appendText + ''); + var showOn = this._get(inst, 'showOn'); + if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field + input.focus(this._showDatepicker); + if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked + var buttonText = this._get(inst, 'buttonText'); + var buttonImage = this._get(inst, 'buttonImage'); + var trigger = $(this._get(inst, 'buttonImageOnly') ? + $('').addClass(this._triggerClass). + attr({ src: buttonImage, alt: buttonText, title: buttonText }) : + $('').addClass(this._triggerClass). + html(buttonImage == '' ? buttonText : $('').attr( + { src:buttonImage, alt:buttonText, title:buttonText }))); + input[isRTL ? 'before' : 'after'](trigger); + trigger.click(function() { + if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) + $.datepicker._hideDatepicker(); + else + $.datepicker._showDatepicker(target); + return false; + }); + } + input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress). + bind("setData.datepicker", function(event, key, value) { + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key) { + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + }, + + /* Attach an inline date picker to a div. */ + _inlineDatepicker: function(target, inst) { + var input = $(target); + if (input.hasClass(this.markerClassName)) + return; + input.addClass(this.markerClassName).append(inst.dpDiv). + bind("setData.datepicker", function(event, key, value){ + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key){ + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + this._setDate(inst, this._getDefaultDate(inst)); + this._updateDatepicker(inst); + }, + + /* Tidy up after displaying the date picker. */ + _inlineShow: function(inst) { + var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers + inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width()); + }, + + /* Pop-up the date picker in a "dialog" box. + @param input element - ignored + @param dateText string - the initial date to display (in the current format) + @param onSelect function - the function(dateText) to call when a date is selected + @param settings object - update the dialog date picker instance's settings (anonymous object) + @param pos int[2] - coordinates for the dialog's position within the screen or + event - with x/y coordinates or + leave empty for default (screen centre) + @return the manager object */ + _dialogDatepicker: function(input, dateText, onSelect, settings, pos) { + var inst = this._dialogInst; // internal instance + if (!inst) { + var id = 'dp' + new Date().getTime(); + this._dialogInput = $(''); + this._dialogInput.keydown(this._doKeyDown); + $('body').append(this._dialogInput); + inst = this._dialogInst = this._newInst(this._dialogInput, false); + inst.settings = {}; + $.data(this._dialogInput[0], PROP_NAME, inst); + } + extendRemove(inst.settings, settings || {}); + this._dialogInput.val(dateText); + + this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); + if (!this._pos) { + var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + var scrollY = document.documentElement.scrollTop || document.body.scrollTop; + this._pos = // should use actual width/height below + [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; + } + + // move input on screen for focus, but hidden behind dialog + this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px'); + inst.settings.onSelect = onSelect; + this._inDialog = true; + this.dpDiv.addClass(this._dialogClass); + this._showDatepicker(this._dialogInput[0]); + if ($.blockUI) + $.blockUI(this.dpDiv); + $.data(this._dialogInput[0], PROP_NAME, inst); + return this; + }, + + /* Detach a datepicker from its control. + @param target element - the target input field or division or span */ + _destroyDatepicker: function(target) { + var nodeName = target.nodeName.toLowerCase(); + var $target = $(target); + $.removeData(target, PROP_NAME); + if (nodeName == 'input') { + $target.siblings('.' + this._appendClass).remove().end(). + siblings('.' + this._triggerClass).remove().end(). + removeClass(this.markerClassName). + unbind('focus', this._showDatepicker). + unbind('keydown', this._doKeyDown). + unbind('keypress', this._doKeyPress); + } else if (nodeName == 'div' || nodeName == 'span') + $target.removeClass(this.markerClassName).empty(); + }, + + /* Enable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _enableDatepicker: function(target) { + target.disabled = false; + $(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = false; }).end(). + siblings('img.' + this._triggerClass).css({opacity: '1.0', cursor: ''}); + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + }, + + /* Disable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _disableDatepicker: function(target) { + target.disabled = true; + $(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = true; }).end(). + siblings('img.' + this._triggerClass).css({opacity: '0.5', cursor: 'default'}); + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + this._disabledInputs[this._disabledInputs.length] = target; + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + @param target element - the target input field or division or span + @return boolean - true if disabled, false if enabled */ + _isDisabledDatepicker: function(target) { + if (!target) + return false; + for (var i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] == target) + return true; + } + return false; + }, + + /* Update the settings for a date picker attached to an input field or division. + @param target element - the target input field or division or span + @param name object - the new settings to update or + string - the name of the setting to change or + @param value any - the new value for the setting (omit if above is an object) */ + _changeDatepicker: function(target, name, value) { + var settings = name || {}; + if (typeof name == 'string') { + settings = {}; + settings[name] = value; + } + if (inst = $.data(target, PROP_NAME)) { + extendRemove(inst.settings, settings); + this._updateDatepicker(inst); + } + }, + + /* Set the dates for a jQuery selection. + @param target element - the target input field or division or span + @param date Date - the new date + @param endDate Date - the new end date for a range (optional) */ + _setDateDatepicker: function(target, date, endDate) { + var inst = $.data(target, PROP_NAME); + if (inst) { + this._setDate(inst, date, endDate); + this._updateDatepicker(inst); + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + @param target element - the target input field or division or span + @return Date - the current date or + Date[2] - the current dates for a range */ + _getDateDatepicker: function(target) { + var inst = $.data(target, PROP_NAME); + if (inst) + this._setDateFromField(inst); + return (inst ? this._getDate(inst) : null); + }, + + /* Handle keystrokes. */ + _doKeyDown: function(e) { + var inst = $.data(e.target, PROP_NAME); + var handled = true; + if ($.datepicker._datepickerShowing) + switch (e.keyCode) { + case 9: $.datepicker._hideDatepicker(null, ''); + break; // hide on tab out + case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear, + $('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]); + return false; // don't submit the form + break; // select the value on enter + case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration')); + break; // hide on escape + case 33: $.datepicker._adjustDate(e.target, (e.ctrlKey ? -1 : + -$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M')); + break; // previous month/year on page up/+ ctrl + case 34: $.datepicker._adjustDate(e.target, (e.ctrlKey ? +1 : + +$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M')); + break; // next month/year on page down/+ ctrl + case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target); + break; // clear on ctrl+end + case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target); + break; // current on ctrl+home + case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D'); + break; // -1 day on ctrl+left + case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D'); + break; // -1 week on ctrl+up + case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D'); + break; // +1 day on ctrl+right + case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D'); + break; // +1 week on ctrl+down + default: handled = false; + } + else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home + $.datepicker._showDatepicker(this); + else + handled = false; + if (handled) { + e.preventDefault(); + e.stopPropagation(); + } + }, + + /* Filter entered characters - based on date format. */ + _doKeyPress: function(e) { + var inst = $.data(e.target, PROP_NAME); + var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); + var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode); + return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); + }, + + /* Pop-up the date picker for a given input field. + @param input element - the input field attached to the date picker or + event - if triggered by focus */ + _showDatepicker: function(input) { + input = input.target || input; + if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger + input = $('input', input.parentNode)[0]; + if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here + return; + var inst = $.data(input, PROP_NAME); + var beforeShow = $.datepicker._get(inst, 'beforeShow'); + extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); + $.datepicker._hideDatepicker(null, ''); + $.datepicker._lastInput = input; + $.datepicker._setDateFromField(inst); + if ($.datepicker._inDialog) // hide cursor + input.value = ''; + if (!$.datepicker._pos) { // position below input + $.datepicker._pos = $.datepicker._findPos(input); + $.datepicker._pos[1] += input.offsetHeight; // add the height + } + var isFixed = false; + $(input).parents().each(function() { + isFixed |= $(this).css('position') == 'fixed'; + return !isFixed; + }); + if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled + $.datepicker._pos[0] -= document.documentElement.scrollLeft; + $.datepicker._pos[1] -= document.documentElement.scrollTop; + } + var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; + $.datepicker._pos = null; + inst.rangeStart = null; + // determine sizing offscreen + inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); + $.datepicker._updateDatepicker(inst); + // fix width for dynamic number of date pickers + inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] * + $('.ui-datepicker', inst.dpDiv[0])[0].offsetWidth); + // and adjust position before showing + offset = $.datepicker._checkOffset(inst, offset, isFixed); + inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? + 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', + left: offset.left + 'px', top: offset.top + 'px'}); + if (!inst.inline) { + var showAnim = $.datepicker._get(inst, 'showAnim') || 'show'; + var duration = $.datepicker._get(inst, 'duration'); + var postProcess = function() { + $.datepicker._datepickerShowing = true; + if ($.browser.msie && parseInt($.browser.version) < 7) // fix IE < 7 select problems + $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4, + height: inst.dpDiv.height() + 4}); + }; + if ($.effects && $.effects[showAnim]) + inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); + else + inst.dpDiv[showAnim](duration, postProcess); + if (duration == '') + postProcess(); + if (inst.input[0].type != 'hidden') + inst.input[0].focus(); + $.datepicker._curInst = inst; + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function(inst) { + var dims = {width: inst.dpDiv.width() + 4, + height: inst.dpDiv.height() + 4}; + inst.dpDiv.empty().append(this._generateDatepicker(inst)). + find('iframe.ui-datepicker-cover'). + css({width: dims.width, height: dims.height}); + var numMonths = this._getNumberOfMonths(inst); + inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + + 'Class']('ui-datepicker-multi'); + inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + + 'Class']('ui-datepicker-rtl'); + if (inst.input && inst.input[0].type != 'hidden') + $(inst.input[0]).focus(); + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function(inst, offset, isFixed) { + var pos = inst.input ? this._findPos(inst.input[0]) : null; + var browserWidth = window.innerWidth || document.documentElement.clientWidth; + var browserHeight = window.innerHeight || document.documentElement.clientHeight; + var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + var scrollY = document.documentElement.scrollTop || document.body.scrollTop; + // reposition date picker horizontally if outside the browser window + if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth) + offset.left = Math.max((isFixed ? 0 : scrollX), + pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() - + (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0)); + else + offset.left -= (isFixed ? scrollX : 0); + // reposition date picker vertically if outside the browser window + if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight) + offset.top = Math.max((isFixed ? 0 : scrollY), + pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) - + (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0)); + else + offset.top -= (isFixed ? scrollY : 0); + return offset; + }, + + /* Find an object's position on the screen. */ + _findPos: function(obj) { + while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { + obj = obj.nextSibling; + } + var position = $(obj).offset(); + return [position.left, position.top]; + }, + + /* Hide the date picker from view. + @param input element - the input field attached to the date picker + @param duration string - the duration over which to close the date picker */ + _hideDatepicker: function(input, duration) { + var inst = this._curInst; + if (!inst) + return; + var rangeSelect = this._get(inst, 'rangeSelect'); + if (rangeSelect && this._stayOpen) + this._selectDate('#' + inst.id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + this._stayOpen = false; + if (this._datepickerShowing) { + duration = (duration != null ? duration : this._get(inst, 'duration')); + var showAnim = this._get(inst, 'showAnim'); + var postProcess = function() { + $.datepicker._tidyDialog(inst); + }; + if (duration != '' && $.effects && $.effects[showAnim]) + inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), + duration, postProcess); + else + inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : + (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess); + if (duration == '') + this._tidyDialog(inst); + var onClose = this._get(inst, 'onClose'); + if (onClose) + onClose.apply((inst.input ? inst.input[0] : null), + [this._getDate(inst), inst]); // trigger custom callback + this._datepickerShowing = false; + this._lastInput = null; + inst.settings.prompt = null; + if (this._inDialog) { + this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); + if ($.blockUI) { + $.unblockUI(); + $('body').append(this.dpDiv); + } + } + this._inDialog = false; + } + this._curInst = null; + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function(inst) { + inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker'); + $('.' + this._promptClass, inst.dpDiv).remove(); + }, + + /* Close date picker if clicked elsewhere. */ + _checkExternalClick: function(event) { + if (!$.datepicker._curInst) + return; + var $target = $(event.target); + if (($target.parents('#' + $.datepicker._mainDivId).length == 0) && + !$target.hasClass($.datepicker.markerClassName) && + !$target.hasClass($.datepicker._triggerClass) && + $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) + $.datepicker._hideDatepicker(null, ''); + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function(id, offset, period) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + this._adjustInstDate(inst, offset, period); + this._updateDatepicker(inst); + }, + + /* Action for current link. */ + _gotoToday: function(id) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + if (this._get(inst, 'gotoCurrent') && inst.currentDay) { + inst.selectedDay = inst.currentDay; + inst.drawMonth = inst.selectedMonth = inst.currentMonth; + inst.drawYear = inst.selectedYear = inst.currentYear; + } + else { + var date = new Date(); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + } + this._adjustDate(target); + this._notifyChange(inst); + }, + + /* Action for selecting a new month/year. */ + _selectMonthYear: function(id, select, period) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + inst._selectingMonthYear = false; + inst[period == 'M' ? 'drawMonth' : 'drawYear'] = + select.options[select.selectedIndex].value - 0; + this._adjustDate(target); + this._notifyChange(inst); + }, + + /* Restore input focus after not changing month/year. */ + _clickMonthYear: function(id) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + if (inst.input && inst._selectingMonthYear && !$.browser.msie) + inst.input[0].focus(); + inst._selectingMonthYear = !inst._selectingMonthYear; + }, + + /* Action for changing the first week day. */ + _changeFirstDay: function(id, day) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + inst.settings.firstDay = day; + this._updateDatepicker(inst); + }, + + /* Action for selecting a day. */ + _selectDay: function(id, month, year, td) { + if ($(td).hasClass(this._unselectableClass)) + return; + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + var rangeSelect = this._get(inst, 'rangeSelect'); + if (rangeSelect) { + this._stayOpen = !this._stayOpen; + if (this._stayOpen) { + $('.ui-datepicker td').removeClass(this._currentClass); + $(td).addClass(this._currentClass); + } + } + inst.selectedDay = inst.currentDay = $('a', td).html(); + inst.selectedMonth = inst.currentMonth = month; + inst.selectedYear = inst.currentYear = year; + if (this._stayOpen) { + inst.endDay = inst.endMonth = inst.endYear = null; + } + else if (rangeSelect) { + inst.endDay = inst.currentDay; + inst.endMonth = inst.currentMonth; + inst.endYear = inst.currentYear; + } + this._selectDate(id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + if (this._stayOpen) { + inst.rangeStart = new Date(inst.currentYear, inst.currentMonth, inst.currentDay); + this._updateDatepicker(inst); + } + else if (rangeSelect) { + inst.selectedDay = inst.currentDay = inst.rangeStart.getDate(); + inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth(); + inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear(); + inst.rangeStart = null; + if (inst.inline) + this._updateDatepicker(inst); + } + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function(id) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + if (this._get(inst, 'mandatory')) + return; + this._stayOpen = false; + inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null; + this._selectDate(target, ''); + }, + + /* Update the input field with the selected date. */ + _selectDate: function(id, dateStr) { + var target = $(id); + var inst = $.data(target[0], PROP_NAME); + dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); + if (this._get(inst, 'rangeSelect') && dateStr) + dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) : + dateStr) + this._get(inst, 'rangeSeparator') + dateStr; + if (inst.input) + inst.input.val(dateStr); + this._updateAlternate(inst); + var onSelect = this._get(inst, 'onSelect'); + if (onSelect) + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback + else if (inst.input) + inst.input.trigger('change'); // fire the change event + if (inst.inline) + this._updateDatepicker(inst); + else if (!this._stayOpen) { + this._hideDatepicker(null, this._get(inst, 'duration')); + this._lastInput = inst.input[0]; + if (typeof(inst.input[0]) != 'object') + inst.input[0].focus(); // restore focus + this._lastInput = null; + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function(inst) { + var altField = this._get(inst, 'altField'); + if (altField) { // update alternate field too + var altFormat = this._get(inst, 'altFormat'); + var date = this._getDate(inst); + dateStr = (isArray(date) ? (!date[0] && !date[1] ? '' : + this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) + + this._get(inst, 'rangeSeparator') + this.formatDate( + altFormat, date[1] || date[0], this._getFormatConfig(inst))) : + this.formatDate(altFormat, date, this._getFormatConfig(inst))); + $(altField).each(function() { $(this).val(dateStr); }); + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + @param date Date - the date to customise + @return [boolean, string] - is this date selectable?, what is its CSS class? */ + noWeekends: function(date) { + var day = date.getDay(); + return [(day > 0 && day < 6), '']; + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + @param date Date - the date to get the week for + @return number - the number of the week within the year that contains this date */ + iso8601Week: function(date) { + var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), (date.getTimezoneOffset() / -60)); + var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan + var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7 + firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday + if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary + checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year + return $.datepicker.iso8601Week(checkDate); + } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year + firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7; + if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary + checkDate.setDate(checkDate.getDate() + 3); // Generate for next year + return $.datepicker.iso8601Week(checkDate); + } + } + return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date + }, + + /* Provide status text for a particular date. + @param date the date to get the status for + @param inst the current datepicker instance + @return the status display text for this date */ + dateStatus: function(date, inst) { + return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'), + date, $.datepicker._getFormatConfig(inst)); + }, + + /* Parse a string value into a date object. + See formatDate below for the possible formats. + + @param format string - the expected format of the date + @param value string - the date in the above format + @param settings Object - attributes include: + shortYearCutoff number - the cutoff year for determining the century (optional) + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return Date - the extracted date value or null if value is blank */ + parseDate: function (format, value, settings) { + if (format == null || value == null) + throw 'Invalid arguments'; + value = (typeof value == 'object' ? value.toString() : value + ''); + if (value == '') + return null; + var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + var year = -1; + var month = -1; + var day = -1; + var literal = false; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Extract a number from the string value + var getNumber = function(match) { + lookAhead(match); + var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : 2)); + var size = origSize; + var num = 0; + while (size > 0 && iValue < value.length && + value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') { + num = num * 10 + (value.charAt(iValue++) - 0); + size--; + } + if (size == origSize) + throw 'Missing number at position ' + iValue; + return num; + }; + // Extract a name from the string value and convert to an index + var getName = function(match, shortNames, longNames) { + var names = (lookAhead(match) ? longNames : shortNames); + var size = 0; + for (var j = 0; j < names.length; j++) + size = Math.max(size, names[j].length); + var name = ''; + var iInit = iValue; + while (size > 0 && iValue < value.length) { + name += value.charAt(iValue++); + for (var i = 0; i < names.length; i++) + if (name == names[i]) + return i + 1; + size--; + } + throw 'Unknown name at position ' + iInit; + }; + // Confirm that a literal character matches the string value + var checkLiteral = function() { + if (value.charAt(iValue) != format.charAt(iFormat)) + throw 'Unexpected literal at position ' + iValue; + iValue++; + }; + var iValue = 0; + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + checkLiteral(); + else + switch (format.charAt(iFormat)) { + case 'd': + day = getNumber('d'); + break; + case 'D': + getName('D', dayNamesShort, dayNames); + break; + case 'm': + month = getNumber('m'); + break; + case 'M': + month = getName('M', monthNamesShort, monthNames); + break; + case 'y': + year = getNumber('y'); + break; + case '@': + var date = new Date(getNumber('@')); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case "'": + if (lookAhead("'")) + checkLiteral(); + else + literal = true; + break; + default: + checkLiteral(); + } + } + if (year < 100) + year += new Date().getFullYear() - new Date().getFullYear() % 100 + + (year <= shortYearCutoff ? 0 : -100); + var date = new Date(year, month - 1, day); + if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) + throw 'Invalid date'; // E.g. 31/02/* + return date; + }, + + /* Standard date formats. */ + ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) + COOKIE: 'D, dd M yy', + ISO_8601: 'yy-mm-dd', + RFC_822: 'D, d M y', + RFC_850: 'DD, dd-M-y', + RFC_1036: 'D, d M y', + RFC_1123: 'D, d M yy', + RFC_2822: 'D, d M yy', + RSS: 'D, d M y', // RFC 822 + TIMESTAMP: '@', + W3C: 'yy-mm-dd', // ISO 8601 + + /* Format a date object into a string value. + The format can be combinations of the following: + d - day of month (no leading zero) + dd - day of month (two digit) + D - day name short + DD - day name long + m - month of year (no leading zero) + mm - month of year (two digit) + M - month name short + MM - month name long + y - year (two digit) + yy - year (four digit) + @ - Unix timestamp (ms since 01/01/1970) + '...' - literal text + '' - single quote + + @param format string - the desired format of the date + @param date Date - the date value to format + @param settings Object - attributes include: + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return string - the date in the above format */ + formatDate: function (format, date, settings) { + if (!date) + return ''; + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Format a number, with leading zero if necessary + var formatNumber = function(match, value) { + return (lookAhead(match) && value < 10 ? '0' : '') + value; + }; + // Format a name, short or long as requested + var formatName = function(match, value, shortNames, longNames) { + return (lookAhead(match) ? longNames[value] : shortNames[value]); + }; + var output = ''; + var literal = false; + if (date) + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + output += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': + output += formatNumber('d', date.getDate()); + break; + case 'D': + output += formatName('D', date.getDay(), dayNamesShort, dayNames); + break; + case 'm': + output += formatNumber('m', date.getMonth() + 1); + break; + case 'M': + output += formatName('M', date.getMonth(), monthNamesShort, monthNames); + break; + case 'y': + output += (lookAhead('y') ? date.getFullYear() : + (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); + break; + case '@': + output += date.getTime(); + break; + case "'": + if (lookAhead("'")) + output += "'"; + else + literal = true; + break; + default: + output += format.charAt(iFormat); + } + } + return output; + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function (format) { + var chars = ''; + var literal = false; + for (var iFormat = 0; iFormat < format.length; iFormat++) + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + chars += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': case 'm': case 'y': case '@': + chars += '0123456789'; + break; + case 'D': case 'M': + return null; // Accept anything + case "'": + if (lookAhead("'")) + chars += "'"; + else + literal = true; + break; + default: + chars += format.charAt(iFormat); + } + return chars; + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function(inst, name) { + return inst.settings[name] !== undefined ? + inst.settings[name] : this._defaults[name]; + }, + + /* Parse existing date and initialise date picker. */ + _setDateFromField: function(inst) { + var dateFormat = this._get(inst, 'dateFormat'); + var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null; + inst.endDay = inst.endMonth = inst.endYear = null; + var date = defaultDate = this._getDefaultDate(inst); + if (dates.length > 0) { + var settings = this._getFormatConfig(inst); + if (dates.length > 1) { + date = this.parseDate(dateFormat, dates[1], settings) || defaultDate; + inst.endDay = date.getDate(); + inst.endMonth = date.getMonth(); + inst.endYear = date.getFullYear(); + } + try { + date = this.parseDate(dateFormat, dates[0], settings) || defaultDate; + } catch (e) { + this.log(e); + date = defaultDate; + } + } + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + inst.currentDay = (dates[0] ? date.getDate() : 0); + inst.currentMonth = (dates[0] ? date.getMonth() : 0); + inst.currentYear = (dates[0] ? date.getFullYear() : 0); + this._adjustInstDate(inst); + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function(inst) { + var date = this._determineDate(this._get(inst, 'defaultDate'), new Date()); + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + date = (minDate && date < minDate ? minDate : date); + date = (maxDate && date > maxDate ? maxDate : date); + return date; + }, + + /* A date may be specified as an exact value or a relative one. */ + _determineDate: function(date, defaultDate) { + var offsetNumeric = function(offset) { + var date = new Date(); + date.setUTCDate(date.getUTCDate() + offset); + return date; + }; + var offsetString = function(offset, getDaysInMonth) { + var date = new Date(); + var year = date.getFullYear(); + var month = date.getMonth(); + var day = date.getDate(); + var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; + var matches = pattern.exec(offset); + while (matches) { + switch (matches[2] || 'd') { + case 'd' : case 'D' : + day += (matches[1] - 0); break; + case 'w' : case 'W' : + day += (matches[1] * 7); break; + case 'm' : case 'M' : + month += (matches[1] - 0); + day = Math.min(day, getDaysInMonth(year, month)); + break; + case 'y': case 'Y' : + year += (matches[1] - 0); + day = Math.min(day, getDaysInMonth(year, month)); + break; + } + matches = pattern.exec(offset); + } + return new Date(year, month, day); + }; + return (date == null ? defaultDate : + (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) : + (typeof date == 'number' ? offsetNumeric(date) : date))); + }, + + /* Set the date(s) directly. */ + _setDate: function(inst, date, endDate) { + var clear = !(date); + date = this._determineDate(date, new Date()); + inst.selectedDay = inst.currentDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); + if (this._get(inst, 'rangeSelect')) { + if (endDate) { + endDate = this._determineDate(endDate, null); + inst.endDay = endDate.getDate(); + inst.endMonth = endDate.getMonth(); + inst.endYear = endDate.getFullYear(); + } else { + inst.endDay = inst.currentDay; + inst.endMonth = inst.currentMonth; + inst.endYear = inst.currentYear; + } + } + this._adjustInstDate(inst); + if (inst.input) + inst.input.val(clear ? '' : this._formatDate(inst) + + (!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') + + this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear))); + }, + + /* Retrieve the date(s) directly. */ + _getDate: function(inst) { + var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); + if (this._get(inst, 'rangeSelect')) { + return [inst.rangeStart || startDate, (!inst.endYear ? null : + new Date(inst.endYear, inst.endMonth, inst.endDay))]; + } else + return startDate; + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateDatepicker: function(inst) { + var today = new Date(); + today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time + var showStatus = this._get(inst, 'showStatus'); + var isRTL = this._get(inst, 'isRTL'); + // build the date picker HTML + var clear = (this._get(inst, 'mandatory') ? '' : + ''); + var controls = '
' + (isRTL ? '' : clear) + + '' + (isRTL ? clear : '') + '
'; + var prompt = this._get(inst, 'prompt'); + var closeAtTop = this._get(inst, 'closeAtTop'); + var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); + var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); + var numMonths = this._getNumberOfMonths(inst); + var stepMonths = this._get(inst, 'stepMonths'); + var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); + var currentDate = (!inst.currentDay ? new Date(9999, 9, 9) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + var drawMonth = inst.drawMonth; + var drawYear = inst.drawYear; + if (maxDate) { + var maxDraw = new Date(maxDate.getFullYear(), + maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()); + maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); + while (new Date(drawYear, drawMonth, 1) > maxDraw) { + drawMonth--; + if (drawMonth < 0) { + drawMonth = 11; + drawYear--; + } + } + } + // controls and links + var prevText = this._get(inst, 'prevText'); + prevText = (!navigationAsDateFormat ? prevText : this.formatDate( + prevText, new Date(drawYear, drawMonth - stepMonths, 1), this._getFormatConfig(inst))); + var prev = '
' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + '' + prevText + '' : + (hideIfNoPrevNext ? '' : '')) + '
'; + var nextText = this._get(inst, 'nextText'); + nextText = (!navigationAsDateFormat ? nextText : this.formatDate( + nextText, new Date(drawYear, drawMonth + stepMonths, 1), this._getFormatConfig(inst))); + var next = '
' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? + '' + nextText + '' : + (hideIfNoPrevNext ? '' : '')) + '
'; + var currentText = this._get(inst, 'currentText'); + currentText = (!navigationAsDateFormat ? currentText: this.formatDate( + currentText, today, this._getFormatConfig(inst))); + var html = (prompt ? '
' + prompt + '
' : '') + + (closeAtTop && !inst.inline ? controls : '') + + ''; + var firstDay = this._get(inst, 'firstDay'); + var changeFirstDay = this._get(inst, 'changeFirstDay'); + var dayNames = this._get(inst, 'dayNames'); + var dayNamesShort = this._get(inst, 'dayNamesShort'); + var dayNamesMin = this._get(inst, 'dayNamesMin'); + var monthNames = this._get(inst, 'monthNames'); + var beforeShowDay = this._get(inst, 'beforeShowDay'); + var highlightWeek = this._get(inst, 'highlightWeek'); + var showOtherMonths = this._get(inst, 'showOtherMonths'); + var showWeeks = this._get(inst, 'showWeeks'); + var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; + var status = (showStatus ? this._get(inst, 'dayStatus') || ' ' : ''); + var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus; + var endDate = inst.endDay ? new Date(inst.endYear, inst.endMonth, inst.endDay) : currentDate; + for (var row = 0; row < numMonths[0]; row++) + for (var col = 0; col < numMonths[1]; col++) { + var selectedDate = new Date(drawYear, drawMonth, inst.selectedDay); + html += '
' + + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, + selectedDate, row > 0 || col > 0, showStatus, monthNames) + // draw month headers + '' + + '' + + (showWeeks ? '' : ''); + for (var dow = 0; dow < 7; dow++) { // days of the week + var day = (dow + firstDay) % 7; + var dayStatus = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) : + status.replace(/D/, dayNamesShort[day])); + html += '= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' + + (!changeFirstDay ? '' + + dayNamesMin[day] + (changeFirstDay ? '' : '') + ''; + } + html += ''; + var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); + if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) + inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); + var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; + var printDate = new Date(drawYear, drawMonth, 1 - leadDays); + var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate + for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows + html += '' + + (showWeeks ? '' : ''); + for (var dow = 0; dow < 7; dow++) { // create date picker days + var daySettings = (beforeShowDay ? + beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); + var otherMonth = (printDate.getMonth() != drawMonth); + var unselectable = otherMonth || !daySettings[0] || + (minDate && printDate < minDate) || (maxDate && printDate > maxDate); + html += ''; // display for this month + printDate.setUTCDate(printDate.getUTCDate() + 1); + } + html += ''; + } + drawMonth++; + if (drawMonth > 11) { + drawMonth = 0; + drawYear++; + } + html += '
' + this._get(inst, 'weekHeader') + '
' + calculateWeek(printDate) + '' + // actions + (otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months + (unselectable ? printDate.getDate() : '' + printDate.getDate() + '')) + '
'; + } + html += (showStatus ? '
' + (this._get(inst, 'initStatus') || ' ') + '
' : '') + + (!closeAtTop && !inst.inline ? controls : '') + + '
' + + ($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ? + '' : ''); + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + selectedDate, secondary, showStatus, monthNames) { + minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate); + var html = '
'; + // month selection + if (secondary || !this._get(inst, 'changeMonth')) + html += monthNames[drawMonth] + ' '; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + html += ''; + } + // year selection + if (secondary || !this._get(inst, 'changeYear')) + html += drawYear; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var year = 0; + var endYear = 0; + if (years.length != 2) { + year = drawYear - 10; + endYear = drawYear + 10; + } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') { + year = endYear = new Date().getFullYear(); + year += parseInt(years[0], 10); + endYear += parseInt(years[1], 10); + } else { + year = parseInt(years[0], 10); + endYear = parseInt(years[1], 10); + } + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + html += ''; + } + html += '
'; // Close datepicker_header + return html; + }, + + /* Provide code to set and clear the status panel. */ + _addStatus: function(inst, text) { + return ' onmouseover="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\'' + text + '\');" ' + + 'onmouseout="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\' \');"'; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = new Date(year, month, day); + // ensure it is within the bounds set + var minDate = this._getMinMaxDate(inst, 'min', true); + var maxDate = this._getMinMaxDate(inst, 'max'); + date = (minDate && date < minDate ? minDate : date); + date = (maxDate && date > maxDate ? maxDate : date); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [new Date(inst.selectedYear, inst.selectedMonth, 1), inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */ + _getMinMaxDate: function(inst, minMax, checkRange) { + var date = this._determineDate(this._get(inst, minMax + 'Date'), null); + if (date) { + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + date.setMilliseconds(0); + } + return (!checkRange || !inst.rangeStart ? date : + (!date || inst.rangeStart > date ? inst.rangeStart : date)); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - new Date(year, month, 32).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + // during range selection, use minimum of selected date and range start + var newMinDate = (!inst.rangeStart ? null : + new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)); + newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate); + var minDate = newMinDate || this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : new Date(year, month, day)) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Determine whether an object is an array. */ +function isArray(a) { + return (a && (($.browser.safari && typeof a == 'object' && a.length) || + (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance + +/* Initialise the date picker. */ +$(document).ready(function() { + $(document.body).append($.datepicker.dpDiv). + mousedown($.datepicker._checkExternalClick); +}); + +})(jQuery); diff --git a/template-common/lib/ui/ui.datepicker.packed.js b/template-common/lib/ui/ui.datepicker.packed.js new file mode 100644 index 000000000..17b720d04 --- /dev/null +++ b/template-common/lib/ui/ui.datepicker.packed.js @@ -0,0 +1,2 @@ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(n($){c 19="f";n 3A(){b.7i=F;b.44=r;b.2s=[];b.2W=F;b.2G=F;b.5w="t-f-I";b.5O="t-f-3a";b.2p="t-f-41";b.5x="t-f-9D";b.5g="t-f-3l";b.5a="t-f-3H";b.4o="t-f-4u-G";b.5Q=[];b.5Q[""]={6C:"9C",6D:"9B 4a 4u h",6A:"7m",6B:"7m 9A 6P",2A:" z;9y",6z:"4b 4a 9x C",2z:"9w v;",6y:"4b 4a 3P C",2U:"9u",6x:"4b 4a 4u C",1g:["9t","9s","9r","9q","7l","9p","9o","9n","9m","9l","9k","9j"],1P:["9i","9h","9g","9f","7l","9e","9d","9c","9b","9a","99","98"],6g:"4b a 7k C",69:"4b a 7k A",6v:"97",96:"95 94 4a A",1o:["93","92","91","90","8Z","8Y","8X"],1t:["8W","8V","8U","8T","8S","8R","8Q"],4r:["8P","8O","8N","8M","8L","8K","8J"],4s:"8I 3N 8H 8G 2y G",2S:"7j 3N, M d",2L:"4z/3o/2V",1x:0,6k:"7j a h",1D:F};b.1z={31:"2E",1K:"5H",5A:{},2C:r,49:"",2K:"...",3y:"",7g:F,3G:1i,5i:F,3Q:F,3m:F,5f:F,6h:1i,6d:1i,6c:"-10:+10",3M:1i,3g:F,2w:F,3L:F,4q:b.3O,1C:"+10",1j:F,6w:b.2S,O:r,S:r,1c:"8F",3K:r,48:r,2F:r,68:r,46:r,67:1,2m:1,1E:F,3T:" - ",3Z:"",3q:""};$.4d(b.1z,b.5Q[""]);b.J=$(\'\')}$.4d(3A.5V,{2H:"8E",5o:n(){k(b.7i){8D.5o.2b("",4T)}},8C:n(u){3D(b.1z,u||{});q b},5S:n(o,u){c 3z=r;1m(4R 61 b.1z){c 4Q=o.8B("h:"+4R);k(4Q){3z=3z||{};6J{3z[4R]=8A(4Q)}6I(8z){3z[4R]=4Q}}}c 1Y=o.1Y.5J();c 1v=(1Y=="I"||1Y=="3k");k(!o.x){o.x="78"+v z().1R()}c 8=b.5P($(o),1v);8.u=$.4d({},u||{},3z||{});k(1Y=="p"){b.7h(o,8)}N{k(1v){b.7b(o,8)}}},5P:n(o,1v){q{x:o[0].x,p:o,1s:0,1r:0,1B:0,H:0,K:0,1v:1v,J:(!1v?b.J:$(\'\'))}},7h:n(o,8){c p=$(o);k(p.42(b.2H)){q}c 49=b.l(8,"49");c 1D=b.l(8,"1D");k(49){p[1D?"7d":"7c"](\'<3k V="\'+b.5O+\'">\'+49+"")}c 31=b.l(8,"31");k(31=="2E"||31=="4k"){p.2E(b.3v)}k(31=="3x"||31=="4k"){c 2K=b.l(8,"2K");c 3y=b.l(8,"3y");c 41=$(b.l(8,"7g")?$("<4N/>").2j(b.2p).7f({56:3y,7e:2K,3J:2K}):$(\'<3x 47="3x">\').2j(b.2p).R(3y==""?2K:$("<4N/>").7f({56:3y,7e:2K,3J:2K})));p[1D?"7d":"7c"](41);41.8y(n(){k($.f.2W&&$.f.3r==o){$.f.2B()}N{$.f.3v(o)}q F})}p.2j(b.2H).5N(b.4M).75(b.5M).4P("7a.f",n(3s,2J,E){8.u[2J]=E}).4P("79.f",n(3s,2J){q b.l(8,2J)});$.1d(o,19,8)},7b:n(o,8){c p=$(o);k(p.42(b.2H)){q}p.2j(b.2H).3a(8.J).4P("7a.f",n(3s,2J,E){8.u[2J]=E}).4P("79.f",n(3s,2J){q b.l(8,2J)});$.1d(o,19,8);b.5k(8,b.5n(8));b.24(8)},8x:n(8){c 1b=b.3d(8);8.J.1M(1b[1]*$(".t-f",8.J[0]).1M())},8w:n(p,76,2F,u,2r){c 8=b.77;k(!8){c x="78"+v z().1R();b.26=$(\'

\');b.26.5N(b.4M);$("29").3a(b.26);8=b.77=b.5P(b.26,F);8.u={};$.1d(b.26[0],19,8)}3D(8.u,u||{});b.26.3n(76);b.1H=(2r?(2r.1a?2r:[2r.8v,2r.8u]):r);k(!b.1H){c 4I=4J.6T||15.1L.5F||15.29.5F;c 4H=4J.6S||15.1L.5E||15.29.5E;c 30=15.1L.3u||15.29.3u;c 2Z=15.1L.3t||15.29.3t;b.1H=[(4I/2)-2O+30,(4H/2)-8t+2Z]}b.26.25("2q",b.1H[0]+"4K").25("1X",b.1H[1]+"4K");8.u.2F=2F;b.2G=1i;b.J.2j(b.5x);b.3v(b.26[0]);k($.43){$.43(b.J)}$.1d(b.26[0],19,8);q b},8s:n(o){c 1Y=o.1Y.5J();c $o=$(o);$.8r(o,19);k(1Y=="p"){$o.3w("."+b.5O).45().3i().3w("."+b.2p).45().3i().2Q(b.2H).4E("2E",b.3v).4E("5N",b.4M).4E("75",b.5M)}N{k(1Y=="I"||1Y=="3k"){$o.2Q(b.2H).6X()}}},8q:n(o){o.4O=F;$(o).3w("3x."+b.2p).3C(n(){b.4O=F}).3i().3w("4N."+b.2p).25({74:"1.0",73:""});b.2s=$.72(b.2s,n(E){q(E==o?r:E)})},8p:n(o){o.4O=1i;$(o).3w("3x."+b.2p).3C(n(){b.4O=1i}).3i().3w("4N."+b.2p).25({74:"0.5",73:"3V"});b.2s=$.72(b.2s,n(E){q(E==o?r:E)});b.2s[b.2s.1a]=o},70:n(o){k(!o){q F}1m(c i=0;i-1)},3v:n(p){p=p.o||p;k(p.1Y.5J()!="p"){p=$("p",p.8h)[0]}k($.f.70(p)||$.f.3r==p){q}c 8=$.1d(p,19);c 48=$.f.l(8,"48");3D(8.u,(48?48.2b(p,[p,8]):{}));$.f.2B(r,"");$.f.3r=p;$.f.5q(8);k($.f.2G){p.E=""}k(!$.f.1H){$.f.1H=$.f.5C(p);$.f.1H[1]+=p.8g}c 1p=F;$(p).6Q().3C(n(){1p|=$(b).25("1W")=="6Z";q!1p});k(1p&&$.2c.5D){$.f.1H[0]-=15.1L.3u;$.f.1H[1]-=15.1L.3t}c P={2q:$.f.1H[0],1X:$.f.1H[1]};$.f.1H=r;8.1h=r;8.J.25({1W:"4F",5I:"8f",1X:"-8e"});$.f.24(8);8.J.1M($.f.3d(8)[1]*$(".t-f",8.J[0])[0].8d);P=$.f.6U(8,P,1p);8.J.25({1W:($.f.2G&&$.43?"8c":(1p?"6Z":"4F")),5I:"6Y",2q:P.2q+"4K",1X:P.1X+"4K"});k(!8.1v){c 1K=$.f.l(8,"1K")||"5H";c 1c=$.f.l(8,"1c");c 2X=n(){$.f.2W=1i;k($.2c.57&&2N($.2c.6j)<7){$("4j.t-f-55").25({1M:8.J.1M()+4,2I:8.J.2I()+4})}};k($.4G&&$.4G[1K]){8.J.5H(1K,$.f.l(8,"5A"),1c,2X)}N{8.J[1K](1c,2X)}k(1c==""){2X()}k(8.p[0].47!="5B"){8.p[0].2E()}$.f.44=8}},24:n(8){c 5G={1M:8.J.1M()+4,2I:8.J.2I()+4};8.J.6X().3a(b.6E(8)).8b("4j.t-f-55").25({1M:5G.1M,2I:5G.2I});c 1b=b.3d(8);8.J[(1b[0]!=1||1b[1]!=1?"6W":"45")+"6V"]("t-f-8a");8.J[(b.l(8,"1D")?"6W":"45")+"6V"]("t-f-89");k(8.p&&8.p[0].47!="5B"){$(8.p[0]).2E()}},6U:n(8,P,1p){c 2r=8.p?b.5C(8.p[0]):r;c 4I=4J.6T||15.1L.5F;c 4H=4J.6S||15.1L.5E;c 30=15.1L.3u||15.29.3u;c 2Z=15.1L.3t||15.29.3t;k(b.l(8,"1D")||(P.2q+8.J.1M()-30)>4I){P.2q=1Q.2t((1p?0:30),2r[0]+(8.p?8.p.1M():0)-(1p?30:0)-8.J.1M()-(1p&&$.2c.5D?15.1L.3u:0))}N{P.2q-=(1p?30:0)}k((P.1X+8.J.2I()-2Z)>4H){P.1X=1Q.2t((1p?0:2Z),2r[1]-(1p?2Z:0)-(b.2G?0:8.J.2I())-(1p&&$.2c.5D?15.1L.3t:0))}N{P.1X-=(1p?2Z:0)}q P},5C:n(2Y){3S(2Y&&(2Y.47=="5B"||2Y.88!=1)){2Y=2Y.87}c 1W=$(2Y).P();q[1W.2q,1W.1X]},2B:n(p,1c){c 8=b.44;k(!8){q}c 1E=b.l(8,"1E");k(1E&&b.2o){b.4C("#"+8.x,b.2M(8,8.1f,8.1q,8.1n))}b.2o=F;k(b.2W){1c=(1c!=r?1c:b.l(8,"1c"));c 1K=b.l(8,"1K");c 2X=n(){$.f.5y(8)};k(1c!=""&&$.4G&&$.4G[1K]){8.J.5z(1K,$.f.l(8,"5A"),1c,2X)}N{8.J[(1c==""?"5z":(1K=="86"?"85":(1K=="84"?"83":"5z")))](1c,2X)}k(1c==""){b.5y(8)}c 46=b.l(8,"46");k(46){46.2b((8.p?8.p[0]:r),[b.4w(8),8])}b.2W=F;b.3r=r;8.u.3l=r;k(b.2G){b.26.25({1W:"4F",2q:"0",1X:"-6R"});k($.43){$.82();$("29").3a(b.J)}}b.2G=F}b.44=r},5y:n(8){8.J.2Q(b.5x).4E(".t-f");$("."+b.5g,8.J).45()},5R:n(3s){k(!$.f.44){q}c $o=$(3s.o);k(($o.6Q("#"+$.f.5w).1a==0)&&!$o.42($.f.2H)&&!$o.42($.f.2p)&&$.f.2W&&!($.f.2G&&$.43)){$.f.2B(r,"")}},1U:n(x,P,20){c o=$(x);c 8=$.1d(o[0],19);b.4g(8,P,20);b.24(8)},5e:n(x){c o=$(x);c 8=$.1d(o[0],19);k(b.l(8,"5f")&&8.1f){8.1s=8.1f;8.H=8.1r=8.1q;8.K=8.1B=8.1n}N{c h=v z();8.1s=h.U();8.H=8.1r=h.16();8.K=8.1B=h.Q()}b.1U(o);b.4f(8)},53:n(x,2P,20){c o=$(x);c 8=$.1d(o[0],19);8.4D=F;8[20=="M"?"H":"K"]=2P.2a[2P.81].E-0;b.1U(o);b.4f(8)},52:n(x){c o=$(x);c 8=$.1d(o[0],19);k(8.p&&8.4D&&!$.2c.57){8.p[0].2E()}8.4D=!8.4D},6s:n(x,G){c o=$(x);c 8=$.1d(o[0],19);8.u.1x=G;b.24(8)},59:n(x,C,A,1w){k($(1w).42(b.5a)){q}c o=$(x);c 8=$.1d(o[0],19);c 1E=b.l(8,"1E");k(1E){b.2o=!b.2o;k(b.2o){$(".t-f 1w").2Q(b.4o);$(1w).2j(b.4o)}}8.1s=8.1f=$("a",1w).R();8.1r=8.1q=C;8.1B=8.1n=A;k(b.2o){8.1T=8.22=8.17=r}N{k(1E){8.1T=8.1f;8.22=8.1q;8.17=8.1n}}b.4C(x,b.2M(8,8.1f,8.1q,8.1n));k(b.2o){8.1h=v z(8.1n,8.1q,8.1f);b.24(8)}N{k(1E){8.1s=8.1f=8.1h.U();8.1r=8.1q=8.1h.16();8.1B=8.1n=8.1h.Q();8.1h=r;k(8.1v){b.24(8)}}}},5h:n(x){c o=$(x);c 8=$.1d(o[0],19);k(b.l(8,"5i")){q}b.2o=F;8.1T=8.22=8.17=8.1h=r;b.4C(o,"")},4C:n(x,1J){c o=$(x);c 8=$.1d(o[0],19);1J=(1J!=r?1J:b.2M(8));k(b.l(8,"1E")&&1J){1J=(8.1h?b.2M(8,8.1h):1J)+b.l(8,"3T")+1J}k(8.p){8.p.3n(1J)}b.6O(8);c 2F=b.l(8,"2F");k(2F){2F.2b((8.p?8.p[0]:r),[1J,8])}N{k(8.p){8.p.41("6P")}}k(8.1v){b.24(8)}N{k(!b.2o){b.2B(r,b.l(8,"1c"));b.3r=8.p[0];k(1O(8.p[0])!="4c"){8.p[0].2E()}b.3r=r}}},6O:n(8){c 3Z=b.l(8,"3Z");k(3Z){c 3q=b.l(8,"3q");c h=b.4w(8);1J=(5Z(h)?(!h[0]&&!h[1]?"":b.2d(3q,h[0],b.1Z(8))+b.l(8,"3T")+b.2d(3q,h[1]||h[0],b.1Z(8))):b.2d(3q,h,b.1Z(8)));$(3Z).3C(n(){$(b).3n(1J)})}},80:n(h){c G=h.3e();q[(G>0&&G<6),""]},3O:n(h){c 1A=v z(h.Q(),h.16(),h.U(),(h.7Z()/-60));c 3p=v z(1A.Q(),1-1,4);c 1x=3p.3e()||7;3p.4e(3p.U()+1-1x);k(1x<4&&1A<3p){1A.4e(1A.U()-3);q $.f.3O(1A)}N{k(1A>v z(1A.Q(),12-1,28)){1x=v z(1A.Q()+1,1-1,4).3e()||7;k(1x>4&&(1A.3e()||7)<1x-3){1A.4e(1A.U()+3);q $.f.3O(1A)}}}q 1Q.7Y(((1A-3p)/7X)/7)+1},2S:n(h,8){q $.f.2d($.f.l(8,"2S"),h,$.f.1Z(8))},5p:n(X,E,u){k(X==r||E==r){3W"6M 4T"}E=(1O E=="4c"?E.5X():E+"");k(E==""){q r}c 1C=(u?u.1C:r)||b.1z.1C;c 1t=(u?u.1t:r)||b.1z.1t;c 1o=(u?u.1o:r)||b.1z.1o;c 1P=(u?u.1P:r)||b.1z.1P;c 1g=(u?u.1g:r)||b.1z.1g;c A=-1;c C=-1;c G=-1;c 1F=F;c 1G=n(1l){c 1y=(T+10&&1I="0"&&E.18(1I)<="9"){4B=4B*10+(E.18(1I++)-0);23--}k(23==5v){3W"7W 4X 5u 1W "+1I}q 4B};c 5t=n(1l,4x,4y){c 3Y=(1G(1l)?4y:4x);c 23=0;1m(c j=0;j<3Y.1a;j++){23=1Q.2t(23,3Y[j].1a)}c 1e="";c 6N=1I;3S(23>0&&1I0){c u=b.1Z(8);k(2D.1a>1){h=b.5p(2L,2D[1],u)||2C;8.1T=h.U();8.22=h.16();8.17=h.Q()}6J{h=b.5p(2L,2D[0],u)||2C}6I(e){b.5o(e);h=2C}}8.1s=h.U();8.H=8.1r=h.16();8.K=8.1B=h.Q();8.1f=(2D[0]?h.U():0);8.1q=(2D[0]?h.16():0);8.1n=(2D[0]?h.Q():0);b.4g(8)},5n:n(8){c h=b.3F(b.l(8,"2C"),v z());c O=b.2e(8,"2f",1i);c S=b.2e(8,"2t");h=(O&&hS?S:h);q h},3F:n(h,2C){c 6F=n(P){c h=v z();h.6o(h.6n()+P);q h};c 6G=n(P,5m){c h=v z();c A=h.Q();c C=h.16();c G=h.U();c 5l=/([+-]?[0-9]+)\\s*(d|D|w|W|m|M|y|Y)?/g;c 1y=5l.6H(P);3S(1y){3U(1y[2]||"d"){B"d":B"D":G+=(1y[1]-0);L;B"w":B"W":G+=(1y[1]*7);L;B"m":B"M":C+=(1y[1]-0);G=1Q.2f(G,5m(A,C));L;B"y":B"Y":A+=(1y[1]-0);G=1Q.2f(G,5m(A,C));L}1y=5l.6H(P)}q v z(A,C,G)};q(h==r?2C:(1O h=="3B"?6G(h,b.3E):(1O h=="4X"?6F(h):h)))},5k:n(8,h,1S){c 2v=!(h);h=b.3F(h,v z());8.1s=8.1f=h.U();8.H=8.1r=8.1q=h.16();8.K=8.1B=8.1n=h.Q();k(b.l(8,"1E")){k(1S){1S=b.3F(1S,r);8.1T=1S.U();8.22=1S.16();8.17=1S.Q()}N{8.1T=8.1f;8.22=8.1q;8.17=8.1n}}b.4g(8);k(8.p){8.p.3n(2v?"":b.2M(8)+(!b.l(8,"1E")?"":b.l(8,"3T")+b.2M(8,8.1T,8.22,8.17)))}},4w:n(8){c 5j=(!8.1n||(8.p&&8.p.3n()=="")?r:v z(8.1n,8.1q,8.1f));k(b.l(8,"1E")){q[8.1h||5j,(!8.17?r:v z(8.17,8.22,8.1T))]}N{q 5j}},6E:n(8){c 2k=v z();2k=v z(2k.Q(),2k.16(),2k.U());c 1j=b.l(8,"1j");c 1D=b.l(8,"1D");c 2v=(b.l(8,"5i")?"":\'"+b.l(8,"6C")+"");c 58=\'\'+(1D?"":2v)+\'"+b.l(8,"6A")+""+(1D?2v:"")+"";c 3l=b.l(8,"3l");c 3G=b.l(8,"3G");c 3Q=b.l(8,"3Q");c 3m=b.l(8,"3m");c 1b=b.3d(8);c 2m=b.l(8,"2m");c 6q=(1b[0]!=1||1b[1]!=1);c 4p=(!8.1f?v z(7F,9,9):v z(8.1n,8.1q,8.1f));c O=b.2e(8,"2f",1i);c S=b.2e(8,"2t");c H=8.H;c K=8.K;k(S){c 3R=v z(S.Q(),S.16()-1b[1]+1,S.U());3R=(O&&3R3R){H--;k(H<0){H=11;K--}}}c 2A=b.l(8,"2A");2A=(!3m?2A:b.2d(2A,v z(K,H-2m,1),b.1Z(8)));c 4t=\'\'+(b.4W(8,-1,K,H)?""+2A+"":(3Q?"":"<4v>"+2A+""))+"";c 2z=b.l(8,"2z");2z=(!3m?2z:b.2d(2z,v z(K,H+2m,1),b.1Z(8)));c 3P=\'\'+(b.4W(8,+1,K,H)?""+2z+"":(3Q?"":"<4v>"+2z+""))+"";c 2U=b.l(8,"2U");2U=(!3m?2U:b.2d(2U,2k,b.1Z(8)));c R=(3l?\'\'+3l+"":"")+(3G&&!8.1v?58:"")+\'\'+(1D?3P:4t)+(b.4V(8,(b.l(8,"5f")&&8.1f?4p:2k))?\'"+2U+"":"")+(1D?4t:3P)+"";c 1x=b.l(8,"1x");c 3M=b.l(8,"3M");c 1o=b.l(8,"1o");c 1t=b.l(8,"1t");c 4r=b.l(8,"4r");c 1g=b.l(8,"1g");c 3K=b.l(8,"3K");c 3g=b.l(8,"3g");c 2w=b.l(8,"2w");c 3L=b.l(8,"3L");c 4q=b.l(8,"4q")||b.3O;c 21=(1j?b.l(8,"4s")||"u;":"");c 2S=b.l(8,"6w")||b.2S;c 1S=8.1T?v z(8.17,8.22,8.1T):4p;1m(c 2T=0;2T<1b[0];2T++){1m(c 3j=0;3j<1b[1];3j++){c 3f=v z(K,H,8.1s);R+=\'\'+b.6i(8,H,K,O,S,3f,2T>0||3j>0,1j,1g)+\'<6l V="t-f" 7C="0" 7B="0"><6r><4m V="t-f-3J-2T">\'+(3L?"<1w>"+b.l(8,"6v")+"":"");1m(c 2l=0;2l<7;2l++){c G=(2l+1x)%7;c 4s=(21.6u("3N")>-1?21.6t(/3N/,1o[G]):21.6t(/D/,1t[G]));R+="<1w"+((2l+1x+6)%7>=5?\' V="t-f-2y-3i-2R"\':"")+">"+(!3M?"<3k":"\'+4r[G]+(3M?"":"")+""}R+="<6m>";c 5c=b.3E(K,H);k(K==8.1B&&H==8.1r){8.1s=1Q.2f(8.1s,5c)}c 5d=(b.64(K,H)-1x+7)%7;c 1k=v z(K,H,1-5d);c 6p=(6q?6:1Q.7A((5d+5c)/7));1m(c 5b=0;5b<6p;5b++){R+=\'<4m V="t-f-3h-2T">\'+(3L?\'<1w V="t-f-2y-3j">\'+4q(1k)+"":"");1m(c 2l=0;2l<7;2l++){c 3I=(3K?3K.2b((8.p?8.p[0]:r),[1k]):[1i,""]);c 2i=(1k.16()!=H);c 3H=2i||!3I[0]||(O&&1kS);R+=\'<1w V="t-f-3h-2R\'+((2l+1x+6)%7>=5?" t-f-2y-3i-2R":"")+(2i?" t-f-2i":"")+(1k.1R()==3f.1R()&&H==8.1r?" t-f-3h-2R-2x":"")+(3H?" "+b.5a:"")+(2i&&!2w?"":" "+3I[1]+(1k.1R()>=4p.1R()&&1k.1R()<=1S.1R()?" "+b.4o:"")+(1k.1R()==2k.1R()?" t-f-2k":""))+\'"\'+((!2i||2w)&&3I[2]?\' 3J="\'+3I[2]+\'"\':"")+(3H?(3g?" 51=\\"Z(b).4n().2j(\'t-f-2y-2x\');\\" 4Z=\\"Z(b).4n().2Q(\'t-f-2y-2x\');\\"":""):" 51=\\"Z(b).2j(\'t-f-3h-2R-2x\')"+(3g?".4n().2j(\'t-f-2y-2x\')":"")+";"+(!1j||(2i&&!2w)?"":"Z(\'#t-f-21-"+8.x+"\').R(\'"+(2S.2b((8.p?8.p[0]:r),[1k,8])||"u;")+"\');")+"\\" 4Z=\\"Z(b).2Q(\'t-f-3h-2R-2x\')"+(3g?".4n().2Q(\'t-f-2y-2x\')":"")+";"+(!1j||(2i&&!2w)?"":"Z(\'#t-f-21-"+8.x+"\').R(\'u;\');")+\'" 2h="Z.f.59(\\\'#\'+8.x+"\',"+H+","+K+\', b);"\')+">"+(2i?(2w?1k.U():"u;"):(3H?1k.U():""+1k.U()+""))+"";1k.6o(1k.6n()+1)}R+=""}H++;k(H>11){H=0;K++}R+=""}}R+=(1j?\'\'+(b.l(8,"6k")||"u;")+"":"")+(!3G&&!8.1v?58:"")+\'\'+($.2c.57&&2N($.2c.6j)<7&&!8.1v?\'<4j 56="7z:F;" V="t-f-55">\':"");q R},6i:n(8,H,K,O,S,3f,54,1j,1g){O=(8.1h&&O&&3f\';k(54||!b.l(8,"6h")){R+=1g[H]+"u;"}N{c 6f=(O&&O.Q()==K);c 6e=(S&&S.Q()==K);R+=\'<2P V="t-f-v-C" 6a="Z.f.53(\\\'#\'+8.x+"\', b, \'M\');\\" 2h=\\"Z.f.52(\'#"+8.x+"\');\\""+(1j?b.2g(8,b.l(8,"6g")||"u;"):"")+">";1m(c C=0;C<12;C++){k((!6f||C>=O.16())&&(!6e||C<=S.16())){R+=\'<4h E="\'+C+\'"\'+(C==H?\' 4i="4i"\':"")+">"+1g[C]+""}}R+=""}k(54||!b.l(8,"6d")){R+=K}N{c 2u=b.l(8,"6c").6b(":");c A=0;c 17=0;k(2u.1a!=2){A=K-10;17=K+10}N{k(2u[0].18(0)=="+"||2u[0].18(0)=="-"){A=17=v z().Q();A+=2N(2u[0],10);17+=2N(2u[1],10)}N{A=2N(2u[0],10);17=2N(2u[1],10)}}A=(O?1Q.2t(A,O.Q()):A);17=(S?1Q.2f(17,S.Q()):17);R+=\'<2P V="t-f-v-A" 6a="Z.f.53(\\\'#\'+8.x+"\', b, \'Y\');\\" 2h=\\"Z.f.52(\'#"+8.x+"\');\\""+(1j?b.2g(8,b.l(8,"69")||"u;"):"")+">";1m(;A<=17;A++){R+=\'<4h E="\'+A+\'"\'+(A==K?\' 4i="4i"\':"")+">"+A+""}R+=""}R+="";q R},2g:n(8,50){q" 51=\\"Z(\'#t-f-21-"+8.x+"\').R(\'"+50+"\');\\" 4Z=\\"Z(\'#t-f-21-"+8.x+"\').R(\'u;\');\\""},4g:n(8,P,20){c A=8.K+(20=="Y"?P:0);c C=8.H+(20=="M"?P:0);c G=1Q.2f(8.1s,b.3E(A,C))+(20=="D"?P:0);c h=v z(A,C,G);c O=b.2e(8,"2f",1i);c S=b.2e(8,"2t");h=(O&&hS?S:h);8.1s=h.U();8.H=8.1r=h.16();8.K=8.1B=h.Q();k(20=="M"||20=="Y"){b.4f(8)}},4f:n(8){c 4Y=b.l(8,"68");k(4Y){4Y.2b((8.p?8.p[0]:r),[v z(8.1B,8.1r,1),8])}},3d:n(8){c 1b=b.l(8,"67");q(1b==r?[1,1]:(1O 1b=="4X"?[1,1b]:1b))},2e:n(8,66,65){c h=b.3F(b.l(8,66+"z"),r);k(h){h.7x(0);h.7w(0);h.7v(0);h.7u(0)}q(!65||!8.1h?h:(!h||8.1h>h?8.1h:h))},3E:n(A,C){q 32-v z(A,C,32).U()},64:n(A,C){q v z(A,C,1).3e()},4W:n(8,P,63,62){c 1b=b.3d(8);c h=v z(63,62+(P<0?P:1b[1]),1);k(P<0){h.4e(b.3E(h.Q(),h.16()))}q b.4V(8,h)},4V:n(8,h){c 3c=(!8.1h?r:v z(8.1B,8.1r,8.1s));3c=(3c&&8.1h<3c?8.1h:3c);c O=3c||b.2e(8,"2f");c S=b.2e(8,"2t");q((!O||h>=O)&&(!S||h<=S))},1Z:n(8){c 1C=b.l(8,"1C");1C=(1O 1C!="3B"?1C:v z().Q()%2O+2N(1C,10));q{1C:1C,1t:b.l(8,"1t"),1o:b.l(8,"1o"),1P:b.l(8,"1P"),1g:b.l(8,"1g")}},2M:n(8,G,C,A){k(!G){8.1f=8.1s;8.1q=8.1r;8.1n=8.1B}c h=(G?(1O G=="4c"?G:v z(A,C,G)):v z(8.1n,8.1q,8.1f));q b.2d(b.l(8,"2L"),h,b.1Z(8))}});n 3D(o,3b){$.4d(o,3b);1m(c 1e 61 3b){k(3b[1e]==r||3b[1e]==4U){o[1e]=3b[1e]}}q o}n 5Z(a){q(a&&(($.2c.7t&&1O a=="4c"&&a.1a)||(a.5Y&&a.5Y.5X().1l(/\\5W\\(\\)/))))}$.7s.f=n(2a){c 4S=5W.5V.7r.7q(4T,1);k(1O 2a=="3B"&&(2a=="7p"||2a=="U")){q $.f["5U"+2a+"3A"].2b($.f,[b[0]].5T(4S))}q b.3C(n(){1O 2a=="3B"?$.f["5U"+2a+"3A"].2b($.f,[b].5T(4S)):$.f.5S(b,2a)})};$.f=v 3A();$(15).7o(n(){$(15.29).3a($.f.J).7n($.f.5R)})})(Z)',62,598,'||||||||inst|||this|var|||datepicker||date|||if|_get||function|target|input|return|null||ui|settings|new||id||Date|year|case|month||value|false|day|drawMonth|div|dpDiv|drawYear|break||else|minDate|offset|getFullYear|html|maxDate|iFormat|getDate|class||format||jQuery||||||document|getMonth|endYear|charAt|PROP_NAME|length|numMonths|duration|data|name|currentDay|monthNames|rangeStart|true|showStatus|printDate|match|for|currentYear|dayNames|isFixed|currentMonth|selectedMonth|selectedDay|dayNamesShort|xa0|inline|td|firstDay|matches|_defaults|checkDate|selectedYear|shortYearCutoff|isRTL|rangeSelect|literal|lookAhead|_pos|iValue|dateStr|showAnim|documentElement|width|ctrlKey|typeof|monthNamesShort|Math|getTime|endDate|endDay|_adjustDate|output|position|top|nodeName|_getFormatConfig|period|status|endMonth|size|_updateDatepicker|css|_dialogInput|||body|options|apply|browser|formatDate|_getMinMaxDate|min|_addStatus|onclick|otherMonth|addClass|today|dow|stepMonths|chars|_stayOpen|_triggerClass|left|pos|_disabledInputs|max|years|clear|showOtherMonths|over|week|nextText|prevText|_hideDatepicker|defaultDate|dates|focus|onSelect|_inDialog|markerClassName|height|key|buttonText|dateFormat|_formatDate|parseInt|100|select|removeClass|cell|dateStatus|row|currentText|yy|_datepickerShowing|postProcess|obj|scrollY|scrollX|showOn|||||||||append|props|newMinDate|_getNumberOfMonths|getDay|selectedDate|highlightWeek|days|end|col|span|prompt|navigationAsDateFormat|val|dd|firstMon|altFormat|_lastInput|event|scrollTop|scrollLeft|_showDatepicker|siblings|button|buttonImage|inlineSettings|Datepicker|string|each|extendRemove|_getDaysInMonth|_determineDate|closeAtTop|unselectable|daySettings|title|beforeShowDay|showWeeks|changeFirstDay|DD|iso8601Week|next|hideIfNoPrevNext|maxDraw|while|rangeSeparator|switch|default|throw|getNumber|names|altField||trigger|hasClass|blockUI|_curInst|remove|onClose|type|beforeShow|appendText|the|Show|object|extend|setDate|_notifyChange|_adjustInstDate|option|selected|iframe|both|style|tr|parent|_currentClass|currentDate|calculateWeek|dayNamesMin|dayStatus|prev|current|label|_getDate|shortNames|longNames|mm|checkLiteral|num|_selectDate|_selectingMonthYear|unbind|absolute|effects|browserHeight|browserWidth|window|px|handled|_doKeyDown|img|disabled|bind|attrValue|attrName|otherArgs|arguments|undefined|_isInRange|_canAdjustMonth|number|onChange|onmouseout|text|onmouseover|_clickMonthYear|_selectMonthYear|secondary|cover|src|msie|controls|_selectDay|_unselectableClass|dRow|daysInMonth|leadDays|_gotoToday|gotoCurrent|_promptClass|_clearDate|mandatory|startDate|_setDate|pattern|getDaysInMonth|_getDefaultDate|log|parseDate|_setDateFromField|formatName|formatNumber|getName|at|origSize|_mainDivId|_dialogClass|_tidyDialog|hide|showOptions|hidden|_findPos|opera|clientHeight|clientWidth|dims|show|display|toLowerCase|chr|keyCode|_doKeyPress|keydown|_appendClass|_newInst|regional|_checkExternalClick|_attachDatepicker|concat|_|prototype|Array|toString|constructor|isArray||in|curMonth|curYear|_getFirstDayOfMonth|checkRange|minMax|numberOfMonths|onChangeMonthYear|yearStatus|onchange|split|yearRange|changeYear|inMaxYear|inMinYear|monthStatus|changeMonth|_generateMonthYearHeader|version|initStatus|table|tbody|getUTCDate|setUTCDate|numRows|isMultiMonth|thead|_changeFirstDay|replace|indexOf|weekHeader|statusForDate|currentStatus|nextStatus|prevStatus|closeText|closeStatus|clearText|clearStatus|_generateDatepicker|offsetNumeric|offsetString|exec|catch|try|_possibleChars|getYear|Invalid|iInit|_updateAlternate|change|parents|100px|innerHeight|innerWidth|_checkOffset|Class|add|empty|none|fixed|_isDisabledDatepicker|charCode|map|cursor|opacity|keypress|dateText|_dialogInst|dp|getData|setData|_inlineDatepicker|after|before|alt|attr|buttonImageOnly|_connectDatepicker|debug|Select|different|May|Close|mousedown|ready|isDisabled|call|slice|fn|safari|setMilliseconds|setSeconds|setMinutes|setHours|header|javascript|ceil|cellspacing|cellpadding|one|links|9999|close|control|0123456789|W3C|TIMESTAMP|RSS|RFC_2822|RFC_1123|RFC_1036|RFC_850|RFC_822|ISO_8601|COOKIE|ATOM|Unexpected|Unknown|Missing|86400000|floor|getTimezoneOffset|noWeekends|selectedIndex|unblockUI|fadeOut|fadeIn|slideUp|slideDown|nextSibling|nodeType|rtl|multi|find|static|offsetWidth|1000px|block|offsetHeight|parentNode|fromCharCode|String|stopPropagation|preventDefault|_getDateDatepicker|_setDateDatepicker|_changeDatepicker|_disableDatepicker|_enableDatepicker|removeData|_destroyDatepicker|150|pageY|pageX|_dialogDatepicker|_inlineShow|click|err|eval|getAttribute|setDefaults|console|hasDatepicker|normal|first|as|Set|Sa|Fr|Th|We|Tu|Mo|Su|Sat|Fri|Thu|Wed|Tue|Mon|Sun|Saturday|Friday|Thursday|Wednesday|Tuesday|Monday|Sunday|of|Week|weekStatus|Wk|Dec|Nov|Oct|Sep|Aug|Jul|Jun|Apr|Mar|Feb|Jan|December|November|October|September|August|July|June|April|March|February|January|Today|x3e|Next|previous|Prev|x3c|without|Erase|Clear|dialog'.split('|'),0,{})) + diff --git a/template-common/lib/ui/ui.dialog.js b/template-common/lib/ui/ui.dialog.js new file mode 100644 index 000000000..858e9e28b --- /dev/null +++ b/template-common/lib/ui/ui.dialog.js @@ -0,0 +1,497 @@ +/* + * jQuery UI Dialog + * + * Copyright (c) 2008 Richard D. Worth (rdworth.org) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ +(function($) { + +var setDataSwitch = { + dragStart: "start.draggable", + drag: "drag.draggable", + dragStop: "stop.draggable", + maxHeight: "maxHeight.resizable", + minHeight: "minHeight.resizable", + maxWidth: "maxWidth.resizable", + minWidth: "minWidth.resizable", + resizeStart: "start.resizable", + resize: "drag.resizable", + resizeStop: "stop.resizable" +}; + +$.widget("ui.dialog", { + init: function() { + var self = this, + options = this.options, + resizeHandles = typeof options.resizable == 'string' + ? options.resizable + : 'n,e,s,w,se,sw,ne,nw', + + uiDialogContent = this.element + .addClass('ui-dialog-content') + .wrap('

') + .wrap('
'), + + uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent() + .addClass('ui-dialog-container') + .css({position: 'relative', width: '100%', height: '100%'})), + + title = options.title || uiDialogContent.attr('title') || '', + uiDialogTitlebar = (this.uiDialogTitlebar = + $('
')) + .append('' + title + '') + .append('X') + .prependTo(uiDialogContainer), + + uiDialog = (this.uiDialog = uiDialogContainer.parent()) + .appendTo(document.body) + .hide() + .addClass('ui-dialog') + .addClass(options.dialogClass) + // add content classes to dialog + // to inherit theme at top level of element + .addClass(uiDialogContent.attr('className')) + .removeClass('ui-dialog-content') + .css({ + position: 'absolute', + width: options.width, + height: options.height, + overflow: 'hidden', + zIndex: options.zIndex + }) + // setting tabIndex makes the div focusable + // setting outline to 0 prevents a border on focus in Mozilla + .attr('tabIndex', -1).css('outline', 0).keydown(function(ev) { + if (options.closeOnEscape) { + var ESC = 27; + (ev.keyCode && ev.keyCode == ESC && self.close()); + } + }) + .mousedown(function() { + self.moveToTop(); + }), + + uiDialogButtonPane = (this.uiDialogButtonPane = $('
')) + .addClass('ui-dialog-buttonpane').css({ position: 'absolute', bottom: 0 }) + .appendTo(uiDialog); + + this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar) + .hover( + function() { + $(this).addClass('ui-dialog-titlebar-close-hover'); + }, + function() { + $(this).removeClass('ui-dialog-titlebar-close-hover'); + } + ) + .mousedown(function(ev) { + ev.stopPropagation(); + }) + .click(function() { + self.close(); + return false; + }); + + this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function() { + $.ui.disableSelection(this); + }); + + if ($.fn.draggable) { + uiDialog.draggable({ + cancel: '.ui-dialog-content', + helper: options.dragHelper, + handle: '.ui-dialog-titlebar', + start: function(e, ui) { + self.moveToTop(); + (options.dragStart && options.dragStart.apply(self.element[0], arguments)); + }, + drag: function(e, ui) { + (options.drag && options.drag.apply(self.element[0], arguments)); + }, + stop: function(e, ui) { + (options.dragStop && options.dragStop.apply(self.element[0], arguments)); + $.ui.dialog.overlay.resize(); + } + }); + (options.draggable || uiDialog.draggable('disable')); + } + + if ($.fn.resizable) { + uiDialog.resizable({ + cancel: '.ui-dialog-content', + helper: options.resizeHelper, + maxWidth: options.maxWidth, + maxHeight: options.maxHeight, + minWidth: options.minWidth, + minHeight: options.minHeight, + start: function() { + (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); + }, + resize: function(e, ui) { + (options.autoResize && self.size.apply(self)); + (options.resize && options.resize.apply(self.element[0], arguments)); + }, + handles: resizeHandles, + stop: function(e, ui) { + (options.autoResize && self.size.apply(self)); + (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); + $.ui.dialog.overlay.resize(); + } + }); + (options.resizable || uiDialog.resizable('disable')); + } + + this.createButtons(options.buttons); + this.isOpen = false; + + (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); + (options.autoOpen && this.open()); + }, + + setData: function(key, value){ + (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); + switch (key) { + case "buttons": + this.createButtons(value); + break; + case "draggable": + this.uiDialog.draggable(value ? 'enable' : 'disable'); + break; + case "height": + this.uiDialog.height(value); + break; + case "position": + this.position(value); + break; + case "resizable": + (typeof value == 'string' && this.uiDialog.data('handles.resizable', value)); + this.uiDialog.resizable(value ? 'enable' : 'disable'); + break; + case "title": + $(".ui-dialog-title", this.uiDialogTitlebar).text(value); + break; + case "width": + this.uiDialog.width(value); + break; + } + + $.widget.prototype.setData.apply(this, arguments); + }, + + position: function(pos) { + var wnd = $(window), doc = $(document), + pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), + minTop = pTop; + + if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { + pos = [ + pos == 'right' || pos == 'left' ? pos : 'center', + pos == 'top' || pos == 'bottom' ? pos : 'middle' + ]; + } + if (pos.constructor != Array) { + pos = ['center', 'middle']; + } + if (pos[0].constructor == Number) { + pLeft += pos[0]; + } else { + switch (pos[0]) { + case 'left': + pLeft += 0; + break; + case 'right': + pLeft += wnd.width() - this.uiDialog.width(); + break; + default: + case 'center': + pLeft += (wnd.width() - this.uiDialog.width()) / 2; + } + } + if (pos[1].constructor == Number) { + pTop += pos[1]; + } else { + switch (pos[1]) { + case 'top': + pTop += 0; + break; + case 'bottom': + pTop += wnd.height() - this.uiDialog.height(); + break; + default: + case 'middle': + pTop += (wnd.height() - this.uiDialog.height()) / 2; + } + } + + // prevent the dialog from being too high (make sure the titlebar + // is accessible) + pTop = Math.max(pTop, minTop); + this.uiDialog.css({top: pTop, left: pLeft}); + }, + + size: function() { + var container = this.uiDialogContainer, + titlebar = this.uiDialogTitlebar, + content = this.element, + tbMargin = parseInt(content.css('margin-top'),10) + parseInt(content.css('margin-bottom'),10), + lrMargin = parseInt(content.css('margin-left'),10) + parseInt(content.css('margin-right'),10); + content.height(container.height() - titlebar.outerHeight() - tbMargin); + content.width(container.width() - lrMargin); + }, + + open: function() { + if (this.isOpen) { return; } + + this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null; + (this.uiDialog.next().length > 0) && this.uiDialog.appendTo('body'); + this.position(this.options.position); + this.uiDialog.show(this.options.show); + this.options.autoResize && this.size(); + this.moveToTop(true); + + // CALLBACK: open + var openEV = null; + var openUI = { + options: this.options + }; + this.uiDialogTitlebarClose.focus(); + this.element.triggerHandler("dialogopen", [openEV, openUI], this.options.open); + + this.isOpen = true; + }, + + // the force parameter allows us to move modal dialogs to their correct + // position on open + moveToTop: function(force) { + if ((this.options.modal && !force) + || (!this.options.stack && !this.options.modal)) { return this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); } + + var maxZ = this.options.zIndex, options = this.options; + $('.ui-dialog:visible').each(function() { + maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); + }); + (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); + this.uiDialog.css('z-index', ++maxZ); + + this.element.triggerHandler("dialogfocus", [null, { options: this.options }], this.options.focus); + }, + + close: function() { + (this.overlay && this.overlay.destroy()); + this.uiDialog.hide(this.options.hide); + + // CALLBACK: close + var closeEV = null; + var closeUI = { + options: this.options + }; + this.element.triggerHandler("dialogclose", [closeEV, closeUI], this.options.close); + $.ui.dialog.overlay.resize(); + + this.isOpen = false; + }, + + destroy: function() { + (this.overlay && this.overlay.destroy()); + this.uiDialog.hide(); + this.element + .unbind('.dialog') + .removeData('dialog') + .removeClass('ui-dialog-content') + .hide().appendTo('body'); + this.uiDialog.remove(); + }, + + createButtons: function(buttons) { + var self = this, + hasButtons = false, + uiDialogButtonPane = this.uiDialogButtonPane; + + // remove any existing buttons + uiDialogButtonPane.empty().hide(); + + $.each(buttons, function() { return !(hasButtons = true); }); + if (hasButtons) { + uiDialogButtonPane.show(); + $.each(buttons, function(name, fn) { + $('