Ext.ux.Portal = Ext.extend(Ext.Panel, {layout: 'column',autoScroll:true,cls:'x-portal',defaultType: 'portalcolumn',initComponent : function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true});},initEvents : function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd = new Ext.ux.Portal.DropZone(this, this.dropConfig);}});Ext.ux.Portal.DropZone = function(portal, cfg){this.portal = portal;Ext.dd.ScrollManager.register(portal.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,portal.bwrap.dom, cfg);portal.body.ddScrollConfig = this.ddScrollConfig;};Ext.extend(Ext.ux.Portal.DropZone, Ext.dd.DropTarget, {ddScrollConfig : {vthresh: 50,hthresh: -1,animate: true,increment: 200},createEvent : function(dd, e, data, col, c, pos){return {portal: this.portal,panel: data.panel,columnIndex: col,column: c,position: pos,data: data,source: dd,rawEvent: e,status: this.dropAllowed};},notifyOver : function(dd, e, data){var xy = e.getXY(), portal = this.portal, px = dd.proxy;if(!this.grid){this.grid = this.getGrid();}var cw = portal.body.dom.clientWidth;if(!this.lastCW){this.lastCW = cw;}else if(this.lastCW != cw){this.lastCW = cw;portal.doLayout();this.grid = this.getGrid();}var col = 0, xs = this.grid.columnX, cmatch = false;for(var len = xs.length; col < len; col++){if(xy[0] < (xs[col].x + xs[col].w)){cmatch = true;break;}}if(!cmatch){col--;}var p, match = false, pos = 0,c = portal.items.itemAt(col),items = c.items.items;for(var len = items.length; pos < len; pos++){p = items[pos];var h = p.el.getHeight();if(h !== 0 && (p.el.getY()+(h/2)) > xy[1]){match = true;break;}}var overEvent = this.createEvent(dd, e, data, col, c,match && p ? pos : c.items.getCount());if(portal.fireEvent('validatedrop', overEvent) !== false &&portal.fireEvent('beforedragover',overEvent) !== false){px.getProxy().setWidth('auto');if(p){px.moveProxy(p.el.dom.parentNode, match ? p.el.dom : null);}else{px.moveProxy(c.el.dom, null);}this.lastPos = {c: c, col: col, p: match && p ? pos : false};this.scrollPos = portal.body.getScroll();portal.fireEvent('dragover', overEvent);return overEvent.status;}else{return overEvent.status;}},notifyOut : function(){delete this.grid;},notifyDrop : function(dd, e, data){delete this.grid;if(!this.lastPos){return;}var c = this.lastPos.c, col = this.lastPos.col, pos = this.lastPos.p;var dropEvent = this.createEvent(dd, e, data, col, c,pos !== false ? pos : c.items.getCount());if(this.portal.fireEvent('validatedrop', dropEvent) !== false &&this.portal.fireEvent('beforedrop', dropEvent) !== false){dd.proxy.getProxy().remove();dd.panel.el.dom.parentNode.removeChild(dd.panel.el.dom);if(pos !== false){c.insert(pos, dd.panel);}else{c.add(dd.panel);}c.doLayout();this.portal.fireEvent('drop', dropEvent);var st = this.scrollPos.top;if(st){var d = this.portal.body.dom;setTimeout(function(){d.scrollTop = st;}, 10);}}delete this.lastPos;},getGrid : function(){var box = this.portal.bwrap.getBox();box.columnX = [];this.portal.items.each(function(c){box.columnX.push({x: c.el.getX(), w: c.el.getWidth()});});return box;}});Ext.ux.PortalColumn = Ext.extend(Ext.Container, {layout: 'anchor',autoEl: 'div',defaultType: 'portlet',cls:'x-portal-column'});Ext.reg('portalcolumn', Ext.ux.PortalColumn);Ext.ux.Portlet = Ext.extend(Ext.Panel, {anchor: '100%',frame:true,collapsible:true,draggable:true,cls:'x-portlet'});Ext.reg('portlet', Ext.ux.Portlet);Ext.state.Manager.setProvider(new Ext.state.CookieProvider());var tools = [{title:'sd',text:'test',handler: function(){Ext.Msg.alert('Message', 'The Settings tool was clicked.');}},{id:'close',handler: function(e, target, panel){panel.ownerCt.remove(panel, true);}}];Ext.reg('portal', Ext.ux.Portal);Ext.state.Manager.setProvider(new Ext.state.CookieProvider());var viewport = new Ext.Viewport({layout:'border',items:[new Ext.BoxComponent({ region:'north',el: 'MAIN_NORTH',height:32}),{region:'west',id:'west-panel',title:'Promemoria',split:true,width: 320,minSize: 175,maxSize: 400,collapsible: true,margins:'0 0 0 5',items: [{xtype:'portal',region:'center',margins:'35 5 5 0',items:[{style:'padding:10px 0 10px 10px',items:[{contentEl: 'IDFILTRIPERSONAL',tools:[{id:'plus',handler: function(){for (var item in arrayData['AIP'][11]['FILTER']['PERSONAL']['ID']) {arrayData['AIP'][11]['FILTER']['PERSONAL'][item]=1;}furoros.Runmodule('11','REFRESH_PERSONAL','APP','');furoros.Runmodule('11','REFRESH_ROOM','APP','');furoros.Runmodule('11','REFRESH_SPEC','APP','');furoros.Runmodule('11','REFRESH_CALENDAR_MAIN','APP','');}},{id:'minus',handler: function(){for (var item in arrayData['AIP'][11]['FILTER']['PERSONAL']['ID']) {arrayData['AIP'][11]['FILTER']['PERSONAL'][item]=0;}furoros.Runmodule('11','REFRESH_PERSONAL','APP','');furoros.Runmodule('11','REFRESH_ROOM','APP','');furoros.Runmodule('11','REFRESH_SPEC','APP','');furoros.Runmodule('11','REFRESH_CALENDAR_MAIN','APP','');}}],title: 'PERSONALE',html: ''},{contentEl: 'IDFILTRIROOM',title: 'STANZE',html: '',tools:[{id:'minus',handler: function(){for (var item in arrayData['AIP'][11]['FILTER']['ROOM']['ID']) {arrayData['AIP'][11]['FILTER']['ROOM'][item]=0;}furoros.Runmodule('11','REFRESH_ROOM','APP','');furoros.Runmodule('11','REFRESH_SPEC','APP','');furoros.Runmodule('11','REFRESH_PERSONAL','APP','');furoros.Runmodule('11','REFRESH_CALENDAR_MAIN','APP','');}}]},{contentEl: 'IDFILTRISPEC',title: 'SPECIALITA&apos;',html: '',tools:[{id:'minus',handler: function(){for (var item in arrayData['AIP'][11]['FILTER']['SPEC']['ID']) {arrayData['AIP'][11]['FILTER']['SPEC'][item]=0;}for (var item in arrayData['AIP'][11]['FILTER']['SPECSPEC']['ID']) {arrayData['AIP'][11]['FILTER']['SPECSPEC'][item]=0;}furoros.Runmodule('11','REFRESH_SPEC','APP','');furoros.Runmodule('11','REFRESH_ROOM','APP','');furoros.Runmodule('11','REFRESH_PERSONAL','APP','');furoros.Runmodule('11','REFRESH_CALENDAR_MAIN','APP','');}}]},{contentEl: 'IDFILTRITOOLS',title: 'TOOLS',html: ''}]}]},{contentEl: 'MAIN_WEST',border:false}]},new Ext.TabPanel({id:'MAIN_TP',region:'center',deferredRender:false,activeTab:0,items:[{contentEl:'MAIN_CENTER1',html:'<br/><br/><br/><table align=center border=0 width=70%><tr><td><h2>Benvenuto.</h2><br/><p><font size=4 color=#376CAD>G</font><b>estione appuntamenti On Line</b> &egrave; un gestionale on-line che permette ...</p></td></tr></table>',title: 'Benvenuto',closable:true,autoScroll:true},{contentEl:'IDAID11DIVCALENDAR',html:'',title: 'Calendario',closable:false,autoScroll:true}]})]});