Skip to content
This repository
Browse code

Merge remote-tracking branch 'origin/3.0'

  • Loading branch information...
commit 4cc82e906bf9e4f2a94a100684b8d9767c05d232 2 parents e51937f + 47b56d4
Ingo Schommer authored

Showing 32 changed files with 4,100 additions and 4,125 deletions. Show diff stats Hide diff stats

  1. 6  admin/code/LeftAndMain.php
  2. 74  admin/javascript/LeftAndMain.js
  3. 11  admin/thirdparty/chosen/chosen/chosen.jquery.js
  4. 2  admin/thirdparty/chosen/chosen/chosen.jquery.min.js
  5. 8  admin/thirdparty/chosen/chosen/chosen.proto.js
  6. 2  admin/thirdparty/chosen/chosen/chosen.proto.min.js
  7. 2  admin/thirdparty/chosen/coffee/chosen.jquery.coffee
  8. 32  api/RSSFeed.php
  9. 1  css/AssetUploadField.css
  10. 2  css/TreeDropdownField.css
  11. 1  dev/Debug.php
  12. 4  dev/install/install.php5
  13. 4  docs/en/reference/cms-architecture.md
  14. 3  docs/en/topics/javascript.md
  15. 5  forms/GroupedDropdownField.php
  16. 6  forms/HtmlEditorField.php
  17. 8  javascript/TreeDropdownField.js
  18. 1  lang/en.yml
  19. 1  lang/en_GB.yml
  20. 2  model/DataQuery.php
  21. 66  model/Versioned.php
  22. 1  oembed/Oembed.php
  23. 7  scss/AssetUploadField.scss
  24. 1  scss/TreeDropdownField.scss
  25. 14  templates/Includes/HtmlEditorField_viewfile.ss
  26. 19  tests/api/RSSFeedTest.php
  27. 103  tests/model/VersionedTest.php
  28. 2  thirdparty/jquery-entwine/.piston.yml
  29. 2  thirdparty/jquery-entwine/spec/SpecRunner.html
  30. 2  thirdparty/jquery-entwine/spec/spec.entwine.addrem.js
  31. 94  thirdparty/jquery-entwine/src/jquery.entwine.inspector.js
  32. 7,739  thirdparty/jquery-entwine/vendor/{jquery-1.7.2.js → jquery-1.8.0.js}
6  admin/code/LeftAndMain.php
@@ -296,9 +296,9 @@ function init() {
296 296
 		);
297 297
 
298 298
 		// TODO Confuses jQuery.ondemand through document.write()
299  
-		// if (Director::isDev()) {
300  
-			// Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
301  
-		// }
  299
+		if (Director::isDev()) {
  300
+			Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
  301
+		}
302 302
 
303 303
 		Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
304 304
 		Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
74  admin/javascript/LeftAndMain.js
@@ -20,18 +20,38 @@ jQuery.noConflict();
20 20
 		
21 21
 		// apply an select element only when it is ready, ie. when it is rendered into a template
22 22
 		// with css applied and got a width value.
23  
-		var applyChosen = function(el){
24  
-			if(el.outerWidth()){
25  
-				el.chosen({
26  
-					'disable_search_threshold' : 20,
27  
-					'allow_single_deselect': true
28  
-				}).addClass("has-chzn");
29  
-				// Copy over title attribute if required
30  
-				if(el.attr('title')) el.siblings('.chzn-container').attr('title', el.attr('title'));
  23
+		var applyChosen = function(el) {
  24
+			if(el.is(':visible')) {
  25
+				el.addClass('has-chzn').chosen({
  26
+					allow_single_deselect: true,
  27
+					disable_search_threshold: 20
  28
+				});
  29
+
  30
+				var title = el.prop('title')
  31
+
  32
+				if(title) {
  33
+					el.siblings('.chzn-container').prop('title', title);
  34
+				}
31 35
 			} else {
32  
-				setTimeout(function() {applyChosen(el);},500);
  36
+				setTimeout(function() { applyChosen(el); }, 500);
33 37
 			}
34 38
 		};
  39
+
  40
+		/**
  41
+		 * Compare URLs, but normalize trailing slashes in 
  42
+		 * URL to work around routing weirdnesses in SS_HTTPRequest.
  43
+		 * Also normalizes relative URLs by prefixing them with the <base>.
  44
+		 */
  45
+		var isSameUrl = function(url1, url2) {
  46
+			var baseUrl = $('base').attr('href');
  47
+			url1 = $.path.isAbsoluteUrl(url1) ? url1 : $.path.makeUrlAbsolute(url1, baseUrl),
  48
+			url2 = $.path.isAbsoluteUrl(url2) ? url2 : $.path.makeUrlAbsolute(url2, baseUrl);
  49
+			var url1parts = $.path.parseUrl(url1), url2parts = $.path.parseUrl(url2);
  50
+			return (
  51
+				url1parts.pathname.replace(/\/*$/, '') == url2parts.pathname.replace(/\/*$/, '') && 
  52
+				url1parts.search == url2parts.search
  53
+			);
  54
+		};
35 55
 		
36 56
 		$(window).bind('resize', positionLoadingSpinner).trigger('resize');
37 57
 
@@ -39,10 +59,12 @@ jQuery.noConflict();
39 59
 		$(document).ajaxComplete(function(e, xhr, settings) {
40 60
 			// Simulates a redirect on an ajax response.
41 61
 			if(window.History.enabled) {
42  
-				var url = xhr.getResponseHeader('X-ControllerURL'), opts, requestHeaders = settings.headers;
43  
-				// Normalize trailing slashes in URL to work around routing weirdnesses in SS_HTTPRequest.
44  
-				var isSame = (url && History.getPageUrl().replace(/\/+$/, '') == url.replace(/\/+$/, ''));
45  
-				if(url && !isSame) {
  62
+				var url = xhr.getResponseHeader('X-ControllerURL'), 
  63
+					// TODO Replaces trailing slashes added by History after locale (e.g. admin/?locale=en/)
  64
+					origUrl = History.getPageUrl().replace(/\/$/, ''),
  65
+					opts, requestHeaders = settings.headers;
  66
+
  67
+				if(url !== null && !isSameUrl(origUrl, url)) {
46 68
 					opts = {pjax: xhr.getResponseHeader('X-Pjax') ? xhr.getResponseHeader('X-Pjax') : settings.headers['X-Pjax']};
47 69
 					window.History.pushState(opts, '', url);
48 70
 				}
@@ -144,8 +166,9 @@ jQuery.noConflict();
144 166
 			 *  - {String} url
145 167
 			 *  - {String} title New window title
146 168
 			 *  - {Object} data Any additional data passed through to History.pushState()
  169
+			 *  - {boolean} forceReload Forces the replacement of the current history state, even if the URL is the same, i.e. allows reloading.
147 170
 			 */
148  
-			loadPanel: function(url, title, data) {
  171
+			loadPanel: function(url, title, data, forceReload) {
149 172
 				if(!data) data = {};
150 173
 				if(!title) title = "";
151 174
 
@@ -169,13 +192,26 @@ jQuery.noConflict();
169 192
 				if(window.History.enabled) {
170 193
 					// Active menu item is set based on X-Controller ajax header,
171 194
 					// which matches one class on the menu
172  
-					window.History.pushState(data, title, url);
  195
+					if(forceReload) {
  196
+						// Add a parameter to make sure the page gets reloaded even if the URL is the same.
  197
+						$.extend(data, {__forceReload: Math.random()});
  198
+						window.History.replaceState(data, title, url);
  199
+					} else {
  200
+						window.History.pushState(data, title, url);
  201
+					}
173 202
 				} else {
174 203
 					window.location = $.path.makeUrlAbsolute(url, $('base').attr('href'));
175 204
 				}
176 205
 			},
177 206
 
178 207
 			/**
  208
+			 * Nice wrapper for reloading current history state.
  209
+			 */
  210
+			reloadCurrentPanel: function() {
  211
+				this.loadPanel(window.History.getState().url, null, null, true);
  212
+			},
  213
+
  214
+			/**
179 215
 			 * Function: submitForm
180 216
 			 * 
181 217
 			 * Parameters:
@@ -887,11 +923,9 @@ jQuery.noConflict();
887 923
 					ajaxOptions: {
888 924
 						// Overwrite ajax loading to use CMS logic instead
889 925
 						beforeSend: function(xhr, settings) {
890  
-							var makeAbs = $.path.makeUrlAbsolute,
891  
-								baseUrl = $('base').attr('href'),
892  
-								isSame = (makeAbs(settings.url, baseUrl) == makeAbs(document.location.href));
893  
-								
894  
-							if(!isSame) $('.cms-container').loadPanel(settings.url);
  926
+							if(!isSameUrl(document.location.href, settings.url)) {
  927
+								$('.cms-container').loadPanel(settings.url);
  928
+							}
895 929
 							return false;
896 930
 						}
897 931
 					},
11  admin/thirdparty/chosen/chosen/chosen.jquery.js
@@ -14,8 +14,6 @@
14 14
 
15 15
   SelectParser = (function() {
16 16
 
17  
-    SelectParser.name = 'SelectParser';
18  
-
19 17
     function SelectParser() {
20 18
       this.options_index = 0;
21 19
       this.parsed = [];
@@ -109,8 +107,6 @@ Copyright (c) 2011 by Harvest
109 107
 
110 108
   AbstractChosen = (function() {
111 109
 
112  
-    AbstractChosen.name = 'AbstractChosen';
113  
-
114 110
     function AbstractChosen(form_field, options) {
115 111
       this.form_field = form_field;
116 112
       this.options = options != null ? options : {};
@@ -280,7 +276,7 @@ Copyright (c) 2011 by Harvest
280 276
 (function() {
281 277
   var $, Chosen, get_side_border_padding, root,
282 278
     __hasProp = {}.hasOwnProperty,
283  
-    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
  279
+    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
284 280
 
285 281
   root = this;
286 282
 
@@ -305,8 +301,6 @@ Copyright (c) 2011 by Harvest
305 301
 
306 302
     __extends(Chosen, _super);
307 303
 
308  
-    Chosen.name = 'Chosen';
309  
-
310 304
     function Chosen() {
311 305
       return Chosen.__super__.constructor.apply(this, arguments);
312 306
     }
@@ -325,7 +319,6 @@ Copyright (c) 2011 by Harvest
325 319
       this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
326 320
       this.container_id += "_chzn";
327 321
       this.f_width = this.form_field_jq.outerWidth();
328  
-      if (this.f_width==0) this.f_width = this.form_field_jq.css("width");
329 322
       this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
330 323
       container_div = $("<div />", {
331 324
         id: this.container_id,
@@ -348,7 +341,7 @@ Copyright (c) 2011 by Harvest
348 341
 
349 342
       rise = this.rise_up(this.container, this.dropdown);
350 343
       dd_top = rise ? -this.container.find('.chzn-drop').height() : this.container.height();
351  
-      dd_width = this.container.width - get_side_border_padding(this.dropdown);
  344
+      dd_width = this.container.width() - get_side_border_padding(this.dropdown);
352 345
       this.dropdown.css({
353 346
         "width": dd_width + "px",
354 347
         "top": dd_top + "px"
2  admin/thirdparty/chosen/chosen/chosen.jquery.min.js
@@ -9,4 +9,4 @@
9 9
 
10 10
 // based on version 0.9.8, applied a very simple patch that fix percentaage width support on select tag
11 11
 // This file is generated by `cake build`, do not edit it by hand.
12  
-(function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.name="SelectParser",a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a}).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.name="AbstractChosen",a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e={}.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?this.each(function(d){var e;e=a(this);if(!e.hasClass("chzn-done"))return e.data("chosen",new b(this,c))}):this}}),b=function(b){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,b),e.name="Chosen",e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f,g;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+(this.options.width||this.f_width)+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),f=this.rise_up(this.container,this.dropdown),d=f?-this.container.find(".chzn-drop").height():this.container.height(),e=this.container.width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),g=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:g+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a,b,d;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),d=this.rise_up(this.container,this.dropdown),a=d?-this.container.find(".chzn-drop").height():this.is_multiple?this.container.height():this.container.height()-1,b=this.container.width()-c(this.dropdown),this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.css("width",b-c(this.search_container)-c(this.search_field)+"px"),this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o<q;o++){c=s[o];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,i=c.dom_id,h=a("#"+i);if(f.test(c.html))b=!0,j+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p<r;p++)d=e[p],f.test(d)&&(b=!0,j+=1)}b?(k.length?(l=c.html.search(n),m=c.html.substr(0,l+k.length)+"</em>"+c.html.substr(l+k.length),m=m.substr(0,l)+"<em>"+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j,k;if(this.is_multiple){d=0,i=0,g="position:absolute; left: -1000px; top: -1000px; display:none;",h=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(j=0,k=h.length;j<k;j++)f=h[j],g+=f+":"+this.search_field.css(f)+";";return c=a("<div />",{style:g}),c.text(this.search_field.val()),a("body").append(c),i=c.width()+25,c.remove(),i>this.f_width-10&&(i=this.f_width-10),this.search_field.css({width:i+"px"}),e=this.rise_up(this.container,this.dropdown),b=e?-this.container.find(".chzn-drop").height():this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e.prototype.rise_up=function(b,c){var d,e,f,g;return g=b.find("a.chzn-single"),g.length>0?(f=a(window).height()+a(document).scrollTop()-b.find("a").innerHeight(),e=g.offset().top,d=c.innerHeight(),e+d>f&&e-d>0?(b.addClass("chzn-with-rise"),!0):(b.removeClass("chzn-with-rise"),!1)):!1},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this);
  12
+(function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){return!e.browser.msie||e.browser.version!=="6.0"&&e.browser.version!=="7.0"?this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))}):this}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,t=e("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+(this.options.width||this.f_width)+"px;"}),this.is_multiple?t.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):t.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(t),this.container=e("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.rise_up(this.container,this.dropdown),r=s?-this.container.find(".chzn-drop").height():this.container.height(),i=this.container.width()-n(this.dropdown),this.dropdown.css({width:i+"px",top:r+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),o=i-n(this.search_container)-n(this.search_field),this.search_field.css({width:o+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){return e.container_mousedown(t)}),this.container.mouseup(function(t){return e.container_mouseup(t)}),this.container.mouseenter(function(t){return e.mouse_enter(t)}),this.container.mouseleave(function(t){return e.mouse_leave(t)}),this.search_results.mouseup(function(t){return e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){return e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){return e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){return e.results_update_field(t)}),this.search_field.blur(function(t){return e.input_blur(t)}),this.search_field.keyup(function(t){return e.keyup_checker(t)}),this.search_field.keydown(function(t){return e.keydown_checker(t)}),this.is_multiple?(this.search_choices.click(function(t){return e.choices_click(t)}),this.search_field.focus(function(t){return e.input_focus(t)})):this.container.click(function(e){return e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.stopPropagation(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR")return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e,t,r;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),r=this.rise_up(this.container,this.dropdown),e=r?-this.container.find(".chzn-drop").height():this.is_multiple?this.container.height():this.container.height()-1,t=this.container.width()-n(this.dropdown),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.css("width",t-n(this.search_container)-n(this.search_field)+"px"),this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",t):(this.selected_item.attr("tabindex",t),this.search_field.attr("tabindex",-1))},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t)},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i=this;return n=this.container_id+"_c_"+t.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>'),r=e("#"+n).find("a").first(),r.click(function(e){return i.choice_destroy_link_click(e)})},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(e.attr("rel")),e.parents("li").first().remove()},i.prototype.results_reset=function(t){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),e(t.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f,l;if(this.is_multiple){r=0,a=0,o="position:absolute; left: -1000px; top: -1000px; display:none;",u=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(f=0,l=u.length;f<l;f++)s=u[f],o+=s+":"+this.search_field.css(s)+";";return n=e("<div />",{style:o}),n.text(this.search_field.val()),e("body").append(n),a=n.width()+25,n.remove(),a>this.f_width-10&&(a=this.f_width-10),this.search_field.css({width:a+"px"}),i=this.rise_up(this.container,this.dropdown),t=i?-this.container.find(".chzn-drop").height():this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i.prototype.rise_up=function(t,n){var r,i,s,o;return o=t.find("a.chzn-single"),o.length>0?(s=e(window).height()+e(document).scrollTop()-t.find("a").innerHeight(),i=o.offset().top,r=n.innerHeight(),i+r>s&&i-r>0?(t.addClass("chzn-with-rise"),!0):(t.removeClass("chzn-with-rise"),!1)):!1},i}(AbstractChosen),n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
8  admin/thirdparty/chosen/chosen/chosen.proto.js
@@ -14,8 +14,6 @@
14 14
 
15 15
   SelectParser = (function() {
16 16
 
17  
-    SelectParser.name = 'SelectParser';
18  
-
19 17
     function SelectParser() {
20 18
       this.options_index = 0;
21 19
       this.parsed = [];
@@ -109,8 +107,6 @@ Copyright (c) 2011 by Harvest
109 107
 
110 108
   AbstractChosen = (function() {
111 109
 
112  
-    AbstractChosen.name = 'AbstractChosen';
113  
-
114 110
     function AbstractChosen(form_field, options) {
115 111
       this.form_field = form_field;
116 112
       this.options = options != null ? options : {};
@@ -280,7 +276,7 @@ Copyright (c) 2011 by Harvest
280 276
 (function() {
281 277
   var Chosen, get_side_border_padding, root,
282 278
     __hasProp = {}.hasOwnProperty,
283  
-    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
  279
+    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
284 280
 
285 281
   root = this;
286 282
 
@@ -288,8 +284,6 @@ Copyright (c) 2011 by Harvest
288 284
 
289 285
     __extends(Chosen, _super);
290 286
 
291  
-    Chosen.name = 'Chosen';
292  
-
293 287
     function Chosen() {
294 288
       return Chosen.__super__.constructor.apply(this, arguments);
295 289
     }
2  admin/thirdparty/chosen/chosen/chosen.proto.min.js
@@ -9,4 +9,4 @@
9 9
 
10 10
 // based on version 0.9.8, applied a very simple patch that fix percentaage width support on select tag
11 11
 // This file is generated by `cake build`, do not edit it by hand.
12  
-(function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.name="SelectParser",a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a}).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.name="AbstractChosen",a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d={}.hasOwnProperty,e=function(a,b){function e(){this.constructor=a}for(var c in b)d.call(b,c)&&(a[c]=b[c]);return e.prototype=b.prototype,a.prototype=new e,a.__super__=b.prototype,a};c=this,a=function(a){function d(){return d.__super__.constructor.apply(this,arguments)}return e(d,a),d.name="Chosen",d.prototype.setup=function(){return this.is_rtl=this.form_field.hasClassName("chzn-rtl")},d.prototype.finish_setup=function(){return this.form_field.addClassName("chzn-done")},d.prototype.set_default_values=function(){return d.__super__.set_default_values.call(this),this.single_temp=new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.multi_temp=new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'),this.choice_temp=new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},d.prototype.set_up_html=function(){var a,c,d,e,f;return this.container_id=this.form_field.identify().replace(/(:|\.)/g,"_")+"_chzn",this.f_width=this.form_field.getStyle("width")?parseInt(this.form_field.getStyle("width"),10):this.form_field.getWidth(),c={id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px"},this.default_text=this.form_field.readAttribute("data-placeholder")?this.form_field.readAttribute("data-placeholder"):this.default_text_default,a=this.is_multiple?(new Element("div",c)).update(this.multi_temp.evaluate({"default":this.default_text})):(new Element("div",c)).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:a}),this.container=$(this.container_id),this.container.addClassName("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.down("div.chzn-drop"),d=this.container.getHeight(),e=this.f_width-b(this.dropdown),this.dropdown.setStyle({width:e+"px",top:d+"px"}),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chzn-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chzn-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chzn-search"),this.selected_item=this.container.down(".chzn-single"),f=e-b(this.search_container)-b(this.search_field),this.search_field.setStyle({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field.fire("liszt:ready",{chosen:this})},d.prototype.register_observers=function(){var a=this;return this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.form_field.observe("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.observe("click",function(b){return a.choices_click(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)})):this.container.observe("click",function(a){return a.preventDefault()})},d.prototype.search_field_disabled=function(){this.is_disabled=this.form_field.disabled;if(this.is_disabled)return this.container.addClassName("chzn-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field();this.container.removeClassName("chzn-disabled"),this.search_field.disabled=!1;if(!this.is_multiple)return this.selected_item.observe("focus",this.activate_action)},d.prototype.container_mousedown=function(a){var b;if(!this.is_disabled)return b=a!=null?a.target.hasClassName("search-choice-close"):!1,a&&a.type==="mousedown"&&!this.results_showing&&a.stop(),!this.pending_destroy_click&&!b?(this.active_field?!this.is_multiple&&a&&(a.target===this.selected_item||a.target.up("a.chzn-single"))&&this.results_toggle():(this.is_multiple&&this.search_field.clear(),document.observe("click",this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},d.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},d.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClassName("chzn-container-active"))return this.close_field()},d.prototype.close_field=function(){return document.stopObserving("click",this.click_test_action),this.is_multiple||(this.selected_item.tabIndex=this.search_field.tabIndex,this.search_field.tabIndex=-1),this.active_field=!1,this.results_hide(),this.container.removeClassName("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},d.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.tabIndex=this.selected_item.tabIndex,this.selected_item.tabIndex=-1),this.container.addClassName("chzn-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},d.prototype.test_active_click=function(a){return a.target.up("#"+this.container_id)?this.active_field=!0:this.close_field()},d.prototype.results_build=function(){var a,b,d,e,f;this.parsing=!0,this.results_data=c.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.select("li.search-choice").invoke("remove"),this.choices=0):this.is_multiple||(this.selected_item.down("span").update(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClassName("chzn-container-single-nosearch"):this.container.removeClassName("chzn-container-single-nosearch")),a="",f=this.results_data;for(d=0,e=f.length;d<e;d++)b=f[d],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClassName("chzn-default").down("span").update(b.html),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.update(a),this.parsing=!1},d.prototype.result_add_group=function(a){return a.disabled?"":(a.dom_id=this.container_id+"_g_"+a.array_index,'<li id="'+a.dom_id+'" class="group-result">'+a.label.escapeHTML()+"</li>")},d.prototype.result_do_highlight=function(a){var b,c,d,e,f;this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight();if(b>=e)return this.search_results.scrollTop=b-d>0?b-d:0;if(c<f)return this.search_results.scrollTop=c},d.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},d.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClassName("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.getHeight():this.container.getHeight()-1,this.dropdown.setStyle({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results()},d.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClassName("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.setStyle({left:"-9000px"}),this.results_showing=!1},d.prototype.set_tab_index=function(a){var b;if(this.form_field.tabIndex)return b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.is_multiple?this.search_field.tabIndex=b:(this.selected_item.tabIndex=b,this.search_field.tabIndex=-1)},d.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},d.prototype.search_results_mouseup=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_highlight=b,this.result_select(a)},d.prototype.search_results_mouseover=function(a){var b;b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result");if(b)return this.result_do_highlight(b)},d.prototype.search_results_mouseout=function(a){if(a.target.hasClassName("active-result")||a.target.up(".active-result"))return this.result_clear_highlight()},d.prototype.choices_click=function(a){a.preventDefault();if(this.active_field&&!a.target.hasClassName("search-choice")&&!a.target.up(".search-choice")&&!this.results_showing)return this.results_show()},d.prototype.choice_build=function(a){var b,c,d=this;return b=this.container_id+"_c_"+a.array_index,this.choices+=1,this.search_container.insert({before:this.choice_temp.evaluate({id:b,choice:a.html,position:a.array_index})}),c=$(b).down("a"),c.observe("click",function(a){return d.choice_destroy_link_click(a)})},d.prototype.choice_destroy_link_click=function(a){a.preventDefault();if(!this.is_disabled)return this.pending_destroy_click=!0,this.choice_destroy(a.target)},d.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.value.length<1&&this.results_hide(),this.result_deselect(a.readAttribute("rel")),a.up("li").remove()},d.prototype.results_reset=function(a){this.form_field.options[0].selected=!0,this.selected_item.down("span").update(this.default_text),this.is_multiple||this.selected_item.addClassName("chzn-default"),this.show_search_field_default(),a.target.remove(),typeof Event.simulate=="function"&&this.form_field.simulate("change");if(this.active_field)return this.results_hide()},d.prototype.result_select=function(a){var b,c,d;if(this.result_highlight)return b=this.result_highlight,this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.descendants(".result-selected").invoke("removeClassName","result-selected"),this.selected_item.removeClassName("chzn-default"),this.result_single_selected=b),b.addClassName("result-selected"),d=b.id.substr(b.id.lastIndexOf("_")+1),c=this.results_data[d],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.is_multiple?this.choice_build(c):(this.selected_item.down("span").update(c.html),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.value="",typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.result_activate=function(a){return a.addClassName("active-result")},d.prototype.result_deactivate=function(a){return a.removeClassName("active-result")},d.prototype.result_deselect=function(a){var b,c;return c=this.results_data[a],c.selected=!1,this.form_field.options[c.options_index].selected=!1,b=$(this.container_id+"_o_"+a),b.removeClassName("result-selected").addClassName("active-result").show(),this.result_clear_highlight(),this.winnow_results(),typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},d.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&!this.selected_item.down("abbr"))return this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'})},d.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;this.no_results_clear(),h=0,i=this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML(),f=this.search_contains?"":"^",e=new RegExp(f+i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),l=new RegExp(i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),q=this.results_data;for(m=0,o=q.length;m<o;m++){b=q[m];if(!b.disabled&&!b.empty)if(b.group)$(b.dom_id).hide();else if(!this.is_multiple||!b.selected){a=!1,g=b.dom_id;if(e.test(b.html))a=!0,h+=1;else if(b.html.indexOf(" ")>=0||b.html.indexOf("[")===0){d=b.html.replace(/\[|\]/g,"").split(" ");if(d.length)for(n=0,p=d.length;n<p;n++)c=d[n],e.test(c)&&(a=!0,h+=1)}a?(i.length?(j=b.html.search(l),k=b.html.substr(0,j+i.length)+"</em>"+b.html.substr(j+i.length),k=k.substr(0,j)+"<em>"+k.substr(j)):k=b.html,$(g).innerHTML!==k&&$(g).update(k),this.result_activate($(g)),b.group_array_index!=null&&$(this.results_data[b.group_array_index].dom_id).setStyle({display:"list-item"})):($(g)===this.result_highlight&&this.result_clear_highlight(),this.result_deactivate($(g)))}}return h<1&&i.length?this.no_results(i):this.winnow_results_set_highlight()},d.prototype.winnow_results_clear=function(){var a,b,c,d,e;this.search_field.clear(),b=this.search_results.select("li"),e=[];for(c=0,d=b.length;c<d;c++)a=b[c],a.hasClassName("group-result")?e.push(a.show()):!this.is_multiple||!a.hasClassName("result-selected")?e.push(this.result_activate(a)):e.push(void 0);return e},d.prototype.winnow_results_set_highlight=function(){var a;if(!this.result_highlight){this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),a==null&&(a=this.search_results.down(".active-result"));if(a!=null)return this.result_do_highlight(a)}},d.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a}))},d.prototype.no_results_clear=function(){var a,b;a=null,b=[];while(a=this.search_results.down(".no-results"))b.push(a.remove());return b},d.prototype.keydown_arrow=function(){var a,b,c;a=this.search_results.select("li.active-result");if(a.length){this.result_highlight?this.results_showing&&(c=this.result_highlight.nextSiblings(),b=c.intersect(a),b.length&&this.result_do_highlight(b.first())):this.result_do_highlight(a.first());if(!this.results_showing)return this.results_show()}},d.prototype.keyup_arrow=function(){var a,b,c;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},d.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClassName("search-choice-focus"))},d.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},d.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},d.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(h=0,i=f.length;h<i;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return b=(new Element("div",{style:e})).update(this.search_field.value.escapeHTML()),document.body.appendChild(b),g=Element.measure(b,"width")+25,b.remove(),g>this.f_width-10&&(g=this.f_width-10),this.search_field.setStyle({width:g+"px"}),a=this.container.getHeight(),this.dropdown.setStyle({top:a+"px"})}},d}(AbstractChosen),c.Chosen=a,Prototype.Browser.IE&&/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(Prototype.BrowserFeatures.Version=new Number(RegExp.$1)),b=function(a){var b,c;return b=new Element.Layout(a),c=b.get("border-left")+b.get("border-right")+b.get("padding-left")+b.get("padding-right")},c.get_side_border_padding=b}.call(this);
  12
+(function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r={}.hasOwnProperty,i=function(e,t){function i(){this.constructor=e}for(var n in t)r.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e};n=this,e=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return i(r,e),r.prototype.setup=function(){return this.is_rtl=this.form_field.hasClassName("chzn-rtl")},r.prototype.finish_setup=function(){return this.form_field.addClassName("chzn-done")},r.prototype.set_default_values=function(){return r.__super__.set_default_values.call(this),this.single_temp=new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.multi_temp=new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'),this.choice_temp=new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},r.prototype.set_up_html=function(){var e,n,r,i,s;return this.container_id=this.form_field.identify().replace(/(:|\.)/g,"_")+"_chzn",this.f_width=this.form_field.getStyle("width")?parseInt(this.form_field.getStyle("width"),10):this.form_field.getWidth(),n={id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px"},this.default_text=this.form_field.readAttribute("data-placeholder")?this.form_field.readAttribute("data-placeholder"):this.default_text_default,e=this.is_multiple?(new Element("div",n)).update(this.multi_temp.evaluate({"default":this.default_text})):(new Element("div",n)).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:e}),this.container=$(this.container_id),this.container.addClassName("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.down("div.chzn-drop"),r=this.container.getHeight(),i=this.f_width-t(this.dropdown),this.dropdown.setStyle({width:i+"px",top:r+"px"}),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chzn-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chzn-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chzn-search"),this.selected_item=this.container.down(".chzn-single"),s=i-t(this.search_container)-t(this.search_field),this.search_field.setStyle({width:s+"px"})),this.results_build(),this.set_tab_index(),this.form_field.fire("liszt:ready",{chosen:this})},r.prototype.register_observers=function(){var e=this;return this.container.observe("mousedown",function(t){return e.container_mousedown(t)}),this.container.observe("mouseup",function(t){return e.container_mouseup(t)}),this.container.observe("mouseenter",function(t){return e.mouse_enter(t)}),this.container.observe("mouseleave",function(t){return e.mouse_leave(t)}),this.search_results.observe("mouseup",function(t){return e.search_results_mouseup(t)}),this.search_results.observe("mouseover",function(t){return e.search_results_mouseover(t)}),this.search_results.observe("mouseout",function(t){return e.search_results_mouseout(t)}),this.form_field.observe("liszt:updated",function(t){return e.results_update_field(t)}),this.search_field.observe("blur",function(t){return e.input_blur(t)}),this.search_field.observe("keyup",function(t){return e.keyup_checker(t)}),this.search_field.observe("keydown",function(t){return e.keydown_checker(t)}),this.is_multiple?(this.search_choices.observe("click",function(t){return e.choices_click(t)}),this.search_field.observe("focus",function(t){return e.input_focus(t)})):this.container.observe("click",function(e){return e.preventDefault()})},r.prototype.search_field_disabled=function(){this.is_disabled=this.form_field.disabled;if(this.is_disabled)return this.container.addClassName("chzn-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field();this.container.removeClassName("chzn-disabled"),this.search_field.disabled=!1;if(!this.is_multiple)return this.selected_item.observe("focus",this.activate_action)},r.prototype.container_mousedown=function(e){var t;if(!this.is_disabled)return t=e!=null?e.target.hasClassName("search-choice-close"):!1,e&&e.type==="mousedown"&&!this.results_showing&&e.stop(),!this.pending_destroy_click&&!t?(this.active_field?!this.is_multiple&&e&&(e.target===this.selected_item||e.target.up("a.chzn-single"))&&this.results_toggle():(this.is_multiple&&this.search_field.clear(),document.observe("click",this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},r.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR")return this.results_reset(e)},r.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClassName("chzn-container-active"))return this.close_field()},r.prototype.close_field=function(){return document.stopObserving("click",this.click_test_action),this.is_multiple||(this.selected_item.tabIndex=this.search_field.tabIndex,this.search_field.tabIndex=-1),this.active_field=!1,this.results_hide(),this.container.removeClassName("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},r.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.tabIndex=this.selected_item.tabIndex,this.selected_item.tabIndex=-1),this.container.addClassName("chzn-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},r.prototype.test_active_click=function(e){return e.target.up("#"+this.container_id)?this.active_field=!0:this.close_field()},r.prototype.results_build=function(){var e,t,r,i,s;this.parsing=!0,this.results_data=n.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.select("li.search-choice").invoke("remove"),this.choices=0):this.is_multiple||(this.selected_item.down("span").update(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClassName("chzn-container-single-nosearch"):this.container.removeClassName("chzn-container-single-nosearch")),e="",s=this.results_data;for(r=0,i=s.length;r<i;r++)t=s[r],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClassName("chzn-default").down("span").update(t.html),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.update(e),this.parsing=!1},r.prototype.result_add_group=function(e){return e.disabled?"":(e.dom_id=this.container_id+"_g_"+e.array_index,'<li id="'+e.dom_id+'" class="group-result">'+e.label.escapeHTML()+"</li>")},r.prototype.result_do_highlight=function(e){var t,n,r,i,s;this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClassName("highlighted"),r=parseInt(this.search_results.getStyle("maxHeight"),10),s=this.search_results.scrollTop,i=r+s,n=this.result_highlight.positionedOffset().top,t=n+this.result_highlight.getHeight();if(t>=i)return this.search_results.scrollTop=t-r>0?t-r:0;if(n<s)return this.search_results.scrollTop=n},r.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},r.prototype.results_show=function(){var e;return this.is_multiple||(this.selected_item.addClassName("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),e=this.is_multiple?this.container.getHeight():this.container.getHeight()-1,this.dropdown.setStyle({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results()},r.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClassName("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.setStyle({left:"-9000px"}),this.results_showing=!1},r.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.is_multiple?this.search_field.tabIndex=t:(this.selected_item.tabIndex=t,this.search_field.tabIndex=-1)},r.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},r.prototype.search_results_mouseup=function(e){var t;t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result");if(t)return this.result_highlight=t,this.result_select(e)},r.prototype.search_results_mouseover=function(e){var t;t=e.target.hasClassName("active-result")?e.target:e.target.up(".active-result");if(t)return this.result_do_highlight(t)},r.prototype.search_results_mouseout=function(e){if(e.target.hasClassName("active-result")||e.target.up(".active-result"))return this.result_clear_highlight()},r.prototype.choices_click=function(e){e.preventDefault();if(this.active_field&&!e.target.hasClassName("search-choice")&&!e.target.up(".search-choice")&&!this.results_showing)return this.results_show()},r.prototype.choice_build=function(e){var t,n,r=this;return t=this.container_id+"_c_"+e.array_index,this.choices+=1,this.search_container.insert({before:this.choice_temp.evaluate({id:t,choice:e.html,position:e.array_index})}),n=$(t).down("a"),n.observe("click",function(e){return r.choice_destroy_link_click(e)})},r.prototype.choice_destroy_link_click=function(e){e.preventDefault();if(!this.is_disabled)return this.pending_destroy_click=!0,this.choice_destroy(e.target)},r.prototype.choice_destroy=function(e){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.value.length<1&&this.results_hide(),this.result_deselect(e.readAttribute("rel")),e.up("li").remove()},r.prototype.results_reset=function(e){this.form_field.options[0].selected=!0,this.selected_item.down("span").update(this.default_text),this.is_multiple||this.selected_item.addClassName("chzn-default"),this.show_search_field_default(),e.target.remove(),typeof Event.simulate=="function"&&this.form_field.simulate("change");if(this.active_field)return this.results_hide()},r.prototype.result_select=function(e){var t,n,r;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.descendants(".result-selected").invoke("removeClassName","result-selected"),this.selected_item.removeClassName("chzn-default"),this.result_single_selected=t),t.addClassName("result-selected"),r=t.id.substr(t.id.lastIndexOf("_")+1),n=this.results_data[r],n.selected=!0,this.form_field.options[n.options_index].selected=!0,this.is_multiple?this.choice_build(n):(this.selected_item.down("span").update(n.html),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.value="",typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},r.prototype.result_activate=function(e){return e.addClassName("active-result")},r.prototype.result_deactivate=function(e){return e.removeClassName("active-result")},r.prototype.result_deselect=function(e){var t,n;return n=this.results_data[e],n.selected=!1,this.form_field.options[n.options_index].selected=!1,t=$(this.container_id+"_o_"+e),t.removeClassName("result-selected").addClassName("active-result").show(),this.result_clear_highlight(),this.winnow_results(),typeof Event.simulate=="function"&&this.form_field.simulate("change"),this.search_field_scale()},r.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&!this.selected_item.down("abbr"))return this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'})},r.prototype.winnow_results=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m;this.no_results_clear(),u=0,a=this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML(),s=this.search_contains?"":"^",i=new RegExp(s+a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),c=new RegExp(a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=this.results_data;for(h=0,d=m.length;h<d;h++){t=m[h];if(!t.disabled&&!t.empty)if(t.group)$(t.dom_id).hide();else if(!this.is_multiple||!t.selected){e=!1,o=t.dom_id;if(i.test(t.html))e=!0,u+=1;else if(t.html.indexOf(" ")>=0||t.html.indexOf("[")===0){r=t.html.replace(/\[|\]/g,"").split(" ");if(r.length)for(p=0,v=r.length;p<v;p++)n=r[p],i.test(n)&&(e=!0,u+=1)}e?(a.length?(f=t.html.search(c),l=t.html.substr(0,f+a.length)+"</em>"+t.html.substr(f+a.length),l=l.substr(0,f)+"<em>"+l.substr(f)):l=t.html,$(o).innerHTML!==l&&$(o).update(l),this.result_activate($(o)),t.group_array_index!=null&&$(this.results_data[t.group_array_index].dom_id).setStyle({display:"list-item"})):($(o)===this.result_highlight&&this.result_clear_highlight(),this.result_deactivate($(o)))}}return u<1&&a.length?this.no_results(a):this.winnow_results_set_highlight()},r.prototype.winnow_results_clear=function(){var e,t,n,r,i;this.search_field.clear(),t=this.search_results.select("li"),i=[];for(n=0,r=t.length;n<r;n++)e=t[n],e.hasClassName("group-result")?i.push(e.show()):!this.is_multiple||!e.hasClassName("result-selected")?i.push(this.result_activate(e)):i.push(void 0);return i},r.prototype.winnow_results_set_highlight=function(){var e;if(!this.result_highlight){this.is_multiple||(e=this.search_results.down(".result-selected.active-result")),e==null&&(e=this.search_results.down(".active-result"));if(e!=null)return this.result_do_highlight(e)}},r.prototype.no_results=function(e){return this.search_results.insert(this.no_results_temp.evaluate({terms:e}))},r.prototype.no_results_clear=function(){var e,t;e=null,t=[];while(e=this.search_results.down(".no-results"))t.push(e.remove());return t},r.prototype.keydown_arrow=function(){var e,t,n;e=this.search_results.select("li.active-result");if(e.length){this.result_highlight?this.results_showing&&(n=this.result_highlight.nextSiblings(),t=n.intersect(e),t.length&&this.result_do_highlight(t.first())):this.result_do_highlight(e.first());if(!this.results_showing)return this.results_show()}},r.prototype.keyup_arrow=function(){var e,t,n;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return n=this.result_highlight.previousSiblings(),e=this.search_results.select("li.active-result"),t=n.intersect(e),t.length?this.result_do_highlight(t.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},r.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClassName("search-choice-focus"))},r.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},r.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},r.prototype.search_field_scale=function(){var e,t,n,r,i,s,o,u,a;if(this.is_multiple){n=0,o=0,i="position:absolute; left: -1000px; top: -1000px; display:none;",s=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(u=0,a=s.length;u<a;u++)r=s[u],i+=r+":"+this.search_field.getStyle(r)+";";return t=(new Element("div",{style:i})).update(this.search_field.value.escapeHTML()),document.body.appendChild(t),o=Element.measure(t,"width")+25,t.remove(),o>this.f_width-10&&(o=this.f_width-10),this.search_field.setStyle({width:o+"px"}),e=this.container.getHeight(),this.dropdown.setStyle({top:e+"px"})}},r}(AbstractChosen),n.Chosen=e,Prototype.Browser.IE&&/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(Prototype.BrowserFeatures.Version=new Number(RegExp.$1)),t=function(e){var t,n;return t=new Element.Layout(e),n=t.get("border-left")+t.get("border-right")+t.get("padding-left")+t.get("padding-right")},n.get_side_border_padding=t}.call(this);
2  admin/thirdparty/chosen/coffee/chosen.jquery.coffee
@@ -60,7 +60,7 @@ class Chosen extends AbstractChosen
60 60
     dd_top = if rise then -this.container.find('.chzn-drop').height() else @container.height()
61 61
 
62 62
     #patch applied: https://github.com/harvesthq/chosen/issues/300
63  
-    dd_width = (@container.width - get_side_border_padding(@dropdown))
  63
+    dd_width = (@container.width() - get_side_border_padding(@dropdown))
64 64
     
65 65
     @dropdown.css({"width": dd_width  + "px", "top": dd_top + "px"})
66 66
 
32  api/RSSFeed.php
@@ -144,6 +144,7 @@ static function linkToFeed($url, $title = null) {
144 144
 	 */
145 145
 	function Entries() {
146 146
 		$output = new ArrayList();
  147
+
147 148
 		if(isset($this->entries)) {
148 149
 			foreach($this->entries as $entry) {
149 150
 				$output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField));
@@ -183,7 +184,10 @@ function Description() {
183 184
 	/**
184 185
 	 * Output the feed to the browser
185 186
 	 */
186  
-	function outputToBrowser() {
  187
+	public function outputToBrowser() {
  188
+		$prevState = SSViewer::get_source_file_comments();
  189
+		SSViewer::set_source_file_comments(false);
  190
+
187 191
 		if(is_int($this->lastModified)) {
188 192
 			HTTP::register_modification_timestamp($this->lastModified);
189 193
 			header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT');
@@ -192,26 +196,14 @@ function outputToBrowser() {
192 196
 			HTTP::register_etag($this->etag);
193 197
 		}
194 198
 
195  
-		$body = $this->feedContent();
196  
-		HTTP::add_cache_headers();
197  
-		header("Content-type: text/xml");
198  
-		echo $body;
199  
-	}
200  
-	
201  
-	/**
202  
-	 * Return the content of the RSS feed.
203  
-	 * 
204  
-	 * Also temporarily disabled source file comments, and restores
205  
-	 * to previous state once content has been rendered.
206  
-	 * 
207  
-	 * @return string
208  
-	 */
209  
-	function feedContent() {
210  
-		$prevState = SSViewer::get_source_file_comments();
211  
-		SSViewer::set_source_file_comments(false);
212  
-		$content = str_replace('&nbsp;', '&#160;', $this->renderWith($this->getTemplate()));
  199
+		if(!headers_sent()) {
  200
+			HTTP::add_cache_headers();
  201
+			header("Content-type: text/xml");
  202
+		}
  203
+
213 204
 		SSViewer::set_source_file_comments($prevState);
214  
-		return $content;
  205
+
  206
+		return $this->renderWith($this->getTemplate());
215 207
 	}
216 208
 
217 209
 	/**
1  css/AssetUploadField.css
@@ -22,6 +22,7 @@ body.cms.ss-uploadfield-edit-iframe .fieldholder-small label, .composite.ss-asse
22 22
 .ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-preview { position: absolute; height: 30px; width: 40px; overflow: hidden; z-index: 1; }
23 23
 .ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-preview .no-preview { display: block; height: 100%; width: 100%; background: url("../images/icons/document.png") 2px 0px no-repeat; }
24 24
 .ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item-info { position: relative; height: 30px; overflow: hidden; background-color: #5db4df; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5db4df), color-stop(8%, #5db1dd), color-stop(50%, #439bcb), color-stop(54%, #3f99cd), color-stop(96%, #207db6), color-stop(100%, #1e7cba)); background-image: -webkit-linear-gradient(top, #5db4df 0%, #5db1dd 8%, #439bcb 50%, #3f99cd 54%, #207db6 96%, #1e7cba 100%); background-image: -moz-linear-gradient(top, #5db4df 0%, #5db1dd 8%, #439bcb 50%, #3f99cd 54%, #207db6 96%, #1e7cba 100%); background-image: -o-linear-gradient(top, #5db4df 0%, #5db1dd 8%, #439bcb 50%, #3f99cd 54%, #207db6 96%, #1e7cba 100%); background-image: -ms-linear-gradient(top, #5db4df 0%, #5db1dd 8%, #439bcb 50%, #3f99cd 54%, #207db6 96%, #1e7cba 100%); background-image: linear-gradient(top, #5db4df 0%, #5db1dd 8%, #439bcb 50%, #3f99cd 54%, #207db6 96%, #1e7cba 100%); }
  25
+.ss-assetuploadfield .ss-uploadfield-files .ss-uploadfield-item .info { position: relative; padding: 7px; overflow: hidden; background-color: #FFBE66; border: 1px solid #FF9300; }
25 26
 .ss-assetuploadfield .ss-uploadfield-files .ui-state-error .ss-uploadfield-item-info { background-color: #c11f1d; padding-right: 130px; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #c11f1d), color-stop(4%, #bf1d1b), color-stop(8%, #b71b1c), color-stop(15%, #b61e1d), color-stop(27%, #b11d1d), color-stop(31%, #ab1d1c), color-stop(42%, #a51b1b), color-stop(46%, #9f1b19), color-stop(50%, #9f1b19), color-stop(54%, #991c1a), color-stop(58%, #971a18), color-stop(62%, #911b1b), color-stop(65%, #911b1b), color-stop(88%, #7e1816), color-stop(92%, #771919), color-stop(100%, #731817)); background-image: -webkit-linear-gradient(top, #c11f1d 0%, #bf1d1b 4%, #b71b1c 8%, #b61e1d 15%, #b11d1d 27%, #ab1d1c 31%, #a51b1b 42%, #9f1b19 46%, #9f1b19 50%, #991c1a 54%, #971a18 58%, #911b1b 62%, #911b1b 65%, #7e1816 88%, #771919 92%, #731817 100%); background-image: -moz-linear-gradient(top, #c11f1d 0%, #bf1d1b 4%, #b71b1c 8%, #b61e1d 15%, #b11d1d 27%, #ab1d1c 31%, #a51b1b 42%, #9f1b19 46%, #9f1b19 50%, #991c1a 54%, #971a18 58%, #911b1b 62%, #911b1b 65%, #7e1816 88%, #771919 92%, #731817 100%); background-image: -o-linear-gradient(top, #c11f1d 0%, #bf1d1b 4%, #b71b1c 8%, #b61e1d 15%, #b11d1d 27%, #ab1d1c 31%, #a51b1b 42%, #9f1b19 46%, #9f1b19 50%, #991c1a 54%, #971a18 58%, #911b1b 62%, #911b1b 65%, #7e1816 88%, #771919 92%, #731817 100%); background-image: -ms-linear-gradient(top, #c11f1d 0%, #bf1d1b 4%, #b71b1c 8%, #b61e1d 15%, #b11d1d 27%, #ab1d1c 31%, #a51b1b 42%, #9f1b19 46%, #9f1b19 50%, #991c1a 54%, #971a18 58%, #911b1b 62%, #911b1b 65%, #7e1816 88%, #771919 92%, #731817 100%); background-image: linear-gradient(top, #c11f1d 0%, #bf1d1b 4%, #b71b1c 8%, #b61e1d 15%, #b11d1d 27%, #ab1d1c 31%, #a51b1b 42%, #9f1b19 46%, #9f1b19 50%, #991c1a 54%, #971a18 58%, #911b1b 62%, #911b1b 65%, #7e1816 88%, #771919 92%, #731817 100%); }
26 27
 .ss-assetuploadfield .ss-uploadfield-files .ui-state-error .ss-uploadfield-item-info .ss-uploadfield-item-name { width: 100%; cursor: default; background: #bcb9b9; background: rgba(201, 198, 198, 0.9); }
27 28
 .ss-assetuploadfield .ss-uploadfield-files .ui-state-error .ss-uploadfield-item-info .ss-uploadfield-item-name .name { text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.7); }
2  css/TreeDropdownField.css
@@ -4,7 +4,7 @@ div.TreeDropdownField .treedropdownfield-title { float: left; padding: 7px; widt
4 4
 div.TreeDropdownField .treedropdownfield-panel { clear: left; position: absolute; overflow: auto; display: none; cursor: default; border: 1px solid #aaa; border-top: none; margin: 1px 0 0 -1px; /* account for border on container div */ max-height: 200px; background-color: #fff; z-index: 50; -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); -o-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); }
5 5
 div.TreeDropdownField .treedropdownfield-panel ul.tree { margin: 0; }
6 6
 div.TreeDropdownField .treedropdownfield-panel ul.tree a { font-size: 12px; }
7  
-div.TreeDropdownField .treedropdownfield-toggle-panel-link { border: none; margin: 0; z-index: 0; padding: 7px 3px; float: right; overflow: hidden; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; background: #ccc; background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(0.6, #eeeeee)); background-image: -webkit-linear-gradient(center bottom, #cccccc 0%, #eeeeee 60%); background-image: -moz-linear-gradient(center bottom, #cccccc 0%, #eeeeee 60%); background-image: -o-linear-gradient(bottom, #cccccc 0%, #eeeeee 60%); background-image: -ms-linear-gradient(top, #cccccc 0%, #eeeeee 60%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); background-image: linear-gradient(top, #cccccc 0%, #eeeeee 60%); border-left: 1px solid #aaa; }
  7
+div.TreeDropdownField .treedropdownfield-toggle-panel-link { border: none; margin: 0; z-index: 0; padding: 7px 3px; overflow: hidden; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; background: #ccc; background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(0.6, #eeeeee)); background-image: -webkit-linear-gradient(center bottom, #cccccc 0%, #eeeeee 60%); background-image: -moz-linear-gradient(center bottom, #cccccc 0%, #eeeeee 60%); background-image: -o-linear-gradient(bottom, #cccccc 0%, #eeeeee 60%); background-image: -ms-linear-gradient(top, #cccccc 0%, #eeeeee 60%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); background-image: linear-gradient(top, #cccccc 0%, #eeeeee 60%); border-left: 1px solid #aaa; }
8 8
 div.TreeDropdownField .treedropdownfield-toggle-panel-link.treedropdownfield-open-tree { background: transparent; border: none; }
9 9
 div.TreeDropdownField .treedropdownfield-toggle-panel-link a { text-decoration: none; display: block; border: 0; margin: 0; opacity: 0.5; }
10 10
 div.TreeDropdownField .loading, div.TreeDropdownField .jstree-themeroller a.jstree-loading .jstree-icon { background: white url("../images/network-save.gif") center center no-repeat !important; }
1  dev/Debug.php
@@ -416,7 +416,6 @@ static function showError($errno, $errstr, $errfile, $errline, $errcontext, $err
416 416
 		}
417 417
 		$reporter->writeTrace(($errcontext ? $errcontext : debug_backtrace()));
418 418
 		$reporter->writeFooter();
419  
-		exit(1);
420 419
 	}
421 420
 	
422 421
 	/**
4  dev/install/install.php5
@@ -984,6 +984,7 @@ class Installer extends InstallRequirements {
984 984
 ?>
985 985
 <html>
986 986
 	<head>
  987
+		<meta charset="utf-8" />
987 988
 		<title>Installing SilverStripe...</title>
988 989
 		<link rel="stylesheet" type="text/css" href="<?php echo FRAMEWORK_NAME; ?>/dev/install/css/install.css" />
989 990
 		<script src="<?php echo FRAMEWORK_NAME; ?>/thirdparty/jquery/jquery.js"></script>
@@ -1352,7 +1353,8 @@ TEXT;
1352 1353
 			method: 'get',
1353 1354
 			url: 'InstallerTest/testrewrite',
1354 1355
 			complete: function(response) {
1355  
-				if(response.responseText == 'OK') {
  1356
+				var r = response.responseText.replace(/[^A-Z]?/g,"");
  1357
+				if(r === "OK") {
1356 1358
 					$('#ModRewriteResult').html("Friendly URLs set up successfully; I am now redirecting you to your SilverStripe site...")
1357 1359
 					setTimeout(function() {
1358 1360
 						window.location = "$destinationURL";
4  docs/en/reference/cms-architecture.md
Source Rendered
@@ -127,6 +127,10 @@ in jQuery.entwine, we're trying to reuse library code wherever possible.
127 127
 The most prominent example of this is the usage of [jQuery UI](http://jqueryui.com) for
128 128
 dialogs and buttons.
129 129
 
  130
+The CMS includes the jQuery.entwine inspector. Press Ctrl+` to bring down the inspector.
  131
+You can then click on any element in the CMS to see which entwine methods are bound to
  132
+any particular element.
  133
+
130 134
 ## JavaScript and CSS dependencies via Requirements and Ajax
131 135
 
132 136
 The JavaScript logic powering the CMS is divided into many files,
3  docs/en/topics/javascript.md
Source Rendered
@@ -222,6 +222,9 @@ This is a deliberately simple example, the strength of jQuery.entwine over simpl
222 222
 properties, namespacing, as well as its inheritance based on CSS selectors. Please see the [project
223 223
 documentation](http://github.com/hafriedlander/jquery.entwine/tree/master) for more complete examples.
224 224
 
  225
+When working in the CMS, the CMS includes the jQuery.entwine inspector. Press Ctrl+` to bring down the inspector.
  226
+You can then click on any element in the CMS to see which entwine methods are bound to any particular element.
  227
+
225 228
 ## Architecture and Best Practices
226 229
 
227 230
 ### Keep things simple
5  forms/GroupedDropdownField.php
@@ -57,5 +57,10 @@ function Field($properties = array()) {
57 57
 
58 58
 		return $this->createTag('select', $this->getAttributes(), $options);
59 59
 	}
  60
+
  61
+	function Type() {
  62
+		return 'groupeddropdown dropdown';
  63
+	}
  64
+	
60 65
 }
61 66
 
6  forms/HtmlEditorField.php
@@ -761,7 +761,7 @@ protected function getFiles($parentID = null) {
761 761
 	 * @return Array All extensions which can be handled by the different views.
762 762
 	 */
763 763
 	protected function getAllowedExtensions() {
764  
-		$exts = array('jpg', 'gif', 'png', 'swf');
  764
+		$exts = array('jpg', 'gif', 'png', 'swf','jpeg');
765 765
 		$this->extend('updateAllowedExtensions', $exts);
766 766
 		return $exts;
767 767
 	}
@@ -896,6 +896,10 @@ public function getOembed() {
896 896
 	public function appCategory() {
897 897
 		return 'embed';
898 898
 	}
  899
+	
  900
+	public function getInfo() {
  901
+		return $this->oembed->info;
  902
+	}
899 903
 }
900 904
 
901 905
 class HtmlEditorField_Image extends HtmlEditorField_File {
8  javascript/TreeDropdownField.js
@@ -193,11 +193,13 @@
193 193
 						'data': this.getPanel().find('.tree-holder').html(),
194 194
 						'ajax': {
195 195
 							'url': function(node) {
196  
-								return self.data('urlTree') + '/' + ($(node).data("id") ? $(node).data("id") : 0);
  196
+								var url = $.path.parseUrl(self.data('urlTree')).hrefNoSearch;
  197
+								return url + '/' + ($(node).data("id") ? $(node).data("id") : 0);
197 198
 							},
198 199
 							'data': function(node) {
  200
+								var query = $.query.load(self.data('urlTree')).keys;
199 201
 								var params = self.getRequestParams();
200  
-								params = $.extend({}, params, {ajax: 1});
  202
+								params = $.extend({}, query, params, {ajax: 1});
201 203
 								return params;
202 204
 							}
203 205
 						}
@@ -262,7 +264,7 @@
262 264
 			onadd: function() {
263 265
 				this._super();
264 266
 				
265  
-				var title = this.data('title');
  267
+				var title = decodeURIComponent(this.data('title'));
266 268
 				this.find('.treedropdownfield-title').replaceWith(
267 269
 					$('<input type="text" class="treedropdownfield-title search" />')
268 270
 				);
1  lang/en.yml
@@ -548,5 +548,6 @@ en:
548 548
     STARTALL: 'Start all'
549 549
     STARTALLINFO: 'Start all uploads'
550 550
     Saved: Saved
  551
+    HOTLINKINFO: Info: This image will be hotlinked. Please ensure you have permissions from the original site creator to do so.
551 552
   Versioned:
552 553
     has_many_Versions: Versions
1  lang/en_GB.yml
@@ -513,5 +513,6 @@ en_GB:
513 513
     STARTALL: 'Start all'
514 514
     STARTALLINFO: 'Start all uploads'
515 515
     Saved: Saved
  516
+    HOTLINKINFO: Info: This image will be hotlinked. Please ensure you have permissions from the original site creator to do so.
516 517
   Versioned:
517 518
     has_many_Versions: Versions
2  model/DataQuery.php
@@ -227,7 +227,7 @@ function getFinalisedQuery($queriedColumns = null) {
227 227
 
228 228
 		// TODO: Versioned, Translatable, SiteTreeSubsites, etc, could probably be better implemented as subclasses of DataQuery
229 229
 
230  
-		$obj = Injector::inst()->get(ClassInfo::baseDataClass($this->dataClass));
  230
+		$obj = Injector::inst()->get($this->dataClass);
231 231
 		$obj->extend('augmentSQL', $query, $this);
232 232
 
233 233
 		$this->ensureSelectContainsOrderbyColumns($query);
66  model/Versioned.php
@@ -145,7 +145,8 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
145 145
 			$date = $dataQuery->getQueryParam('Versioned.date');
146 146
 			foreach($query->getFrom() as $table => $dummy) {
147 147
 				$query->renameTable($table, $table . '_versions');
148  
-				$query->replaceText("\"$table\".\"ID\"", "\"$table\".\"RecordID\"");
  148
+				$query->replaceText("\"{$table}_versions\".\"ID\"", "\"{$table}_versions\".\"RecordID\"");
  149
+				$query->replaceText("`{$table}_versions`.`ID`", "`{$table}_versions`.`RecordID`");
149 150
 				
150 151
 				// Add all <basetable>_versions columns
151 152
 				foreach(self::$db_for_versions_table as $name => $type) {
@@ -154,15 +155,24 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
154 155
 				$query->selectField(sprintf('"%s_versions"."%s"', $baseTable, 'RecordID'), "ID");
155 156
 
156 157
 				if($table != $baseTable) {
157  
-					$query->addFrom(array($table => " AND \"{$table}_versions\".\"Version\" = \"{$baseTable}_versions\".\"Version\""));
  158
+					$query->addWhere("\"{$table}_versions\".\"Version\" = \"{$baseTable}_versions\".\"Version\"");
158 159
 				}
159 160
 			}
160 161
 
161 162
 			// Link to the version archived on that date
162  
-			$archiveTable = $this->requireArchiveTempTable($baseTable, $date);
163  
-			$query->addFrom(array($archiveTable => "INNER JOIN \"$archiveTable\"
164  
-				ON \"$archiveTable\".\"ID\" = \"{$baseTable}_versions\".\"RecordID\" 
165  
-				AND \"$archiveTable\".\"Version\" = \"{$baseTable}_versions\".\"Version\""));
  163
+			$safeDate = Convert::raw2sql($date);
  164
+			$query->addWhere(
  165
+					"`{$baseTable}_versions`.`Version` IN 
  166
+					(SELECT LatestVersion FROM 
  167
+						(SELECT 
  168
+							`{$baseTable}_versions`.`RecordID`, 
  169
+							MAX(`{$baseTable}_versions`.`Version`) AS LatestVersion
  170
+							FROM `{$baseTable}_versions`
  171
+							WHERE `{$baseTable}_versions`.`LastEdited` <= '$safeDate'
  172
+							GROUP BY `{$baseTable}_versions`.`RecordID`
  173
+						) AS `{$baseTable}_versions_latest`
  174
+						WHERE `{$baseTable}_versions_latest`.`RecordID` = `{$baseTable}_versions`.`RecordID`
  175
+					)");
166 176
 			break;
167 177
 		
168 178
 		// Reading a specific stage (Stage or Live)
@@ -203,10 +213,18 @@ function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
203 213
 			// Return latest version instances, regardless of whether they are on a particular stage
204 214
 			// This provides "show all, including deleted" functonality
205 215
 			if($dataQuery->getQueryParam('Versioned.mode') == 'latest_versions') {
206  
-				$archiveTable = self::requireArchiveTempTable($baseTable);
207  
-				$query->addInnerJoin($archiveTable, "\"$archiveTable\".\"ID\" = \"{$baseTable}_versions\".\"RecordID\" AND \"$archiveTable\".\"Version\" = \"{$baseTable}_versions\".\"Version\"");
  216
+				$query->addWhere(
  217
+					"`{$alias}_versions`.`Version` IN 
  218
+					(SELECT LatestVersion FROM 
  219
+						(SELECT 
  220
+							`{$alias}_versions`.`RecordID`, 
  221
+							MAX(`{$alias}_versions`.`Version`) AS LatestVersion
  222
+							FROM `{$alias}_versions`
  223
+							GROUP BY `{$alias}_versions`.`RecordID`
  224
+						) AS `{$alias}_versions_latest`
  225
+						WHERE `{$alias}_versions_latest`.`RecordID` = `{$alias}_versions`.`RecordID`
  226
+					)");
208 227
 			}
209  
-
210 228
 			break;
211 229
 		default:
212 230
 			throw new InvalidArgumentException("Bad value for query parameter Versioned.mode: " . $dataQuery->getQueryParam('Versioned.mode'));
@@ -233,34 +251,6 @@ public static function on_db_reset() {
233 251
 		// Remove references to them
234 252
 		self::$archive_tables = array();
235 253
 	}
236  
-	
237  
-	/**
238  
-	 * Create a temporary table mapping each database record to its version on the given date.
239  
-	 * This is used by the versioning system to return database content on that date.
240  
-	 * @param string $baseTable The base table.
241  
-	 * @param string $date The date.  If omitted, then the latest version of each page will be returned.
242  
-	 * @todo Ensure that this is DB abstracted
243  
-	 */
244  
-	protected static function requireArchiveTempTable($baseTable, $date = null) {
245  
-		if(!isset(self::$archive_tables[$baseTable])) {
246  
-			self::$archive_tables[$baseTable] = DB::createTable("_Archive$baseTable", array(
247  
-				"ID" => "INT NOT NULL",
248  
-				"Version" => "INT NOT NULL",
249  
-			), null, array('temporary' => true));
250  
-		}
251  
-		
252  
-		if(!DB::query("SELECT COUNT(*) FROM \"" . self::$archive_tables[$baseTable] . "\"")->value()) {
253  
-			if($date) $dateClause = "WHERE \"LastEdited\" <= '$date'";
254  
-			else $dateClause = "";
255  
-
256  
-			DB::query("INSERT INTO \"" . self::$archive_tables[$baseTable] . "\"
257  
-				SELECT \"RecordID\", max(\"Version\") FROM \"{$baseTable}_versions\"
258  
-				$dateClause
259  
-				GROUP BY \"RecordID\"");
260  
-		}
261  
-		
262  
-		return self::$archive_tables[$baseTable];
263  
-	}
264 254
 
265 255
 	/**
266 256
 	 * An array of DataObject extensions that may require versioning for extra tables
@@ -705,7 +695,7 @@ public function allVersions($filter = "", $sort = "", $limit = "", $join = "", $
705 695
 		$oldMode = self::get_reading_mode();
706 696
 		self::reading_stage('Stage');
707 697
 		
708  
-		$list = DataObject::get(get_class($this->owner), $filter, $sort, $limit, $join);
  698
+		$list = DataObject::get(get_class($this->owner), $filter, $sort, $join, $limit);
709 699
 		if($having) $having = $list->having($having);
710 700
 		
711 701
 		$query = $list->dataQuery()->query();
1  oembed/Oembed.php
@@ -253,6 +253,7 @@ protected function loadData() {
253 253
 				$data['provider_url'] = $protocoll.$host;
254 254
 				$data['width'] = imagesx($image);
255 255
 				$data['height'] = imagesy($image);
  256
+				$data['info'] = _t('UploadField.HOTLINKINFO', 'Info: This image will be hotlinked. Please ensure you have permissions from the original site creator to do so.');
256 257
 			}
257 258
 		}
258 259
 
7  scss/AssetUploadField.scss
@@ -88,6 +88,13 @@ body.cms.ss-uploadfield-edit-iframe, .composite.ss-assetuploadfield .details fie
88 88
 			padding: 0;
89 89
 			overflow: hidden;
90 90
 			position: relative;
  91
+			.info {
  92
+				position: relative; 
  93
+				padding: 7px; 
  94
+				overflow: hidden; 
  95
+				background-color: #FFBE66; 
  96
+				border: 1px solid #FF9300;
  97
+			}
91 98
 		}
92 99
 		.ss-uploadfield-item-preview {
93 100
 			position: absolute;
1  scss/TreeDropdownField.scss
@@ -52,7 +52,6 @@ div.TreeDropdownField {
52 52
 		margin: 0;
53 53
 		z-index: 0;
54 54
 		padding: 7px 3px;
55  
-		float: right;
56 55
 		overflow: hidden;
57 56
 		-webkit-border-radius: 0 4px 4px 0;
58 57
 		-moz-border-radius: 0 4px 4px 0;
14  templates/Includes/HtmlEditorField_viewfile.ss
@@ -38,11 +38,13 @@
38 38
 				</div>
39 39
 			</div>
40 40
 		</div>
41  
-	<div class="details ss-uploadfield-item-editform loading">
42  
-		<fieldset>
43  
-			<% loop Fields %>
44  
-				$FieldHolder
45  
-			<% end_loop %>
46  
-		</fieldset>
  41
+		<% if Info %><div class="info">$Info</div><% end_if %>
  42
+		<div class="details ss-uploadfield-item-editform loading">
  43
+			<fieldset>
  44
+				<% loop Fields %>
  45
+					$FieldHolder
  46
+				<% end_loop %>
  47
+			</fieldset>
  48
+		</div>
47 49
 	</div>
48 50
 </div>
19  tests/api/RSSFeedTest.php
@@ -14,7 +14,7 @@ function testRSSFeed() {
14 14
 		$list->push(new RSSFeedTest_ItemC());
15 15
 
16 16
 		$rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description");
17  
-		$content = $rssFeed->feedContent();
  17
+		$content = $rssFeed->outputToBrowser();
18 18
 
19 19
 		//Debug::message($content);
20 20
 		$this->assertContains('<link>http://www.example.org/item-a/</link>', $content);
@@ -32,7 +32,7 @@ function testRSSFeed() {
32 32
 
33 33
 		// Feed #2 - put Content() into <title> and AltContent() into <description>
34 34
 		$rssFeed = new RSSFeed($list, "http://www.example.com", "Test RSS Feed", "Test RSS Feed Description", "Content", "AltContent");
35  
-		$content = $rssFeed->feedContent();
  35
+		$content = $rssFeed->outputToBrowser();
36 36
 
37 37
 		$this->assertContains('<title>ItemA Content</title>', $content);
38 38
 		$this->assertContains('<title>ItemB Content</title>', $content);
@@ -47,13 +47,11 @@ public function testRenderWithTemplate() {
47 47
 		$rssFeed = new RSSFeed(new ArrayList(), "", "", "");
48 48
 		$rssFeed->setTemplate('RSSFeedTest');
49 49
 
50  
-		$content = $rssFeed->feedContent();
51  
-
  50
+		$content = $rssFeed->outputToBrowser();
52 51
 		$this->assertContains('<title>Test Custom Template</title>', $content);
53 52
 
54 53
 		$rssFeed->setTemplate('RSSFeed');
55  
-		$content = $rssFeed->feedContent();
56  
-		
  54
+		$content = $rssFeed->outputToBrowser();
57 55
 		$this->assertNotContains('<title>Test Custom Template</title>', $content);
58 56
 	}
59 57
 
@@ -69,7 +67,6 @@ public function tearDown() {
69 67
 		Director::setBaseURL(null);
70 68
 		$_SERVER['HTTP_HOST'] = self::$original_host;
71 69
 	}
72  
-
73 70
 }
74 71
 
75 72
 class RSSFeedTest_ItemA extends ViewableData {
@@ -83,9 +80,11 @@ class RSSFeedTest_ItemA extends ViewableData {
83 80
 	function getTitle() {
84 81
 		return "ItemA";
85 82
 	}
  83
+
86 84
 	function getContent() {
87 85
 		return "ItemA Content";
88 86
 	}
  87
+
89 88
 	function getAltContent() {
90 89
 		return "ItemA AltContent";
91 90
 	}
@@ -101,12 +100,15 @@ class RSSFeedTest_ItemB extends ViewableData {
101 100
 	function Title() {
102 101
 		return "ItemB";
103 102
 	}
  103
+
104 104
 	function AbsoluteLink() {
105 105
 		return "http://www.example.com/item-b.html";
106 106
 	}
  107
+
107 108
 	function Content() {
108 109
 		return "ItemB Content";
109 110
 	}
  111
+
110 112
 	function AltContent() {
111 113
 		return "ItemB AltContent";
112 114
 	}
@@ -114,7 +116,7 @@ function AltContent() {
114 116
 
115 117
 class RSSFeedTest_ItemC extends ViewableData {
116 118
 	// ItemC tests fields - Title has casting, Content doesn't.
117  
-	static $casting = array(
  119
+	public static $casting = array(
118 120
 		'Title' => 'Varchar',
119 121
 		'AltContent' => 'Text',
120 122
 	);
@@ -126,6 +128,7 @@ class RSSFeedTest_ItemC extends ViewableData {
126 128
 	function Link() {
127 129
 		return "item-c.html";
128 130
 	}
  131
+
129 132
 	function AbsoluteLink() {
130 133
 		return "http://www.example.com/item-c.html";
131 134
 	}
103  tests/model/VersionedTest.php
@@ -266,6 +266,109 @@ public function testGetVersionWhenClassnameChanged() {
266 266
 		$this->assertInstanceOf("VersionedTest_DataObject", $obj3);
267 267
 
268 268
 	}
  269
+	
  270
+	public function testArchiveVersion() {
  271
+		
  272
+		// In 2005 this file was created
  273
+		SS_Datetime::set_mock_now('2005-01-01 00:00:00');
  274
+		$testPage = new VersionedTest_Subclass();
  275
+		$testPage->Title = 'Archived page';
  276
+		$testPage->Content = 'This is the content from 2005';
  277
+		$testPage->ExtraField = '2005';
  278
+		$testPage->write();
  279
+		
  280
+		// In 2007 we updated it
  281
+		SS_Datetime::set_mock_now('2007-01-01 00:00:00');
  282
+		$testPage->Content = "It's 2007 already!";
  283
+		$testPage->ExtraField = '2007';
  284
+		$testPage->write();
  285
+		
  286
+		// In 2009 we updated it again
  287
+		SS_Datetime::set_mock_now('2009-01-01 00:00:00');
  288
+		$testPage->Content = "I'm enjoying 2009";
  289
+		$testPage->ExtraField = '2009';
  290
+		$testPage->write();
  291
+		
  292
+		// End mock, back to the present day:)
  293
+		SS_Datetime::clear_mock_now();
  294
+		
  295
+		// Test 1 - 2006 Content
  296
+		singleton('VersionedTest_Subclass')->flushCache(true);
  297
+		Versioned::set_reading_mode('Archive.2006-01-01 00:00:00');
  298
+		$testPage2006 = DataObject::get('VersionedTest_Subclass')->filter(array('Title' => 'Archived page'))->first();
  299
+		$this->assertInstanceOf("VersionedTest_Subclass", $testPage2006);
  300
+		$this->assertEquals("2005", $testPage2006->ExtraField);
  301
+		$this->assertEquals("This is the content from 2005", $testPage2006->Content);
  302
+		
  303
+		// Test 2 - 2008 Content
  304
+		singleton('VersionedTest_Subclass')->flushCache(true);
  305
+		Versioned::set_reading_mode('Archive.2008-01-01 00:00:00');
  306
+		$testPage2008 = DataObject::get('VersionedTest_Subclass')->filter(array('Title' => 'Archived page'))->first();
  307
+		$this->assertInstanceOf("VersionedTest_Subclass", $testPage2008);
  308
+		$this->assertEquals("2007", $testPage2008->ExtraField);
  309
+		$this->assertEquals("It's 2007 already!", $testPage2008->Content);
  310
+		
  311
+		// Test 3 - Today
  312
+		singleton('VersionedTest_Subclass')->flushCache(true);
  313
+		Versioned::set_reading_mode('Stage.Stage');
  314
+		$testPageCurrent = DataObject::get('VersionedTest_Subclass')->filter(array('Title' => 'Archived page'))->first();
  315
+		$this->assertInstanceOf("VersionedTest_Subclass", $testPageCurrent);
  316
+		$this->assertEquals("2009", $testPageCurrent->ExtraField);
  317
+		$this->assertEquals("I'm enjoying 2009", $testPageCurrent->Content);
  318
+	}
  319
+
  320
+	public function testAllVersions()
  321
+	{
  322
+		// In 2005 this file was created
  323
+		SS_Datetime::set_mock_now('2005-01-01 00:00:00');
  324
+		$testPage = new VersionedTest_Subclass();
  325
+		$testPage->Title = 'Archived page';
  326
+		$testPage->Content = 'This is the content from 2005';
  327
+		$testPage->ExtraField = '2005';
  328
+		$testPage->write();
  329
+		
  330
+		// In 2007 we updated it
  331
+		SS_Datetime::set_mock_now('2007-01-01 00:00:00');
  332
+		$testPage->Content = "It's 2007 already!";
  333
+		$testPage->ExtraField = '2007';
  334
+		$testPage->write();
  335
+		
  336
+		// Check both versions are returned
  337
+		$versions = Versioned::get_all_versions('VersionedTest_Subclass', $testPage->ID);
  338
+		$content = array();
  339
+		$extraFields = array();
  340
+		foreach($versions as $version)
  341
+		{
  342
+			$content[] = $version->Content;
  343
+			$extraFields[] = $version->ExtraField;
  344
+		}
  345
+		
  346
+		$this->assertEquals($versions->Count(), 2, 'All versions returned');
  347
+		$this->assertEquals($content, array('This is the content from 2005', "It's 2007 already!"), 'Version fields returned');
  348
+		$this->assertEquals($extraFields, array('2005', '2007'), 'Version fields returned');
  349
+		
  350
+		// In 2009 we updated it again
  351
+		SS_Datetime::set_mock_now('2009-01-01 00:00:00');
  352
+		$testPage->Content = "I'm enjoying 2009";
  353
+		$testPage->ExtraField = '2009';
  354
+		$testPage->write();
  355
+		
  356
+		// End mock, back to the present day:)
  357
+		SS_Datetime::clear_mock_now();
  358
+		
  359
+		$versions = Versioned::get_all_versions('VersionedTest_Subclass', $testPage->ID);
  360
+		$content = array();
  361
+		$extraFields = array();
  362
+		foreach($versions as $version)
  363
+		{
  364
+			$content[] = $version->Content;
  365
+			$extraFields[] = $version->ExtraField;
  366
+		}
  367
+		
  368
+		$this->assertEquals($versions->Count(), 3, 'Additional all versions returned');
  369
+		$this->assertEquals($content, array('This is the content from 2005', "It's 2007 already!", "I'm enjoying 2009"), 'Additional version fields returned');
  370
+		$this->assertEquals($extraFields, array('2005', '2007', '2009'), 'Additional version fields returned');
  371
+	}
269 372
 }
270 373
 
271 374
 class VersionedTest_DataObject extends DataObject implements TestOnly {
2  thirdparty/jquery-entwine/.piston.yml
@@ -3,6 +3,6 @@ repository_url: https://github.com/hafriedlander/jquery.entwine.git
3 3
 format: 1
4 4
 handler: 
5 5
   branch: master
6  
-  commit: ca22d2b88771cf3c65e65288c4991050a42883a3
  6
+  commit: 21af92dbad424148af6dd7ea310ab7344fcf7015
7 7
 repository_class: Piston::Git::Repository
8 8
 lock: false
2  thirdparty/jquery-entwine/spec/SpecRunner.html
@@ -12,7 +12,7 @@
12 12
 
13 13
 	<script type="text/javascript">
14 14
 		versionarg = window.location.search.match(/version=([^&]+)/);
15  
-		jQueryVersion = versionarg ? versionarg[1] : '1.7.2';
  15
+		jQueryVersion = versionarg ? versionarg[1] : '1.8.0';
16 16
 		jQuerySource = 'local';
17 17
 
18 18
 		var jQuery;
2  thirdparty/jquery-entwine/spec/spec.entwine.addrem.js
@@ -94,12 +94,10 @@ describe('Entwine', function(){
94 94
 
95 95
 				$('#a,#b').entwine({
96 96
 					onadd: function(){
97  
-						console.debug('added', this);
98 97
 						added.push(this.attr('id'));
99 98
 						sequence.push(this.attr('id'));
100 99
 					},
101 100
 					onremove: function(){
102  
-						console.debug('added', this);
103 101
 						removed.push(this.attr('id'));
104 102
 						sequence.push(this.attr('id'));
105 103
 					}
94  thirdparty/jquery-entwine/src/jquery.entwine.inspector.js
... ...
@@ -1,30 +1,39 @@
1 1
 
2  
-document.write([
3  
-'<style type="text/css">',
4  
-	'#entwine-inspector { position: fixed; z-index: 1000001; left: 0; right: 0; height: 400px; background: white; -webkit-box-shadow: 0 5px 40px 0 black; -moz-box-shadow: 0 5px 40px 0 black; }',
5  
-	'#entwine-inspector li { list-style: none; margin: 2px 0; padding: 2px 0; }',
6  
-	'#entwine-inspector li:hover { background: #eee; }',
7  
-	'#entwine-inspector li.selected { background: #ddd; }',
8  
-
9  
-	'#ei-columns { overflow: hidden; display: -webkit-box; display: -moz-box; width: 100%; height: 380px; }',
10  
-
11  
-	'.ei-column { height: 380px; width: 1px; -webkit-box-flex: 1; -moz-box-flex: 1; }',
12  
-	'#entwine-inspector .ei-column h1 { display: block; margin: 0; padding: 5px 2px; height: 20px; text-align: center; background: #444; color: #eee; font-size: 14px; font-weight: bold; }',
13  
-	'#entwine-inspector .ei-column ul { overflow-y: scroll; height: 350px; }',
14  
-
15  
-	'#ei-options { overflow: hidden; height: 20px; background: #444; color: #eee; }',
16  
-	'#ei-options label { padding-right: 5px; border-right: 1px solid #eee; }',
17  
-
18  
-	'.ei-entwined:hover, .ei-selected { background: rgba(128,0,0,0.2); }',
19  
-	'.ei-hovernode { position: absolute; z-index: 1000000; background: rgba(0,0,0,0.3); border: 1px solid white; outline: 1px solid white; }',
20  
-
21  
-	'#ei-selectors li { color: #aaa; display: none; }',
22  
-	'#ei-selectors li.matching, #entwine-inspector.show-unmatched #ei-selectors li { display: block; }',
23  
-	'#ei-selectors li.matching { color: black; }',
24  
-'</style>'
25  
-].join("\n"));
26  
-
27 2
 jQuery(function($){
  3
+	// Create a new style element
  4
+	var styleEl = document.createElement('style');
  5
+	styleEl.setAttribute('type', 'text/css');
  6
+	(document.head || document.getElementsByTagName('head')[0]).appendChild(styleEl);
  7
+
  8
+	var inspectorCSS = [
  9
+		'#entwine-inspector { position: fixed; z-index: 1000001; left: 0; right: 0; height: 400px; background: white; -webkit-box-shadow: 0 5px 40px 0 black; -moz-box-shadow: 0 5px 40px 0 black; }',
  10
+		'#entwine-inspector li { list-style: none; margin: 2px 0; padding: 2px 0; }',
  11
+		'#entwine-inspector li:hover { background: #eee; }',
  12
+		'#entwine-inspector li.selected { background: #ddd; }',
  13
+
  14
+		'#ei-columns { overflow: hidden; display: -webkit-box; display: -moz-box; width: 100%; height: 380px; }',
  15
+
  16
+		'.ei-column { height: 380px; width: 1px; -webkit-box-flex: 1; -moz-box-flex: 1; }',
  17
+		'#entwine-inspector .ei-column h1 { display: block; margin: 0; padding: 5px 2px; height: 20px; text-align: center; background: #444; color: #eee; font-size: 14px; font-weight: bold; }',
  18
+		'#entwine-inspector .ei-column ul { overflow-y: scroll; height: 350px; }',
  19
+
  20
+		'#ei-options { overflow: hidden; height: 20px; background: #444; color: #eee; }',
  21
+		'#ei-options label { padding-right: 5px; border-right: 1px solid #eee; }',
  22
+
  23
+		'.ei-entwined:hover, .ei-selected { background: rgba(128,0,0,0.2); }',
  24
+		'.ei-hovernode { position: absolute; z-index: 1000000; background: rgba(0,0,0,0.3); border: 1px solid white; outline: 1px solid white; }',
  25
+
  26
+		'#ei-selectors li { color: #aaa; display: none; }',
  27
+		'#ei-selectors li.matching, #entwine-inspector.show-unmatched #ei-selectors li { display: block; }',
  28
+		'#ei-selectors li.matching { color: black; }'
  29
+	].join("\n");
  30
+
  31
+	// Set the style element to style up the inspector panel
  32
+	if(styleEl.styleSheet){
  33
+		styleEl.styleSheet.cssText = inspectorCSS;
  34
+	}else{
  35
+		styleEl.appendChild(document.createTextNode(inspectorCSS));
  36
+	}
28 37
 
29 38
 	var inspectorPanel = $('<div id="entwine-inspector" class="show-unmatched"></div>').appendTo('body');
30 39
 	var columnHolder = $('<div id="ei-columns"></div>').appendTo(inspectorPanel);
@@ -79,6 +88,22 @@ jQuery(function($){
79 88
 		});
80 89
 	};
81 90
 
  91
+	var dumpElement = function(el) {
  92
+		var frag = document.createDocumentFragment();
  93
+		var div = document.createElement('div'); frag.appendChild(div);
  94
+
  95
+		var clone = el.cloneNode(false); $(clone).removeClass('ei-entwined').removeAttr('style');
  96
+
  97
+		var i = clone.attributes.length;
  98
+		while (i--) {
  99
+			var attr = clone.attributes.item(i);
  100
+			if (attr.name != 'class' && attr.name != 'id' && attr.value.length > 20) attr.value = attr.value.substr(0, 18)+'..'+attr.value.substr(-2);
  101
+		}
  102
+
  103
+		div.appendChild(clone);
  104
+		return div.innerHTML;
  105
+	};
  106
+
82 107
 	var displaydetails = function(e){
83 108
 		e.preventDefault(); e.stopPropagation();
84 109
 
@@ -99,18 +124,7 @@ jQuery(function($){
99 124
 			var target = $(this);
100