function getShouts(){this.createStore=function(){this.store=new Ext.data.JsonStore({url:'/modules/shoutbox/pages/shout.php?page=getShouts',root:'data',fields:['userID','userName','message','shoutID','date','userIP']});this.store.sort('date');};this.getMyStore=function(){return this.store;};this.reloadMyStore=function(){this.store.load();};this.countRecords=function(){return this.store.getTotalCount();};return this.store;};function createShoutBox(){var maxLength=70;var shoutButton=new Ext.Button({text:'Shout it',minWidth:95,iconCls:'write',handler:function(){postShout();}});var shoutReloadButton=new Ext.Button({text:'Herlaad',minWidth:95,iconCls:'refresh',handler:function(){showMembersGrid.getStore().load();}});var yourText=new Ext.form.TextField({fieldLabel:'Bericht ',maxLength:maxLength,width:430});var shoutBoxPanel=new Ext.Panel({frame:true,buttons:[shoutReloadButton,shoutButton,yourText]});var store=new getShouts();store.createStore();store.reloadMyStore();var newStore=store.getMyStore();var loadMask=new Ext.LoadMask(Ext.getBody(),{msg:'laden...',store:newStore});var showMembersGrid=new Ext.grid.GridPanel({loadMask:loadMask,title:'Shoutbox',frame:true,id:'shoutboxGrid',renderTo:'shoutBoxPanel',width:650,bbar:shoutBoxPanel,height:295,frame:false,iconCls:'icon-grid',store:newStore,cm:new Ext.grid.ColumnModel([{header:'Naam',width:100,sortable:true,renderer:function(a){a="<b>"+a+"</b>";return a;},dataIndex:'userName'},{header:'Datum',width:115,sortable:true,dataIndex:'date'},{header:'Bericht',width:430,sortable:true,dataIndex:'message'}])});function postShout(){var userText=yourText.getValue();if(userText.length>maxLength){alert("Maximale tekst lengte is "+maxLength);return;}yourText.setValue('');if(userText==''||userText==null){siteFunctions.checkResultAlert(false,'Voer eerst je bericht in.');return;}var conn=new Ext.data.Connection();conn.request({url:'modules/shoutbox/pages/shout.php',method:'POST',params:{'page':'shoutnow','message':userText}});conn.on('requestcomplete',function(sender,param){showMembersGrid.getStore().load();});}}