EXT富客户端后台管理系统 初步代码提供给大家 <%$sitename%> <%*加载的Extjs 资源文件 -- 开始*%> <%*加载的Extjs 资源文件 -- 结束*%> <%*执行块的JS区域 -- 开始*%> <br>//具体开发 -- BJExtreme类 <br>BJExtreme= function(){} ; <br>BJExtreme.prototype.getAuthor = function(){ <br>return '许消寒' ; <br>} <br>BJExtreme.prototype.getVersion = function(){ <br>return '2008年08月13日 17:00' ; <br>} <br>BJExtreme.prototype.getController = function(){ <br>return 'index.php' ; <br>} <br>BJExtreme.prototype.buildLinkStr = function(ctl,act){ <br>if (ctl == undefined) <br>return BJExtreme.prototype.getController() ; <br>if (act == undefined) <br>act = null ; <br>return BJExtreme.prototype.getController() + '?ctl=' + ctl + '&act=' + act ; <br>} <br>BJExtreme.prototype.showWindow = function(title1,width1,height1,html1){ <br>if (this.win == undefined){ <br>this.win = new Ext.Window({ <br>title: title1, <br>width: width1 , <br>height: height1 , <br>html: html1 <br>}); <br>} <br>else { <br>this.win.close(); <br>this.win = new Ext.Window({ <br>title: title1, <br>width: width1 , <br>height: height1 , <br>html: html1 <br>}); <br>} <br>this.win.show(); <br>} <br>/*对出现的UI组件单独封装*/ <br>BJExtreme.prototype.ui = function(){} ; <br>BJExtreme.prototype.ui.mainTopic = { <br>title: 'Beijing Extreme 后台管理', region: 'north' , <br>html: '<embed src="<%$prj_dir%>/swf/top_title.swf" quality="high" type="application/x-shockwave-flash" width="450" height="50"></embed>' <br>}; <br>/*左侧菜单项操作 -- 开始*/ <br>//定义初始话状态时的菜单条对象 <br>BJExtreme.prototype.ui.menuBar = { <br>xtype: 'treepanel' , <br>title: '菜单',region: 'west',width: 200 ,collapsible: true , <br>loader: null , root: null ,rootVisible: true , listeners: null <br>}; <br>//旅游相关 <br>BJExtreme.prototype.ui.menuBar.Traveling = { <br>text: '旅游' , <br>leaf: false , // 这个设为false 则显示文件夹图标 , true 则显示单项图标 <br>children: null <br>}; <br>BJExtreme.prototype.ui.menuBar.Traveling.children = [ <br>{text: '北京',leaf: true ,ctl: 'Peking',act: ''}, <br>{text: '西藏' ,leaf: true ,ctl: 'Tibet' ,act: ''}, <br>{text: '泰国' ,leaf: true}, <br>{text: '香格里拉',leaf: true,ctl:'Shangrila',act: ''} <br>]; <br>//藏医相关 <br>BJExtreme.prototype.ui.menuBar.Mibetdoctor = { <br>text: '藏医' , <br>leaf: false , <br>children: null <br>}; <br>BJExtreme.prototype.ui.menuBar.Mibetdoctor.children = [ <br>{text: '藏医历史',leaf: true}, <br>{text: '藏医理论' ,leaf: true}, <br>{text: '诊断' ,leaf: true}, <br>{text: '病症' ,leaf: true}, <br>{text: '治疗',leaf: true} <br>]; <br><br>//潜水 <br>BJExtreme.prototype.ui.menuBar.ping = { <br>text: '潜水' , <br>leaf: false , <br>children: null <br>}; <br>//登山 <br>BJExtreme.prototype.ui.menuBar.Mountain = { <br>text: '登山' , <br>leaf: false , <br>children: null <br>}; <br>//攀岩 <br>BJExtreme.prototype.ui.menuBar.Rockclimbe = { <br>text: '攀岩' , <br>leaf: false , <br>children: null <br>}; <br>//徒步 <br>BJExtreme.prototype.ui.menuBar.Onfoot = { <br>text: '徒步' , <br>leaf: false , <br>children: null <br>}; <br>//摩托车 <br>BJExtreme.prototype.ui.menuBar.Motorcycle = { <br>text: '摩托车' , <br>leaf: false , <br>children: null <br>}; <br>//项目中集成的模块 <br>BJExtreme.prototype.ui.menuBar.ModuleInProject = { <br>text: '项目中集成的模块' , <br>leaf: false , <br>children: null <br>}; <br>BJExtreme.prototype.ui.menuBar.ModuleInProject.children = [ <br>{ <br>text: '互动提示条',leaf: true,ctl: 'ExtjsStudy',act: 'linkTips', <br>//这个运行的优先级高于下面的那个通用的监听控制器 <br>listeners:{click: function (n){window.open(BJExtreme.prototype.buildLinkStr(n.attributes.ctl,n.attributes.act));return false ;}} <br>} <br>]; <br>//初始化 菜单项元素 信息 -- 这个必须在 -- 当前菜单是使用异步树组件生成的 , 以后可以添加其他不同的实现 <br>BJExtreme.prototype.ui.menuBar.loader = new Ext.tree.TreeLoader(); <br>BJExtreme.prototype.ui.menuBar.root = new Ext.tree.AsyncTreeNode({ <br>expanded: true , <br>children: [ <br>BJExtreme.prototype.ui.menuBar.Traveling , <br>BJExtreme.prototype.ui.menuBar.Mibetdoctor , <br>BJExtreme.prototype.ui.menuBar.ping , <br>BJExtreme.prototype.ui.menuBar.Mountain , <br>BJExtreme.prototype.ui.menuBar.Rockclimbe , <br>BJExtreme.prototype.ui.menuBar.Onfoot , <br>BJExtreme.prototype.ui.menuBar.Motorcycle , <br>BJExtreme.prototype.ui.menuBar.ModuleInProject <br>] <br>}); <br>//定义一个简单的响应事件 <br>BJExtreme.prototype.ui.menuBar.listeners = { <br>click: function (n) //n.attributes 可以获得AsyncTreeNode的children中的对象 <br>{ <br>if (n.attributes.leaf == true) //叶选项 <br>{ <br>//n.attributes.text n.attributes.leaf <br>var ctlStr = BJExtreme.prototype.buildLinkStr(n.attributes.ctl,n.attributes.act); <br>myextreme.showWindow('当前控制器',400,300,ctlStr) ; <br>} <br>else //包含子菜单 <br>{ <br>//not to do <br>} <br>} <br>}; <br>//菜单选项结束 <br>//主内容面板 <br>BJExtreme.prototype.ui.contentPane = { <br>id: "main_content", xtype: "tabpanel" , region: 'center' ,items: [{title: '主内容面板'}] <br>}; <br>//状态条 <br>BJExtreme.prototype.ui.statusBar = { <br>xtype: "tabpanel" , region: 'south' ,items: [{title: '状态条'}] <br>}; <br>BJExtreme.prototype.buildMainPane = function(BJExtremeObj){ <br>//Ext.Viewport 用来将对象渲染到页面中的body块中,会自动改变,每个页面仅限一个 <br>this.mainPane = new Ext.Viewport({ <br>enableTabScroll: true , <br>layout: 'border', //设为fit则不能显示复合面板 <br>items: [ <br>BJExtremeObj.ui.mainTopic, <br>BJExtremeObj.ui.menuBar , <br>BJExtremeObj.ui.contentPane , <br>BJExtremeObj.ui.statusBar <br>] <br>}) ; <br>} <br>var myextreme = new BJExtreme() ; <br>Ext.onReady( <br>function(){ <br>//Ext.MessageBox.alert('BJExtreme Version',myextreme.getVersion()); <br>//Ext.MessageBox.alert('BJExtreme Version',myextreme.buildLinkStr('t','b')); <br>myextreme.buildMainPane(myextreme) ; <br>} <br>); <br> <%*执行块的JS区域 -- 结束*%>