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.

210 lines
5.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/utm/gPoint.php');
  4. $PROP_TPL=<<<_DATA_BOUNDARY
  5. {
  6. xtype: 'form',
  7. labelWidth: 40, // label settings here cascade unless overridden
  8. frame: false,
  9. bodyStyle:'padding:5px 5px 0',
  10. defaultType: 'textfield',
  11. labelAlign: 'right',
  12. items: [{
  13. xtype: 'panel',
  14. height: 100,
  15. html: '<p align="center"><img src="/style/assets/%%%TYPE%%%_node.png"><br/>%%%NAME%%%<br/></p>'
  16. },%%%LOCATION_PART%%%{
  17. xtype:'fieldset',
  18. title: 'Orientation',
  19. collapsible: true,
  20. autoHeight:true,
  21. defaults: {
  22. //width: 168
  23. },
  24. defaultType: 'textfield',
  25. items :[{
  26. fieldLabel: 'Roll',
  27. id: 'sroll',
  28. value: %%%ROLL%%%,
  29. name: 'sroll',
  30. allowBlank:false
  31. },{
  32. fieldLabel: 'Pitch',
  33. id: 'spitch',
  34. value: %%%PITCH%%%,
  35. name: 'spitch',
  36. allowBlank:false
  37. },{
  38. fieldLabel: 'Yaw',
  39. id: 'syaw',
  40. value: %%%YAW%%%,
  41. name: 'syaw',
  42. allowBlank:false
  43. },{
  44. xtype: 'button',
  45. width: '100%',
  46. text: 'Edit Orientation',
  47. handler: orientationEditor
  48. }]
  49. },{
  50. xtype:'fieldset',
  51. title: 'Diff Position',
  52. collapsible: true,
  53. autoHeight:true,
  54. defaults: {
  55. //width: 168
  56. },
  57. defaultType: 'numberfield',
  58. items :[{
  59. fieldLabel: 'ΔX',
  60. id: 'dx',
  61. value: %%%DX%%%,
  62. name: 'dx',
  63. allowBlank:false
  64. },{
  65. fieldLabel: 'ΔY',
  66. id: 'dy',
  67. value: %%%DY%%%,
  68. name: 'dy',
  69. allowBlank:false
  70. },{
  71. fieldLabel: 'ΔZ',
  72. id: 'dz',
  73. value: %%%DZ%%%,
  74. name: 'dz',
  75. allowBlank:false
  76. },{
  77. xtype: 'button',
  78. width: '100%',
  79. text: 'Set Position',
  80. handler: setNodeLocationByDelta
  81. }]
  82. },{
  83. xtype: 'button',
  84. text: 'Update',
  85. width: '100%',
  86. handler: updateLocationOrientation
  87. }]
  88. }
  89. _DATA_BOUNDARY;
  90. $LOCA_TPL=<<<_DATA_BOUNDARY
  91. {
  92. xtype:'fieldset',
  93. //checkboxToggle:true,
  94. collapsible: true,
  95. title: 'Location',
  96. autoHeight: true,
  97. defaults: {
  98. //width: 180
  99. },
  100. defaultType: 'textfield',
  101. collapsed: false,
  102. items :[{
  103. fieldLabel: 'Lat',
  104. name: 'slat',
  105. value: %%%LAT%%%,
  106. id: 'slat',
  107. allowBlank:false
  108. },{
  109. fieldLabel: 'Lon',
  110. id: 'slon',
  111. value: %%%LON%%%,
  112. name: 'slon',
  113. allowBlank:false
  114. },{
  115. fieldLabel: 'Alt',
  116. id: 'salt',
  117. value: %%%ALT%%%,
  118. name: 'salt',
  119. allowBlank:false
  120. },{
  121. xtype: 'button',
  122. text: 'Set To Anchor Position',
  123. width: '100%',
  124. handler: setNodeLocationToAnchor
  125. }]
  126. },
  127. _DATA_BOUNDARY;
  128. if( $CUser->Data['id'] > 1 ){
  129. $Node = intval( $_POST['NODE'] );
  130. $QS = "SELECT * FROM `nodes` WHERE id = {$Node}";
  131. $Result = $DATABASE->Query( $QS, false );
  132. if( count( $Result ) ){
  133. $Props = $Result[0];
  134. $Type = intval( $Props['type'] );
  135. $TName = 'props/loc_prop.js';
  136. $QS = "SELECT * FROM `system_props`";
  137. $R = $DATABASE->Query($QS);
  138. $GPS = ( $R[0]['local_binding'] == 0 );
  139. if( $GPS ){
  140. $PROP_TPL = str_replace('%%%LOCATION_PART%%%', $LOCA_TPL, $PROP_TPL );
  141. } else {
  142. $PROP_TPL = str_replace('%%%LOCATION_PART%%%', '', $PROP_TPL );
  143. };
  144. $SLAT = $R[0]['anchor_lat'];
  145. $SLON = $R[0]['anchor_lon'];
  146. $SALT = $R[0]['anchor_alt'];
  147. $A = new gPoint();
  148. $A->setLongLat( $SLON, $SLAT );
  149. $A->convertLLtoTM();
  150. $XC = $A->E();
  151. $YC = $A->N();
  152. $Zo = floatval( $SALT );
  153. $ZC = $A->Z();
  154. $Data = $PROP_TPL;//file_get_contents( $TName );
  155. $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data );
  156. $Data = str_replace('%%%TYPE%%%', $Type, $Data );
  157. $Data = str_replace('%%%NAME%%%', urldecode( $Props['name'] ), $Data );
  158. switch( $Type ){
  159. case 1:
  160. case 2:
  161. case 3:
  162. case 4:
  163. case ARGUS_3D_SENSOR:
  164. case 6:{
  165. $QS = "SELECT * FROM lrf_sensors WHERE id={$Props['aux_id']}";
  166. $RR = $DATABASE->Query( $QS );
  167. $C = $RR[0];
  168. break;
  169. };
  170. case 10:
  171. case 11:
  172. case 12:
  173. case 13:{
  174. $QS="SELECT * FROM cameras WHERE id={$Props['aux_id']}";
  175. $RR = $DATABASE->Query( $QS );
  176. $C = $RR[0];
  177. break;
  178. };
  179. default: $Data = '{}';
  180. };
  181. $DX = floatval( $C['x'] );
  182. $DY = floatval( $C['y'] );
  183. $DZ = floatval( $C['z'] );
  184. $CC = new gPoint();
  185. $CC->setUTM( $XC + $DX, $YC + $DY, $ZC );
  186. $CC->convertTMtoLL();
  187. $LAT = $CC->Lat();
  188. $LON = $CC->Long();
  189. $ALT = $Zo + $DZ;
  190. $ROLL = floatval( $C['x_rot'] );
  191. $PITCH = floatval( $C['y_rot'] );
  192. $YAW = floatval( $C['z_rot'] );
  193. $Data = str_replace( '%%%LAT%%%', $LAT, $Data );
  194. $Data = str_replace( '%%%LON%%%', $LON, $Data );
  195. $Data = str_replace( '%%%ALT%%%', $ALT, $Data );
  196. $Data = str_replace( '%%%ROLL%%%', $ROLL, $Data );
  197. $Data = str_replace( '%%%PITCH%%%', $PITCH, $Data );
  198. $Data = str_replace( '%%%YAW%%%', $YAW, $Data );
  199. $Data = str_replace( '%%%DX%%%', $DX, $Data );
  200. $Data = str_replace( '%%%DY%%%', $DY, $Data );
  201. $Data = str_replace( '%%%DZ%%%', $DZ, $Data );
  202. echo $Data;
  203. } else {
  204. echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}';
  205. };
  206. } else {
  207. header('location: /');
  208. };
  209. ?>