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.

589 lines
17 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. Ext.onReady(function(){
  8. var items = [];
  9. Ext.QuickTips.init();
  10. //=============================================================
  11. // Layout grid toggle button
  12. //=============================================================
  13. // items.push({
  14. // xtype: 'panel',
  15. // border: false,
  16. // width: 120,
  17. // x: 50, y: 20,
  18. // items: {
  19. // xtype: 'button',
  20. // text: 'Toggle Layout Grid',
  21. // handler: function(){
  22. // Ext.getBody().toggleClass('x-layout-grid');
  23. // }
  24. // }
  25. // });
  26. //=============================================================
  27. // Panel / Window
  28. //=============================================================
  29. items.push({
  30. xtype: 'panel',
  31. width: 150,
  32. height: 150,
  33. title: 'Basic Panel',
  34. bodyStyle: {padding: '5px'},
  35. html: 'Some content',
  36. collapsible: true,
  37. x: 50, y: 100
  38. });
  39. items.push({
  40. xtype: 'panel',
  41. width: 150,
  42. height: 150,
  43. title: 'Masked Panel',
  44. x: 210, y: 100,
  45. bodyStyle: {padding: '5px'},
  46. html: 'Some content',
  47. collapsible: true,
  48. listeners: {
  49. 'render': function(p){
  50. p.body.mask('Loading...');
  51. },
  52. delay: 50
  53. }
  54. });
  55. items.push({
  56. xtype: 'panel',
  57. width: 150,
  58. height: 150,
  59. title: 'Framed Panel',
  60. html: 'Some content',
  61. frame: true,
  62. collapsible: true,
  63. x: 370, y: 100
  64. });
  65. new Ext.Window({
  66. width: 150,
  67. height: 150,
  68. title: 'Window',
  69. bodyStyle: {padding: '5px'},
  70. html: 'Click Submit for Confirmation Msg.',
  71. collapsible: true,
  72. closable: false,
  73. draggable: false,
  74. shadow: false,
  75. resizable: false,
  76. x: 530, y: 100,
  77. tbar: [{
  78. text: 'Toolbar'
  79. }],
  80. buttons: [{
  81. text: 'Submit',
  82. id: 'message_box',
  83. cls: 'x-icon-btn',
  84. iconCls: 'x-icon-btn-ok',
  85. handler: function(){
  86. Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?');
  87. }
  88. }]
  89. }).show();
  90. //=============================================================
  91. // Toolbar / Menu
  92. //=============================================================
  93. var menu = new Ext.menu.Menu({
  94. items: [{
  95. text: 'Menu item'
  96. },{
  97. text: 'Check 1',
  98. checked: true
  99. },{
  100. text: 'Check 2',
  101. checked: false
  102. }, '-', {
  103. text: 'Option 1',
  104. checked: true,
  105. group: 'opts'
  106. },{
  107. text: 'Option 2',
  108. checked: false,
  109. group: 'opts'
  110. }, '-', {
  111. text: 'Sub-items',
  112. menu: new Ext.menu.Menu({
  113. items: [{text: 'Item 1'},{text: 'Item 2'}]
  114. })
  115. }]
  116. });
  117. items.push({
  118. xtype: 'panel',
  119. width: 450,
  120. height: 150,
  121. title: 'Basic Panel With Toolbars',
  122. x: 690, y: 100,
  123. tbar: ['Toolbar & Menus', ' ', '-', {
  124. text: 'Button'
  125. },{
  126. text: 'Menu Button',
  127. id: 'menu-btn',
  128. menu: menu
  129. },{
  130. xtype: 'tbsplit',
  131. text: 'Split Button',
  132. menu: new Ext.menu.Menu({
  133. items: [{text: 'Item 1'},{text: 'Item 2'}]
  134. })
  135. },{
  136. xtype: 'button',
  137. enableToggle: true,
  138. pressed: true,
  139. text: 'Toggle Button'
  140. }],
  141. bbar: [{
  142. text: 'Bottom Bar'
  143. }]
  144. });
  145. //=============================================================
  146. // Form widgets
  147. //=============================================================
  148. items.push({
  149. xtype: 'form',
  150. id: 'form-widgets',
  151. title: 'Form Widgets',
  152. width: 630,
  153. height: 700,
  154. frame: true,
  155. x: 50, y: 260,
  156. tools: [
  157. {id:'toggle'},{id:'close'},{id:'minimize'},{id:'maximize'},{id:'restore'},{id:'gear'},{id:'pin'},
  158. {id:'unpin'},{id:'right'},{id:'left'},{id:'up'},{id:'down'},{id:'refresh'},{id:'minus'},{id:'plus'},
  159. {id:'help'},{id:'search'},{id:'save'},{id:'print'}
  160. ],
  161. bodyStyle: {
  162. padding: '10px 20px'
  163. },
  164. defaults: {
  165. anchor: '98%',
  166. msgTarget: 'side',
  167. allowBlank: false
  168. },
  169. items: [{
  170. xtype: 'label',
  171. text: 'Plain Label'
  172. },{
  173. fieldLabel: 'TextField',
  174. xtype: 'textfield',
  175. emptyText: 'Enter a value',
  176. itemCls: 'x-form-required'
  177. },{
  178. fieldLabel: 'ComboBox',
  179. xtype: 'combo',
  180. store: ['Foo', 'Bar'],
  181. itemCls: 'x-form-required',
  182. resizable: true
  183. },{
  184. fieldLabel: 'DateField',
  185. itemCls: 'x-form-required',
  186. xtype: 'datefield'
  187. },{
  188. fieldLabel: 'TimeField',
  189. itemCls: 'x-form-required',
  190. xtype: 'timefield'
  191. },{
  192. fieldLabel: 'NumberField',
  193. emptyText: '(This field is optional)',
  194. allowBlank: true,
  195. xtype: 'numberfield'
  196. },{
  197. fieldLabel: 'TextArea',
  198. //msgTarget: 'under',
  199. itemCls: 'x-form-required',
  200. xtype: 'textarea',
  201. cls: 'x-form-valid',
  202. value: 'This field is hard-coded to have the "valid" style (it will require some code changes to add/remove this style dynamically)'
  203. },{
  204. fieldLabel: 'Checkboxes',
  205. xtype: 'checkboxgroup',
  206. columns: [100,100],
  207. items: [{boxLabel: 'Foo', checked: true},{boxLabel: 'Bar'}]
  208. },{
  209. fieldLabel: 'Radios',
  210. xtype: 'radiogroup',
  211. columns: [100,100],
  212. items: [{boxLabel: 'Foo', checked: true, name: 'radios'},{boxLabel: 'Bar', name: 'radios'}]
  213. },{
  214. hideLabel: true,
  215. xtype: 'htmleditor',
  216. value: 'Mouse over toolbar for tooltips.<br /><br />The HTMLEditor IFrame requires a refresh between a stylesheet switch to get accurate colors.',
  217. height: 110,
  218. handler: function(){
  219. Ext.get('styleswitcher').on('click', function(e){
  220. Ext.getCmp('form-widgets').getForm().reset();
  221. });
  222. }
  223. },{
  224. title: 'Plain Fieldset',
  225. xtype: 'fieldset',
  226. height: 50
  227. },{
  228. title: 'Collapsible Fieldset',
  229. xtype: 'fieldset',
  230. collapsible: true,
  231. height: 50
  232. },{
  233. title: 'Checkbox Fieldset',
  234. xtype: 'fieldset',
  235. checkboxToggle: true,
  236. height: 50
  237. }],
  238. buttons: [{
  239. text:'Toggle Enabled',
  240. cls: 'x-icon-btn',
  241. iconCls: 'x-icon-btn-toggle',
  242. handler: function(){
  243. Ext.getCmp('form-widgets').getForm().items.each(function(ctl){
  244. ctl.setDisabled(!ctl.disabled);
  245. });
  246. }
  247. },{
  248. text: 'Reset Form',
  249. cls: 'x-icon-btn',
  250. iconCls: 'x-icon-btn-reset',
  251. handler: function(){
  252. Ext.getCmp('form-widgets').getForm().reset();
  253. }
  254. },{
  255. text:'Validate',
  256. cls: 'x-icon-btn',
  257. iconCls: 'x-icon-btn-ok',
  258. handler: function(){
  259. Ext.getCmp('form-widgets').getForm().isValid();
  260. }
  261. }]
  262. });
  263. //=============================================================
  264. // BorderLayout
  265. //=============================================================
  266. items.push({
  267. xtype: 'panel',
  268. width: 450,
  269. height: 350,
  270. title: 'BorderLayout Panel',
  271. x: 690, y: 260,
  272. layout: 'border',
  273. defaults: {
  274. collapsible: true,
  275. split: true
  276. },
  277. items: [{
  278. title: 'North',
  279. region: 'north',
  280. html: 'North',
  281. ctitle: 'North',
  282. margins: '5 5 0 5',
  283. height: 70
  284. },{
  285. title: 'South',
  286. region: 'south',
  287. html: 'South',
  288. collapseMode: 'mini',
  289. margins: '0 5 5 5',
  290. height: 70
  291. },{
  292. title: 'West',
  293. region: 'west',
  294. html: 'West',
  295. collapseMode: 'mini',
  296. margins: '0 0 0 5',
  297. width: 100
  298. },{
  299. title: 'East',
  300. region: 'east',
  301. html: 'East',
  302. margins: '0 5 0 0',
  303. width: 100
  304. },{
  305. title: 'Center',
  306. region: 'center',
  307. collapsible: false,
  308. html: 'Center'
  309. }]
  310. });
  311. //=============================================================
  312. // Grid
  313. //=============================================================
  314. var myData = [
  315. ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
  316. ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
  317. ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
  318. ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
  319. ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
  320. ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
  321. ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
  322. ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
  323. ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
  324. ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am']
  325. ];
  326. var store = new Ext.data.SimpleStore({
  327. fields: [
  328. {name: 'company'},
  329. {name: 'price', type: 'float'},
  330. {name: 'change', type: 'float'},
  331. {name: 'pctChange', type: 'float'},
  332. {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
  333. ],
  334. sortInfo: {
  335. field: 'company', direction: 'ASC'
  336. }
  337. });
  338. var pagingBar = new Ext.PagingToolbar({
  339. pageSize: 5,
  340. store: store,
  341. displayInfo: true,
  342. displayMsg: 'Displaying topics {0} - {1} of {2}'
  343. });
  344. store.loadData(myData);
  345. items.push({
  346. xtype: 'grid',
  347. store: store,
  348. columns: [
  349. {id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company'},
  350. {header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
  351. {header: "Change", width: 75, sortable: true, dataIndex: 'change'},
  352. {header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange'},
  353. {header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
  354. ],
  355. stripeRows: true,
  356. autoExpandColumn: 'company',
  357. loadMask: true,
  358. height: 200,
  359. width: 450,
  360. x: 690, y: 620,
  361. title:'GridPanel',
  362. bbar: pagingBar,
  363. tbar: [
  364. { text: 'Toolbar' },'->',
  365. new Ext.form.TwinTriggerField({
  366. xtype: 'twintriggerfield',
  367. trigger1Class: 'x-form-clear-trigger',
  368. trigger2Class: 'x-form-search-trigger'
  369. })
  370. ]
  371. });
  372. //=============================================================
  373. // ListView
  374. //=============================================================
  375. var listView = new Ext.list.ListView({
  376. store: store,
  377. multiSelect: true,
  378. emptyText: 'No images to display',
  379. reserveScrollOffset: true,
  380. columns: [
  381. {id:'company',header: "Company", width: .5, sortable: true, dataIndex: 'company'},
  382. {header: "Price", width: .25, sortable: true, tpl: '{price:usMoney}', dataIndex: 'price'},
  383. {header: "Change", width: .25, sortable: true, dataIndex: 'change'}
  384. ]
  385. });
  386. items.push({
  387. xtype:'panel',
  388. id:'images-view',
  389. width:250,
  390. height:182,
  391. x: 430, y: 1130,
  392. collapsible:false,
  393. layout:'fit',
  394. title:'Simple ListView', // <i>(0 items selected)</i>
  395. items: listView
  396. });
  397. //=============================================================
  398. // Accordion / Tree
  399. //=============================================================
  400. var tree = new Ext.tree.TreePanel({
  401. title: 'TreePanel',
  402. autoScroll: true,
  403. enableDD: true
  404. });
  405. var root = new Ext.tree.TreeNode({
  406. text: 'Root Node',
  407. expanded: true
  408. });
  409. tree.setRootNode(root);
  410. root.appendChild(new Ext.tree.TreeNode({text: 'Item 1'}));
  411. root.appendChild(new Ext.tree.TreeNode({text: 'Item 2'}));
  412. var node = new Ext.tree.TreeNode({text: 'Folder'});
  413. node.appendChild(new Ext.tree.TreeNode({text: 'Item 3'}));
  414. root.appendChild(node);
  415. var accConfig = {
  416. title: 'Accordion and TreePanel',
  417. layout: 'accordion',
  418. x: 690, y: 830,
  419. width: 450,
  420. height: 240,
  421. bodyStyle: {
  422. 'background-color': '#eee'
  423. },
  424. defaults: {
  425. border: false
  426. },
  427. items: [tree, {
  428. title: 'Item 2',
  429. html: 'Some content'
  430. },{
  431. title: 'Item 3',
  432. html: 'Some content'
  433. }]
  434. }
  435. items.push(accConfig);
  436. //=============================================================
  437. // Tabs
  438. //=============================================================
  439. var tabCfg = {
  440. xtype: 'tabpanel',
  441. activeTab: 0,
  442. width: 310,
  443. height: 150,
  444. defaults: {
  445. bodyStyle: 'padding:10px;'
  446. },
  447. items: [{
  448. title: 'Tab 1',
  449. html: 'Free-standing tab panel'
  450. },{
  451. title: 'Tab 2',
  452. closable: true
  453. },{
  454. title: 'Tab 3',
  455. closable: true
  456. }]
  457. };
  458. items.push(Ext.applyIf({
  459. x: 50, y: 970,
  460. enableTabScroll: true,
  461. items: [{
  462. title: 'Tab 1',
  463. html: 'Tab panel for display in a border layout'
  464. },{
  465. title: 'Tab 2',
  466. closable: true
  467. },{
  468. title: 'Tab 3',
  469. closable: true
  470. },{
  471. title: 'Tab 4',
  472. closable: true
  473. },{
  474. title: 'Tab 5',
  475. closable: true
  476. },{
  477. title: 'Tab 6',
  478. closable: true
  479. },{
  480. title: 'Tab 7',
  481. closable: true
  482. }] // enable 4 through 7 to see tab scrolling
  483. }, tabCfg));
  484. items.push(Ext.apply({
  485. plain: true,
  486. x: 370, y: 970
  487. }, tabCfg));
  488. //=============================================================
  489. // DatePicker
  490. //=============================================================
  491. items.push({
  492. xtype: 'panel',
  493. border: false,
  494. width: 180,
  495. x: 50, y: 1130,
  496. items: {
  497. xtype: 'datepicker'
  498. }
  499. });
  500. //=============================================================
  501. // Resizable
  502. //=============================================================
  503. var rszEl = Ext.DomHelper.append(Ext.getBody(), {
  504. style: 'background: transparent;', html: '<div style="padding:20px;">Resizable handles</div>'
  505. }, true);
  506. rszEl.position('absolute', 1, 240, 1130);
  507. rszEl.setSize(180, 180);
  508. new Ext.Resizable(rszEl, {
  509. handles: 'all',
  510. pinned: true
  511. });
  512. //=============================================================
  513. // ProgressBar / Slider
  514. //=============================================================
  515. items.push({
  516. xtype: 'panel',
  517. title: 'ProgressBar / Slider',
  518. x: 690, y: 1080,
  519. width: 450,
  520. height: 200,
  521. bodyStyle: {padding: '15px'},
  522. items: [{
  523. xtype: 'progress',
  524. value: .5,
  525. text: 'Progress text...'
  526. },{
  527. xtype: 'slider',
  528. value: 50
  529. },{
  530. xtype: 'slider',
  531. vertical: true,
  532. value: 50,
  533. height: 100
  534. }]
  535. });
  536. //=============================================================
  537. // Render everything!
  538. //=============================================================
  539. new Ext.Viewport({
  540. layout: 'absolute',
  541. //cls: 'x-layout-grid',
  542. autoScroll: true,
  543. items: items
  544. });
  545. Ext.getCmp('menu-btn').showMenu();
  546. //=============================================================
  547. // Stylesheet Switcher
  548. //=============================================================
  549. Ext.get('styleswitcher_select').on('change',function(e,select){
  550. var name = select[select.selectedIndex].value;
  551. setActiveStyleSheet(name);
  552. });
  553. var cookie = readCookie("style");
  554. var title = cookie ? cookie : getPreferredStyleSheet();
  555. Ext.get('styleswitcher_select').dom.value=title;
  556. });