Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
14 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. // Sample desktop configuration
  8. MyDesktop = new Ext.app.App({
  9. init :function(){
  10. Ext.QuickTips.init();
  11. },
  12. getModules : function(){
  13. return [
  14. new MyDesktop.GridWindow(),
  15. new MyDesktop.TabWindow(),
  16. new MyDesktop.AccordionWindow(),
  17. new MyDesktop.BogusMenuModule(),
  18. new MyDesktop.BogusModule()
  19. ];
  20. },
  21. // config for the start menu
  22. getStartConfig : function(){
  23. return {
  24. title: 'Jack Slocum',
  25. iconCls: 'user',
  26. toolItems: [{
  27. text:'Settings',
  28. iconCls:'settings',
  29. scope:this
  30. },'-',{
  31. text:'Logout',
  32. iconCls:'logout',
  33. scope:this
  34. }]
  35. };
  36. }
  37. });
  38. /*
  39. * Example windows
  40. */
  41. MyDesktop.GridWindow = Ext.extend(Ext.app.Module, {
  42. id:'grid-win',
  43. init : function(){
  44. this.launcher = {
  45. text: 'Grid Window',
  46. iconCls:'icon-grid',
  47. handler : this.createWindow,
  48. scope: this
  49. }
  50. },
  51. createWindow : function(){
  52. var desktop = this.app.getDesktop();
  53. var win = desktop.getWindow('grid-win');
  54. if(!win){
  55. win = desktop.createWindow({
  56. id: 'grid-win',
  57. title:'Grid Window',
  58. width:740,
  59. height:480,
  60. iconCls: 'icon-grid',
  61. shim:false,
  62. animCollapse:false,
  63. constrainHeader:true,
  64. layout: 'fit',
  65. items:
  66. new Ext.grid.GridPanel({
  67. border:false,
  68. ds: new Ext.data.Store({
  69. reader: new Ext.data.ArrayReader({}, [
  70. {name: 'company'},
  71. {name: 'price', type: 'float'},
  72. {name: 'change', type: 'float'},
  73. {name: 'pctChange', type: 'float'}
  74. ]),
  75. data: Ext.grid.dummyData
  76. }),
  77. cm: new Ext.grid.ColumnModel([
  78. new Ext.grid.RowNumberer(),
  79. {header: "Company", width: 120, sortable: true, dataIndex: 'company'},
  80. {header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
  81. {header: "Change", width: 70, sortable: true, dataIndex: 'change'},
  82. {header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'}
  83. ]),
  84. viewConfig: {
  85. forceFit:true
  86. },
  87. //autoExpandColumn:'company',
  88. tbar:[{
  89. text:'Add Something',
  90. tooltip:'Add a new row',
  91. iconCls:'add'
  92. }, '-', {
  93. text:'Options',
  94. tooltip:'Blah blah blah blaht',
  95. iconCls:'option'
  96. },'-',{
  97. text:'Remove Something',
  98. tooltip:'Remove the selected item',
  99. iconCls:'remove'
  100. }]
  101. })
  102. });
  103. }
  104. win.show();
  105. }
  106. });
  107. MyDesktop.TabWindow = Ext.extend(Ext.app.Module, {
  108. id:'tab-win',
  109. init : function(){
  110. this.launcher = {
  111. text: 'Tab Window',
  112. iconCls:'tabs',
  113. handler : this.createWindow,
  114. scope: this
  115. }
  116. },
  117. createWindow : function(){
  118. var desktop = this.app.getDesktop();
  119. var win = desktop.getWindow('tab-win');
  120. if(!win){
  121. win = desktop.createWindow({
  122. id: 'tab-win',
  123. title:'Tab Window',
  124. width:740,
  125. height:480,
  126. iconCls: 'tabs',
  127. shim:false,
  128. animCollapse:false,
  129. border:false,
  130. constrainHeader:true,
  131. layout: 'fit',
  132. items:
  133. new Ext.TabPanel({
  134. activeTab:0,
  135. items: [{
  136. title: 'Tab Text 1',
  137. header:false,
  138. html : '<p>Something useful would be in here.</p>',
  139. border:false
  140. },{
  141. title: 'Tab Text 2',
  142. header:false,
  143. html : '<p>Something useful would be in here.</p>',
  144. border:false
  145. },{
  146. title: 'Tab Text 3',
  147. header:false,
  148. html : '<p>Something useful would be in here.</p>',
  149. border:false
  150. },{
  151. title: 'Tab Text 4',
  152. header:false,
  153. html : '<p>Something useful would be in here.</p>',
  154. border:false
  155. }]
  156. })
  157. });
  158. }
  159. win.show();
  160. }
  161. });
  162. MyDesktop.AccordionWindow = Ext.extend(Ext.app.Module, {
  163. id:'acc-win',
  164. init : function(){
  165. this.launcher = {
  166. text: 'Accordion Window',
  167. iconCls:'accordion',
  168. handler : this.createWindow,
  169. scope: this
  170. }
  171. },
  172. createWindow : function(){
  173. var desktop = this.app.getDesktop();
  174. var win = desktop.getWindow('acc-win');
  175. if(!win){
  176. win = desktop.createWindow({
  177. id: 'acc-win',
  178. title: 'Accordion Window',
  179. width:250,
  180. height:400,
  181. iconCls: 'accordion',
  182. shim:false,
  183. animCollapse:false,
  184. constrainHeader:true,
  185. tbar:[{
  186. tooltip:{title:'Rich Tooltips', text:'Let your users know what they can do!'},
  187. iconCls:'connect'
  188. },'-',{
  189. tooltip:'Add a new user',
  190. iconCls:'user-add'
  191. },' ',{
  192. tooltip:'Remove the selected user',
  193. iconCls:'user-delete'
  194. }],
  195. layout:'accordion',
  196. border:false,
  197. layoutConfig: {
  198. animate:false
  199. },
  200. items: [
  201. new Ext.tree.TreePanel({
  202. id:'im-tree',
  203. title: 'Online Users',
  204. loader: new Ext.tree.TreeLoader(),
  205. rootVisible:false,
  206. lines:false,
  207. autoScroll:true,
  208. tools:[{
  209. id:'refresh',
  210. on:{
  211. click: function(){
  212. var tree = Ext.getCmp('im-tree');
  213. tree.body.mask('Loading', 'x-mask-loading');
  214. tree.root.reload();
  215. tree.root.collapse(true, false);
  216. setTimeout(function(){ // mimic a server call
  217. tree.body.unmask();
  218. tree.root.expand(true, true);
  219. }, 1000);
  220. }
  221. }
  222. }],
  223. root: new Ext.tree.AsyncTreeNode({
  224. text:'Online',
  225. children:[{
  226. text:'Friends',
  227. expanded:true,
  228. children:[{
  229. text:'Jack',
  230. iconCls:'user',
  231. leaf:true
  232. },{
  233. text:'Brian',
  234. iconCls:'user',
  235. leaf:true
  236. },{
  237. text:'Jon',
  238. iconCls:'user',
  239. leaf:true
  240. },{
  241. text:'Tim',
  242. iconCls:'user',
  243. leaf:true
  244. },{
  245. text:'Nige',
  246. iconCls:'user',
  247. leaf:true
  248. },{
  249. text:'Fred',
  250. iconCls:'user',
  251. leaf:true
  252. },{
  253. text:'Bob',
  254. iconCls:'user',
  255. leaf:true
  256. }]
  257. },{
  258. text:'Family',
  259. expanded:true,
  260. children:[{
  261. text:'Kelly',
  262. iconCls:'user-girl',
  263. leaf:true
  264. },{
  265. text:'Sara',
  266. iconCls:'user-girl',
  267. leaf:true
  268. },{
  269. text:'Zack',
  270. iconCls:'user-kid',
  271. leaf:true
  272. },{
  273. text:'John',
  274. iconCls:'user-kid',
  275. leaf:true
  276. }]
  277. }]
  278. })
  279. }), {
  280. title: 'Settings',
  281. html:'<p>Something useful would be in here.</p>',
  282. autoScroll:true
  283. },{
  284. title: 'Even More Stuff',
  285. html : '<p>Something useful would be in here.</p>'
  286. },{
  287. title: 'My Stuff',
  288. html : '<p>Something useful would be in here.</p>'
  289. }
  290. ]
  291. });
  292. }
  293. win.show();
  294. }
  295. });
  296. // for example purposes
  297. var windowIndex = 0;
  298. MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
  299. init : function(){
  300. this.launcher = {
  301. text: 'Window '+(++windowIndex),
  302. iconCls:'bogus',
  303. handler : this.createWindow,
  304. scope: this,
  305. windowId:windowIndex
  306. }
  307. },
  308. createWindow : function(src){
  309. var desktop = this.app.getDesktop();
  310. var win = desktop.getWindow('bogus'+src.windowId);
  311. if(!win){
  312. win = desktop.createWindow({
  313. id: 'bogus'+src.windowId,
  314. title:src.text,
  315. width:640,
  316. height:480,
  317. html : '<p>Something useful would be in here.</p>',
  318. iconCls: 'bogus',
  319. shim:false,
  320. animCollapse:false,
  321. constrainHeader:true
  322. });
  323. }
  324. win.show();
  325. }
  326. });
  327. MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
  328. init : function(){
  329. this.launcher = {
  330. text: 'Bogus Submenu',
  331. iconCls: 'bogus',
  332. handler: function() {
  333. return false;
  334. },
  335. menu: {
  336. items:[{
  337. text: 'Bogus Window '+(++windowIndex),
  338. iconCls:'bogus',
  339. handler : this.createWindow,
  340. scope: this,
  341. windowId: windowIndex
  342. },{
  343. text: 'Bogus Window '+(++windowIndex),
  344. iconCls:'bogus',
  345. handler : this.createWindow,
  346. scope: this,
  347. windowId: windowIndex
  348. },{
  349. text: 'Bogus Window '+(++windowIndex),
  350. iconCls:'bogus',
  351. handler : this.createWindow,
  352. scope: this,
  353. windowId: windowIndex
  354. },{
  355. text: 'Bogus Window '+(++windowIndex),
  356. iconCls:'bogus',
  357. handler : this.createWindow,
  358. scope: this,
  359. windowId: windowIndex
  360. },{
  361. text: 'Bogus Window '+(++windowIndex),
  362. iconCls:'bogus',
  363. handler : this.createWindow,
  364. scope: this,
  365. windowId: windowIndex
  366. }]
  367. }
  368. }
  369. }
  370. });
  371. // Array data for the grid
  372. Ext.grid.dummyData = [
  373. ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
  374. ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
  375. ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
  376. ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
  377. ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
  378. ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
  379. ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
  380. ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
  381. ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
  382. ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
  383. ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
  384. ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
  385. ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
  386. ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
  387. ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
  388. ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
  389. ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
  390. ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
  391. ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am'],
  392. ['Walt Disney Company (The) (Holding Company)',29.89,0.24,0.81,'9/1 12:00am']
  393. ];