aboutsummaryrefslogtreecommitdiffstats
path: root/template-common
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2008-09-25 15:10:39 +0000
committerpatdenice <patdenice@piwigo.org>2008-09-25 15:10:39 +0000
commitfd0b26af453fedf4528eaf4114914a6e5b7bc685 (patch)
treedf6baa48ee5512e6b96f7a4f1184db8ab91e131e /template-common
parenta3dc10babc0609f2a097bca76da1de8b2d92ace6 (diff)
- 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
Diffstat (limited to 'template-common')
-rw-r--r--template-common/lib/plugins/jquery.cluetip.js543
-rw-r--r--template-common/lib/plugins/jquery.cluetip.packed.js1
-rw-r--r--template-common/lib/plugins/jquery.dimensions.js119
-rw-r--r--template-common/lib/plugins/jquery.dimensions.packed.js1
-rw-r--r--template-common/lib/ui/ui.accordion.js9
-rw-r--r--template-common/lib/ui/ui.accordion.packed.js2
-rw-r--r--template-common/lib/ui/ui.core.js33
-rw-r--r--template-common/lib/ui/ui.core.packed.js2
-rw-r--r--template-common/lib/ui/ui.datepicker.js1533
-rw-r--r--template-common/lib/ui/ui.datepicker.packed.js2
-rw-r--r--template-common/lib/ui/ui.dialog.js497
-rw-r--r--template-common/lib/ui/ui.dialog.packed.js2
-rw-r--r--template-common/lib/ui/ui.draggable.js562
-rw-r--r--template-common/lib/ui/ui.draggable.packed.js2
-rw-r--r--template-common/lib/ui/ui.droppable.js281
-rw-r--r--template-common/lib/ui/ui.droppable.packed.js2
-rw-r--r--template-common/lib/ui/ui.resizable.js770
-rw-r--r--template-common/lib/ui/ui.resizable.packed.js2
-rw-r--r--template-common/lib/ui/ui.selectable.js264
-rw-r--r--template-common/lib/ui/ui.selectable.packed.js2
-rw-r--r--template-common/lib/ui/ui.slider.js440
-rw-r--r--template-common/lib/ui/ui.slider.packed.js2
-rw-r--r--template-common/lib/ui/ui.tabs.js599
-rw-r--r--template-common/lib/ui/ui.tabs.packed.js2
24 files changed, 5639 insertions, 33 deletions
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: '<img src="cross.png" alt="close" />',
+ * truncate: 60,
+ * ajaxSettings: {
+ * type: 'POST'
+ * }
+ * });
+ * @desc Displays a clueTip on mouseover of all <a> 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 = $('<div id="cluetip-inner"></div>');
+ $cluetipTitle = $('<h3 id="cluetip-title"></h3>');
+ $cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
+ $cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex})
+ .append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
+ $('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
+ .insertBefore('#cluetip').hide();
+ $cluetip.css({position: 'absolute', zIndex: cluezIndex});
+ $cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
+ $cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').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($('<div></div>').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('<div class="split-body">' + tipParts[i] + '</div>');
+ }
+ };
+ 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('<i>sorry, the contents could not be loaded</i>');
+ }
+ };
+ 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('<div></div>').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('&nbsp;') : $cluetipTitle.hide();
+ if (opts.sticky) {
+ var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
+ (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(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/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=$('<div id="cluetip-inner"></div>');$cluetipTitle=$('<h3 id="cluetip-title"></h3>');$cluetipOuter=$('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);$cluetip=$('<div id="cluetip"></div>').css({zIndex:opts.cluezIndex}).append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();$('<div id="cluetip-waitimage"></div>').css({position:'absolute',zIndex:cluezIndex-1}).insertBefore('#cluetip').hide();$cluetip.css({position:'absolute',zIndex:cluezIndex});$cluetipOuter.css({position:'relative',zIndex:cluezIndex+1});$cluetipArrows=$('<div id="cluetip-arrows" class="cluetip-arrows"></div>').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($('<div></div>').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<tpl;i++){if(i==0){$cluetipInner.html(tipParts[i])}else{$cluetipInner.append('<div class="split-body">'+tipParts[i]+'</div>')}};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('<i>sorry, the contents could not be loaded</i>')}};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('<div></div>').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('&nbsp;'):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('<div id="cluetip-close"><a href="#">'+opts.closeText+'</a></div>');(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((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){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()}$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(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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<H.1k;G++){6(D.c[H[G][0]]){H[G][1].N(D.b,E)}}}},t:{},f:4(D){6(C.d.t[D]){5 C.d.t[D]}7 E=C(\'<2y 2x="d-2w">\').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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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<H.1e;G++){5(D.a[H[G][0]]){H[G][1].v(D.c,E)}}}},p:{},d:3(D){5(C.8.p[D]){4 C.8.p[D]}6 E=C(\'<2o 2n="8-2m">\').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: '&#x3c;Prev', // Display text for previous month link
+ prevStatus: 'Show the previous month', // Status text for previous month link
+ nextText: 'Next&#x3e;', // 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 = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
+}
+
+$.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
+ $('<div class="ui-datepicker-inline"></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']('<span class="' + this._appendClass + '">' + appendText + '</span>');
+ 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') ?
+ $('<img/>').addClass(this._triggerClass).
+ attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+ $('<button type="button"></button>').addClass(this._triggerClass).
+ html(buttonImage == '' ? buttonText : $('<img/>').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 = $('<input type="text" id="' + id +
+ '" size="1" style="position: absolute; top: -100px;"/>');
+ 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') ? '' :
+ '<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#' + inst.id + '\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'clearStatus') || '&#xa0;') : '') + '>' +
+ this._get(inst, 'clearText') + '</a></div>');
+ var controls = '<div class="ui-datepicker-control">' + (isRTL ? '' : clear) +
+ '<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'closeStatus') || '&#xa0;') : '') + '>' +
+ this._get(inst, 'closeText') + '</a></div>' + (isRTL ? clear : '') + '</div>';
+ 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 = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+ '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'prevStatus') || '&#xa0;') : '') + '>' + prevText + '</a>' :
+ (hideIfNoPrevNext ? '' : '<label>' + prevText + '</label>')) + '</div>';
+ var nextText = this._get(inst, 'nextText');
+ nextText = (!navigationAsDateFormat ? nextText : this.formatDate(
+ nextText, new Date(drawYear, drawMonth + stepMonths, 1), this._getFormatConfig(inst)));
+ var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+ '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'nextStatus') || '&#xa0;') : '') + '>' + nextText + '</a>' :
+ (hideIfNoPrevNext ? '' : '<label>' + nextText + '</label>')) + '</div>';
+ var currentText = this._get(inst, 'currentText');
+ currentText = (!navigationAsDateFormat ? currentText: this.formatDate(
+ currentText, today, this._getFormatConfig(inst)));
+ var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') +
+ (closeAtTop && !inst.inline ? controls : '') +
+ '<div class="ui-datepicker-links">' + (isRTL ? next : prev) +
+ (this._isInRange(inst, (this._get(inst, 'gotoCurrent') && inst.currentDay ?
+ currentDate : today)) ? '<div class="ui-datepicker-current">' +
+ '<a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'currentStatus') || '&#xa0;') : '') + '>' +
+ currentText + '</a></div>' : '') + (isRTL ? prev : next) + '</div>';
+ 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') || '&#xa0;' : '');
+ 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 += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' +
+ this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+ selectedDate, row > 0 || col > 0, showStatus, monthNames) + // draw month headers
+ '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' +
+ '<tr class="ui-datepicker-title-row">' +
+ (showWeeks ? '<td>' + this._get(inst, 'weekHeader') + '</td>' : '');
+ 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 += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
+ (!changeFirstDay ? '<span' :
+ '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') +
+ (showStatus ? this._addStatus(inst, dayStatus) : '') + ' title="' + dayNames[day] + '">' +
+ dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
+ }
+ html += '</tr></thead><tbody>';
+ 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 += '<tr class="ui-datepicker-days-row">' +
+ (showWeeks ? '<td class="ui-datepicker-week-col">' + calculateWeek(printDate) + '</td>' : '');
+ 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 += '<td class="ui-datepicker-days-cell' +
+ ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends
+ (otherMonth ? ' ui-datepicker-otherMonth' : '') + // highlight days from other months
+ (printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ?
+ ' ui-datepicker-days-cell-over' : '') + // highlight selected day
+ (unselectable ? ' ' + this._unselectableClass : '') + // highlight unselectable days
+ (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+ (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
+ ' ' + this._currentClass : '') + // highlight selected day
+ (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+ (unselectable ? (highlightWeek ? ' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"' + // highlight selection week
+ ' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"' : '') : // unhighlight selection week
+ ' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')' + // highlight selection
+ (highlightWeek ? '.parent().addClass(\'ui-datepicker-week-over\')' : '') + ';' + // highlight selection week
+ (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
+ inst.id + '\').html(\'' + (dateStatus.apply((inst.input ? inst.input[0] : null),
+ [printDate, inst]) || '&#xa0;') +'\');') + '"' +
+ ' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')' + // unhighlight selection
+ (highlightWeek ? '.parent().removeClass(\'ui-datepicker-week-over\')' : '') + ';' + // unhighlight selection week
+ (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
+ inst.id + '\').html(\'&#xa0;\');') + '" onclick="jQuery.datepicker._selectDay(\'#' +
+ inst.id + '\',' + drawMonth + ',' + drawYear + ', this);"') + '>' + // actions
+ (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
+ (unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
+ printDate.setUTCDate(printDate.getUTCDate() + 1);
+ }
+ html += '</tr>';
+ }
+ drawMonth++;
+ if (drawMonth > 11) {
+ drawMonth = 0;
+ drawYear++;
+ }
+ html += '</tbody></table></div>';
+ }
+ html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id +
+ '" class="ui-datepicker-status">' + (this._get(inst, 'initStatus') || '&#xa0;') + '</div>' : '') +
+ (!closeAtTop && !inst.inline ? controls : '') +
+ '<div style="clear: both;"></div>' +
+ ($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ?
+ '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
+ 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 = '<div class="ui-datepicker-header">';
+ // month selection
+ if (secondary || !this._get(inst, 'changeMonth'))
+ html += monthNames[drawMonth] + '&#xa0;';
+ else {
+ var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+ var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+ html += '<select class="ui-datepicker-new-month" ' +
+ 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
+ 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'monthStatus') || '&#xa0;') : '') + '>';
+ for (var month = 0; month < 12; month++) {
+ if ((!inMinYear || month >= minDate.getMonth()) &&
+ (!inMaxYear || month <= maxDate.getMonth()))
+ html += '<option value="' + month + '"' +
+ (month == drawMonth ? ' selected="selected"' : '') +
+ '>' + monthNames[month] + '</option>';
+ }
+ html += '</select>';
+ }
+ // 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 += '<select class="ui-datepicker-new-year" ' +
+ 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
+ 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
+ (showStatus ? this._addStatus(inst, this._get(inst, 'yearStatus') || '&#xa0;') : '') + '>';
+ for (; year <= endYear; year++) {
+ html += '<option value="' + year + '"' +
+ (year == drawYear ? ' selected="selected"' : '') +
+ '>' + year + '</option>';
+ }
+ html += '</select>';
+ }
+ html += '</div>'; // 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(\'&#xa0;\');"';
+ },
+
+ /* 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(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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:"&#9z;9y",6z:"4b 4a 9x C",2z:"9w&#9v;",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=$(\'<I x="\'+b.5w+\'" 4l="5I: 6Y;"></I>\')}$.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:$(\'<I V="t-f-1v"></I>\'))}},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+"</3k>")}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"></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=$(\'<p 47="50" x="\'+x+\'" 23="1" 4l="1W: 4F; 1X: -6R;"/>\');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<b.2s.1a;i++){k(b.2s[i]==o){q 1i}}q F},8o:n(o,1e,E){c u=1e||{};k(1O 1e=="3B"){u={};u[1e]=E}k(8=$.1d(o,19)){3D(8.u,u);b.24(8)}},8n:n(o,h,1S){c 8=$.1d(o,19);k(8){b.5k(8,h,1S);b.24(8)}},8m:n(o){c 8=$.1d(o,19);k(8){b.5q(8)}q(8?b.4w(8):r)},4M:n(e){c 8=$.1d(e.o,19);c 4L=1i;k($.f.2W){3U(e.5L){B 9:$.f.2B(r,"");L;B 13:$.f.59(e.o,8.1r,8.1B,$("1w.t-f-3h-2R-2x",8.J)[0]);q F;L;B 27:$.f.2B(r,$.f.l(8,"1c"));L;B 33:$.f.1U(e.o,(e.1N?-1:-$.f.l(8,"2m")),(e.1N?"Y":"M"));L;B 34:$.f.1U(e.o,(e.1N?+1:+$.f.l(8,"2m")),(e.1N?"Y":"M"));L;B 35:k(e.1N){$.f.5h(e.o)}L;B 36:k(e.1N){$.f.5e(e.o)}L;B 37:k(e.1N){$.f.1U(e.o,-1,"D")}L;B 38:k(e.1N){$.f.1U(e.o,-7,"D")}L;B 39:k(e.1N){$.f.1U(e.o,+1,"D")}L;B 40:k(e.1N){$.f.1U(e.o,+7,"D")}L;3V:4L=F}}N{k(e.5L==36&&e.1N){$.f.3v(b)}N{4L=F}}k(4L){e.8l();e.8k()}},5M:n(e){c 8=$.1d(e.o,19);c 2n=$.f.6K($.f.l(8,"2L"));c 5K=8j.8i(e.71==4U?e.5L:e.71);q e.1N||(5K<" "||!2n||2n.6u(5K)>-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+1<X.1a&&X.18(T+1)==1l);k(1y){T++}q 1y};c 3X=n(1l){1G(1l);c 5v=(1l=="@"?14:(1l=="y"?4:2));c 23=5v;c 4B=0;3S(23>0&&1I<E.1a&&E.18(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&&1I<E.1a){1e+=E.18(1I++);1m(c i=0;i<3Y.1a;i++){k(1e==3Y[i]){q i+1}}23--}3W"7V 1e 5u 1W "+6N};c 4A=n(){k(E.18(1I)!=X.18(T)){3W"7U 1F 5u 1W "+1I}1I++};c 1I=0;1m(c T=0;T<X.1a;T++){k(1F){k(X.18(T)=="\'"&&!1G("\'")){1F=F}N{4A()}}N{3U(X.18(T)){B"d":G=3X("d");L;B"D":5t("D",1t,1o);L;B"m":C=3X("m");L;B"M":C=5t("M",1P,1g);L;B"y":A=3X("y");L;B"@":c h=v z(3X("@"));A=h.Q();C=h.16()+1;G=h.U();L;B"\'":k(1G("\'")){4A()}N{1F=1i}L;3V:4A()}}}k(A<2O){A+=v z().Q()-v z().Q()%2O+(A<=1C?0:-2O)}c h=v z(A,C-1,G);k(h.Q()!=A||h.16()+1!=C||h.U()!=G){3W"6M h"}q h},7T:"2V-4z-3o",7S:"D, 3o M 2V",7R:"2V-4z-3o",7Q:"D, d M y",7P:"3N, 3o-M-y",7O:"D, d M y",7N:"D, d M 2V",7M:"D, d M 2V",7L:"D, d M y",7K:"@",7J:"2V-4z-3o",2d:n(X,h,u){k(!h){q""}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 1G=n(1l){c 1y=(T+1<X.1a&&X.18(T+1)==1l);k(1y){T++}q 1y};c 5s=n(1l,E){q(1G(1l)&&E<10?"0":"")+E};c 5r=n(1l,E,4x,4y){q(1G(1l)?4y[E]:4x[E])};c 1V="";c 1F=F;k(h){1m(c T=0;T<X.1a;T++){k(1F){k(X.18(T)=="\'"&&!1G("\'")){1F=F}N{1V+=X.18(T)}}N{3U(X.18(T)){B"d":1V+=5s("d",h.U());L;B"D":1V+=5r("D",h.3e(),1t,1o);L;B"m":1V+=5s("m",h.16()+1);L;B"M":1V+=5r("M",h.16(),1P,1g);L;B"y":1V+=(1G("y")?h.Q():(h.6L()%2O<10?"0":"")+h.6L()%2O);L;B"@":1V+=h.1R();L;B"\'":k(1G("\'")){1V+="\'"}N{1F=1i}L;3V:1V+=X.18(T)}}}}q 1V},6K:n(X){c 2n="";c 1F=F;1m(c T=0;T<X.1a;T++){k(1F){k(X.18(T)=="\'"&&!1G("\'")){1F=F}N{2n+=X.18(T)}}N{3U(X.18(T)){B"d":B"m":B"y":B"@":2n+="7I";L;B"D":B"M":q r;B"\'":k(1G("\'")){2n+="\'"}N{1F=1i}L;3V:2n+=X.18(T)}}}q 2n},l:n(8,1e){q 8.u[1e]!==4U?8.u[1e]:b.1z[1e]},5q:n(8){c 2L=b.l(8,"2L");c 2D=8.p?8.p.3n().6b(b.l(8,"3T")):r;8.1T=8.22=8.17=r;c h=2C=b.5n(8);k(2D.1a>0){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&&h<O?O:h);h=(S&&h>S?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")?"":\'<I V="t-f-2v"><a 2h="Z.f.5h(\\\'#\'+8.x+"\');\\""+(1j?b.2g(8,b.l(8,"6D")||"&#1u;"):"")+">"+b.l(8,"6C")+"</a></I>");c 58=\'<I V="t-f-7H">\'+(1D?"":2v)+\'<I V="t-f-7G"><a 2h="Z.f.2B();"\'+(1j?b.2g(8,b.l(8,"6B")||"&#1u;"):"")+">"+b.l(8,"6A")+"</a></I>"+(1D?2v:"")+"</I>";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&&3R<O?O:3R);3S(v z(K,H,1)>3R){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=\'<I V="t-f-4t">\'+(b.4W(8,-1,K,H)?"<a 2h=\\"Z.f.1U(\'#"+8.x+"\', -"+2m+", \'M\');\\""+(1j?b.2g(8,b.l(8,"6z")||"&#1u;"):"")+">"+2A+"</a>":(3Q?"":"<4v>"+2A+"</4v>"))+"</I>";c 2z=b.l(8,"2z");2z=(!3m?2z:b.2d(2z,v z(K,H+2m,1),b.1Z(8)));c 3P=\'<I V="t-f-3P">\'+(b.4W(8,+1,K,H)?"<a 2h=\\"Z.f.1U(\'#"+8.x+"\', +"+2m+", \'M\');\\""+(1j?b.2g(8,b.l(8,"6y")||"&#1u;"):"")+">"+2z+"</a>":(3Q?"":"<4v>"+2z+"</4v>"))+"</I>";c 2U=b.l(8,"2U");2U=(!3m?2U:b.2d(2U,2k,b.1Z(8)));c R=(3l?\'<I V="\'+b.5g+\'">\'+3l+"</I>":"")+(3G&&!8.1v?58:"")+\'<I V="t-f-7E">\'+(1D?3P:4t)+(b.4V(8,(b.l(8,"5f")&&8.1f?4p:2k))?\'<I V="t-f-4u"><a 2h="Z.f.5e(\\\'#\'+8.x+"\');\\""+(1j?b.2g(8,b.l(8,"6x")||"&#1u;"):"")+">"+2U+"</a></I>":"")+(1D?4t:3P)+"</I>";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")||"&#1u;":"");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+=\'<I V="t-f-7D-C\'+(3j==0?" t-f-v-2T":"")+\'">\'+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")+"</1w>":"");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":"<a 2h=\\"Z.f.6s(\'#"+8.x+"\', "+G+\');"\')+(1j?b.2g(8,4s):"")+\' 3J="\'+1o[G]+\'">\'+4r[G]+(3M?"</a>":"</3k>")+"</1w>"}R+="</4m></6r><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)+"</1w>":"");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&&1k<O)||(S&&1k>S);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])||"&#1u;")+"\');")+"\\" 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(\'&#1u;\');")+\'" 2h="Z.f.59(\\\'#\'+8.x+"\',"+H+","+K+\', b);"\')+">"+(2i?(2w?1k.U():"&#1u;"):(3H?1k.U():"<a>"+1k.U()+"</a>"))+"</1w>";1k.6o(1k.6n()+1)}R+="</4m>"}H++;k(H>11){H=0;K++}R+="</6m></6l></I>"}}R+=(1j?\'<I 4l="2v: 4k;"></I><I x="t-f-21-\'+8.x+\'" V="t-f-21">\'+(b.l(8,"6k")||"&#1u;")+"</I>":"")+(!3G&&!8.1v?58:"")+\'<I 4l="2v: 4k;"></I>\'+($.2c.57&&2N($.2c.6j)<7&&!8.1v?\'<4j 56="7z:F;" V="t-f-55"></4j>\':"");q R},6i:n(8,H,K,O,S,3f,54,1j,1g){O=(8.1h&&O&&3f<O?3f:O);c R=\'<I V="t-f-7y">\';k(54||!b.l(8,"6h")){R+=1g[H]+"&#1u;"}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")||"&#1u;"):"")+">";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]+"</4h>"}}R+="</2P>"}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")||"&#1u;"):"")+">";1m(;A<=17;A++){R+=\'<4h E="\'+A+\'"\'+(A==K?\' 4i="4i"\':"")+">"+A+"</4h>"}R+="</2P>"}R+="</I>";q R},2g:n(8,50){q" 51=\\"Z(\'#t-f-21-"+8.x+"\').R(\'"+50+"\');\\" 4Z=\\"Z(\'#t-f-21-"+8.x+"\').R(\'&#1u;\');\\""},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&&h<O?O:h);h=(S&&h>S?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('<div/>')
+ .wrap('<div/>'),
+
+ 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 =
+ $('<div class="ui-dialog-titlebar"/>'))
+ .append('<span class="ui-dialog-title">' + title + '</span>')
+ .append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
+ .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 = $('<div/>'))
+ .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) {
+ $('<button/>')
+ .text(name)
+ .click(function() { fn.apply(self.element[0], arguments); })
+ .appendTo(uiDialogButtonPane);
+ });
+ }
+ }
+});
+
+$.extend($.ui.dialog, {
+ defaults: {
+ autoOpen: true,
+ autoResize: true,
+ bgiframe: false,
+ buttons: {},
+ closeOnEscape: true,
+ draggable: true,
+ height: 200,
+ minHeight: 100,
+ minWidth: 150,
+ modal: false,
+ overlay: {},
+ position: 'center',
+ resizable: true,
+ stack: true,
+ width: 300,
+ zIndex: 1000
+ },
+
+ overlay: function(dialog) {
+ this.$el = $.ui.dialog.overlay.create(dialog);
+ }
+});
+
+$.extend($.ui.dialog.overlay, {
+ instances: [],
+ events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
+ function(e) { return e + '.dialog-overlay'; }).join(' '),
+ create: function(dialog) {
+ if (this.instances.length === 0) {
+ // prevent use of anchors and inputs
+ // we use a setTimeout in case the overlay is created from an
+ // event that we're going to be cancelling (see #2804)
+ setTimeout(function() {
+ $('a, :input').bind($.ui.dialog.overlay.events, function() {
+ // allow use of the element if inside a dialog and
+ // - there are no modal dialogs
+ // - there are modal dialogs, but we are in front of the topmost modal
+ var allow = false;
+ var $dialog = $(this).parents('.ui-dialog');
+ if ($dialog.length) {
+ var $overlays = $('.ui-dialog-overlay');
+ if ($overlays.length) {
+ var maxZ = parseInt($overlays.css('z-index'), 10);
+ $overlays.each(function() {
+ maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10));
+ });
+ allow = parseInt($dialog.css('z-index'), 10) > maxZ;
+ } else {
+ allow = true;
+ }
+ }
+ return allow;
+ });
+ }, 1);
+
+ // allow closing by pressing the escape key
+ $(document).bind('keydown.dialog-overlay', function(e) {
+ var ESC = 27;
+ (e.keyCode && e.keyCode == ESC && dialog.close());
+ });
+
+ // handle window resize
+ $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
+ }
+
+ var $el = $('<div/>').appendTo(document.body)
+ .addClass('ui-dialog-overlay').css($.extend({
+ borderWidth: 0, margin: 0, padding: 0,
+ position: 'absolute', top: 0, left: 0,
+ width: this.width(),
+ height: this.height()
+ }, dialog.options.overlay));
+
+ (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
+
+ this.instances.push($el);
+ return $el;
+ },
+
+ destroy: function($el) {
+ this.instances.splice($.inArray(this.instances, $el), 1);
+
+ if (this.instances.length === 0) {
+ $('a, :input').add([document, window]).unbind('.dialog-overlay');
+ }
+
+ $el.remove();
+ },
+
+ height: function() {
+ if ($.browser.msie && $.browser.version < 7) {
+ var scrollHeight = Math.max(
+ document.documentElement.scrollHeight,
+ document.body.scrollHeight
+ );
+ var offsetHeight = Math.max(
+ document.documentElement.offsetHeight,
+ document.body.offsetHeight
+ );
+
+ if (scrollHeight < offsetHeight) {
+ return $(window).height() + 'px';
+ } else {
+ return scrollHeight + 'px';
+ }
+ } else {
+ return $(document).height() + 'px';
+ }
+ },
+
+ width: function() {
+ if ($.browser.msie && $.browser.version < 7) {
+ var scrollWidth = Math.max(
+ document.documentElement.scrollWidth,
+ document.body.scrollWidth
+ );
+ var offsetWidth = Math.max(
+ document.documentElement.offsetWidth,
+ document.body.offsetWidth
+ );
+
+ if (scrollWidth < offsetWidth) {
+ return $(window).width() + 'px';
+ } else {
+ return scrollWidth + 'px';
+ }
+ } else {
+ return $(document).width() + 'px';
+ }
+ },
+
+ resize: function() {
+ /* If the dialog is draggable and the user drags it past the
+ * right edge of the window, the document becomes wider so we
+ * need to stretch the overlay. If the user then drags the
+ * dialog back to the left, the document will become narrower,
+ * so we need to shrink the overlay to the appropriate size.
+ * This is handled by shrinking the overlay before setting it
+ * to the full document size.
+ */
+ var $overlays = $([]);
+ $.each($.ui.dialog.overlay.instances, function() {
+ $overlays = $overlays.add(this);
+ });
+
+ $overlays.css({
+ width: 0,
+ height: 0
+ }).css({
+ width: $.ui.dialog.overlay.width(),
+ height: $.ui.dialog.overlay.height()
+ });
+ }
+});
+
+$.extend($.ui.dialog.overlay.prototype, {
+ destroy: function() {
+ $.ui.dialog.overlay.destroy(this.$el);
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.dialog.packed.js b/template-common/lib/ui/ui.dialog.packed.js
new file mode 100644
index 000000000..f158ee590
--- /dev/null
+++ b/template-common/lib/ui/ui.dialog.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(5(B){b A={1W:"1z.t",15:"15.t",1V:"1y.t",1A:"1A.i",1e:"1e.i",1B:"1B.i",1d:"1d.i",1U:"1z.i",p:"15.i",1T:"1y.i"};B.2p("6.4",{3o:5(){b J=3,K=3.9,D=2u K.i=="2t"?K.i:"n,e,s,w,3n,3m,3l,3k",E=3.k.y("6-4-1f").2z("<1a/>").2z("<1a/>"),G=(3.2l=E.2x().y("6-4-3j").g({q:"3i",d:"1K%",c:"1K%"})),H=K.1j||E.1Y("1j")||"",C=(3.1i=B(\'<1a 1Z="6-4-16"/>\')).2y(\'<1C 1Z="6-4-1j">\'+H+"</1C>").2y(\'<a 3h="#" 1Z="6-4-16-v"><1C>X</1C></a>\').3g(G),I=(3.f=G.2x()).12(j.x).14().y("6-4").y(K.3f).y(E.1Y("3e")).1O("6-4-1f").g({q:"1F",d:K.d,c:K.c,3d:"3c",1b:K.1b}).1Y("3b",-1).g("3a",0).1H(5(L){h(K.2f){b M=27;(L.1o&&L.1o==M&&J.v())}}).1J(5(){J.1u()}),F=(3.2i=B("<1a/>")).y("6-4-39").g({q:"1F",1h:0}).12(I);3.2k=B(".6-4-16-v",C).1X(5(){B(3).y("6-4-16-v-1X")},5(){B(3).1O("6-4-16-v-1X")}).1J(5(L){L.38()}).1I(5(){J.v();l U});3.1i.37("*").1E(3.1i).W(5(){B.6.36(3)});h(B.1n.t){I.t({2w:".6-4-1f",2v:K.35,34:".6-4-16",1z:5(M,L){J.1u();(K.1W&&K.1W.u(J.k[0],O))},15:5(M,L){(K.15&&K.15.u(J.k[0],O))},1y:5(M,L){(K.1V&&K.1V.u(J.k[0],O));B.6.4.8.p()}});(K.t||I.t("1x"))}h(B.1n.i){I.i({2w:".6-4-1f",2v:K.33,1B:K.1B,1A:K.1A,1d:K.1d,1e:K.1e,1z:5(){(K.1U&&K.1U.u(J.k[0],O))},p:5(M,L){(K.1r&&J.1v.u(J));(K.p&&K.p.u(J.k[0],O))},2r:D,1y:5(M,L){(K.1r&&J.1v.u(J));(K.1T&&K.1T.u(J.k[0],O));B.6.4.8.p()}});(K.i||I.i("1x"))}3.1N(K.1L);3.1s=U;(K.T&&B.1n.T&&I.T());(K.2g&&3.1P())},2o:5(C,D){(A[C]&&3.f.2s(A[C],D));1R(C){m"1L":3.1N(D);o;m"t":3.f.t(D?"2q":"1x");o;m"c":3.f.c(D);o;m"q":3.q(D);o;m"i":(2u D=="2t"&&3.f.2s("2r.i",D));3.f.i(D?"2q":"1x");o;m"1j":B(".6-4-1j",3.1i).2h(D);o;m"d":3.f.d(D);o}B.2p.20.2o.u(3,O)},q:5(H){b D=B(17),E=B(j),F=E.32(),C=E.31(),G=F;h(B.2b(H,["1c","11","1w","1h","Z"])>=0){H=[H=="1w"||H=="Z"?H:"1c",H=="11"||H=="1h"?H:"1Q"]}h(H.1S!=30){H=["1c","1Q"]}h(H[0].1S==2n){C+=H[0]}Q{1R(H[0]){m"Z":C+=0;o;m"1w":C+=D.d()-3.f.d();o;2m:m"1c":C+=(D.d()-3.f.d())/2}}h(H[1].1S==2n){F+=H[1]}Q{1R(H[1]){m"11":F+=0;o;m"1h":F+=D.c()-3.f.c();o;2m:m"1Q":F+=(D.c()-3.f.c())/2}}F=S.R(F,G);3.f.g({11:F,Z:C})},1v:5(){b D=3.2l,G=3.1i,E=3.k,F=N(E.g("19-11"),10)+N(E.g("19-1h"),10),C=N(E.g("19-Z"),10)+N(E.g("19-1w"),10);E.c(D.c()-G.2Z()-F);E.d(D.d()-C)},1P:5(){h(3.1s){l}3.8=3.9.1q?2Y B.6.4.8(3):1g;(3.f.2X().18>0)&&3.f.12("x");3.q(3.9.q);3.f.1M(3.9.1M);3.9.1r&&3.1v();3.1u(r);b C=1g;b D={9:3.9};3.2k.1p();3.k.1t("2W",[C,D],3.9.1P);3.1s=r},1u:5(E){h((3.9.1q&&!E)||(!3.9.2e&&!3.9.1q)){l 3.k.1t("2j",[1g,{9:3.9}],3.9.1p)}b D=3.9.1b,C=3.9;B(".6-4:2V").W(5(){D=S.R(D,N(B(3).g("z-13"),10)||C.1b)});(3.8&&3.8.$1D.g("z-13",++D));3.f.g("z-13",++D);3.k.1t("2j",[1g,{9:3.9}],3.9.1p)},v:5(){(3.8&&3.8.V());3.f.14(3.9.14);b D=1g;b C={9:3.9};3.k.1t("2U",[D,C],3.9.v);B.6.4.8.p();3.1s=U},V:5(){(3.8&&3.8.V());3.f.14();3.k.29(".4").2T("4").1O("6-4-1f").14().12("x");3.f.28()},1N:5(F){b E=3,C=U,D=3.2i;D.2S().14();B.W(F,5(){l!(C=r)});h(C){D.1M();B.W(F,5(G,H){B("<2R/>").2h(G).1I(5(){H.u(E.k[0],O)}).12(D)})}}});B.1k(B.6.4,{2Q:{2g:r,1r:r,T:U,1L:{},2f:r,t:r,c:2P,1e:1K,1d:2O,1q:U,8:{},q:"1c",i:r,2e:r,d:2N,1b:2M},8:5(C){3.$1D=B.6.4.8.2d(C)}});B.1k(B.6.4.8,{P:[],2c:B.2L("1p,1J,2K,1H,2J,1I".2I(","),5(C){l C+".4-8"}).2H(" "),2d:5(D){h(3.P.18===0){2G(5(){B("a, :2a").1G(B.6.4.8.2c,5(){b F=U;b H=B(3).2F(".6-4");h(H.18){b E=B(".6-4-8");h(E.18){b G=N(E.g("z-13"),10);E.W(5(){G=S.R(G,N(B(3).g("z-13"),10))});F=N(H.g("z-13"),10)>G}Q{F=r}}l F})},1);B(j).1G("1H.4-8",5(E){b F=27;(E.1o&&E.1o==F&&D.v())});B(17).1G("p.4-8",B.6.4.8.p)}b C=B("<1a/>").12(j.x).y("6-4-8").g(B.1k({2E:0,19:0,2D:0,q:"1F",11:0,Z:0,d:3.d(),c:3.c()},D.9.8));(D.9.T&&B.1n.T&&C.T());3.P.2C(C);l C},V:5(C){3.P.2B(B.2b(3.P,C),1);h(3.P.18===0){B("a, :2a").1E([j,17]).29(".4-8")}C.28()},c:5(){h(B.1m.24&&B.1m.23<7){b D=S.R(j.1l.26,j.x.26);b C=S.R(j.1l.25,j.x.25);h(D<C){l B(17).c()+"Y"}Q{l D+"Y"}}Q{l B(j).c()+"Y"}},d:5(){h(B.1m.24&&B.1m.23<7){b C=S.R(j.1l.22,j.x.22);b D=S.R(j.1l.21,j.x.21);h(C<D){l B(17).d()+"Y"}Q{l C+"Y"}}Q{l B(j).d()+"Y"}},p:5(){b C=B([]);B.W(B.6.4.8.P,5(){C=C.1E(3)});C.g({d:0,c:0}).g({d:B.6.4.8.d(),c:B.6.4.8.c()})}});B.1k(B.6.4.8.20,{V:5(){B.6.4.8.V(3.$1D)}})})(2A)',62,211,'|||this|dialog|function|ui||overlay|options||var|height|width||uiDialog|css|if|resizable|document|element|return|case||break|resize|position|true||draggable|apply|close||body|addClass|||||||||||||||parseInt|arguments|instances|else|max|Math|bgiframe|false|destroy|each||px|left||top|appendTo|index|hide|drag|titlebar|window|length|margin|div|zIndex|center|minWidth|minHeight|content|null|bottom|uiDialogTitlebar|title|extend|documentElement|browser|fn|keyCode|focus|modal|autoResize|isOpen|triggerHandler|moveToTop|size|right|disable|stop|start|maxHeight|maxWidth|span|el|add|absolute|bind|keydown|click|mousedown|100|buttons|show|createButtons|removeClass|open|middle|switch|constructor|resizeStop|resizeStart|dragStop|dragStart|hover|attr|class|prototype|offsetWidth|scrollWidth|version|msie|offsetHeight|scrollHeight||remove|unbind|input|inArray|events|create|stack|closeOnEscape|autoOpen|text|uiDialogButtonPane|dialogfocus|uiDialogTitlebarClose|uiDialogContainer|default|Number|setData|widget|enable|handles|data|string|typeof|helper|cancel|parent|append|wrap|jQuery|splice|push|padding|borderWidth|parents|setTimeout|join|split|keypress|mouseup|map|1000|300|150|200|defaults|button|empty|removeData|dialogclose|visible|dialogopen|next|new|outerHeight|Array|scrollLeft|scrollTop|resizeHelper|handle|dragHelper|disableSelection|find|stopPropagation|buttonpane|outline|tabIndex|hidden|overflow|className|dialogClass|prependTo|href|relative|container|nw|ne|sw|se|init'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.draggable.js b/template-common/lib/ui/ui.draggable.js
new file mode 100644
index 000000000..31aecff58
--- /dev/null
+++ b/template-common/lib/ui/ui.draggable.js
@@ -0,0 +1,562 @@
+/*
+ * jQuery UI Draggable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Draggables
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
+ init: function() {
+
+ //Initialize needed constants
+ var o = this.options;
+
+ //Position the node
+ if (o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
+ this.element.css('position', 'relative');
+
+ this.element.addClass('ui-draggable');
+ (o.disabled && this.element.addClass('ui-draggable-disabled'));
+
+ this.mouseInit();
+
+ },
+ mouseStart: function(e) {
+ var o = this.options;
+
+ if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) return false;
+
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+
+
+ $(this.options.handle, this.element).find("*").andSelf().each(function() {
+ if(this == e.target) handle = true;
+ });
+ if (!handle) return false;
+
+ if($.ui.ddmanager) $.ui.ddmanager.current = this;
+
+ //Create and append the visible helper
+ this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
+ if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+ if(this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");
+
+ /*
+ * - Position generation -
+ * This block generates everything position related - it's the core of draggables.
+ */
+
+ this.margins = { //Cache the margins
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
+ top: (parseInt(this.element.css("marginTop"),10) || 0)
+ };
+
+ this.cssPosition = this.helper.css("position"); //Store the helper's css position
+ this.offset = this.element.offset(); //The element's absolute position on the page
+ this.offset = { //Substract the margins from the element's absolute offset
+ top: this.offset.top - this.margins.top,
+ left: this.offset.left - this.margins.left
+ };
+
+ this.offset.click = { //Where the click happened, relative to the element
+ left: e.pageX - this.offset.left,
+ top: e.pageY - this.offset.top
+ };
+
+ this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position
+ if(this.offsetParent[0] == document.body && $.browser.mozilla) po = { top: 0, left: 0 }; //Ugly FF3 fix
+ this.offset.parent = { //Store its position plus border
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+ };
+
+ var p = this.element.position(); //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helpers
+ this.offset.relative = this.cssPosition == "relative" ? {
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.offsetParent[0].scrollTop,
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.offsetParent[0].scrollLeft
+ } : { top: 0, left: 0 };
+
+ this.originalPosition = this.generatePosition(e); //Generate the original position
+ this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size
+
+ if(o.cursorAt) {
+ if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left + this.margins.left;
+ if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right + this.margins.left;
+ if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top + this.margins.top;
+ if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom + this.margins.top;
+ }
+
+
+ /*
+ * - Position constraining -
+ * Here we prepare position constraining like grid and containment.
+ */
+
+ if(o.containment) {
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
+ 0 - this.offset.relative.left - this.offset.parent.left,
+ 0 - this.offset.relative.top - this.offset.parent.top,
+ $(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+ ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+ ];
+
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
+ var ce = $(o.containment)[0];
+ var co = $(o.containment).offset();
+
+ this.containment = [
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left,
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top,
+ co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0),
+ co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0)
+ ];
+ }
+ }
+
+ //Call plugins and callbacks
+ this.propagate("start", e);
+
+ this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
+ if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
+
+ this.helper.addClass("ui-draggable-dragging");
+ this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+ return true;
+ },
+ convertPositionTo: function(d, pos) {
+ if(!pos) pos = this.position;
+ var mod = d == "absolute" ? 1 : -1;
+ return {
+ top: (
+ pos.top // the calculated relative position
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
+ - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod
+ + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
+ ),
+ left: (
+ pos.left // the calculated relative position
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
+ - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod
+ + this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
+ )
+ };
+ },
+ generatePosition: function(e) {
+
+ var o = this.options;
+ var position = {
+ top: (
+ e.pageY // The absolute mouse position
+ - this.offset.click.top // Click offset (relative to the element)
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
+ + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)
+ ),
+ left: (
+ e.pageX // The absolute mouse position
+ - this.offset.click.left // Click offset (relative to the element)
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
+ + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0)
+ )
+ };
+
+ if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options
+
+ /*
+ * - Position constraining -
+ * Constrain the position to a mix of grid, containment.
+ */
+ if(this.containment) {
+ if(position.left < this.containment[0]) position.left = this.containment[0];
+ if(position.top < this.containment[1]) position.top = this.containment[1];
+ if(position.left > this.containment[2]) position.left = this.containment[2];
+ if(position.top > this.containment[3]) position.top = this.containment[3];
+ }
+
+ if(o.grid) {
+ var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
+ position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+ var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
+ position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+ }
+
+ return position;
+ },
+ mouseDrag: function(e) {
+
+ //Compute the helpers position
+ this.position = this.generatePosition(e);
+ this.positionAbs = this.convertPositionTo("absolute");
+
+ //Call plugins and callbacks and use the resulting position if something is returned
+ this.position = this.propagate("drag", e) || this.position;
+
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
+
+ return false;
+ },
+ mouseStop: function(e) {
+
+ //If we are using droppables, inform the manager about the drop
+ var dropped = false;
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
+ var dropped = $.ui.ddmanager.drop(this, e);
+
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
+ var self = this;
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {
+ self.propagate("stop", e);
+ self.clear();
+ });
+ } else {
+ this.propagate("stop", e);
+ this.clear();
+ }
+
+ return false;
+ },
+ clear: function() {
+ this.helper.removeClass("ui-draggable-dragging");
+ if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
+ this.helper = null;
+ this.cancelHelperRemoval = false;
+ },
+
+ // From now on bulk stuff - mainly helpers
+ plugins: {},
+ uiHash: function(e) {
+ return {
+ helper: this.helper,
+ position: this.position,
+ absolutePosition: this.positionAbs,
+ options: this.options
+ };
+ },
+ propagate: function(n,e) {
+ $.ui.plugin.call(this, n, [e, this.uiHash()]);
+ if(n == "drag") this.positionAbs = this.convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+ return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.uiHash()], this.options[n]);
+ },
+ destroy: function() {
+ if(!this.element.data('draggable')) return;
+ this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');
+ this.mouseDestroy();
+ }
+}));
+
+$.extend($.ui.draggable, {
+ defaults: {
+ appendTo: "parent",
+ axis: false,
+ cancel: ":input",
+ delay: 0,
+ distance: 1,
+ helper: "original"
+ }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+ start: function(e, ui) {
+ var t = $('body');
+ if (t.css("cursor")) ui.options._cursor = t.css("cursor");
+ t.css("cursor", ui.options.cursor);
+ },
+ stop: function(e, ui) {
+ if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
+ }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+ start: function(e, ui) {
+ var t = $(ui.helper);
+ if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
+ t.css('zIndex', ui.options.zIndex);
+ },
+ stop: function(e, ui) {
+ if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
+ }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+ start: function(e, ui) {
+ var t = $(ui.helper);
+ if(t.css("opacity")) ui.options._opacity = t.css("opacity");
+ t.css('opacity', ui.options.opacity);
+ },
+ stop: function(e, ui) {
+ if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
+ }
+});
+
+$.ui.plugin.add("draggable", "iframeFix", {
+ start: function(e, ui) {
+ $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
+ },
+ stop: function(e, ui) {
+ $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
+ }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+ start: function(e, ui) {
+ var o = ui.options;
+ var i = $(this).data("draggable");
+ o.scrollSensitivity = o.scrollSensitivity || 20;
+ o.scrollSpeed = o.scrollSpeed || 20;
+
+ i.overflowY = function(el) {
+ do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
+ return $(document);
+ }(this);
+ i.overflowX = function(el) {
+ do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
+ return $(document);
+ }(this);
+
+ if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
+ if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
+
+ },
+ drag: function(e, ui) {
+
+ var o = ui.options;
+ var i = $(this).data("draggable");
+
+ if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
+ if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)
+ i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
+ if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)
+ i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
+
+ } else {
+ if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
+ $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+ if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+ $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+ }
+
+ if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
+ if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)
+ i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
+ if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)
+ i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
+ } else {
+ if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+ $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+ if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+ $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+ }
+
+ }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+ start: function(e, ui) {
+
+ var inst = $(this).data("draggable");
+ inst.snapElements = [];
+ $(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {
+ var $t = $(this); var $o = $t.offset();
+ if(this != inst.element[0]) inst.snapElements.push({
+ item: this,
+ width: $t.outerWidth(), height: $t.outerHeight(),
+ top: $o.top, left: $o.left
+ });
+ });
+
+ },
+ drag: function(e, ui) {
+
+ var inst = $(this).data("draggable");
+ var d = ui.options.snapTolerance || 20;
+ var x1 = ui.absolutePosition.left, x2 = x1 + inst.helperProportions.width,
+ y1 = ui.absolutePosition.top, y2 = y1 + inst.helperProportions.height;
+
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
+
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+
+ //Yes, I know, this is insane ;)
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue;
+
+ if(ui.options.snapMode != 'inner') {
+ var ts = Math.abs(t - y2) <= 20;
+ var bs = Math.abs(b - y1) <= 20;
+ var ls = Math.abs(l - x2) <= 20;
+ var rs = Math.abs(r - x1) <= 20;
+ if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
+ if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b, left: 0 }).top;
+ if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
+ if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r }).left;
+ }
+
+ if(ui.options.snapMode != 'outer') {
+ var ts = Math.abs(t - y1) <= 20;
+ var bs = Math.abs(b - y2) <= 20;
+ var ls = Math.abs(l - x1) <= 20;
+ var rs = Math.abs(r - x2) <= 20;
+ if(ts) ui.position.top = inst.convertPositionTo("relative", { top: t, left: 0 }).top;
+ if(bs) ui.position.top = inst.convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
+ if(ls) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: l }).left;
+ if(rs) ui.position.left = inst.convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+ }
+
+ };
+ }
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+ start: function(e,ui) {
+
+ var inst = $(this).data("draggable");
+ inst.sortables = [];
+ $(ui.options.connectToSortable).each(function() {
+ if($.data(this, 'sortable')) {
+ var sortable = $.data(this, 'sortable');
+ inst.sortables.push({
+ instance: sortable,
+ shouldRevert: sortable.options.revert
+ });
+ sortable.refreshItems(); //Do a one-time refresh at start to refresh the containerCache
+ sortable.propagate("activate", e, inst);
+ }
+ });
+
+ },
+ stop: function(e,ui) {
+
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+ var inst = $(this).data("draggable");
+
+ $.each(inst.sortables, function() {
+ if(this.instance.isOver) {
+ this.instance.isOver = 0;
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+ if(this.shouldRevert) this.instance.options.revert = true; //revert here
+ this.instance.mouseStop(e);
+
+ //Also propagate receive event, since the sortable is actually receiving a element
+ this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
+
+ this.instance.options.helper = this.instance.options._helper;
+ } else {
+ this.instance.propagate("deactivate", e, inst);
+ }
+
+ });
+
+ },
+ drag: function(e,ui) {
+
+ var inst = $(this).data("draggable"), self = this;
+
+ var checkPos = function(o) {
+
+ var l = o.left, r = l + o.width,
+ t = o.top, b = t + o.height;
+
+ return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
+ && t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
+ };
+
+ $.each(inst.sortables, function(i) {
+
+ if(checkPos.call(inst, this.instance.containerCache)) {
+
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+ if(!this.instance.isOver) {
+ this.instance.isOver = 1;
+
+ //Now we fake the start of dragging for the sortable instance,
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+ this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+ this.instance.options.helper = function() { return ui.helper[0]; };
+
+ e.target = this.instance.currentItem[0];
+ this.instance.mouseCapture(e, true);
+ this.instance.mouseStart(e, true, true);
+
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+ this.instance.offset.click.top = inst.offset.click.top;
+ this.instance.offset.click.left = inst.offset.click.left;
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+
+ inst.propagate("toSortable", e);
+
+ }
+
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+ if(this.instance.currentItem) this.instance.mouseDrag(e);
+
+ } else {
+
+ //If it doesn't intersect with the sortable, and it intersected before,
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+ if(this.instance.isOver) {
+ this.instance.isOver = 0;
+ this.instance.cancelHelperRemoval = true;
+ this.instance.options.revert = false; //No revert here
+ this.instance.mouseStop(e, true);
+ this.instance.options.helper = this.instance.options._helper;
+
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+ this.instance.currentItem.remove();
+ if(this.instance.placeholder) this.instance.placeholder.remove();
+
+ inst.propagate("fromSortable", e);
+ }
+
+ };
+
+ });
+
+ }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+ start: function(e,ui) {
+ var group = $.makeArray($(ui.options.stack.group)).sort(function(a,b) {
+ return (parseInt($(a).css("zIndex"),10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"),10) || ui.options.stack.min);
+ });
+
+ $(group).each(function(i) {
+ this.style.zIndex = ui.options.stack.min + i;
+ });
+
+ this[0].style.zIndex = ui.options.stack.min + group.length;
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.draggable.packed.js b/template-common/lib/ui/ui.draggable.packed.js
new file mode 100644
index 000000000..27e30c770
--- /dev/null
+++ b/template-common/lib/ui/ui.draggable.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(b(A){A.3y("g.i",A.1T({},A.g.3x,{3w:b(){a B=4.9;7(B.d=="27"&&!(/(l|Z|15)/).1k(4.j.e("m"))){4.j.e("m","l")}4.j.2b("g-i");(B.2e&&4.j.2b("g-i-2e"));4.3v()},2g:b(F){a H=4.9;7(4.d||H.2e||A(F.1Q).3u(".g-3t-1L")){n 11}a C=!4.9.1L||!A(4.9.1L,4.j).1A?t:11;A(4.9.1L,4.j).3s("*").3r().1b(b(){7(4==F.1Q){C=t}});7(!C){n 11}7(A.g.1f){A.g.1f.3q=4}4.d=A.3p(H.d)?A(H.d.3o(4.j[0],[F])):(H.d=="1S"?4.j.1S():4.j);7(!4.d.3n("14").1A){4.d.1p((H.1p=="k"?4.j[0].1t:H.1p))}7(4.d[0]!=4.j[0]&&!(/(15|Z)/).1k(4.d.e("m"))){4.d.e("m","Z")}4.S={6:(o(4.j.e("3m"),10)||0),5:(o(4.j.e("3l"),10)||0)};4.z=4.d.e("m");4.8=4.j.8();4.8={5:4.8.5-4.S.5,6:4.8.6-4.S.6};4.8.q={6:F.1q-4.8.6,5:F.1s-4.8.5};4.p=4.d.p();a B=4.p.8();7(4.p[0]==f.14&&A.3k.3j){B={5:0,6:0}}4.8.k={5:B.5+(o(4.p.e("2c"),10)||0),6:B.6+(o(4.p.e("2d"),10)||0)};a E=4.j.m();4.8.l=4.z=="l"?{5:E.5-(o(4.d.e("5"),10)||0)+4.p[0].s,6:E.6-(o(4.d.e("6"),10)||0)+4.p[0].r}:{5:0,6:0};4.1m=4.2a(F);4.w={v:4.d.1W(),u:4.d.1V()};7(H.1a){7(H.1a.6!=1K){4.8.q.6=H.1a.6+4.S.6}7(H.1a.2z!=1K){4.8.q.6=4.w.v-H.1a.2z+4.S.6}7(H.1a.5!=1K){4.8.q.5=H.1a.5+4.S.5}7(H.1a.2y!=1K){4.8.q.5=4.w.u-H.1a.2y+4.S.5}}7(H.h){7(H.h=="k"){H.h=4.d[0].1t}7(H.h=="f"||H.h=="1r"){4.h=[0-4.8.l.6-4.8.k.6,0-4.8.l.5-4.8.k.5,A(H.h=="f"?f:1r).v()-4.8.l.6-4.8.k.6-4.w.v-4.S.6-(o(4.j.e("2x"),10)||0),(A(H.h=="f"?f:1r).u()||f.14.1t.2v)-4.8.l.5-4.8.k.5-4.w.u-4.S.5-(o(4.j.e("2u"),10)||0)]}7(!(/^(f|1r|k)$/).1k(H.h)){a D=A(H.h)[0];a G=A(H.h).8();4.h=[G.6+(o(A(D).e("2d"),10)||0)-4.8.l.6-4.8.k.6,G.5+(o(A(D).e("2c"),10)||0)-4.8.l.5-4.8.k.5,G.6+T.2w(D.3i,D.1Z)-(o(A(D).e("2d"),10)||0)-4.8.l.6-4.8.k.6-4.w.v-4.S.6-(o(4.j.e("2x"),10)||0),G.5+T.2w(D.2v,D.22)-(o(A(D).e("2c"),10)||0)-4.8.l.5-4.8.k.5-4.w.u-4.S.5-(o(4.j.e("2u"),10)||0)]}}4.18("16",F);4.w={v:4.d.1W(),u:4.d.1V()};7(A.g.1f&&!H.2s){A.g.1f.3h(4,F)}4.d.2b("g-i-2r");4.1P(F);n t},W:b(C,D){7(!D){D=4.m}a B=C=="Z"?1:-1;n{5:(D.5+4.8.l.5*B+4.8.k.5*B-(4.z=="15"||(4.z=="Z"&&4.p[0]==f.14)?0:4.p[0].s)*B+(4.z=="15"?A(f).s():0)*B+4.S.5*B),6:(D.6+4.8.l.6*B+4.8.k.6*B-(4.z=="15"||(4.z=="Z"&&4.p[0]==f.14)?0:4.p[0].r)*B+(4.z=="15"?A(f).r():0)*B+4.S.6*B)}},2a:b(E){a F=4.9;a B={5:(E.1s-4.8.q.5-4.8.l.5-4.8.k.5+(4.z=="15"||(4.z=="Z"&&4.p[0]==f.14)?0:4.p[0].s)-(4.z=="15"?A(f).s():0)),6:(E.1q-4.8.q.6-4.8.l.6-4.8.k.6+(4.z=="15"||(4.z=="Z"&&4.p[0]==f.14)?0:4.p[0].r)-(4.z=="15"?A(f).r():0))};7(!4.1m){n B}7(4.h){7(B.6<4.h[0]){B.6=4.h[0]}7(B.5<4.h[1]){B.5=4.h[1]}7(B.6>4.h[2]){B.6=4.h[2]}7(B.5>4.h[3]){B.5=4.h[3]}}7(F.19){a D=4.1m.5+T.2t((B.5-4.1m.5)/F.19[1])*F.19[1];B.5=4.h?(!(D<4.h[1]||D>4.h[3])?D:(!(D<4.h[1])?D-F.19[1]:D+F.19[1])):D;a C=4.1m.6+T.2t((B.6-4.1m.6)/F.19[0])*F.19[0];B.6=4.h?(!(C<4.h[0]||C>4.h[2])?C:(!(C<4.h[0])?C-F.19[0]:C+F.19[0])):C}n B},1P:b(B){4.m=4.2a(B);4.1h=4.W("Z");4.m=4.18("1d",B)||4.m;7(!4.9.1z||4.9.1z!="y"){4.d[0].1v.6=4.m.6+"1I"}7(!4.9.1z||4.9.1z!="x"){4.d[0].1v.5=4.m.5+"1I"}7(A.g.1f){A.g.1f.1d(4,B)}n 11},1O:b(C){a D=11;7(A.g.1f&&!4.9.2s){a D=A.g.1f.3g(4,C)}7((4.9.1g=="3f"&&!D)||(4.9.1g=="3e"&&D)||4.9.1g===t){a B=4;A(4.d).3d(4.1m,o(4.9.1g,10)||3c,b(){B.18("1i",C);B.29()})}1x{4.18("1i",C);4.29()}n 11},29:b(){4.d.2q("g-i-2r");7(4.9.d!="27"&&!4.1w){4.d.1M()}4.d=3b;4.1w=11},3a:{},28:b(B){n{d:4.d,m:4.m,1U:4.1h,9:4.9}},18:b(C,B){A.g.17.2i(4,C,[B,4.28()]);7(C=="1d"){4.1h=4.W("Z")}n 4.j.2j(C=="1d"?C:"1d"+C,[B,4.28()],4.9[C])},39:b(){7(!4.j.V("i")){n}4.j.38("i").37(".i").2q("g-i");4.36()}}));A.1T(A.g.i,{35:{1p:"k",1z:11,34:":33",32:0,31:1,d:"27"}});A.g.17.1c("i","1u",{16:b(D,C){a B=A("14");7(B.e("1u")){C.9.26=B.e("1u")}B.e("1u",C.9.1u)},1i:b(C,B){7(B.9.26){A("14").e("1u",B.9.26)}}});A.g.17.1c("i","U",{16:b(D,C){a B=A(C.d);7(B.e("U")){C.9.25=B.e("U")}B.e("U",C.9.U)},1i:b(C,B){7(B.9.25){A(B.d).e("U",B.9.25)}}});A.g.17.1c("i","1l",{16:b(D,C){a B=A(C.d);7(B.e("1l")){C.9.24=B.e("1l")}B.e("1l",C.9.1l)},1i:b(C,B){7(B.9.24){A(B.d).e("1l",B.9.24)}}});A.g.17.1c("i","1J",{16:b(C,B){A(B.9.1J===t?"30":B.9.1J).1b(b(){A(\'<23 2Z="g-i-1J" 1v="2Y: #2X;"></23>\').e({v:4.1Z+"1I",u:4.22+"1I",m:"Z",1l:"0.2W",U:2V}).e(A(4).8()).1p("14")})},1i:b(C,B){A("23.2U").1b(b(){4.1t.2T(4)})}});A.g.17.1c("i","1y",{16:b(D,C){a E=C.9;a B=A(4).V("i");E.13=E.13||20;E.12=E.12||20;B.Y=b(F){2p{7(/1H|1y/.1k(F.e("1G"))||(/1H|1y/).1k(F.e("1G-y"))){n F}F=F.k()}2o(F[0].1t);n A(f)}(4);B.X=b(F){2p{7(/1H|1y/.1k(F.e("1G"))||(/1H|1y/).1k(F.e("1G-x"))){n F}F=F.k()}2o(F[0].1t);n A(f)}(4);7(B.Y[0]!=f&&B.Y[0].1F!="1E"){B.21=B.Y.8()}7(B.X[0]!=f&&B.X[0].1F!="1E"){B.1Y=B.X.8()}},1d:b(D,C){a E=C.9;a B=A(4).V("i");7(B.Y[0]!=f&&B.Y[0].1F!="1E"){7((B.21.5+B.Y[0].22)-D.1s<E.13){B.Y[0].s=B.Y[0].s+E.12}7(D.1s-B.21.5<E.13){B.Y[0].s=B.Y[0].s-E.12}}1x{7(D.1s-A(f).s()<E.13){A(f).s(A(f).s()-E.12)}7(A(1r).u()-(D.1s-A(f).s())<E.13){A(f).s(A(f).s()+E.12)}}7(B.X[0]!=f&&B.X[0].1F!="1E"){7((B.1Y.6+B.X[0].1Z)-D.1q<E.13){B.X[0].r=B.X[0].r+E.12}7(D.1q-B.1Y.6<E.13){B.X[0].r=B.X[0].r-E.12}}1x{7(D.1q-A(f).r()<E.13){A(f).r(A(f).r()-E.12)}7(A(1r).v()-(D.1q-A(f).r())<E.13){A(f).r(A(f).r()+E.12)}}}});A.g.17.1c("i","1X",{16:b(D,C){a B=A(4).V("i");B.1j=[];A(C.9.1X===t?".g-i":C.9.1X).1b(b(){a F=A(4);a E=F.8();7(4!=B.j[0]){B.1j.2l({2h:4,v:F.1W(),u:F.1V(),5:E.5,6:E.6})}})},1d:b(J,N){a I=A(4).V("i");a L=N.9.2S||20;a D=N.1U.6,C=D+I.w.v,P=N.1U.5,O=P+I.w.u;2R(a H=I.1j.1A-1;H>=0;H--){a E=I.1j[H].6,B=E+I.1j[H].v,R=I.1j[H].5,M=R+I.1j[H].u;7(!((E-L<D&&D<B+L&&R-L<P&&P<M+L)||(E-L<D&&D<B+L&&R-L<O&&O<M+L)||(E-L<C&&C<B+L&&R-L<P&&P<M+L)||(E-L<C&&C<B+L&&R-L<O&&O<M+L))){2Q}7(N.9.2n!="2P"){a K=T.1e(R-O)<=20;a Q=T.1e(M-P)<=20;a G=T.1e(E-C)<=20;a F=T.1e(B-D)<=20;7(K){N.m.5=I.W("l",{5:R-I.w.u,6:0}).5}7(Q){N.m.5=I.W("l",{5:M,6:0}).5}7(G){N.m.6=I.W("l",{5:0,6:E-I.w.v}).6}7(F){N.m.6=I.W("l",{5:0,6:B}).6}}7(N.9.2n!="2O"){a K=T.1e(R-P)<=20;a Q=T.1e(M-O)<=20;a G=T.1e(E-D)<=20;a F=T.1e(B-C)<=20;7(K){N.m.5=I.W("l",{5:R,6:0}).5}7(Q){N.m.5=I.W("l",{5:M-I.w.u,6:0}).5}7(G){N.m.6=I.W("l",{5:0,6:E}).6}7(F){N.m.6=I.W("l",{5:0,6:B-I.w.v}).6}}}}});A.g.17.1c("i","2m",{16:b(D,C){a B=A(4).V("i");B.1D=[];A(C.9.2m).1b(b(){7(A.V(4,"1R")){a E=A.V(4,"1R");B.1D.2l({c:E,2k:E.9.1g});E.2N();E.18("2M",D,B)}})},1i:b(D,C){a B=A(4).V("i");A.1b(B.1D,b(){7(4.c.1o){4.c.1o=0;B.1w=t;4.c.1w=11;7(4.2k){4.c.9.1g=t}4.c.1O(D);4.c.j.2j("2L",[D,A.1T(4.c.g(),{2K:B.j})],4.c.9["2J"]);4.c.9.d=4.c.9.1N}1x{4.c.18("2I",D,B)}})},1d:b(F,E){a D=A(4).V("i"),B=4;a C=b(K){a H=K.6,J=H+K.v,I=K.5,G=I+K.u;n(H<(4.1h.6+4.8.q.6)&&(4.1h.6+4.8.q.6)<J&&I<(4.1h.5+4.8.q.5)&&(4.1h.5+4.8.q.5)<G)};A.1b(D.1D,b(G){7(C.2i(D,4.c.2H)){7(!4.c.1o){4.c.1o=1;4.c.1C=A(B).1S().1p(4.c.j).V("1R-2h",t);4.c.9.1N=4.c.9.d;4.c.9.d=b(){n E.d[0]};F.1Q=4.c.1C[0];4.c.2G(F,t);4.c.2g(F,t,t);4.c.8.q.5=D.8.q.5;4.c.8.q.6=D.8.q.6;4.c.8.k.6-=D.8.k.6-4.c.8.k.6;4.c.8.k.5-=D.8.k.5-4.c.8.k.5;D.18("2F",F)}7(4.c.1C){4.c.1P(F)}}1x{7(4.c.1o){4.c.1o=0;4.c.1w=t;4.c.9.1g=11;4.c.1O(F,t);4.c.9.d=4.c.9.1N;4.c.1C.1M();7(4.c.2f){4.c.2f.1M()}D.18("2E",F)}}})}});A.g.17.1c("i","1n",{16:b(D,B){a C=A.2D(A(B.9.1n.2C)).2B(b(F,E){n(o(A(F).e("U"),10)||B.9.1n.1B)-(o(A(E).e("U"),10)||B.9.1n.1B)});A(C).1b(b(E){4.1v.U=B.9.1n.1B+E});4[0].1v.U=B.9.1n.1B+C.1A}})})(2A)',62,221,'||||this|top|left|if|offset|options|var|function|instance|helper|css|document|ui|containment|draggable|element|parent|relative|position|return|parseInt|offsetParent|click|scrollLeft|scrollTop|true|height|width|helperProportions|||cssPosition|||||||||||||||||||margins|Math|zIndex|data|convertPositionTo|overflowX|overflowY|absolute||false|scrollSpeed|scrollSensitivity|body|fixed|start|plugin|propagate|grid|cursorAt|each|add|drag|abs|ddmanager|revert|positionAbs|stop|snapElements|test|opacity|originalPosition|stack|isOver|appendTo|pageX|window|pageY|parentNode|cursor|style|cancelHelperRemoval|else|scroll|axis|length|min|currentItem|sortables|HTML|tagName|overflow|auto|px|iframeFix|undefined|handle|remove|_helper|mouseStop|mouseDrag|target|sortable|clone|extend|absolutePosition|outerHeight|outerWidth|snap|overflowXOffset|offsetWidth||overflowYOffset|offsetHeight|div|_opacity|_zIndex|_cursor|original|uiHash|clear|generatePosition|addClass|borderTopWidth|borderLeftWidth|disabled|placeholder|mouseStart|item|call|triggerHandler|shouldRevert|push|connectToSortable|snapMode|while|do|removeClass|dragging|dropBehaviour|round|marginBottom|scrollHeight|max|marginRight|bottom|right|jQuery|sort|group|makeArray|fromSortable|toSortable|mouseCapture|containerCache|deactivate|receive|sender|sortreceive|activate|refreshItems|outer|inner|continue|for|snapTolerance|removeChild|DragDropIframeFix|1000|001|fff|background|class|iframe|distance|delay|input|cancel|defaults|mouseDestroy|unbind|removeData|destroy|plugins|null|500|animate|valid|invalid|drop|prepareOffsets|scrollWidth|mozilla|browser|marginTop|marginLeft|parents|apply|isFunction|current|andSelf|find|resizable|is|mouseInit|init|mouse|widget'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.droppable.js b/template-common/lib/ui/ui.droppable.js
new file mode 100644
index 000000000..6d3e159fa
--- /dev/null
+++ b/template-common/lib/ui/ui.droppable.js
@@ -0,0 +1,281 @@
+/*
+ * jQuery UI Droppable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Droppables
+ *
+ * Depends:
+ * ui.core.js
+ * ui.draggable.js
+ */
+(function($) {
+
+$.widget("ui.droppable", {
+ init: function() {
+
+ this.element.addClass("ui-droppable");
+ this.isover = 0; this.isout = 1;
+
+ //Prepare the passed options
+ var o = this.options, accept = o.accept;
+ o = $.extend(o, {
+ accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) {
+ return $(d).is(accept);
+ }
+ });
+
+ //Store the droppable's proportions
+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+
+ // Add the reference and positions to the manager
+ $.ui.ddmanager.droppables.push(this);
+
+ },
+ plugins: {},
+ ui: function(c) {
+ return {
+ draggable: (c.currentItem || c.element),
+ helper: c.helper,
+ position: c.position,
+ absolutePosition: c.positionAbs,
+ options: this.options,
+ element: this.element
+ };
+ },
+ destroy: function() {
+ var drop = $.ui.ddmanager.droppables;
+ for ( var i = 0; i < drop.length; i++ )
+ if ( drop[i] == this )
+ drop.splice(i, 1);
+
+ this.element
+ .removeClass("ui-droppable ui-droppable-disabled")
+ .removeData("droppable")
+ .unbind(".droppable");
+ },
+ over: function(e) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+ $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
+ this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
+ }
+
+ },
+ out: function(e) {
+
+ var draggable = $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+ if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+ $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
+ this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
+ }
+
+ },
+ drop: function(e,custom) {
+
+ var draggable = custom || $.ui.ddmanager.current;
+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+
+ var childrenIntersection = false;
+ this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
+ childrenIntersection = true; return false;
+ }
+ });
+ if(childrenIntersection) return false;
+
+ if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+ $.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
+ this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
+ return true;
+ }
+
+ return false;
+
+ },
+ activate: function(e) {
+
+ var draggable = $.ui.ddmanager.current;
+ $.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
+ if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
+
+ },
+ deactivate: function(e) {
+
+ var draggable = $.ui.ddmanager.current;
+ $.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
+ if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);
+
+ }
+});
+
+$.extend($.ui.droppable, {
+ defaults: {
+ disabled: false,
+ tolerance: 'intersect'
+ }
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+
+ if (!droppable.offset) return false;
+
+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+ var l = droppable.offset.left, r = l + droppable.proportions.width,
+ t = droppable.offset.top, b = t + droppable.proportions.height;
+
+ switch (toleranceMode) {
+ case 'fit':
+ return (l < x1 && x2 < r
+ && t < y1 && y2 < b);
+ break;
+ case 'intersect':
+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+ break;
+ case 'pointer':
+ return (l < ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) && ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left) < r
+ && t < ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) && ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top) < b);
+ break;
+ case 'touch':
+ return (
+ (y1 >= t && y1 <= b) || // Top edge touching
+ (y2 >= t && y2 <= b) || // Bottom edge touching
+ (y1 < t && y2 > b) // Surrounded vertically
+ ) && (
+ (x1 >= l && x1 <= r) || // Left edge touching
+ (x2 >= l && x2 <= r) || // Right edge touching
+ (x1 < l && x2 > r) // Surrounded horizontally
+ );
+ break;
+ default:
+ return false;
+ break;
+ }
+
+};
+
+/*
+ This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+ current: null,
+ droppables: [],
+ prepareOffsets: function(t, e) {
+
+ var m = $.ui.ddmanager.droppables;
+ var type = e ? e.type : null; // workaround for #2317
+
+ for (var i = 0; i < m.length; i++) {
+ if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue;
+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
+ m[i].offset = m[i].element.offset();
+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+
+ if(type == "dragstart" || type == "sortactivate") m[i].activate.call(m[i], e); //Activate the droppable if used directly from draggables
+ }
+
+ },
+ drop: function(draggable, e) {
+
+ var dropped = false;
+ $.each($.ui.ddmanager.droppables, function() {
+
+ if(!this.options) return;
+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+ dropped = this.drop.call(this, e);
+
+ if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
+ this.isout = 1; this.isover = 0;
+ this.deactivate.call(this, e);
+ }
+
+ });
+ return dropped;
+
+ },
+ drag: function(draggable, e) {
+
+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, e);
+
+ //Run through all droppables and check their positions based on specific tolerance options
+
+ $.each($.ui.ddmanager.droppables, function() {
+
+ if(this.options.disabled || this.greedyChild || !this.visible) return;
+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+
+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+ if(!c) return;
+
+ var parentInstance;
+ if (this.options.greedy) {
+ var parent = this.element.parents('.ui-droppable:eq(0)');
+ if (parent.length) {
+ parentInstance = $.data(parent[0], 'droppable');
+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+ }
+ }
+
+ // we just moved into a greedy child
+ if (parentInstance && c == 'isover') {
+ parentInstance['isover'] = 0;
+ parentInstance['isout'] = 1;
+ parentInstance.out.call(parentInstance, e);
+ }
+
+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+ this[c == "isover" ? "over" : "out"].call(this, e);
+
+ // we just moved out of a greedy child
+ if (parentInstance && c == 'isout') {
+ parentInstance['isout'] = 0;
+ parentInstance['isover'] = 1;
+ parentInstance.over.call(parentInstance, e);
+ }
+ });
+
+ }
+};
+
+/*
+ * Droppable Extensions
+ */
+
+$.ui.plugin.add("droppable", "activeClass", {
+ activate: function(e, ui) {
+ $(this).addClass(ui.options.activeClass);
+ },
+ deactivate: function(e, ui) {
+ $(this).removeClass(ui.options.activeClass);
+ },
+ drop: function(e, ui) {
+ $(this).removeClass(ui.options.activeClass);
+ }
+});
+
+$.ui.plugin.add("droppable", "hoverClass", {
+ over: function(e, ui) {
+ $(this).addClass(ui.options.hoverClass);
+ },
+ out: function(e, ui) {
+ $(this).removeClass(ui.options.hoverClass);
+ },
+ drop: function(e, ui) {
+ $(this).removeClass(ui.options.hoverClass);
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.droppable.packed.js b/template-common/lib/ui/ui.droppable.packed.js
new file mode 100644
index 000000000..717a3f3e6
--- /dev/null
+++ b/template-common/lib/ui/ui.droppable.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(8(A){A.1P("4.c",{1O:8(){3.5.Z("4-c");3.e=0;3.k=1;9 C=3.6,B=C.g;C=A.13(C,{g:C.g&&C.g.1N==1M?C.g:8(D){a A(D).1L(B)}});3.V={u:3.5[0].1a,t:3.5[0].19};A.4.d.s.1K(3)},1J:{},4:8(B){a{1e:(B.h||B.5),1f:B.1f,l:B.l,1I:B.n,6:3.6,5:3.5}},1H:8(){9 B=A.4.d.s;1c(9 C=0;C<B.10;C++){7(B[C]==3){B.1G(C,1)}}3.5.M("4-c 4-c-r").1F("c").1E(".c")},p:8(C){9 B=A.4.d.v;7(!B||(B.h||B.5)[0]==3.5[0]){a}7(3.6.g.b(3.5,(B.h||B.5))){A.4.m.b(3,"p",[C,3.4(B)]);3.5.R("1D",[C,3.4(B)],3.6.p)}},o:8(C){9 B=A.4.d.v;7(!B||(B.h||B.5)[0]==3.5[0]){a}7(3.6.g.b(3.5,(B.h||B.5))){A.4.m.b(3,"o",[C,3.4(B)]);3.5.R("1C",[C,3.4(B)],3.6.o)}},j:8(D,C){9 B=C||A.4.d.v;7(!B||(B.h||B.5)[0]==3.5[0]){a i}9 E=i;3.5.1B(".4-c").1A(".4-1e-1z").12(8(){9 F=A.16(3,"c");7(F.6.17&&A.4.q(B,A.13(F,{f:F.5.f()}),F.6.U)){E=1d;a i}});7(E){a i}7(3.6.g.b(3.5,(B.h||B.5))){A.4.m.b(3,"j",[D,3.4(B)]);3.5.R("j",[D,3.4(B)],3.6.j);a 1d}a i},O:8(C){9 B=A.4.d.v;A.4.m.b(3,"O",[C,3.4(B)]);7(B){3.5.R("1y",[C,3.4(B)],3.6.O)}},N:8(C){9 B=A.4.d.v;A.4.m.b(3,"N",[C,3.4(B)]);7(B){3.5.R("1x",[C,3.4(B)],3.6.N)}}});A.13(A.4.c,{1w:{r:i,U:"q"}});A.4.q=8(L,F,J){7(!F.f){a i}9 D=(L.n||L.l.x).y,C=D+L.z.u,I=(L.n||L.l.x).w,H=I+L.z.t;9 E=F.f.y,B=E+F.V.u,K=F.f.w,G=K+F.V.t;1v(J){W"1u":a(E<D&&C<B&&K<I&&H<G);Q;W"q":a(E<D+(L.z.u/2)&&C-(L.z.u/2)<B&&K<I+(L.z.t/2)&&H-(L.z.t/2)<G);Q;W"1t":a(E<((L.n||L.l.x).y+(L.Y||L.f.X).y)&&((L.n||L.l.x).y+(L.Y||L.f.X).y)<B&&K<((L.n||L.l.x).w+(L.Y||L.f.X).w)&&((L.n||L.l.x).w+(L.Y||L.f.X).w)<G);Q;W"1s":a((I>=K&&I<=G)||(H>=K&&H<=G)||(I<K&&H>G))&&((D>=E&&D<=B)||(C>=E&&C<=B)||(D<E&&C>B));Q;1r:a i;Q}};A.4.d={v:11,s:[],18:8(D,F){9 B=A.4.d.s;9 E=F?F.1q:11;1c(9 C=0;C<B.10;C++){7(B[C].6.r||(D&&!B[C].6.g.b(B[C].5,(D.h||D.5)))){1b}B[C].P=B[C].5.1p("1o")!="1n";7(!B[C].P){1b}B[C].f=B[C].5.f();B[C].V={u:B[C].5[0].1a,t:B[C].5[0].19};7(E=="1m"||E=="1l"){B[C].O.b(B[C],F)}}},j:8(B,C){9 D=i;A.12(A.4.d.s,8(){7(!3.6){a}7(!3.6.r&&3.P&&A.4.q(B,3,3.6.U)){D=3.j.b(3,C)}7(!3.6.r&&3.P&&3.6.g.b(3.5,(B.h||B.5))){3.k=1;3.e=0;3.N.b(3,C)}});a D},1k:8(B,C){7(B.6.1j){A.4.d.18(B,C)}A.12(A.4.d.s,8(){7(3.6.r||3.15||!3.P){a}9 E=A.4.q(B,3,3.6.U);9 G=!E&&3.e==1?"k":(E&&3.e==0?"e":11);7(!G){a}9 F;7(3.6.17){9 D=3.5.1i(".4-c:1h(0)");7(D.10){F=A.16(D[0],"c");F.15=(G=="e"?1:0)}}7(F&&G=="e"){F["e"]=0;F["k"]=1;F.o.b(F,C)}3[G]=1;3[G=="k"?"e":"k"]=0;3[G=="e"?"p":"o"].b(3,C);7(F&&G=="k"){F["k"]=0;F["e"]=1;F.p.b(F,C)}})}};A.4.m.14("c","T",{O:8(C,B){A(3).Z(B.6.T)},N:8(C,B){A(3).M(B.6.T)},j:8(C,B){A(3).M(B.6.T)}});A.4.m.14("c","S",{p:8(C,B){A(3).Z(B.6.S)},o:8(C,B){A(3).M(B.6.S)},j:8(C,B){A(3).M(B.6.S)}})})(1g)',62,114,'|||this|ui|element|options|if|function|var|return|call|droppable|ddmanager|isover|offset|accept|currentItem|false|drop|isout|position|plugin|positionAbs|out|over|intersect|disabled|droppables|height|width|current|top|absolute|left|helperProportions|||||||||||||removeClass|deactivate|activate|visible|break|triggerHandler|hoverClass|activeClass|tolerance|proportions|case|click|clickOffset|addClass|length|null|each|extend|add|greedyChild|data|greedy|prepareOffsets|offsetHeight|offsetWidth|continue|for|true|draggable|helper|jQuery|eq|parents|refreshPositions|drag|sortactivate|dragstart|none|display|css|type|default|touch|pointer|fit|switch|defaults|dropdeactivate|dropactivate|dragging|not|find|dropout|dropover|unbind|removeData|splice|destroy|absolutePosition|plugins|push|is|Function|constructor|init|widget'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.resizable.js b/template-common/lib/ui/ui.resizable.js
new file mode 100644
index 000000000..7b681af55
--- /dev/null
+++ b/template-common/lib/ui/ui.resizable.js
@@ -0,0 +1,770 @@
+/*
+ * jQuery UI Resizable
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
+ init: function() {
+
+ var self = this, o = this.options;
+
+ var elpos = this.element.css('position');
+
+ this.originalElement = this.element;
+
+ // simulate .ui-resizable { position: relative; }
+ this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
+
+ $.extend(o, {
+ _aspectRatio: !!(o.aspectRatio),
+ helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
+ knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
+ });
+
+ //Default Theme
+ var aBorder = '1px solid #DEDEDE';
+
+ o.defaultTheme = {
+ 'ui-resizable': { display: 'block' },
+ 'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },
+ 'ui-resizable-n': { cursor: 'n-resize', height: '4px', left: '0px', right: '0px', borderTop: aBorder },
+ 'ui-resizable-s': { cursor: 's-resize', height: '4px', left: '0px', right: '0px', borderBottom: aBorder },
+ 'ui-resizable-e': { cursor: 'e-resize', width: '4px', top: '0px', bottom: '0px', borderRight: aBorder },
+ 'ui-resizable-w': { cursor: 'w-resize', width: '4px', top: '0px', bottom: '0px', borderLeft: aBorder },
+ 'ui-resizable-se': { cursor: 'se-resize', width: '4px', height: '4px', borderRight: aBorder, borderBottom: aBorder },
+ 'ui-resizable-sw': { cursor: 'sw-resize', width: '4px', height: '4px', borderBottom: aBorder, borderLeft: aBorder },
+ 'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },
+ 'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
+ };
+
+ o.knobTheme = {
+ 'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
+ 'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },
+ 'ui-resizable-s': { cursor: 's-resize', bottom: '0px', left: '45%' },
+ 'ui-resizable-e': { cursor: 'e-resize', right: '0px', top: '45%' },
+ 'ui-resizable-w': { cursor: 'w-resize', left: '0px', top: '45%' },
+ 'ui-resizable-se': { cursor: 'se-resize', right: '0px', bottom: '0px' },
+ 'ui-resizable-sw': { cursor: 'sw-resize', left: '0px', bottom: '0px' },
+ 'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },
+ 'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
+ };
+
+ o._nodeName = this.element[0].nodeName;
+
+ //Wrap the element if it cannot hold child nodes
+ if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+ var el = this.element;
+
+ //Opera fixing relative position
+ if (/relative/.test(el.css('position')) && $.browser.opera)
+ el.css({ position: 'relative', top: 'auto', left: 'auto' });
+
+ //Create a wrapper element and set the wrapper to the new current internal element
+ el.wrap(
+ $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( {
+ position: el.css('position'),
+ width: el.outerWidth(),
+ height: el.outerHeight(),
+ top: el.css('top'),
+ left: el.css('left')
+ })
+ );
+
+ var oel = this.element; this.element = this.element.parent();
+
+ // store instance on wrapper
+ this.element.data('resizable', this);
+
+ //Move margins to the wrapper
+ this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
+ marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
+ });
+
+ oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+
+ //Prevent Safari textarea resize
+ if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
+
+ o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
+
+ // avoid IE jump
+ this.element.css({ margin: oel.css('margin') });
+
+ // fix handlers offset
+ this._proportionallyResize();
+ }
+
+ if(!o.handles) o.handles = !$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' };
+ if(o.handles.constructor == String) {
+
+ o.zIndex = o.zIndex || 1000;
+
+ if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
+
+ var n = o.handles.split(","); o.handles = {};
+
+ // insertions are applied when don't have theme loaded
+ var insertionsDefault = {
+ handle: 'position: absolute; display: none; overflow:hidden;',
+ n: 'top: 0pt; width:100%;',
+ e: 'right: 0pt; height:100%;',
+ s: 'bottom: 0pt; width:100%;',
+ w: 'left: 0pt; height:100%;',
+ se: 'bottom: 0pt; right: 0px;',
+ sw: 'bottom: 0pt; left: 0px;',
+ ne: 'top: 0pt; right: 0px;',
+ nw: 'top: 0pt; left: 0px;'
+ };
+
+ for(var i = 0; i < n.length; i++) {
+ var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'),
+ allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});
+
+ // increase zIndex of sw, se, ne, nw axis
+ var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};
+
+ var defCss = (loadDefault ? insertionsDefault[handle] : ''),
+ axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );
+ o.handles[handle] = '.ui-resizable-'+handle;
+
+ this.element.append(
+ //Theme detection, if not loaded, load o.defaultTheme
+ axis.css( loadDefault ? allDefTheme : {} )
+ // Load the knobHandle css, fix width, height, top, left...
+ .css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)
+ );
+ }
+
+ if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
+ }
+
+ this._renderAxis = function(target) {
+ target = target || this.element;
+
+ for(var i in o.handles) {
+ if(o.handles[i].constructor == String)
+ o.handles[i] = $(o.handles[i], this.element).show();
+
+ if (o.transparent)
+ o.handles[i].css({opacity:0});
+
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+ if (this.element.is('.ui-wrapper') &&
+ o._nodeName.match(/textarea|input|select|button/i)) {
+
+ var axis = $(o.handles[i], this.element), padWrapper = 0;
+
+ //Checking the correct pad and border
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+ //The padding type i have to apply...
+ var padPos = [ 'padding',
+ /ne|nw|n/.test(i) ? 'Top' :
+ /se|sw|s/.test(i) ? 'Bottom' :
+ /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+
+ if (!o.transparent)
+ target.css(padPos, padWrapper);
+
+ this._proportionallyResize();
+ }
+ if(!$(o.handles[i]).length) continue;
+ }
+ };
+
+ this._renderAxis(this.element);
+ o._handles = $('.ui-resizable-handle', self.element);
+
+ if (o.disableSelection)
+ o._handles.each(function(i, e) { $.ui.disableSelection(e); });
+
+ //Matching axis name
+ o._handles.mouseover(function() {
+ if (!o.resizing) {
+ if (this.className)
+ var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+ //Axis, default = se
+ self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
+ }
+ });
+
+ //If we want to auto hide the elements
+ if (o.autoHide) {
+ o._handles.hide();
+ $(self.element).addClass("ui-resizable-autohide").hover(function() {
+ $(this).removeClass("ui-resizable-autohide");
+ o._handles.show();
+ },
+ function(){
+ if (!o.resizing) {
+ $(this).addClass("ui-resizable-autohide");
+ o._handles.hide();
+ }
+ });
+ }
+
+ this.mouseInit();
+ },
+ plugins: {},
+ ui: function() {
+ return {
+ originalElement: this.originalElement,
+ element: this.element,
+ helper: this.helper,
+ position: this.position,
+ size: this.size,
+ options: this.options,
+ originalSize: this.originalSize,
+ originalPosition: this.originalPosition
+ };
+ },
+ propagate: function(n,e) {
+ $.ui.plugin.call(this, n, [e, this.ui()]);
+ if (n != "resize") this.element.triggerHandler(["resize", n].join(""), [e, this.ui()], this.options[n]);
+ },
+ destroy: function() {
+ var el = this.element, wrapped = el.children(".ui-resizable").get(0);
+
+ this.mouseDestroy();
+
+ var _destroy = function(exp) {
+ $(exp).removeClass("ui-resizable ui-resizable-disabled")
+ .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+ };
+
+ _destroy(el);
+
+ if (el.is('.ui-wrapper') && wrapped) {
+ el.parent().append(
+ $(wrapped).css({
+ position: el.css('position'),
+ width: el.outerWidth(),
+ height: el.outerHeight(),
+ top: el.css('top'),
+ left: el.css('left')
+ })
+ ).end().remove();
+
+ _destroy(wrapped);
+ }
+ },
+ mouseStart: function(e) {
+ if(this.options.disabled) return false;
+
+ var handle = false;
+ for(var i in this.options.handles) {
+ if($(this.options.handles[i])[0] == e.target) handle = true;
+ }
+ if (!handle) return false;
+
+ var o = this.options, iniPos = this.element.position(), el = this.element,
+ num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
+ o.resizing = true;
+ o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+
+ // bugfix #1749
+ if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+
+ // sOffset decides if document scrollOffset will be added to the top/left of the resizable element
+ var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));
+ var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;
+
+ el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
+ }
+
+ //Opera fixing relative position
+ if ($.browser.opera && /relative/.test(el.css('position')))
+ el.css({ position: 'relative', top: 'auto', left: 'auto' });
+
+ this._renderProxy();
+
+ var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+
+ if (o.containment) {
+ curleft += $(o.containment).scrollLeft()||0;
+ curtop += $(o.containment).scrollTop()||0;
+ }
+
+ //Store needed variables
+ this.offset = this.helper.offset();
+ this.position = { left: curleft, top: curtop };
+ this.size = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalSize = o.helper || ie6 ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+ this.originalPosition = { left: curleft, top: curtop };
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+ this.originalMousePosition = { left: e.pageX, top: e.pageY };
+
+ //Aspect Ratio
+ o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.height / this.originalSize.width)||1);
+
+ if (o.preserveCursor)
+ $('body').css('cursor', this.axis + '-resize');
+
+ this.propagate("start", e);
+ return true;
+ },
+ mouseDrag: function(e) {
+
+ //Increase performance, avoid regex
+ var el = this.helper, o = this.options, props = {},
+ self = this, smp = this.originalMousePosition, a = this.axis;
+
+ var dx = (e.pageX-smp.left)||0, dy = (e.pageY-smp.top)||0;
+ var trigger = this._change[a];
+ if (!trigger) return false;
+
+ // Calculate the attrs that will be change
+ var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
+
+ if (o._aspectRatio || e.shiftKey)
+ data = this._updateRatio(data, e);
+
+ data = this._respectSize(data, e);
+
+ // plugins callbacks need to be called first
+ this.propagate("resize", e);
+
+ el.css({
+ top: this.position.top + "px", left: this.position.left + "px",
+ width: this.size.width + "px", height: this.size.height + "px"
+ });
+
+ if (!o.helper && o.proportionallyResize)
+ this._proportionallyResize();
+
+ this._updateCache(data);
+
+ // calling the user callback at the end
+ this.element.triggerHandler("resize", [e, this.ui()], this.options["resize"]);
+
+ return false;
+ },
+ mouseStop: function(e) {
+
+ this.options.resizing = false;
+ var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
+
+ if(o.helper) {
+ var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
+ soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+ soffsetw = ista ? 0 : self.sizeDiff.width;
+
+ var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
+
+ if (!o.animate)
+ this.element.css($.extend(s, { top: top, left: left }));
+
+ if (o.helper && !o.animate) this._proportionallyResize();
+ }
+
+ if (o.preserveCursor)
+ $('body').css('cursor', 'auto');
+
+ this.propagate("stop", e);
+
+ if (o.helper) this.helper.remove();
+
+ return false;
+ },
+ _updateCache: function(data) {
+ var o = this.options;
+ this.offset = this.helper.offset();
+ if (data.left) this.position.left = data.left;
+ if (data.top) this.position.top = data.top;
+ if (data.height) this.size.height = data.height;
+ if (data.width) this.size.width = data.width;
+ },
+ _updateRatio: function(data, e) {
+ var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+
+ if (data.height) data.width = (csize.height / o.aspectRatio);
+ else if (data.width) data.height = (csize.width * o.aspectRatio);
+
+ if (a == 'sw') {
+ data.left = cpos.left + (csize.width - data.width);
+ data.top = null;
+ }
+ if (a == 'nw') {
+ data.top = cpos.top + (csize.height - data.height);
+ data.left = cpos.left + (csize.width - data.width);
+ }
+
+ return data;
+ },
+ _respectSize: function(data, e) {
+
+ var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis,
+ ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,
+ isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;
+
+ if (isminw) data.width = o.minWidth;
+ if (isminh) data.height = o.minHeight;
+ if (ismaxw) data.width = o.maxWidth;
+ if (ismaxh) data.height = o.maxHeight;
+
+ var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+ var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+
+ if (isminw && cw) data.left = dw - o.minWidth;
+ if (ismaxw && cw) data.left = dw - o.maxWidth;
+ if (isminh && ch) data.top = dh - o.minHeight;
+ if (ismaxh && ch) data.top = dh - o.maxHeight;
+
+ // fixing jump error on top/left - bug #2330
+ var isNotwh = !data.width && !data.height;
+ if (isNotwh && !data.left && data.top) data.top = null;
+ else if (isNotwh && !data.top && data.left) data.left = null;
+
+ return data;
+ },
+ _proportionallyResize: function() {
+ var o = this.options;
+ if (!o.proportionallyResize) return;
+ var prel = o.proportionallyResize, el = this.helper || this.element;
+
+ if (!o.borderDif) {
+ var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+ p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+
+ o.borderDif = $.map(b, function(v, i) {
+ var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+ return border + padding;
+ });
+ }
+ prel.css({
+ height: (el.height() - o.borderDif[0] - o.borderDif[2]) + "px",
+ width: (el.width() - o.borderDif[1] - o.borderDif[3]) + "px"
+ });
+ },
+ _renderProxy: function() {
+ var el = this.element, o = this.options;
+ this.elementOffset = el.offset();
+
+ if(o.helper) {
+ this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+
+ // fix ie6 offset
+ var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
+ pxyoffset = ( ie6 ? 2 : -1 );
+
+ this.helper.addClass(o.helper).css({
+ width: el.outerWidth() + pxyoffset,
+ height: el.outerHeight() + pxyoffset,
+ position: 'absolute',
+ left: this.elementOffset.left - ie6offset +'px',
+ top: this.elementOffset.top - ie6offset +'px',
+ zIndex: ++o.zIndex
+ });
+
+ this.helper.appendTo("body");
+
+ if (o.disableSelection)
+ $.ui.disableSelection(this.helper.get(0));
+
+ } else {
+ this.helper = el;
+ }
+ },
+ _change: {
+ e: function(e, dx, dy) {
+ return { width: this.originalSize.width + dx };
+ },
+ w: function(e, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { left: sp.left + dx, width: cs.width - dx };
+ },
+ n: function(e, dx, dy) {
+ var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+ return { top: sp.top + dy, height: cs.height - dy };
+ },
+ s: function(e, dx, dy) {
+ return { height: this.originalSize.height + dy };
+ },
+ se: function(e, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));
+ },
+ sw: function(e, dx, dy) {
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));
+ },
+ ne: function(e, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [e, dx, dy]));
+ },
+ nw: function(e, dx, dy) {
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [e, dx, dy]));
+ }
+ }
+}));
+
+$.extend($.ui.resizable, {
+ defaults: {
+ cancel: ":input",
+ distance: 1,
+ delay: 0,
+ preventDefault: true,
+ transparent: false,
+ minWidth: 10,
+ minHeight: 10,
+ aspectRatio: false,
+ disableSelection: true,
+ preserveCursor: true,
+ autoHide: false,
+ knobHandles: false
+ }
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "containment", {
+
+ start: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable"), el = self.element;
+ var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+ if (!ce) return;
+
+ self.containerElement = $(ce);
+
+ if (/document/.test(oc) || oc == document) {
+ self.containerOffset = { left: 0, top: 0 };
+ self.containerPosition = { left: 0, top: 0 };
+
+ self.parentData = {
+ element: $(document), left: 0, top: 0,
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+ };
+ }
+
+
+ // i'm a node, so compute top, left, right, bottom
+ else{
+ self.containerOffset = $(ce).offset();
+ self.containerPosition = $(ce).position();
+ self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };
+
+ var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+
+ self.parentData = {
+ element: ce, left: co.left, top: co.top, width: width, height: height
+ };
+ }
+ },
+
+ resize: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable"),
+ ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
+ pRatio = o._aspectRatio || e.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
+
+ if (ce[0] != document && /static/.test(ce.css('position')))
+ cop = self.containerPosition;
+
+ if (cp.left < (o.helper ? co.left : cop.left)) {
+ self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
+ if (pRatio) self.size.height = self.size.width * o.aspectRatio;
+ self.position.left = o.helper ? co.left : cop.left;
+ }
+
+ if (cp.top < (o.helper ? co.top : 0)) {
+ self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
+ if (pRatio) self.size.width = self.size.height / o.aspectRatio;
+ self.position.top = o.helper ? co.top : 0;
+ }
+
+ var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
+ hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
+
+ if (woset + self.size.width >= self.parentData.width) {
+ self.size.width = self.parentData.width - woset;
+ if (pRatio) self.size.height = self.size.width * o.aspectRatio;
+ }
+
+ if (hoset + self.size.height >= self.parentData.height) {
+ self.size.height = self.parentData.height - hoset;
+ if (pRatio) self.size.width = self.size.height / o.aspectRatio;
+ }
+ },
+
+ stop: function(e, ui){
+ var o = ui.options, self = $(this).data("resizable"), cp = self.position,
+ co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
+
+ var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
+
+
+ if (o.helper && !o.animate && /relative/.test(ce.css('position')))
+ $(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });
+
+ if (o.helper && !o.animate && /static/.test(ce.css('position')))
+ $(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });
+
+ }
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+ resize: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey;
+ o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+ var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+
+ if (/^(se|s|e)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ }
+ else if (/^(ne)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.top = op.top - oy;
+ }
+ else if (/^(sw)$/.test(a)) {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.left = op.left - ox;
+ }
+ else {
+ self.size.width = os.width + ox;
+ self.size.height = os.height + oy;
+ self.position.top = op.top - oy;
+ self.position.left = op.left - ox;
+ }
+ }
+
+});
+
+$.ui.plugin.add("resizable", "animate", {
+
+ stop: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable");
+
+ var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
+ soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
+ soffsetw = ista ? 0 : self.sizeDiff.width;
+
+ var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
+ left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
+ top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
+
+ self.element.animate(
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
+ duration: o.animateDuration || "slow", easing: o.animateEasing || "swing",
+ step: function() {
+
+ var data = {
+ width: parseInt(self.element.css('width'), 10),
+ height: parseInt(self.element.css('height'), 10),
+ top: parseInt(self.element.css('top'), 10),
+ left: parseInt(self.element.css('left'), 10)
+ };
+
+ if (pr) pr.css({ width: data.width, height: data.height });
+
+ // propagating resize, and updating values for each animation step
+ self._updateCache(data);
+ self.propagate("animate", e);
+
+ }
+ }
+ );
+ }
+
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+ start: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
+
+ if (!pr) self.ghost = self.element.clone();
+ else self.ghost = pr.clone();
+
+ self.ghost.css(
+ { opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }
+ )
+ .addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');
+
+ self.ghost.appendTo(self.helper);
+
+ },
+
+ resize: function(e, ui){
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
+
+ if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
+
+ },
+
+ stop: function(e, ui){
+ var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
+ if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
+ }
+
+});
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+ start: function(e, ui) {
+ var o = ui.options, self = $(this).data("resizable"),
+
+ _store = function(exp) {
+ $(exp).each(function() {
+ $(this).data("resizable-alsoresize", {
+ width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
+ left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
+ });
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object') {
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+ else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
+ }else{
+ _store(o.alsoResize);
+ }
+ },
+
+ resize: function(e, ui){
+ var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
+
+ var delta = {
+ height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
+ top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
+ },
+
+ _alsoResize = function(exp, c) {
+ $(exp).each(function() {
+ var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
+
+ $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
+ var sum = (start[prop]||0) + (delta[prop]||0);
+ if (sum && sum >= 0)
+ style[prop] = sum || null;
+ });
+ $(this).css(style);
+ });
+ };
+
+ if (typeof(o.alsoResize) == 'object') {
+ $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
+ }else{
+ _alsoResize(o.alsoResize);
+ }
+ },
+
+ stop: function(e, ui){
+ $(this).removeData("resizable-alsoresize-start");
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.resizable.packed.js b/template-common/lib/ui/ui.resizable.packed.js
new file mode 100644
index 000000000..ef0ea0c12
--- /dev/null
+++ b/template-common/lib/ui/ui.resizable.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(h(A){A.4s("b.c",A.19({},A.b.4r,{4q:h(){f M=4,N=4.m;f Q=4.k.d("g");4.2v=4.k;4.k.1j("b-c").d({g:/20/.q(Q)?"1i":Q});A.19(N,{1N:!!(N.1a),l:N.l||N.12||N.1o?N.l||"4p":1g,1m:N.1m===1v?"b-c-1V-13":N.1m});f H="2E 3m #4o";N.3j={"b-c":{1W:"2d"},"b-c-13":{g:"1D",3o:"#3n",4n:"0.2E"},"b-c-n":{t:"n-o",8:"16",5:"p",1s:"p",2F:H},"b-c-s":{t:"s-o",8:"16",5:"p",1s:"p",2I:H},"b-c-e":{t:"e-o",6:"16",9:"p",1t:"p",2H:H},"b-c-w":{t:"w-o",6:"16",9:"p",1t:"p",2G:H},"b-c-y":{t:"y-o",6:"16",8:"16",2H:H,2I:H},"b-c-x":{t:"x-o",6:"16",8:"16",2I:H,2G:H},"b-c-Z":{t:"Z-o",6:"16",8:"16",2H:H,2F:H},"b-c-z":{t:"z-o",6:"16",8:"16",2G:H,2F:H}};N.2z={"b-c-13":{3o:"#3n",4m:"2E 3m #4l",8:"3l",6:"3l"},"b-c-n":{t:"n-o",9:"p",5:"45%"},"b-c-s":{t:"s-o",1t:"p",5:"45%"},"b-c-e":{t:"e-o",1s:"p",9:"45%"},"b-c-w":{t:"w-o",5:"p",9:"45%"},"b-c-y":{t:"y-o",1s:"p",1t:"p"},"b-c-x":{t:"x-o",5:"p",1t:"p"},"b-c-z":{t:"z-o",5:"p",9:"p"},"b-c-Z":{t:"Z-o",1s:"p",9:"p"}};N.2y=4.k[0].2f;a(N.2y.2x(/4k|1Y|2j|3f|3e|4j/i)){f B=4.k;a(/1i/.q(B.d("g"))&&A.1f.35){B.d({g:"1i",9:"1U",5:"1U"})}B.4i(A(\'<1E 3i="b-2t" 2o="2n: 2m;"></1E>\').d({g:B.d("g"),6:B.1x(),8:B.1w(),9:B.d("9"),5:B.d("5")}));f J=4.k;4.k=4.k.1P();4.k.11("c",4);4.k.d({2D:J.d("2D"),2C:J.d("2C"),2B:J.d("2B"),2A:J.d("2A")});J.d({2D:0,2C:0,2B:0,2A:0});a(A.1f.4h&&N.2V){J.d("o","3k")}N.1h=J.d({g:"20",4g:1,1W:"2d"});4.k.d({2c:J.d("2c")});4.1T()}a(!N.u){N.u=!A(".b-c-13",4.k).1K?"e,s,y":{n:".b-c-n",e:".b-c-e",s:".b-c-s",w:".b-c-w",y:".b-c-y",x:".b-c-x",Z:".b-c-Z",z:".b-c-z"}}a(N.u.3h==3g){N.1C=N.1C||4f;a(N.u=="4e"){N.u="n,e,s,w,y,x,Z,z"}f O=N.u.4d(",");N.u={};f G={13:"g: 1D; 1W: 3k; 2n:2m;",n:"9: 1r; 6:2a%;",e:"1s: 1r; 8:2a%;",s:"1t: 1r; 6:2a%;",w:"5: 1r; 8:2a%;",y:"1t: 1r; 1s: p;",x:"1t: 1r; 5: p;",Z:"9: 1r; 1s: p;",z:"9: 1r; 5: p;"};2s(f R=0;R<O.1K;R++){f S=A.4c(O[R]),L=N.3j,F="b-c-"+S,C=!A.b.d(F)&&!N.1m,P=A.b.d("b-c-1V-13"),T=A.19(L[F],L["b-c-13"]),D=A.19(N.2z[F],!P?N.2z["b-c-13"]:{});f K=/x|y|Z|z/.q(S)?{1C:++N.1C}:{};f I=(C?G[S]:""),E=A([\'<1E 3i="b-c-13 \',F,\'" 2o="\',I,G.13,\'"></1E>\'].2u("")).d(K);N.u[S]=".b-c-"+S;4.k.38(E.d(C?T:{}).d(N.1m?D:{}).1j(N.1m?"b-c-1V-13":"").1j(N.1m))}a(N.1m){4.k.1j("b-c-1V").d(!A.b.d("b-c-1V")?{}:{})}}4.3d=h(Y){Y=Y||4.k;2s(f V 36 N.u){a(N.u[V].3h==3g){N.u[V]=A(N.u[V],4.k).3b()}a(N.2i){N.u[V].d({2M:0})}a(4.k.2r(".b-2t")&&N.2y.2x(/1Y|2j|3f|3e/i)){f W=A(N.u[V],4.k),X=0;X=/x|Z|z|y|n|s/.q(V)?W.1w():W.1x();f U=["4b",/Z|z|n/.q(V)?"4a":/y|x|s/.q(V)?"49":/^e$/.q(V)?"48":"47"].2u("");a(!N.2i){Y.d(U,X)}4.1T()}a(!A(N.u[V]).1K){46}}};4.3d(4.k);N.1G=A(".b-c-13",M.k);a(N.1Q){N.1G.1y(h(U,V){A.b.1Q(V)})}N.1G.44(h(){a(!N.29){a(4.3c){f U=4.3c.2x(/b-c-(y|x|Z|z|n|e|s|w)/i)}M.1u=N.1u=U&&U[1]?U[1]:"y"}});a(N.2U){N.1G.3a();A(M.k).1j("b-c-2w").43(h(){A(4).39("b-c-2w");N.1G.3b()},h(){a(!N.29){A(4).1j("b-c-2w");N.1G.3a()}})}4.42()},41:{},b:h(){r{2v:4.2v,k:4.k,l:4.l,g:4.g,j:4.j,m:4.m,15:4.15,14:4.14}},1M:h(C,B){A.b.1z.40(4,C,[B,4.b()]);a(C!="o"){4.k.2Z(["o",C].2u(""),[B,4.b()],4.m[C])}},3Z:h(){f D=4.k,C=D.3Y(".b-c").1c(0);4.3X();f B=h(E){A(E).39("b-c b-c-37").2J("c").3W(".c").3V(".b-c-13").2p()};B(D);a(D.2r(".b-2t")&&C){D.1P().38(A(C).d({g:D.d("g"),6:D.1x(),8:D.1w(),9:D.d("9"),5:D.d("5")})).3U().2p();B(C)}},3T:h(K){a(4.m.37){r 1b}f J=1b;2s(f H 36 4.m.u){a(A(4.m.u[H])[0]==K.3S){J=1v}}a(!J){r 1b}f C=4.m,B=4.k.g(),D=4.k,I=h(O){r v(O,10)||0},G=A.1f.26&&A.1f.2l<7;C.29=1v;C.2q={9:A(1l).33(),5:A(1l).34()};a(D.2r(".b-3R")||(/1D/).q(D.d("g"))){f M=A.1f.26&&!C.1B&&(/1D/).q(D.d("g"))&&!(/1i/).q(D.1P().d("g"));f L=M?C.2q.9:0,F=M?C.2q.5:0;D.d({g:"1D",9:(B.9+L),5:(B.5+F)})}a(A.1f.35&&/1i/.q(D.d("g"))){D.d({g:"1i",9:"1U",5:"1U"})}4.2W();f N=I(4.l.d("5")),E=I(4.l.d("9"));a(C.1B){N+=A(C.1B).34()||0;E+=A(C.1B).33()||0}4.1k=4.l.1k();4.g={5:N,9:E};4.j=C.l||G?{6:D.1x(),8:D.1w()}:{6:D.6(),8:D.8()};4.15=C.l||G?{6:D.1x(),8:D.1w()}:{6:D.6(),8:D.8()};4.14={5:N,9:E};4.1p={6:D.1x()-D.6(),8:D.1w()-D.8()};4.32={5:K.31,9:K.30};C.1a=(1J C.1a=="2Q")?C.1a:((4.15.8/4.15.6)||1);a(C.2h){A("23").d("t",4.1u+"-o")}4.1M("1H",K);r 1v},3Q:h(I){f D=4.l,C=4.m,J={},M=4,F=4.32,K=4.1u;f N=(I.31-F.5)||0,L=(I.30-F.9)||0;f E=4.1e[K];a(!E){r 1b}f H=E.1n(4,[I,N,L]),G=A.1f.26&&A.1f.2l<7,B=4.1p;a(C.1N||I.1Z){H=4.2Y(H,I)}H=4.2X(H,I);4.1M("o",I);D.d({9:4.g.9+"1q",5:4.g.5+"1q",6:4.j.6+"1q",8:4.j.8+"1q"});a(!C.l&&C.1h){4.1T()}4.2e(H);4.k.2Z("o",[I,4.b()],4.m["o"]);r 1b},3P:h(I){4.m.29=1b;f E=4.m,H=h(M){r v(M,10)||0},K=4;a(E.l){f D=E.1h,B=D&&(/1Y/i).q(D.1c(0).2f),C=B&&A.b.1X(D.1c(0),"5")?0:K.1p.8,G=B?0:K.1p.6;f L={6:(K.j.6-G),8:(K.j.8-C)},F=(v(K.k.d("5"),10)+(K.g.5-K.14.5))||1g,J=(v(K.k.d("9"),10)+(K.g.9-K.14.9))||1g;a(!E.1o){4.k.d(A.19(L,{9:J,5:F}))}a(E.l&&!E.1o){4.1T()}}a(E.2h){A("23").d("t","1U")}4.1M("1I",I);a(E.l){4.l.2p()}r 1b},2e:h(B){f C=4.m;4.1k=4.l.1k();a(B.5){4.g.5=B.5}a(B.9){4.g.9=B.9}a(B.8){4.j.8=B.8}a(B.6){4.j.6=B.6}},2Y:h(D,E){f F=4.m,G=4.g,C=4.j,B=4.1u;a(D.8){D.6=(C.8/F.1a)}18{a(D.6){D.8=(C.6*F.1a)}}a(B=="x"){D.5=G.5+(C.6-D.6);D.9=1g}a(B=="z"){D.9=G.9+(C.8-D.8);D.5=G.5+(C.6-D.6)}r D},2X:h(H,I){f F=4.l,E=4.m,N=E.1N||I.1Z,M=4.1u,P=H.6&&E.28&&E.28<H.6,J=H.8&&E.27&&E.27<H.8,D=H.6&&E.1S&&E.1S>H.6,O=H.8&&E.1R&&E.1R>H.8;a(D){H.6=E.1S}a(O){H.8=E.1R}a(P){H.6=E.28}a(J){H.8=E.27}f C=4.14.5+4.15.6,L=4.g.9+4.j.8;f G=/x|z|w/.q(M),B=/z|Z|n/.q(M);a(D&&G){H.5=C-E.1S}a(P&&G){H.5=C-E.28}a(O&&B){H.9=L-E.1R}a(J&&B){H.9=L-E.27}f K=!H.6&&!H.8;a(K&&!H.5&&H.9){H.9=1g}18{a(K&&!H.9&&H.5){H.5=1g}}r H},1T:h(){f F=4.m;a(!F.1h){r}f D=F.1h,C=4.l||4.k;a(!F.1F){f B=[D.d("3O"),D.d("3N"),D.d("3M"),D.d("3L")],E=[D.d("3K"),D.d("3J"),D.d("3I"),D.d("3H")];F.1F=A.3G(B,h(G,I){f H=v(G,10)||0,J=v(E[I],10)||0;r H+J})}D.d({8:(C.8()-F.1F[0]-F.1F[2])+"1q",6:(C.6()-F.1F[1]-F.1F[3])+"1q"})},2W:h(){f C=4.k,F=4.m;4.2k=C.1k();a(F.l){4.l=4.l||A(\'<1E 2o="2n:2m;"></1E>\');f B=A.1f.26&&A.1f.2l<7,D=(B?1:0),E=(B?2:-1);4.l.1j(F.l).d({6:C.1x()+E,8:C.1w()+E,g:"1D",5:4.2k.5-D+"1q",9:4.2k.9-D+"1q",1C:++F.1C});4.l.2L("23");a(F.1Q){A.b.1Q(4.l.1c(0))}}18{4.l=C}},1e:{e:h(D,C,B){r{6:4.15.6+C}},w:h(F,C,B){f G=4.m,D=4.15,E=4.14;r{5:E.5+C,6:D.6-C}},n:h(F,C,B){f G=4.m,D=4.15,E=4.14;r{9:E.9+B,8:D.8-B}},s:h(D,C,B){r{8:4.15.8+B}},y:h(D,C,B){r A.19(4.1e.s.1n(4,24),4.1e.e.1n(4,[D,C,B]))},x:h(D,C,B){r A.19(4.1e.s.1n(4,24),4.1e.w.1n(4,[D,C,B]))},Z:h(D,C,B){r A.19(4.1e.n.1n(4,24),4.1e.e.1n(4,[D,C,B]))},z:h(D,C,B){r A.19(4.1e.n.1n(4,24),4.1e.w.1n(4,[D,C,B]))}}}));A.19(A.b.c,{3F:{3E:":2j",3D:1,3C:0,2V:1v,2i:1b,1S:10,1R:10,1a:1b,1Q:1v,2h:1v,2U:1b,1m:1b}});A.b.1z.1L("c","1B",{1H:h(I,K){f E=K.m,M=A(4).11("c"),G=M.k;f C=E.1B,F=(C 3B A)?C.1c(0):(/1P/.q(C))?G.1P().1c(0):C;a(!F){r}M.2g=A(F);a(/1l/.q(C)||C==1l){M.1O={5:0,9:0};M.21={5:0,9:0};M.1A={k:A(1l),5:0,9:0,6:A(1l).6(),8:A(1l).8()||1l.23.3A.2T}}18{M.1O=A(F).1k();M.21=A(F).g();M.22={8:A(F).2R(),6:A(F).2S()};f J=M.1O,B=M.22.8,H=M.22.6,D=(A.b.1X(F,"5")?F.3z:H),L=(A.b.1X(F)?F.2T:B);M.1A={k:F,5:J.5,9:J.9,6:D,8:L}}},o:h(H,K){f E=K.m,N=A(4).11("c"),C=N.22,J=N.1O,G=N.j,I=N.g,L=E.1N||H.1Z,B={9:0,5:0},D=N.2g;a(D[0]!=1l&&/20/.q(D.d("g"))){B=N.21}a(I.5<(E.l?J.5:B.5)){N.j.6=N.j.6+(E.l?(N.g.5-J.5):(N.g.5-B.5));a(L){N.j.8=N.j.6*E.1a}N.g.5=E.l?J.5:B.5}a(I.9<(E.l?J.9:0)){N.j.8=N.j.8+(E.l?(N.g.9-J.9):N.g.9);a(L){N.j.6=N.j.8/E.1a}N.g.9=E.l?J.9:0}f F=(E.l?N.1k.5-J.5:(N.g.5-B.5))+N.1p.6,M=(E.l?N.1k.9-J.9:N.g.9)+N.1p.8;a(F+N.j.6>=N.1A.6){N.j.6=N.1A.6-F;a(L){N.j.8=N.j.6*E.1a}}a(M+N.j.8>=N.1A.8){N.j.8=N.1A.8-M;a(L){N.j.6=N.j.8/E.1a}}},1I:h(G,J){f C=J.m,L=A(4).11("c"),H=L.g,I=L.1O,B=L.21,D=L.2g;f E=A(L.l),M=E.1k(),K=E.2S(),F=E.2R();a(C.l&&!C.1o&&/1i/.q(D.d("g"))){A(4).d({5:(M.5-I.5),9:(M.9-I.9),6:K,8:F})}a(C.l&&!C.1o&&/20/.q(D.d("g"))){A(4).d({5:B.5+(M.5-I.5),9:B.9+(M.9-I.9),6:K,8:F})}}});A.b.1z.1L("c","1d",{o:h(H,J){f D=J.m,L=A(4).11("c"),G=L.j,E=L.15,F=L.14,K=L.1u,I=D.1N||H.1Z;D.1d=1J D.1d=="2Q"?[D.1d,D.1d]:D.1d;f C=2P.2O((G.6-E.6)/(D.1d[0]||1))*(D.1d[0]||1),B=2P.2O((G.8-E.8)/(D.1d[1]||1))*(D.1d[1]||1);a(/^(y|s|e)$/.q(K)){L.j.6=E.6+C;L.j.8=E.8+B}18{a(/^(Z)$/.q(K)){L.j.6=E.6+C;L.j.8=E.8+B;L.g.9=F.9-B}18{a(/^(x)$/.q(K)){L.j.6=E.6+C;L.j.8=E.8+B;L.g.5=F.5-C}18{L.j.6=E.6+C;L.j.8=E.8+B;L.g.9=F.9-B;L.g.5=F.5-C}}}}});A.b.1z.1L("c","1o",{1I:h(I,K){f F=K.m,L=A(4).11("c");f E=F.1h,B=E&&(/1Y/i).q(E.1c(0).2f),C=B&&A.b.1X(E.1c(0),"5")?0:L.1p.8,H=B?0:L.1p.6;f D={6:(L.j.6-H),8:(L.j.8-C)},G=(v(L.k.d("5"),10)+(L.g.5-L.14.5))||1g,J=(v(L.k.d("9"),10)+(L.g.9-L.14.9))||1g;L.k.1o(A.19(D,J&&G?{9:J,5:G}:{}),{3y:F.3x||"3w",3v:F.3u||"3t",3s:h(){f M={6:v(L.k.d("6"),10),8:v(L.k.d("8"),10),9:v(L.k.d("9"),10),5:v(L.k.d("5"),10)};a(E){E.d({6:M.6,8:M.8})}L.2e(M);L.1M("1o",I)}})}});A.b.1z.1L("c","12",{1H:h(E,D){f F=D.m,B=A(4).11("c"),G=F.1h,C=B.j;a(!G){B.12=B.k.2N()}18{B.12=G.2N()}B.12.d({2M:0.25,1W:"2d",g:"1i",8:C.8,6:C.6,2c:0,5:0,9:0}).1j("b-c-12").1j(1J F.12=="3r"?F.12:"");B.12.2L(B.l)},o:h(D,C){f E=C.m,B=A(4).11("c"),F=E.1h;a(B.12){B.12.d({g:"1i",8:B.j.8,6:B.j.6})}},1I:h(D,C){f E=C.m,B=A(4).11("c"),F=E.1h;a(B.12&&B.l){B.l.1c(0).3q(B.12.1c(0))}}});A.b.1z.1L("c","17",{1H:h(E,C){f F=C.m,B=A(4).11("c"),D=h(G){A(G).1y(h(){A(4).11("c-2b",{6:v(A(4).6(),10),8:v(A(4).8(),10),5:v(A(4).d("5"),10),9:v(A(4).d("9"),10)})})};a(1J(F.17)=="2K"){a(F.17.1K){F.17=F.17[0];D(F.17)}18{A.1y(F.17,h(G,H){D(G)})}}18{D(F.17)}},o:h(F,E){f G=E.m,C=A(4).11("c"),D=C.15,I=C.14;f H={8:(C.j.8-D.8)||0,6:(C.j.6-D.6)||0,9:(C.g.9-I.9)||0,5:(C.g.5-I.5)||0},B=h(J,K){A(J).1y(h(){f N=A(4).11("c-2b"),M={},L=K&&K.1K?K:["6","8","9","5"];A.1y(L||["6","8","9","5"],h(O,Q){f P=(N[Q]||0)+(H[Q]||0);a(P&&P>=0){M[Q]=P||1g}});A(4).d(M)})};a(1J(G.17)=="2K"){A.1y(G.17,h(J,K){B(J,K)})}18{B(G.17)}},1I:h(C,B){A(4).2J("c-2b-1H")}})})(3p)',62,277,'||||this|left|width||height|top|if|ui|resizable|css||var|position|function||size|element|helper|options||resize|0px|test|return||cursor|handles|parseInt||sw|se|nw||||||||||||||||||||||||||ne||data|ghost|handle|originalPosition|originalSize|4px|alsoResize|else|extend|aspectRatio|false|get|grid|_change|browser|null|proportionallyResize|relative|addClass|offset|document|knobHandles|apply|animate|sizeDiff|px|0pt|right|bottom|axis|true|outerHeight|outerWidth|each|plugin|parentData|containment|zIndex|absolute|div|borderDif|_handles|start|stop|typeof|length|add|propagate|_aspectRatio|containerOffset|parent|disableSelection|minHeight|minWidth|_proportionallyResize|auto|knob|display|hasScroll|textarea|shiftKey|static|containerPosition|containerSize|body|arguments||msie|maxHeight|maxWidth|resizing|100|alsoresize|margin|block|_updateCache|nodeName|containerElement|preserveCursor|transparent|input|elementOffset|version|hidden|overflow|style|remove|documentScroll|is|for|wrapper|join|originalElement|autohide|match|_nodeName|knobTheme|marginBottom|marginRight|marginTop|marginLeft|1px|borderTop|borderLeft|borderRight|borderBottom|removeData|object|appendTo|opacity|clone|round|Math|number|innerHeight|innerWidth|scrollHeight|autoHide|preventDefault|_renderProxy|_respectSize|_updateRatio|triggerHandler|pageY|pageX|originalMousePosition|scrollTop|scrollLeft|opera|in|disabled|append|removeClass|hide|show|className|_renderAxis|button|select|String|constructor|class|defaultTheme|none|8px|solid|F2F2F2|background|jQuery|removeChild|string|step|swing|animateEasing|easing|slow|animateDuration|duration|scrollWidth|parentNode|instanceof|delay|distance|cancel|defaults|map|paddingLeft|paddingBottom|paddingRight|paddingTop|borderLeftWidth|borderBottomWidth|borderRightWidth|borderTopWidth|mouseStop|mouseDrag|draggable|target|mouseStart|end|find|unbind|mouseDestroy|children|destroy|call|plugins|mouseInit|hover|mouseover||continue|Left|Right|Bottom|Top|padding|trim|split|all|1000|zoom|safari|wrap|img|canvas|808080|border|fontSize|DEDEDE|proxy|init|mouse|widget'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.selectable.js b/template-common/lib/ui/ui.selectable.js
new file mode 100644
index 000000000..814e7d48e
--- /dev/null
+++ b/template-common/lib/ui/ui.selectable.js
@@ -0,0 +1,264 @@
+/*
+ * jQuery UI Selectable
+ *
+ * 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/Selectables
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
+ init: function() {
+ var self = this;
+
+ this.element.addClass("ui-selectable");
+
+ this.dragged = false;
+
+ // cache selectee children based on filter
+ var selectees;
+ this.refresh = function() {
+ selectees = $(self.options.filter, self.element[0]);
+ selectees.each(function() {
+ var $this = $(this);
+ var pos = $this.offset();
+ $.data(this, "selectable-item", {
+ element: this,
+ $element: $this,
+ left: pos.left,
+ top: pos.top,
+ right: pos.left + $this.width(),
+ bottom: pos.top + $this.height(),
+ startselected: false,
+ selected: $this.hasClass('ui-selected'),
+ selecting: $this.hasClass('ui-selecting'),
+ unselecting: $this.hasClass('ui-unselecting')
+ });
+ });
+ };
+ this.refresh();
+
+ this.selectees = selectees.addClass("ui-selectee");
+
+ this.mouseInit();
+
+ this.helper = $(document.createElement('div')).css({border:'1px dotted black'});
+ },
+ toggle: function() {
+ if(this.options.disabled){
+ this.enable();
+ } else {
+ this.disable();
+ }
+ },
+ destroy: function() {
+ this.element
+ .removeClass("ui-selectable ui-selectable-disabled")
+ .removeData("selectable")
+ .unbind(".selectable");
+ this.mouseDestroy();
+ },
+ mouseStart: function(e) {
+ var self = this;
+
+ this.opos = [e.pageX, e.pageY];
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ this.selectees = $(options.filter, this.element[0]);
+
+ // selectable START callback
+ this.element.triggerHandler("selectablestart", [e, {
+ "selectable": this.element[0],
+ "options": options
+ }], options.start);
+
+ $('body').append(this.helper);
+ // position helper (lasso)
+ this.helper.css({
+ "z-index": 100,
+ "position": "absolute",
+ "left": e.clientX,
+ "top": e.clientY,
+ "width": 0,
+ "height": 0
+ });
+
+ if (options.autoRefresh) {
+ this.refresh();
+ }
+
+ this.selectees.filter('.ui-selected').each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.startselected = true;
+ if (!e.ctrlKey) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ self.element.triggerHandler("selectableunselecting", [e, {
+ selectable: self.element[0],
+ unselecting: selectee.element,
+ options: options
+ }], options.unselecting);
+ }
+ });
+
+ var isSelectee = false;
+ $(e.target).parents().andSelf().each(function() {
+ if($.data(this, "selectable-item")) isSelectee = true;
+ });
+ return this.options.keyboard ? !isSelectee : true;
+ },
+ mouseDrag: function(e) {
+ var self = this;
+ this.dragged = true;
+
+ if (this.options.disabled)
+ return;
+
+ var options = this.options;
+
+ var x1 = this.opos[0], y1 = this.opos[1], x2 = e.pageX, y2 = e.pageY;
+ if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+ if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+ this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+ this.selectees.each(function() {
+ var selectee = $.data(this, "selectable-item");
+ //prevent helper from being selected if appendTo: selectable
+ if (!selectee || selectee.element == self.element[0])
+ return;
+ var hit = false;
+ if (options.tolerance == 'touch') {
+ hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+ } else if (options.tolerance == 'fit') {
+ hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+ }
+
+ if (hit) {
+ // SELECT
+ if (selectee.selected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+ }
+ if (selectee.unselecting) {
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ }
+ if (!selectee.selecting) {
+ selectee.$element.addClass('ui-selecting');
+ selectee.selecting = true;
+ // selectable SELECTING callback
+ self.element.triggerHandler("selectableselecting", [e, {
+ selectable: self.element[0],
+ selecting: selectee.element,
+ options: options
+ }], options.selecting);
+ }
+ } else {
+ // UNSELECT
+ if (selectee.selecting) {
+ if (e.ctrlKey && selectee.startselected) {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ selectee.$element.addClass('ui-selected');
+ selectee.selected = true;
+ } else {
+ selectee.$element.removeClass('ui-selecting');
+ selectee.selecting = false;
+ if (selectee.startselected) {
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ }
+ // selectable UNSELECTING callback
+ self.element.triggerHandler("selectableunselecting", [e, {
+ selectable: self.element[0],
+ unselecting: selectee.element,
+ options: options
+ }], options.unselecting);
+ }
+ }
+ if (selectee.selected) {
+ if (!e.ctrlKey && !selectee.startselected) {
+ selectee.$element.removeClass('ui-selected');
+ selectee.selected = false;
+
+ selectee.$element.addClass('ui-unselecting');
+ selectee.unselecting = true;
+ // selectable UNSELECTING callback
+ self.element.triggerHandler("selectableunselecting", [e, {
+ selectable: self.element[0],
+ unselecting: selectee.element,
+ options: options
+ }], options.unselecting);
+ }
+ }
+ }
+ });
+
+ return false;
+ },
+ mouseStop: function(e) {
+ var self = this;
+
+ this.dragged = false;
+
+ var options = this.options;
+
+ $('.ui-unselecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-unselecting');
+ selectee.unselecting = false;
+ selectee.startselected = false;
+ self.element.triggerHandler("selectableunselected", [e, {
+ selectable: self.element[0],
+ unselected: selectee.element,
+ options: options
+ }], options.unselected);
+ });
+ $('.ui-selecting', this.element[0]).each(function() {
+ var selectee = $.data(this, "selectable-item");
+ selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+ selectee.selecting = false;
+ selectee.selected = true;
+ selectee.startselected = true;
+ self.element.triggerHandler("selectableselected", [e, {
+ selectable: self.element[0],
+ selected: selectee.element,
+ options: options
+ }], options.selected);
+ });
+ this.element.triggerHandler("selectablestop", [e, {
+ selectable: self.element[0],
+ options: this.options
+ }], this.options.stop);
+
+ this.helper.remove();
+
+ return false;
+ }
+}));
+
+$.extend($.ui.selectable, {
+ defaults: {
+ distance: 1,
+ delay: 0,
+ cancel: ":input",
+ appendTo: 'body',
+ autoRefresh: true,
+ filter: '*',
+ tolerance: 'touch'
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.selectable.packed.js b/template-common/lib/ui/ui.selectable.packed.js
new file mode 100644
index 000000000..04aa12886
--- /dev/null
+++ b/template-common/lib/ui/ui.selectable.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(d(A){A.1M("4.5",A.V({},A.4.1L,{1K:d(){8 B=2;2.3.h("4-5");2.v=b;8 C;2.Q=d(){C=A(B.9.q,B.3[0]);C.o(d(){8 D=A(2);8 E=D.1J();A.n(2,"5-m",{3:2,$3:D,k:E.k,j:E.j,L:E.k+D.N(),y:E.j+D.M(),i:b,a:D.R("4-a"),c:D.R("4-c"),6:D.R("4-6")})})};2.Q();2.s=C.h("4-1I");2.1H();2.p=A(1G.1F("1E")).O({1D:"1C 1B 1A"})},1z:d(){7(2.9.t){2.1y()}r{2.1x()}},1w:d(){2.3.f("4-5 4-5-t").1v("5").1u(".5");2.1t()},1s:d(E){8 C=2;2.P=[E.Y,E.X];7(2.9.t){l}8 D=2.9;2.s=A(D.q,2.3[0]);2.3.g("1r",[E,{"5":2.3[0],"9":D}],D.1q);A("U").1p(2.p);2.p.O({"z-1o":1n,"1m":"1l","k":E.1k,"j":E.1j,"N":0,"M":0});7(D.T){2.Q()}2.s.q(".4-a").o(d(){8 F=A.n(2,"5-m");F.i=e;7(!E.x){F.$3.f("4-a");F.a=b;F.$3.h("4-6");F.6=e;C.3.g("w",[E,{5:C.3[0],6:F.3,9:D}],D.6)}});8 B=b;A(E.1i).1h().1g().o(d(){7(A.n(2,"5-m")){B=e}});l 2.9.1f?!B:e},1e:d(I){8 C=2;2.v=e;7(2.9.t){l}8 E=2.9;8 D=2.P[0],H=2.P[1],B=I.Y,G=I.X;7(D>B){8 F=B;B=D;D=F}7(H>G){8 F=G;G=H;H=F}2.p.O({k:D,j:H,N:B-D,M:G-H});2.s.o(d(){8 J=A.n(2,"5-m");7(!J||J.3==C.3[0]){l}8 K=b;7(E.u=="S"){K=(!(J.k>B||J.L<D||J.j>G||J.y<H))}r{7(E.u=="1d"){K=(J.k>D&&J.L<B&&J.j>H&&J.y<G)}}7(K){7(J.a){J.$3.f("4-a");J.a=b}7(J.6){J.$3.f("4-6");J.6=b}7(!J.c){J.$3.h("4-c");J.c=e;C.3.g("1c",[I,{5:C.3[0],c:J.3,9:E}],E.c)}}r{7(J.c){7(I.x&&J.i){J.$3.f("4-c");J.c=b;J.$3.h("4-a");J.a=e}r{J.$3.f("4-c");J.c=b;7(J.i){J.$3.h("4-6");J.6=e}C.3.g("w",[I,{5:C.3[0],6:J.3,9:E}],E.6)}}7(J.a){7(!I.x&&!J.i){J.$3.f("4-a");J.a=b;J.$3.h("4-6");J.6=e;C.3.g("w",[I,{5:C.3[0],6:J.3,9:E}],E.6)}}}});l b},1b:d(D){8 B=2;2.v=b;8 C=2.9;A(".4-6",2.3[0]).o(d(){8 E=A.n(2,"5-m");E.$3.f("4-6");E.6=b;E.i=b;B.3.g("1a",[D,{5:B.3[0],W:E.3,9:C}],C.W)});A(".4-c",2.3[0]).o(d(){8 E=A.n(2,"5-m");E.$3.f("4-c").h("4-a");E.c=b;E.a=e;E.i=e;B.3.g("19",[D,{5:B.3[0],a:E.3,9:C}],C.a)});2.3.g("18",[D,{5:B.3[0],9:2.9}],2.9.17);2.p.16();l b}}));A.V(A.4.5,{15:{14:1,13:0,12:":11",10:"U",T:e,q:"*",u:"S"}})})(Z)',62,111,'||this|element|ui|selectable|unselecting|if|var|options|selected|false|selecting|function|true|removeClass|triggerHandler|addClass|startselected|top|left|return|item|data|each|helper|filter|else|selectees|disabled|tolerance|dragged|selectableunselecting|ctrlKey|bottom|||||||||||||right|height|width|css|opos|refresh|hasClass|touch|autoRefresh|body|extend|unselected|pageY|pageX|jQuery|appendTo|input|cancel|delay|distance|defaults|remove|stop|selectablestop|selectableselected|selectableunselected|mouseStop|selectableselecting|fit|mouseDrag|keyboard|andSelf|parents|target|clientY|clientX|absolute|position|100|index|append|start|selectablestart|mouseStart|mouseDestroy|unbind|removeData|destroy|disable|enable|toggle|black|dotted|1px|border|div|createElement|document|mouseInit|selectee|offset|init|mouse|widget'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.slider.js b/template-common/lib/ui/ui.slider.js
new file mode 100644
index 000000000..fc4cbd870
--- /dev/null
+++ b/template-common/lib/ui/ui.slider.js
@@ -0,0 +1,440 @@
+/*
+ * jQuery UI Slider
+ *
+ * Copyright (c) 2008 Paul Bakaus
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Slider
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.fn.unwrap = $.fn.unwrap || function(expr) {
+ return this.each(function(){
+ $(this).parents(expr).eq(0).after(this).remove();
+ });
+};
+
+$.widget("ui.slider", {
+ plugins: {},
+ ui: function(e) {
+ return {
+ options: this.options,
+ handle: this.currentHandle,
+ value: this.options.axis != "both" || !this.options.axis ? Math.round(this.value(null,this.options.axis == "vertical" ? "y" : "x")) : {
+ x: Math.round(this.value(null,"x")),
+ y: Math.round(this.value(null,"y"))
+ },
+ range: this.getRange()
+ };
+ },
+ propagate: function(n,e) {
+ $.ui.plugin.call(this, n, [e, this.ui()]);
+ this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
+ },
+ destroy: function() {
+
+ this.element
+ .removeClass("ui-slider ui-slider-disabled")
+ .removeData("slider")
+ .unbind(".slider");
+
+ if(this.handle && this.handle.length) {
+ this.handle
+ .unwrap("a");
+ this.handle.each(function() {
+ $(this).data("mouse").mouseDestroy();
+ });
+ }
+
+ this.generated && this.generated.remove();
+
+ },
+ setData: function(key, value) {
+ $.widget.prototype.setData.apply(this, arguments);
+ if (/min|max|steps/.test(key)) {
+ this.initBoundaries();
+ }
+
+ if(key == "range") {
+ value ? this.handle.length == 2 && this.createRange() : this.removeRange();
+ }
+
+ },
+
+ init: function() {
+
+ var self = this;
+ this.element.addClass("ui-slider");
+ this.initBoundaries();
+
+ // Initialize mouse and key events for interaction
+ this.handle = $(this.options.handle, this.element);
+ if (!this.handle.length) {
+ self.handle = self.generated = $(self.options.handles || [0]).map(function() {
+ var handle = $("<div/>").addClass("ui-slider-handle").appendTo(self.element);
+ if (this.id)
+ handle.attr("id", this.id);
+ return handle[0];
+ });
+ }
+
+
+ var handleclass = function(el) {
+ this.element = $(el);
+ this.element.data("mouse", this);
+ this.options = self.options;
+
+ this.element.bind("mousedown", function() {
+ if(self.currentHandle) this.blur(self.currentHandle);
+ self.focus(this,1);
+ });
+
+ this.mouseInit();
+ };
+
+ $.extend(handleclass.prototype, $.ui.mouse, {
+ mouseStart: function(e) { return self.start.call(self, e, this.element[0]); },
+ mouseStop: function(e) { return self.stop.call(self, e, this.element[0]); },
+ mouseDrag: function(e) { return self.drag.call(self, e, this.element[0]); },
+ mouseCapture: function() { return true; },
+ trigger: function(e) { this.mouseDown(e); }
+ });
+
+
+ $(this.handle)
+ .each(function() {
+ new handleclass(this);
+ })
+ .wrap('<a href="javascript:void(0)" style="outline:none;border:none;"></a>')
+ .parent()
+ .bind('focus', function(e) { self.focus(this.firstChild); })
+ .bind('blur', function(e) { self.blur(this.firstChild); })
+ .bind('keydown', function(e) { if(!self.options.noKeyboard) self.keydown(e.keyCode, this.firstChild); })
+ ;
+
+ // Bind the click to the slider itself
+ this.element.bind('mousedown.slider', function(e) {
+ self.click.apply(self, [e]);
+ self.currentHandle.data("mouse").trigger(e);
+ self.firstValue = self.firstValue + 1; //This is for always triggering the change event
+ });
+
+ // Move the first handle to the startValue
+ $.each(this.options.handles || [], function(index, handle) {
+ self.moveTo(handle.start, index, true);
+ });
+ if (!isNaN(this.options.startValue))
+ this.moveTo(this.options.startValue, 0, true);
+
+ this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle
+ if(this.handle.length == 2 && this.options.range) this.createRange();
+ },
+ initBoundaries: function() {
+
+ var element = this.element[0], o = this.options;
+ this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
+
+ $.extend(o, {
+ axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
+ max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),
+ min: !isNaN(parseInt(o.min,10)) ? { x: parseInt(o.min, 10), y: parseInt(o.min, 10) } : ({ x: o.min && o.min.x || 0, y: o.min && o.min.y || 0 })
+ });
+ //Prepare the real maxValue
+ o.realMax = {
+ x: o.max.x - o.min.x,
+ y: o.max.y - o.min.y
+ };
+ //Calculate stepping based on steps
+ o.stepping = {
+ x: o.stepping && o.stepping.x || parseInt(o.stepping, 10) || (o.steps ? o.realMax.x/(o.steps.x || parseInt(o.steps, 10) || o.realMax.x) : 0),
+ y: o.stepping && o.stepping.y || parseInt(o.stepping, 10) || (o.steps ? o.realMax.y/(o.steps.y || parseInt(o.steps, 10) || o.realMax.y) : 0)
+ };
+ },
+
+
+ keydown: function(keyCode, handle) {
+ if(/(37|38|39|40)/.test(keyCode)) {
+ this.moveTo({
+ x: /(37|39)/.test(keyCode) ? (keyCode == 37 ? '-' : '+') + '=' + this.oneStep("x") : 0,
+ y: /(38|40)/.test(keyCode) ? (keyCode == 38 ? '-' : '+') + '=' + this.oneStep("y") : 0
+ }, handle);
+ }
+ },
+ focus: function(handle,hard) {
+ this.currentHandle = $(handle).addClass('ui-slider-handle-active');
+ if (hard)
+ this.currentHandle.parent()[0].focus();
+ },
+ blur: function(handle) {
+ $(handle).removeClass('ui-slider-handle-active');
+ if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };
+ },
+ click: function(e) {
+ // This method is only used if:
+ // - The user didn't click a handle
+ // - The Slider is not disabled
+ // - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
+
+ var pointer = [e.pageX,e.pageY];
+
+ var clickedHandle = false;
+ this.handle.each(function() {
+ if(this == e.target)
+ clickedHandle = true;
+ });
+ if (clickedHandle || this.options.disabled || !(this.currentHandle || this.previousHandle))
+ return;
+
+ // If a previous handle was focussed, focus it again
+ if (!this.currentHandle && this.previousHandle)
+ this.focus(this.previousHandle, true);
+
+ // propagate only for distance > 0, otherwise propagation is done my drag
+ this.offset = this.element.offset();
+
+ this.moveTo({
+ y: this.convertValue(e.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"),
+ x: this.convertValue(e.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")
+ }, null, !this.options.distance);
+ },
+
+
+
+ createRange: function() {
+ if(this.rangeElement) return;
+ this.rangeElement = $('<div></div>')
+ .addClass('ui-slider-range')
+ .css({ position: 'absolute' })
+ .appendTo(this.element);
+ this.updateRange();
+ },
+ removeRange: function() {
+ this.rangeElement.remove();
+ this.rangeElement = null;
+ },
+ updateRange: function() {
+ var prop = this.options.axis == "vertical" ? "top" : "left";
+ var size = this.options.axis == "vertical" ? "height" : "width";
+ this.rangeElement.css(prop, (parseInt($(this.handle[0]).css(prop),10) || 0) + this.handleSize(0, this.options.axis == "vertical" ? "y" : "x")/2);
+ this.rangeElement.css(size, (parseInt($(this.handle[1]).css(prop),10) || 0) - (parseInt($(this.handle[0]).css(prop),10) || 0));
+ },
+ getRange: function() {
+ return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.options.axis == "vertical" ? "height" : "width"),10), this.options.axis == "vertical" ? "y" : "x") : null;
+ },
+
+ handleIndex: function() {
+ return this.handle.index(this.currentHandle[0]);
+ },
+ value: function(handle, axis) {
+ if(this.handle.length == 1) this.currentHandle = this.handle;
+ if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";
+
+ var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
+
+ if(curHandle.data("mouse").sliderValue) {
+ return parseInt(curHandle.data("mouse").sliderValue[axis],10);
+ } else {
+ return parseInt(((parseInt(curHandle.css(axis == "x" ? "left" : "top"),10) / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(handle,axis))) * this.options.realMax[axis]) + this.options.min[axis],10);
+ }
+
+ },
+ convertValue: function(value,axis) {
+ return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))) * this.options.realMax[axis];
+ },
+
+ translateValue: function(value,axis) {
+ return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis));
+ },
+ translateRange: function(value,axis) {
+ if (this.rangeElement) {
+ if (this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1),axis))
+ value = this.translateValue(this.value(1,axis) - this.oneStep(axis), axis);
+ if (this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0),axis))
+ value = this.translateValue(this.value(0,axis) + this.oneStep(axis), axis);
+ }
+ if (this.options.handles) {
+ var handle = this.options.handles[this.handleIndex()];
+ if (value < this.translateValue(handle.min,axis)) {
+ value = this.translateValue(handle.min,axis);
+ } else if (value > this.translateValue(handle.max,axis)) {
+ value = this.translateValue(handle.max,axis);
+ }
+ }
+ return value;
+ },
+ translateLimits: function(value,axis) {
+ if (value >= this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))
+ value = this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis);
+ if (value <= 0)
+ value = 0;
+ return value;
+ },
+ handleSize: function(handle,axis) {
+ return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[0]["offset"+(axis == "x" ? "Width" : "Height")];
+ },
+ oneStep: function(axis) {
+ return this.options.stepping[axis] || 1;
+ },
+
+
+ start: function(e, handle) {
+
+ var o = this.options;
+ if(o.disabled) return false;
+
+ // Prepare the outer size
+ this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
+
+ // This is a especially ugly fix for strange blur events happening on mousemove events
+ if (!this.currentHandle)
+ this.focus(this.previousHandle, true);
+
+ this.offset = this.element.offset();
+
+ this.handleOffset = this.currentHandle.offset();
+ this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
+
+ this.firstValue = this.value();
+
+ this.propagate('start', e);
+ this.drag(e, handle);
+ return true;
+
+ },
+ stop: function(e) {
+ this.propagate('stop', e);
+ if (this.firstValue != this.value())
+ this.propagate('change', e);
+ // This is a especially ugly fix for strange blur events happening on mousemove events
+ this.focus(this.currentHandle, true);
+ return false;
+ },
+ drag: function(e, handle) {
+
+ var o = this.options;
+ var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};
+ if(!this.currentHandle) this.focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events
+
+ position.left = this.translateLimits(position.left, "x");
+ position.top = this.translateLimits(position.top, "y");
+
+ if (o.stepping.x) {
+ var value = this.convertValue(position.left, "x");
+ value = Math.round(value / o.stepping.x) * o.stepping.x;
+ position.left = this.translateValue(value, "x");
+ }
+ if (o.stepping.y) {
+ var value = this.convertValue(position.top, "y");
+ value = Math.round(value / o.stepping.y) * o.stepping.y;
+ position.top = this.translateValue(value, "y");
+ }
+
+ position.left = this.translateRange(position.left, "x");
+ position.top = this.translateRange(position.top, "y");
+
+ if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
+ if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
+
+ //Store the slider's value
+ this.currentHandle.data("mouse").sliderValue = {
+ x: Math.round(this.convertValue(position.left, "x")) || 0,
+ y: Math.round(this.convertValue(position.top, "y")) || 0
+ };
+
+ if (this.rangeElement)
+ this.updateRange();
+ this.propagate('slide', e);
+ return false;
+ },
+
+ moveTo: function(value, handle, noPropagation) {
+
+ var o = this.options;
+
+ // Prepare the outer size
+ this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
+
+ //If no handle has been passed, no current handle is available and we have multiple handles, return false
+ if (handle == undefined && !this.currentHandle && this.handle.length != 1)
+ return false;
+
+ //If only one handle is available, use it
+ if (handle == undefined && !this.currentHandle)
+ handle = 0;
+
+ if (handle != undefined)
+ this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
+
+
+ if(value.x !== undefined && value.y !== undefined) {
+ var x = value.x, y = value.y;
+ } else {
+ var x = value, y = value;
+ }
+
+ if(x !== undefined && x.constructor != Number) {
+ var me = /^\-\=/.test(x), pe = /^\+\=/.test(x);
+ if(me || pe) {
+ x = this.value(null, "x") + parseInt(x.replace(me ? '=' : '+=', ''), 10);
+ } else {
+ x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
+ }
+ }
+
+ if(y !== undefined && y.constructor != Number) {
+ var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
+ if(me || pe) {
+ y = this.value(null, "y") + parseInt(y.replace(me ? '=' : '+=', ''), 10);
+ } else {
+ y = isNaN(parseInt(y, 10)) ? undefined : parseInt(y, 10);
+ }
+ }
+
+ if(o.axis != "vertical" && x !== undefined) {
+ if(o.stepping.x) x = Math.round(x / o.stepping.x) * o.stepping.x;
+ x = this.translateValue(x, "x");
+ x = this.translateLimits(x, "x");
+ x = this.translateRange(x, "x");
+
+ o.animate ? this.currentHandle.stop().animate({ left: x }, (Math.abs(parseInt(this.currentHandle.css("left")) - x)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ left: x });
+ }
+
+ if(o.axis != "horizontal" && y !== undefined) {
+ if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;
+ y = this.translateValue(y, "y");
+ y = this.translateLimits(y, "y");
+ y = this.translateRange(y, "y");
+ o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
+ }
+
+ if (this.rangeElement)
+ this.updateRange();
+
+ //Store the slider's value
+ this.currentHandle.data("mouse").sliderValue = {
+ x: Math.round(this.convertValue(x, "x")) || 0,
+ y: Math.round(this.convertValue(y, "y")) || 0
+ };
+
+ if (!noPropagation) {
+ this.propagate('start', null);
+ this.propagate('stop', null);
+ this.propagate('change', null);
+ this.propagate("slide", null);
+ }
+ }
+});
+
+$.ui.slider.getter = "value";
+
+$.ui.slider.defaults = {
+ handle: ".ui-slider-handle",
+ distance: 1,
+ animate: false
+};
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.slider.packed.js b/template-common/lib/ui/ui.slider.packed.js
new file mode 100644
index 000000000..727d0285c
--- /dev/null
+++ b/template-common/lib/ui/ui.slider.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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}('(6(A){A.25.1C=A.25.1C||6(B){c 3.18(6(){A(3).2J(B).2I(0).2H(3).1s()})};A.24("j.m",{2G:{},j:6(B){c{8:3.8,9:3.7,n:3.8.l!="2F"||!3.8.l?p.t(3.n(i,3.8.l=="w"?"y":"x")):{x:p.t(3.n(i,"x")),y:p.t(3.n(i,"y"))},1h:3.1K()}},M:6(C,B){A.j.2E.1k(3,C,[B,3.j()]);3.d.2D(C=="1a"?C:"1a"+C,[B,3.j()],3.8[C])},2C:6(){3.d.1R("j-m j-m-1r").2B("m").2A(".m");4(3.9&&3.9.11){3.9.1C("a");3.9.18(6(){A(3).U("P").2z()})}3.1B&&3.1B.1s()},23:6(B,C){A.24.22.23.1Z(3,2y);4(/k|s|X/.Q(B)){3.1y()}4(B=="1h"){C?3.9.11==2&&3.1u():3.1L()}},2x:6(){h B=3;3.d.1i("j-m");3.1y();3.9=A(3.8.9,3.d);4(!3.9.11){B.9=B.1B=A(B.8.1g||[0]).2w(6(){h D=A("<1t/>").1i("j-m-9").1M(B.d);4(3.1A){D.2v("1A",3.1A)}c D[0]})}h C=6(D){3.d=A(D);3.d.U("P",3);3.8=B.8;3.d.19("20",6(){4(B.7){3.1j(B.7)}B.O(3,1)});3.2u()};A.1W(C.22,A.j.P,{2t:6(D){c B.12.1k(B,D,3.d[0])},2s:6(D){c B.Z.1k(B,D,3.d[0])},2r:6(D){c B.1p.1k(B,D,3.d[0])},2q:6(){c N},1Y:6(D){3.2p(D)}});A(3.9).18(6(){2o C(3)}).2n(\'<a 2m="2l:2k(0)" 2j="2i:21;2h:21;"></a>\').1S().19("O",6(D){B.O(3.1z)}).19("1j",6(D){B.1j(3.1z)}).19("1x",6(D){4(!B.8.2g){B.1x(D.2f,3.1z)}});3.d.19("20.m",6(D){B.1P.1Z(B,[D]);B.7.U("P").1Y(D);B.1f=B.1f+1});A.18(3.8.1g||[],6(D,E){B.16(E.12,D,N)});4(!V(3.8.1X)){3.16(3.8.1X,0,N)}3.R=A(3.9[0]);4(3.9.11==2&&3.8.1h){3.1u()}},1y:6(){h B=3.d[0],C=3.8;3.S={J:3.d.1n(),z:3.d.1m()};A.1W(C,{l:C.l||(B.1N<B.1O?"w":"1l"),s:!V(b(C.s,10))?{x:b(C.s,10),y:b(C.s,10)}:({x:C.s&&C.s.x||1V,y:C.s&&C.s.y||1V}),k:!V(b(C.k,10))?{x:b(C.k,10),y:b(C.k,10)}:({x:C.k&&C.k.x||0,y:C.k&&C.k.y||0})});C.T={x:C.s.x-C.k.x,y:C.s.y-C.k.y};C.f={x:C.f&&C.f.x||b(C.f,10)||(C.X?C.T.x/(C.X.x||b(C.X,10)||C.T.x):0),y:C.f&&C.f.y||b(C.f,10)||(C.X?C.T.y/(C.X.y||b(C.X,10)||C.T.y):0)}},1x:6(C,B){4(/(1w|1v|1U|1T)/.Q(C)){3.16({x:/(1w|1U)/.Q(C)?(C==1w?"-":"+")+"="+3.17("x"):0,y:/(1v|1T)/.Q(C)?(C==1v?"-":"+")+"="+3.17("y"):0},B)}},O:6(B,C){3.7=A(B).1i("j-m-9-1Q");4(C){3.7.1S()[0].O()}},1j:6(B){A(B).1R("j-m-9-1Q");4(3.7&&3.7[0]==B){3.R=3.7;3.7=i}},1P:6(C){h D=[C.1d,C.1e];h B=Y;3.9.18(6(){4(3==C.2e){B=N}});4(B||3.8.1r||!(3.7||3.R)){c}4(!3.7&&3.R){3.O(3.R,N)}3.K=3.d.K();3.16({y:3.v(C.1e-3.K.e-3.7[0].1O/2,"y"),x:3.v(C.1d-3.K.g-3.7[0].1N/2,"x")},i,!3.8.1D)},1u:6(){4(3.u){c}3.u=A("<1t></1t>").1i("j-m-1h").o({2d:"2c"}).1M(3.d);3.1c()},1L:6(){3.u.1s();3.u=i},1c:6(){h C=3.8.l=="w"?"e":"g";h B=3.8.l=="w"?"z":"J";3.u.o(C,(b(A(3.9[0]).o(C),10)||0)+3.W(0,3.8.l=="w"?"y":"x")/2);3.u.o(B,(b(A(3.9[1]).o(C),10)||0)-(b(A(3.9[0]).o(C),10)||0))},1K:6(){c 3.u?3.v(b(3.u.o(3.8.l=="w"?"z":"J"),10),3.8.l=="w"?"y":"x"):i},1J:6(){c 3.9.2b(3.7[0])},n:6(D,B){4(3.9.11==1){3.7=3.9}4(!B){B=3.8.l=="w"?"y":"x"}h C=A(D!=r&&D!==i?3.9[D]||D:3.7);4(C.U("P").1b){c b(C.U("P").1b[B],10)}15{c b(((b(C.o(B=="x"?"g":"e"),10)/(3.S[B=="x"?"J":"z"]-3.W(D,B)))*3.8.T[B])+3.8.k[B],10)}},v:6(C,B){c 3.8.k[B]+(C/(3.S[B=="x"?"J":"z"]-3.W(i,B)))*3.8.T[B]},q:6(C,B){c((C-3.8.k[B])/3.8.T[B])*(3.S[B=="x"?"J":"z"]-3.W(i,B))},13:6(D,B){4(3.u){4(3.7[0]==3.9[0]&&D>=3.q(3.n(1),B)){D=3.q(3.n(1,B)-3.17(B),B)}4(3.7[0]==3.9[1]&&D<=3.q(3.n(0),B)){D=3.q(3.n(0,B)+3.17(B),B)}}4(3.8.1g){h C=3.8.1g[3.1J()];4(D<3.q(C.k,B)){D=3.q(C.k,B)}15{4(D>3.q(C.s,B)){D=3.q(C.s,B)}}}c D},14:6(C,B){4(C>=3.S[B=="x"?"J":"z"]-3.W(i,B)){C=3.S[B=="x"?"J":"z"]-3.W(i,B)}4(C<=0){C=0}c C},W:6(C,B){c A(C!=r&&C!==i?3.9[C]:3.7)[0]["K"+(B=="x"?"2a":"29")]},17:6(B){c 3.8.f[B]||1},12:6(C,B){h D=3.8;4(D.1r){c Y}3.S={J:3.d.1n(),z:3.d.1m()};4(!3.7){3.O(3.R,N)}3.K=3.d.K();3.1q=3.7.K();3.1o={e:C.1e-3.1q.e,g:C.1d-3.1q.g};3.1f=3.n();3.M("12",C);3.1p(C,B);c N},Z:6(B){3.M("Z",B);4(3.1f!=3.n()){3.M("1E",B)}3.O(3.7,N);c Y},1p:6(E,D){h F=3.8;h B={e:E.1e-3.K.e-3.1o.e,g:E.1d-3.K.g-3.1o.g};4(!3.7){3.O(3.R,N)}B.g=3.14(B.g,"x");B.e=3.14(B.e,"y");4(F.f.x){h C=3.v(B.g,"x");C=p.t(C/F.f.x)*F.f.x;B.g=3.q(C,"x")}4(F.f.y){h C=3.v(B.e,"y");C=p.t(C/F.f.y)*F.f.y;B.e=3.q(C,"y")}B.g=3.13(B.g,"x");B.e=3.13(B.e,"y");4(F.l!="w"){3.7.o({g:B.g})}4(F.l!="1l"){3.7.o({e:B.e})}3.7.U("P").1b={x:p.t(3.v(B.g,"x"))||0,y:p.t(3.v(B.e,"y"))||0};4(3.u){3.1c()}3.M("1a",E);c Y},16:6(F,E,G){h H=3.8;3.S={J:3.d.1n(),z:3.d.1m()};4(E==r&&!3.7&&3.9.11!=1){c Y}4(E==r&&!3.7){E=0}4(E!=r){3.7=3.R=A(3.9[E]||E)}4(F.x!==r&&F.y!==r){h B=F.x,I=F.y}15{h B=F,I=F}4(B!==r&&B.1I!=1H){h D=/^\\-\\=/.Q(B),C=/^\\+\\=/.Q(B);4(D||C){B=3.n(i,"x")+b(B.1G(D?"=":"+=",""),10)}15{B=V(b(B,10))?r:b(B,10)}}4(I!==r&&I.1I!=1H){h D=/^\\-\\=/.Q(I),C=/^\\+\\=/.Q(I);4(D||C){I=3.n(i,"y")+b(I.1G(D?"=":"+=",""),10)}15{I=V(b(I,10))?r:b(I,10)}}4(H.l!="w"&&B!==r){4(H.f.x){B=p.t(B/H.f.x)*H.f.x}B=3.q(B,"x");B=3.14(B,"x");B=3.13(B,"x");H.L?3.7.Z().L({g:B},(p.1F(b(3.7.o("g"))-B))*(!V(b(H.L))?H.L:5)):3.7.o({g:B})}4(H.l!="1l"&&I!==r){4(H.f.y){I=p.t(I/H.f.y)*H.f.y}I=3.q(I,"y");I=3.14(I,"y");I=3.13(I,"y");H.L?3.7.Z().L({e:I},(p.1F(b(3.7.o("e"))-I))*(!V(b(H.L))?H.L:5)):3.7.o({e:I})}4(3.u){3.1c()}3.7.U("P").1b={x:p.t(3.v(B,"x"))||0,y:p.t(3.v(I,"y"))||0};4(!G){3.M("12",i);3.M("Z",i);3.M("1E",i);3.M("1a",i)}}});A.j.m.28="n";A.j.m.27={9:".j-m-9",1D:1,L:Y}})(26)',62,170,'|||this|if||function|currentHandle|options|handle||parseInt|return|element|top|stepping|left|var|null|ui|min|axis|slider|value|css|Math|translateValue|undefined|max|round|rangeElement|convertValue|vertical|||height||||||||||width|offset|animate|propagate|true|focus|mouse|test|previousHandle|actualSize|realMax|data|isNaN|handleSize|steps|false|stop||length|start|translateRange|translateLimits|else|moveTo|oneStep|each|bind|slide|sliderValue|updateRange|pageX|pageY|firstValue|handles|range|addClass|blur|call|horizontal|outerHeight|outerWidth|clickOffset|drag|handleOffset|disabled|remove|div|createRange|38|37|keydown|initBoundaries|firstChild|id|generated|unwrap|distance|change|abs|replace|Number|constructor|handleIndex|getRange|removeRange|appendTo|offsetWidth|offsetHeight|click|active|removeClass|parent|40|39|100|extend|startValue|trigger|apply|mousedown|none|prototype|setData|widget|fn|jQuery|defaults|getter|Height|Width|index|absolute|position|target|keyCode|noKeyboard|border|outline|style|void|javascript|href|wrap|new|mouseDown|mouseCapture|mouseDrag|mouseStop|mouseStart|mouseInit|attr|map|init|arguments|mouseDestroy|unbind|removeData|destroy|triggerHandler|plugin|both|plugins|after|eq|parents'.split('|'),0,{}))
+
diff --git a/template-common/lib/ui/ui.tabs.js b/template-common/lib/ui/ui.tabs.js
new file mode 100644
index 000000000..a7099d0be
--- /dev/null
+++ b/template-common/lib/ui/ui.tabs.js
@@ -0,0 +1,599 @@
+/*
+ * jQuery UI Tabs
+ *
+ * Copyright (c) 2007, 2008 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Tabs
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.widget("ui.tabs", {
+ init: function() {
+ this.options.event += '.tabs'; // namespace event
+
+ // create tabs
+ this.tabify(true);
+ },
+ setData: function(key, value) {
+ if ((/^selected/).test(key))
+ this.select(value);
+ else {
+ this.options[key] = value;
+ this.tabify();
+ }
+ },
+ length: function() {
+ return this.$tabs.length;
+ },
+ tabId: function(a) {
+ return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')
+ || this.options.idPrefix + $.data(a);
+ },
+ ui: function(tab, panel) {
+ return {
+ options: this.options,
+ tab: tab,
+ panel: panel,
+ index: this.$tabs.index(tab)
+ };
+ },
+ tabify: function(init) {
+
+ this.$lis = $('li:has(a[href])', this.element);
+ this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
+ this.$panels = $([]);
+
+ var self = this, o = this.options;
+
+ this.$tabs.each(function(i, a) {
+ // inline tab
+ if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
+ self.$panels = self.$panels.add(a.hash);
+ // remote tab
+ else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
+ $.data(a, 'href.tabs', a.href); // required for restore on destroy
+ $.data(a, 'load.tabs', a.href); // mutable
+ var id = self.tabId(a);
+ a.href = '#' + id;
+ var $panel = $('#' + id);
+ if (!$panel.length) {
+ $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
+ .insertAfter( self.$panels[i - 1] || self.element );
+ $panel.data('destroy.tabs', true);
+ }
+ self.$panels = self.$panels.add( $panel );
+ }
+ // invalid tab href
+ else
+ o.disabled.push(i + 1);
+ });
+
+ if (init) {
+
+ // attach necessary classes for styling if not present
+ this.element.addClass(o.navClass);
+ this.$panels.each(function() {
+ var $this = $(this);
+ $this.addClass(o.panelClass);
+ });
+
+ // Selected tab
+ // use "selected" option or try to retrieve:
+ // 1. from fragment identifier in url
+ // 2. from cookie
+ // 3. from selected class attribute on <li>
+ if (o.selected === undefined) {
+ if (location.hash) {
+ this.$tabs.each(function(i, a) {
+ if (a.hash == location.hash) {
+ o.selected = i;
+ // prevent page scroll to fragment
+ if ($.browser.msie || $.browser.opera) { // && !o.remote
+ var $toShow = $(location.hash), toShowId = $toShow.attr('id');
+ $toShow.attr('id', '');
+ setTimeout(function() {
+ $toShow.attr('id', toShowId); // restore id
+ }, 500);
+ }
+ scrollTo(0, 0);
+ return false; // break
+ }
+ });
+ }
+ else if (o.cookie) {
+ var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);
+ if (index && self.$tabs[index])
+ o.selected = index;
+ }
+ else if (self.$lis.filter('.' + o.selectedClass).length)
+ o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );
+ }
+ o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ // A selected tab cannot become disabled.
+ o.disabled = $.unique(o.disabled.concat(
+ $.map(this.$lis.filter('.' + o.disabledClass),
+ function(n, i) { return self.$lis.index(n); } )
+ )).sort();
+ if ($.inArray(o.selected, o.disabled) != -1)
+ o.disabled.splice($.inArray(o.selected, o.disabled), 1);
+
+ // highlight selected tab
+ this.$panels.addClass(o.hideClass);
+ this.$lis.removeClass(o.selectedClass);
+ if (o.selected !== null) {
+ this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
+ this.$lis.eq(o.selected).addClass(o.selectedClass);
+
+ // seems to be expected behavior that the show callback is fired
+ var onShow = function() {
+ $(self.element).triggerHandler('tabsshow',
+ [self.fakeEvent('tabsshow'), self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);
+ };
+
+ // load if remote tab
+ if ($.data(this.$tabs[o.selected], 'load.tabs'))
+ this.load(o.selected, onShow);
+ // just trigger show event
+ else
+ onShow();
+
+ }
+
+ // clean up to avoid memory leaks in certain versions of IE 6
+ $(window).bind('unload', function() {
+ self.$tabs.unbind('.tabs');
+ self.$lis = self.$tabs = self.$panels = null;
+ });
+
+ }
+
+ // disable tabs
+ for (var i = 0, li; li = this.$lis[i]; i++)
+ $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
+
+ // reset cache if switching from cached to not cached
+ if (o.cache === false)
+ this.$tabs.removeData('cache.tabs');
+
+ // set up animations
+ var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';
+ if (o.fx && o.fx.constructor == Array)
+ hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx;
+ else
+ hideFx = showFx = o.fx || baseFx;
+
+ // reset some styles to maintain print style sheets etc.
+ var resetCSS = { display: '', overflow: '', height: '' };
+ if (!$.browser.msie) // not in IE to prevent ClearType font issue
+ resetCSS.opacity = '';
+
+ // Hide a tab, animation prevents browser scrolling to fragment,
+ // $show is optional.
+ function hideTab(clicked, $hide, $show) {
+ $hide.animate(hideFx, hideFx.duration || baseDuration, function() { //
+ $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+ if ($.browser.msie && hideFx.opacity)
+ $hide[0].style.filter = '';
+ if ($show)
+ showTab(clicked, $show, $hide);
+ });
+ }
+
+ // Show a tab, animation prevents browser scrolling to fragment,
+ // $hide is optional.
+ function showTab(clicked, $show, $hide) {
+ if (showFx === baseFx)
+ $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
+ $show.animate(showFx, showFx.duration || baseDuration, function() {
+ $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
+ if ($.browser.msie && showFx.opacity)
+ $show[0].style.filter = '';
+
+ // callback
+ $(self.element).triggerHandler('tabsshow',
+ [self.fakeEvent('tabsshow'), self.ui(clicked, $show[0])], o.show);
+
+ });
+ }
+
+ // switch a tab
+ function switchTab(clicked, $li, $hide, $show) {
+ /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
+ $.ajaxHistory.update(clicked.hash);
+ }*/
+ $li.addClass(o.selectedClass)
+ .siblings().removeClass(o.selectedClass);
+ hideTab(clicked, $hide, $show);
+ }
+
+ // attach tab event handler, unbind to avoid duplicates from former tabifying...
+ this.$tabs.unbind('.tabs').bind(o.event, function() {
+
+ //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
+ var $li = $(this).parents('li:eq(0)'),
+ $hide = self.$panels.filter(':visible'),
+ $show = $(this.hash);
+
+ // If tab is already selected and not unselectable or tab disabled or
+ // or is already loading or click callback returns false stop here.
+ // Check if click handler returns false last so that it is not executed
+ // for a disabled or loading tab!
+ if (($li.hasClass(o.selectedClass) && !o.unselect)
+ || $li.hasClass(o.disabledClass)
+ || $(this).hasClass(o.loadingClass)
+ || $(self.element).triggerHandler('tabsselect', [self.fakeEvent('tabsselect'), self.ui(this, $show[0])], o.select) === false
+ ) {
+ this.blur();
+ return false;
+ }
+
+ self.options.selected = self.$tabs.index(this);
+
+ // if tab may be closed
+ if (o.unselect) {
+ if ($li.hasClass(o.selectedClass)) {
+ self.options.selected = null;
+ $li.removeClass(o.selectedClass);
+ self.$panels.stop();
+ hideTab(this, $hide);
+ this.blur();
+ return false;
+ } else if (!$hide.length) {
+ self.$panels.stop();
+ var a = this;
+ self.load(self.$tabs.index(this), function() {
+ $li.addClass(o.selectedClass).addClass(o.unselectClass);
+ showTab(a, $show);
+ });
+ this.blur();
+ return false;
+ }
+ }
+
+ if (o.cookie)
+ $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);
+
+ // stop possibly running animations
+ self.$panels.stop();
+
+ // show new tab
+ if ($show.length) {
+
+ // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
+ /*if ($.browser.msie && o.bookmarkable) {
+ var showId = this.hash.replace('#', '');
+ $show.attr('id', '');
+ setTimeout(function() {
+ $show.attr('id', showId); // restore id
+ }, 0);
+ }*/
+
+ var a = this;
+ self.load(self.$tabs.index(this), $hide.length ?
+ function() {
+ switchTab(a, $li, $hide, $show);
+ } :
+ function() {
+ $li.addClass(o.selectedClass);
+ showTab(a, $show);
+ }
+ );
+
+ // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
+ /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;
+ var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;
+ setTimeout(function() {
+ scrollTo(scrollX, scrollY);
+ }, 0);*/
+
+ } else
+ throw 'jQuery UI Tabs: Mismatching fragment identifier.';
+
+ // Prevent IE from keeping other link focussed when using the back button
+ // and remove dotted border from clicked link. This is controlled in modern
+ // browsers via CSS, also blur removes focus from address bar in Firefox
+ // which can become a usability and annoying problem with tabsRotate.
+ if ($.browser.msie)
+ this.blur();
+
+ //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
+ return false;
+
+ });
+
+ // disable click if event is configured to something else
+ if (!(/^click/).test(o.event))
+ this.$tabs.bind('click.tabs', function() { return false; });
+
+ },
+ add: function(url, label, index) {
+ if (index == undefined)
+ index = this.$tabs.length; // append by default
+
+ var o = this.options;
+ var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
+ $li.data('destroy.tabs', true);
+
+ var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );
+
+ // try to find an existing element before creating a new one
+ var $panel = $('#' + id);
+ if (!$panel.length) {
+ $panel = $(o.panelTemplate).attr('id', id)
+ .addClass(o.hideClass)
+ .data('destroy.tabs', true);
+ }
+ $panel.addClass(o.panelClass);
+ if (index >= this.$lis.length) {
+ $li.appendTo(this.element);
+ $panel.appendTo(this.element[0].parentNode);
+ } else {
+ $li.insertBefore(this.$lis[index]);
+ $panel.insertBefore(this.$panels[index]);
+ }
+
+ o.disabled = $.map(o.disabled,
+ function(n, i) { return n >= index ? ++n : n });
+
+ this.tabify();
+
+ if (this.$tabs.length == 1) {
+ $li.addClass(o.selectedClass);
+ $panel.removeClass(o.hideClass);
+ var href = $.data(this.$tabs[0], 'load.tabs');
+ if (href)
+ this.load(index, href);
+ }
+
+ // callback
+ this.element.triggerHandler('tabsadd',
+ [this.fakeEvent('tabsadd'), this.ui(this.$tabs[index], this.$panels[index])], o.add
+ );
+ },
+ remove: function(index) {
+ var o = this.options, $li = this.$lis.eq(index).remove(),
+ $panel = this.$panels.eq(index).remove();
+
+ // If selected tab was removed focus tab to the right or
+ // in case the last tab was removed the tab to the left.
+ if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
+ this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
+
+ o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
+ function(n, i) { return n >= index ? --n : n });
+
+ this.tabify();
+
+ // callback
+ this.element.triggerHandler('tabsremove',
+ [this.fakeEvent('tabsremove'), this.ui($li.find('a')[0], $panel[0])], o.remove
+ );
+ },
+ enable: function(index) {
+ var o = this.options;
+ if ($.inArray(index, o.disabled) == -1)
+ return;
+
+ var $li = this.$lis.eq(index).removeClass(o.disabledClass);
+ if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
+ $li.css('display', 'inline-block');
+ setTimeout(function() {
+ $li.css('display', 'block');
+ }, 0);
+ }
+
+ o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
+
+ // callback
+ this.element.triggerHandler('tabsenable',
+ [this.fakeEvent('tabsenable'), this.ui(this.$tabs[index], this.$panels[index])], o.enable
+ );
+
+ },
+ disable: function(index) {
+ var self = this, o = this.options;
+ if (index != o.selected) { // cannot disable already selected tab
+ this.$lis.eq(index).addClass(o.disabledClass);
+
+ o.disabled.push(index);
+ o.disabled.sort();
+
+ // callback
+ this.element.triggerHandler('tabsdisable',
+ [this.fakeEvent('tabsdisable'), this.ui(this.$tabs[index], this.$panels[index])], o.disable
+ );
+ }
+ },
+ select: function(index) {
+ if (typeof index == 'string')
+ index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
+ this.$tabs.eq(index).trigger(this.options.event);
+ },
+ load: function(index, callback) { // callback is for internal usage only
+
+ var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
+ bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
+
+ callback = callback || function() {};
+
+ // no remote or from cache - just finish with callback
+ if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
+ callback();
+ return;
+ }
+
+ // load remote from here on
+
+ var inner = function(parent) {
+ var $parent = $(parent), $inner = $parent.find('*:last');
+ return $inner.length && $inner.is(':not(img)') && $inner || $parent;
+ };
+ var cleanup = function() {
+ self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)
+ .each(function() {
+ if (o.spinner)
+ inner(this).parent().html(inner(this).data('label.tabs'));
+ });
+ self.xhr = null;
+ };
+
+ if (o.spinner) {
+ var label = inner(a).html();
+ inner(a).wrapInner('<em></em>')
+ .find('em').data('label.tabs', label).html(o.spinner);
+ }
+
+ var ajaxOptions = $.extend({}, o.ajaxOptions, {
+ url: url,
+ success: function(r, s) {
+ $(a.hash).html(r);
+ cleanup();
+
+ if (o.cache)
+ $.data(a, 'cache.tabs', true); // if loaded once do not load them again
+
+ // callbacks
+ $(self.element).triggerHandler('tabsload',
+ [self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load
+ );
+ o.ajaxOptions.success && o.ajaxOptions.success(r, s);
+
+ // This callback is required because the switch has to take
+ // place after loading has completed. Call last in order to
+ // fire load before show callback...
+ callback();
+ }
+ });
+ if (this.xhr) {
+ // terminate pending requests from other tabs and restore tab label
+ this.xhr.abort();
+ cleanup();
+ }
+ $a.addClass(o.loadingClass);
+ setTimeout(function() { // timeout is again required in IE, "wait" for id being restored
+ self.xhr = $.ajax(ajaxOptions);
+ }, 0);
+
+ },
+ url: function(index, url) {
+ this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
+ },
+ destroy: function() {
+ var o = this.options;
+ this.element.unbind('.tabs')
+ .removeClass(o.navClass).removeData('tabs');
+ this.$tabs.each(function() {
+ var href = $.data(this, 'href.tabs');
+ if (href)
+ this.href = href;
+ var $this = $(this).unbind('.tabs');
+ $.each(['href', 'load', 'cache'], function(i, prefix) {
+ $this.removeData(prefix + '.tabs');
+ });
+ });
+ this.$lis.add(this.$panels).each(function() {
+ if ($.data(this, 'destroy.tabs'))
+ $(this).remove();
+ else
+ $(this).removeClass([o.selectedClass, o.unselectClass,
+ o.disabledClass, o.panelClass, o.hideClass].join(' '));
+ });
+ },
+ fakeEvent: function(type) {
+ return $.event.fix({
+ type: type,
+ target: this.element[0]
+ });
+ }
+});
+
+$.ui.tabs.defaults = {
+ // basic setup
+ unselect: false,
+ event: 'click',
+ disabled: [],
+ cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+ // TODO history: false,
+
+ // Ajax
+ spinner: 'Loading&#8230;',
+ cache: false,
+ idPrefix: 'ui-tabs-',
+ ajaxOptions: {},
+
+ // animations
+ fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
+
+ // templates
+ tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
+ panelTemplate: '<div></div>',
+
+ // CSS classes
+ navClass: 'ui-tabs-nav',
+ selectedClass: 'ui-tabs-selected',
+ unselectClass: 'ui-tabs-unselect',
+ disabledClass: 'ui-tabs-disabled',
+ panelClass: 'ui-tabs-panel',
+ hideClass: 'ui-tabs-hide',
+ loadingClass: 'ui-tabs-loading'
+};
+
+$.ui.tabs.getter = "length";
+
+/*
+ * Tabs Extensions
+ */
+
+/*
+ * Rotate
+ */
+$.extend($.ui.tabs.prototype, {
+ rotation: null,
+ rotate: function(ms, continuing) {
+
+ continuing = continuing || false;
+
+ var self = this, t = this.options.selected;
+
+ function start() {
+ self.rotation = setInterval(function() {
+ t = ++t < self.$tabs.length ? t : 0;
+ self.select(t);
+ }, ms);
+ }
+
+ function stop(e) {
+ if (!e || e.clientX) { // only in case of a true click
+ clearInterval(self.rotation);
+ }
+ }
+
+ // start interval
+ if (ms) {
+ start();
+ if (!continuing)
+ this.$tabs.bind(this.options.event, stop);
+ else
+ this.$tabs.bind(this.options.event, function() {
+ stop();
+ t = self.options.selected;
+ start();
+ });
+ }
+ // stop interval
+ else {
+ stop();
+ this.$tabs.unbind(this.options.event, stop);
+ }
+ }
+});
+
+})(jQuery);
diff --git a/template-common/lib/ui/ui.tabs.packed.js b/template-common/lib/ui/ui.tabs.packed.js
new file mode 100644
index 000000000..137270e23
--- /dev/null
+++ b/template-common/lib/ui/ui.tabs.packed.js
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?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(A){A.3g("8.3",{3f:4(){2.c.t+=".3";2.1f(1d)},3e:4(B,C){5((/^7/).26(B)){2.17(C)}m{2.c[B]=C;2.1f()}},j:4(){d 2.$3.j},1G:4(B){d B.2b&&B.2b.14(/\\s/g,"2a").14(/[^A-3d-3c-9\\-2a:\\.]/g,"")||2.c.1S+A.f(B)},8:4(C,B){d{c:2.c,3b:C,1O:B,V:2.$3.V(C)}},1f:4(O){2.$i=A("1j:3a(a[n])",2.h);2.$3=2.$i.1t(4(){d A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.X(4(R,Q){5(Q.v&&Q.v.14("#","")){P.$b=P.$b.1c(Q.v)}m{5(A(Q).13("n")!="#"){A.f(Q,"n.3",Q.n);A.f(Q,"p.3",Q.n);6 T=P.1G(Q);Q.n="#"+T;6 S=A("#"+T);5(!S.j){S=A(D.1z).13("1g",T).l(D.19).39(P.$b[R-1]||P.h);S.f("1b.3",1d)}P.$b=P.$b.1c(S)}m{D.e.1Y(R+1)}}});5(O){2.h.l(D.1y);2.$b.X(4(){6 Q=A(2);Q.l(D.19)});5(D.7===1q){5(1L.v){2.$3.X(4(S,Q){5(Q.v==1L.v){D.7=S;5(A.Y.1h||A.Y.38){6 R=A(1L.v),T=R.13("1g");R.13("1g","");1B(4(){R.13("1g",T)},37)}36(0,0);d o}})}m{5(D.11){6 J=35(A.11("8-3"+A.f(P.h)),10);5(J&&P.$3[J]){D.7=J}}m{5(P.$i.U("."+D.k).j){D.7=P.$i.V(P.$i.U("."+D.k)[0])}}}}D.7=D.7===w||D.7!==1q?D.7:0;D.e=A.34(D.e.33(A.1t(2.$i.U("."+D.W),4(R,Q){d P.$i.V(R)}))).1X();5(A.1s(D.7,D.e)!=-1){D.e.32(A.1s(D.7,D.e),1)}2.$b.l(D.x);2.$i.q(D.k);5(D.7!==w){2.$b.r(D.7).1I().q(D.x);2.$i.r(D.7).l(D.k);6 K=4(){A(P.h).z("1v",[P.u("1v"),P.8(P.$3[D.7],P.$b[D.7])],D.1I)};5(A.f(2.$3[D.7],"p.3")){2.p(D.7,K)}m{K()}}A(31).16("30",4(){P.$3.15(".3");P.$i=P.$3=P.$b=w})}2Z(6 G=0,N;N=2.$i[G];G++){A(N)[A.1s(G,D.e)!=-1&&!A(N).12(D.k)?"l":"q"](D.W)}5(D.y===o){2.$3.1n("y.3")}6 C,I,B={"2Y-2X":0,1K:1},E="2W";5(D.Z&&D.Z.2V==2U){C=D.Z[0]||B,I=D.Z[1]||B}m{C=I=D.Z||B}6 H={1r:"",2T:"",2S:""};5(!A.Y.1h){H.1J=""}4 M(R,Q,S){Q.29(C,C.1K||E,4(){Q.l(D.x).1e(H);5(A.Y.1h&&C.1J){Q[0].28.U=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1e("1r","1F")}S.29(I,I.1K||E,4(){S.q(D.x).1e(H);5(A.Y.1h&&I.1J){S[0].28.U=""}A(P.h).z("1v",[P.u("1v"),P.8(R,S[0])],D.1I)})}4 F(R,T,Q,S){T.l(D.k).2R().q(D.k);M(R,Q,S)}2.$3.15(".3").16(D.t,4(){6 T=A(2).2Q("1j:r(0)"),Q=P.$b.U(":2P"),S=A(2.v);5((T.12(D.k)&&!D.1i)||T.12(D.W)||A(2).12(D.18)||A(P.h).z("27",[P.u("27"),P.8(2,S[0])],D.17)===o){2.1u();d o}P.c.7=P.$3.V(2);5(D.1i){5(T.12(D.k)){P.c.7=w;T.q(D.k);P.$b.1H();M(2,Q);2.1u();d o}m{5(!Q.j){P.$b.1H();6 R=2;P.p(P.$3.V(2),4(){T.l(D.k).l(D.1x);L(R,S)});2.1u();d o}}}5(D.11){A.11("8-3"+A.f(P.h),P.c.7,D.11)}P.$b.1H();5(S.j){6 R=2;P.p(P.$3.V(2),Q.j?4(){F(R,T,Q,S)}:4(){T.l(D.k);L(R,S)})}m{2O"1M 2N 2M: 2L 2K 2J."}5(A.Y.1h){2.1u()}d o});5(!(/^1A/).26(D.t)){2.$3.16("1A.3",4(){d o})}},1c:4(E,D,C){5(C==1q){C=2.$3.j}6 G=2.c;6 I=A(G.1R.14(/#\\{n\\}/g,E).14(/#\\{1k\\}/g,D));I.f("1b.3",1d);6 H=E.2I("#")==0?E.14("#",""):2.1G(A("a:2H-2G",I)[0]);6 F=A("#"+H);5(!F.j){F=A(G.1z).13("1g",H).l(G.x).f("1b.3",1d)}F.l(G.19);5(C>=2.$i.j){I.25(2.h);F.25(2.h[0].2F)}m{I.24(2.$i[C]);F.24(2.$b[C])}G.e=A.1t(G.e,4(K,J){d K>=C?++K:K});2.1f();5(2.$3.j==1){I.l(G.k);F.q(G.x);6 B=A.f(2.$3[0],"p.3");5(B){2.p(C,B)}}2.h.z("23",[2.u("23"),2.8(2.$3[C],2.$b[C])],G.1c)},1a:4(B){6 D=2.c,E=2.$i.r(B).1a(),C=2.$b.r(B).1a();5(E.12(D.k)&&2.$3.j>1){2.17(B+(B+1<2.$3.j?1:-1))}D.e=A.1t(A.21(D.e,4(G,F){d G!=B}),4(G,F){d G>=B?--G:G});2.1f();2.h.z("22",[2.u("22"),2.8(E.1E("a")[0],C[0])],D.1a)},1Z:4(B){6 C=2.c;5(A.1s(B,C.e)==-1){d}6 D=2.$i.r(B).q(C.W);5(A.Y.2E){D.1e("1r","2D-1F");1B(4(){D.1e("1r","1F")},0)}C.e=A.21(C.e,4(F,E){d F!=B});2.h.z("20",[2.u("20"),2.8(2.$3[B],2.$b[B])],C.1Z)},1V:4(C){6 B=2,D=2.c;5(C!=D.7){2.$i.r(C).l(D.W);D.e.1Y(C);D.e.1X();2.h.z("1W",[2.u("1W"),2.8(2.$3[C],2.$b[C])],D.1V)}},17:4(B){5(2C B=="2B"){B=2.$3.V(2.$3.U("[n$="+B+"]")[0])}2.$3.r(B).2A(2.c.t)},p:4(G,K){6 L=2,D=2.c,E=2.$3.r(G),J=E[0],H=K==1q||K===o,B=E.f("p.3");K=K||4(){};5(!B||!H&&A.f(J,"y.3")){K();d}6 M=4(N){6 O=A(N),P=O.1E("*:2z");d P.j&&P.2y(":2x(2w)")&&P||O};6 C=4(){L.$3.U("."+D.18).q(D.18).X(4(){5(D.1m){M(2).2v().1p(M(2).f("1k.3"))}});L.1o=w};5(D.1m){6 I=M(J).1p();M(J).2u("<1D></1D>").1E("1D").f("1k.3",I).1p(D.1m)}6 F=A.1N({},D.1l,{1T:B,1C:4(O,N){A(J.v).1p(O);C();5(D.y){A.f(J,"y.3",1d)}A(L.h).z("1U",[L.u("1U"),L.8(L.$3[G],L.$b[G])],D.p);D.1l.1C&&D.1l.1C(O,N);K()}});5(2.1o){2.1o.2t();C()}E.l(D.18);1B(4(){L.1o=A.2s(F)},0)},1T:4(C,B){2.$3.r(C).1n("y.3").f("p.3",B)},1b:4(){6 B=2.c;2.h.15(".3").q(B.1y).1n("3");2.$3.X(4(){6 C=A.f(2,"n.3");5(C){2.n=C}6 D=A(2).15(".3");A.X(["n","p","y"],4(E,F){D.1n(F+".3")})});2.$i.1c(2.$b).X(4(){5(A.f(2,"1b.3")){A(2).1a()}m{A(2).q([B.k,B.1x,B.W,B.19,B.x].2r(" "))}})},u:4(B){d A.t.2q({2p:B,2o:2.h[0]})}});A.8.3.2n={1i:o,t:"1A",e:[],11:w,1m:"2m&#2l;",y:o,1S:"8-3-",1l:{},Z:w,1R:\'<1j><a n="#{n}"><1Q>#{1k}</1Q></a></1j>\',1z:"<1P></1P>",1y:"8-3-2k",k:"8-3-7",1x:"8-3-1i",W:"8-3-e",19:"8-3-1O",x:"8-3-2j",18:"8-3-2i"};A.8.3.2h="j";A.1N(A.8.3.2g,{1w:w,2f:4(C,F){F=F||o;6 B=2,E=2.c.7;4 G(){B.1w=2e(4(){E=++E<B.$3.j?E:0;B.17(E)},C)}4 D(H){5(!H||H.2d){2c(B.1w)}}5(C){G();5(!F){2.$3.16(2.c.t,D)}m{2.$3.16(2.c.t,4(){D();E=B.c.7;G()})}}m{D();2.$3.15(2.c.t,D)}}})})(1M)',62,203,'||this|tabs|function|if|var|selected|ui|||panels|options|return|disabled|data||element|lis|length|selectedClass|addClass|else|href|false|load|removeClass|eq||event|fakeEvent|hash|null|hideClass|cache|triggerHandler|||||||||||||||||||||filter|index|disabledClass|each|browser|fx||cookie|hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|tabsshow|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|tabsload|disable|tabsdisable|sort|push|enable|tabsenable|grep|tabsremove|tabsadd|insertBefore|appendTo|test|tabsselect|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|target|type|fix|join|ajax|abort|wrapInner|parent|img|not|is|last|trigger|string|typeof|inline|safari|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{}))
+