From a2930cfa613ef12e91909a9351d2a01019f53937 Mon Sep 17 00:00:00 2001 From: Kevin Nehls Date: Tue, 14 Jul 2009 20:41:10 -0700 Subject: Fix backslashes in relative URLs of combined css files. --- modules/gallery/libraries/Gallery_View.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 8a0be7f2..4715be09 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -135,6 +135,7 @@ class Gallery_View_Core extends View { $relative = substr(realpath(dirname($css_file) . "/$match[1]"), $docroot_length); if (!empty($relative)) { $search[] = $match[0]; + $relative = str_replace(DIRECTORY_SEPARATOR, "/", $relative); $replace[] = "url('" . url::abs_file($relative) . "')"; } else { Kohana::log("error", "Missing URL reference '{$match[1]}' in CSS file '$css_file'"); -- cgit v1.2.3 From b96ac1eb81b7ccd5bd050ffab0ca9ce1feec8f4f Mon Sep 17 00:00:00 2001 From: Kevin Nehls Date: Wed, 15 Jul 2009 21:28:00 -0700 Subject: move fix for backslashes on windows outside of loop per bharat's suggestion --- modules/gallery/libraries/Gallery_View.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 4715be09..133066d7 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -135,12 +135,12 @@ class Gallery_View_Core extends View { $relative = substr(realpath(dirname($css_file) . "/$match[1]"), $docroot_length); if (!empty($relative)) { $search[] = $match[0]; - $relative = str_replace(DIRECTORY_SEPARATOR, "/", $relative); $replace[] = "url('" . url::abs_file($relative) . "')"; } else { Kohana::log("error", "Missing URL reference '{$match[1]}' in CSS file '$css_file'"); } } + $replace = str_replace(DIRECTORY_SEPARATOR, "/", $replace); $css = str_replace($search, $replace, $css); } $imports = preg_match_all("#@import\s*['|\"]{0,1}(.*?)['|\"]{0,1};#", -- cgit v1.2.3 From afc1de54b1119680c144f474f1c587f3c69b6813 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 11 Sep 2009 09:41:01 -0700 Subject: Upgraded to the latest svn version of selectable and applied local fixes to address ticket #696 --- lib/jquery-ui.js | 410 ++++++++++++++++++++++++++------------ modules/organize/css/organize.css | 12 +- modules/organize/js/organize.js | 8 +- 3 files changed, 297 insertions(+), 133 deletions(-) diff --git a/lib/jquery-ui.js b/lib/jquery-ui.js index 4939d009..85e457a0 100644 --- a/lib/jquery-ui.js +++ b/lib/jquery-ui.js @@ -159,87 +159,98 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var self = this; this.items = $(this.options.filter, this.element); - this.element.addClass("ui-selectable"); + this.element.addClass("ui-selectable ui-widget"); //Set the currentFocus to the first item - this.currentFocus = this.items.eq(0); - + this.currentFocus = this.items.eq(0).attr('tabindex', 0); + //Refresh item positions - this.refresh(); + this.refresh(1); //Disable text selection this.element.disableSelection(); //Prepare caret selection - if(this.options.lasso) this._mouseInit(); + if(this.options.lasso) { + + // we need to move the lasso options onto the root options for the mouse clas + if(this.options.lasso !== true) { + $.extend(this.options, this.options.lasso); + } + + this._mouseInit(); + } this.element .bind('mousedown.selectable', function(event) { + if(self.options.disabled) + return; + var item = self._targetIsItem(event.target); if (!item) return; - + // If item is part of current selection and current // selection is multiple, return and allow mouseup // to fire (Windows gets this right too, OSX doesn't) - if(self._selection.length > 1 && $(item).hasClass(self.options.selectedClass)) { + if(self._selection.length > 1 && $(item).hasClass('ui-selected')) { return (self._listenForMouseUp = 1); } - + if(self._trigger('beforeselect', event) === false) return true; self._select(event, item); self.element[0].focus(); event.preventDefault(); - + }) .bind('mouseup.selectable', function(event) { if(self._listenForMouseUp) { - + self._listenForMouseUp = 0; var item = self._targetIsItem(event.target); if (!item) return; - + if(self._trigger('beforeselect', event) === false) return true; - + self._select(event, item); self.element[0].focus(); event.preventDefault(); } }) .bind('focus.selectable', function() { - self.currentFocus.addClass('ui-focused'); + if(!self.options.disabled) self.currentFocus.addClass('ui-state-focus'); }) .bind('blur.selectable', function() { - self.currentFocus.removeClass('ui-focused'); + if(!self.options.disabled) self.currentFocus.removeClass('ui-state-focus'); }) .bind('keydown.selectable', function(event) { - if(!self.options.keyboard) + if(!self.options.keyboard || self.options.disabled) return; - + if(self._trigger('beforeselect', event) === false) return true; - + if(event.keyCode == $.ui.keyCode.DOWN) { - self.options.smart ? self.selectClosest('down', event) : self.selectNext(event); + self.options.closest ? self.selectClosest('down', event) : self.next(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.RIGHT) { - self.options.smart ? self.selectClosest('right', event) : self.selectNext(event); + self.options.closest ? self.selectClosest('right', event) : self.next(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.UP) { - self.options.smart ? self.selectClosest('up', event) : self.selectPrevious(event); + self.options.closest ? self.selectClosest('up', event) : self.previous(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.LEFT) { - self.options.smart ? self.selectClosest('left', event) : self.selectPrevious(event); + self.options.closest ? self.selectClosest('left', event) : self.previous(event); event.preventDefault(); } @@ -253,14 +264,14 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v .addClass("ui-selectable-lasso"); }, - + selectClosest: function(direction, event) { - + var current = [/(down|right)/.test(direction) ? 10000 : -10000, null], overlap = 10000, selfOffset = this.currentFocus.data('selectable-item'); - $(this.options.filter, this.element).not(this.currentFocus).filter(':visible').each(function() { + this.items.not(this.currentFocus).filter(':visible').each(function() { var $this = $(this), offset = $this.data('selectable-item'), @@ -270,71 +281,84 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v }; switch(direction) { - + case 'up': if((selfOffset.top > offset.top && offset.top >= current[0]) && (offset.top != current[0] || distance.x < overlap)) { current = [offset.top, $this]; overlap = distance.x; } break; - + case 'down': if((selfOffset.top < offset.top && offset.top <= current[0]) && (offset.top != current[0] || distance.x < overlap)) { current = [offset.top, $this]; overlap = distance.x; } break; - + case 'left': if((selfOffset.left > offset.left && offset.left >= current[0]) && (offset.left != current[0] || distance.y < overlap)) { current = [offset.left, $this]; overlap = distance.y; } break; - + case 'right': if((selfOffset.left < offset.left && offset.left <= current[0]) && (offset.left != current[0] || distance.y < overlap)) { current = [offset.left, $this]; overlap = distance.y; } break; - + } }); - - return current[1] ? this._select(event, current[1]) : false; - + + // if nothing close is found, bail + if(!current[1]) + return false; + + //We need to find the index of the current, and the index of the new one to call selectAdjacent + // - calling _select doesn't work, since it's only for mouse interaction (no ctrl focus move!) + var currentIndex = this.items.index(this.currentFocus[0]); + var newIndex = this.items.index(current[1]); + + return this._selectAdjacent(event, newIndex - currentIndex); + }, destroy: function() { + this.items.removeClass("ui-selectable-item ui-selected ui-state-active"); this.element - .removeClass("ui-selectable ui-selectable-disabled") + .removeClass("ui-selectable ui-selectable-disabled ui-widget") .removeData("selectable") .unbind(".selectable"); this._mouseDestroy(); }, - + _mouseCapture: function(event) { //If the item we start dragging on is a selectable, we bail (if keyboard is used) this.clickedOnItem = this._targetIsItem(event.target); - return !this.options.keyboard || !this.clickedOnItem; + return true; // TODO: this starts the lasso on items as well - we might want to introduce an option to disable this }, - + _mouseStart: function(event) { - + var self = this, o = this.options; this.opos = [event.pageX, event.pageY]; - + if (o.disabled) return; - + //Cache positions - this.refresh(); - + this.refresh(1); + //Trigger start event this._trigger("start", event, this._uiHash()); - + + //Save the current selection as previous + this._previousSelection = this._selection.slice(); + // append and position helper (lasso) $('body').append(this.helper); this.helper.css({ @@ -347,36 +371,36 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v }); //Tell the intersection that some start selected - this.items.filter('.'+this.options.selectedClass).each(function() { - if(event.metaKey) { - if(this != self.clickedOnItem) $.data(this, "selectable-item").startSelected = true; - } else self._removeFromSelection($(this), event); - }); - + for (var i = this._selection.length - 1; i >= 0; i--){ + if(event.metaKey || event.ctrlKey) { + if(this != self.clickedOnItem) $(this._selection[i]).data("selectable-item").startSelected = true; + } else self._removeFromSelection($(this._selection[i]), event); + }; + }, - + _mouseDrag: function(event) { - + var self = this, o = this.options; - + if (o.disabled) return; - + //Do the lasso magic var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.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}); - + //Loop through all items and check overlaps this.items.each(function() { - + var item = $.data(this, "selectable-item"); - + //prevent helper from being selected if appendTo: selectable if (!item || item.element == self.element[0]) return; - + var hit = false; if (o.lasso && o.lasso.tolerance == 'touch') { hit = ( !(item.left > x2 || item.right < x1 || item.top > y2 || item.bottom < y1) ); @@ -387,43 +411,119 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v hit ? item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event) : !item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event); - + }); - + return false; - + }, - + _mouseStop: function(event) { - this._trigger("stop", event, this._uiHash()); + + var newlySelected = [], + newlyDeselected = []; + + // Find out the delta of the newly selected items + for (var i=0; i < this._selection.length; i++) { + var wasAlreadyPartOfPreviousSelection = false; + for (var j=0; j < this._previousSelection.length; j++) { + if(this._selection[i][0] == this._previousSelection[j][0]) + wasAlreadyPartOfPreviousSelection = true; + }; + if(!wasAlreadyPartOfPreviousSelection) newlySelected.push(this._selection[i]); + }; + + // Find out the delta of the newly unselected items + for (var i = this._previousSelection.length - 1; i >= 0; i--){ + if(!this._previousSelection[i].data('selectable-item').selected) newlyDeselected.push(this._previousSelection[i]); + }; + + + // Transform both deltas into jQuery objects + newlySelected = $($.map(newlySelected, function(i) { return i[0]; })); + newlyDeselected = $($.map(newlyDeselected, function(i) { return i[0]; })); + + var uiHash = $.extend(this._uiHash(), { + added: newlySelected || [], + removed: newlyDeselected || [] + }); + this._trigger("stop", event, uiHash); + + // Trigger change event if anything has changed + if((newlySelected && newlySelected.length) || (newlyDeselected && newlyDeselected.length)) { + this._trigger('change', event, uiHash); + } + this.helper.remove(); return false; - }, - + }, + _targetIsItem: function(item) { var found = $(item).parents().andSelf().filter(':data(selectable-item)'); return found.length && found; - }, + }, _selection: [], + _endSelection: function(event, newlySelected) { + + //Only trigger the 'deselect' event if items have been removed from the selection + var newlyDeselected = this._triggerDeselection(event); + + //Only trigger 'select' event if items have been added to the selection + if(newlySelected && newlySelected.length) + this._trigger('select', event, this._uiHash(newlySelected, 'added')); + + // Trigger change event if anything has changed + if((newlySelected && newlySelected.length) || (newlyDeselected && newlyDeselected.length)) { + var uiHash = $.extend(this._uiHash(), { + added: newlySelected || [], + removed: newlyDeselected || [] + }); + this._trigger('change', event, uiHash); + } + + }, + + _triggerDeselection: function(event) { + + var triggerItems = []; + + for (var i = this._previousSelection.length - 1; i >= 0; i--){ + var data = this._previousSelection[i].data('selectable-item'); + if(!data || !data.selected) triggerItems.push(this._previousSelection[i]); + }; + + this._previousSelection = []; + triggerItems = $($.map(triggerItems, function(i) { return i[0]; })); + if(triggerItems.length) this._trigger('deselect', event, this._uiHash(triggerItems, 'removed')); + + return triggerItems; + + }, + _clearSelection: function(triggerEvent) { var triggerItems = []; for (var i = this._selection.length - 1; i >= 0; i--){ - if(triggerEvent && this._selection[i].data('selectable-item').selected) triggerItems.push(this._selection[i]); - this._selection[i].removeClass(this.options.selectedClass); - this._selection[i].data('selectable-item').selected = false; + var data = this._selection[i].data('selectable-item'); + if(triggerEvent && data && data.selected) triggerItems.push(this._selection[i]); + this._selection[i].removeClass('ui-selected ui-state-active'); + if (data) + data.selected = false; }; + this._previousSelection = this._selection.slice(); this._selection = []; - if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($($.map(triggerItems, function(i) { return i[0]; })), 'removed')); + if(triggerEvent && triggerItems.length) this._trigger('deselect', triggerEvent, this._uiHash($($.map(triggerItems, function(i) { return i[0]; })), 'removed')); }, _toggleSelection: function(item, event) { - item.data('selectable-item').selected ? this._removeFromSelection(item, event) : this._addToSelection(item); + var selected = item.data('selectable-item').selected; + selected ? this._removeFromSelection(item, event) : this._addToSelection(item); + return !selected; }, _addToSelection: function(item, triggerEvent) { @@ -433,13 +533,13 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v this._selection.push(item); this.latestSelection = item; - item.addClass(this.options.selectedClass); + item.addClass('ui-selected ui-state-active'); item.data('selectable-item').selected = true; - + if(triggerEvent) { this._trigger('select', triggerEvent, $.extend({ lasso: true }, this._uiHash(item))); } - + return item; }, @@ -448,10 +548,14 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v for (var i=0; i < this._selection.length; i++) { if (this._selection[i][0] == item[0]) { - this._selection[i].removeClass(this.options.selectedClass); - this._selection[i].data('selectable-item').selected = false; + this._selection[i].removeClass('ui-selected ui-state-active'); + var data = this._selection[i].data('selectable-item'); + if (data) { + data.selected = false; + } + this._selection.splice(i,1); - if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($(item), 'removed')); + if(triggerEvent) this._trigger('deselect', triggerEvent, this._uiHash($(item), 'removed')); break; } }; @@ -462,10 +566,10 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var newlySelected = []; - if (event.shiftKey && this.options.multiple) { + if (event && event.shiftKey) { //Clear the previous selection to make room for a shift selection - this._clearSelection(event); + this._clearSelection(); var index = this.items.index(this.latestWithoutModifier[0]) > this.items.index(this.currentFocus[0]) ? -1 : 1; var i = this.latestWithoutModifier.data('selectable-item').selected ? this.items.eq(this.items.index(this.latestWithoutModifier[0])+index) : this.latestWithoutModifier; @@ -479,16 +583,17 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v } else { - if (event.metaKey) { - this._toggleSelection(this.currentFocus, event); + if (event && (event.metaKey || event.ctrlKey)) { + var withMetaIsNewlySelected = this._toggleSelection(this.currentFocus, event); + if(withMetaIsNewlySelected) newlySelected.push(this.currentFocus); } else { - this._clearSelection(event); + this._clearSelection(); newlySelected.push(this._addToSelection(this.currentFocus)); this.latestWithoutModifier = this.currentFocus; } } - + return $($.map(newlySelected, function(i) { return i[0]; })); }, @@ -497,7 +602,7 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var newlySelected = []; - if (event.shiftKey && this.options.multiple) { + if (event && event.shiftKey) { if (this.currentFocus.data('selectable-item').selected) { this._removeFromSelection(this.previousFocus, event); @@ -519,7 +624,7 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v } else { //If the CTRL or Apple/Win key is pressed, only set focus - if (event.metaKey) + if (event && (event.metaKey || event.ctrlKey)) return; this._clearSelection(event); @@ -527,84 +632,148 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v this.latestWithoutModifier = this.currentFocus; } - - return $($.map(newlySelected, function(i) { return i[0]; })); + + return $($.map(newlySelected, function(i) { if(i) return i[0]; })); }, _select: function(event, item) { //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus; - this.currentFocus = $(item); + this.previousFocus = this.currentFocus.attr('tabindex', -1); + this.currentFocus = $(item).attr('tabindex', 0); - this.previousFocus.removeClass('ui-focused'); - this.currentFocus.addClass('ui-focused'); + this.previousFocus.removeClass('ui-state-focus'); + this.currentFocus.addClass('ui-state-focus'); //Set and update the selection var newlySelected = this._updateSelectionMouse(event); - //Trigger select event - if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); + // Ending the selection does a diff and then triggers appropriate events + this._endSelection(event, newlySelected); }, _selectAdjacent: function(event, index) { var item = this.items.eq(this.items.index(this.currentFocus[0]) + index); - + //Bail if there's no previous/next item if (!item.length) return; //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus; - this.currentFocus = item; + this.previousFocus = this.currentFocus.attr('tabindex', -1); + this.currentFocus = item.attr('tabindex', 0); - this.previousFocus.removeClass('ui-focused'); - this.currentFocus.addClass('ui-focused'); + this.previousFocus.removeClass('ui-state-focus'); + this.currentFocus.addClass('ui-state-focus'); //Set and update the selection + this._previousSelection = this._selection.slice(); var newlySelected = this._updateSelection(event, index); - //Trigger select event - if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); + // Ending the selection does a diff and then triggers appropriate events + this._endSelection(event, newlySelected); }, - selectPrevious: function(event) { + previous: function(event) { this._selectAdjacent(event, -1); }, - selectNext: function(event) { + next: function(event) { this._selectAdjacent(event, 1); }, - - refresh: function() { - var o = this.options; + refresh: function(fromInside) { + + var o = this.options, self = this; this.items = $(o.filter, this.element); + this.items.addClass('ui-selectable-item'); this.items.each(function() { + var $this = $(this); var pos = $this.offset(); + + if(self.currentFocus && self.currentFocus[0] != this) + $this.attr('tabindex', -1); + $.data(this, "selectable-item", { left: pos.left, top: pos.top, right: pos.left + $this.width(), bottom: pos.top + $this.height(), startSelected: false, - selected: $this.hasClass(o.selectedClass) + selected: $this.hasClass('ui-selected') }); }); + + if(!fromInside) { + this._previousSelection = this._selection.slice(); + this._selection = []; + for (var i=0; i < this._previousSelection.length; i++) { + if(this._previousSelection[i][0].parentNode) this._selection.push(this._previousSelection[i]); + }; + + this._endSelection(); + } + + }, - + select: function(item) { - //TODO + + if(!isNaN(parseInt(item))) + item = this.items.get(item); + + item = $(item, this.element); + if(!item.length) return; + + // clear the current selection + this._clearSelection(); + + // select all found + var newlySelected = [], self = this; + item.each(function(i) { + if(i == 0) { //Setting the focus on the first item in the list + self.previousFocus = self.currentFocus.attr('tabindex', -1); + self.currentFocus = $(this).attr('tabindex', 0); + self.previousFocus.removeClass('ui-state-focus'); + self.currentFocus.addClass('ui-state-focus'); + } + newlySelected.push(self._addToSelection($(this))); + }); + + // Ending the selection does a diff and then triggers appropriate events + this._endSelection(event, $($.map(newlySelected, function(i) { return i[0]; }))); + }, - + deselect: function(item) { - if(!item) this._clearSelection(true); - //TODO: Deselect single elements + + // if no item was specified, deselect all + if(!item) + this._clearSelection(true); + + if(!isNaN(parseInt(item))) + item = this.items.get(item); + + item = $(item, this.element); + if(!item.length) return; + + //store the current selection + this._previousSelection = this._selection.slice(); + + // deselect all found + var self = this; + item.each(function() { + self._removeFromSelection($(this)); + }); + + // Ending the selection does a diff and then triggers appropriate events + this._endSelection(event); + }, _uiHash: function(items, specialKey) { @@ -621,17 +790,9 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v $.extend($.ui.selectable, { defaults: { - - //TODO: Figure out how to move these defaults out - cancel: ":input,option", - delay: 0, - distance: 1, - appendTo: 'body', - - multiple: true, - smart: true, + closest: true, filter: '> *', - + keyboard: true, lasso: { cancel: ":input,option", @@ -639,10 +800,7 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v distance: 1, tolerance: 'touch', appendTo: 'body' - }, - - //Should we really delete that? - selectedClass: 'ui-state-selected' + } } }); diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 15b5538d..ed786dac 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -102,9 +102,15 @@ width: 9em; } -.gOrganizeMicroThumbGridCell.ui-state-selected { - margin: 2px; - border: 2px solid #13A; +.gOrganizeMicroThumbGridCell.ui-selected { + margin: 2px !important; + border: 2px solid #13A !important; +} + +.gOrganizeMicroThumbGridCell.ui-state-focus, +.gOrganizeMicroThumbGridCell.ui-state-active { + background: none; + border: 0px; } .ui-selectable-lasso { diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index c30f89e0..7d204708 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,12 +1,12 @@ (function($) { $.organize = { micro_thumb_draggable: { - handle: ".ui-state-selected", + handle: ".ui-selected", distance: 10, cursorAt: { left: -10, top: -10}, appendTo: "#gOrganizeMicroThumbPanel", helper: function(event, ui) { - var selected = $(".ui-draggable.ui-state-selected img"); + var selected = $(".ui-draggable.ui-selected img"); if (selected.length) { var set = $('
') .css({ @@ -37,7 +37,7 @@ }, start: function(event, ui) { - $("#gOrganizeMicroThumbPanel .ui-state-selected").hide(); + $("#gOrganizeMicroThumbPanel .ui-selected").hide(); }, drag: function(event, ui) { @@ -80,7 +80,7 @@ greedy: true, drop: function(event, ui) { if ($(event.target).hasClass("gViewOnly")) { - $(".ui-state-selected").show(); + $(".ui-selected").show(); $(".gOrganizeMicroThumbGridCell").css("borderStyle", "none"); } else { $.organize.do_drop({ -- cgit v1.2.3 From 7ec490b6009965920fea35e971b29f11df6e6bff Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 11 Sep 2009 11:04:35 -0700 Subject: rawurlencode() path components in relative_path_cache and relative_url_cache so that they're safe for browser use. --- modules/gallery/models/item.php | 4 ++-- modules/gallery/tests/Item_Model_Test.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index da1f6959..a87997c6 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -284,8 +284,8 @@ class Item_Model extends ORM_MPTT { ->where("id <>", 1) ->orderby("left_ptr", "ASC") ->get() as $row) { - $names[] = urlencode($row->name); - $slugs[] = urlencode($row->slug); + $names[] = rawurlencode($row->name); + $slugs[] = rawurlencode($row->slug); } $this->relative_path_cache = implode($names, "/"); $this->relative_url_cache = implode($slugs, "/"); diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 585e247c..84210e4c 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -150,4 +150,14 @@ class Item_Model_Test extends Unit_Test_Case { $this->assert_same("ORIGINAL_VALUE", $item->original()->title); $this->assert_same("NEW_VALUE", $item->title); } + + public function urls_are_rawurlencoded_test() { + $item = self::_create_random_item(); + $item->slug = "foo bar"; + $item->name = "foo bar.jpg"; + $item->save(); + + $this->assert_equal("foo%20bar", $item->relative_url()); + $this->assert_equal("foo%20bar.jpg", $item->relative_path()); + } } -- cgit v1.2.3 From e1b9565232fac63ce63b29c434211ad9763b13ac Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 11 Sep 2009 11:16:52 -0700 Subject: Change all booleans to use php_flag instead of php_value. And turn off suhosin.session.encrypt by default. --- .htaccess | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.htaccess b/.htaccess index 8c2e3793..1d8bcb34 100644 --- a/.htaccess +++ b/.htaccess @@ -1,12 +1,13 @@ - php_value short_open_tag 1 - php_value magic_quotes_gpc 0 - php_value magic_quotes_sybase 0 - php_value magic_quotes_runtime 0 - php_value register_globals 0 - php_value session.auto_start 0 - php_value upload_max_filesize 20M - php_value post_max_size 100M + php_flag short_open_tag On + php_flag magic_quotes_gpc Off + php_flag magic_quotes_sybase Off + php_flag magic_quotes_runtime Off + php_flag register_globals Off + php_flag session.auto_start Off + php_flag suhosin.session.encrypt Off + php_value upload_max_filesize 20M + php_value post_max_size 100M # Try to disable the parts of mod_security that interfere with the Flash uploader -- cgit v1.2.3 From 82d61c698e47b7b838b9289a9d86bb275da30abb Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 11 Sep 2009 12:56:42 -0700 Subject: Revert "Upgraded to the latest svn version of selectable and applied local fixes to address ticket #696" This reverts commit afc1de54b1119680c144f474f1c587f3c69b6813. --- lib/jquery-ui.js | 410 ++++++++++++-------------------------- modules/organize/css/organize.css | 12 +- modules/organize/js/organize.js | 8 +- 3 files changed, 133 insertions(+), 297 deletions(-) diff --git a/lib/jquery-ui.js b/lib/jquery-ui.js index 85e457a0..4939d009 100644 --- a/lib/jquery-ui.js +++ b/lib/jquery-ui.js @@ -159,98 +159,87 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var self = this; this.items = $(this.options.filter, this.element); - this.element.addClass("ui-selectable ui-widget"); + this.element.addClass("ui-selectable"); //Set the currentFocus to the first item - this.currentFocus = this.items.eq(0).attr('tabindex', 0); - + this.currentFocus = this.items.eq(0); + //Refresh item positions - this.refresh(1); + this.refresh(); //Disable text selection this.element.disableSelection(); //Prepare caret selection - if(this.options.lasso) { - - // we need to move the lasso options onto the root options for the mouse clas - if(this.options.lasso !== true) { - $.extend(this.options, this.options.lasso); - } - - this._mouseInit(); - } + if(this.options.lasso) this._mouseInit(); this.element .bind('mousedown.selectable', function(event) { - if(self.options.disabled) - return; - var item = self._targetIsItem(event.target); if (!item) return; - + // If item is part of current selection and current // selection is multiple, return and allow mouseup // to fire (Windows gets this right too, OSX doesn't) - if(self._selection.length > 1 && $(item).hasClass('ui-selected')) { + if(self._selection.length > 1 && $(item).hasClass(self.options.selectedClass)) { return (self._listenForMouseUp = 1); } - + if(self._trigger('beforeselect', event) === false) return true; self._select(event, item); self.element[0].focus(); event.preventDefault(); - + }) .bind('mouseup.selectable', function(event) { if(self._listenForMouseUp) { - + self._listenForMouseUp = 0; var item = self._targetIsItem(event.target); if (!item) return; - + if(self._trigger('beforeselect', event) === false) return true; - + self._select(event, item); self.element[0].focus(); event.preventDefault(); } }) .bind('focus.selectable', function() { - if(!self.options.disabled) self.currentFocus.addClass('ui-state-focus'); + self.currentFocus.addClass('ui-focused'); }) .bind('blur.selectable', function() { - if(!self.options.disabled) self.currentFocus.removeClass('ui-state-focus'); + self.currentFocus.removeClass('ui-focused'); }) .bind('keydown.selectable', function(event) { - if(!self.options.keyboard || self.options.disabled) + if(!self.options.keyboard) return; - + if(self._trigger('beforeselect', event) === false) return true; - + if(event.keyCode == $.ui.keyCode.DOWN) { - self.options.closest ? self.selectClosest('down', event) : self.next(event); + self.options.smart ? self.selectClosest('down', event) : self.selectNext(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.RIGHT) { - self.options.closest ? self.selectClosest('right', event) : self.next(event); + self.options.smart ? self.selectClosest('right', event) : self.selectNext(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.UP) { - self.options.closest ? self.selectClosest('up', event) : self.previous(event); + self.options.smart ? self.selectClosest('up', event) : self.selectPrevious(event); event.preventDefault(); } - + if(event.keyCode == $.ui.keyCode.LEFT) { - self.options.closest ? self.selectClosest('left', event) : self.previous(event); + self.options.smart ? self.selectClosest('left', event) : self.selectPrevious(event); event.preventDefault(); } @@ -264,14 +253,14 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v .addClass("ui-selectable-lasso"); }, - + selectClosest: function(direction, event) { - + var current = [/(down|right)/.test(direction) ? 10000 : -10000, null], overlap = 10000, selfOffset = this.currentFocus.data('selectable-item'); - this.items.not(this.currentFocus).filter(':visible').each(function() { + $(this.options.filter, this.element).not(this.currentFocus).filter(':visible').each(function() { var $this = $(this), offset = $this.data('selectable-item'), @@ -281,84 +270,71 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v }; switch(direction) { - + case 'up': if((selfOffset.top > offset.top && offset.top >= current[0]) && (offset.top != current[0] || distance.x < overlap)) { current = [offset.top, $this]; overlap = distance.x; } break; - + case 'down': if((selfOffset.top < offset.top && offset.top <= current[0]) && (offset.top != current[0] || distance.x < overlap)) { current = [offset.top, $this]; overlap = distance.x; } break; - + case 'left': if((selfOffset.left > offset.left && offset.left >= current[0]) && (offset.left != current[0] || distance.y < overlap)) { current = [offset.left, $this]; overlap = distance.y; } break; - + case 'right': if((selfOffset.left < offset.left && offset.left <= current[0]) && (offset.left != current[0] || distance.y < overlap)) { current = [offset.left, $this]; overlap = distance.y; } break; - + } }); - - // if nothing close is found, bail - if(!current[1]) - return false; - - //We need to find the index of the current, and the index of the new one to call selectAdjacent - // - calling _select doesn't work, since it's only for mouse interaction (no ctrl focus move!) - var currentIndex = this.items.index(this.currentFocus[0]); - var newIndex = this.items.index(current[1]); - - return this._selectAdjacent(event, newIndex - currentIndex); - + + return current[1] ? this._select(event, current[1]) : false; + }, destroy: function() { - this.items.removeClass("ui-selectable-item ui-selected ui-state-active"); this.element - .removeClass("ui-selectable ui-selectable-disabled ui-widget") + .removeClass("ui-selectable ui-selectable-disabled") .removeData("selectable") .unbind(".selectable"); this._mouseDestroy(); }, - + _mouseCapture: function(event) { //If the item we start dragging on is a selectable, we bail (if keyboard is used) this.clickedOnItem = this._targetIsItem(event.target); - return true; // TODO: this starts the lasso on items as well - we might want to introduce an option to disable this + return !this.options.keyboard || !this.clickedOnItem; }, - + _mouseStart: function(event) { - + var self = this, o = this.options; this.opos = [event.pageX, event.pageY]; - + if (o.disabled) return; - + //Cache positions - this.refresh(1); - + this.refresh(); + //Trigger start event this._trigger("start", event, this._uiHash()); - - //Save the current selection as previous - this._previousSelection = this._selection.slice(); - + // append and position helper (lasso) $('body').append(this.helper); this.helper.css({ @@ -371,36 +347,36 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v }); //Tell the intersection that some start selected - for (var i = this._selection.length - 1; i >= 0; i--){ - if(event.metaKey || event.ctrlKey) { - if(this != self.clickedOnItem) $(this._selection[i]).data("selectable-item").startSelected = true; - } else self._removeFromSelection($(this._selection[i]), event); - }; - + this.items.filter('.'+this.options.selectedClass).each(function() { + if(event.metaKey) { + if(this != self.clickedOnItem) $.data(this, "selectable-item").startSelected = true; + } else self._removeFromSelection($(this), event); + }); + }, - + _mouseDrag: function(event) { - + var self = this, o = this.options; - + if (o.disabled) return; - + //Do the lasso magic var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.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}); - + //Loop through all items and check overlaps this.items.each(function() { - + var item = $.data(this, "selectable-item"); - + //prevent helper from being selected if appendTo: selectable if (!item || item.element == self.element[0]) return; - + var hit = false; if (o.lasso && o.lasso.tolerance == 'touch') { hit = ( !(item.left > x2 || item.right < x1 || item.top > y2 || item.bottom < y1) ); @@ -411,119 +387,43 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v hit ? item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event) : !item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event); - + }); - + return false; - + }, - + _mouseStop: function(event) { - - var newlySelected = [], - newlyDeselected = []; - - // Find out the delta of the newly selected items - for (var i=0; i < this._selection.length; i++) { - var wasAlreadyPartOfPreviousSelection = false; - for (var j=0; j < this._previousSelection.length; j++) { - if(this._selection[i][0] == this._previousSelection[j][0]) - wasAlreadyPartOfPreviousSelection = true; - }; - if(!wasAlreadyPartOfPreviousSelection) newlySelected.push(this._selection[i]); - }; - - // Find out the delta of the newly unselected items - for (var i = this._previousSelection.length - 1; i >= 0; i--){ - if(!this._previousSelection[i].data('selectable-item').selected) newlyDeselected.push(this._previousSelection[i]); - }; - - - // Transform both deltas into jQuery objects - newlySelected = $($.map(newlySelected, function(i) { return i[0]; })); - newlyDeselected = $($.map(newlyDeselected, function(i) { return i[0]; })); - - var uiHash = $.extend(this._uiHash(), { - added: newlySelected || [], - removed: newlyDeselected || [] - }); - this._trigger("stop", event, uiHash); - - // Trigger change event if anything has changed - if((newlySelected && newlySelected.length) || (newlyDeselected && newlyDeselected.length)) { - this._trigger('change', event, uiHash); - } - + this._trigger("stop", event, this._uiHash()); this.helper.remove(); return false; - }, - + }, + _targetIsItem: function(item) { var found = $(item).parents().andSelf().filter(':data(selectable-item)'); return found.length && found; - }, + }, _selection: [], - _endSelection: function(event, newlySelected) { - - //Only trigger the 'deselect' event if items have been removed from the selection - var newlyDeselected = this._triggerDeselection(event); - - //Only trigger 'select' event if items have been added to the selection - if(newlySelected && newlySelected.length) - this._trigger('select', event, this._uiHash(newlySelected, 'added')); - - // Trigger change event if anything has changed - if((newlySelected && newlySelected.length) || (newlyDeselected && newlyDeselected.length)) { - var uiHash = $.extend(this._uiHash(), { - added: newlySelected || [], - removed: newlyDeselected || [] - }); - this._trigger('change', event, uiHash); - } - - }, - - _triggerDeselection: function(event) { - - var triggerItems = []; - - for (var i = this._previousSelection.length - 1; i >= 0; i--){ - var data = this._previousSelection[i].data('selectable-item'); - if(!data || !data.selected) triggerItems.push(this._previousSelection[i]); - }; - - this._previousSelection = []; - triggerItems = $($.map(triggerItems, function(i) { return i[0]; })); - if(triggerItems.length) this._trigger('deselect', event, this._uiHash(triggerItems, 'removed')); - - return triggerItems; - - }, - _clearSelection: function(triggerEvent) { var triggerItems = []; for (var i = this._selection.length - 1; i >= 0; i--){ - var data = this._selection[i].data('selectable-item'); - if(triggerEvent && data && data.selected) triggerItems.push(this._selection[i]); - this._selection[i].removeClass('ui-selected ui-state-active'); - if (data) - data.selected = false; + if(triggerEvent && this._selection[i].data('selectable-item').selected) triggerItems.push(this._selection[i]); + this._selection[i].removeClass(this.options.selectedClass); + this._selection[i].data('selectable-item').selected = false; }; - this._previousSelection = this._selection.slice(); this._selection = []; - if(triggerEvent && triggerItems.length) this._trigger('deselect', triggerEvent, this._uiHash($($.map(triggerItems, function(i) { return i[0]; })), 'removed')); + if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($($.map(triggerItems, function(i) { return i[0]; })), 'removed')); }, _toggleSelection: function(item, event) { - var selected = item.data('selectable-item').selected; - selected ? this._removeFromSelection(item, event) : this._addToSelection(item); - return !selected; + item.data('selectable-item').selected ? this._removeFromSelection(item, event) : this._addToSelection(item); }, _addToSelection: function(item, triggerEvent) { @@ -533,13 +433,13 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v this._selection.push(item); this.latestSelection = item; - item.addClass('ui-selected ui-state-active'); + item.addClass(this.options.selectedClass); item.data('selectable-item').selected = true; - + if(triggerEvent) { this._trigger('select', triggerEvent, $.extend({ lasso: true }, this._uiHash(item))); } - + return item; }, @@ -548,14 +448,10 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v for (var i=0; i < this._selection.length; i++) { if (this._selection[i][0] == item[0]) { - this._selection[i].removeClass('ui-selected ui-state-active'); - var data = this._selection[i].data('selectable-item'); - if (data) { - data.selected = false; - } - + this._selection[i].removeClass(this.options.selectedClass); + this._selection[i].data('selectable-item').selected = false; this._selection.splice(i,1); - if(triggerEvent) this._trigger('deselect', triggerEvent, this._uiHash($(item), 'removed')); + if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($(item), 'removed')); break; } }; @@ -566,10 +462,10 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var newlySelected = []; - if (event && event.shiftKey) { + if (event.shiftKey && this.options.multiple) { //Clear the previous selection to make room for a shift selection - this._clearSelection(); + this._clearSelection(event); var index = this.items.index(this.latestWithoutModifier[0]) > this.items.index(this.currentFocus[0]) ? -1 : 1; var i = this.latestWithoutModifier.data('selectable-item').selected ? this.items.eq(this.items.index(this.latestWithoutModifier[0])+index) : this.latestWithoutModifier; @@ -583,17 +479,16 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v } else { - if (event && (event.metaKey || event.ctrlKey)) { - var withMetaIsNewlySelected = this._toggleSelection(this.currentFocus, event); - if(withMetaIsNewlySelected) newlySelected.push(this.currentFocus); + if (event.metaKey) { + this._toggleSelection(this.currentFocus, event); } else { - this._clearSelection(); + this._clearSelection(event); newlySelected.push(this._addToSelection(this.currentFocus)); this.latestWithoutModifier = this.currentFocus; } } - + return $($.map(newlySelected, function(i) { return i[0]; })); }, @@ -602,7 +497,7 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v var newlySelected = []; - if (event && event.shiftKey) { + if (event.shiftKey && this.options.multiple) { if (this.currentFocus.data('selectable-item').selected) { this._removeFromSelection(this.previousFocus, event); @@ -624,7 +519,7 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v } else { //If the CTRL or Apple/Win key is pressed, only set focus - if (event && (event.metaKey || event.ctrlKey)) + if (event.metaKey) return; this._clearSelection(event); @@ -632,148 +527,84 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v this.latestWithoutModifier = this.currentFocus; } - - return $($.map(newlySelected, function(i) { if(i) return i[0]; })); + + return $($.map(newlySelected, function(i) { return i[0]; })); }, _select: function(event, item) { //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus.attr('tabindex', -1); - this.currentFocus = $(item).attr('tabindex', 0); + this.previousFocus = this.currentFocus; + this.currentFocus = $(item); - this.previousFocus.removeClass('ui-state-focus'); - this.currentFocus.addClass('ui-state-focus'); + this.previousFocus.removeClass('ui-focused'); + this.currentFocus.addClass('ui-focused'); //Set and update the selection var newlySelected = this._updateSelectionMouse(event); - // Ending the selection does a diff and then triggers appropriate events - this._endSelection(event, newlySelected); + //Trigger select event + if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); }, _selectAdjacent: function(event, index) { var item = this.items.eq(this.items.index(this.currentFocus[0]) + index); - + //Bail if there's no previous/next item if (!item.length) return; //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus.attr('tabindex', -1); - this.currentFocus = item.attr('tabindex', 0); + this.previousFocus = this.currentFocus; + this.currentFocus = item; - this.previousFocus.removeClass('ui-state-focus'); - this.currentFocus.addClass('ui-state-focus'); + this.previousFocus.removeClass('ui-focused'); + this.currentFocus.addClass('ui-focused'); //Set and update the selection - this._previousSelection = this._selection.slice(); var newlySelected = this._updateSelection(event, index); - // Ending the selection does a diff and then triggers appropriate events - this._endSelection(event, newlySelected); + //Trigger select event + if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); }, - previous: function(event) { + selectPrevious: function(event) { this._selectAdjacent(event, -1); }, - next: function(event) { + selectNext: function(event) { this._selectAdjacent(event, 1); }, + + refresh: function() { - refresh: function(fromInside) { - - var o = this.options, self = this; + var o = this.options; this.items = $(o.filter, this.element); - this.items.addClass('ui-selectable-item'); this.items.each(function() { - var $this = $(this); var pos = $this.offset(); - - if(self.currentFocus && self.currentFocus[0] != this) - $this.attr('tabindex', -1); - $.data(this, "selectable-item", { left: pos.left, top: pos.top, right: pos.left + $this.width(), bottom: pos.top + $this.height(), startSelected: false, - selected: $this.hasClass('ui-selected') + selected: $this.hasClass(o.selectedClass) }); }); - - if(!fromInside) { - this._previousSelection = this._selection.slice(); - this._selection = []; - for (var i=0; i < this._previousSelection.length; i++) { - if(this._previousSelection[i][0].parentNode) this._selection.push(this._previousSelection[i]); - }; - - this._endSelection(); - } - - }, - + select: function(item) { - - if(!isNaN(parseInt(item))) - item = this.items.get(item); - - item = $(item, this.element); - if(!item.length) return; - - // clear the current selection - this._clearSelection(); - - // select all found - var newlySelected = [], self = this; - item.each(function(i) { - if(i == 0) { //Setting the focus on the first item in the list - self.previousFocus = self.currentFocus.attr('tabindex', -1); - self.currentFocus = $(this).attr('tabindex', 0); - self.previousFocus.removeClass('ui-state-focus'); - self.currentFocus.addClass('ui-state-focus'); - } - newlySelected.push(self._addToSelection($(this))); - }); - - // Ending the selection does a diff and then triggers appropriate events - this._endSelection(event, $($.map(newlySelected, function(i) { return i[0]; }))); - + //TODO }, - + deselect: function(item) { - - // if no item was specified, deselect all - if(!item) - this._clearSelection(true); - - if(!isNaN(parseInt(item))) - item = this.items.get(item); - - item = $(item, this.element); - if(!item.length) return; - - //store the current selection - this._previousSelection = this._selection.slice(); - - // deselect all found - var self = this; - item.each(function() { - self._removeFromSelection($(this)); - }); - - // Ending the selection does a diff and then triggers appropriate events - this._endSelection(event); - + if(!item) this._clearSelection(true); + //TODO: Deselect single elements }, _uiHash: function(items, specialKey) { @@ -790,9 +621,17 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v $.extend($.ui.selectable, { defaults: { - closest: true, - filter: '> *', + //TODO: Figure out how to move these defaults out + cancel: ":input,option", + delay: 0, + distance: 1, + appendTo: 'body', + + multiple: true, + smart: true, + filter: '> *', + keyboard: true, lasso: { cancel: ":input,option", @@ -800,7 +639,10 @@ jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(v distance: 1, tolerance: 'touch', appendTo: 'body' - } + }, + + //Should we really delete that? + selectedClass: 'ui-state-selected' } }); diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index ed786dac..15b5538d 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -102,15 +102,9 @@ width: 9em; } -.gOrganizeMicroThumbGridCell.ui-selected { - margin: 2px !important; - border: 2px solid #13A !important; -} - -.gOrganizeMicroThumbGridCell.ui-state-focus, -.gOrganizeMicroThumbGridCell.ui-state-active { - background: none; - border: 0px; +.gOrganizeMicroThumbGridCell.ui-state-selected { + margin: 2px; + border: 2px solid #13A; } .ui-selectable-lasso { diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 7d204708..c30f89e0 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,12 +1,12 @@ (function($) { $.organize = { micro_thumb_draggable: { - handle: ".ui-selected", + handle: ".ui-state-selected", distance: 10, cursorAt: { left: -10, top: -10}, appendTo: "#gOrganizeMicroThumbPanel", helper: function(event, ui) { - var selected = $(".ui-draggable.ui-selected img"); + var selected = $(".ui-draggable.ui-state-selected img"); if (selected.length) { var set = $('
') .css({ @@ -37,7 +37,7 @@ }, start: function(event, ui) { - $("#gOrganizeMicroThumbPanel .ui-selected").hide(); + $("#gOrganizeMicroThumbPanel .ui-state-selected").hide(); }, drag: function(event, ui) { @@ -80,7 +80,7 @@ greedy: true, drop: function(event, ui) { if ($(event.target).hasClass("gViewOnly")) { - $(".ui-selected").show(); + $(".ui-state-selected").show(); $(".gOrganizeMicroThumbGridCell").css("borderStyle", "none"); } else { $.organize.do_drop({ -- cgit v1.2.3 From 42454cad5afc7f78b557766f4182299327dee9b1 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 12 Sep 2009 08:50:19 -0700 Subject: Update the jquery-ui.js to use the release version of Selectable --- lib/jquery-ui.js | 969 ++++++++++++++++++------------------------------------- 1 file changed, 320 insertions(+), 649 deletions(-) diff --git a/lib/jquery-ui.js b/lib/jquery-ui.js index 4939d009..c803ea27 100644 --- a/lib/jquery-ui.js +++ b/lib/jquery-ui.js @@ -1,649 +1,320 @@ -/* - * jQuery UI 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI - */ -jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* - * jQuery UI Draggable 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * 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(a){a.widget("ui.draggable",a.extend({},a.ui.mouse,{_init:function(){if(this.options.helper=="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit()},destroy:function(){if(!this.element.data("draggable")){return}this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;if(this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")){return false}this.handle=this._getHandle(b);if(!this.handle){return false}return true},_mouseStart:function(b){var c=this.options;this.helper=this._createHelper(b);this._cacheHelperProportions();if(a.ui.ddmanager){a.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(b);this.originalPageX=b.pageX;this.originalPageY=b.pageY;if(c.cursorAt){this._adjustOffsetFromHelper(c.cursorAt)}if(c.containment){this._setContainment()}this._trigger("start",b);this._cacheHelperProportions();if(a.ui.ddmanager&&!c.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,b)}this.helper.addClass("ui-draggable-dragging");this._mouseDrag(b,true);return true},_mouseDrag:function(b,d){this.position=this._generatePosition(b);this.positionAbs=this._convertPositionTo("absolute");if(!d){var c=this._uiHash();this._trigger("drag",b,c);this.position=c.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(a.ui.ddmanager){a.ui.ddmanager.drag(this,b)}return false},_mouseStop:function(c){var d=false;if(a.ui.ddmanager&&!this.options.dropBehaviour){d=a.ui.ddmanager.drop(this,c)}if(this.dropped){d=this.dropped;this.dropped=false}if((this.options.revert=="invalid"&&!d)||(this.options.revert=="valid"&&d)||this.options.revert===true||(a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d))){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){b._trigger("stop",c);b._clear()})}else{this._trigger("stop",c);this._clear()}return false},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==b.target){c=true}});return c},_createHelper:function(c){var d=this.options;var b=a.isFunction(d.helper)?a(d.helper.apply(this.element[0],[c])):(d.helper=="clone"?this.element.clone():this.element);if(!b.parents("body").length){b.appendTo((d.appendTo=="parent"?this.element[0].parentNode:d.appendTo))}if(b[0]!=this.element[0]&&!(/(fixed|absolute)/).test(b.css("position"))){b.css("position","absolute")}return b},_adjustOffsetFromHelper:function(b){if(b.left!=undefined){this.offset.click.left=b.left+this.margins.left}if(b.right!=undefined){this.offset.click.left=this.helperProportions.width-b.right+this.margins.left}if(b.top!=undefined){this.offset.click.top=b.top+this.margins.top}if(b.bottom!=undefined){this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])){b.left+=this.scrollParent.scrollLeft();b.top+=this.scrollParent.scrollTop()}if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)){b={top:0,left:0}}return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var b=this.element.position();return{top:b.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:b.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else{return{top:0,left:0}}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e=this.options;if(e.containment=="parent"){e.containment=this.helper[0].parentNode}if(e.containment=="document"||e.containment=="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(e.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(e.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]}if(!(/^(document|window|parent)$/).test(e.containment)&&e.containment.constructor!=Array){var c=a(e.containment)[0];if(!c){return}var d=a(e.containment).offset();var b=(a(c).css("overflow")!="hidden");this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(b?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(b?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}else{if(e.containment.constructor==Array){this.containment=e.containment}}},_convertPositionTo:function(f,h){if(!h){h=this.position}var c=f=="absolute"?1:-1;var e=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=(/(html|body)/i).test(b[0].tagName);return{top:(h.top+this.offset.relative.top*c+this.offset.parent.top*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():(g?0:b.scrollTop()))*c)),left:(h.left+this.offset.relative.left*c+this.offset.parent.left*c-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:b.scrollLeft())*c))}},_generatePosition:function(e){var h=this.options,b=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,i=(/(html|body)/i).test(b[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset()}var d=e.pageX;var c=e.pageY;if(this.originalPosition){if(this.containment){if(e.pageX-this.offset.click.leftthis.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y=p&&n<=k)||(m>=p&&m<=k)||(nk))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(ec));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".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(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;/* - * jQuery UI Sortable 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Sortables - * - * Depends: - * ui.core.js - */ -(function(a){a.widget("ui.sortable",a.extend({},a.ui.mouse,{_init:function(){var b=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)f&&(e+h)m[this.floating?"width":"height"])){return g}else{return(f0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/* - * jQuery UI Accordion 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Accordion - * - * Depends: - * ui.core.js - */ -(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;/* - * jQuery UI Dialog 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * 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(c){var b={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"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||" ",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("
")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(f){var d=this;if(false===d._trigger("beforeclose",f)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",f)}):d.uiDialog.hide()&&d._trigger("close",f));c.ui.dialog.overlay.resize();d._isOpen=false;if(d.options.modal){var e=0;c(".ui-dialog").each(function(){if(this!=d.uiDialog[0]){e=Math.max(e,c(this).css("z-index"))}});c.ui.dialog.maxZ=e}},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||" ");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){if(c.ui.dialog.overlay.instances.length){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})}},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("
").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove();var e=0;c.each(this.instances,function(){e=Math.max(e,this.css("z-index"))});this.maxZ=e},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"
",spinner:"Loading…",tabTemplate:'
  • #{label}
  • '}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i
    ').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){if(b===undefined){return this._value()}this._setData("value",b);return this},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery);;/* - * jQuery UI Effects 1.7.2 - * - * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);;/* - * jQuery UI Selectable @VERSION - * - * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) - * 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.items = $(this.options.filter, this.element); - this.element.addClass("ui-selectable"); - - //Set the currentFocus to the first item - this.currentFocus = this.items.eq(0); - - //Refresh item positions - this.refresh(); - - //Disable text selection - this.element.disableSelection(); - - //Prepare caret selection - if(this.options.lasso) this._mouseInit(); - - this.element - .bind('mousedown.selectable', function(event) { - - var item = self._targetIsItem(event.target); - if (!item) return; - - // If item is part of current selection and current - // selection is multiple, return and allow mouseup - // to fire (Windows gets this right too, OSX doesn't) - if(self._selection.length > 1 && $(item).hasClass(self.options.selectedClass)) { - return (self._listenForMouseUp = 1); - } - - if(self._trigger('beforeselect', event) === false) - return true; - - self._select(event, item); - self.element[0].focus(); - event.preventDefault(); - - }) - .bind('mouseup.selectable', function(event) { - if(self._listenForMouseUp) { - - self._listenForMouseUp = 0; - var item = self._targetIsItem(event.target); - if (!item) return; - - if(self._trigger('beforeselect', event) === false) - return true; - - self._select(event, item); - self.element[0].focus(); - event.preventDefault(); - } - }) - .bind('focus.selectable', function() { - self.currentFocus.addClass('ui-focused'); - }) - .bind('blur.selectable', function() { - self.currentFocus.removeClass('ui-focused'); - }) - .bind('keydown.selectable', function(event) { - - if(!self.options.keyboard) - return; - - if(self._trigger('beforeselect', event) === false) - return true; - - if(event.keyCode == $.ui.keyCode.DOWN) { - self.options.smart ? self.selectClosest('down', event) : self.selectNext(event); - event.preventDefault(); - } - - if(event.keyCode == $.ui.keyCode.RIGHT) { - self.options.smart ? self.selectClosest('right', event) : self.selectNext(event); - event.preventDefault(); - } - - if(event.keyCode == $.ui.keyCode.UP) { - self.options.smart ? self.selectClosest('up', event) : self.selectPrevious(event); - event.preventDefault(); - } - - if(event.keyCode == $.ui.keyCode.LEFT) { - self.options.smart ? self.selectClosest('left', event) : self.selectPrevious(event); - event.preventDefault(); - } - - if ((event.ctrlKey || event.metaKey) && event.keyCode == $.ui.keyCode.SPACE) { - self._toggleSelection(self.currentFocus, event); - } - - }); - - this.helper = $(document.createElement('div')) - .addClass("ui-selectable-lasso"); - - }, - - selectClosest: function(direction, event) { - - var current = [/(down|right)/.test(direction) ? 10000 : -10000, null], - overlap = 10000, - selfOffset = this.currentFocus.data('selectable-item'); - - $(this.options.filter, this.element).not(this.currentFocus).filter(':visible').each(function() { - - var $this = $(this), - offset = $this.data('selectable-item'), - distance = { - x: Math.abs(selfOffset.left - offset.left) + Math.abs((offset.left+this.offsetWidth) - (selfOffset.left+this.offsetWidth)), - y: Math.abs(selfOffset.top - offset.top) + Math.abs((offset.top+this.offsetHeight) - (selfOffset.top+this.offsetHeight)) - }; - - switch(direction) { - - case 'up': - if((selfOffset.top > offset.top && offset.top >= current[0]) && (offset.top != current[0] || distance.x < overlap)) { - current = [offset.top, $this]; - overlap = distance.x; - } - break; - - case 'down': - if((selfOffset.top < offset.top && offset.top <= current[0]) && (offset.top != current[0] || distance.x < overlap)) { - current = [offset.top, $this]; - overlap = distance.x; - } - break; - - case 'left': - if((selfOffset.left > offset.left && offset.left >= current[0]) && (offset.left != current[0] || distance.y < overlap)) { - current = [offset.left, $this]; - overlap = distance.y; - } - break; - - case 'right': - if((selfOffset.left < offset.left && offset.left <= current[0]) && (offset.left != current[0] || distance.y < overlap)) { - current = [offset.left, $this]; - overlap = distance.y; - } - break; - - } - - }); - - return current[1] ? this._select(event, current[1]) : false; - - }, - - destroy: function() { - this.element - .removeClass("ui-selectable ui-selectable-disabled") - .removeData("selectable") - .unbind(".selectable"); - this._mouseDestroy(); - }, - - _mouseCapture: function(event) { - //If the item we start dragging on is a selectable, we bail (if keyboard is used) - this.clickedOnItem = this._targetIsItem(event.target); - return !this.options.keyboard || !this.clickedOnItem; - }, - - _mouseStart: function(event) { - - var self = this, o = this.options; - this.opos = [event.pageX, event.pageY]; - - if (o.disabled) - return; - - //Cache positions - this.refresh(); - - //Trigger start event - this._trigger("start", event, this._uiHash()); - - // append and position helper (lasso) - $('body').append(this.helper); - this.helper.css({ - zIndex: 100, - position: "absolute", - left: event.clientX, - top: event.clientY, - width: 0, - height: 0 - }); - - //Tell the intersection that some start selected - this.items.filter('.'+this.options.selectedClass).each(function() { - if(event.metaKey) { - if(this != self.clickedOnItem) $.data(this, "selectable-item").startSelected = true; - } else self._removeFromSelection($(this), event); - }); - - }, - - _mouseDrag: function(event) { - - var self = this, o = this.options; - - if (o.disabled) - return; - - //Do the lasso magic - var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.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}); - - //Loop through all items and check overlaps - this.items.each(function() { - - var item = $.data(this, "selectable-item"); - - //prevent helper from being selected if appendTo: selectable - if (!item || item.element == self.element[0]) - return; - - var hit = false; - if (o.lasso && o.lasso.tolerance == 'touch') { - hit = ( !(item.left > x2 || item.right < x1 || item.top > y2 || item.bottom < y1) ); - } else if (o.lasso && o.lasso.tolerance == 'fit') { - hit = (item.left > x1 && item.right < x2 && item.top > y1 && item.bottom < y2); - } - - hit ? - item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event) - : !item.startSelected ? self._removeFromSelection($(this), event) : self._addToSelection($(this), event); - - }); - - return false; - - }, - - _mouseStop: function(event) { - this._trigger("stop", event, this._uiHash()); - this.helper.remove(); - return false; - }, - - _targetIsItem: function(item) { - var found = $(item).parents().andSelf().filter(':data(selectable-item)'); - return found.length && found; - }, - - _selection: [], - - _clearSelection: function(triggerEvent) { - - var triggerItems = []; - - for (var i = this._selection.length - 1; i >= 0; i--){ - if(triggerEvent && this._selection[i].data('selectable-item').selected) triggerItems.push(this._selection[i]); - this._selection[i].removeClass(this.options.selectedClass); - this._selection[i].data('selectable-item').selected = false; - }; - - this._selection = []; - if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($($.map(triggerItems, function(i) { return i[0]; })), 'removed')); - - }, - - _toggleSelection: function(item, event) { - item.data('selectable-item').selected ? this._removeFromSelection(item, event) : this._addToSelection(item); - }, - - _addToSelection: function(item, triggerEvent) { - - if (item.data('selectable-item').selected) - return null; - - this._selection.push(item); - this.latestSelection = item; - item.addClass(this.options.selectedClass); - item.data('selectable-item').selected = true; - - if(triggerEvent) { - this._trigger('select', triggerEvent, $.extend({ lasso: true }, this._uiHash(item))); - } - - return item; - - }, - - _removeFromSelection: function(item, triggerEvent) { - - for (var i=0; i < this._selection.length; i++) { - if (this._selection[i][0] == item[0]) { - this._selection[i].removeClass(this.options.selectedClass); - this._selection[i].data('selectable-item').selected = false; - this._selection.splice(i,1); - if(triggerEvent) this._trigger('unselect', triggerEvent, this._uiHash($(item), 'removed')); - break; - } - }; - - }, - - _updateSelectionMouse: function(event) { - - var newlySelected = []; - - if (event.shiftKey && this.options.multiple) { - - //Clear the previous selection to make room for a shift selection - this._clearSelection(event); - - var index = this.items.index(this.latestWithoutModifier[0]) > this.items.index(this.currentFocus[0]) ? -1 : 1; - var i = this.latestWithoutModifier.data('selectable-item').selected ? this.items.eq(this.items.index(this.latestWithoutModifier[0])+index) : this.latestWithoutModifier; - while(i.length && i[0] != this.currentFocus[0]) { - i[0] == this.previousFocus[0] ? this._addToSelection(i) : newlySelected.push(this._addToSelection(i)); - i = this.items.eq(this.items.index(i[0])+index); - } - - //Readd the item with the current focus - newlySelected.push(this._addToSelection(this.currentFocus)); - - } else { - - if (event.metaKey) { - this._toggleSelection(this.currentFocus, event); - } else { - this._clearSelection(event); - newlySelected.push(this._addToSelection(this.currentFocus)); - this.latestWithoutModifier = this.currentFocus; - } - - } - - return $($.map(newlySelected, function(i) { return i[0]; })); - - }, - - _updateSelection: function(event, index) { - - var newlySelected = []; - - if (event.shiftKey && this.options.multiple) { - - if (this.currentFocus.data('selectable-item').selected) { - this._removeFromSelection(this.previousFocus, event); - } else { - - var index2 = this.items.index(this.latestSelection[0]) > this.items.index(this.currentFocus[0]) ? 1 : -1; - if (!this.previousFocus.data('selectable-item').selected) { - var i = index == index2 ? this.items.eq(this.items.index(this.previousFocus[0])+index2) : this.previousFocus; - while(i.length && !i.data('selectable-item').selected) { - newlySelected.push(this._addToSelection(i)); - i = this.items.eq(this.items.index(i[0])+index2); - } - } - - newlySelected.push(this._addToSelection(this.currentFocus)); - - } - - } else { - - //If the CTRL or Apple/Win key is pressed, only set focus - if (event.metaKey) - return; - - this._clearSelection(event); - newlySelected.push(this._addToSelection(this.currentFocus)); - this.latestWithoutModifier = this.currentFocus; - - } - - return $($.map(newlySelected, function(i) { return i[0]; })); - - }, - - _select: function(event, item) { - - //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus; - this.currentFocus = $(item); - - this.previousFocus.removeClass('ui-focused'); - this.currentFocus.addClass('ui-focused'); - - //Set and update the selection - var newlySelected = this._updateSelectionMouse(event); - - //Trigger select event - if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); - - }, - - _selectAdjacent: function(event, index) { - - var item = this.items.eq(this.items.index(this.currentFocus[0]) + index); - - //Bail if there's no previous/next item - if (!item.length) return; - - //Set the current selection to the previous/next item - this.previousFocus = this.currentFocus; - this.currentFocus = item; - - this.previousFocus.removeClass('ui-focused'); - this.currentFocus.addClass('ui-focused'); - - //Set and update the selection - var newlySelected = this._updateSelection(event, index); - - //Trigger select event - if(newlySelected && newlySelected.length) this._trigger('select', event, this._uiHash(newlySelected, 'added')); - - }, - - selectPrevious: function(event) { - this._selectAdjacent(event, -1); - }, - - selectNext: function(event) { - this._selectAdjacent(event, 1); - }, - - refresh: function() { - - var o = this.options; - this.items = $(o.filter, this.element); - this.items.each(function() { - var $this = $(this); - var pos = $this.offset(); - $.data(this, "selectable-item", { - left: pos.left, - top: pos.top, - right: pos.left + $this.width(), - bottom: pos.top + $this.height(), - startSelected: false, - selected: $this.hasClass(o.selectedClass) - }); - }); - - }, - - select: function(item) { - //TODO - }, - - deselect: function(item) { - if(!item) this._clearSelection(true); - //TODO: Deselect single elements - }, - - _uiHash: function(items, specialKey) { - var uiHash = { - previousFocus: this.previousFocus, - currentFocus: this.currentFocus, - selection: $($.map(this._selection, function(i) { return i[0]; })) - }; - if(specialKey) uiHash[specialKey] = items; - return uiHash; - } - - })); - - $.extend($.ui.selectable, { - defaults: { - - //TODO: Figure out how to move these defaults out - cancel: ":input,option", - delay: 0, - distance: 1, - appendTo: 'body', - - multiple: true, - smart: true, - filter: '> *', - - keyboard: true, - lasso: { - cancel: ":input,option", - delay: 0, - distance: 1, - tolerance: 'touch', - appendTo: 'body' - }, - - //Should we really delete that? - selectedClass: 'ui-state-selected' - } - }); - -})(jQuery); +;jQuery.ui||(function($){var _remove=$.fn.remove,isFF2=$.browser.mozilla&&(parseFloat($.browser.version)<1.9);$.ui={version:"1.7.2",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;} +for(var i=0;i0){return true;} +el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(isFF2){var attr=$.attr,removeAttr=$.fn.removeAttr,ariaNS="http://www.w3.org/2005/07/aaa",ariaState=/^aria-/,ariaRole=/^wairole:/;$.attr=function(elem,name,value){var set=value!==undefined;return(name=='role'?(set?attr.call(this,elem,name,"wairole:"+value):(attr.apply(this,arguments)||"").replace(ariaRole,"")):(ariaState.test(name)?(set?elem.setAttributeNS(ariaNS,name.replace(ariaState,"aaa:"),value):attr.call(this,elem,name.replace(ariaState,"aaa:"))):attr.apply(this,arguments)));};$.fn.removeAttr=function(name){return(ariaState.test(name)?this.each(function(){this.removeAttributeNS(ariaNS,name.replace(ariaState,""));}):removeAttr.call(this,name));};} +$.fn.extend({remove:function(){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});return _remove.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','').unbind('selectstart.ui');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none').bind('selectstart.ui',function(){return false;});},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);} +return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});function getter(namespace,plugin,method,args){function getMethods(type){var methods=$[namespace][plugin][type]||[];return(typeof methods=='string'?methods.split(/,?\s+/):methods);} +var methods=getMethods('getter');if(args.length==1&&typeof args[0]=='string'){methods=methods.concat(getMethods('getterSetter'));} +return($.inArray(method,methods)!=-1);} +$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=='string'),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&options.substring(0,1)=='_'){return this;} +if(isMethodCall&&getter(namespace,name,options,args)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined);} +return this.each(function(){var instance=$.data(this,name);(!instance&&!isMethodCall&&$.data(this,name,new $[namespace][name](this,options))._init());(instance&&isMethodCall&&$.isFunction(instance[options])&&instance[options].apply(instance,args));});};$[namespace]=$[namespace]||{};$[namespace][name]=function(element,options){var self=this;this.namespace=namespace;this.widgetName=name;this.widgetEventPrefix=$[namespace][name].eventPrefix||name;this.widgetBaseClass=namespace+'-'+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,$.metadata&&$.metadata.get(element)[name],options);this.element=$(element).bind('setData.'+name,function(event,key,value){if(event.target==element){return self._setData(key,value);}}).bind('getData.'+name,function(event,key){if(event.target==element){return self._getData(key);}}).bind('remove',function(){return self.destroy();});};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype);$[namespace][name].getterSetter='option';};$.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+'-disabled'+' '+this.namespace+'-state-disabled').removeAttr('aria-disabled');},option:function(key,value){var options=key,self=this;if(typeof key=="string"){if(value===undefined){return this._getData(key);} +options={};options[key]=value;} +$.each(options,function(key,value){self._setData(key,value);});},_getData:function(key){return this.options[key];},_setData:function(key,value){this.options[key]=value;if(key=='disabled'){this.element +[value?'addClass':'removeClass'](this.widgetBaseClass+'-disabled'+' '+ +this.namespace+'-state-disabled').attr("aria-disabled",value);}},enable:function(){this._setData('disabled',false);},disable:function(){this._setData('disabled',true);},_trigger:function(type,event,data){var callback=this.options[type],eventName=(type==this.widgetEventPrefix?type:this.widgetEventPrefix+type);event=$.Event(event);event.type=eventName;if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}} +this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};$.widget.defaults={disabled:false};$.ui.mouse={_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;event.stopImmediatePropagation();return false;}});if($.browser.msie){this._mouseUnselectable=this.element.attr('unselectable');this.element.attr('unselectable','on');} +this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);($.browser.msie&&this.element.attr('unselectable',this._mouseUnselectable));},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;} +(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;} +this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);} +if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}} +this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);} +if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();} +if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));} +return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);} +return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0};})(jQuery);(function($){$.widget("ui.draggable",$.extend({},$.ui.mouse,{_init:function(){if(this.options.helper=='original'&&!(/^(?:r|a|f)/).test(this.element.css("position"))) +this.element[0].style.position='relative';(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable" ++" ui-draggable-dragging" ++" ui-draggable-disabled");this._mouseDestroy();},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is('.ui-resizable-handle')) +return false;this.handle=this._getHandle(event);if(!this.handle) +return false;return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager) +$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt) +this._adjustOffsetFromHelper(o.cursorAt);if(o.containment) +this._setContainment();this._trigger("start",event);this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour) +$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true;},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();this._trigger('drag',event,ui);this.position=ui.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,event);return false;},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour) +dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false;} +if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){self._trigger("stop",event);self._clear();});}else{this._trigger("stop",event);this._clear();} +return false;},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true;});return handle;},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=='clone'?this.element.clone():this.element);if(!helper.parents('body').length) +helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))) +helper.css("position","absolute");return helper;},_adjustOffsetFromHelper:function(obj){if(obj.left!=undefined)this.offset.click.left=obj.left+this.margins.left;if(obj.right!=undefined)this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;if(obj.top!=undefined)this.offset.click.top=obj.top+this.margins.top;if(obj.bottom!=undefined)this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();} +if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie)) +po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;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.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else if(o.containment.constructor==Array){this.containment=o.containment;}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top ++this.offset.relative.top*mod ++this.offset.parent.top*mod +-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left ++this.offset.relative.left*mod ++this.offset.parent.left*mod +-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();} +var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.leftthis.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;} +if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.topthis.containment[3])?top:(!(top-this.offset.click.topthis.containment[2])?left:(!(left-this.offset.click.left').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data('draggable').options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css('opacity',o.opacity);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._opacity)$(ui.helper).css('opacity',o._opacity);}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML')i.overflowOffset=i.scrollParent.offset();},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML'){if(!o.axis||o.axis!='x'){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY=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;if(!((l-d=t&&y1<=b)||(y2>=t&&y2<=b)||(y1b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:{'default':[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope];var type=event?event.type:null;var list=(t.currentItem||t.element).find(":data(droppable)").andSelf();droppablesLoop:for(var i=0;i').css({position:this.element.css('position'),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css('top'),left:this.element.css('left')}));this.element=this.element.parent().data("resizable",this.element.data('resizable'));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css('resize');this.originalElement.css('resize','none');this._proportionallyResizeElements.push(this.originalElement.css({position:'static',zoom:1,display:'block'}));this.originalElement.css({margin:this.originalElement.css('margin')});this._proportionallyResize();} +this.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(this.handles.constructor==String){if(this.handles=='all')this.handles='n,e,s,w,se,sw,ne,nw';var n=this.handles.split(",");this.handles={};for(var i=0;i');if(/sw|se|ne|nw/.test(handle))axis.css({zIndex:++o.zIndex});if('se'==handle){axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');};this.handles[handle]='.ui-resizable-'+handle;this.element.append(axis);}} +this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String) +this.handles[i]=$(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var axis=$(this.handles[i],this.element),padWrapper=0;padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();var padPos=['padding',/ne|nw|n/.test(i)?'Top':/se|sw|s/.test(i)?'Bottom':/^e$/.test(i)?'Right':'Left'].join("");target.css(padPos,padWrapper);this._proportionallyResize();} +if(!$(this.handles[i]).length) +continue;}};this._renderAxis(this.element);this._handles=$('.ui-resizable-handle',this.element).disableSelection();this._handles.mouseover(function(){if(!self.resizing){if(this.className) +var axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);self.axis=axis&&axis[1]?axis[1]:'se';}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").hover(function(){$(this).removeClass("ui-resizable-autohide");self._handles.show();},function(){if(!self.resizing){$(this).addClass("ui-resizable-autohide");self._handles.hide();}});} +this._mouseInit();},destroy:function(){this._mouseDestroy();var _destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();};if(this.elementIsWrapper){_destroy(this.element);var wrapper=this.element;wrapper.parent().append(this.originalElement.css({position:wrapper.css('position'),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css('top'),left:wrapper.css('left')})).end().remove();} +this.originalElement.css('resize',this.originalResizeStyle);_destroy(this.originalElement);},_mouseCapture:function(event){var handle=false;for(var i in this.handles){if($(this.handles[i])[0]==event.target)handle=true;} +return this.options.disabled||!!handle;},_mouseStart:function(event){var o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;this.documentScroll={top:$(document).scrollTop(),left:$(document).scrollLeft()};if(el.is('.ui-draggable')||(/absolute/).test(el.css('position'))){el.css({position:'absolute',top:iniPos.top,left:iniPos.left});} +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;} +this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{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:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio=='number')?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var cursor=$('.ui-resizable-'+this.axis).css('cursor');$('body').css('cursor',cursor=='auto'?this.axis+'-resize':cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true;},_mouseDrag:function(event){var el=this.helper,o=this.options,props={},self=this,smp=this.originalMousePosition,a=this.axis;var dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0;var trigger=this._change[a];if(!trigger)return false;var data=trigger.apply(this,[event,dx,dy]),ie6=$.browser.msie&&$.browser.version<7,csdif=this.sizeDiff;if(this._aspectRatio||event.shiftKey) +data=this._updateRatio(data,event);data=this._respectSize(data,event);this._propagate("resize",event);el.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length) +this._proportionallyResize();this._updateCache(data);this._trigger('resize',event,this.ui());return false;},_mouseStop:function(event){this.resizing=false;var o=this.options,self=this;if(this._helper){var pr=this._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?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}));self.helper.height(self.size.height);self.helper.width(self.size.width);if(this._helper&&!o.animate)this._proportionallyResize();} +$('body').css('cursor','auto');this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper)this.helper.remove();return false;},_updateCache:function(data){var o=this.options;this.offset=this.helper.offset();if(isNumber(data.left))this.position.left=data.left;if(isNumber(data.top))this.position.top=data.top;if(isNumber(data.height))this.size.height=data.height;if(isNumber(data.width))this.size.width=data.width;},_updateRatio:function(data,event){var o=this.options,cpos=this.position,csize=this.size,a=this.axis;if(data.height)data.width=(csize.height*this.aspectRatio);else if(data.width)data.height=(csize.width/this.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,event){var el=this.helper,o=this.options,pRatio=this._aspectRatio||event.shiftKey,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&(o.maxWidthdata.width),isminh=isNumber(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;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(!this._proportionallyResizeElements.length)return;var element=this.helper||this.element;for(var i=0;i');var ie6=$.browser.msie&&$.browser.version<7,ie6offset=(ie6?1:0),pxyoffset=(ie6?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+pxyoffset,height:this.element.outerHeight()+pxyoffset,position:'absolute',left:this.elementOffset.left-ie6offset+'px',top:this.elementOffset.top-ie6offset+'px',zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(event,dx,dy){return{width:this.originalSize.width+dx};},w:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(event,dx,dy){var o=this.options,cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(event,dx,dy){return{height:this.originalSize.height+dy};},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);(n!="resize"&&this._trigger(n,event,this.ui()));},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}}));$.extend($.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});$.ui.plugin.add("resizable","alsoResize",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options;_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'&&!o.alsoResize.parentNode){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(event,ui){var self=$(this).data("resizable"),o=self.options,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 el=$(this),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;});if(/relative/.test(el.css('position'))&&$.browser.opera){self._revertToRelativePosition=true;el.css({position:'absolute',top:'auto',left:'auto'});} +el.css(style);});};if(typeof(o.alsoResize)=='object'&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(event,ui){var self=$(this).data("resizable");if(self._revertToRelativePosition&&$.browser.opera){self._revertToRelativePosition=false;el.css({position:'relative'});} +$(this).removeData("resizable-alsoresize-start");}});$.ui.plugin.add("resizable","animate",{stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;var pr=self._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],'left')?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,easing:o.animateEasing,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.length)$(pr[0]).css({width:data.width,height:data.height});self._updateCache(data);self._propagate("resize",event);}});}});$.ui.plugin.add("resizable","containment",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,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};} +else{var element=$(ce),p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name));});self.containerOffset=element.offset();self.containerPosition=element.position();self.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};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(event,ui){var self=$(this).data("resizable"),o=self.options,ps=self.containerSize,co=self.containerOffset,cs=self.size,cp=self.position,pRatio=self._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=self.containerElement;if(ce[0]!=document&&(/static/).test(ce.css('position')))cop=co;if(cp.left<(self._helper?co.left:0)){self.size.width=self.size.width+(self._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:0;} +if(cp.top<(self._helper?co.top:0)){self.size.height=self.size.height+(self._helper?(self.position.top-co.top):self.position.top);if(pRatio)self.size.width=self.size.height*o.aspectRatio;self.position.top=self._helper?co.top:0;} +self.offset.left=self.parentData.left+self.position.left;self.offset.top=self.parentData.top+self.position.top;var woset=Math.abs((self._helper?self.offset.left-cop.left:(self.offset.left-cop.left))+self.sizeDiff.width),hoset=Math.abs((self._helper?self.offset.top-cop.top:(self.offset.top-co.top))+self.sizeDiff.height);var isParent=self.containerElement.get(0)==self.element.parent().get(0),isOffsetRelative=/relative|absolute/.test(self.containerElement.css('position'));if(isParent&&isOffsetRelative)woset-=self.parentData.left;if(woset+self.size.width>=self.parentData.width){self.size.width=self.parentData.width-woset;if(pRatio)self.size.height=self.size.width/self.aspectRatio;} +if(hoset+self.size.height>=self.parentData.height){self.size.height=self.parentData.height-hoset;if(pRatio)self.size.width=self.size.height*self.aspectRatio;}},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options,cp=self.position,co=self.containerOffset,cop=self.containerPosition,ce=self.containerElement;var helper=$(self.helper),ho=helper.offset(),w=helper.outerWidth()-self.sizeDiff.width,h=helper.outerHeight()-self.sizeDiff.height;if(self._helper&&!o.animate&&(/relative/).test(ce.css('position'))) +$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});if(self._helper&&!o.animate&&(/static/).test(ce.css('position'))) +$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.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(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.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;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.widget("ui.selectable",$.extend({},$.ui.mouse,{_init:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;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.outerWidth(),bottom:pos.top+$this.outerHeight(),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'}).addClass("ui-selectable-helper");},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();},_mouseStart:function(event){var self=this;this.opos=[event.pageX,event.pageY];if(this.options.disabled) +return;var options=this.options;this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":event.clientX,"top":event.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(!event.metaKey){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');selectee.unselecting=false;selectee.selecting=true;selectee.selected=true;self._trigger("selecting",event,{selecting:selectee.element});return false;}});},_mouseDrag:function(event){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=event.pageX,y2=event.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");if(!selectee||selectee.element==self.element[0]) +return;var hit=false;if(options.tolerance=='touch'){hit=(!(selectee.left>x2||selectee.righty2||selectee.bottomx1&&selectee.righty1&&selectee.bottom=0;i--) +this.items[i].item.removeData("sortable-item");},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;} +if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;} +this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt) +this._adjustOffsetFromHelper(o.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();} +this._createPlaceholder();if(o.containment) +this._setContainment();if(o.cursor){if($('body').css("cursor"))this._storedCursor=$('body').css("cursor");$('body').css("cursor",o.cursor);} +if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity);} +if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex);} +if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML') +this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions) +this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this));}} +if($.ui.ddmanager) +$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour) +$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;} +if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML'){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=='semi-dynamic'?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;} +this._trigger("change",event,this._uiHash());break;}} +this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger('sort',event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour) +$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event);});}else{this._clear(event,noPropagation);} +return false;},cancel:function(){var self=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original") +this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else +this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0;}}} +if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);} +return true;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1]+'[]')+'='+(o.key&&o.expression?res[1]:res[2]));});return str.join('&');},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||'id')||'');});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)l&&(x1+dxClick)item[this.floating?'width':'height'])){return isOverElement;}else{return(l0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper"),inst]);}};};} +queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this);});};return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};} +for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j=0;i--){var item=this.items[i];if(item.instance!=this.currentContainer&&this.currentContainer&&item.item[0]!=this.currentItem[0]) +continue;var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();} +var p=t.offset();item.left=p.left;item.top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className) +el.style.visibility="hidden";return el;},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css('paddingTop')||0,10)-parseInt(self.currentItem.css('paddingBottom')||0,10));};if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css('paddingLeft')||0,10)-parseInt(self.currentItem.css('paddingRight')||0,10));};}};} +self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder);},_contactContainers:function(event){for(var i=this.containers.length-1;i>=0;i--){if(this._intersectsWith(this.containers[i].containerCache)){if(!this.containers[i].containerCache.over){if(this.currentContainer!=this.containers[i]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[i].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[i].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[i].floating?'left':'top'];if(Math.abs(cur-base)this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;} +if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.topthis.containment[3])?top:(!(top-this.offset.click.topthis.containment[2])?left:(!(left-this.offset.click.left=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.containers[i]));}};};for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this));};}).call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this));};}).call(this,this.containers[i]));this.containers[i].containerCache.over=0;}} +if(this._storedCursor)$('body').css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=='auto'?'':this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i *',opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}});})(jQuery);(function($){$.widget("ui.accordion",{_init:function(){var o=this.options,self=this;this.running=0;if(o.collapsible==$.ui.accordion.defaults.collapsible&&o.alwaysOpen!=$.ui.accordion.defaults.alwaysOpen){o.collapsible=!o.alwaysOpen;} +if(o.navigation){var current=this.element.find("a").filter(o.navigationFilter);if(current.length){if(current.filter(o.header).length){this.active=current;}else{this.active=current.parent().parent().prev();current.addClass("ui-accordion-content-active");}}} +this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix");} +this.headers=this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){$(this).addClass('ui-state-hover');}).bind("mouseleave.accordion",function(){$(this).removeClass('ui-state-hover');}).bind("focus.accordion",function(){$(this).addClass('ui-state-focus');}).bind("blur.accordion",function(){$(this).removeClass('ui-state-focus');});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass('ui-accordion-content-active');$("").addClass("ui-icon "+o.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);if($.browser.msie){this.element.find('a').css('zoom','1');} +this.resize();this.element.attr('role','tablist');this.headers.attr('role','tab').bind('keydown',function(event){return self._keydown(event);}).next().attr('role','tabpanel');this.headers.not(this.active||"").attr('aria-expanded','false').attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr('tabIndex','0');}else{this.active.attr('aria-expanded','true').attr('tabIndex','0');} +if(!$.browser.safari) +this.headers.find('a').attr('tabIndex','-1');if(o.event){this.headers.bind((o.event)+".accordion",function(event){return self._clickHandler.call(self,event,this);});}},destroy:function(){var o=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind('.accordion').removeData('accordion');this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var contents=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(o.autoHeight||o.fillHeight){contents.css("height","");}},_setData:function(key,value){if(key=='alwaysOpen'){key='collapsible';value=!value;} +$.widget.prototype._setData.apply(this,arguments);},_keydown:function(event){var o=this.options,keyCode=$.ui.keyCode;if(o.disabled||event.altKey||event.ctrlKey) +return;var length=this.headers.length;var currentIndex=this.headers.index(event.target);var toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:return this._clickHandler({target:event.target},event.target);} +if(toFocus){$(event.target).attr('tabIndex','-1');$(toFocus).attr('tabIndex','0');toFocus.focus();return false;} +return true;},resize:function(){var o=this.options,maxHeight;if(o.fillSpace){if($.browser.msie){var defOverflow=this.element.parent().css('overflow');this.element.parent().css('overflow','hidden');} +maxHeight=this.element.parent().height();if($.browser.msie){this.element.parent().css('overflow',defOverflow);} +this.headers.each(function(){maxHeight-=$(this).outerHeight();});var maxPadding=0;this.headers.next().each(function(){maxPadding=Math.max(maxPadding,$(this).innerHeight()-$(this).height());}).height(Math.max(0,maxHeight-maxPadding)).css('overflow','auto');}else if(o.autoHeight){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}},activate:function(index){var active=this._findActive(index)[0];this._clickHandler({target:active},active);},_findActive:function(selector){return selector?typeof selector=="number"?this.headers.filter(":eq("+selector+")"):this.headers.not(this.headers.not(selector)):selector===false?$([]):this.headers.filter(":eq(0)");},_clickHandler:function(event,target){var o=this.options;if(o.disabled)return false;if(!event.target&&o.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);this.active.next().addClass('ui-accordion-content-active');var toHide=this.active.next(),data={options:o,newHeader:$([]),oldHeader:o.active,newContent:$([]),oldContent:toHide},toShow=(this.active=$([]));this._toggle(toShow,toHide,data);return false;} +var clicked=$(event.currentTarget||target);var clickedIsActive=clicked[0]==this.active[0];if(this.running||(!o.collapsible&&clickedIsActive)){return false;} +this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);this.active.next().addClass('ui-accordion-content-active');if(!clickedIsActive){clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);clicked.next().addClass('ui-accordion-content-active');} +var toShow=clicked.next(),toHide=this.active.next(),data={options:o,newHeader:clickedIsActive&&o.collapsible?$([]):clicked,oldHeader:this.active,newContent:clickedIsActive&&o.collapsible?$([]):toShow.find('> *'),oldContent:toHide.find('> *')},down=this.headers.index(this.active[0])>this.headers.index(clicked[0]);this.active=clickedIsActive?$([]):clicked;this._toggle(toShow,toHide,data,clickedIsActive,down);return false;},_toggle:function(toShow,toHide,data,clickedIsActive,down){var o=this.options,self=this;this.toShow=toShow;this.toHide=toHide;this.data=data;var complete=function(){if(!self)return;return self._completed.apply(self,arguments);};this._trigger("changestart",null,this.data);this.running=toHide.size()===0?toShow.size():toHide.size();if(o.animated){var animOptions={};if(o.collapsible&&clickedIsActive){animOptions={toShow:$([]),toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace};}else{animOptions={toShow:toShow,toHide:toHide,complete:complete,down:down,autoHeight:o.autoHeight||o.fillSpace};} +if(!o.proxied){o.proxied=o.animated;} +if(!o.proxiedDuration){o.proxiedDuration=o.duration;} +o.animated=$.isFunction(o.proxied)?o.proxied(animOptions):o.proxied;o.duration=$.isFunction(o.proxiedDuration)?o.proxiedDuration(animOptions):o.proxiedDuration;var animations=$.ui.accordion.animations,duration=o.duration,easing=o.animated;if(!animations[easing]){animations[easing]=function(options){this.slide(options,{easing:easing,duration:duration||700});};} +animations[easing](animOptions);}else{if(o.collapsible&&clickedIsActive){toShow.toggle();}else{toHide.hide();toShow.show();} +complete(true);} +toHide.prev().attr('aria-expanded','false').attr("tabIndex","-1").blur();toShow.prev().attr('aria-expanded','true').attr("tabIndex","0").focus();},_completed:function(cancel){var o=this.options;this.running=cancel?0:--this.running;if(this.running)return;if(o.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""});} +this._trigger('change',null,this.data);}});$.extend($.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:'slide',autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase();}},animations:{slide:function(options,additions){options=$.extend({easing:"swing",duration:300},options,additions);if(!options.toHide.size()){options.toShow.animate({height:"show"},options);return;} +if(!options.toShow.size()){options.toHide.animate({height:"hide"},options);return;} +var overflow=options.toShow.css('overflow'),percentDone,showProps={},hideProps={},fxAttrs=["height","paddingTop","paddingBottom"],originalWidth;var s=options.toShow;originalWidth=s[0].style.width;s.width(parseInt(s.parent().width(),10)-parseInt(s.css("paddingLeft"),10)-parseInt(s.css("paddingRight"),10)-(parseInt(s.css("borderLeftWidth"),10)||0)-(parseInt(s.css("borderRightWidth"),10)||0));$.each(fxAttrs,function(i,prop){hideProps[prop]='hide';var parts=(''+$.css(options.toShow[0],prop)).match(/^([\d+-.]+)(.*)$/);showProps[prop]={value:parts[1],unit:parts[2]||'px'};});options.toShow.css({height:0,overflow:'hidden'}).show();options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{step:function(now,settings){if(settings.prop=='height'){percentDone=(settings.now-settings.start)/(settings.end-settings.start);} +options.toShow[0].style[settings.prop]=(percentDone*showProps[settings.prop].value)+showProps[settings.prop].unit;},duration:options.duration,easing:options.easing,complete:function(){if(!options.autoHeight){options.toShow.css("height","");} +options.toShow.css("width",originalWidth);options.toShow.css({overflow:overflow});options.complete();}});},bounceslide:function(options){this.slide(options,{easing:options.down?"easeOutBounce":"swing",duration:options.down?1000:200});},easeslide:function(options){this.slide(options,{easing:"easeinout",duration:700});}}});})(jQuery);(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"},uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr('title');var self=this,options=this.options,title=options.title||this.originalTitle||' ',titleId=$.ui.dialog.getTitleId(this.element),uiDialog=(this.uiDialog=$('
    ')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({position:'absolute',overflow:'hidden',zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){(options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&self.close(event));}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=this.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(this.uiDialogTitlebar=$('
    ')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).mousedown(function(ev){ev.stopPropagation();}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(this.uiDialogTitlebarCloseText=$('')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();(options.draggable&&$.fn.draggable&&this._makeDraggable());(options.resizable&&$.fn.resizable&&this._makeResizable());this._createButtons(options.buttons);this._isOpen=false;(options.bgiframe&&$.fn.bgiframe&&uiDialog.bgiframe());(options.autoOpen&&this.open());},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');this.uiDialog.remove();(this.originalTitle&&this.element.attr('title',this.originalTitle));},close:function(event){var self=this;if(false===self._trigger('beforeclose',event)){return;} +(self.overlay&&self.overlay.destroy());self.uiDialog.unbind('keypress.ui-dialog');(self.options.hide?self.uiDialog.hide(self.options.hide,function(){self._trigger('close',event);}):self.uiDialog.hide()&&self._trigger('close',event));$.ui.dialog.overlay.resize();self._isOpen=false;if(self.options.modal){var maxZ=0;$('.ui-dialog').each(function(){if(this!=self.uiDialog[0]){maxZ=Math.max(maxZ,$(this).css('z-index'));}});$.ui.dialog.maxZ=maxZ;}},isOpen:function(){return this._isOpen;},moveToTop:function(force,event){if((this.options.modal&&!force)||(!this.options.stack&&!this.options.modal)){return this._trigger('focus',event);} +if(this.options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=this.options.zIndex;} +(this.overlay&&this.overlay.$el.css('z-index',$.ui.dialog.overlay.maxZ=++$.ui.dialog.maxZ));var saveScroll={scrollTop:this.element.attr('scrollTop'),scrollLeft:this.element.attr('scrollLeft')};this.uiDialog.css('z-index',++$.ui.dialog.maxZ);this.element.attr(saveScroll);this._trigger('focus',event);},open:function(){if(this._isOpen){return;} +var options=this.options,uiDialog=this.uiDialog;this.overlay=options.modal?new $.ui.dialog.overlay(this):null;(uiDialog.next().length&&uiDialog.appendTo('body'));this._size();this._position(options.position);uiDialog.show(options.show);this.moveToTop(true);(options.modal&&uiDialog.bind('keypress.ui-dialog',function(event){if(event.keyCode!=$.ui.keyCode.TAB){return;} +var tabbables=$(':tabbable',this),first=tabbables.filter(':first')[0],last=tabbables.filter(':last')[0];if(event.target==last&&!event.shiftKey){setTimeout(function(){first.focus();},1);}else if(event.target==first&&event.shiftKey){setTimeout(function(){last.focus();},1);}}));$([]).add(uiDialog.find('.ui-dialog-content :tabbable:first')).add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')).add(uiDialog).filter(':first').focus();this._trigger('open');this._isOpen=true;},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$('
    ').addClass('ui-dialog-buttonpane '+'ui-widget-content '+'ui-helper-clearfix');this.uiDialog.find('.ui-dialog-buttonpane').remove();(typeof buttons=='object'&&buttons!==null&&$.each(buttons,function(){return!(hasButtons=true);}));if(hasButtons){$.each(buttons,function(name,fn){$('').addClass('ui-state-default '+'ui-corner-all').text(name).click(function(){fn.apply(self.element[0],arguments);}).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');}).focus(function(){$(this).addClass('ui-state-focus');}).blur(function(){$(this).removeClass('ui-state-focus');}).appendTo(uiDialogButtonPane);});uiDialogButtonPane.appendTo(this.uiDialog);}},_makeDraggable:function(){var self=this,options=this.options,heightBeforeDrag;this.uiDialog.draggable({cancel:'.ui-dialog-content',handle:'.ui-dialog-titlebar',containment:'document',start:function(){heightBeforeDrag=options.height;$(this).height($(this).height()).addClass("ui-dialog-dragging");(options.dragStart&&options.dragStart.apply(self.element[0],arguments));},drag:function(){(options.drag&&options.drag.apply(self.element[0],arguments));},stop:function(){$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);(options.dragStop&&options.dragStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}});},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=this.options,resizeHandles=typeof handles=='string'?handles:'n,e,s,w,se,sw,ne,nw';this.uiDialog.resizable({cancel:'.ui-dialog-content',alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight,start:function(){$(this).addClass("ui-dialog-resizing");(options.resizeStart&&options.resizeStart.apply(self.element[0],arguments));},resize:function(){(options.resize&&options.resize.apply(self.element[0],arguments));},handles:resizeHandles,stop:function(){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();(options.resizeStop&&options.resizeStop.apply(self.element[0],arguments));$.ui.dialog.overlay.resize();}}).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');},_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.outerWidth();break;default:case'center':pLeft+=(wnd.width()-this.uiDialog.outerWidth())/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.outerHeight();break;default:case'middle':pTop+=(wnd.height()-this.uiDialog.outerHeight())/2;}} +pTop=Math.max(pTop,minTop);this.uiDialog.css({top:pTop,left:pLeft});},_setData:function(key,value){(setDataSwitch[key]&&this.uiDialog.data(setDataSwitch[key],value));switch(key){case"buttons":this._createButtons(value);break;case"closeText":this.uiDialogTitlebarCloseText.text(value);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(uiDialogClasses+value);break;case"draggable":(value?this._makeDraggable():this.uiDialog.draggable('destroy'));break;case"height":this.uiDialog.height(value);break;case"position":this._position(value);break;case"resizable":var uiDialog=this.uiDialog,isResizable=this.uiDialog.is(':data(resizable)');(isResizable&&!value&&uiDialog.resizable('destroy'));(isResizable&&typeof value=='string'&&uiDialog.resizable('option','handles',value));(isResizable||this._makeResizable(value));break;case"title":$(".ui-dialog-title",this.uiDialogTitlebar).html(value||' ');break;case"width":this.uiDialog.width(value);break;} +$.widget.prototype._setData.apply(this,arguments);},_size:function(){var options=this.options;this.element.css({height:0,minHeight:0,width:'auto'});var nonContentHeight=this.uiDialog.css({height:'auto',width:options.width}).height();this.element.css({minHeight:Math.max(options.minHeight-nonContentHeight,0),height:options.height=='auto'?'auto':Math.max(options.height-nonContentHeight,0)});}});$.extend($.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:'close',dialogClass:'',draggable:true,hide:null,height:'auto',maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:'center',resizable:true,show:null,stack:true,title:'',width:300,zIndex:1000},getter:'isOpen',uuid:0,maxZ:0,getTitleId:function($el){return'ui-dialog-title-'+($el.attr('id')||++this.uuid);},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog);}});$.extend($.ui.dialog.overlay,{instances:[],maxZ:0,events:$.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(event){return event+'.dialog-overlay';}).join(' '),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){var dialogZ=$(event.target).parents('.ui-dialog').css('zIndex')||0;return(dialogZ>$.ui.dialog.overlay.maxZ);});}},1);$(document).bind('keydown.dialog-overlay',function(event){(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode==$.ui.keyCode.ESCAPE&&dialog.close(event));});$(window).bind('resize.dialog-overlay',$.ui.dialog.overlay.resize);} +var $el=$('
    ').appendTo(document.body).addClass('ui-widget-overlay').css({width:this.width(),height:this.height()});(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){$([document,window]).unbind('.dialog-overlay');} +$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css('z-index'));});this.maxZ=maxZ;},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=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=$.unique(o.disabled.concat($.map(this.lis.filter('.ui-state-disabled'),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);} +this.panels.addClass('ui-tabs-hide');this.lis.removeClass('ui-tabs-selected ui-state-active');if(o.selected>=0&&this.anchors.length){this.panels.eq(o.selected).removeClass('ui-tabs-hide');this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');self.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[o.selected],self.panels[o.selected]));});this.load(o.selected);} +$(window).bind('unload',function(){self.lis.add(self.anchors).unbind('.tabs');self.lis=self.anchors=self.panels=null;});} +else{o.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'));} +this.element[o.collapsible?'addClass':'removeClass']('ui-tabs-collapsible');if(o.cookie){this._cookie(o.selected,o.cookie);} +for(var i=0,li;(li=this.lis[i]);i++){$(li)[$.inArray(i,o.disabled)!=-1&&!$(li).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');} +if(o.cache===false){this.anchors.removeData('cache.tabs');} +this.lis.add(this.anchors).unbind('.tabs');if(o.event!='mouseover'){var addState=function(state,el){if(el.is(':not(.ui-state-disabled)')){el.addClass('ui-state-'+state);}};var removeState=function(state,el){el.removeClass('ui-state-'+state);};this.lis.bind('mouseover.tabs',function(){addState('hover',$(this));});this.lis.bind('mouseout.tabs',function(){removeState('hover',$(this));});this.anchors.bind('focus.tabs',function(){addState('focus',$(this).closest('li'));});this.anchors.bind('blur.tabs',function(){removeState('focus',$(this).closest('li'));});} +var hideFx,showFx;if(o.fx){if($.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];} +else{hideFx=showFx=o.fx;}} +function resetStyle($el,fx){$el.css({display:''});if($.browser.msie&&fx.opacity){$el[0].style.removeAttribute('filter');}} +var showTab=showFx?function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.hide().removeClass('ui-tabs-hide').animate(showFx,showFx.duration||'normal',function(){resetStyle($show,showFx);self._trigger('show',null,self._ui(clicked,$show[0]));});}:function(clicked,$show){$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');$show.removeClass('ui-tabs-hide');self._trigger('show',null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||'normal',function(){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');$hide.addClass('ui-tabs-hide');self.element.dequeue("tabs");};this.anchors.bind(o.event+'.tabs',function(){var el=this,$li=$(this).closest('li'),$hide=self.panels.filter(':not(.ui-tabs-hide)'),$show=$(self._sanitizeSelector(this.hash));if(($li.hasClass('ui-tabs-selected')&&!o.collapsible)||$li.hasClass('ui-state-disabled')||$li.hasClass('ui-state-processing')||self._trigger('select',null,self._ui(this,$show[0]))===false){this.blur();return false;} +o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass('ui-tabs-selected')){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);} +self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;} +else if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);} +self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}} +if(o.cookie){self._cookie(o.selected,o.cookie);} +if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});} +self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));} +else{throw'jQuery UI Tabs: Mismatching fragment identifier.';} +if($.browser.msie){this.blur();}});this.anchors.bind('click.tabs',function(){return false;});},destroy:function(){var o=this.options;this.abort();this.element.unbind('.tabs').removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible').removeData('tabs');this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');this.anchors.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.unbind('.tabs').add(this.panels).each(function(){if($.data(this,'destroy.tabs')){$(this).remove();} +else{$(this).removeClass(['ui-state-default','ui-corner-top','ui-tabs-selected','ui-state-active','ui-state-hover','ui-state-focus','ui-state-disabled','ui-tabs-panel','ui-widget-content','ui-corner-bottom','ui-tabs-hide'].join(' '));}});if(o.cookie){this._cookie(null,o.cookie);}},add:function(url,label,index){if(index===undefined){index=this.anchors.length;} +var self=this,o=this.options,$li=$(o.tabTemplate.replace(/#\{href\}/g,url).replace(/#\{label\}/g,label)),id=!url.indexOf('#')?url.replace('#',''):this._tabId($('a',$li)[0]);$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs',true);var $panel=$('#'+id);if(!$panel.length){$panel=$(o.panelTemplate).attr('id',id).data('destroy.tabs',true);} +$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');if(index>=this.lis.length){$li.appendTo(this.list);$panel.appendTo(this.list[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.anchors.length==1){$li.addClass('ui-tabs-selected ui-state-active');$panel.removeClass('ui-tabs-hide');this.element.queue("tabs",function(){self._trigger('show',null,self._ui(self.anchors[0],self.panels[0]));});this.load(0);} +this._trigger('add',null,this._ui(this.anchors[index],this.panels[index]));},remove:function(index){var o=this.options,$li=this.lis.eq(index).remove(),$panel=this.panels.eq(index).remove();if($li.hasClass('ui-tabs-selected')&&this.anchors.length>1){this.select(index+(index+1=index?--n:n;});this._tabify();this._trigger('remove',null,this._ui($li.find('a')[0],$panel[0]));},enable:function(index){var o=this.options;if($.inArray(index,o.disabled)==-1){return;} +this.lis.eq(index).removeClass('ui-state-disabled');o.disabled=$.grep(o.disabled,function(n,i){return n!=index;});this._trigger('enable',null,this._ui(this.anchors[index],this.panels[index]));},disable:function(index){var self=this,o=this.options;if(index!=o.selected){this.lis.eq(index).addClass('ui-state-disabled');o.disabled.push(index);o.disabled.sort();this._trigger('disable',null,this._ui(this.anchors[index],this.panels[index]));}},select:function(index){if(typeof index=='string'){index=this.anchors.index(this.anchors.filter('[href$='+index+']'));} +else if(index===null){index=-1;} +if(index==-1&&this.options.collapsible){index=this.options.selected;} +this.anchors.eq(index).trigger(this.options.event+'.tabs');},load:function(index){var self=this,o=this.options,a=this.anchors.eq(index)[0],url=$.data(a,'load.tabs');this.abort();if(!url||this.element.queue("tabs").length!==0&&$.data(a,'cache.tabs')){this.element.dequeue("tabs");return;} +this.lis.eq(index).addClass('ui-state-processing');if(o.spinner){var span=$('span',a);span.data('label.tabs',span.html()).html(o.spinner);} +this.xhr=$.ajax($.extend({},o.ajaxOptions,{url:url,success:function(r,s){$(self._sanitizeSelector(a.hash)).html(r);self._cleanup();if(o.cache){$.data(a,'cache.tabs',true);} +self._trigger('load',null,self._ui(self.anchors[index],self.panels[index]));try{o.ajaxOptions.success(r,s);} +catch(e){} +self.element.dequeue("tabs");}}));},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr;} +this._cleanup();},url:function(index,url){this.anchors.eq(index).removeData('cache.tabs').data('load.tabs',url);},length:function(){return this.anchors.length;}});$.extend($.ui.tabs,{version:'1.7.2',getter:'length',defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:'click',fx:null,idPrefix:'ui-tabs-',panelTemplate:'
    ',spinner:'Loading…',tabTemplate:'
  • #{label}
  • '}});$.extend($.ui.tabs.prototype,{rotation:null,rotate:function(ms,continuing){var self=this,o=this.options;var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t
    ').appendTo(this.element);this._refreshValue();},destroy:function(){this.element.removeClass("ui-progressbar" ++" ui-widget" ++" ui-widget-content" ++" ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();$.widget.prototype.destroy.apply(this,arguments);},value:function(newValue){if(newValue===undefined){return this._value();} +this._setData('value',newValue);return this;},_setData:function(key,value){switch(key){case'value':this.options.value=value;this._refreshValue();this._trigger('change',null,{});break;} +$.widget.prototype._setData.apply(this,arguments);},_value:function(){var val=this.options.value;if(valthis._valueMax())val=this._valueMax();return val;},_valueMin:function(){var valueMin=0;return valueMin;},_valueMax:function(){var valueMax=100;return valueMax;},_refreshValue:function(){var value=this.value();this.valueDiv[value==this._valueMax()?'addClass':'removeClass']("ui-corner-right");this.valueDiv.width(value+'%');this.element.attr("aria-valuenow",value);}});$.extend($.ui.progressbar,{version:"1.7.2",defaults:{value:0}});})(jQuery);;jQuery.effects||(function($){$.effects={version:"1.7.2",save:function(element,set){for(var i=0;i');var wrapper=element.parent();if(element.css('position')=='static'){wrapper.css({position:'relative'});element.css({position:'relative'});}else{var top=element.css('top');if(isNaN(parseInt(top,10)))top='auto';var left=element.css('left');if(isNaN(parseInt(left,10)))left='auto';wrapper.css({position:element.css('position'),top:top,left:left,zIndex:element.css('z-index')}).show();element.css({position:'relative',top:0,left:0});} +wrapper.css(props);return wrapper;},removeWrapper:function(element){if(element.parent().is('.ui-effects-wrapper')) +return element.parent().replaceWith(element);return element;},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){unit=element.cssUnit(x);if(unit[0]>0)value[x]=unit[0]*factor+unit[1];});return value;},animateClass:function(value,duration,easing,callback){var cb=(typeof easing=="function"?easing:(callback?callback:null));var ea=(typeof easing=="string"?easing:null);return this.each(function(){var offset={};var that=$(this);var oldStyleAttr=that.attr("style")||'';if(typeof oldStyleAttr=='object')oldStyleAttr=oldStyleAttr["cssText"];if(value.toggle){that.hasClass(value.toggle)?value.remove=value.toggle:value.add=value.toggle;} +var oldStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.addClass(value.add);if(value.remove)that.removeClass(value.remove);var newStyle=$.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(value.add)that.removeClass(value.add);if(value.remove)that.addClass(value.remove);for(var n in newStyle){if(typeof newStyle[n]!="function"&&newStyle[n]&&n.indexOf("Moz")==-1&&n.indexOf("length")==-1&&newStyle[n]!=oldStyle[n]&&(n.match(/color/i)||(!n.match(/color/i)&&!isNaN(parseInt(newStyle[n],10))))&&(oldStyle.position!="static"||(oldStyle.position=="static"&&!n.match(/left|top|bottom|right/))))offset[n]=newStyle[n];} +that.animate(offset,duration,ea,function(){if(typeof $(this).attr("style")=='object'){$(this).attr("style")["cssText"]="";$(this).attr("style")["cssText"]=oldStyleAttr;}else $(this).attr("style",oldStyleAttr);if(value.add)$(this).addClass(value.add);if(value.remove)$(this).removeClass(value.remove);if(cb)cb.apply(this,arguments);});});}};function _normalizeArguments(a,m){var o=a[1]&&a[1].constructor==Object?a[1]:{};if(m)o.mode=m;var speed=a[1]&&a[1].constructor!=Object?a[1]:(o.duration?o.duration:a[2]);speed=$.fx.off?0:typeof speed==="number"?speed:$.fx.speeds[speed]||$.fx.speeds._default;var callback=o.callback||($.isFunction(a[1])&&a[1])||($.isFunction(a[2])&&a[2])||($.isFunction(a[3])&&a[3]);return[a[0],o,speed,callback];} +$.fn.extend({_show:$.fn.show,_hide:$.fn.hide,__toggle:$.fn.toggle,_addClass:$.fn.addClass,_removeClass:$.fn.removeClass,_toggleClass:$.fn.toggleClass,effect:function(fx,options,speed,callback){return $.effects[fx]?$.effects[fx].call(this,{method:fx,options:options||{},duration:speed,callback:callback}):null;},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))) +return this._show.apply(this,arguments);else{return this.effect.apply(this,_normalizeArguments(arguments,'show'));}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))) +return this._hide.apply(this,arguments);else{return this.effect.apply(this,_normalizeArguments(arguments,'hide'));}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||($.isFunction(arguments[0])||typeof arguments[0]=='boolean')){return this.__toggle.apply(this,arguments);}else{return this.effect.apply(this,_normalizeArguments(arguments,'toggle'));}},addClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{add:classNames},speed,easing,callback]):this._addClass(classNames);},removeClass:function(classNames,speed,easing,callback){return speed?$.effects.animateClass.apply(this,[{remove:classNames},speed,easing,callback]):this._removeClass(classNames);},toggleClass:function(classNames,speed,easing,callback){return((typeof speed!=="boolean")&&speed)?$.effects.animateClass.apply(this,[{toggle:classNames},speed,easing,callback]):this._toggleClass(classNames,speed);},morph:function(remove,add,speed,easing,callback){return $.effects.animateClass.apply(this,[{add:add,remove:remove},speed,easing,callback]);},switchClass:function(){return this.morph.apply(this,arguments);},cssUnit:function(key){var style=this.css(key),val=[];$.each(['em','px','%','pt'],function(i,unit){if(style.indexOf(unit)>0) +val=[parseFloat(style),unit];});return val;}});$.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){$.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);} +fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0],10),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1],10),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2],10),255),0)].join(",")+")";};});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3) +return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) +return[parseInt(result[1],10),parseInt(result[2],10),parseInt(result[3],10)];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) +return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) +return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) +return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];if(result=/rgba\(0, 0, 0, 0\)/.exec(color)) +return colors['transparent'];return colors[$.trim(color).toLowerCase()];} +function getColor(elem,attr){var color;do{color=$.curCSS(elem,attr);if(color!=''&&color!='transparent'||$.nodeName(elem,"body")) +break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};$.easing.jswing=$.easing.swing;$.extend($.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a').appendTo(document.body).addClass(o.options.className).css({top:startPosition.top,left:startPosition.left,height:elem.innerHeight(),width:elem.innerWidth(),position:'absolute'}).animate(animation,o.duration,o.options.easing,function(){transfer.remove();(o.callback&&o.callback.apply(elem[0],arguments));elem.dequeue();});});};})(jQuery); \ No newline at end of file -- cgit v1.2.3 From 1d40c77c4c05a85fbf6bbb96820fb98cbaa989eb Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 12 Sep 2009 08:53:24 -0700 Subject: Update the organize module to use the release version of jquery Selectable. Unfortunately this does not have the functionality to select additional thumbnails using the ctrl or alt-keys, it is preferable to forking the Selectable component. This functionality should arrive with ui.jquery 1.8.x --- modules/organize/css/organize.css | 5 +++-- modules/organize/js/organize.js | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/organize/css/organize.css b/modules/organize/css/organize.css index 15b5538d..b1cef33c 100644 --- a/modules/organize/css/organize.css +++ b/modules/organize/css/organize.css @@ -102,12 +102,13 @@ width: 9em; } -.gOrganizeMicroThumbGridCell.ui-state-selected { +.gOrganizeMicroThumbGridCell.ui-selecting, +.gOrganizeMicroThumbGridCell.ui-selected { margin: 2px; border: 2px solid #13A; } -.ui-selectable-lasso { +.ui-selectable-helper { z-index: 2000 !important; border: 1px dashed #00F; opacity: 0.25; diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index c30f89e0..7d204708 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,12 +1,12 @@ (function($) { $.organize = { micro_thumb_draggable: { - handle: ".ui-state-selected", + handle: ".ui-selected", distance: 10, cursorAt: { left: -10, top: -10}, appendTo: "#gOrganizeMicroThumbPanel", helper: function(event, ui) { - var selected = $(".ui-draggable.ui-state-selected img"); + var selected = $(".ui-draggable.ui-selected img"); if (selected.length) { var set = $('
    ') .css({ @@ -37,7 +37,7 @@ }, start: function(event, ui) { - $("#gOrganizeMicroThumbPanel .ui-state-selected").hide(); + $("#gOrganizeMicroThumbPanel .ui-selected").hide(); }, drag: function(event, ui) { @@ -80,7 +80,7 @@ greedy: true, drop: function(event, ui) { if ($(event.target).hasClass("gViewOnly")) { - $(".ui-state-selected").show(); + $(".ui-selected").show(); $(".gOrganizeMicroThumbGridCell").css("borderStyle", "none"); } else { $.organize.do_drop({ -- cgit v1.2.3 From 0bb489b69438266359bfd22955f4d5c8f9d6ade3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 10:02:27 -0700 Subject: Properly internationalize the text for the By: line. This gets rid of the escaping problem. --- modules/info/helpers/info_theme.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index 51378e54..e5f9c909 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -38,7 +38,9 @@ class info_theme_Core { if ($item->owner) { $results .= "
  • "; if ($item->owner->url) { - $results .= t("By: %owner_name", array("owner_name" => "owner->url}\">{$item->owner->full_name}")); + $results .= t("By: %owner_name", + array("owner_name" => $item->owner->display_name(), + "owner_url" => $item->owner->url)); } else { $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); } -- cgit v1.2.3 From 961bc3b18571b5f3ad2a355b71d40c4830dd44ba Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 10:06:24 -0700 Subject: Use user::display_name() in another case where it was missing. --- modules/info/helpers/info_theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/info/helpers/info_theme.php b/modules/info/helpers/info_theme.php index e5f9c909..4bf894ad 100644 --- a/modules/info/helpers/info_theme.php +++ b/modules/info/helpers/info_theme.php @@ -42,7 +42,7 @@ class info_theme_Core { array("owner_name" => $item->owner->display_name(), "owner_url" => $item->owner->url)); } else { - $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); + $results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name())); } $results .= "
  • "; } -- cgit v1.2.3 From 823fa2fc8339a6638ef4f0fcdae7f96e99a4f0bd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 10:33:46 -0700 Subject: Updated for url format changes applied in 2aad580f53dbc06bb170c710467b47a5a532c6c8. --- modules/gallery/tests/xss_data.txt | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 8c71740e..193d2ca1 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -48,6 +48,7 @@ modules/gallery/views/admin_block_log_entries.html.php 8 DIRTY $entry modules/gallery/views/admin_block_news.html.php 5 DIRTY_JS $entry["link"] modules/gallery/views/admin_block_news.html.php 5 DIRTY $entry["title"] modules/gallery/views/admin_block_news.html.php 7 DIRTY text::limit_words(strip_tags($entry["description"]),25); +modules/gallery/views/admin_block_photo_stream.html.php 5 DIRTY_JS $photo->url() modules/gallery/views/admin_block_photo_stream.html.php 6 DIRTY photo::img_dimensions($photo->width,$photo->height,72) modules/gallery/views/admin_block_photo_stream.html.php 7 DIRTY_ATTR $photo->thumb_url() modules/gallery/views/admin_dashboard.html.php 5 DIRTY_JS $csrf @@ -180,14 +181,14 @@ modules/image_block/views/image_block_block.html.php 3 DIRTY_JS $item- modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class"=>"gThumbnail")) modules/info/views/info_block.html.php 22 DIRTY date("M j, Y H:i:s",$item->captured) modules/info/views/info_block.html.php 29 DIRTY_JS $item->owner->url -modules/notification/views/comment_published.html.php 28 DIRTY_JS $comment->item()->url(array(),true) -modules/notification/views/comment_published.html.php 29 DIRTY $comment->item()->url(array(),true) -modules/notification/views/item_added.html.php 16 DIRTY_JS $item->url(array(),true) -modules/notification/views/item_added.html.php 17 DIRTY $item->url(array(),true) -modules/notification/views/item_deleted.html.php 18 DIRTY_JS $item->parent()->url(array(),true) -modules/notification/views/item_deleted.html.php 19 DIRTY $item->parent()->url(array(),true) -modules/notification/views/item_updated.html.php 20 DIRTY_JS $item->url(array(),true) -modules/notification/views/item_updated.html.php 20 DIRTY $item->url(array(),true) +modules/notification/views/comment_published.html.php 28 DIRTY_JS $comment->item()->abs_url() +modules/notification/views/comment_published.html.php 29 DIRTY $comment->item()->abs_url() +modules/notification/views/item_added.html.php 16 DIRTY_JS $item->abs_url() +modules/notification/views/item_added.html.php 17 DIRTY $item->abs_url() +modules/notification/views/item_deleted.html.php 18 DIRTY_JS $item->parent()->abs_url() +modules/notification/views/item_deleted.html.php 19 DIRTY $item->parent()->abs_url() +modules/notification/views/item_updated.html.php 20 DIRTY_JS $item->abs_url() +modules/notification/views/item_updated.html.php 20 DIRTY $item->abs_url() modules/organize/views/organize_dialog.html.php 3 DIRTY_JS url::site("organize/move_to/__ALBUM_ID__?csrf=$csrf") modules/organize/views/organize_dialog.html.php 4 DIRTY_JS url::site("organize/rearrange/__TARGET_ID__/__BEFORE__?csrf=$csrf") modules/organize/views/organize_dialog.html.php 5 DIRTY_JS url::site("organize/sort_order/__ALBUM_ID__/__COL__/__DIR__?csrf=$csrf") @@ -246,6 +247,7 @@ modules/rss/views/feed.mrss.php 73 DIRTY_ATTR $chi modules/rss/views/feed.mrss.php 74 DIRTY_ATTR $child->mime_type modules/rss/views/rss_block.html.php 6 DIRTY_JS rss::url($url) modules/search/views/search.html.php 30 DIRTY_ATTR $item_class +modules/search/views/search.html.php 31 DIRTY_JS $item->url() modules/search/views/search.html.php 32 DIRTY $item->thumb_img() modules/server_add/views/admin_server_add.html.php 15 DIRTY_ATTR $id modules/server_add/views/admin_server_add.html.php 24 DIRTY $form @@ -285,6 +287,7 @@ themes/admin_default/views/admin.html.php 15 DIRTY_JS $theme themes/admin_default/views/admin.html.php 32 DIRTY $theme->admin_head() themes/admin_default/views/admin.html.php 36 DIRTY $theme->admin_page_top() themes/admin_default/views/admin.html.php 44 DIRTY $theme->admin_header_top() +themes/admin_default/views/admin.html.php 49 DIRTY_JS item::root()->url() themes/admin_default/views/admin.html.php 53 DIRTY $theme->admin_menu() themes/admin_default/views/admin.html.php 55 DIRTY $theme->admin_header_bottom() themes/admin_default/views/admin.html.php 62 DIRTY $content @@ -325,6 +328,8 @@ themes/default/views/page.html.php 41 DIRTY $new_w themes/default/views/page.html.php 42 DIRTY $new_height themes/default/views/page.html.php 43 DIRTY $thumb_proportion themes/default/views/page.html.php 82 DIRTY $header_text +themes/default/views/page.html.php 84 DIRTY_JS item::root()->url() +themes/default/views/page.html.php 98 DIRTY_JS $parent->url("show={$theme->item()->id}") themes/default/views/page.html.php 112 DIRTY $content themes/default/views/page.html.php 118 DIRTY newView("sidebar.html") themes/default/views/page.html.php 125 DIRTY $footer_text -- cgit v1.2.3 From 51f6329a89be3382b7319b0add30283e9c9bce6a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 17:11:10 -0700 Subject: Update version to "3.0 beta 3" --- modules/gallery/helpers/gallery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 813134eb..a892287f 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_Core { - const VERSION = "3.0 git (pre-beta3)"; + const VERSION = "3.0 beta 3"; /** * If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is -- cgit v1.2.3 From 711cdde5b9755140981000adc6dd7897d836ccc5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 20:46:54 -0700 Subject: Only tack ?show= on for the last parent, because that's the only parent for which the id is relevant. In a perfect world each parent's link would have a ?show= for the next child's id. But that would require some confusing code and I don't want to put that into the default/example theme yet. --- themes/default/views/page.html.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php index 733534ea..19d8cc00 100644 --- a/themes/default/views/page.html.php +++ b/themes/default/views/page.html.php @@ -95,7 +95,12 @@
    • - item()->id}") ?>"> + + item()->id}" : null) ?>"> title) ?>
    • -- cgit v1.2.3 From bc69dfb410ac0b35e4f2caa2230858eb15322a9a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 12 Sep 2009 22:30:05 -0700 Subject: Updated README for beta 3 --- README | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README b/README index d445be1f..b3426212 100644 --- a/README +++ b/README @@ -7,10 +7,10 @@ interface. SECURITY (& INTENDED AUDIENCE): -This is the first beta release of Gallery 3.0 and while it's not a -finished product, it's heading into the home stretch. You can install -it on public websites, but remember that until the final release is -out, we make no guarantees that it won't do bad things. +This is the third and final beta release of Gallery 3.0 and while it's +not a finished product, it's heading into the home stretch. You can +install it on public websites, but remember that until the final +release is out, we make no guarantees that it won't do bad things. Note: - We've contracted a professional security audit, received their results @@ -22,8 +22,7 @@ Note: - Most of the key features are in, but some of them (notably the "add from server" and "organize album" features) are probably going to be completely rewritten. - - Starting with beta 1 we're going to offer an upgrade path so you won't - have to reinstall and start all over (yay!) + - You can upgrade from beta 1, but not from alpha releases. The intended audience of this release is folks who are willing to live a little bit on the edge. We'll do our best to take care of your data -- cgit v1.2.3 From caa2002d7777e0ceb884d4c628650804620ca2b6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Sep 2009 01:04:16 -0700 Subject: If there's a show= param and we can't find the given id in the current album, just ignore the parameter. --- modules/gallery/controllers/albums.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 183c26d0..08a60132 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -40,11 +40,13 @@ class Albums_Controller extends Items_Controller { if ($show) { $index = $album->get_position($show); - $page = ceil($index / $page_size); - if ($page == 1) { - url::redirect($album->abs_url()); - } else { - url::redirect($album->abs_url("page=$page")); + if ($index) { + $page = ceil($index / $page_size); + if ($page == 1) { + url::redirect($album->abs_url()); + } else { + url::redirect($album->abs_url("page=$page")); + } } } -- cgit v1.2.3 From 645cf6347cda049dc09664e60626c7a4f5609f89 Mon Sep 17 00:00:00 2001 From: Kevin Nehls Date: Sun, 13 Sep 2009 09:14:25 -0700 Subject: Fix "Back to the gallery" link in upper-right corner in Admin Dashboard. --- themes/admin_default/views/admin.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php index f77881bb..995e95ef 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_default/views/admin.html.php @@ -43,7 +43,7 @@
      admin_header_top() ?>
        -
      • url(), "← ".t("Back to the Gallery")) ?>
      • +
      "> -- cgit v1.2.3 From 1499778b4aaf010cbb766d83770284a54044a836 Mon Sep 17 00:00:00 2001 From: Kevin Nehls Date: Sun, 13 Sep 2009 09:26:30 -0700 Subject: Remove raw HTML that's wrapped around the name of the file to create if not logged in as admin --- modules/gallery/views/upgrader.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index 5f93c2d5..8a01cd29 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -81,7 +81,7 @@

      - gallery3/var/tmp directory.", array("name" => "
      $upgrade_token")) ?> + %name in your gallery3/var/tmp directory.", array("name" => "$upgrade_token")) ?>

      "> -- cgit v1.2.3 From 827c845abbfe0767cb5063fea372477c24713b1e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Sep 2009 14:14:01 -0700 Subject: Use the absolute url format for the root item. html::anchor() will not prepend the base url to that. --- themes/admin_default/views/admin.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php index 995e95ef..ef15ed25 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_default/views/admin.html.php @@ -43,7 +43,7 @@
      admin_header_top() ?>
        -
      • +
      • abs_url(), "← ".t("Back to the Gallery")) ?>
      +
      diff --git a/themes/default/views/block.html.php b/themes/default/views/block.html.php index 37504861..e8cff833 100644 --- a/themes/default/views/block.html.php +++ b/themes/default/views/block.html.php @@ -1,5 +1,7 @@ + +

      -- cgit v1.2.3 From 6c0732e16fa904125d9d437f8f3e96d377c448d9 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 13 Sep 2009 16:24:03 -0700 Subject: Set the AlbumTreeContainer instead of the height. This fixes ticket #755 --- modules/organize/js/organize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 7d204708..cfaff01c 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -142,7 +142,7 @@ $("#gDialog").bind("dialogopen", function(event, ui) { $("#gOrganize").height($("#gDialog").innerHeight() - 20); $("#gOrganizeMicroThumbPanel").height($("#gDialog").innerHeight() - 90); - $("#gOrganizeAlbumTree").height($("#gDialog").innerHeight() - 59); + $("#gOrganizeTreeContainer").height($("#gDialog").innerHeight() - 59); }); $("#gDialog").bind("dialogclose", function(event, ui) { -- cgit v1.2.3 From 8fa370c49fa28741d6ff1bd9ca4ccc1f70dc37af Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Sep 2009 22:59:58 -0700 Subject: Set the version to "3.0 git (pre-RC1)" --- modules/gallery/helpers/gallery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index a892287f..40e188e2 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_Core { - const VERSION = "3.0 beta 3"; + const VERSION = "3.0 git (pre-RC1)"; /** * If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is -- cgit v1.2.3 From 5f343ab8a0538d68b905e86968cfd80902512d8a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 14 Sep 2009 08:11:12 -0700 Subject: Change the variable to to resolve ticket #769 --- modules/organize/controllers/organize.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 4639777c..259c94e7 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -53,8 +53,8 @@ class Organize_Controller extends Controller { } print json_encode( - array("tree" => self::_expanded_tree(ORM::factory("item", 1), $album)->__toString(), - "grid" => self::_get_micro_thumb_grid($album, 0)->__toString())); + array("tree" => self::_expanded_tree(ORM::factory("item", 1), $target_album)->__toString(), + "grid" => self::_get_micro_thumb_grid($target_album, 0)->__toString())); } function rearrange($target_id, $before_or_after) { -- cgit v1.2.3 From 59eadacc67acb10d803ca7ef1bdc0635041a1d41 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 11:19:32 -0700 Subject: Improve language preference (Acccept-Language header matching): Boost same-language match over exact locale match for lower qvalue. --- modules/gallery/helpers/locales.php | 56 +++++++++++++++------------ modules/gallery/tests/Locales_Helper_Test.php | 10 ++++- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index 16dda2d7..ab7f7526 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -165,50 +165,58 @@ class locales_Core { list ($ignored, $qvalue) = explode("=", $qvalue . "=="); $qvalue = floatval($qvalue); } - $locale_preferences[] = array($requested_locale, $qvalue); + // Group by language to boost inexact same-language matches + list ($language) = explode("_", $requested_locale . "_"); + if (!isset($locale_preferences[$language])) { + $locale_preferences[$language] = array(); + } + $locale_preferences[$language][$requested_locale] = $qvalue; } } // Compare and score requested locales with installed ones $scored_locales = array(); - foreach ($locale_preferences as $requested_value) { - $scored_locale_match = self::_locale_match_score($requested_value); - if ($scored_locale_match) { - $scored_locales[] = $scored_locale_match; + foreach ($locale_preferences as $language => $requested_locales) { + // Inexact match adjustment (same language, different region) + $fallback_adjustment_factor = 0.95; + if (count($requested_locales) > 1) { + // Sort by qvalue, descending + $qvalues = array_values($requested_locales); + rsort($qvalues); + // Ensure inexact match scores worse than 2nd preference in same language. + $fallback_adjustment_factor *= $qvalues[1]; + } + foreach ($requested_locales as $requested_locale => $qvalue) { + list ($matched_locale, $match_score) = + self::_locale_match_score($requested_locale, $qvalue, $fallback_adjustment_factor); + if ($matched_locale && + (!isset($scored_locales[$matched_locale]) || + $match_score > $scored_locales[$matched_locale])) { + $scored_locales[$matched_locale] = $match_score; + } } } - usort($scored_locales, array("locales", "_compare_locale_by_qvalue")); + arsort($scored_locales); - $best_match = array_shift($scored_locales); - if ($best_match) { - return $best_match[0]; - } + list ($locale) = each($scored_locales); + return $locale; } return null; } - static function _compare_locale_by_qvalue($a, $b) { - $a = $a[1]; - $b = $b[1]; - if ($a == $b) { - return 0; - } - return $a < $b ? 1 : -1; - } - - private static function _locale_match_score($requested_locale_and_qvalue) { - list ($requested_locale, $qvalue) = $requested_locale_and_qvalue; + private static function _locale_match_score($requested_locale, $qvalue, $adjustment_factor) { $installed = self::installed(); if (isset($installed[$requested_locale])) { - return $requested_locale_and_qvalue; + return array($requested_locale, $qvalue); } list ($language) = explode("_", $requested_locale . "_"); if (isset(self::$language_subtag_to_locale[$language]) && isset($installed[self::$language_subtag_to_locale[$language]])) { - return array(self::$language_subtag_to_locale[$language], $qvalue * 0.66); + $score = $adjustment_factor * $qvalue; + return array(self::$language_subtag_to_locale[$language], $score); } - return null; + return array(null, 0); } } \ No newline at end of file diff --git a/modules/gallery/tests/Locales_Helper_Test.php b/modules/gallery/tests/Locales_Helper_Test.php index 85b8e206..4c03d8d4 100644 --- a/modules/gallery/tests/Locales_Helper_Test.php +++ b/modules/gallery/tests/Locales_Helper_Test.php @@ -67,7 +67,7 @@ class Locales_Helper_Test extends Unit_Test_Case { locales::update_installed(array("no_NO", "pt_PT", "ja_JP")); $_SERVER["HTTP_ACCEPT_LANGUAGE"] = "en,en-us,ja_JP;q=0.7,no-fr;q=0.9"; $locale = locales::locale_from_http_request(); - $this->assert_equal("ja_JP", $locale); + $this->assert_equal("no_NO", $locale); } public function locale_from_http_request_best_match_vs_installed_2_test() { @@ -83,4 +83,12 @@ class Locales_Helper_Test extends Unit_Test_Case { $locale = locales::locale_from_http_request(); $this->assert_equal(null, $locale); } + + public function locale_from_http_request_prefer_inexact_same_language_match_over_exact_other_language_match_test() { + locales::update_installed(array("de_DE", "ar_AR", "fa_IR", "he_IL", "en_US")); + // Accept-Language header from Firefox 3.5/Ubuntu + $_SERVER["HTTP_ACCEPT_LANGUAGE"] = "he,en-us;q=0.9,de-ch;q=0.5,en;q=0.3"; + $locale = locales::locale_from_http_request(); + $this->assert_equal("he_IL", $locale); + } } \ No newline at end of file -- cgit v1.2.3 From 7cc37451f4b7f7fe833fd5d355dab0f2a904d35e Mon Sep 17 00:00:00 2001 From: Jan Koprowski Date: Sat, 12 Sep 2009 20:36:02 +0200 Subject: Forbid from add symbolink link in admin server add. Read ticket #744 for more details. --- modules/server_add/controllers/admin_server_add.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index fac2aa44..af9c5b22 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -34,15 +34,17 @@ class Admin_Server_Add_Controller extends Admin_Controller { $form = $this->_get_admin_form(); $paths = unserialize(module::get_var("server_add", "authorized_paths", "a:0:{}")); if ($form->validate()) { - if (is_readable($form->add_path->path->value)) { + if (is_link($form->add_path->path->value)) { + $form->add_path->path->add_error("is_symlink", 1); + } else if (! is_readable($form->add_path->path->value)) { + $form->add_path->path->add_error("not_readable", 1); + } else { $path = $form->add_path->path->value; $paths[$path] = 1; module::set_var("server_add", "authorized_paths", serialize($paths)); message::success(t("Added path %path", array("path" => $path))); server_add::check_config($paths); url::redirect("admin/server_add"); - } else { - $form->add_path->path->add_error("not_readable", 1); } } @@ -84,9 +86,10 @@ class Admin_Server_Add_Controller extends Admin_Controller { array("id" => "gServerAddAdminForm")); $add_path = $form->group("add_path"); $add_path->input("path")->label(t("Path"))->rules("required") - ->error_messages("not_readable", t("This directory is not readable by the webserver")); + ->error_messages("not_readable", t("This directory is not readable by the webserver")) + ->error_messages("is_symlink", t("Path can not be symbolic link")); $add_path->submit("add")->value(t("Add Path")); return $form; } -} \ No newline at end of file +} -- cgit v1.2.3 From c3f8b623766fe20768fb86c21e8455785b8e9928 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 Sep 2009 19:57:12 -0700 Subject: Adjust the text of the symlink error message. --- modules/server_add/controllers/admin_server_add.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index af9c5b22..7cd82d60 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -87,7 +87,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { $add_path = $form->group("add_path"); $add_path->input("path")->label(t("Path"))->rules("required") ->error_messages("not_readable", t("This directory is not readable by the webserver")) - ->error_messages("is_symlink", t("Path can not be symbolic link")); + ->error_messages("is_symlink", t("Symbolic links are not allowed")); $add_path->submit("add")->value(t("Add Path")); return $form; -- cgit v1.2.3 From 548bfc9455c859251d62ba406d1d40135b158f67 Mon Sep 17 00:00:00 2001 From: Jan Koprowski Date: Sun, 13 Sep 2009 07:00:31 +0200 Subject: Autopopulation text form now clear content after getting focus every time. Problem described in #630. --- lib/gallery.form.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/gallery.form.js b/lib/gallery.form.js index e69be326..e1a24290 100644 --- a/lib/gallery.form.js +++ b/lib/gallery.form.js @@ -26,16 +26,23 @@ function shortFormInit(formID) { $(inputID).val(labelValue); } + // Attach event listeners to the input - $(inputID).bind("focus blur", function(e){ + $(inputID).bind("focus", function(e){ var eLabelVal = $(this).siblings("label").html(); var eInputVal = $(this).val(); // Empty input value if it equals it's label if (eLabelVal == eInputVal) { $(this).val(""); + } + }); + + $(inputID).bind("blur", function(e){ + var eLabelVal = $(this).siblings("label").html(); + // Reset the input value if it's empty - } else if ($(this).val() == "") { + if ($(this).val() == "") { $(this).val(eLabelVal); } }); -- cgit v1.2.3 From 8b7e3e6c1a6a708b7b60837c33a895682c7de32f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 Sep 2009 20:21:12 -0700 Subject: Refactor all the short form code to tighten it up, and make it such that the form button is disabled if we're showing the placeholder text. --- lib/gallery.form.js | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/gallery.form.js b/lib/gallery.form.js index e1a24290..67245e60 100644 --- a/lib/gallery.form.js +++ b/lib/gallery.form.js @@ -3,47 +3,45 @@ * * @param shortForms array Array of short form IDs */ -function handleShortFormEvent(shortForms) { - for (var i in shortForms) { - shortFormInit(shortForms[i]); +function handle_short_form_event(short_forms) { + for (var i in short_forms) { + short_form_init(short_forms[i]); } } /** * Initialize a short form. Short forms may contain only one text input. * - * @param formID string The form's ID, including # + * @param form_id string The form's CSS id */ -function shortFormInit(formID) { - $(formID).addClass("gShortForm"); +function short_form_init(form_id) { + var form = $(form_id); + form.addClass("gShortForm"); - // Get the input ID and it's label text - var labelValue = $(formID + " label:first").html(); - var inputID = "#" + $(formID + " input[type=text]:first").attr("id"); + var label = form.find("label:first"); + var input = form.find("input[type=text]:first"); + var button = form.find("input[type=submit]"); // Set the input value equal to label text - if ($(inputID).val() == "") { - $(inputID).val(labelValue); + if (input.val() == "") { + input.val(label.html()); + button.enable(false); } - // Attach event listeners to the input - $(inputID).bind("focus", function(e){ - var eLabelVal = $(this).siblings("label").html(); - var eInputVal = $(this).val(); - + input.bind("focus", function(e) { // Empty input value if it equals it's label - if (eLabelVal == eInputVal) { - $(this).val(""); + if ($(this).val() == label.html()) { + $(this).val(""); } + button.enable(true); }); - $(inputID).bind("blur", function(e){ - var eLabelVal = $(this).siblings("label").html(); - + input.bind("blur", function(e){ // Reset the input value if it's empty if ($(this).val() == "") { - $(this).val(eLabelVal); + $(this).val(label.html()); + button.enable(false); } }); } -- cgit v1.2.3 From ffccfb9e634de527261dca8e46ac4053806ec87b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 Sep 2009 20:23:32 -0700 Subject: Move the code that adds the .gShortForm CSS class out of gallery.short_forms.js and into the theme, since this is really a theme decision. --- lib/gallery.form.js | 13 ------------- themes/default/js/ui.init.js | 7 +++++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib/gallery.form.js b/lib/gallery.form.js index 67245e60..77ce3b7d 100644 --- a/lib/gallery.form.js +++ b/lib/gallery.form.js @@ -1,14 +1,3 @@ -/** - * Handle initialization of all short forms - * - * @param shortForms array Array of short form IDs - */ -function handle_short_form_event(short_forms) { - for (var i in short_forms) { - short_form_init(short_forms[i]); - } -} - /** * Initialize a short form. Short forms may contain only one text input. * @@ -16,8 +5,6 @@ function handle_short_form_event(short_forms) { */ function short_form_init(form_id) { var form = $(form_id); - form.addClass("gShortForm"); - var label = form.find("label:first"); var input = form.find("input[type=text]:first"); var button = form.find("input[type=submit]"); diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 949933e9..93dfb275 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -2,7 +2,7 @@ * Initialize jQuery UI and Gallery Plugin elements */ -var shortForms = new Array( +var short_forms = new Array( "#gQuickSearchForm", "#gAddTagForm", "#gSearchForm" @@ -36,7 +36,10 @@ $(document).ready(function() { } // Initialize short forms - handleShortFormEvent(shortForms); + for (var i in short_forms) { + short_form_init(short_forms[i]); + $(short_forms[i]).addClass("gShortForm"); + } $(".gShortForm input[type=text]").addClass("ui-corner-left"); $(".gShortForm input[type=submit]").addClass("ui-state-default ui-corner-right"); -- cgit v1.2.3 From 17254799d1069e9f67de14460264cda76395746f Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 20:27:04 -0700 Subject: Initial skeleton of Controller_Auth code audit test (non functional). --- modules/gallery/tests/Controller_Auth_Test.php | 211 +++++++++++++++++++++++++ modules/gallery/tests/controller_auth_data.txt | 0 2 files changed, 211 insertions(+) create mode 100644 modules/gallery/tests/Controller_Auth_Test.php create mode 100644 modules/gallery/tests/controller_auth_data.txt diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php new file mode 100644 index 00000000..9927859b --- /dev/null +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -0,0 +1,211 @@ +input, Forge] + // Require: ->validate() or access::verify_csrf\( + if ($function && $open_braces >= 2) { + if ($token[0] == T_STRING) { + if ($token[1] == "access" && + self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) && + self::_token_matches(array(T_STRING, "require"), $tokens, $token_number + 2) && + self::_token_matches("(", $tokens, $token_number + 3)) { + $token_number += 3; + $function->checks_authorization(true); + } else if ($token[1] == "access" && + self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) && + self::_token_matches(array(T_STRING, "verify_csrf"), $tokens, $token_number + 2) && + self::_token_matches("(", $tokens, $token_number + 3)) { + $token_number += 3; + $function->checks_csrf(true); + } else if (in_array($token[1], array("Input", "Forge")) && + self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1)) { + $token_number++; + $function->uses_input(true); + } + } else if ($token == T_VARIABLE) { + if ($token[1] == '$this' && + self::_token_matches(array(T_OBJECT_OPERATOR), $tokens, $token_number + 1) && + self::_token_matches(array(T_STRING, "input"), $tokens, $token_number + 2)) { + $token_number += 2; + $function->uses_input(true); + } + } else if ($token[0] == T_OBJECT_OPERATOR) { + if (self::_token_matches(array(T_STRING), "validate", $token_number + 1) && + self::_token_matches("(", $tokens, $token_number + 2)) { + $token_number += 2; + $function->checks_csrf(true); + } + } + } + } + } + } + + // Generate the report + $new = TMPPATH . "controller_auth_data.txt"; + $fd = fopen($new, "wb"); + ksort($found); + foreach ($found as $controller => $frames) { + foreach ($functions as $function) { + $flags = array(); + if ($function->uses_input() && !$function->checks_csrf()) { + $flags[] = "DIRTY_CSRF"; + } + if ($function->checks_authorization()) { + $flags[] = "DIRTY_AUTH"; + } + + if (!$flags) { + // Don't print CLEAN instances + continue; + } + + fprintf($fd, "%-60s %-20s %-21s\n", + $controller, $function->name, implode("|", $flags)); + } + } + fclose($fd); + + // Compare with the expected report from our golden file. + $canonical = MODPATH . "gallery/tests/controller_auth_data.txt"; + exec("diff $canonical $new", $output, $return_value); + $this->assert_false( + $return_value, "Controller auth golden file mismatch. Output:\n" . implode("\n", $output) ); + } + + private static function _token_matches($expected_token, &$tokens, $token_number) { + if (!isset($tokens[$token_number])) { + return false; + } + + $token = $tokens[$token_number]; + + if (is_array($expected_token)) { + for ($i = 0; $i < count($expected_token); $i++) { + if ($expected_token[$i] != $token[$i]) { + return false; + } + } + return true; + } else { + return $expected_token == $token; + } + } + + static function _function($name, $line) { + return new Controller_Auth_Test_Function($name, $line); + } +} + +class Controller_Auth_Test_Function { + public $name; + public $line; + private $_uses_input = false; + private $_checks_authorization = false; + private $_checks_csrf = false; + + function __construct($name, $line) { + $this->name = $name; + $this->line = $line; + } + + function uses_input($val=null) { + if ($val !== null) { + $this->_uses_input = $val; + } + return $this->_uses_input; + } + + function checks_authorization($val) { + if ($val !== null) { + $this->_checks_authorization = $val; + } + return $this->_checks_authorization; + } + + function checks_csrf($val) { + if ($val !== null) { + $this->_checks_csrf = $val; + } + return $this->_checks_csrf; + } +} \ No newline at end of file diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 61bbe1d78c409dbc2d4af771146878f8f720959a Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 21:03:23 -0700 Subject: First functional version of Controller_Auth_Test --- modules/gallery/tests/Controller_Auth_Test.php | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index 9927859b..e3eb4eaf 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -29,6 +29,8 @@ class Controller_Auth_Test extends Unit_Test_Case { } } + $is_admin_controller = false; + $open_braces = 0; $function = null; for ($token_number = 0; $token_number < count($tokens); $token_number++) { @@ -38,10 +40,12 @@ class Controller_Auth_Test extends Unit_Test_Case { // 1 open brace = in class context. // 2 open braces = in function. if (!is_array($token)) { - if ($token == "{") { + if ($token == "}") { $open_braces--; - if ($function) { + if ($open_braces == 1 && $function) { $found[$controller][] = $function; + } else if ($open_braces == 0) { + $is_admin_controller = false; } $function = null; } else if ($token == "{") { @@ -50,7 +54,11 @@ class Controller_Auth_Test extends Unit_Test_Case { } else { // An array token - if ($open_braces == 1 && $token[0] == T_FUNCTION) { + if ($open_braces == 0 && $token[0] == T_EXTENDS) { + if (self::_token_matches(array(T_STRING, "Admin_Controller"), $tokens, $token_number + 1)) { + $is_admin_controller = true; + } + } else if ($open_braces == 1 && $token[0] == T_FUNCTION) { $line = $token[2]; $name = ""; // Search backwards to check visibility, @@ -63,15 +71,15 @@ class Controller_Auth_Test extends Unit_Test_Case { // Search forward to get function name do { $token_number++; - if (self_::token_matches(array(T_STRING), $tokens, $token_number)) { + if (self::_token_matches(array(T_STRING), $tokens, $token_number)) { $token = $tokens[$token_number]; - $name = $tokens[1]; + $name = $token[1]; break; } } while ($token_number < count($tokens)); if (!$is_private) { - $function = self::_function($name, $line); + $function = self::_function($name, $line, $is_admin_controller); } } @@ -86,7 +94,7 @@ class Controller_Auth_Test extends Unit_Test_Case { if ($token[0] == T_STRING) { if ($token[1] == "access" && self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) && - self::_token_matches(array(T_STRING, "require"), $tokens, $token_number + 2) && + self::_token_matches(array(T_STRING, "required"), $tokens, $token_number + 2) && self::_token_matches("(", $tokens, $token_number + 3)) { $token_number += 3; $function->checks_authorization(true); @@ -109,7 +117,7 @@ class Controller_Auth_Test extends Unit_Test_Case { $function->uses_input(true); } } else if ($token[0] == T_OBJECT_OPERATOR) { - if (self::_token_matches(array(T_STRING), "validate", $token_number + 1) && + if (self::_token_matches(array(T_STRING, "validate"), $tokens, $token_number + 1) && self::_token_matches("(", $tokens, $token_number + 2)) { $token_number += 2; $function->checks_csrf(true); @@ -124,13 +132,16 @@ class Controller_Auth_Test extends Unit_Test_Case { $new = TMPPATH . "controller_auth_data.txt"; $fd = fopen($new, "wb"); ksort($found); - foreach ($found as $controller => $frames) { + foreach ($found as $controller => $functions) { + $is_admin_controller = true; foreach ($functions as $function) { + $is_admin_controller &= $function->is_admin_controller; + $flags = array(); if ($function->uses_input() && !$function->checks_csrf()) { $flags[] = "DIRTY_CSRF"; } - if ($function->checks_authorization()) { + if (!$function->is_admin_controller && !$function->checks_authorization()) { $flags[] = "DIRTY_AUTH"; } @@ -142,6 +153,11 @@ class Controller_Auth_Test extends Unit_Test_Case { fprintf($fd, "%-60s %-20s %-21s\n", $controller, $function->name, implode("|", $flags)); } + + if (strpos(basename($controller), "admin_") === 0 && !$is_admin_controller) { + fprintf($fd, "%-60s %-20s %-21s\n", + $controller, basename($controller), "NO_ADMIN_CONTROLLER"); + } } fclose($fd); @@ -171,21 +187,23 @@ class Controller_Auth_Test extends Unit_Test_Case { } } - static function _function($name, $line) { - return new Controller_Auth_Test_Function($name, $line); + static function _function($name, $line, $is_admin_controller) { + return new Controller_Auth_Test_Function($name, $line, $is_admin_controller); } } class Controller_Auth_Test_Function { public $name; public $line; + public $is_admin_controller = false; private $_uses_input = false; private $_checks_authorization = false; private $_checks_csrf = false; - function __construct($name, $line) { + function __construct($name, $line, $is_admin_controller) { $this->name = $name; $this->line = $line; + $this->is_admin_controller = $is_admin_controller; } function uses_input($val=null) { @@ -195,14 +213,14 @@ class Controller_Auth_Test_Function { return $this->_uses_input; } - function checks_authorization($val) { + function checks_authorization($val=null) { if ($val !== null) { $this->_checks_authorization = $val; } return $this->_checks_authorization; } - function checks_csrf($val) { + function checks_csrf($val=null) { if ($val !== null) { $this->_checks_csrf = $val; } -- cgit v1.2.3 From e168e0dfae28bb56289b4debae8825c104ee69f9 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 21:50:48 -0700 Subject: CSRF / auth fixes, golden data file checkpoint --- modules/gallery/controllers/permissions.php | 2 +- modules/gallery/controllers/simple_uploader.php | 1 + modules/gallery/tests/Controller_Auth_Test.php | 8 ++++++-- modules/gallery/tests/controller_auth_data.txt | 17 +++++++++++++++++ modules/tag/controllers/tags.php | 2 ++ modules/user/controllers/admin_users.php | 2 +- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/gallery/controllers/permissions.php b/modules/gallery/controllers/permissions.php index 5f4620b2..8d75862e 100644 --- a/modules/gallery/controllers/permissions.php +++ b/modules/gallery/controllers/permissions.php @@ -81,7 +81,7 @@ class Permissions_Controller extends Controller { } } - function _get_form($item) { + private function _get_form($item) { $view = new View("permissions_form.html"); $view->item = $item; $view->groups = ORM::factory("group")->find_all(); diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php index 156d18ac..bc508319 100644 --- a/modules/gallery/controllers/simple_uploader.php +++ b/modules/gallery/controllers/simple_uploader.php @@ -32,6 +32,7 @@ class Simple_Uploader_Controller extends Controller { } public function start() { + access::verify_csrf(); batch::start(); } diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index e3eb4eaf..50afae8f 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -21,6 +21,10 @@ class Controller_Auth_Test extends Unit_Test_Case { public function find_missing_auth_test() { $found = array(); foreach (glob("*/*/controllers/*.php") as $controller) { + if (strpos($controller, "modules/unit_test/") !== false) { + continue; + } + // List of all tokens without whitespace, simplifying parsing. $tokens = array(); foreach (token_get_all(file_get_contents($controller)) as $token) { @@ -150,12 +154,12 @@ class Controller_Auth_Test extends Unit_Test_Case { continue; } - fprintf($fd, "%-60s %-20s %-21s\n", + fprintf($fd, "%-60s %-20s %s\n", $controller, $function->name, implode("|", $flags)); } if (strpos(basename($controller), "admin_") === 0 && !$is_admin_controller) { - fprintf($fd, "%-60s %-20s %-21s\n", + fprintf($fd, "%-60s %-20s %s\n", $controller, basename($controller), "NO_ADMIN_CONTROLLER"); } } diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index e69de29b..aabd2863 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -0,0 +1,17 @@ +modules/comment/controllers/admin_comments.php queue DIRTY_CSRF +modules/digibug/controllers/digibug.php close_window DIRTY_AUTH +modules/gallery/controllers/combined.php javascript DIRTY_AUTH +modules/gallery/controllers/combined.php css DIRTY_AUTH +modules/gallery/controllers/maintenance.php index DIRTY_AUTH +modules/gallery/controllers/rest.php form_add DIRTY_AUTH +modules/gallery/controllers/rest.php _index DIRTY_AUTH +modules/gallery/controllers/rest.php _create DIRTY_AUTH +modules/gallery/controllers/rest.php _show DIRTY_AUTH +modules/gallery/controllers/rest.php _update DIRTY_AUTH +modules/gallery/controllers/rest.php _delete DIRTY_AUTH +modules/gallery/controllers/rest.php _form_add DIRTY_AUTH +modules/gallery/controllers/rest.php _form_edit DIRTY_AUTH +modules/gallery/controllers/simple_uploader.php start DIRTY_AUTH +modules/gallery/controllers/simple_uploader.php finish DIRTY_AUTH +modules/user/controllers/login.php ajax DIRTY_AUTH +modules/user/controllers/login.php html DIRTY_AUTH diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index c993e374..f4f98090 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -43,6 +43,8 @@ class Tags_Controller extends REST_Controller { } public function _index() { + // Far from perfection, but at least require view permission for the root album + access::required("view", 1); print tag::cloud(30); } diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index 521f82fa..0b748955 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Admin_Users_Controller extends Controller { +class Admin_Users_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_users.html"); -- cgit v1.2.3 From dc3d45e7607acce91253e44c29998b8797131f93 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 22:01:59 -0700 Subject: Add exception for REST controllers (no fixes necessary). --- modules/gallery/tests/Controller_Auth_Test.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index 50afae8f..c4dc915b 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -18,6 +18,11 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Controller_Auth_Test extends Unit_Test_Case { + static $rest_methods = array("_index", "_show", "_form_edit", "_form_add", "_create", + "_update", "_delete"); + + static $rest_methods_with_csrf_check = array("_update", "_delete", "_create"); + public function find_missing_auth_test() { $found = array(); foreach (glob("*/*/controllers/*.php") as $controller) { @@ -34,6 +39,7 @@ class Controller_Auth_Test extends Unit_Test_Case { } $is_admin_controller = false; + $is_rest_controller = false; $open_braces = 0; $function = null; @@ -50,6 +56,7 @@ class Controller_Auth_Test extends Unit_Test_Case { $found[$controller][] = $function; } else if ($open_braces == 0) { $is_admin_controller = false; + $is_rest_controller = false; } $function = null; } else if ($token == "{") { @@ -61,6 +68,8 @@ class Controller_Auth_Test extends Unit_Test_Case { if ($open_braces == 0 && $token[0] == T_EXTENDS) { if (self::_token_matches(array(T_STRING, "Admin_Controller"), $tokens, $token_number + 1)) { $is_admin_controller = true; + } else if (self::_token_matches(array(T_STRING, "REST_Controller"), $tokens, $token_number + 1)) { + $is_rest_controller = true; } } else if ($open_braces == 1 && $token[0] == T_FUNCTION) { $line = $token[2]; @@ -82,8 +91,11 @@ class Controller_Auth_Test extends Unit_Test_Case { } } while ($token_number < count($tokens)); - if (!$is_private) { + if (!$is_private || ($is_rest_controller && in_array($name, self::$rest_methods))) { $function = self::_function($name, $line, $is_admin_controller); + if ($is_rest_controller && in_array($name, self::$rest_methods_with_csrf_check)) { + $function->checks_csrf(true); + } } } -- cgit v1.2.3 From 7608870537503ec571f45a175c8486d7945e7c63 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 22:51:49 -0700 Subject: Controller auth / CSRF fixes --- modules/gallery/tests/Controller_Auth_Test.php | 19 +++++++++++-------- modules/gallery/tests/controller_auth_data.txt | 22 ++++++++++++++++++++++ modules/organize/controllers/organize.php | 4 ++++ modules/rss/controllers/rss.php | 4 ++-- modules/tag/controllers/tags.php | 3 ++- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index c4dc915b..cd4abe07 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -26,7 +26,7 @@ class Controller_Auth_Test extends Unit_Test_Case { public function find_missing_auth_test() { $found = array(); foreach (glob("*/*/controllers/*.php") as $controller) { - if (strpos($controller, "modules/unit_test/") !== false) { + if (preg_match("{modules/(gallery_)?unit_test/}", $controller)) { continue; } @@ -54,11 +54,11 @@ class Controller_Auth_Test extends Unit_Test_Case { $open_braces--; if ($open_braces == 1 && $function) { $found[$controller][] = $function; + $function = null; } else if ($open_braces == 0) { $is_admin_controller = false; $is_rest_controller = false; } - $function = null; } else if ($token == "{") { $open_braces++; } @@ -80,6 +80,7 @@ class Controller_Auth_Test extends Unit_Test_Case { $previous_2 = $tokens[$token_number - 2][0]; $is_private = in_array($previous, array(T_PRIVATE, T_PROTECTED)) || in_array($previous_2, array(T_PRIVATE, T_PROTECTED)); + $is_static = $previous == T_STATIC || $previous_2 == T_STATIC; // Search forward to get function name do { @@ -91,7 +92,9 @@ class Controller_Auth_Test extends Unit_Test_Case { } } while ($token_number < count($tokens)); - if (!$is_private || ($is_rest_controller && in_array($name, self::$rest_methods))) { + if (!$is_static && + (!$is_private || + ($is_rest_controller && in_array($name, self::$rest_methods)))) { $function = self::_function($name, $line, $is_admin_controller); if ($is_rest_controller && in_array($name, self::$rest_methods_with_csrf_check)) { $function->checks_csrf(true); @@ -110,7 +113,8 @@ class Controller_Auth_Test extends Unit_Test_Case { if ($token[0] == T_STRING) { if ($token[1] == "access" && self::_token_matches(array(T_DOUBLE_COLON, "::"), $tokens, $token_number + 1) && - self::_token_matches(array(T_STRING, "required"), $tokens, $token_number + 2) && + self::_token_matches(array(T_STRING), $tokens, $token_number + 2) && + in_array($tokens[$token_number + 2][1], array("forbidden", "required")) && self::_token_matches("(", $tokens, $token_number + 3)) { $token_number += 3; $function->checks_authorization(true); @@ -125,7 +129,7 @@ class Controller_Auth_Test extends Unit_Test_Case { $token_number++; $function->uses_input(true); } - } else if ($token == T_VARIABLE) { + } else if ($token[0] == T_VARIABLE) { if ($token[1] == '$this' && self::_token_matches(array(T_OBJECT_OPERATOR), $tokens, $token_number + 1) && self::_token_matches(array(T_STRING, "input"), $tokens, $token_number + 2)) { @@ -152,7 +156,6 @@ class Controller_Auth_Test extends Unit_Test_Case { $is_admin_controller = true; foreach ($functions as $function) { $is_admin_controller &= $function->is_admin_controller; - $flags = array(); if ($function->uses_input() && !$function->checks_csrf()) { $flags[] = "DIRTY_CSRF"; @@ -224,14 +227,14 @@ class Controller_Auth_Test_Function { function uses_input($val=null) { if ($val !== null) { - $this->_uses_input = $val; + $this->_uses_input = (bool) $val; } return $this->_uses_input; } function checks_authorization($val=null) { if ($val !== null) { - $this->_checks_authorization = $val; + $this->_checks_authorization = (bool) $val; } return $this->_checks_authorization; } diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index aabd2863..fcb977e4 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -1,8 +1,17 @@ modules/comment/controllers/admin_comments.php queue DIRTY_CSRF +modules/comment/controllers/comments.php _index DIRTY_CSRF +modules/digibug/controllers/digibug.php print_proxy DIRTY_CSRF|DIRTY_AUTH modules/digibug/controllers/digibug.php close_window DIRTY_AUTH +modules/gallery/controllers/admin.php __call DIRTY_AUTH +modules/gallery/controllers/albums.php _show DIRTY_CSRF +modules/gallery/controllers/albums.php _form_add DIRTY_CSRF modules/gallery/controllers/combined.php javascript DIRTY_AUTH modules/gallery/controllers/combined.php css DIRTY_AUTH +modules/gallery/controllers/file_proxy.php __call DIRTY_CSRF|DIRTY_AUTH modules/gallery/controllers/maintenance.php index DIRTY_AUTH +modules/gallery/controllers/rest.php __construct DIRTY_AUTH +modules/gallery/controllers/rest.php __call DIRTY_AUTH +modules/gallery/controllers/rest.php form_edit DIRTY_AUTH modules/gallery/controllers/rest.php form_add DIRTY_AUTH modules/gallery/controllers/rest.php _index DIRTY_AUTH modules/gallery/controllers/rest.php _create DIRTY_AUTH @@ -13,5 +22,18 @@ modules/gallery/controllers/rest.php _form_add modules/gallery/controllers/rest.php _form_edit DIRTY_AUTH modules/gallery/controllers/simple_uploader.php start DIRTY_AUTH modules/gallery/controllers/simple_uploader.php finish DIRTY_AUTH +modules/gallery/controllers/upgrader.php index DIRTY_AUTH +modules/gallery/controllers/welcome_message.php index DIRTY_AUTH +modules/rss/controllers/rss.php feed DIRTY_CSRF|DIRTY_AUTH +modules/search/controllers/search.php index DIRTY_CSRF|DIRTY_AUTH +modules/server_add/controllers/admin_server_add.php autocomplete DIRTY_CSRF +modules/server_add/controllers/server_add.php children DIRTY_CSRF +modules/tag/controllers/admin_tags.php index DIRTY_CSRF +modules/tag/controllers/tags.php _show DIRTY_CSRF|DIRTY_AUTH modules/user/controllers/login.php ajax DIRTY_AUTH +modules/user/controllers/login.php auth_ajax DIRTY_AUTH modules/user/controllers/login.php html DIRTY_AUTH +modules/user/controllers/login.php auth_html DIRTY_AUTH +modules/user/controllers/logout.php index DIRTY_CSRF|DIRTY_AUTH +modules/user/controllers/password.php reset DIRTY_AUTH +modules/user/controllers/password.php do_reset DIRTY_CSRF|DIRTY_AUTH diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 259c94e7..08c80de3 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -45,9 +45,13 @@ class Organize_Controller extends Controller { access::verify_csrf(); $target_album = ORM::factory("item", $target_album_id); + access::required("view", $target_album); + access::required("add", $target_album); + foreach ($this->input->post("source_ids") as $source_id) { $source = ORM::factory("item", $source_id); if (!$source->contains($target_album)) { + access::required("edit", $source); item::move($source, $target_album); } } diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php index b89bed40..015d6032 100644 --- a/modules/rss/controllers/rss.php +++ b/modules/rss/controllers/rss.php @@ -21,13 +21,13 @@ class Rss_Controller extends Controller { public static $page_size = 20; public function feed($module_id, $feed_id, $id=null) { - $page = $this->input->get("page", 1); + $page = (int) $this->input->get("page", 1); if ($page < 1) { url::redirect(url::merge(array("page" => 1))); } // Configurable page size between 1 and 100, default 20 - $page_size = max(1, min(100, $this->input->get("page_size", self::$page_size))); + $page_size = max(1, min(100, (int) $this->input->get("page_size", self::$page_size))); // Run the appropriate feed callback if (module::is_active($module_id)) { diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index f4f98090..b9f2c61c 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -44,7 +44,8 @@ class Tags_Controller extends REST_Controller { public function _index() { // Far from perfection, but at least require view permission for the root album - access::required("view", 1); + $album = ORM::factory("item", 1); + access::required("view", $album); print tag::cloud(30); } -- cgit v1.2.3 From 39632c4689842b3e3bb0715c0e9be757149c257d Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 23:01:26 -0700 Subject: Also check for rss feeds in controller auth check --- modules/gallery/tests/Controller_Auth_Test.php | 8 ++++++-- modules/gallery/tests/controller_auth_data.txt | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/gallery/tests/Controller_Auth_Test.php b/modules/gallery/tests/Controller_Auth_Test.php index cd4abe07..caf6d8f2 100644 --- a/modules/gallery/tests/Controller_Auth_Test.php +++ b/modules/gallery/tests/Controller_Auth_Test.php @@ -25,7 +25,9 @@ class Controller_Auth_Test extends Unit_Test_Case { public function find_missing_auth_test() { $found = array(); - foreach (glob("*/*/controllers/*.php") as $controller) { + $controllers = glob("*/*/controllers/*.php"); + $feeds = glob("*/*/helpers/*_rss.php"); + foreach (array_merge($controllers, $feeds) as $controller) { if (preg_match("{modules/(gallery_)?unit_test/}", $controller)) { continue; } @@ -92,7 +94,9 @@ class Controller_Auth_Test extends Unit_Test_Case { } } while ($token_number < count($tokens)); - if (!$is_static && + $is_rss_feed = $name == "feed" && strpos(basename($controller), "_rss.php"); + + if ((!$is_static || $is_rss_feed) && (!$is_private || ($is_rest_controller && in_array($name, self::$rest_methods)))) { $function = self::_function($name, $line, $is_admin_controller); diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index fcb977e4..fdf00c5e 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -1,5 +1,6 @@ modules/comment/controllers/admin_comments.php queue DIRTY_CSRF modules/comment/controllers/comments.php _index DIRTY_CSRF +modules/comment/helpers/comment_rss.php feed DIRTY_AUTH modules/digibug/controllers/digibug.php print_proxy DIRTY_CSRF|DIRTY_AUTH modules/digibug/controllers/digibug.php close_window DIRTY_AUTH modules/gallery/controllers/admin.php __call DIRTY_AUTH -- cgit v1.2.3 From f1887422f8b4ba68dc273fe6f7d3f1123681e89a Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 15 Sep 2009 23:07:41 -0700 Subject: Stricter input handling (cast to int) --- modules/tag/controllers/tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index b9f2c61c..1bd6b3cc 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -22,7 +22,7 @@ class Tags_Controller extends REST_Controller { public function _show($tag) { $page_size = module::get_var("gallery", "page_size", 9); - $page = $this->input->get("page", "1"); + $page = (int) $this->input->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; -- cgit v1.2.3 From eb8e23582f8c11062868811854417a8a8ec0122b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 16 Sep 2009 08:46:55 -0700 Subject: Update the jquery-ui.js with the patched version from vendor --- lib/jquery-ui.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/jquery-ui.js b/lib/jquery-ui.js index c803ea27..3398b9e4 100644 --- a/lib/jquery-ui.js +++ b/lib/jquery-ui.js @@ -114,18 +114,26 @@ $(this).css({left:ho.left-cop.left-co.left,width:w,height:h});if(self._helper&&! $(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}});$.ui.plugin.add("resizable","ghost",{start:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size;self.ghost=self.originalElement.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(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost)self.ghost.css({position:'relative',height:self.size.height,width:self.size.width});},stop:function(event,ui){var self=$(this).data("resizable"),o=self.options;if(self.ghost&&self.helper)self.helper.get(0).removeChild(self.ghost.get(0));}});$.ui.plugin.add("resizable","grid",{resize:function(event,ui){var self=$(this).data("resizable"),o=self.options,cs=self.size,os=self.originalSize,op=self.originalPosition,a=self.axis,ratio=o._aspectRatio||event.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;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.widget("ui.selectable",$.extend({},$.ui.mouse,{_init:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;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.outerWidth(),bottom:pos.top+$this.outerHeight(),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'}).addClass("ui-selectable-helper");},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();},_mouseStart:function(event){var self=this;this.opos=[event.pageX,event.pageY];if(this.options.disabled) -return;var options=this.options;this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":event.clientX,"top":event.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(!event.metaKey){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');selectee.unselecting=false;selectee.selecting=true;selectee.selected=true;self._trigger("selecting",event,{selecting:selectee.element});return false;}});},_mouseDrag:function(event){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=event.pageX,y2=event.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp;} +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;}}});var num=function(v){return parseInt(v,10)||0;};var isNumber=function(value){return!isNaN(parseInt(value,10));};})(jQuery);(function($){$.widget("ui.selectable",$.extend({},$.ui.mouse,{_init:function(){var self=this;this.element.addClass("ui-selectable");this.dragged=false;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.outerWidth(),bottom:pos.top+$this.outerHeight(),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'}).addClass("ui-selectable-helper");this.element.bind("mousedown.selectable",function(event){if(event.pageX>self.element[0].scrollWidth+self.element.offset().left){return;} +var selectee=self._targetIsSelectable(event.target);if(!selectee){return;} +var test=$(".ui-selected").length;if(!event.ctrlKey&&$(".ui-selected").length>1&&$(selectee).hasClass("ui-selected")){return(self._listenForMouseUp=1);} +if(!event.ctrlKey){$(".ui-selected").each(function(){self._removeSelection(this,event);});} +self._toggleSelection(selectee,event);event.preventDefault();}).bind("mouseup.selectable",function(event){if(self._listenForMouseUp){self._listenForMouseUp=0;var selectee=self._targetIsSelectable(event.target);if(!selectee){return;} +self._addSelection(selectee,event);event.preventDefault();}})},_addSelection:function(selectee,event){$(selectee).addClass("ui-selecting");this._trigger("selecting",event,{selecting:selectee});$(selectee).removeClass('ui-selecting').addClass('ui-selected');this._trigger("selected",event,{selected:selectee});},_removeSelection:function(selected,event){$(selected).removeClass('ui-selected').addClass('ui-unselecting');this._trigger("unselecting",event,{unselecting:selected});$(selected).removeClass('ui-unselecting');this._trigger("unselected",event,{unselected:selected});},_toggleSelection:function(selectee,event){if($(selectee).hasClass("ui-selected")){this._removeSelection(selectee,event);}else{this._addSelection(selectee,event);}},_targetIsSelectable:function(target){var found=$(target).parents().andSelf().filter(".ui-selectee");return found.length&&found;},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();},_mouseStart:function(event){var self=this;if(event.pageX>this.element[0].scrollWidth+this.element.offset().left){this.opos=null;return;} +this.opos=[event.pageX,event.pageY];if(this.options.disabled) +return;var options=this.options,appendTo=$(options.appendTo),parentOffset=appendTo.css('position')=='static'?appendTo.offsetParent().offset():appendTo.offset();this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);appendTo.append(this.helper);this.helper.css({"z-index":100,"position":"absolute","left":event.clientX-parentOffset.left,"top":event.clientY-parentOffset.top,"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(!event.metaKey){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().andSelf().each(function(){var selectee=$.data(this,"selectable-item");if(selectee){selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');selectee.unselecting=false;selectee.selecting=true;selectee.selected=true;self._trigger("selecting",event,{selecting:selectee.element});return false;}});},_mouseDrag:function(event){var self=this;if(!this.opos){return;} +this.dragged=true;if(this.options.disabled) +return;var options=this.options;var x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY,appendTo=$(options.appendTo),parentOffset=appendTo.css('position')=='static'?appendTo.offsetParent().offset():appendTo.offset();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");if(!selectee||selectee.element==self.element[0]) +this.helper.css({left:x1-parentOffset.left,top:y1-parentOffset.top,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item");if(!selectee||selectee.element==self.element[0]) return;var hit=false;if(options.tolerance=='touch'){hit=(!(selectee.left>x2||selectee.righty2||selectee.bottomx1&&selectee.righty1&&selectee.bottom=0;i--) +if(selectee.selected){if(!event.metaKey&&!selectee.startselected){selectee.$element.removeClass('ui-selected');selectee.selected=false;selectee.$element.addClass('ui-unselecting');selectee.unselecting=true;self._trigger("unselecting",event,{unselecting:selectee.element});}}}});return false;},_mouseStop:function(event){var self=this;if(!this.opos){return;} +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._trigger("unselected",event,{unselected:selectee.element});});$('.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._trigger("selected",event,{selected:selectee.element});});this._trigger("stop",event);this.helper.remove();return false;}}));$.extend($.ui.selectable,{version:"1.7.2",defaults:{appendTo:'body',autoRefresh:true,cancel:":input,option",delay:0,distance:0,filter:'*',tolerance:'touch'}});})(jQuery);(function($){$.widget("ui.sortable",$.extend({},$.ui.mouse,{_init:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--) this.items[i].item.removeData("sortable-item");},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;} if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;} this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;if(o.cursorAt) -- cgit v1.2.3 From 5490057480f17e5810cf8b9e558769ebd74d4b27 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 16 Sep 2009 12:27:13 -0700 Subject: When editing tags in place, and there is a validation error, highlight the tag with a red border and show a statust message. This fixes ticket: #779 --- modules/tag/controllers/admin_tags.php | 15 ++++++++++----- modules/tag/js/tag.js | 6 ++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 8b8dde21..3301566b 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -81,15 +81,20 @@ class Admin_Tags_Controller extends Admin_Controller { kohana::show_404(); } - $form = tag::get_rename_form($tag); - $valid = $form->validate(); + //Don't use a form as the form is dynamically created in the js + $post = new Validation($_POST); + $post->add_rules("name", "required", "length[1,64]"); + $valid = $post->validate(); if ($valid) { - $new_name = $form->rename_tag->inputs["name"]->value; + $new_name = $this->input->post("name"); $new_tag = ORM::factory("tag")->where("name", $new_name)->find(); if ($new_tag->loaded) { - $form->rename_tag->inputs["name"]->add_error("in_use", 1); + $error_msg = "There is already a tag with that name"; $valid = false; } + } else { + $error_msg = $post->errors(); + $error_msg = $error_msg[0]; } if ($valid) { @@ -110,7 +115,7 @@ class Admin_Tags_Controller extends Admin_Controller { } else { print json_encode( array("result" => "error", - "form" => $form->__toString())); + "message" => $error_msg)); } } } diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index aaae9e72..d656da36 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -19,6 +19,7 @@ function ajaxify_tag_form() { function closeEditInPlaceForms() { // closes currently open inplace edit forms if ($("#gRenameTagForm").length) { + $("#gEditErrorMessage").remove(); var li = $("#gRenameTagForm").parent(); $("#gRenameTagForm").parent().html($("#gRenameTagForm").parent().data("revert")); li.height(""); @@ -66,6 +67,11 @@ function editInPlace(element) { $("#gTag-" + data.tag_id).text(data.new_tagname); // update tagname console.log(data); window.location.reload(); + } else if (data.result == "error") { + $("#gRenameTagForm #name") + .css("border", "2px solid red") + .focus(); + $("#gTagAdmin").before("

      " + data.message + "

      "); } } }); -- cgit v1.2.3 From 4e1e24ba1a976cd0bb7ca7dd03c6001f906a25dd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 16 Sep 2009 20:34:42 -0700 Subject: Add a movie_menu() theme callback, and have the default theme call it in the sidebar on movie page types. --- modules/gallery/libraries/Theme_View.php | 6 ++++++ themes/default/views/sidebar.html.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 541bce88..130e2dce 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -111,6 +111,12 @@ class Theme_View_Core extends Gallery_View { return $menu->compact(); } + public function movie_menu() { + $menu = Menu::factory("root"); + module::event("movie_menu", $menu, $this); + return $menu->compact(); + } + public function context_menu($item, $thumbnail_css_selector) { $menu = Menu::factory("root") ->append(Menu::factory("submenu") diff --git a/themes/default/views/sidebar.html.php b/themes/default/views/sidebar.html.php index 928ecb93..04379eb6 100644 --- a/themes/default/views/sidebar.html.php +++ b/themes/default/views/sidebar.html.php @@ -6,6 +6,8 @@ album_menu() ?> photo_menu() ?> + + movie_menu() ?> tag_menu() ?> -- cgit v1.2.3 From 9d76797b17d65540a903ef37eee6edca3e83108b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 16 Sep 2009 22:23:32 -0700 Subject: Changed the search module installer to explicitly specify MyISAM as the database type. Changed the packager to not remove the engine specification if the table is search_records. Fixes Ticket #774 --- installer/install.sql | 2 +- modules/gallery/controllers/packager.php | 10 ++++++++-- modules/search/helpers/search_installer.php | 10 ++++++++++ modules/search/module.info | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/installer/install.sql b/installer/install.sql index ca0ecadf..e8aaa681 100755 --- a/installer/install.sql +++ b/installer/install.sql @@ -278,7 +278,7 @@ CREATE TABLE {search_records} ( PRIMARY KEY (`id`), KEY `item_id` (`item_id`), FULLTEXT KEY `data` (`data`) -) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; INSERT INTO {search_records} VALUES (1,1,0,' Gallery'); DROP TABLE IF EXISTS {sessions}; diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php index fbb1d07d..ae87d74b 100644 --- a/modules/gallery/controllers/packager.php +++ b/modules/gallery/controllers/packager.php @@ -114,18 +114,24 @@ class Packager_Controller extends Controller { $root = ORM::factory("item", 1); $root_created_timestamp = $root->created; $root_updated_timestamp = $root->updated; + $table_name = ""; foreach (file($sql_file) as $line) { // Prefix tables $line = preg_replace( "/(CREATE TABLE|IF EXISTS|INSERT INTO) `{$dbconfig['table_prefix']}(\w+)`/", "\\1 {\\2}", $line); + if (preg_match("/CREATE TABLE {(\w+)}/", $line, $matches)) { + $table_name = $matches[1]; + } // Normalize dates $line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line); $line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line); - // Remove ENGINE= specifications - $line = preg_replace("/ENGINE=\S+ /", "", $line); + // Remove ENGINE= specifications execpt for search records, it always needs to be MyISAM + if ($table_name != "search_records") { + $line = preg_replace("/ENGINE=\S+ /", "", $line); + } $buf .= $line; } diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index 10d8211f..096f46c7 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -28,6 +28,7 @@ class search_installer { PRIMARY KEY (`id`), KEY(`item_id`), FULLTEXT INDEX (`data`)) + ENGINE=MYISAM DEFAULT CHARSET=utf8;"); module::set_version("search", 1); } @@ -47,4 +48,13 @@ class search_installer { static function uninstall() { Database::instance()->query("DROP TABLE {search_records}"); } + + static function upgrade($version) { + $db = Database::instance(); + if ($version == 1) { + $db->query("ALTER TABLE {search_records} ENGINE=MYISAM"); + module::set_version("search", 2); + } + } + } diff --git a/modules/search/module.info b/modules/search/module.info index f417c4fa..2f2ebdf1 100644 --- a/modules/search/module.info +++ b/modules/search/module.info @@ -1,3 +1,3 @@ name = "Search" description = "Allows users to search their Gallery" -version = 1 +version = 2 -- cgit v1.2.3 From 86996dcac7ca07e789df6ce1d5b13867d8aa57f6 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 01:17:30 -0700 Subject: Mark permission's display name for translation --- modules/gallery/helpers/gallery_installer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index a1856424..6500482b 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -203,6 +203,12 @@ class gallery_installer { access::register_permission("edit", "Edit"); access::register_permission("add", "Add"); + // Mark for translation (must be the same strings as used above) + t("View Full Size"); + t("View"); + t("Edit"); + t("Add"); + $root = ORM::factory("item"); $root->type = "album"; $root->title = "Gallery"; -- cgit v1.2.3 From 30b5c389e6baae397d6c5c9fe9c7ed91a5296568 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 01:21:06 -0700 Subject: Fix: Make "Sharing your translations" a localizable string --- modules/gallery/views/admin_languages.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index fa97d299..ab370f88 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -98,6 +98,6 @@
      -

      Sharing your translations

      +

      t("Sharing your translations")

      -- cgit v1.2.3 From a5af531fbee1db0c3a0ae0d23388245b2d2ec2de Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 07:04:11 -0700 Subject: Don't show links as part of the auto complete list --- modules/server_add/controllers/admin_server_add.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index 7cd82d60..38190fee 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -36,7 +36,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { if ($form->validate()) { if (is_link($form->add_path->path->value)) { $form->add_path->path->add_error("is_symlink", 1); - } else if (! is_readable($form->add_path->path->value)) { + } else if (!is_readable($form->add_path->path->value)) { $form->add_path->path->add_error("not_readable", 1); } else { $path = $form->add_path->path->value; @@ -73,7 +73,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { $directories = array(); $path_prefix = $this->input->get("q"); foreach (glob("{$path_prefix}*") as $file) { - if (is_dir($file)) { + if (is_dir($file) && !is_link($file)) { $directories[] = $file; } } -- cgit v1.2.3 From 86681eebf7ee2bf28b12fd12ee6a5fe70bc36d0a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 07:29:37 -0700 Subject: Move the check_environment into the installer helper and call it from the command line installer as well as the web installer. --- installer/cli.php | 5 +++++ installer/installer.php | 41 +++++++++++++++++++++++++++++++++++++++++ installer/web.php | 42 +----------------------------------------- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/installer/cli.php b/installer/cli.php index 50845ea4..182c3d26 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -30,6 +30,11 @@ if (installer::already_installed()) { return; } +$errors = installer::check_environment(); +if ($errors) { + oops(implode("errors", "\n")); +} + $config = parse_cli_params(); if (!installer::connect($config)) { oops("Unable to connect to the database.\n" . mysql_error() . "\n"); diff --git a/installer/installer.php b/installer/installer.php index 7a417634..70afc440 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -178,4 +178,45 @@ class installer { static function prepend_prefix($prefix, $sql) { return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql); } + + static function check_environment() { + if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { + $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the MySQL or the MySQLi extension."; + } + + if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { + $errors[] = "PHP is missing Perl-Compatible Regular Expression support."; + } + + if (!(function_exists("spl_autoload_register"))) { + $errors[] = "PHP is missing Standard PHP Library (SPL) support"; + } + + if (!(class_exists("ReflectionClass"))) { + $errors[] = "PHP is missing reflection support"; + } + + if (!(function_exists("filter_list"))) { + $errors[] = "PHP is missing the filter extension"; + } + + if (!(extension_loaded("iconv"))) { + $errors[] = "PHP is missing the iconv extension"; + } + + if (!(extension_loaded("simplexml"))) { + $errors[] = "PHP is missing the SimpleXML extension"; + } + + if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { + $errors[] = "The mbstring extension is overloading PHP's native string functions. Please disable it."; + } + + if (!function_exists("json_encode")) { + $errors[] = "PHP is missing the JavaScript Object Notation (JSON) extension. Please install it."; + } + + return @$errors; +} + } diff --git a/installer/web.php b/installer/web.php index eb0211a6..c46f072a 100644 --- a/installer/web.php +++ b/installer/web.php @@ -23,7 +23,7 @@ if (installer::already_installed()) { switch (@$_GET["step"]) { default: case "welcome": - $errors = check_environment(); + $errors = installer::check_environment(); if ($errors) { $content = render("environment_errors.html.php", array("errors" => $errors)); } else { @@ -80,43 +80,3 @@ function render($view, $args=array()) { function oops($error) { return render("oops.html.php", array("error" => $error)); } - -function check_environment() { - if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { - $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the MySQL or the MySQLi extension."; - } - - if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { - $errors[] = "PHP is missing Perl-Compatible Regular Expression support."; - } - - if (!(function_exists("spl_autoload_register"))) { - $errors[] = "PHP is missing Standard PHP Library (SPL) support"; - } - - if (!(class_exists("ReflectionClass"))) { - $errors[] = "PHP is missing reflection support"; - } - - if (!(function_exists("filter_list"))) { - $errors[] = "PHP is missing the filter extension"; - } - - if (!(extension_loaded("iconv"))) { - $errors[] = "PHP is missing the iconv extension"; - } - - if (!(extension_loaded("simplexml"))) { - $errors[] = "PHP is missing the SimpleXML extension"; - } - - if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { - $errors[] = "The mbstring extension is overloading PHP's native string functions. Please disable it."; - } - - if (!function_exists("json_encode")) { - $errors[] = "PHP is missing the JavaScript Object Notation (JSON) extension. Please install it."; - } - - return @$errors; -} -- cgit v1.2.3 From 88c374dee8b63957b7523850508c9bd7b8c4f100 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 10:01:15 -0700 Subject: Arg, fixing the "Sharing your Translations" text, thanks engineer@gmc --- modules/gallery/views/admin_languages.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index ab370f88..fb30c7ba 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -98,6 +98,6 @@
      -

      t("Sharing your translations")

      +

      -- cgit v1.2.3 From be1d49d017a71ee0967c47325986f482532a4f16 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 10:55:50 -0700 Subject: Change the timeout on resubmitting the next task iteration to 25ms instead of. This allows the jQuery.ajax method to complete its processing. Otherwise, the browser can spend time thrashing around trying to send the next request. --- modules/server_add/js/server_add.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 51ef41a7..4c411715 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -39,7 +39,7 @@ function start_add() { success: function(data, textStatus) { $("#gStatus").html(data.status); $("#gServerAdd .gProgressBar").progressbar("value", data.percent_complete); - setTimeout(function() { run_add(data.url); }, 0); + setTimeout(function() { run_add(data.url); }, 25); } }); return false; @@ -56,7 +56,7 @@ function run_add(url) { if (data.done) { $("#gServerAddProgress").slideUp(); } else { - setTimeout(function() { run_add(url); }, 0); + setTimeout(function() { run_add(url); }, 25); } } }); -- cgit v1.2.3 From c7f8d8be6fe9e15b11ef781bdd6ed279fcb5f1a4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 10:57:22 -0700 Subject: Don't try to creat an album that corresponds to the staging directory. Just add the contents of the staging directlyinto the album that server_add was invoked from. Fixes ticket #785 --- modules/server_add/controllers/server_add.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 26b3bd08..9769cd6f 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -137,17 +137,25 @@ class Server_Add_Controller extends Admin_Controller { // form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We // have this extra level of abstraction because we don't know its Item_Model id yet. $queue = $task->get("queue"); + $paths = unserialize(module::get_var("server_add", "authorized_paths")); + while ($queue && microtime(true) - $start < 0.5) { list($file, $parent_entry_id) = array_shift($queue); - $entry = ORM::factory("server_add_file"); - $entry->task_id = $task->id; - $entry->file = $file; - $entry->parent_id = $parent_entry_id; - $entry->save(); + // Ignore the staging directories as directories to be imported. + if (empty($paths[$file])) { + $entry = ORM::factory("server_add_file"); + $entry->task_id = $task->id; + $entry->file = $file; + $entry->parent_id = $parent_entry_id; + $entry->save(); + $entry_id = $entry->id; + } else { + $entry_id = null; + } foreach (glob("$file/*") as $child) { if (is_dir($child)) { - $queue[] = array($child, $entry->id); + $queue[] = array($child, $entry_id); } else { $ext = strtolower(pathinfo($child, PATHINFO_EXTENSION)); if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4")) && @@ -155,7 +163,7 @@ class Server_Add_Controller extends Admin_Controller { $child_entry = ORM::factory("server_add_file"); $child_entry->task_id = $task->id; $child_entry->file = $child; - $child_entry->parent_id = $entry->id; + $child_entry->parent_id = $entry_id; $child_entry->save(); } } -- cgit v1.2.3 From 6469763225b1f74bc5391f09446bcf280bea389e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 11:10:15 -0700 Subject: Reload the album when server_add dialog is closed --- modules/server_add/views/server_add_tree_dialog.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index 8eb6e4df..dd4efd06 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -50,6 +50,7 @@ }); $("#gServerCloseButton").click(function(event) { $("#gDialog").dialog("close"); + window.location.reload(); }); }); -- cgit v1.2.3 From 48326ad01708fcfa020283e2ad8b2cae4ede1600 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 12:11:00 -0700 Subject: Cleanup issues with the original fix for #779 --- modules/tag/controllers/admin_tags.php | 4 ++-- modules/tag/js/tag.js | 2 +- themes/admin_default/css/screen.css | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index 3301566b..ced73d65 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -81,7 +81,7 @@ class Admin_Tags_Controller extends Admin_Controller { kohana::show_404(); } - //Don't use a form as the form is dynamically created in the js + // Don't use a form as the form is dynamically created in the js $post = new Validation($_POST); $post->add_rules("name", "required", "length[1,64]"); $valid = $post->validate(); @@ -89,7 +89,7 @@ class Admin_Tags_Controller extends Admin_Controller { $new_name = $this->input->post("name"); $new_tag = ORM::factory("tag")->where("name", $new_name)->find(); if ($new_tag->loaded) { - $error_msg = "There is already a tag with that name"; + $error_msg = t("There is already a tag with that name")->__toString(); $valid = false; } } else { diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index d656da36..52c695c6 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -69,7 +69,7 @@ function editInPlace(element) { window.location.reload(); } else if (data.result == "error") { $("#gRenameTagForm #name") - .css("border", "2px solid red") + .addClass("gError") .focus(); $("#gTagAdmin").before("

      " + data.message + "

      "); } diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css index 33cc6733..de6d436e 100644 --- a/themes/admin_default/css/screen.css +++ b/themes/admin_default/css/screen.css @@ -1034,6 +1034,11 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { float: right; } +#gRenameTagForm input[type="text"].gError { + border: 2px solid red; + background: none; +} + #gRenameTagForm input[type="submit"] { height: 25px; } -- cgit v1.2.3 From 6458b47e3ed3ef31d08080a66781ee53bf0f25ed Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 12:38:59 -0700 Subject: Remove the update code introduced with 9d7d79. In addition, captialize MyISAM correctly. --- modules/search/helpers/search_installer.php | 11 +---------- modules/search/module.info | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index 096f46c7..f3225b4e 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -28,7 +28,7 @@ class search_installer { PRIMARY KEY (`id`), KEY(`item_id`), FULLTEXT INDEX (`data`)) - ENGINE=MYISAM + ENGINE=MyISAM DEFAULT CHARSET=utf8;"); module::set_version("search", 1); } @@ -48,13 +48,4 @@ class search_installer { static function uninstall() { Database::instance()->query("DROP TABLE {search_records}"); } - - static function upgrade($version) { - $db = Database::instance(); - if ($version == 1) { - $db->query("ALTER TABLE {search_records} ENGINE=MYISAM"); - module::set_version("search", 2); - } - } - } diff --git a/modules/search/module.info b/modules/search/module.info index 2f2ebdf1..f417c4fa 100644 --- a/modules/search/module.info +++ b/modules/search/module.info @@ -1,3 +1,3 @@ name = "Search" description = "Allows users to search their Gallery" -version = 2 +version = 1 -- cgit v1.2.3 From 2eeacd2656083739a588738b28d578e616d46c9c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 13:55:11 -0700 Subject: use an implicit cast to convert the translated error message to a string as it is encoded by the json routines and will be treated as an object otherwise --- modules/tag/controllers/admin_tags.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index ced73d65..b42e3748 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -89,7 +89,7 @@ class Admin_Tags_Controller extends Admin_Controller { $new_name = $this->input->post("name"); $new_tag = ORM::factory("tag")->where("name", $new_name)->find(); if ($new_tag->loaded) { - $error_msg = t("There is already a tag with that name")->__toString(); + $error_msg = (string)t("There is already a tag with that name"); $valid = false; } } else { -- cgit v1.2.3 From d050f0a2466fedfe96c3bbc072374d01b17951c5 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 14:04:13 -0700 Subject: Minor style fix: (string) $var, not (string)$var, and move the explicit cast down where it's needed. --- modules/tag/controllers/admin_tags.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index b42e3748..63f7957c 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -89,7 +89,7 @@ class Admin_Tags_Controller extends Admin_Controller { $new_name = $this->input->post("name"); $new_tag = ORM::factory("tag")->where("name", $new_name)->find(); if ($new_tag->loaded) { - $error_msg = (string)t("There is already a tag with that name"); + $error_msg = t("There is already a tag with that name"); $valid = false; } } else { @@ -115,7 +115,7 @@ class Admin_Tags_Controller extends Admin_Controller { } else { print json_encode( array("result" => "error", - "message" => $error_msg)); + "message" => (string) $error_msg)); } } } -- cgit v1.2.3 From 2e23ae98c43ae099a0b7b18f3c65fae21401aa43 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 17 Sep 2009 14:12:43 -0700 Subject: - Add theme->movie_menu() to whitelisted methods. - xss_data checkpoint --- modules/gallery/tests/Xss_Security_Test.php | 3 ++- modules/gallery/tests/xss_data.txt | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index 85624517..16541017 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -144,7 +144,8 @@ class Xss_Security_Test extends Unit_Test_Case { "dynamic_bottom", "dynamic_top", "footer", "head", "header_bottom", "header_top", "page_bottom", "page_top", "photo_blocks", "photo_bottom", "photo_top", "resize_bottom", "resize_top", "sidebar_blocks", "sidebar_bottom", - "sidebar_top", "thumb_bottom", "thumb_info", "thumb_top")) && + "sidebar_top", "thumb_bottom", "thumb_info", "thumb_top", + "movie_menu")) && self::_token_matches("(", $tokens, $token_number + 3)) { $method = $tokens[$token_number + 2][1]; diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 193d2ca1..57da8730 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -295,10 +295,11 @@ themes/admin_default/views/admin.html.php 68 DIRTY $sideb themes/admin_default/views/admin.html.php 73 DIRTY $theme->admin_footer() themes/admin_default/views/admin.html.php 75 DIRTY $theme->admin_credits() themes/admin_default/views/admin.html.php 79 DIRTY $theme->admin_page_bottom() -themes/admin_default/views/block.html.php 2 DIRTY $id -themes/admin_default/views/block.html.php 2 DIRTY_ATTR $css_id -themes/admin_default/views/block.html.php 10 DIRTY $title -themes/admin_default/views/block.html.php 13 DIRTY $content +themes/admin_default/views/block.html.php 3 DIRTY_ATTR $anchor +themes/admin_default/views/block.html.php 5 DIRTY $id +themes/admin_default/views/block.html.php 5 DIRTY_ATTR $css_id +themes/admin_default/views/block.html.php 13 DIRTY $title +themes/admin_default/views/block.html.php 16 DIRTY $content themes/admin_default/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) themes/admin_default/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) themes/admin_default/views/pager.html.php 27 DIRTY $from_to_msg @@ -309,10 +310,10 @@ themes/default/views/album.html.php 16 DIRTY_ATTR $ite themes/default/views/album.html.php 18 DIRTY_JS $child->url() themes/default/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"gThumbnail")) themes/default/views/album.html.php 23 DIRTY_JS $child->url() -themes/default/views/block.html.php 2 DIRTY_ATTR $anchor -themes/default/views/block.html.php 3 DIRTY_ATTR $css_id -themes/default/views/block.html.php 4 DIRTY $title -themes/default/views/block.html.php 6 DIRTY $content +themes/default/views/block.html.php 3 DIRTY_ATTR $anchor +themes/default/views/block.html.php 5 DIRTY_ATTR $css_id +themes/default/views/block.html.php 6 DIRTY $title +themes/default/views/block.html.php 8 DIRTY $content themes/default/views/dynamic.html.php 11 DIRTY_ATTR $child->is_album()?"gAlbum":"" themes/default/views/dynamic.html.php 13 DIRTY_JS $child->url() themes/default/views/dynamic.html.php 14 DIRTY_ATTR $child->id @@ -329,10 +330,10 @@ themes/default/views/page.html.php 42 DIRTY $new_h themes/default/views/page.html.php 43 DIRTY $thumb_proportion themes/default/views/page.html.php 82 DIRTY $header_text themes/default/views/page.html.php 84 DIRTY_JS item::root()->url() -themes/default/views/page.html.php 98 DIRTY_JS $parent->url("show={$theme->item()->id}") -themes/default/views/page.html.php 112 DIRTY $content -themes/default/views/page.html.php 118 DIRTY newView("sidebar.html") -themes/default/views/page.html.php 125 DIRTY $footer_text +themes/default/views/page.html.php 102 DIRTY_JS $parent->url($parent==$theme->item()->parent()?"show={$theme->item()->id}":null) +themes/default/views/page.html.php 117 DIRTY $content +themes/default/views/page.html.php 123 DIRTY newView("sidebar.html") +themes/default/views/page.html.php 130 DIRTY $footer_text themes/default/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) themes/default/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) themes/default/views/pager.html.php 27 DIRTY $from_to_msg -- cgit v1.2.3 From 15c3f0b1aaf43a1b627266d569971b08c11d5835 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 21:26:55 -0700 Subject: Refactor the server add javascript into a ui.gallery_server_add widget. --- modules/server_add/js/server_add.js | 151 +++++++++++++-------- modules/server_add/views/server_add_tree.html.php | 12 +- .../views/server_add_tree_dialog.html.php | 14 +- 3 files changed, 98 insertions(+), 79 deletions(-) diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 4c411715..7daa0adc 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -1,64 +1,97 @@ -/** - * Manage file selection state. - */ -function select_file(li) { - $(li).toggleClass("selected"); - if ($("#gServerAdd span.selected").length) { - $("#gServerAddAddButton").enable(true).removeClass("ui-state-disabled"); - } else { - $("#gServerAddAddButton").enable(false).addClass("ui-state-disabled"); - } -} +(function($) { + $.widget("ui.gallery_server_add", { + _init: function() { + var self = this; + $("#gServerAddAddButton", this.element).click(function(event) { + event.preventDefault(); + $(".gProgressBar", this.element). + progressbar(). + progressbar("value", 0); + $("#gServerAddProgress", this.element).slideDown("fast", function() { self.start_add(); }); + }); + $("#gServerCloseButton", this.element).click(function(event) { + $("#gDialog").dialog("close"); + window.location.reload(); + }); + $("#gServerAddTree span.gDirectory", this.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#gServerAddTree span.gFile, #gServerAddTree span.gDirectory", this.element).click(function(event) { + self.select_file(event); + }); + }, -/** - * Load a new directory - */ -function open_dir(path) { - $.ajax({ - url: GET_CHILDREN_URL.replace("__PATH__", path), - success: function(data, textStatus) { - $("#gServerAddTree").html(data); - } - }); -} + start_add: function() { + var self = this; + var paths = []; + $.each($("span.selected", self.element), function () { + paths.push($(this).attr("ref")); + }); -function start_add() { - var paths = []; - $.each($("#gServerAdd span.selected"), - function () { - paths.push($(this).attr("file")); - } - ); + $.ajax({ + url: START_URL, + type: "POST", + async: false, + data: { "paths[]": paths }, + dataType: "json", + success: function(data, textStatus) { + $("#gStatus").html(data.status); + $(".gProgressBar", self.element).progressbar("value", data.percent_complete); + setTimeout(function() { self.run_add(data.url); }, 25); + } + }); + return false; + }, - $.ajax({ - url: START_URL, - type: "POST", - async: false, - data: { "paths[]": paths }, - dataType: "json", - success: function(data, textStatus) { - $("#gStatus").html(data.status); - $("#gServerAdd .gProgressBar").progressbar("value", data.percent_complete); - setTimeout(function() { run_add(data.url); }, 25); - } - }); - return false; -} + run_add: function (url) { + var self = this; + $.ajax({ + url: url, + async: false, + dataType: "json", + success: function(data, textStatus) { + $("#gStatus").html(data.status); + $(".gProgressBar", self.element).progressbar("value", data.percent_complete); + if (data.done) { + $("#gServerAddProgress", this.element).slideUp(); + } else { + setTimeout(function() { self.run_add(url); }, 25); + } -function run_add(url) { - $.ajax({ - url: url, - async: false, - dataType: "json", - success: function(data, textStatus) { - $("#gStatus").html(data.status); - $("#gServerAdd .gProgressBar").progressbar("value", data.percent_complete); - if (data.done) { - $("#gServerAddProgress").slideUp(); - } else { - setTimeout(function() { run_add(url); }, 25); - } - } - }); -} + } + }); + }, + /** + * Load a new directory + */ + open_dir: function(event) { + var self = this; + var path = $(event.target).attr("ref"); + $.ajax({ + url: GET_CHILDREN_URL.replace("__PATH__", path), + success: function(data, textStatus) { + $("#gServerAddTree", self.element).html(data); + $("#gServerAddTree span.gDirectory", self.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#gServerAddTree span.gFile, #gServerAddTree span.gDirectory", this.element).click(function(event) { + self.select_file(event); + }); + } + }); + }, + + /** + * Manage file selection state. + */ + select_file: function (event) { + $(event.target).toggleClass("selected"); + if ($("#gServerAdd span.selected").length) { + $("#gServerAddAddButton").enable(true).removeClass("ui-state-disabled"); + } else { + $("#gServerAddAddButton").enable(false).addClass("ui-state-disabled"); + } + } + }); +})(jQuery); diff --git a/modules/server_add/views/server_add_tree.html.php b/modules/server_add/views/server_add_tree.html.php index 918fbdc7..4e5bf601 100644 --- a/modules/server_add/views/server_add_tree.html.php +++ b/modules/server_add/views/server_add_tree.html.php @@ -1,7 +1,7 @@
    • - +
        @@ -9,7 +9,7 @@
      • - +
          @@ -18,12 +18,8 @@
        • "> - - ondblclick="open_dir($(this).attr('file'))" - - file="" - > + " + ref="" >
        • diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index dd4efd06..354659bc 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -40,18 +40,8 @@ -- cgit v1.2.3 From be84c7be2557dae92426e64ab44170e8999cfc44 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 18 Sep 2009 12:17:58 -0700 Subject: * Changed the close functionality so the page is reloaded when the dialog is closed. * Renamed the ServerAddCloseButton. * Added Pause and Continue buttons. Now when add is clicked, A Pause button is shown, once the adding is complete, the add button is reshown andpause button is hidden. Clicking the pause button will hide it and show a continue button. --- modules/server_add/js/server_add.js | 40 ++++++++++++++++++---- .../views/server_add_tree_dialog.html.php | 8 ++++- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 7daa0adc..50a8c36b 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -9,7 +9,18 @@ progressbar("value", 0); $("#gServerAddProgress", this.element).slideDown("fast", function() { self.start_add(); }); }); - $("#gServerCloseButton", this.element).click(function(event) { + $("#gServerAddPauseButton", this.element).click(function(event) { + self.pause = true; + $("#gServerAddPauseButton", this.element).hide(); + $("#gServerAddContinueButton", this.element).show(); + }); + $("#gServerAddContinueButton", this.element).click(function(event) { + self.pause = false; + $("#gServerAddPauseButton", this.element).show(); + $("#gServerAddContinueButton", this.element).hide(); + self.run_add(); + }); + $("#gServerAddCloseButton", this.element).click(function(event) { $("#gDialog").dialog("close"); window.location.reload(); }); @@ -19,8 +30,17 @@ $("#gServerAddTree span.gFile, #gServerAddTree span.gDirectory", this.element).click(function(event) { self.select_file(event); }); + $("#gServerAddTree span.gDirectory", this.element).dblclick(function(event) { + self.open_dir(event); + }); + $("#gDialog").bind("dialogclose", function(event, ui) { + window.location.reload(); + }); }, + taskURL: null, + pause: false, + start_add: function() { var self = this; var paths = []; @@ -28,6 +48,9 @@ paths.push($(this).attr("ref")); }); + $("#gServerAddAddButton", this.element).hide(); + $("#gServerAddPauseButton", this.element).show(); + $.ajax({ url: START_URL, type: "POST", @@ -37,16 +60,17 @@ success: function(data, textStatus) { $("#gStatus").html(data.status); $(".gProgressBar", self.element).progressbar("value", data.percent_complete); - setTimeout(function() { self.run_add(data.url); }, 25); + self.taskURL = data.url; + setTimeout(function() { self.run_add(); }, 25); } }); return false; }, - run_add: function (url) { + run_add: function () { var self = this; $.ajax({ - url: url, + url: self.taskURL, async: false, dataType: "json", success: function(data, textStatus) { @@ -54,10 +78,14 @@ $(".gProgressBar", self.element).progressbar("value", data.percent_complete); if (data.done) { $("#gServerAddProgress", this.element).slideUp(); + $("#gServerAddAddButton", this.element).show(); + $("#gServerAddPauseButton", this.element).hide(); + $("#gServerAddContinueButton", this.element).hide(); } else { - setTimeout(function() { self.run_add(url); }, 25); + if (!self.pause) { + setTimeout(function() { self.run_add(); }, 25); + } } - } }); }, diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index 354659bc..fdb66d1c 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -33,8 +33,14 @@ disabled="disabled"> + + - -- cgit v1.2.3 From 4e6f2f1b4c489c21546c2ae685b814c42e689d71 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 18 Sep 2009 23:53:48 -0700 Subject: Don't display the add menu if the underlying operating system directory is not writable. THis should fix ticket #775 --- modules/gallery/helpers/gallery.php | 7 ++++++- modules/server_add/helpers/server_add_event.php | 13 ++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 40e188e2..d5b2fed9 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -89,9 +89,11 @@ class gallery_Core { $item = $theme->item(); $can_edit = $item && access::can("edit", $item); + $is_album_writable = + is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path()); $can_add = $item && access::can("add", $item); - if ($can_add) { + if ($can_add && $is_album_writable) { $menu->append($add_menu = Menu::factory("submenu") ->id("add_menu") ->label(t("Add"))); @@ -105,6 +107,9 @@ class gallery_Core { ->label(t("Add an album")) ->url(url::site("form/add/albums/$item->id?type=album"))); } + } else if (!$is_album_writable) { + message::warning(t("The album '%album_name' is not writable.", + array("album_name" => $item->title))); } $menu->append($options_menu = Menu::factory("submenu") diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index b9dd8c28..28996ee2 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -31,11 +31,14 @@ class server_add_event_Core { $paths = unserialize(module::get_var("server_add", "authorized_paths")); if ($item && user::active()->admin && $item->is_album() && !empty($paths)) { - $menu->get("add_menu") - ->append(Menu::factory("dialog") - ->id("server_add") - ->label(t("Server add")) - ->url(url::site("server_add/browse/$item->id"))); + $add_menu = $menu->get("add_menu"); + if ($add_menu) { + $add_menu + ->append(Menu::factory("dialog") + ->id("server_add") + ->label(t("Server add")) + ->url(url::site("server_add/browse/$item->id"))); + } } } } -- cgit v1.2.3 From cf89015a29f41321e49ea8024cc33bb0d6c68df1 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 19 Sep 2009 09:34:27 -0700 Subject: Change the fix for ticket #775 to always add the Add menu, but not add any items if the album directory is not writable. --- modules/gallery/helpers/gallery.php | 30 +++++++++++++------------ modules/server_add/helpers/server_add_event.php | 16 ++++++------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index d5b2fed9..80ae65bd 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -89,27 +89,29 @@ class gallery_Core { $item = $theme->item(); $can_edit = $item && access::can("edit", $item); - $is_album_writable = - is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path()); $can_add = $item && access::can("add", $item); - if ($can_add && $is_album_writable) { + if ($can_add) { $menu->append($add_menu = Menu::factory("submenu") ->id("add_menu") ->label(t("Add"))); - $add_menu->append(Menu::factory("dialog") - ->id("add_photos_item") - ->label(t("Add photos")) - ->url(url::site("simple_uploader/app/$item->id"))); - if ($item->is_album()) { + $is_album_writable = + is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path()); + if ($is_album_writable) { $add_menu->append(Menu::factory("dialog") - ->id("add_album_item") - ->label(t("Add an album")) - ->url(url::site("form/add/albums/$item->id?type=album"))); + ->id("add_photos_item") + ->label(t("Add photos")) + ->url(url::site("simple_uploader/app/$item->id"))); + if ($item->is_album()) { + $add_menu->append(Menu::factory("dialog") + ->id("add_album_item") + ->label(t("Add an album")) + ->url(url::site("form/add/albums/$item->id?type=album"))); + } + } else { + message::warning(t("The album '%album_name' is not writable.", + array("album_name" => $item->title))); } - } else if (!$is_album_writable) { - message::warning(t("The album '%album_name' is not writable.", - array("album_name" => $item->title))); } $menu->append($options_menu = Menu::factory("submenu") diff --git a/modules/server_add/helpers/server_add_event.php b/modules/server_add/helpers/server_add_event.php index 28996ee2..4db83f74 100644 --- a/modules/server_add/helpers/server_add_event.php +++ b/modules/server_add/helpers/server_add_event.php @@ -30,15 +30,13 @@ class server_add_event_Core { $item = $theme->item(); $paths = unserialize(module::get_var("server_add", "authorized_paths")); - if ($item && user::active()->admin && $item->is_album() && !empty($paths)) { - $add_menu = $menu->get("add_menu"); - if ($add_menu) { - $add_menu - ->append(Menu::factory("dialog") - ->id("server_add") - ->label(t("Server add")) - ->url(url::site("server_add/browse/$item->id"))); - } + if ($item && user::active()->admin && $item->is_album() && !empty($paths) && + is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) { + $menu->get("add_menu") + ->append(Menu::factory("dialog") + ->id("server_add") + ->label(t("Server add")) + ->url(url::site("server_add/browse/$item->id"))); } } } -- cgit v1.2.3 From 09f998e7a5a58720636c7b1140279b5efbdb33c6 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 19 Sep 2009 10:51:27 -0700 Subject: On the edit album form, add dirname and slug asa hidden fields, so that when the edits are being validated on input, the fields are found and can be referenced --- modules/gallery/helpers/album.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index dfb1e66d..9cd746d7 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -135,6 +135,9 @@ class album_Core { ->error_messages( "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); + } else { + $group->hidden("dirname")->value($parent->name); + $group->hidden("slug")->value($parent->slug); } $sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder")) -- cgit v1.2.3 From 62863f5fead46480cf1a3f5a96eb52ce439d0f0e Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sat, 19 Sep 2009 18:55:49 -0600 Subject: Address IE8 hover effect issues. Closes #666. --- themes/default/js/ui.init.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 93dfb275..e645eb71 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -91,12 +91,19 @@ $(document).ready(function() { }, function() { // Reset item height, position, and z-index - var sib_height = $(this).next().height(); + if ($(this).next().height()) { + var sib_height = $(this).next().height(); + } else { + var sib_height = $(this).prev().height(); + } + if ($.browser.msie && $.browser.version >= 8) { + sib_height = sib_height + 1; + } $(this).css("height", sib_height); $(this).css("position", "relative"); $(this).css("top", null); $(this).css("left", null); - $(this).css("z-index", null); + $(this).css("z-index", 1); // Remove the placeholder and hover class from the item $("#gPlaceHolder").remove(); $(this).removeClass("gHoverItem"); -- cgit v1.2.3 From 33690a32bcf132e5ab470ff77ba23c073ac26271 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 21 Sep 2009 13:33:45 -0700 Subject: Change the exif module to respond to the gallery_ready event and check to see if gettext is installed. The 3rd party library used in the exif module expects gettext to be available. Rather than doing all the time use the gallery ready event to only do it when it might be needed. Fixes ticket #672 --- modules/exif/helpers/exif_event.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php index 826ec959..81ac5f44 100644 --- a/modules/exif/helpers/exif_event.php +++ b/modules/exif/helpers/exif_event.php @@ -18,6 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class exif_event_Core { + static function gallery_ready() { + if (!function_exists("gettext")) { + function gettext($message) { + return (string) t($message); + } + } + } + static function item_created($item) { if (!$item->is_album()) { exif::extract($item); -- cgit v1.2.3