/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(i,e){return e()})(["./kendo.draganddrop.min"],function(){!function(i,e){function t(i){return e!==i}function n(i,e,t){return Math.max(Math.min(parseInt(i,10),1/0===t?t:parseInt(t,10)),parseInt(e,10))}function o(i,e){var t=i.children(b);return t.data("kendoWindow")||t.data("kendo"+e)}function r(e){return i(x).filter(function(){var t=i(this),n=o(t,e);return n.options.modal&&t.is(O)&&n.options.visible}).sort(function(e,t){return+i(e).css("zIndex")-+i(t).css("zIndex")})}function s(i,e){return function(){var t=this,n=t.wrapper,o=n[0].style,r=t.options;if(!r.isMaximized&&!r.isMinimized)return t.restoreOptions={width:o.width,height:o.height},n.find(_).hide().end().find(U).parent().hide().eq(0).before(Y.action({name:"Restore"})),e.call(t),"maximize"==i?t.wrapper.find(y).find(Q).parent().hide():t.wrapper.find(y).find(Q).parent().show(),t}}function a(i){var e=this;e.owner=i,e._draggable=new p(i.wrapper,{filter:_,group:i.wrapper.id+"-resizing",dragstart:u(e.dragstart,e),drag:u(e.drag,e),dragend:u(e.dragend,e)})}function d(i,e){var t=this;t.owner=i,t._draggable=new p(i.wrapper,{filter:e,group:i.wrapper.id+"-moving",dragstart:u(t.dragstart,t),drag:u(t.drag,t),dragend:u(t.dragend,t),dragcancel:u(t.dragcancel,t)})}var l=window.kendo,c=l.ui.Widget,p=l.ui.Draggable,h=i.isPlainObject,f=l._activeElement,u=i.proxy,m=i.extend,g=i.each,w=l.template,v="body",k=".kendoWindow",x=".k-window",z=".k-window-title",y=z+"bar",b=".k-window-content",_=".k-resize-handle",T=".k-overlay",M="k-content-frame",W="k-loading",H="k-state-hover",C="k-state-focused",O=":visible",S="hidden",P="cursor",I="open",D="activate",F="deactivate",L="close",R="refresh",A="resize",q="dragstart",E="dragend",j="error",N="overflow",G="zIndex",U=".k-window-actions .k-i-minimize,.k-window-actions .k-i-maximize",K=".k-i-pin",B=".k-i-unpin",Q=K+","+B,J=".k-window-titlebar .k-window-action",V=l.isLocalUrl,X=c.extend({init:function(n,o){var r,s,p,f,m,w,v=this,_={},T=!1,M=o&&o.actions&&!o.actions.length;c.fn.init.call(v,n,o),o=v.options,n=v.element,f=o.content,M&&(o.actions=[]),v.appendTo=i(o.appendTo||document.body),v._animations(),f&&!h(f)&&(f=o.content={url:f}),n.find("script").filter(function(){return!this.type||this.type.toLowerCase().indexOf("script")>=0}).remove(),n.parent().is(v.appendTo)||o.position.top!==e&&o.position.left!==e||(n.is(O)?(_=n.offset(),T=!0):(s=n.css("visibility"),p=n.css("display"),n.css({visibility:S,display:""}),_=n.offset(),n.css({visibility:s,display:p}))),t(o.visible)&&null!==o.visible||(o.visible=n.is(O)),r=v.wrapper=n.closest(x),n.is(".k-content")&&r[0]||(n.addClass("k-window-content k-content"),v._createWindow(n,o),r=v.wrapper=n.closest(x),v._dimensions()),r.css({top:o.position.top||_.top||"",left:o.position.left||_.left||""}),o.pinned&&v.pin(!0),f&&v.refresh(f),o.visible&&v.toFront(),m=r.children(b),v._tabindex(m),o.visible&&o.modal&&v._overlay(r.is(O)).css({opacity:.5}),r.on("mouseenter"+k,J,function(){i(this).addClass(H)}).on("mouseleave"+k,J,function(){i(this).removeClass(H)}).on("click"+k,J,u(v._windowActionHandler,v)),m.on("keydown"+k,u(v._keydown,v)).on("focus"+k,function(){r.addClass(C)}).on("blur"+k,function(){r.removeClass(C)}),o.resizable&&(r.on("dblclick"+k,y,function(e){return i(e.target).closest(".k-window-action").length||v.toggleMaximization(),this}),g("n e s w se sw ne nw".split(" "),function(i,e){r.append(Y.resizeHandle(e))}),v.resizing=new a(v)),o.draggable&&(v.dragging=new d(v,o.draggable.dragHandle||y)),w=n.attr("id"),w&&(w+="_wnd_title",r.find(y).children(z).attr("id",w),m.attr({role:"dialog","aria-labelledby":w})),r.add(r.find(".k-resize-handle,.k-window-titlebar")).on("mousedown"+k,u(v.toFront,v)),v.touchScroller=l.touchScroller(n),v._resizeHandler=function(i){return v._onDocumentResize(i)},i(window).on("resize",v._resizeHandler),o.visible&&(v.trigger(I),v.trigger(D)),l.notify(v)},_dimensions:function(){var i=this,e=i.wrapper,t=i.options,o=t.width,r=t.height,s=t.maxHeight;i.title(t.title),g(["minWidth","minHeight","maxWidth","maxHeight"],function(i,n){var o=t[n];o&&1/0!=o&&e.css(n,o)}),s&&1/0!=s&&i.element.css("maxHeight",s),o&&((""+o).indexOf("%")>0?e.width(o):e.width(n(o,t.minWidth,t.maxWidth))),r&&((""+r).indexOf("%")>0?e.height(r):e.height(n(r,t.minHeight,t.maxHeight))),t.visible||e.hide()},_animations:function(){var i=this.options;i.animation===!1&&(i.animation={open:{effects:{}},close:{hide:!0,effects:{}}})},setOptions:function(i){c.fn.setOptions.call(this,i),this._animations(),this._dimensions()},events:[I,D,F,L,R,A,q,E,j],options:{name:"Window",animation:{open:{effects:{zoom:{direction:"in"},fade:{direction:"in"}},duration:350},close:{effects:{zoom:{direction:"out",properties:{scale:.7}},fade:{direction:"out"}},duration:350,hide:!0}},title:"",actions:["Close"],autoFocus:!0,modal:!1,resizable:!0,draggable:!0,minWidth:90,minHeight:50,maxWidth:1/0,maxHeight:1/0,pinned:!1,position:{},content:null,visible:null,height:null,width:null},_closable:function(){return i.inArray("close",i.map(this.options.actions,function(i){return i.toLowerCase()}))>-1},_keydown:function(i){var e,t,o,r,s=this,a=s.options,d=l.keys,c=i.keyCode,p=s.wrapper,h=10,f=s.options.isMaximized;i.target!=i.currentTarget||s._closing||(c==d.ESC&&s._closable()&&s._close(!0),!a.draggable||i.ctrlKey||f||(e=l.getOffset(p),c==d.UP?t=p.css("top",e.top-h):c==d.DOWN?t=p.css("top",e.top+h):c==d.LEFT?t=p.css("left",e.left-h):c==d.RIGHT&&(t=p.css("left",e.left+h))),a.resizable&&i.ctrlKey&&!f&&(c==d.UP?(t=!0,r=p.height()-h):c==d.DOWN&&(t=!0,r=p.height()+h),c==d.LEFT?(t=!0,o=p.width()-h):c==d.RIGHT&&(t=!0,o=p.width()+h),t&&(p.css({width:n(o,a.minWidth,a.maxWidth),height:n(r,a.minHeight,a.maxHeight)}),s.trigger(A))),t&&i.preventDefault())},_overlay:function(e){var t=this.appendTo.children(".k-overlay"),n=this.wrapper;return t.length||(t=i("
")),t.insertBefore(n[0]).toggle(e).css(G,parseInt(n.css(G),10)-1),t},_windowActionHandler:function(t){var n=i(t.target).closest(".k-window-action").find(".k-icon"),o=this;o._closing||g({"k-i-close":function(){o._close(!0)},"k-i-maximize":o.maximize,"k-i-minimize":o.minimize,"k-i-restore":o.restore,"k-i-refresh":o.refresh,"k-i-pin":o.pin,"k-i-unpin":o.unpin},function(i,r){return n.hasClass(i)?(t.preventDefault(),r.call(o),!1):e})},center:function(){var e=this,t=e.wrapper,n=i(window);return e.options.isMaximized?e:(t.css({left:n.scrollLeft()+Math.max(0,(n.width()-t.width())/2),top:n.scrollTop()+Math.max(0,(n.height()-t.height())/2)}),e)},title:function(i){var e=this,t=e.wrapper,n=e.options,o=t.find(y),r=o.children(z),s=o.outerHeight();return arguments.length?(i===!1?(t.addClass("k-window-titleless"),o.remove()):(o.length||t.prepend(Y.titlebar(m(Y,n))),t.css("padding-top",s),o.css("margin-top",-s)),r.text(i),e):r.text()},content:function(i){var e=this.wrapper.children(b),t=e.children(".km-scroll-container");return e=t[0]?t:e,i?(l.destroy(this.element.children()),e.html(i),this):e.html()},open:function(){var e,t=this,n=t.wrapper,o=t.options,r=o.animation.open,s=n.children(b),a=s.css(N);return t.trigger(I)||(t._closing&&n.kendoStop(!0,!0),t._closing=!1,t.toFront(),o.autoFocus&&t.element.focus(),o.visible=!0,o.modal&&(e=t._overlay(!1),r.duration?e.kendoStop().kendoAnimate({effects:"fade:in",duration:r.duration}).show():e.css("opacity",.5).show()),n.is(O)||(s.css(N,S),n.show().kendoStop().kendoAnimate({effects:r.effects,duration:r.duration,complete:function(){o.autoFocus&&t.element.focus(),t.trigger(D),s.css(N,a)}}))),o.isMaximized&&(t._documentScrollTop=i(document).scrollTop(),i("html, body").css(N,S)),t},_close:function(t){var n,s,a,d=this,l=d.wrapper,c=d.options,p=c.animation.open,h=c.animation.close;l.is(O)&&!d.trigger(L,{userTriggered:!!t})&&(d._closing=!0,c.visible=!1,i(x).each(function(e,t){var n=i(t),o=n.find(b);t!=l&&o.find("> ."+M).length>0&&o.children(".k-overlay").remove()}),n=r(c.name),s=c.modal&&!n.length,a=c.modal?d._overlay(!0):i(e),s?h.duration?a.kendoStop().kendoAnimate({effects:"fade:out",duration:h.duration,hide:!0}):a.hide():n.length&&o(n.eq(n.length-1),c.name)._overlay(!0),l.kendoStop().kendoAnimate({effects:h.effects||p.effects,reverse:h.reverse===!0,duration:h.duration,complete:function(){l.hide(),d.trigger(F)}})),d.options.isMaximized&&(i("html, body").css(N,""),d._documentScrollTop&&d._documentScrollTop>0&&i(document).scrollTop(d._documentScrollTop))},close:function(){return this._close(!1),this},toFront:function(e){var t,n,o=this,r=o.wrapper,s=r[0],a=+r.css(G),d=a,l=f(),c=o.element,p=e&&e.target?e.target:null;return i(x).each(function(e,t){var n=i(t),o=n.css(G),r=n.find(b);isNaN(o)||(a=Math.max(+o,a)),t!=s&&r.find("> ."+M).length>0&&r.append(Y.overlay)}),(10001==a||a>d)&&r.css(G,a+2),o.element.find("> .k-overlay").remove(),!o.options.autoFocus||i(l).is(c)||i(p).is(J+","+J+" .k-icon,:input,a")||c.find(l).length&&c.find(p).length||(c.focus(),t=i(window).scrollTop(),n=parseInt(o.wrapper.position().top,10),n>0&&0>n-t&&(t>0?i(window).scrollTop(n):o.wrapper.css("top",t))),o},toggleMaximization:function(){return this._closing?this:this[this.options.isMaximized?"restore":"maximize"]()},restore:function(){var e=this,t=e.options,n=e.restoreOptions;if(t.isMaximized||t.isMinimized)return e.wrapper.css({position:e.options.pinned?"fixed":"absolute",left:n.left,top:n.top,width:n.width,height:n.height}).find(".k-window-content,.k-resize-handle").show().end().find(".k-window-titlebar .k-i-restore").parent().remove().end().end().find(U).parent().show().end().end().find(Q).parent().show(),i("html, body").css(N,""),this._documentScrollTop&&this._documentScrollTop>0&&i(document).scrollTop(this._documentScrollTop),t.isMaximized=t.isMinimized=!1,e.trigger(A),e},maximize:s("maximize",function(){var e=this,t=e.wrapper,n=t.position();m(e.restoreOptions,{left:n.left,top:n.top}),t.css({left:0,top:0,position:"fixed"}),this._documentScrollTop=i(document).scrollTop(),i("html, body").css(N,S),e.options.isMaximized=!0,e._onDocumentResize()}),minimize:s("minimize",function(){var i=this;i.wrapper.css("height",""),i.element.hide(),i.options.isMinimized=!0}),pin:function(e){var t=this,n=i(window),o=t.wrapper,r=parseInt(o.css("top"),10),s=parseInt(o.css("left"),10);(e||!t.options.pinned&&!t.options.isMaximized)&&(o.css({position:"fixed",top:r-n.scrollTop(),left:s-n.scrollLeft()}),o.find(y).find(K).addClass("k-i-unpin").removeClass("k-i-pin"),t.options.pinned=!0)},unpin:function(){var e=this,t=i(window),n=e.wrapper,o=parseInt(n.css("top"),10),r=parseInt(n.css("left"),10);e.options.pinned&&!e.options.isMaximized&&(n.css({position:"",top:o+t.scrollTop(),left:r+t.scrollLeft()}),n.find(y).find(B).addClass("k-i-pin").removeClass("k-i-unpin"),e.options.pinned=!1)},_onDocumentResize:function(){var e=this,t=e.wrapper,n=i(window);e.options.isMaximized&&(t.css({width:n.width(),height:n.height()-parseInt(t.css("padding-top"),10)}),e.trigger(A))},refresh:function(e){var n,o,r,s=this,a=s.options,d=i(s.element);return h(e)||(e={url:e}),e=m({},a.content,e),o=t(a.iframe)?a.iframe:e.iframe,r=e.url,r?(t(o)||(o=!V(r)),o?(n=d.find("."+M)[0],n?n.src=r||n.src:d.html(Y.contentFrame(m({},a,{content:e}))),d.find("."+M).unbind("load"+k).on("load"+k,function(){s.trigger(R)})):s._ajaxRequest(e)):(e.template&&s.content(w(e.template)({})),s.trigger(R)),s},_ajaxRequest:function(e){var t=this,n=e.template,o=t.wrapper.find(".k-window-titlebar .k-i-refresh"),r=setTimeout(function(){o.addClass(W)},100);i.ajax(m({type:"GET",dataType:"html",cache:!1,error:u(function(i,e){t.trigger(j,{status:e,xhr:i})},t),complete:function(){clearTimeout(r),o.removeClass(W)},success:u(function(i){n&&(i=w(n)(i||{})),t.content(i),t.element.prop("scrollTop",0),t.trigger(R)},t)},e))},destroy:function(){var e,t,n=this;c.fn.destroy.call(n),l.destroy(n.wrapper),n.resizing&&n.resizing.destroy(),n.dragging&&n.dragging.destroy(),n.element.children("iframe").remove(),n.wrapper.remove().add(n.wrapper.find(".k-resize-handle,.k-window-titlebar")).off(k),i(window).off("resize",n._resizeHandler),e=r(),t=n.options.modal&&!e.length,t?n._overlay(!1).remove():e.length>0&&o(e.eq(e.length-1),n.options.name)._overlay(!0)},_createWindow:function(){var e,t,n=this,o=n.element,r=n.options,s=l.support.isRtl(o);r.scrollable===!1&&o.attr("style","overflow:hidden;"),t=i(Y.wrapper(r)),r.title!==!1&&t.append(Y.titlebar(m(Y,r))),e=o.find("iframe:not(.k-content)").map(function(){var i=this.getAttribute("src");return this.src="",i}),t.toggleClass("k-rtl",s).appendTo(n.appendTo).append(o).find("iframe:not(.k-content)").each(function(i){this.src=e[i]}),t.find(".k-window-title").css(s?"left":"right",t.find(".k-window-actions").outerWidth()+10),o.show(),o.find("[data-role=editor]").each(function(){var e=i(this).data("kendoEditor");e&&e.refresh()})}}),Y={wrapper:w("
"),action:w("#= name #"),titlebar:w("
 #= title #
# for (var i = 0; i < actions.length; i++) { ##= action({ name: actions[i] }) ## } #
"),overlay:"
",contentFrame:w(""),resizeHandle:w("
")};a.prototype={dragstart:function(e){var t=this,n=t.owner,o=n.wrapper;t.elementPadding=parseInt(n.wrapper.css("padding-top"),10),t.initialCursorPosition=l.getOffset(o,"position"),t.resizeDirection=e.currentTarget.prop("className").replace("k-resize-handle k-resize-",""),t.initialSize={width:o.width(),height:o.height()},t.containerOffset=l.getOffset(n.appendTo),o.append(Y.overlay).find(_).not(e.currentTarget).hide(),i(v).css(P,e.currentTarget.css(P))},drag:function(i){var e,t,o,r,s=this,a=s.owner,d=a.wrapper,l=a.options,c=s.resizeDirection,p=s.containerOffset,h=s.initialCursorPosition,f=s.initialSize,u=Math.max(i.x.location,p.left),m=Math.max(i.y.location,p.top);c.indexOf("e")>=0?(e=u-h.left,d.width(n(e,l.minWidth,l.maxWidth))):c.indexOf("w")>=0&&(r=h.left+f.width,e=n(r-u,l.minWidth,l.maxWidth),d.css({left:r-e-p.left,width:e})),c.indexOf("s")>=0?(t=m-h.top-s.elementPadding,d.height(n(t,l.minHeight,l.maxHeight))):c.indexOf("n")>=0&&(o=h.top+f.height,t=n(o-m,l.minHeight,l.maxHeight),d.css({top:o-t-p.top,height:t})),a.trigger(A)},dragend:function(e){var t=this,n=t.owner,o=n.wrapper;return o.find(T).remove().end().find(_).not(e.currentTarget).show(),i(v).css(P,""),n.touchScroller&&n.touchScroller.reset(),27==e.keyCode&&o.css(t.initialCursorPosition).css(t.initialSize),!1},destroy:function(){this._draggable.destroy()}},d.prototype={dragstart:function(e){var t=this.owner,n=t.element,o=n.find(".k-window-actions"),r=l.getOffset(t.appendTo);t.trigger(q),t.initialWindowPosition=l.getOffset(t.wrapper,"position"),t.startPosition={left:e.x.client-t.initialWindowPosition.left,top:e.y.client-t.initialWindowPosition.top},t.minLeftPosition=o.length>0?o.outerWidth()+parseInt(o.css("right"),10)-n.outerWidth():20-n.outerWidth(),t.minLeftPosition-=r.left,t.minTopPosition=-r.top,t.wrapper.append(Y.overlay).find(_).hide(),i(v).css(P,e.currentTarget.css(P))},drag:function(e){var t=this.owner,n={left:Math.max(e.x.client-t.startPosition.left,t.minLeftPosition),top:Math.max(e.y.client-t.startPosition.top,t.minTopPosition)};i(t.wrapper).css(n)},_finishDrag:function(){var e=this.owner;e.wrapper.find(_).toggle(!e.options.isMinimized).end().find(T).remove(),i(v).css(P,"")},dragcancel:function(i){this._finishDrag(),i.currentTarget.closest(x).css(this.owner.initialWindowPosition)},dragend:function(){return this._finishDrag(),this.owner.trigger(E),!1},destroy:function(){this._draggable.destroy()}},l.ui.plugin(X)}(window.kendo.jQuery)});