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.

269 lines
7.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var um_selected_log_id = 0;
  3. var um_server_log_store = new Ext.data.JsonStore({
  4. root: 'records',
  5. totalProperty: 'totalCount',
  6. idProperty: 'id',
  7. remoteSort: true,
  8. fields: [{
  9. name: 'id',
  10. type: 'int'
  11. },{
  12. name: 'type',
  13. type: 'string'
  14. },{
  15. name: 'ts',
  16. type: 'string'
  17. },{
  18. name: 'ptr',
  19. type: 'string'
  20. },{
  21. name: 'module',
  22. type: 'string'
  23. },{
  24. name: 'msg',
  25. type: 'string'
  26. }],
  27. proxy : new Ext.data.HttpProxy({
  28. method: 'POST',
  29. prettyUrls: false,
  30. url: '/lib/controller/listServerLog.php',
  31. headers: {
  32. UID: <?=$UserID;?>,
  33. SID: '<?=$Session;?>'
  34. }
  35. })
  36. });
  37. var um_server_log_col_model_opt = {
  38. columns: [
  39. {header: "<?=$Labels->GetLabel("_ID_");?>", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  40. {header: "<?=$Labels->GetLabel("_DATETIME_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
  41. {header: "<?=$Labels->GetLabel("_POINTER_");?>", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'ptr' },
  42. {header: "<?=$Labels->GetLabel("_MODULE_");?>", width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'module' },
  43. {header: "<?=$Labels->GetLabel("_INFO_");?>", resizable: true, sortable: false, fixed: false, flex: 1, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'msg' }
  44. ],
  45. defaults: {
  46. sortable: false,
  47. menuDisabled: true,
  48. width: 100
  49. }
  50. };
  51. var um_log_sel_model_opt = {
  52. singleSelect: true,
  53. listeners: {
  54. rowselect: function(sm, row, rec) {
  55. um_selected_log_id = rec.data.id;
  56. }
  57. }
  58. };
  59. var um_access_log_store = new Ext.data.JsonStore({
  60. root: 'records',
  61. totalProperty: 'totalCount',
  62. idProperty: 'id',
  63. remoteSort: true,
  64. fields: [{
  65. name: 'id',
  66. type: 'int'
  67. },{
  68. name: 'user',
  69. type: 'string'
  70. },{
  71. name: 'ts',
  72. type: 'string'
  73. },{
  74. name: 'cmd',
  75. type: 'int'
  76. },{
  77. name: 'data_line',
  78. type: 'string'
  79. }],
  80. proxy : new Ext.data.HttpProxy({
  81. method: 'POST',
  82. prettyUrls: false,
  83. url: '/lib/controller/listAccessLog.php',
  84. headers: {
  85. UID: <?=$UserID;?>,
  86. SID: '<?=$Session;?>'
  87. }
  88. })
  89. });
  90. function um_action_renderer( val ){
  91. switch( val ){
  92. case 1: return 'login';
  93. case 13: return 'Access Denied';
  94. case 145: return 'resize screen';
  95. };
  96. return 'unknown action';
  97. };
  98. var um_access_log_col_model_opt = {
  99. columns: [
  100. {header: "<?=$Labels->GetLabel("_ID_");?>", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  101. {header: "<?=$Labels->GetLabel("_USER_");?>",width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'user' },
  102. {header: "<?=$Labels->GetLabel("_DATETIME_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
  103. {header: "<?=$Labels->GetLabel("_ACTION_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', renderer: um_action_renderer, dataIndex: 'cmd' },
  104. {header: "<?=$Labels->GetLabel("_INFO_");?>", resizable: true, sortable: false, fixed: false, flex: 1, dataindex: 'data_line' }
  105. ],
  106. defaults: {
  107. sortable: false,
  108. menuDisabled: true,
  109. width: 100
  110. }
  111. };
  112. var um_access_log_sel_model_opt = {
  113. singleSelect: true,
  114. listeners: {
  115. rowselect: function(sm, row, rec) {
  116. um_selected_log_id = rec.data.id;
  117. }
  118. }
  119. };
  120. function loadAccessLog(){
  121. if( tlInterval!= null ){
  122. window.clearInterval( tlInterval );
  123. tlInterval = null;
  124. timelineObj = null;
  125. };
  126. var tPanel = Ext.getCmp('main_content');
  127. tPanel.removeAll( true );
  128. Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel("_ACC_LOG_");?>' );
  129. tPanel.add({
  130. columnWidth: 1.0,
  131. frame: false,
  132. border: false,
  133. items: [{
  134. xtype: 'panel',
  135. layout: 'fit',
  136. layoutConfig: {
  137. align : 'stretch',
  138. pack : 'start'
  139. },
  140. height: PanelH-5,
  141. flex: 1,
  142. frame: false,
  143. border: false,
  144. items:{
  145. frame: false,
  146. height: PanelH-5,
  147. xtype: 'grid',
  148. forceFit: true,
  149. viewConfig: {
  150. forceFit: true,
  151. getRowClass: function( record, rowIndex, rowParams, store){
  152. switch( record.get('cmd') ){
  153. case 1: return 'row-level01';
  154. case 2: return 'row-level02';
  155. case 3: return 'row-level03';
  156. case 4: return 'row-level04';
  157. case 145: return 'row-level05';
  158. };
  159. return '';
  160. }
  161. },
  162. ds: um_access_log_store,
  163. cm: new Ext.grid.ColumnModel( um_access_log_col_model_opt ),
  164. sm: new Ext.grid.RowSelectionModel( um_log_sel_model_opt )
  165. },tbar: [{
  166. xtype: 'button',
  167. id: 'um_access_reload_btn',
  168. text: '<?=$Labels->GetLabel("_RELOAD_");?>',
  169. handler: function(){
  170. um_access_log_store.reload();
  171. }
  172. }]
  173. }]
  174. });
  175. tPanel.doLayout();
  176. um_selected_log_id = 0;
  177. um_access_log_store.reload();
  178. };
  179. function loadServerLog(){
  180. if( tlInterval!= null ){
  181. window.clearInterval( tlInterval );
  182. tlInterval = null;
  183. timelineObj = null;
  184. };
  185. var tPanel = Ext.getCmp('main_content');
  186. tPanel.removeAll( true );
  187. Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel("_SERV_LOG_");?>' );
  188. tPanel.add({
  189. columnWidth: 1.0,
  190. frame: false,
  191. border: false,
  192. items: [{
  193. xtype: 'panel',
  194. layout: 'fit',
  195. layoutConfig: {
  196. align : 'stretch',
  197. pack : 'start'
  198. },
  199. height: PanelH-5,
  200. flex: 1,
  201. frame: false,
  202. border: false,
  203. items:{
  204. frame: false,
  205. height: PanelH-5,
  206. xtype: 'grid',
  207. forceFit: true,
  208. viewConfig: {
  209. forceFit: true,
  210. getRowClass: function( record, rowIndex, rowParams, store){
  211. switch( record.get('type') ){
  212. case '01': return 'row-level01';
  213. case '02': return 'row-level02';
  214. case '03': return 'row-level03';
  215. case '04': return 'row-level04';
  216. case '05': return 'row-level05';
  217. };
  218. return '';
  219. }
  220. },
  221. ds: um_server_log_store,
  222. cm: new Ext.grid.ColumnModel( um_server_log_col_model_opt ),
  223. sm: new Ext.grid.RowSelectionModel( um_log_sel_model_opt )
  224. },tbar: [{
  225. xtype: 'button',
  226. id: 'um_server_reload_btn',
  227. text: '<?=$Labels->GetLabel("_RELOAD_");?>',
  228. handler: function(){
  229. um_server_log_store.reload();
  230. }
  231. },{
  232. xtype: 'button',
  233. id: 'um_server_clean_btn',
  234. text: '<?=$Labels->GetLabel("_CLEAR_");?>',
  235. handler: function(){
  236. Ext.Ajax.request({
  237. url: '/lib/controller/clearServerLog.php',
  238. params: {
  239. NID: NID,
  240. UID: <?=$UserID;?>,
  241. SID: '<?=$Session;?>'
  242. },
  243. success: function( response, opts ){
  244. um_server_log_store.reload();
  245. }
  246. });
  247. }
  248. }]
  249. }]
  250. });
  251. tPanel.doLayout();
  252. um_selected_log_id = 0;
  253. um_server_log_store.reload();
  254. tlInterval = window.setInterval( um_server_log_store.reload, 333, 0 );
  255. };