X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/f5240829880f87e0cf581c6a296e436fdef0ef80..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/forum/forum.js diff --git a/examples/forum/forum.js b/examples/forum/forum.js deleted file mode 100644 index 474a307f..00000000 --- a/examples/forum/forum.js +++ /dev/null @@ -1,406 +0,0 @@ -/*! - * Ext JS Library 3.3.0 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license - */ -var Forum = {}; - -////////////////////////////////////////////////////////////////////////////////////////////// -// The data store for topics -Forum.TopicStore = function(){ - Forum.TopicStore.superclass.constructor.call(this, { - remoteSort: true, - - proxy: new Ext.data.ScriptTagProxy({ - url: 'http://extjs.com/forum/topics-browse-remote.php' - }), - - reader: new Ext.data.JsonReader({ - root: 'topics', - totalProperty: 'totalCount', - id: 'threadid' - }, [ - 'title', 'forumtitle', 'forumid', 'author', - {name: 'replycount', type: 'int'}, - {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'}, - 'lastposter', 'excerpt' - ]) - }); - - this.setDefaultSort('lastpost', 'desc'); -}; -Ext.extend(Forum.TopicStore, Ext.data.Store, { - loadForum : function(forumId){ - this.baseParams = { - forumId: forumId - }; - this.load({ - params: { - start:0, - limit:25 - } - }); - } -}); - -////////////////////////////////////////////////////////////////////////////////////////////// - -// some renderers -Forum.Renderers = { - topic : function(value, p, record){ - return String.format( - '
'+record.data.excerpt+'
'; - return 'x-grid3-row-expanded'; - } - return 'x-grid3-row-collapsed'; - } - }, - - bbar: new Ext.PagingToolbar({ - pageSize: 25, - store: ds, - displayInfo: true, - displayMsg: 'Displaying results {0} - {1} of {2}', - emptyMsg: "No results to display" - }) - }); - - Forum.SearchView.superclass.constructor.call(this, { - layout:'border', - title:'Search: '+Ext.util.Format.htmlEncode('"'+search+'"'), - items:[ this.grid, this.preview ] - }); - - this.store.baseParams = { - query: search - }; - - this.store.load({params:{start:0, limit: 25}}); -}; - -Ext.extend(Forum.SearchView, Ext.Panel); - - - -Ext.onReady(function(){ - - Ext.QuickTips.init(); - - var ds = new Forum.TopicStore(); - - var cm = new Ext.grid.ColumnModel([{ - id: 'topic', - header: "Topic", - dataIndex: 'title', - width: 420, - renderer: Forum.Renderers.topic - },{ - header: "Author", - dataIndex: 'author', - width: 100, - hidden: true - },{ - header: "Replies", - dataIndex: 'replycount', - width: 70, - align: 'right' - },{ - id: 'last', - header: "Last Post", - dataIndex: 'lastpost', - width: 150, - renderer: Forum.Renderers.lastPost - }]); - - cm.defaultSortable = true; - - var viewport = new Ext.Viewport({ - layout:'border', - items:[ - new Ext.BoxComponent({ // raw - region:'north', - el: 'header', - height:32 - }), - new Ext.tree.TreePanel({ - id:'forum-tree', - region:'west', - title:'Forums', - split:true, - width: 325, - minSize: 175, - maxSize: 400, - collapsible: true, - margins:'0 0 5 5', - loader: new Forum.TreeLoader(), - rootVisible:false, - lines:false, - autoScroll:true, - root: new Ext.tree.AsyncTreeNode({ - text: 'Forums', - expanded:true - }) - }), - new Ext.TabPanel({ - id:'main-tabs', - activeTab:0, - region:'center', - margins:'0 5 5 0', - resizeTabs:true, - tabWidth:150, - items: { - id:'main-view', - layout:'border', - title:'Loading...', - items:[ - new Ext.grid.GridPanel({ - region:'center', - id:'topic-grid', - store: ds, - cm: cm, - sm:new Ext.grid.RowSelectionModel({ - singleSelect:true, - listeners: { - selectionchange: function(sel){ - var rec = sel.getSelected(); - if(rec){ - Ext.getCmp('preview').body.update('' + rec.get('title') + ''+record.data.excerpt+'
'; - return 'x-grid3-row-expanded'; - } - return 'x-grid3-row-collapsed'; - } - }, - tbar:[ - { - text:'New Topic', - iconCls: 'new-topic', - handler:function(){alert('Not implemented.');} - }, - '-', - { - pressed: true, - enableToggle:true, - text:'Preview Pane', - tooltip: {title:'Preview Pane',text:'Show or hide the Preview Pane'}, - iconCls: 'preview', - toggleHandler: togglePreview - }, - ' ', - { - pressed: true, - enableToggle:true, - text:'Summary', - tooltip: {title:'Post Summary',text:'View a short summary of each post in the list'}, - iconCls: 'summary', - toggleHandler: toggleDetails - } - ], - bbar: new Ext.PagingToolbar({ - pageSize: 25, - store: ds, - displayInfo: true, - displayMsg: 'Displaying topics {0} - {1} of {2}', - emptyMsg: "No topics to display" - }) - }), { - id:'preview', - region:'south', - height:250, - title:'View Topic', - split:true, - bodyStyle: 'padding: 10px; font-family: Arial; font-size: 12px;' - } - ] - } - }) - ] - }); - - var tree = Ext.getCmp('forum-tree'); - tree.on('append', function(tree, p, node){ - if(node.id == 40){ - node.select.defer(100, node); - } - }); - var sm = tree.getSelectionModel(); - sm.on('beforeselect', function(sm, node){ - return node.isLeaf(); - }); - sm.on('selectionchange', function(sm, node){ - ds.loadForum(node.id); - Ext.getCmp('main-view').setTitle(node.text); - }); - - - var searchStore = new Ext.data.Store({ - proxy: new Ext.data.ScriptTagProxy({ - url: 'http://extjs.com/forum/topics-browse-remote.php' - }), - reader: new Ext.data.JsonReader({ - root: 'topics', - totalProperty: 'totalCount', - id: 'threadid' - }, [ - 'title', 'author', - {name: 'lastpost', type: 'date', dateFormat: 'timestamp'} - ]) - }); - - // Custom rendering Template - var resultTpl = new Ext.XTemplate( - '