Web UI for ARGUS server
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.

245 lines
6.8 KiB

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