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.

232 lines
8.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $Z = intval( $_POST['NID'] );
  5. if( $Z ){
  6. $QS = "SELECT * FROM `nodes` WHERE `id`={$Z}";
  7. $NN = $DATABASE->Query( $QS );
  8. if( count( $NN ) ){
  9. $Node = $NN[0];
  10. switch( $Node['type'] ){
  11. case 0:{
  12. $QS="SELECT * FROM `servers` WHERE `id`={$Node['aux_id']}";
  13. $SDD = $DATABASE->Query( $QS );
  14. $NData = $SDD[0];
  15. $QS="SELECT * FROM `resources` WHERE `node_id`={$Z} AND ( `type`=101 OR `type`=102 )";
  16. $CN = $DATABASE->Query( $QS );
  17. $IL=array();
  18. foreach( $CN as $N ){
  19. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  20. $NWD = $DATABASE->Query( $QS );
  21. $NW = $NWD[0];
  22. $IL[]="<td width=\"50px\"><img width=\"32\" src=\"/style/assets/".(($N['type']==101)?'NICs.png':'wifi-icon.png')."\"></td><td align=\"right\"><b>{$N['device']}:</b></td><td><b>{$NW['address']}</b></td>";
  23. };
  24. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  25. ?>
  26. {
  27. xtype: 'tabpanel',
  28. frame: false,
  29. id: 'node_settings_content',
  30. border: false,
  31. activeTab: 0,
  32. items: [{
  33. xtype: 'panel',
  34. title: 'General Info',
  35. layout: 'hbox',
  36. items:[{
  37. xtype: 'panel',
  38. flex: 1,
  39. height: 303,
  40. autoScroll: false,
  41. html: '<table width="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr></table>'
  42. },{
  43. xtype: 'form',
  44. id: '_ed_small',
  45. flex: 1,
  46. height: 303,
  47. autoScroll: false,
  48. //layout: 'vbox',
  49. labelWidth: 120,
  50. labelAlign: 'right',
  51. items:[{
  52. xtype: 'textfield',
  53. fieldLabel: '<?=$Labels->GetLabel( 'SERV_NAME' );?>',
  54. id: 'node_name',
  55. value: '<?=$Node['name'];?>',
  56. listeners:{
  57. change: function(){
  58. settingsChangeNotifier( 'node_name' );
  59. Ext.getCmp('sasa_bo').enable();
  60. }
  61. }
  62. },{
  63. xtype: 'panel',
  64. width: '100%',
  65. html: '<div class="sideInfo_item" id="INFO_ON"><?=$Labels->GetLabel( 'SERV_BLD_TAG' ).': '.$NData['version_string'];?></div>'
  66. },{
  67. xtype: 'panel',
  68. width: '100%',
  69. html: '<div class="setEd_infoPanel" id="INFO_IPS"><?=$NIFO;?></div>'
  70. },{
  71. xtype: 'button',
  72. id: 'sasa_bo',
  73. width: '100%',
  74. disabled: true,
  75. text: 'Apply Changes',
  76. handler: function(){
  77. }
  78. }]
  79. }]
  80. },{
  81. xtype: 'panel',
  82. title: 'Resources',
  83. layout: 'hbox',
  84. items:[{
  85. xtype: 'panel',
  86. flex: 1,
  87. height: 303,
  88. autoScroll: 'auto',
  89. //layout: 'fit',
  90. items:[<?php
  91. $QS = "SELECT * FROM resources WHERE `node_id`={$Z}";
  92. $Result = $DATABASE->Query( $QS, false );
  93. if( count( $Result ) ){
  94. foreach( $Result as $R ){
  95. switch( $R['type'] ){
  96. case 1:
  97. //Uart
  98. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  99. break;
  100. case 6:
  101. //USB DC
  102. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="USBDC_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  103. break;
  104. case 31:
  105. //Video Grabber
  106. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="VIDEO_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('FRAMEGRAB_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  107. break;
  108. case 100:
  109. //Loopback
  110. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('LOOPBACK_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  111. break;
  112. case 101:
  113. //Ethernet Interface
  114. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('ETHERNET_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  115. break;
  116. case 102:
  117. //WiFi Interface
  118. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WIFI_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  119. break;
  120. case 103:
  121. //Virtual IP Interface
  122. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VIRTUALIP_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  123. break;
  124. case 104:
  125. //VPN Interface
  126. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VPN_TUN_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  127. break;
  128. case 105:
  129. //WAN Interface
  130. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WAN_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  131. break;
  132. //Media Encoder Sink
  133. case 131: // Video Encoder Sink
  134. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Video Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  135. break;
  136. case 132: // Audio Encoder Sink
  137. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Audio Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  138. break;
  139. default:
  140. $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
  141. };
  142. };
  143. echo implode( ',', $SockDataParts );
  144. };
  145. ?>]
  146. },{
  147. xtype: 'panel',
  148. id: 'res_ed_small',
  149. flex: 1,
  150. height: 303,
  151. layout: 'fit',
  152. items:[{
  153. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  154. }]
  155. }]
  156. },{
  157. xtype: 'panel',
  158. title: 'Modules',
  159. layout: 'hbox',
  160. items:[{
  161. xtype: 'panel',
  162. flex: 1,
  163. height: 303,
  164. autoScroll: 'auto',
  165. tbar:[{
  166. text: 'Add Module'
  167. }],
  168. items:[<?php
  169. $QS = "SELECT * FROM server_modules WHERE `server_id`={$Node['aux_id']}";
  170. $Result = $DATABASE->Query( $QS, false );
  171. if( count( $Result ) ){
  172. foreach( $Result as $R ){
  173. $QS = "SELECT * FROM server_module_types WHERE id={$R['type']}";
  174. $MOMO = $DATABASE->Query( $QS, false );
  175. $MOD = $MOMO[0];
  176. switch( $R['type'] ){
  177. case 1:
  178. case 2:
  179. case 3:
  180. case 4:
  181. case 5:
  182. case 6:
  183. case 7:
  184. case 8:
  185. case 9:
  186. case 10:
  187. $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enabled']==0)?'N':'O').'" onclick="editModule('.$R['id'].');">'.$Labels->GetLabel($MOD['name']).'</a>\'}';
  188. break;
  189. default:
  190. $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}';
  191. };
  192. };
  193. echo implode( ',', $ModPart );
  194. };
  195. ?>]
  196. },{
  197. xtype: 'panel',
  198. id: 'mod_ed_small',
  199. flex: 1,
  200. height: 303,
  201. layout: 'fit',
  202. items:[{
  203. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  204. }]
  205. }]
  206. },{
  207. xtype: 'panel',
  208. title: 'Network',
  209. items:[]
  210. }],
  211. listeners:{
  212. afterrender: function(){
  213. settingsAreChanged = false;
  214. }
  215. },
  216. updateSettings: function(){
  217. alert('Update Settings');
  218. }
  219. }
  220. <?php
  221. break;
  222. };
  223. };
  224. } else {
  225. echo "{}";
  226. };
  227. } else {
  228. echo "{}";
  229. };
  230. } else {
  231. echo "{}";
  232. };
  233. ?>