You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by pr...@apache.org on 2013/08/27 07:35:49 UTC
svn commit: r1517753 [15/33] - in /incubator/climate/branches/rcmet-2.1.1:
./ src/ src/main/ src/main/python/ src/main/python/bin/
src/main/python/docs/ src/main/python/docs/_static/
src/main/python/docs/_templates/ src/main/python/rcmes/ src/main/pyth...
Added: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/bootstrap.min.js
URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/bootstrap.min.js?rev=1517753&view=auto
==============================================================================
--- incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/bootstrap.min.js (added)
+++ incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/bootstrap.min.js Tue Aug 27 05:35:42 2013
@@ -0,0 +1,6 @@
+/*!
+* Bootstrap.js by @fat & @mdo
+* Copyright 2012 Twitter, Inc.
+* http://www.apache.org/licenses/LICENSE-2.0.txt
+*/
+!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=
new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.de
faults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>thi
s.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children(
)[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Const
ructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitionin
g)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse
;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).o
n("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||s.toggleClass("open"),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f<s.length-1&&f++,~f||(f=0),s.eq(f).focus()}};var s=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e.fn.dropdown.noConflict=function()
{return e.fn.dropdown=s,this},e(document).on("click.dropdown.data-api",r).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown-menu",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle).on("keydown.dropdown.data-api",t+", [role=menu]",n.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$e
lement[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")})},hide:function(t){t&&t.preventDefault();var n=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]!==e.target&&!t.$element.has(e.target).length&&t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){t.which==27&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.
$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.tra
nsition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o
.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e.fn[this.type].defaults,r={},i;this._options&&e.each(this._options,function(e,t){n[e]!=t&&(r[e]=t)},this),i=e(t.currentTarget)[this.type](r).data(this.type);if(!i.options.delay||!i.options.delay.show)return i.show();clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){i.hoverState=="in"&&i.show()},i.optio
ns.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top
:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip
(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.h
ide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.pro
totype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"
right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var n=e(this),r=n.data("target")||n.attr("href"),i=/^#\w/.test(r)&&e(r);return i&&i.length&&[[i.position().top+(!e.isWindow(t.$scrollElement.get(0))&&t.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]
}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scr
ollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active:last a")[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dro
pdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:fu
nction(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;whil
e(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,t
his)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagat
ion(),e.preventDefault()},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeah
ead"))return;n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.$element.removeClass(u).addClass("affix"+(a?"-"+a:""))};var n=e.fn.affix;e.fn.affix=function(
n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery);
\ No newline at end of file
Propchange: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/bootstrap.min.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/controllers.js
URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/controllers.js?rev=1517753&view=auto
==============================================================================
--- incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/controllers.js (added)
+++ incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/controllers.js Tue Aug 27 05:35:42 2013
@@ -0,0 +1,572 @@
+'use strict';
+
+// Controller for the world map
+function WorldMapCtrl($rootScope, $scope, selectedDatasetInformation, regionSelectParams) {
+ $scope.datasets = selectedDatasetInformation.getDatasets();
+ $scope.regionParams = regionSelectParams.getParameters();
+
+ $scope.updateMap = function() {
+
+ // Clear Group of layers from map if it exists
+ if ("rectangleGroup" in $rootScope) {
+ $rootScope.rectangleGroup.clearLayers();
+ }
+
+ // Don't process if we don't have any datasets added!!
+ if ($scope.datasets.length == 0)
+ return;
+
+ if ("map" in $rootScope) {
+ // Create Group to add all rectangles to map
+ $rootScope.rectangleGroup = L.layerGroup();
+
+ // Loop through datasets and add rectangles to Group
+ var i = 0;
+ angular.forEach($scope.datasets, function(dataset) {
+ // Get bounds from dataset
+ var maplatlon = dataset.latlonVals;
+ var bounds = [[maplatlon.latMax, maplatlon.lonMin],
+ [maplatlon.latMin, maplatlon.lonMax]];
+
+ var polygon = L.rectangle(bounds,{
+ stroke: false,
+ fillColor: $rootScope.fillColors[i],
+ fillOpacity: 0.3
+ });
+
+ // Add layer to Group
+ $rootScope.rectangleGroup.addLayer(polygon);
+ i++;
+ });
+
+ // Draw user selected region
+ if ($scope.regionParams.latMin != "" && $scope.regionParams.latMax != "" &&
+ $scope.regionParams.lonMin != "" && $scope.regionParams.lonMax != "") {
+
+ var bounds = [[$scope.regionParams.latMax, $scope.regionParams.lonMin],
+ [$scope.regionParams.latMin, $scope.regionParams.lonMax]];
+
+ var polygon = L.rectangle(bounds, {
+ color: '#000000',
+ opacity: 1.0,
+ fill: false,
+ });
+
+ $rootScope.rectangleGroup.addLayer(polygon);
+ }
+
+ // Add rectangle Group to map
+ $rootScope.rectangleGroup.addTo($rootScope.map);
+ }
+ };
+
+ $scope.$watch('datasets', function() {
+ $scope.updateMap();
+ }, true);
+
+ $scope.$watch('regionParams', function() {
+ $scope.updateMap();
+ }, true);
+};
+
+// Controller for dataset parameter selection/modification
+function ParameterSelectCtrl($rootScope, $scope, $http, $timeout, selectedDatasetInformation, regionSelectParams) {
+ $scope.datasets = selectedDatasetInformation.getDatasets();
+
+ // The min/max lat/lon values from the selected datasets
+ $scope.latMin = -90;
+ $scope.latMax = 90;
+ $scope.lonMin = -180;
+ $scope.lonMax = 180;
+ $scope.start = "1980-01-01 00:00:00";
+ $scope.end = "2030-01-01 00:00:00";
+
+ // The min/max lat/lon values entered by the user
+ $scope.enteredLatMin = "";
+ $scope.enteredLatMax = "";
+ $scope.enteredLonMin = "";
+ $scope.enteredLonMax = "";
+ $scope.enteredStart = "";
+ $scope.enteredEnd = "";
+
+ // The min/max lat/lon values that are displayed
+ $scope.displayParams = regionSelectParams.getParameters();
+
+ $scope.runningEval = false;
+
+ var updateDisplayValues = function() {
+ // Update the displayed lat/lon values. We give precedence to users entered values assuming
+ // they're valid given the current set of datasets selected.
+ //
+ // If the user has entered a value for latMin
+ if ($scope.enteredLatMin != "") {
+ // If it's not a valid value...
+ if ($scope.enteredLatMin < $scope.latMin) {
+ // Reset enteredLatMin to the "unmodified" state and display the correct value.
+ $scope.displayParams.latMin = $scope.latMin;
+ } else {
+ $scope.displayParams.latMin = $scope.enteredLatMin;
+ }
+ // Otherwise, just display the value.
+ } else {
+ $scope.displayParams.latMin = $scope.latMin;
+ }
+ // Update latMax
+ if ($scope.enteredLatMin != "") {
+ if ($scope.enteredLatMax > $scope.latMax) {
+ $scope.displayParams.latMax = $scope.latMax;
+ } else {
+ $scope.displayParams.latMax = $scope.enteredLatMax;
+ }
+ } else {
+ $scope.displayParams.latMax = $scope.latMax;
+ }
+ // Update lonMin
+ if ($scope.enteredLonMin != "") {
+ if ($scope.enteredLonMin < $scope.lonMin) {
+ $scope.displayParams.lonMin = $scope.lonMin;
+ } else {
+ $scope.displayParams.lonMin = $scope.enteredLonMin;
+ }
+ } else {
+ $scope.displayParams.lonMin = $scope.lonMin;
+ }
+ // Update lonMax
+ if ($scope.enteredLonMax != "") {
+ if ($scope.enteredLonMax > $scope.lonMax) {
+ $scope.displayParams.lonMax = $scope.lonMax;
+ } else {
+ $scope.displayParams.lonMax = $scope.enteredLonMax;
+ }
+ } else {
+ $scope.displayParams.lonMax = $scope.lonMax;
+ }
+ // Update Start time
+ if ($scope.enteredStart != "") {
+ if ($scope.enteredStart < $scope.start) {
+ $scope.displayParams.start = $scope.start;
+ } else {
+ $scope.displayParams.start = $scope.enteredStart;
+ }
+ } else {
+ $scope.displayParams.start = $scope.start;
+ }
+ // Update End time
+ if ($scope.enteredEnd != "") {
+ if ($scope.enteredEnd > $scope.end) {
+ $scope.displayParams.end = $scope.end;
+ } else {
+ $scope.displayParams.end = $scope.enteredEnd;
+ }
+ } else {
+ $scope.displayParams.end = $scope.end;
+ }
+ }
+
+ $scope.shouldDisableControls = function() {
+ return (selectedDatasetInformation.getDatasetCount() < 2);
+ }
+
+ $scope.shouldDisableEvaluate = function() {
+ return ($scope.shouldDisableControls() || $scope.runningEval);
+ }
+
+ $scope.shouldDisableClearButton = function() {
+ return (selectedDatasetInformation.getDatasetCount() == 0);
+ }
+
+ $scope.shouldDisableResultsView = function() {
+ var res = false;
+
+ if ($rootScope.evalResults == "")
+ res = true;
+
+ return res;
+ }
+
+ $scope.clearDatasets = function() {
+ selectedDatasetInformation.clearDatasets();
+ }
+
+ $scope.runEvaluation = function() {
+ $scope.runningEval = true;
+
+ // TODO
+ // Currently this has the 1 model, 1 observation format hard coded in. This shouldn't
+ // be the long-term case! This needs to be changed!!!!!!!!
+ var obsIndex = -1,
+ modelIndex = -1;
+
+ for (var i = 0; i < $scope.datasets.length; i++) {
+ if ($scope.datasets[i]['isObs'] == 1)
+ obsIndex = i;
+ else
+ modelIndex = i;
+ }
+
+ // You might wonder why this is using a jQuery ajax call instead of a built
+ // in $http.post call. The reason would be that it wasn't working with the
+ // $http.post call but it is with this. So...there you go! This should be
+ // changed eventually!!
+ $.ajax({
+ type: 'POST',
+ url: $rootScope.baseURL + '/rcmes/run/',
+ data: {
+ 'obsDatasetId' : $scope.datasets[obsIndex]['id'],
+ 'obsParameterId' : $scope.datasets[obsIndex]['param'],
+ 'startTime' : $scope.displayParams.start,
+ 'endTime' : $scope.displayParams.end,
+ 'latMin' : $scope.displayParams.latMin,
+ 'latMax' : $scope.displayParams.latMax,
+ 'lonMin' : $scope.displayParams.lonMin,
+ 'lonMax' : $scope.displayParams.lonMax,
+ 'filelist' : $scope.datasets[modelIndex]['id'],
+ 'modelVarName' : $scope.datasets[modelIndex]['param'],
+ 'modelTimeVarName' : $scope.datasets[modelIndex]['time'],
+ 'modelLatVarName' : $scope.datasets[modelIndex]['lat'],
+ 'modelLonVarName' : $scope.datasets[modelIndex]['lon'],
+ 'regridOption' : 'model',
+ 'timeRegridOption' : 'monthly',
+ 'metricOption' : 'bias',
+ },
+ success: function(data) {
+ var comp = data['comparisonPath'].split('/');
+ var model = data['modelPath'].split('/');
+ var obs = data['obsPath'].split('/');
+
+ $rootScope.evalResults = {};
+ $rootScope.evalResults.comparisonPath = comp[comp.length - 1];
+ $rootScope.evalResults.modelPath = model[model.length - 1];
+ $rootScope.evalResults.obsPath = obs[obs.length - 1];
+
+ $scope.runningEval = false;
+
+ $timeout(function() {
+ $('#evaluationResults').trigger('modalOpen', true, true);
+ }, 100);
+ },
+ error: function(xhr, status, error) {
+ $scope.runningEval = false;
+ },
+ });
+ }
+
+ $scope.updateParameters = function() {
+ // Save the user input, even if it isn't valid.
+ $scope.enteredLatMin = $scope.displayParams.latMin;
+ $scope.enteredLatMax = $scope.displayParams.latMax;
+ $scope.enteredLonMin = $scope.displayParams.lonMin;
+ $scope.enteredLonMax = $scope.displayParams.lonMax;
+ $scope.enteredStart = $scope.displayParams.start;
+ $scope.enteredEnd = $scope.displayParams.end;
+
+ // Check if the user values are valid and update the display values.
+ updateDisplayValues();
+ }
+
+ $scope.$watch('datasets',
+ function() {
+ var numDatasets = $scope.datasets.length;
+
+ if (numDatasets) {
+ var latMin = -90,
+ latMax = 90,
+ lonMin = -180,
+ lonMax = 180,
+ start = "1980-01-01 00:00:00",
+ end = "2030-01-01 00:00:00";
+
+ // Get the valid lat/lon range in the selected datasets.
+ for (var i = 0; i < numDatasets; i++) {
+ var curDataset = $scope.datasets[i];
+
+ latMin = (curDataset['latlonVals']['latMin'] > latMin) ? curDataset['latlonVals']['latMin'] : latMin;
+ latMax = (curDataset['latlonVals']['latMax'] < latMax) ? curDataset['latlonVals']['latMax'] : latMax;
+ lonMin = (curDataset['latlonVals']['lonMin'] > lonMin) ? curDataset['latlonVals']['lonMin'] : lonMin;
+ lonMax = (curDataset['latlonVals']['lonMax'] < lonMax) ? curDataset['latlonVals']['lonMax'] : lonMax;
+ start = (curDataset['timeVals']['start'] > start) ? curDataset['timeVals']['start'] : start;
+ end = (curDataset['timeVals']['end'] < end) ? curDataset['timeVals']['end'] : end;
+ }
+ }
+
+ $scope.latMin = latMin;
+ $scope.latMax = latMax;
+ $scope.lonMin = lonMin;
+ $scope.lonMax = lonMax;
+ $scope.start = start;
+ $scope.end = end;
+
+ updateDisplayValues();
+ }, true);
+}
+
+// Controller for dataset display
+function DatasetDisplayCtrl($rootScope, $scope, selectedDatasetInformation) {
+ $scope.datasets = selectedDatasetInformation.getDatasets();
+
+ $scope.removeDataset = function($index) {
+ selectedDatasetInformation.removeDataset($index);
+ }
+}
+
+// Controller for observation selection in modal
+function ObservationSelectCtrl($rootScope, $scope, $http, $q, $timeout, selectedDatasetInformation) {
+ // Grab a copy of the datasets so we can display a count to the user!
+ $scope.datasetCount = selectedDatasetInformation.getDatasets();
+
+ // Initalize the option arrays and default to the first element
+ $scope.params = ["Please select a file above"];
+ $scope.paramSelect = $scope.params[0];
+ $scope.lats = ["Please select a file above"];
+ $scope.latsSelect = $scope.lats[0];
+ $scope.lons = ["Please select a file above"];
+ $scope.lonsSelect = $scope.lons[0];
+ $scope.times = ["Please select a file above"];
+ $scope.timeSelect = $scope.times[0];
+
+ // Grab the path leader information that the webserver is using to limit directory access.
+ $scope.pathLeader = 'False';
+ $http.jsonp($rootScope.baseURL + '/getPathLeader/?callback=JSON_CALLBACK').
+ success(function(data) {
+ $scope.pathLeader = data.leader;
+ });
+
+ // Toggle load button view depending on upload state of selected files
+ $scope.loadingFile = false;
+
+ // Toggle display of a confirmation when loading a dataset
+ $scope.fileAdded = false;
+
+ $scope.latLonVals = [];
+ $scope.timeVals = [];
+ $scope.localSelectForm = {};
+
+ $scope.uploadLocalFile = function() {
+ $scope.loadingFile = true;
+
+ // TODO: Need to try to validate the input a bit. At least make sure we're not
+ // pointing at a directory perhaps?
+
+ // TODO: Two-way binding with ng-model isn't being used here because it fails to update
+ // properly with the auto-complete that we're using on the input box. So we're doing
+ // it the wrong way temporarily...
+ var input = $('#observationFileInput').val();
+
+ // If the backend is limiting directory access we need to add that leader to our path
+ // so it remains valid!
+ if ($scope.pathLeader != 'False') {
+ input = $scope.pathLeader + input
+ }
+
+ // TODO: We're not really handling the case where there is a failure here at all.
+ // Should check for fails and allow the user to make changes.
+ //
+ // Get model variables
+ var varsPromise = $http.jsonp($rootScope.baseURL + '/list/vars/"' + input + '"?callback=JSON_CALLBACK');
+ // Get Lat and Lon variables
+ var latlonPromise = $http.jsonp($rootScope.baseURL + '/list/latlon/"' + input + '"?callback=JSON_CALLBACK');
+ // Get Time variables
+ var timesPromise = $http.jsonp($rootScope.baseURL + '/list/time/"' + input + '"?callback=JSON_CALLBACK');
+
+ $q.all([varsPromise, latlonPromise, timesPromise]).then(
+ // Handle success fetches!
+ function(arrayOfResults) {
+ $scope.loadingFile = false;
+
+ // Handle lat/lon results
+ var data = arrayOfResults[1].data;
+ $scope.lats = [data.latname];
+ $scope.lons = [data.lonname];
+ $scope.latLonVals = [data.latMin, data.latMax, data.lonMin, data.lonMax];
+
+ // If there is more than one option for the user, tell them they need to pick one!
+ if ($scope.lats.length > 1) $scope.lats.splice(0, 0, "Please select an option");
+ if ($scope.lons.length > 1) $scope.lons.splice(0, 0, "Please select an option");
+ // Default the display to the first available option.
+ $scope.latsSelect = $scope.lats[0];
+ $scope.lonsSelect = $scope.lons[0];
+
+ // Handle time results
+ var data = arrayOfResults[2].data
+ $scope.times = [data.timename];
+
+ if ($scope.times.length > 1) $scope.times.splice(0, 0, "Please select an option");
+ $scope.timeSelect = $scope.times[0];
+
+ // Handle parameter results
+ var data = arrayOfResults[0].data.variables;
+ $scope.params = (data instanceof Array) ? data : [data];
+ $scope.params = $.grep($scope.params,
+ function(val) {
+ return ($.inArray(val, $scope.lats) != 0 &&
+ $.inArray(val, $scope.lons) != 0 &&
+ $.inArray(val, $scope.times) != 0);
+ });
+
+ if ($scope.params.length > 1) $scope.params.splice(0, 0, "Please select an option");
+ $scope.paramSelect = $scope.params[0];
+ },
+ // Uh oh! AT LEAST on of our fetches failed
+ function(arrayOfFailure) {
+ $scope.loadingFile = false;
+
+ $scope.params = ["Unable to load variable(s)"];
+ $scope.paramSelect = $scope.params[0];
+ $scope.lats = ["Unable to load variable(s)"];
+ $scope.latsSelect = $scope.lats[0];
+ $scope.lons = ["Unable to load variable(s)"];
+ $scope.lonsSelect = $scope.lons[0];
+ $scope.times = ["Unable to load variable(s)"];
+ $scope.timeSelect = $scope.times[0];
+ }
+ );
+ };
+
+ $scope.addDataSet = function() {
+ // TODO: Need to verify that all the variables selected are correct!!!
+ // TODO: We shouldn't allow different parameters to match the same variables!!
+
+ var newDataset = {};
+ var input = $('#observationFileInput').val();
+
+ // If the backend is limiting directory access we need to add that leader to our path
+ // so it remains valid!
+ if ($scope.pathLeader != 'False') {
+ input = $scope.pathLeader + input
+ }
+
+ newDataset['isObs'] = 0;
+ // Save the model path. Note that the path is effectively the "id" for the model.
+ newDataset['id'] = input;
+ // Grab the file name later for display purposes.
+ var splitFilePath = input.split('/');
+ newDataset['name'] = splitFilePath[splitFilePath.length - 1];
+ // Save the model parameter variable. We save it twice for consistency and display convenience.
+ newDataset['param'] = $scope.paramSelect;
+ newDataset['paramName'] = newDataset['param'];
+ // Save the lat/lon information
+ newDataset['lat'] = $scope.latsSelect;
+ newDataset['lon'] = $scope.lonsSelect;
+
+ newDataset['latlonVals'] = {"latMin": $scope.latLonVals[0], "latMax": $scope.latLonVals[1],
+ "lonMin": $scope.latLonVals[2], "lonMax": $scope.latLonVals[3]};
+ // Get the time information
+ newDataset['time'] = $scope.timeSelect;
+ newDataset['timeVals'] = {"start": $scope.timeVals[0], "end": $scope.timeVals[1]};
+
+ selectedDatasetInformation.addDataset(newDataset);
+
+ // Reset all the fields!!
+ $scope.params = ["Please select a file above"];
+ $scope.paramSelect = $scope.params[0];
+ $scope.lats = ["Please select a file above"];
+ $scope.latsSelect = $scope.lats[0];
+ $scope.lons = ["Please select a file above"];
+ $scope.lonsSelect = $scope.lons[0];
+ $scope.times = ["Please select a file above"];
+ $scope.timeSelect = $scope.times[0];
+ $scope.latLonVals = [];
+ $scope.timeVals = [];
+
+ // Clear the input box
+ $('#observationFileInput').val("");
+
+ // Display a confirmation message for a little bit
+ $scope.fileAdded = true;
+ $timeout(function() {
+ $scope.fileAdded = false;
+ }, 2000);
+ }
+
+ $scope.shouldDisableLoadButton = function() {
+ return $scope.loadingFile;
+ }
+}
+
+function RcmedSelectionCtrl($rootScope, $scope, $http, $timeout, selectedDatasetInformation) {
+ // Grab a copy of the datasets so we can display a count to the user!
+ $scope.datasetCount = selectedDatasetInformation.getDatasets();
+ $scope.fileAdded = false;
+
+ var getObservations = function() {
+ $http.jsonp($rootScope.baseURL + '/getObsDatasets?callback=JSON_CALLBACK').
+ success(function(data) {
+ $scope.availableObs = data;
+ $scope.availableObs.splice(0, 0, {longname: 'Please select an option'});
+ $scope.datasetSelection = $scope.availableObs[0];
+ }).
+ error(function(data) {
+ $scope.availableObs = ["Unable to query RCMED"]
+ });
+ };
+
+ var getObservationTimeRange = function(datasetID) {
+ var times = {
+ '1' : {'start' : '1989-01-01 00:00:00','end' : '2009-12-31 00:00:00'}, // ERA-Interim
+ '2' : {'start' : '2002-08-31 00:00:00','end' : '2010-01-01 00:00:00'}, // AIRS
+ '3' : {'start' : '1998-01-01 00:00:00','end' : '2010-01-01 00:00:00'}, // TRMM
+ '4' : {'start' : '1948-01-01 00:00:00','end' : '2010-01-01 00:00:00'}, // URD
+ '5' : {'start' : '2000-02-24 00:00:00','end' : '2010-05-30 00:00:00'}, // MODIS
+ '6' : {'start' : '1901-01-01 00:00:00','end' : '2006-12-01 00:00:00'} // CRU
+ };
+
+ return ((datasetID in times) ? times[datasetID] : false);
+ };
+
+ $scope.dataSelectUpdated = function() {
+ var urlString = $rootScope.baseURL + '/getDatasetParam?dataset=' +
+ $scope.datasetSelection["shortname"] +
+ "&callback=JSON_CALLBACK";
+ $http.jsonp(urlString).
+ success(function(data) {
+ $scope.retrievedObsParams = data;
+ if ($scope.retrievedObsParams.length > 1)
+ $scope.retrievedObsParams.splice(0, 0, {shortname: 'Please select a parameter'});
+ $scope.parameterSelection = $scope.retrievedObsParams[0];
+ });
+ };
+
+ $scope.addObservation = function() {
+ // This is a horrible hack for temporarily getting a valid time range
+ // for the selected observation. Eventually we need to handle this more
+ // elegantly than indexing into an array...
+ var timeRange = getObservationTimeRange($scope.datasetSelection["dataset_id"]);
+
+ var newDataset = {};
+
+ newDataset['isObs'] = 1;
+ // Save the dataset id (the important part) and name (for display purposes)
+ newDataset['id'] = $scope.datasetSelection['dataset_id'];
+ newDataset['name'] = $scope.datasetSelection['longname'];
+ // Save the parameter id (the important part) and name (for display purposes)
+ newDataset['param'] = $scope.parameterSelection['parameter_id'];
+ newDataset['paramName'] = $scope.parameterSelection['longname'];
+ // Save the (fake) lat/lon information. Our datasets cover the entire globe (I think...)
+ newDataset['latlonVals'] = {"latMin": -90, "latMax": 90, "lonMin": -180, "lonMax": 180};
+ // Set some defaults for lat/lon variable names. This just helps us display stuff later.
+ newDataset['lat'] = "N/A";
+ newDataset['lon'] = "N/A";
+ // Save time range information. If we don't have saved data for this observation then
+ // we set the values to extreme values so they'll be ignored when calculating overlaps.
+ newDataset['timeVals'] = {"start": (timeRange) ? timeRange['start'] : "1901-01-01 00:00:00",
+ "end": (timeRange) ? timeRange['end'] : "2050-01-01 00:00:00"};
+ // Set a default for the time variable names for display convenience.
+ newDataset['time'] = "N/A";
+
+ selectedDatasetInformation.addDataset(newDataset);
+
+ // Clear the user selections by requery-ing RCMED. This is really hacky, but it works for now...
+ $scope.availableObs = [];
+ $scope.retrievedObsParams = [];
+ getObservations();
+
+ // Display a confirmation message for a little bit
+ $scope.fileAdded = true;
+ $timeout(function() {
+ $scope.fileAdded = false;
+ }, 2000);
+ };
+
+ // Grab the available observations from RCMED
+ getObservations();
+}
Propchange: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/controllers.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/directives.js
URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/directives.js?rev=1517753&view=auto
==============================================================================
--- incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/directives.js (added)
+++ incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/directives.js Tue Aug 27 05:35:42 2013
@@ -0,0 +1,374 @@
+'use strict';
+
+// Directive for dealing with the Leaflet map
+angular.module('rcmes').
+directive('sap', function($rootScope) {
+ return {
+ restrict: 'E',
+ replace: true,
+ template: '<div></div>',
+ link: function(scope, element, attrs) {
+ $rootScope.map = L.map(attrs.id, {
+ center: [40, 0],
+ zoom: 2,
+ scrollWheelZoom: false,
+ });
+ //create a CloudMade tile layer and add it to the map
+ L.tileLayer('http://{s}.tile.cloudmade.com/57cbb6ca8cac418dbb1a402586df4528/997/256/{z}/{x}/{y}.png', {
+ maxZoom: 4, minZoom: 2,
+ }).addTo($rootScope.map);
+ }
+ };
+}).
+// Directive for inserting bootstrap modals
+directive('bootstrapModal', function($timeout) {
+ var link = function(scope, elem, attrs) {
+ var escapeEvent;
+ var openModal;
+ var closeModal;
+
+ escapeEvent = function(e) {
+ if (e.which == 27)
+ closeModal();
+ }
+
+ openModal = function(event, toggleBackground, toggleKeyboardEscape) {
+ // Grab the current modal tag based on the modalId attribute in the bootstrapModal tag
+ var modal = $('#' + attrs.modalId);
+
+ // Make all the modal's children of class "close" call the appropriate function for closing!
+ $('.close', modal).bind('click', closeModal);
+
+ modal.modal({
+ show: true,
+ backdrop: toggleBackground,
+ keyboard: toggleKeyboardEscape,
+ });
+ };
+
+ closeModal = function(event) {
+ $('#' + attrs.modalId).modal('hide');
+
+ };
+
+ // We need to bind the close and open modal events so outside elements can trigger the modal.
+ // This has to wait until the template has been fully inserted, so just wait a bit of time
+ // before we set them. I'm sure there's a better way of handling this...
+ $timeout(function() {
+ $('#' + attrs.modalId).
+ bind('modalOpen', openModal).
+ bind('modalClose', closeModal);
+ }, 100);
+ };
+
+ return {
+ link: link,
+ replace: true,
+ restrict: 'E',
+ scope: {
+ modalId: '@'
+ },
+ template: '<div id="{{modalId}}" class="modal hide fade" tabindex="-1"><div ng-transclude></div></div>',
+ transclude: true
+ };
+}).
+// This directive process bootstrap-modal-open attributes. This lets the user bind the opening of a specific modal
+// as well as specifying how that modal should open.
+directive('bootstrapModalOpen', function() {
+ return {
+ restrict: 'A',
+ link: function(scope, elem, attrs) {
+ // Default to showing the background if the user didn't specify a value for this.
+ var hasBackground = (attrs.background === undefined ? true : attrs.background);
+ // Enable keyboard closing of modal with escape key.
+ var hasKeyboardEscape = (attrs.keyboard === undefined ? true : attrs.keyboard);
+
+ $(elem).bind('click', function() {
+ $('#' + attrs.bootstrapModalOpen).trigger('modalOpen', [hasBackground, hasKeyboardEscape]);
+ });
+ }
+ };
+}).
+// Setup a text input that the user will use to input a path to a local file.
+directive('predictiveFileBrowserInput', function() {
+ var link = function($scope, $elem, $attrs) {
+ $scope.autocomplete = [];
+
+ /*
+ * We need a place to dump our auto-completion options
+ */
+ $($elem).parent().append('<ul id="autoCompletePath"><ul>');
+
+ // Handle user clicks on auto-complete path options
+ $(document).on('click', '#autoCompletePath li span', function(e) {
+ // Set the input text box's value to that of the user selected path
+ var val = $(e.target).text();
+ $($elem).val(val);
+
+ // If the user selected a directory, find more results..
+ if (val[val.length - 1] == '/') {
+ $scope.fetchFiles($($elem).val());
+ // Otherwise, remove the auto-complete options...
+ } else {
+ $('#autoCompletePath li').remove();
+ }
+ });
+
+ /*
+ * Handle key-down events on the input box
+ *
+ * We need to ignore <TAB> presses here so we can auto-complete with <TAB>.
+ * If we don't ignore here then <TAB> will move the user to the next field
+ * in the form and our common-prefix-fill won't work later.
+ */
+ $($elem).keydown(function(e) {
+ var code = e.keyCode || e.which;
+ var BACKSPACE = 8,
+ TAB = 9;
+
+ if (code == TAB)
+ return false;
+ });
+
+ /*
+ * Handle key-up events on the input box
+ */
+ $($elem).keyup(function(e) {
+ var code = e.keyCode || e.which;
+ var BACKSPACE = 8,
+ TAB = 9,
+ FORWARD_SLASH = 191;
+
+ if (code === FORWARD_SLASH) {
+ // Fetch new directory information from the server.
+ $scope.fetchFiles($(this).val());
+ } else if (code === TAB) {
+ // Attempt to auto-fill for the user.
+ $scope.handleTabPress();
+ } else if (code == BACKSPACE) {
+ // Need to properly handle the removal of directory information
+ // and the displaying of auto-complete options
+ $scope.handleBackSpace();
+ } else {
+ // Filter auto-complete options based on user input..
+ $scope.handleMiscKeyPress();
+ }
+
+ // This is being used so we can handle backspacing. The user might hold
+ // down the backspace key or select a section of text and delete. This allows
+ // us to compare the result to its prior state, which makes handling
+ // backspaces easier.
+ $scope.lastInputContents = $elem.val();
+ });
+
+ /*
+ * Grab additional path information from the web-server
+ *
+ * Params:
+ * path - The path to get a directory listing of.
+ */
+ // TODO Make this use $HTTP
+ $scope.fetchFiles = function(path) {
+ $.get($scope.baseURL + '/getDirInfo/' + path, {},
+ function(data) {
+ $scope.setNewData(data);
+ $scope.updateAutoComplete();
+ }, 'json');
+ };
+
+ /*
+ * Grab additional path information from the web-server and filter the
+ * results based on the current input text.
+ *
+ * Params:
+ * path - The path to get a directory listing of.
+ *
+ * This is needed to handle deletion of selected text. It is possible that
+ * the user will select text and delete only part of a word. The results
+ * need to be filtered based on this partial input.
+ */
+ // TODO Why isn't this using $http?!?!?! Because I copy and pasted!!!!
+ $scope.fetchFilesAndFilter = function(path) {
+ $.get($scope.baseURL + '/getDirInfo/' + path, {},
+ function(data) {
+ $scope.setNewData(data);
+ $scope.filterResults();
+ $scope.updateAutoComplete();
+ }, 'json');
+ };
+
+ /*
+ * Handle directory data from the server.
+ *
+ * We store the entire directory information along with the remaining
+ * possible options given the users current input. This lets us avoid
+ * unnecessary calls to the server for directory information every time
+ * the user deletes something.
+ */
+ $scope.setNewData = function(data) {
+ $scope.autocomplete = data.sort();
+ $scope.possibleCompletes = $scope.autocomplete;
+ };
+
+ /*
+ * Handle <TAB> presses.
+ *
+ * Attempt to auto-complete options when the user presses <TAB>.
+ */
+ $scope.handleTabPress = function() {
+ // If there's only one option available there's no points in trying to
+ // find a common prefix! Just set the value!
+ if ($scope.possibleCompletes.length === 1) {
+ $elem.val($scope.possibleCompletes[0]);
+
+ // Make sure more options are displayed if a directory was selected.
+ $scope.checkForMoreOptions();
+ $scope.updateAutoComplete();
+ return;
+ }
+
+ // Find the greatest common prefix amongst the remaining choices and set
+ // the input text to it.
+ var prefix = $scope.getLargestCommonPrefix($scope.possibleCompletes);
+ $elem.val(prefix);
+ $scope.updateAutoComplete();
+ };
+
+ /*
+ * Handle Backspacing and option displaying.
+ *
+ * The auto-complete options needs to be displayed correctly when the user
+ * removes directory information.
+ */
+ $scope.handleBackSpace = function() {
+ var curInputVal = $elem.val();
+
+ // If the user deletes everything in the input box all we need to do
+ // is make sure that the auto-complete options aren't displayed.
+ if (curInputVal.length === 0) {
+ $('#autoCompletePath li').remove();
+ return;
+ }
+
+ // Figure out how much text the user removed from the input box.
+ var lengthDiff = $scope.lastInputContents.length - curInputVal.length;
+ // Grab the removed text.
+ var removedText = $scope.lastInputContents.substr(-lengthDiff);
+
+ // If the user deleted over a directory we need to fetch information on the
+ // previous directory for auto-completion.
+ if (removedText.indexOf('/') !== -1) {
+ var lastSlashIndex = curInputVal.lastIndexOf('/');
+
+ // If the remaining path still contains a directory...
+ if (lastSlashIndex !== -1) {
+ // Grab the section of the path that points to a valid directory,
+ // fetch the listing, and update the results.
+ var pathToSearch = curInputVal.slice(0, lastSlashIndex + 1);
+ $scope.fetchFilesAndFilter(pathToSearch);
+ } else {
+ // Delete the old auto-complete information in the case where the user
+ // completely removed path information.
+ $('#autoCompletePath li').remove();
+ }
+ } else {
+ // Otherwise, we just need to filter results based on the remaining input.
+ $scope.filterResults();
+ $scope.updateAutoComplete();
+ }
+ };
+
+ /*
+ * Handle all other key presses in the input box
+ *
+ * Filter the auto-complete options as the user types to ensure that only options
+ * which are possible given the current input text are still displayed.
+ */
+ $scope.handleMiscKeyPress = function() {
+ // Safely exit when there are no options available.
+ if ($scope.autocomplete === [])
+ return;
+
+ // Otherwise, filter the results.
+ $scope.filterResults();
+ $scope.updateAutoComplete();
+ };
+
+ /*
+ * When a path is auto-completed with <TAB> we need to check to see if it points
+ * to a directory. If it does, we still need to fetch results!
+ */
+ $scope.checkForMoreOptions = function() {
+ var path = $elem.val();
+ if (path[path.length - 1] === '/') {
+ $scope.fetchFiles(path);
+ }
+ };
+
+ /*
+ * Calculate the greatest common prefix of the passed options.
+ *
+ * Params:
+ * Options - An array of strings in which the greatest common prefix
+ * should be found
+ *
+ * Returns:
+ * The greatest common prefix of the strings.
+ *
+ *
+ * Note - For us, there will always be a prefix of at least '/' since this can't
+ * possible be called without the users entering a starting directory. As a result,
+ * we don't explicitly handle the case where there is 0 length common prefix.
+ */
+ $scope.getLargestCommonPrefix = function(options) {
+ var index = 1;
+ var shortestString = options.reduce(function(a, b) { return a.length < b.length ? a : b; });
+ var longestString = options.reduce(function(a, b) { return a.length > b.length ? a : b; });
+ var substringToCheck = shortestString[0];
+
+ while (longestString.indexOf(substringToCheck) !== -1) {
+ substringToCheck = shortestString.slice(0, ++index);
+ }
+
+ return longestString.slice(0, index - 1);
+ };
+
+ /*
+ * Filter the auto-complete options based on the current input.
+ */
+ $scope.filterResults = function() {
+ $scope.possibleCompletes = $scope.autocomplete.filter(function(item, index, array) {
+ return (~item.indexOf($($elem).val()));
+ });
+
+ $scope.possibleCompletes.sort();
+ };
+
+ /*
+ * Update the display of auto-complete options.
+ */
+ $scope.updateAutoComplete = function() {
+ // Remove all the existing options
+ $('#autoCompletePath li').remove();
+
+ // We don't need to show anything if the user has completely selected
+ // the only existing option available.
+ if ($scope.possibleCompletes.length === 1) {
+ if ($scope.possibleCompletes[0] === $elem.val()) {
+ return;
+ }
+ }
+
+ // Display all the possible completes
+ $.each($scope.possibleCompletes, function(i, v) {
+ $('#autoCompletePath').append($('<li>').html($('<span>').text(v)));
+ });
+ };
+ };
+
+ return {
+ link: link,
+ scope: true,
+ restrict: 'A'
+ };
+});
Propchange: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/directives.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/filters.js
URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/filters.js?rev=1517753&view=auto
==============================================================================
--- incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/filters.js (added)
+++ incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/filters.js Tue Aug 27 05:35:42 2013
@@ -0,0 +1,10 @@
+'use strict';
+
+/* Filters */
+
+angular.module('myApp.filters', []).
+ filter('interpolate', ['version', function(version) {
+ return function(text) {
+ return String(text).replace(/\%VERSION\%/mg, version);
+ }
+ }]);
Propchange: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/filters.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/jasny-bootstrap.min.js
URL: http://svn.apache.org/viewvc/incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/jasny-bootstrap.min.js?rev=1517753&view=auto
==============================================================================
--- incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/jasny-bootstrap.min.js (added)
+++ incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/jasny-bootstrap.min.js Tue Aug 27 05:35:42 2013
@@ -0,0 +1,6 @@
+/*!
+* Jasny-bootstrap.js by @ArnoldDaniels
+* Copyright 2012 Arnold Daniels
+* http://www.apache.org/licenses/LICENSE-2.0.txt
+*/
+!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.options.target&&(this.$target=e(this.options.target)),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.strict=this.options.strict,this.$menu=e(this.options.menu),this.shown=!1,typeof this.source=="string"&&(this.url=this.source,this.source=this.searchAjax),t.nodeName=="SELECT"&&this.replaceSelect(),this.text=this.$element.val(),this.$element.attr("data-text",this.value).attr("autocomplete","off"),typeof this.$target!="undefined"?this.$element.attr("data-value",this.$target.val()):typeof this.$element.attr("data-value")=="undefined"&&this.$element.attr("data-value",this.strict?"":this.value),this.$menu.css("min-width",this.$element.width()+12),this.listen()};t.prototype={constru
ctor:t,replaceSelect:function(){this.$target=this.$element,this.$element=e('<input type="text" />'),this.source={},this.strict=!0;var t=this.$target.find("option"),n;for(var r=0;r<t.length;r++){n=e(t[r]);if(n.val()===""){this.$element.attr("placeholder",n.html());continue}this.source[n.val()]=n.html(),this.$target.val()==n.val()&&this.$element.val(n.html())}var i=this.$target[0].attributes;for(r=0;r<i.length;r++)i[r].nodeName!="type"&&i[r].nodeName!="name"&&i[r].nodeName!="id"&&i[r].nodeName!="data-provide"&&!i[r].nodeName.match(/^on/)&&this.$element.attr(i[r].nodeName,i[r].nodeValue);this.$element.insertAfter(this.$target),this.$target.attr("autofocus")&&this.$element.trigger("focus").select(),this.$target.attr("autofocus",!1),this.$target.hide()},destroyReplacement:function(){typeof this.$target!="undefined"&&this.$target[0].nodeName=="SELECT"&&this.$element.replaceWith("")},select:function(){var e=this.$menu.find(".active"),t=e.attr("data-value"),n=e.find(".item-text").length>0?e
.find(".item-text").text():e.text();return t=this.updater(t,"value"),n=this.updater(n,"text"),this.$element.val(n).attr("data-value",t),this.text=n,typeof this.$target!="undefined"&&this.$target.val(t).trigger("change"),this.$element.trigger("change"),this.hide()},updater:function(e,t){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){return e.isArray(t)?this.processArray(t):this.processObject(t)},processArray:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e
)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},processObject:function(t){var n=this,r={},i=0;return e.each(t,function(e,t){n.matcher(t)&&(r[e]=t)}),r=this.sorter(r),e.isEmptyObject(r)?this.shown?this.hide():this:(e.each(r,function(e,t){i++>=n.options.items&&delete r[e]}),this.render(r).show())},searchAjax:function(t,n){var r=this;this.ajaxTimeout&&clearTimeout(this.ajaxTimeout),this.ajaxTimeout=setTimeout(function(){r.ajaxTimeout&&clearTimeout(r.ajaxTimeout);if(t===""){r.hide();return}e.get(r.url,{q:t,limit:r.options.items},function(e){typeof e=="string"&&(e=JSON.parse(e)),n(e)})},this.options.ajaxdelay)},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(t){return e.isArray(t)?this.sortArray(t):this.sortObject(t)},sortArray:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);ret
urn t.concat(n,r)},sortObject:function(e){var t={},n;for(n in e)e[n].toLowerCase().indexOf(this.query.toLowerCase())||(t[n]=e[n],delete e[n]);for(n in e)~e[n].indexOf(this.query)&&(t[n]=e[n],delete e[n]);for(n in e)t[n]=e[n];return t},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this,r=e([]);return e.map(t,function(i,s){if(r.length>=n.options.items)return;var o,u;e.isArray(t)&&(s=i),o=e(n.options.item),u=o.find("a").length?o.find("a"):o,u.html(n.highlighter(i)),o.attr("data-value",s),o.find("a").length===0&&o.addClass("dropdown-header"),r.push(o[0])}),r.not(".dropdown-header").first().addClass("active"),this.$menu.html(r),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.nextAll("li:not(.dropdown-header)").first();r.length||(r=e(this.$menu.find("li:not(.dropdown-header)")[0])),r.addClass("active
")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prevAll("li:not(.dropdown-header)").first();n.length||(n=this.$menu.find("li:not(.dropdown-header)").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("change",e.proxy(this.change,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this)),e(window).on("unload",e.proxy(this.destroyReplacement,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.pr
eventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},change:function(e){var t;this.$element.val()!=this.text&&(t=this.$element.val()===""||this.strict?"":this.$element.val(),this.$element.val(t),this.$element.attr("data-value",t),this.text=t,typeof this.$target!="undefined"&&this.$target.val(t))},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mous
edover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',ajaxdelay:400,minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).off("focus.typeahead.data-api").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;n.is("select")&&n.attr("autofocus",!0),t.preventDefault(),n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=window.orientation!==undefined,n=navigator.userAgent.toLowerCase().indexOf
("android")>-1,r=function(t,r){if(n)return;this.$element=e(t),this.options=e.extend({},e.fn.inputmask.defaults,r),this.mask=String(r.mask),this.init(),this.listen(),this.checkVal()};r.prototype={init:function(){var t=this.options.definitions,n=this.mask.length;this.tests=[],this.partialPosition=this.mask.length,this.firstNonMaskPos=null,e.each(this.mask.split(""),e.proxy(function(e,r){r=="?"?(n--,this.partialPosition=e):t[r]?(this.tests.push(new RegExp(t[r])),this.firstNonMaskPos===null&&(this.firstNonMaskPos=this.tests.length-1)):this.tests.push(null)},this)),this.buffer=e.map(this.mask.split(""),e.proxy(function(e,n){if(e!="?")return t[e]?this.options.placeholder:e},this)),this.focusText=this.$element.val(),this.$element.data("rawMaskFn",e.proxy(function(){return e.map(this.buffer,function(e,t){return this.tests[t]&&e!=this.options.placeholder?e:null}).join("")},this))},listen:function(){if(this.$element.attr("readonly"))return;var t=(navigator.userAgent.match(/msie/i)?"paste":"in
put")+".mask";this.$element.on("unmask",e.proxy(this.unmask,this)).on("focus.mask",e.proxy(this.focusEvent,this)).on("blur.mask",e.proxy(this.blurEvent,this)).on("keydown.mask",e.proxy(this.keydownEvent,this)).on("keypress.mask",e.proxy(this.keypressEvent,this)).on(t,e.proxy(this.pasteEvent,this))},caret:function(e,t){if(this.$element.length===0)return;if(typeof e=="number")return t=typeof t=="number"?t:e,this.$element.each(function(){if(this.setSelectionRange)this.setSelectionRange(e,t);else if(this.createTextRange){var n=this.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select()}});if(this.$element[0].setSelectionRange)e=this.$element[0].selectionStart,t=this.$element[0].selectionEnd;else if(document.selection&&document.selection.createRange){var n=document.selection.createRange();e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length}return{begin:e,end:t}},seekNext:function(e){var t=this.mask.length;while(++e<=t&&!this.tests[e]);
return e},seekPrev:function(e){while(--e>=0&&!this.tests[e]);return e},shiftL:function(e,t){var n=this.mask.length;if(e<0)return;for(var r=e,i=this.seekNext(t);r<n;r++)if(this.tests[r]){if(!(i<n&&this.tests[r].test(this.buffer[i])))break;this.buffer[r]=this.buffer[i],this.buffer[i]=this.options.placeholder,i=this.seekNext(i)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,e))},shiftR:function(e){var t=this.mask.length;for(var n=e,r=this.options.placeholder;n<t;n++)if(this.tests[n]){var i=this.seekNext(n),s=this.buffer[n];this.buffer[n]=r;if(!(i<t&&this.tests[i].test(s)))break;r=s}},unmask:function(){this.$element.unbind(".mask").removeData("inputmask")},focusEvent:function(){this.focusText=this.$element.val();var t=this.mask.length,n=this.checkVal();this.writeBuffer();var r=this,i=function(){n==t?r.caret(0,n):r.caret(n)};e.browser.msie?i():setTimeout(i,0)},blurEvent:function(){this.checkVal(),this.$element.val()!=this.focusText&&this.$element.trigger("change")},keydownEv
ent:function(e){var n=e.which;if(n==8||n==46||t&&n==127){var r=this.caret(),i=r.begin,s=r.end;return s-i===0&&(i=n!=46?this.seekPrev(i):s=this.seekNext(i-1),s=n==46?this.seekNext(s):s),this.clearBuffer(i,s),this.shiftL(i,s-1),!1}if(n==27)return this.$element.val(this.focusText),this.caret(0,this.checkVal()),!1},keypressEvent:function(e){var t=this.mask.length,n=e.which,r=this.caret();if(e.ctrlKey||e.altKey||e.metaKey||n<32)return!0;if(n){r.end-r.begin!==0&&(this.clearBuffer(r.begin,r.end),this.shiftL(r.begin,r.end-1));var i=this.seekNext(r.begin-1);if(i<t){var s=String.fromCharCode(n);if(this.tests[i].test(s)){this.shiftR(i),this.buffer[i]=s,this.writeBuffer();var o=this.seekNext(i);this.caret(o)}}return!1}},pasteEvent:function(){var e=this;setTimeout(function(){e.caret(e.checkVal(!0))},0)},clearBuffer:function(e,t){var n=this.mask.length;for(var r=e;r<t&&r<n;r++)this.tests[r]&&(this.buffer[r]=this.options.placeholder)},writeBuffer:function(){return this.$element.val(this.buffer.joi
n("")).val()},checkVal:function(e){var t=this.mask.length,n=this.$element.val(),r=-1;for(var i=0,s=0;i<t;i++)if(this.tests[i]){this.buffer[i]=this.options.placeholder;while(s++<n.length){var o=n.charAt(s-1);if(this.tests[i].test(o)){this.buffer[i]=o,r=i;break}}if(s>n.length)break}else this.buffer[i]==n.charAt(s)&&i!=this.partialPosition&&(s++,r=i);if(!e&&r+1<this.partialPosition)this.$element.val(""),this.clearBuffer(0,t);else if(e||r+1>=this.partialPosition)this.writeBuffer(),e||this.$element.val(this.$element.val().substring(0,r+1));return this.partialPosition?i:this.firstNonMaskPos}},e.fn.inputmask=function(t){return this.each(function(){var n=e(this),i=n.data("inputmask");i||n.data("inputmask",i=new r(this,t))})},e.fn.inputmask.defaults={mask:"",placeholder:"_",definitions:{9:"[0-9]",a:"[A-Za-z]","?":"[A-Za-z0-9]","*":"."}},e.fn.inputmask.Constructor=r,e(document).on("focus.inputmask.data-api","[data-mask]",function(t){var n=e(this);if(n.data("inputmask"))return;t.preventDefault
(),n.inputmask(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){n=e.extend({},e.fn.rowlink.defaults,n);var r=t.nodeName.toLowerCase()=="tr"?e(t):e(t).find("tr:has(td)");r.each(function(){var t=e(this).find(n.target).first();if(!t.length)return;var r=t.attr("href");e(this).find("td").not(".nolink").click(function(){window.location=r}),e(this).addClass("rowlink"),t.replaceWith(t.html())})};e.fn.rowlink=function(n){return this.each(function(){var r=e(this),i=r.data("rowlink");i||r.data("rowlink",i=new t(this,n))})},e.fn.rowlink.defaults={target:"a"},e.fn.rowlink.Constructor=t,e(function(){e('[data-provide="rowlink"],[data-provides="rowlink"]').each(function(){e(this).rowlink(e(this).data())})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file"),this.$input=this.$element.find(":file");if(this.$input.length===0)return;this.name=this
.$input.attr("name")||n.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),this.$hidden.length===0&&(this.$hidden=e('<input type="hidden" />'),this.$element.prepend(this.$hidden)),this.$preview=this.$element.find(".fileupload-preview");var r=this.$preview.css("height");this.$preview.css("display")!="inline"&&r!="0px"&&r!="none"&&this.$preview.css("line-height",r),this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.$remove=this.$element.find('[data-dismiss="fileupload"]'),this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",e.proxy(this.trigger,this)),this.listen()};t.prototype={listen:function(){this.$input.on("change.fileupload",e.proxy(this.change,this)),e(this.$input[0].form).on("reset.fileupload",e.proxy(this.reset,this)),this.$remove&&this.$remove.on("click.fileupload",e.proxy(this.clear,this))},change:function(e,t){if(t==="clear")return;var n=e.target.
files!==undefined?e.target.files[0]:e.target.value?{name:e.target.value.replace(/^.+\\/,"")}:null;if(!n){this.clear();return}this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name);if(this.type==="image"&&this.$preview.length>0&&(typeof n.type!="undefined"?n.type.match("image.*"):n.name.match(/\.(gif|png|jpe?g)$/i))&&typeof FileReader!="undefined"){var r=new FileReader,i=this.$preview,s=this.$element;r.onload=function(e){i.html('<img src="'+e.target.result+'" '+(i.css("max-height")!="none"?'style="max-height: '+i.css("max-height")+';"':"")+" />"),s.addClass("fileupload-exists").removeClass("fileupload-new")},r.readAsDataURL(n)}else this.$preview.text(n.name),this.$element.addClass("fileupload-exists").removeClass("fileupload-new")},clear:function(e){this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name","");if(navigator.userAgent.match(/msie/i)){var t=this.$input.clone(!0);this.$input.after(t),this.$input.remove(),this.$input=t}
else this.$input.val("");this.$preview.html(""),this.$element.addClass("fileupload-new").removeClass("fileupload-exists"),e&&(this.$input.trigger("change",["clear"]),e.preventDefault())},reset:function(e){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(e){this.$input.trigger("click"),e.preventDefault()}},e.fn.fileupload=function(n){return this.each(function(){var r=e(this),i=r.data("fileupload");i||r.data("fileupload",i=new t(this,n)),typeof n=="string"&&i[n]()})},e.fn.fileupload.Constructor=t,e(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(t){var n=e(this);if(n.data("fileupload"))return;n.fileupload(n.data());var r=e(t.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');r.length>0&&(r.trigger(
"click.fileupload"),t.preventDefault())})}(window.jQuery);
\ No newline at end of file
Propchange: incubator/climate/branches/rcmet-2.1.1/src/main/ui/app/js/jasny-bootstrap.min.js
------------------------------------------------------------------------------
svn:executable = *