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.

2781 lines
74 KiB

​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var helpContentTopicID = -1;
  3. var muploader = null;
  4. var uploads_store_id = 0;
  5. var uploads_store = new Ext.data.ArrayStore({
  6. autoDestroy: false,
  7. storeId: 'up_store',
  8. idIndex: 0,
  9. fields: [
  10. {name: 'id', type: 'int' },
  11. {name: 'file_name', type: 'string'},
  12. {name: 'file_id', type: 'string'},
  13. {name: 'size', type: 'string'},
  14. {name: 'progress', type: 'int'},
  15. {name: 'status', type: 'string' }
  16. ]
  17. });
  18. var uploaded_store_id = 0;
  19. var uploaded_store = new Ext.data.ArrayStore({
  20. autoDestroy: false,
  21. storeId: 'mod_store',
  22. idIndex: 0,
  23. fields: [
  24. {name: 'id', type: 'int' },
  25. {name: 'file_name', type: 'string'},
  26. {name: 'size', type: 'int'},
  27. {name: 'status', type: 'int'},
  28. {name: 'ts', type: 'string' },
  29. {name: 'memo', type: 'string' }
  30. ]
  31. });
  32. function progressRenderer( value, meta, record ){
  33. Ext.defer( function( id ){
  34. var p = new Ext.ProgressBar({
  35. id: 'progress_'+id,
  36. renderTo: 'div_'+id,
  37. animate: false,
  38. width: '100%',
  39. value: 0,
  40. text: 'Upload Pending',
  41. });
  42. }, 50, undefined, [ record.data.file_id ] );
  43. return '<div id="div_' + record.data.file_id + '"></div>';
  44. };
  45. var fileUploadsColModel_ops = {
  46. columns: [
  47. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  48. {header: "File Name", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  49. {header: "Size", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  50. {header: "Progress", width: 150, renderer: progressRenderer, dataIndex: 'progress' },
  51. {header: " ", width: 50, dataIndex: 'status3' }
  52. ],
  53. defaults: {
  54. sortable: false,
  55. fixed: true,
  56. menuDisabled: true,
  57. width: 100
  58. }
  59. };
  60. function onModuleFileRenderer( value, meta, record ){
  61. if( value == 0 ){
  62. rv = '<img title="Ready to Upload" alt="Ready to Upload" src="/style/assets/bul_green.png">';
  63. } else {
  64. if( value < 101 ){
  65. rv = '<img title="Uploading" alt="Uploading" src="/style/assets/bul_gray.png">';
  66. } else {
  67. rv = '<img title="Already Uploaded" alt="Already Uploaded" src="/style/assets/bul_blue.png">';
  68. };
  69. };
  70. return rv;
  71. };
  72. var fileModuleColModel_ops = {
  73. columns: [
  74. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  75. {header: "File Name", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  76. {header: "Size", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  77. {header: "Time", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
  78. {header: "Status", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
  79. {header: "Memo", dataIndex: 'memo' }
  80. ],
  81. defaults: {
  82. sortable: false,
  83. fixed: true,
  84. menuDisabled: true,
  85. width: 100
  86. }
  87. };
  88. var fileUploadsSelModel_ops = {
  89. singleSelect: true
  90. };
  91. function loadModuleFiles( sensorID ){
  92. Ext.Ajax.request({
  93. url: '/lib/controller/getDeviceFiles.php',
  94. params: {
  95. UID: <?=$UserID;?>,
  96. SID: '<?=$Session;?>',
  97. DID: sensorID
  98. },
  99. success: function( response, opts ){
  100. var data = Ext.decode( response.responseText );
  101. uploaded_store.removeAll();
  102. uploaded_store.loadData( data.files );
  103. },
  104. failure: failureAJAXFunction
  105. });
  106. };
  107. function loadHelpContent( topicID ){
  108. if( helpContentTopicID == topicID ) return;
  109. helpContentTopicID = topicID;
  110. Ext.Ajax.request({
  111. url: '/lib/controller/getHelpTopic.php',
  112. params: {
  113. UID: <?=$UserID;?>,
  114. SID: '<?=$Session;?>',
  115. TID: topicID
  116. },
  117. success: function( response, opts ){
  118. var tData = Ext.decode(response.responseText);
  119. var tPanel = Ext.getCmp('help_content');
  120. tPanel.removeAll( true );
  121. tPanel.add( tData );
  122. tPanel.doLayout();
  123. },
  124. failure: failureAJAXFunction
  125. });
  126. };
  127. function clearHelpContent(){
  128. helpContentTopicID = -1;
  129. };
  130. function loadRessources(){
  131. Ext.Ajax.request({
  132. url: '/lib/controller/getResources.php',
  133. params: {
  134. UID: <?=$UserID;?>,
  135. SID: '<?=$Session;?>',
  136. },
  137. success: function( response, opts ){
  138. var tData = Ext.decode(response.responseText);
  139. var tPanel = Ext.getCmp('resources_container');
  140. if( tData.status == 'ok' ){
  141. var res = Ext.decode( tData.resources );
  142. tPanel.removeAll( true );
  143. tPanel.add( res );
  144. tPanel.doLayout();
  145. } else {
  146. };
  147. },
  148. failure: failureAJAXFunction
  149. });
  150. };
  151. function loadModules(){
  152. Ext.Ajax.request({
  153. url: '/lib/controller/getModules.php',
  154. params: {
  155. UID: <?=$UserID;?>,
  156. SID: '<?=$Session;?>',
  157. },
  158. success: function( response, opts ){
  159. var tData = Ext.decode(response.responseText);
  160. var tPanel = Ext.getCmp('modules_container');
  161. if( tData.status == 'ok' ){
  162. var res = Ext.decode( tData.modules );
  163. tPanel.removeAll( true );
  164. tPanel.add( res );
  165. tPanel.doLayout();
  166. } else {
  167. tPanel.removeAll( true );
  168. tPanel.doLayout();
  169. var tPanel = Ext.getCmp('mod_ed_small');
  170. tPanel.removeAll( true );
  171. tPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  172. tPanel.doLayout();
  173. };
  174. },
  175. failure: failureAJAXFunction
  176. });
  177. };
  178. function loadFilters(){
  179. Ext.Ajax.request({
  180. url: '/lib/controller/getFilters.php',
  181. params: {
  182. UID: <?=$UserID;?>,
  183. SID: '<?=$Session;?>',
  184. },
  185. success: function( response, opts ){
  186. var tData = Ext.decode(response.responseText);
  187. var tPanel = Ext.getCmp('filters_container');
  188. if( tData.status == 'ok' ){
  189. var res = Ext.decode( tData.modules );
  190. tPanel.removeAll( true );
  191. tPanel.add( res );
  192. tPanel.doLayout();
  193. } else {
  194. tPanel.removeAll( true );
  195. tPanel.doLayout();
  196. var tPanel = Ext.getCmp('flt_ed_small');
  197. tPanel.removeAll( true );
  198. tPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  199. tPanel.doLayout();
  200. };
  201. },
  202. failure: failureAJAXFunction
  203. });
  204. };
  205. function loadPhoneBook(){
  206. Ext.Ajax.request({
  207. url: '/lib/controller/getPhoneBook.php',
  208. params: {
  209. UID: <?=$UserID;?>,
  210. SID: '<?=$Session;?>',
  211. },
  212. success: function( response, opts ){
  213. var data = Ext.decode(response.responseText);
  214. //var tPanel = Ext.getCmp('main_portal');
  215. //tPanel.removeAll(true);
  216. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  217. //tPanel.doLayout();
  218. },
  219. failure: failureAJAXFunction
  220. });
  221. };
  222. var addNPNWindow = null;
  223. function addNewPhoneNumber(){
  224. if( addNPNWindow == null ){
  225. addNPNWindow = new Ext.Window({
  226. title: 'Add New Phone Number',
  227. modal: true,
  228. closeAction: 'hide',
  229. resizable: false,
  230. width: 400,
  231. height: 300,
  232. items:[{
  233. xtype: 'form',
  234. labelWidth: 120,
  235. labelAlign: 'right',
  236. items: [{
  237. xtype: 'textfield',
  238. fieldLabel: 'Name/Label',
  239. id: 'ph_name',
  240. width: 220,
  241. value: ''
  242. },{
  243. xtype: 'textfield',
  244. fieldLabel: 'Phone Number',
  245. id: 'ph_number',
  246. width: 220,
  247. validator: function( a ){
  248. return true;
  249. },
  250. value: ''
  251. },{
  252. xtype: 'radio',
  253. id: 'r_ph_call',
  254. fieldLabel: 'Call Only',
  255. name: 'ph_cam',
  256. checked: true,
  257. value: '1'
  258. },{
  259. xtype: 'radio',
  260. id: 'r_ph_msg',
  261. fieldLabel: 'SMS Only',
  262. name: 'ph_cam',
  263. value: '0'
  264. },{
  265. xtype: 'textarea',
  266. fieldLabel: 'Custom Message',
  267. width: 220,
  268. height: 130,
  269. id: 'cus_sms',
  270. name: 'cus_sms'
  271. }]
  272. }],
  273. bbar:['->',{
  274. text: 'Add',
  275. handler: function(){
  276. var num = Ext.getCmp( 'ph_number' ).getValue();
  277. var lbl = Ext.getCmp( 'ph_name' ).getValue();
  278. var con = (Ext.getCmp( 'r_ph_call' ).getValue())?1:0;
  279. var cust = Ext.getCmp( 'cus_sms' ).getValue();
  280. Ext.Ajax.request({
  281. url: '/lib/controller/addPhoneBookRecord.php',
  282. params: {
  283. UID: <?=$UserID;?>,
  284. SID: '<?=$Session;?>',
  285. PNUM: num,
  286. PNAM: lbl,
  287. PCAL: con,
  288. PMSG: cust
  289. },
  290. success: function( response, opts ){
  291. var data = Ext.decode(response.responseText);
  292. if( data.success ){
  293. } else {
  294. Ext.Msg.show({
  295. title:'Error',
  296. msg: data.msg,
  297. buttons: Ext.Msg.OK,
  298. icon: Ext.MessageBox.ERROR//,
  299. //fn: function(btn, text){
  300. // if( btn == 'yes' ){
  301. // cleanupChangeNotifier();
  302. // } else {
  303. // loadEditor = false;
  304. // };
  305. //}
  306. });
  307. };
  308. //var tPanel = Ext.getCmp('main_portal');
  309. //tPanel.removeAll(true);
  310. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  311. //tPanel.doLayout();
  312. },
  313. failure: failureAJAXFunction
  314. });
  315. }
  316. },{
  317. text: 'Cancel',
  318. handler: function(){
  319. addNPNWindow.hide();
  320. }
  321. }]
  322. });
  323. };
  324. addNPNWindow.show();
  325. };
  326. function loadDetectedCameras(){
  327. Ext.Ajax.request({
  328. url: '/lib/controller/getCameras.php',
  329. params: {
  330. UID: <?=$UserID;?>,
  331. TYP: 0,
  332. SID: '<?=$Session;?>',
  333. },
  334. success: function( response, opts ){
  335. var tData = Ext.decode(response.responseText);
  336. var tPanel = Ext.getCmp('dcam_container');
  337. if( tData.status == 'ok' ){
  338. var res = Ext.decode( tData.cameras );
  339. tPanel.removeAll( true );
  340. tPanel.add( res );
  341. tPanel.doLayout();
  342. var zPanel = Ext.getCmp('dcam_op_small');
  343. zPanel.removeAll( true );
  344. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  345. zPanel.doLayout();
  346. } else {
  347. tPanel.removeAll( true );
  348. tPanel.doLayout();
  349. var zPanel = Ext.getCmp('dcam_op_small');
  350. zPanel.removeAll( true );
  351. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  352. zPanel.doLayout();
  353. };
  354. },
  355. failure: failureAJAXFunction
  356. });
  357. };
  358. function loadAssignedCameras(){
  359. Ext.Ajax.request({
  360. url: '/lib/controller/getCameras.php',
  361. params: {
  362. UID: <?=$UserID;?>,
  363. TYP: 1,
  364. SID: '<?=$Session;?>',
  365. },
  366. success: function( response, opts ){
  367. var tData = Ext.decode(response.responseText);
  368. var tPanel = Ext.getCmp('acam_container');
  369. if( tData.status == 'ok' ){
  370. var res = Ext.decode( tData.cameras );
  371. tPanel.removeAll( true );
  372. tPanel.add( res );
  373. tPanel.doLayout();
  374. var zPanel = Ext.getCmp('acam_op_small');
  375. zPanel.removeAll( true );
  376. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  377. zPanel.doLayout();
  378. } else {
  379. tPanel.removeAll( true );
  380. tPanel.doLayout();
  381. var zPanel = Ext.getCmp('acam_op_small');
  382. zPanel.removeAll( true );
  383. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  384. zPanel.doLayout();
  385. };
  386. },
  387. failure: failureAJAXFunction
  388. });
  389. };
  390. function loadAttachedSensors(){
  391. Ext.Ajax.request({
  392. url: '/lib/controller/getSensors.php',
  393. params: {
  394. UID: <?=$UserID;?>,
  395. SID: '<?=$Session;?>',
  396. },
  397. success: function( response, opts ){
  398. var tData = Ext.decode(response.responseText);
  399. var tPanel = Ext.getCmp('sens_container');
  400. if( tData.status == 'ok' ){
  401. var res = Ext.decode( tData.sensors );
  402. tPanel.removeAll( true );
  403. tPanel.add( res );
  404. tPanel.doLayout();
  405. var zPanel = Ext.getCmp('sens_op_small');
  406. zPanel.removeAll( true );
  407. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  408. zPanel.doLayout();
  409. } else {
  410. tPanel.removeAll( true );
  411. tPanel.doLayout();
  412. var zPanel = Ext.getCmp('sens_op_small');
  413. zPanel.removeAll( true );
  414. zPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
  415. zPanel.doLayout();
  416. };
  417. },
  418. failure: failureAJAXFunction
  419. });
  420. };
  421. function editResource( rid ){
  422. var loadEditor = true;
  423. if( settingsAreChanged ){
  424. Ext.Msg.show({
  425. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  426. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  427. buttons: Ext.Msg.YESNO,
  428. icon: Ext.MessageBox.WARNING,
  429. fn: function(btn, text){
  430. if( btn == 'yes' ){
  431. cleanupChangeNotifier();
  432. } else {
  433. loadEditor = false;
  434. };
  435. }
  436. });
  437. };
  438. if( loadEditor ){
  439. Ext.Ajax.request({
  440. url: '/lib/controller/getResourceEditor.php',
  441. params: {
  442. RID: rid,
  443. UID: <?=$UserID;?>,
  444. SID: '<?=$Session;?>',
  445. },
  446. success: function( response, opts ){
  447. var data = Ext.decode(response.responseText);
  448. var resourceEdPanel = Ext.getCmp('res_ed_small');
  449. if( resourceEdPanel ){
  450. resourceEdPanel.removeAll( true );
  451. resourceEdPanel.add( data );
  452. resourceEdPanel.doLayout();
  453. };
  454. },
  455. failure: failureAJAXFunction
  456. });
  457. };
  458. };
  459. function editFilter( fid ){
  460. var loadEditor = true;
  461. if( settingsAreChanged ){
  462. Ext.Msg.show({
  463. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  464. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  465. buttons: Ext.Msg.YESNO,
  466. icon: Ext.MessageBox.WARNING,
  467. fn: function(btn, text){
  468. if( btn == 'yes' ){
  469. cleanupChangeNotifier();
  470. } else {
  471. loadEditor = false;
  472. };
  473. }
  474. });
  475. };
  476. if( loadEditor ){
  477. Ext.Ajax.request({
  478. url: '/lib/controller/getFilterEditor.php',
  479. params: {
  480. FID: fid,
  481. UID: <?=$UserID;?>,
  482. SID: '<?=$Session;?>',
  483. },
  484. success: function( response, opts ){
  485. var data = Ext.decode(response.responseText);
  486. var resourceEdPanel = Ext.getCmp('flt_ed_small');
  487. if( resourceEdPanel ){
  488. resourceEdPanel.removeAll( true );
  489. resourceEdPanel.add( data );
  490. resourceEdPanel.doLayout();
  491. };
  492. },
  493. failure: failureAJAXFunction
  494. });
  495. };
  496. };
  497. function editModule( mid ){
  498. var loadEditor = true;
  499. if( settingsAreChanged ){
  500. Ext.Msg.show({
  501. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  502. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  503. buttons: Ext.Msg.YESNO,
  504. icon: Ext.MessageBox.WARNING,
  505. fn: function(btn, text){
  506. if( btn == 'yes' ){
  507. cleanupChangeNotifier();
  508. } else {
  509. loadEditor = false;
  510. };
  511. }
  512. });
  513. };
  514. if( loadEditor ){
  515. Ext.Ajax.request({
  516. url: '/lib/controller/getModuleEditor.php',
  517. params: {
  518. MID: mid,
  519. UID: <?=$UserID;?>,
  520. SID: '<?=$Session;?>',
  521. },
  522. success: function( response, opts ){
  523. var data = Ext.decode(response.responseText);
  524. var moduleEdPanel = Ext.getCmp('mod_ed_small');
  525. if( moduleEdPanel ){
  526. moduleEdPanel.removeAll( true );
  527. moduleEdPanel.add( data );
  528. moduleEdPanel.doLayout();
  529. };
  530. },
  531. failure: failureAJAXFunction
  532. });
  533. };
  534. };
  535. function enableModule( ID ){
  536. Ext.Ajax.request({
  537. url: '/lib/controller/doModuleOperation.php',
  538. params: {
  539. OPID: 2,
  540. OPCODE: 1,
  541. MID: ID,
  542. UID: <?=$UserID;?>,
  543. SID: '<?=$Session;?>'
  544. },
  545. success: function(){
  546. //showSettings( SelectedNodeID, 2 );
  547. loadModules();
  548. }
  549. });
  550. };
  551. function disableModule( ID ){
  552. Ext.Ajax.request({
  553. url: '/lib/controller/doModuleOperation.php',
  554. params: {
  555. OPID: 2,
  556. OPCODE: 0,
  557. MID: ID,
  558. UID: <?=$UserID;?>,
  559. SID: '<?=$Session;?>'
  560. },
  561. success: function(){
  562. //showSettings( SelectedNodeID, 2 );
  563. loadModules();
  564. }
  565. });
  566. };
  567. //cursor: url('data:image/svg+xml;utf8,<svg fill="%23FF0000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>') 24 24, auto;
  568. function doCamOperation( cid, op, param, reload = false ){
  569. Ext.Ajax.request({
  570. url: '/lib/controller/doCameraOperation.php',
  571. params: {
  572. CID: cid,
  573. CMD: 10,
  574. OPID: op,
  575. OPCODE: param,
  576. UID: <?=$UserID;?>,
  577. SID: '<?=$Session;?>'
  578. },
  579. success: function(){
  580. if( reload ) loadDetectedCameras();
  581. if( reload ) loadAssignedCameras();
  582. }
  583. });
  584. };
  585. function doApplicationOperation( op, param, reload = false ){
  586. Ext.Ajax.request({
  587. url: '/lib/controller/doApplicationOperation.php',
  588. params: {
  589. OPID: op,
  590. OPCODE: param,
  591. UID: <?=$UserID;?>,
  592. SID: '<?=$Session;?>'
  593. },
  594. success: function(){
  595. //if( reload ) loadDetectedCameras();
  596. //if( reload ) loadAssignedCameras();
  597. }
  598. });
  599. };
  600. function doSensorOperation( sensorid, op, param, reload = false ){
  601. Ext.Ajax.request({
  602. url: '/lib/controller/doSensorOperation.php',
  603. params: {
  604. SNID: sensorid,
  605. CMD: op,
  606. OPID: op,
  607. OPCODE: param,
  608. UID: <?=$UserID;?>,
  609. SID: '<?=$Session;?>'
  610. },
  611. success: function(){
  612. if( reload ) loadAttachedSensors();
  613. }
  614. });
  615. };
  616. function doResourceOperation( resourceid, op, param, value, reload = false ){
  617. Ext.Ajax.request({
  618. url: '/lib/controller/doResourceOperation.php',
  619. params: {
  620. RID: resourceid,
  621. OPID: op,
  622. OPCODE: param,
  623. OPVAL: value,
  624. UID: <?=$UserID;?>,
  625. SID: '<?=$Session;?>'
  626. },
  627. success: function(){
  628. if( reload ) loadAttachedSensors();
  629. }
  630. });
  631. };
  632. function removeModule( ID ){
  633. Ext.Msg.show({
  634. title:'<?=$Labels->GetLabel('_PLS_CONFIRM_');?>',
  635. msg: '<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>',
  636. buttons: Ext.Msg.YESNOCANCEL,
  637. fn: function( btn, text ){
  638. if( btn == 'yes' ){
  639. Ext.Ajax.request({
  640. url: '/lib/controller/doModuleOperation.php',
  641. params: {
  642. OPID: 1,
  643. MID: ID,
  644. UID: <?=$UserID;?>,
  645. SID: '<?=$Session;?>'
  646. },
  647. success: function(){
  648. //showSettings( SelectedNodeID, 2 );
  649. loadModules();
  650. }
  651. });
  652. };
  653. },
  654. icon: Ext.MessageBox.QUESTION
  655. });
  656. };
  657. function disableServOps(){
  658. var tC = Ext.getCmp('servopPanel01');
  659. tC.removeClass('servopInfo_item01');
  660. tC.addClass('servopInfo_item00');
  661. tC.disable();
  662. Ext.getCmp('tbtn_sop01').disable();
  663. //tC.doLayout();
  664. tC = Ext.getCmp('servopPanel02');
  665. tC.removeClass('servopInfo_item11');
  666. tC.addClass('servopInfo_item10');
  667. tC.disable();
  668. Ext.getCmp('tbtn_sop02').disable();
  669. //tC.doLayout();
  670. tC = Ext.getCmp('servopPanel03');
  671. tC.removeClass('servopInfo_item21');
  672. tC.addClass('servopInfo_item20');
  673. tC.disable();
  674. Ext.getCmp('tbtn_sop03').disable();
  675. //tC.doLayout();
  676. tC = Ext.getCmp('servopPanel04');
  677. tC.removeClass('servopInfo_item31');
  678. tC.addClass('servopInfo_item30');
  679. tC.disable();
  680. Ext.getCmp('tbtn_sop04').disable();
  681. //tC.doLayout();
  682. };
  683. function enableServOps(){
  684. var tC = Ext.getCmp('servopPanel01');
  685. if( tC != undefined ){
  686. tC.removeClass('servopInfo_item00');
  687. tC.addClass('servopInfo_item01');
  688. Ext.getCmp('tbtn_sop01').enable();
  689. tC.enable();
  690. };
  691. //tC.doLayout();
  692. tC = Ext.getCmp('servopPanel02');
  693. if( tC != undefined ){
  694. tC.removeClass('servopInfo_item10');
  695. tC.addClass('servopInfo_item11');
  696. tC.enable();
  697. Ext.getCmp('tbtn_sop02').enable();
  698. };
  699. //tC.doLayout();
  700. tC = Ext.getCmp('servopPanel03');
  701. if( tC != undefined ){
  702. tC.removeClass('servopInfo_item20');
  703. tC.addClass('servopInfo_item21');
  704. tC.enable();
  705. Ext.getCmp('tbtn_sop03').enable();
  706. };
  707. //tC.doLayout();
  708. tC = Ext.getCmp('servopPanel04');
  709. if( tC != undefined ){
  710. tC.removeClass('servopInfo_item30');
  711. tC.addClass('servopInfo_item31');
  712. tC.enable();
  713. Ext.getCmp('tbtn_sop04').enable();
  714. };
  715. //tC.doLayout();
  716. };
  717. function updateServerStatus(){
  718. Ext.Ajax.request({
  719. url: '/lib/controller/getServerStatus.php',
  720. params: {
  721. SERVID: 1,
  722. UID: <?=$UserID;?>,
  723. SID: '<?=$Session;?>'
  724. },
  725. success: function( response, opts ){
  726. // If the response is JSON, you have to decode it
  727. var sps = document.getElementById("INFO_SPS");
  728. if( sps == undefined ) return;
  729. var data = Ext.decode(response.responseText);
  730. if( data.status == 'ok' ){
  731. serverIsOnLine = true;
  732. enableServOps();
  733. //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info;
  734. //document.getElementById('OS_NFO').innerHTML = data.stats.os_info;
  735. //document.getElementById('BLD_NFO').innerHTML = data.stats.build;
  736. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  737. setDonatStatus( 1, 1, data.stats.stat_mem );
  738. setDonatStatus( 1, 2, data.stats.stat_disk );
  739. setDonatStatus( 1, 3, data.stats.temp0 );
  740. sps.classList.remove('setEd_infoPanel');
  741. sps.classList.add('setEl_infoPanel');
  742. } else {
  743. serverIsOnLine = false;
  744. disableServOps();
  745. if( data.status == 'na' ){
  746. setDonatStatus( 1, 0, -1 );
  747. setDonatStatus( 1, 1, -1 );
  748. setDonatStatus( 1, 2, -1 );
  749. setDonatStatus( 1, 3, -1 );
  750. sps.classList.remove('setEl_infoPanel');
  751. sps.classList.add('setEd_infoPanel');
  752. } else {
  753. Ext.Msg.show({
  754. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  755. msg: data.messages,
  756. buttons: Ext.Msg.OK,//YESNOCANCEL,
  757. fn: function(){
  758. },
  759. icon: Ext.MessageBox.INFO //QUESTION
  760. });
  761. };
  762. };
  763. if( tlInterval == null ){
  764. tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite );
  765. };
  766. },
  767. failure: failureAJAXFunction
  768. });
  769. };
  770. var addE2UDialog = null;
  771. function addEthernet2Uart(){
  772. if( addE2UDialog == null ){
  773. addE2UDialog = new Ext.Window({
  774. modal: true,
  775. title: '<?=$Labels->GetLabel('_ADD_E2U_DIAL_TTL_');?>',
  776. width: 400,
  777. height: 560,
  778. layout: 'fit',
  779. closeAction: 'hide',
  780. items:[{
  781. xtype: 'form',
  782. labelWidth: 120, // label settings here cascade unless overridden
  783. frame: false,
  784. width: 400,
  785. labelAlign: 'right',
  786. //bodyStyle:'padding:5px 5px 0',
  787. defaultType: 'textfield',
  788. items:[{
  789. xtype: 'panel',
  790. height: 200,
  791. frame: false,
  792. border: false,
  793. html: '<center><img width="200px" src="/style/assets/eth2uart.png"></center>'
  794. },/*{
  795. fieldLabel: 'Name',
  796. id: 'ued_name'
  797. },{
  798. xtype: 'combo',
  799. fieldLabel: '<?=$Labels->GetLabel('_CONNECT_2_');?>',
  800. id: 'ued_servid',
  801. editable: false,
  802. typeAhead: true,
  803. triggerAction: 'all',
  804. width: '100%',
  805. lazyRender:true,
  806. mode: 'local',
  807. store: new Ext.data.ArrayStore({
  808. <?php
  809. $QS = "SELECT `id`, `name` FROM `nodes` WHERE `type`=0";
  810. $Servers = $DATABASE->Query( $QS );
  811. $SLIST = array();
  812. $SSID = 0;
  813. if( count( $Servers ) ){
  814. foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']';
  815. $SSID = intval( $Servers[0]['id'] );
  816. };
  817. //[1,'Server Node'], [2,'Aux Server']
  818. ?>
  819. fields: ['sid', 'snam'],
  820. data: [<?=implode(',',$SLIST);?>]
  821. }),
  822. value: <?=$SSID;?>,
  823. valueField: 'sid',
  824. displayField: 'snam'
  825. },*/{
  826. xtype: 'combo',
  827. fieldLabel: '<?=$Labels->GetLabel('UART_COM_SPEED');?>',
  828. id: 'ued_speed',
  829. editable: false,
  830. typeAhead: true,
  831. triggerAction: 'all',
  832. width: '100%',
  833. lazyRender:true,
  834. mode: 'local',
  835. store: new Ext.data.ArrayStore({
  836. fields: ['speed'],
  837. data: [[19200], [115200]]
  838. }),
  839. value: 19200,
  840. valueField: 'speed',
  841. displayField: 'speed'
  842. },{
  843. xtype: 'combo',
  844. fieldLabel: '<?=$Labels->GetLabel('UART_COM_BITS');?>',
  845. id: 'ued_bit',
  846. editable: false,
  847. typeAhead: true,
  848. triggerAction: 'all',
  849. width: '100%',
  850. lazyRender:true,
  851. mode: 'local',
  852. store: new Ext.data.ArrayStore({
  853. fields: ['bits'],
  854. data: [[5],[6],[7],[8],[9]]
  855. }),
  856. value: 8,
  857. valueField: 'bits',
  858. displayField: 'bits'
  859. },{
  860. xtype: 'combo',
  861. fieldLabel: '<?=$Labels->GetLabel('UART_COM_SBITS');?>',
  862. id: 'ued_stops',
  863. editable: false,
  864. typeAhead: true,
  865. triggerAction: 'all',
  866. width: '100%',
  867. lazyRender:true,
  868. mode: 'local',
  869. store: new Ext.data.ArrayStore({
  870. fields: ['stops'],
  871. data: [[1],[1.5],[2]]
  872. }),
  873. value: 1,
  874. valueField: 'stops',
  875. displayField: 'stops'
  876. },{
  877. xtype: 'combo',
  878. fieldLabel: '<?=$Labels->GetLabel('UART_COM_PARITY');?>',
  879. id: 'ued_parity',
  880. editable: false,
  881. typeAhead: true,
  882. triggerAction: 'all',
  883. width: '100%',
  884. lazyRender:true,
  885. mode: 'local',
  886. store: new Ext.data.ArrayStore({
  887. fields: ['parity'],
  888. data: [['Odd'], ['Even'],['None']]
  889. }),
  890. value: 'None',
  891. valueField: 'parity',
  892. displayField: 'parity'
  893. },{
  894. xtype: 'combo',
  895. fieldLabel: '<?=$Labels->GetLabel('_WORKING_MODE_');?>',
  896. id: 'ued_mode',
  897. editable: false,
  898. typeAhead: true,
  899. triggerAction: 'all',
  900. width: '100%',
  901. lazyRender:true,
  902. mode: 'local',
  903. store: new Ext.data.ArrayStore({
  904. fields: ['mode','mode_txt'],
  905. data: [[0,'<?=$Labels->GetLabel('_UDP_CLIENT_');?>'], [1,'<?=$Labels->GetLabel('_TCP_CLIENT_');?>'], [2,'<?=$Labels->GetLabel('_UDP_SERVER_');?>'], [3,'<?=$Labels->GetLabel('_TCP_SERVER_');?>']]
  906. }),
  907. value: 3,
  908. valueField: 'mode',
  909. displayField: 'mode_txt'
  910. },{
  911. fieldLabel: '<?=$Labels->GetLabel('_DEVICE_IP_');?>',
  912. id: 'ued_ip'
  913. },{
  914. fieldLabel: '<?=$Labels->GetLabel('_DEVICE_PORT_');?>',
  915. value: 8234,
  916. id: 'ued_port'
  917. }],
  918. bbar: [{
  919. text: 'Cancel',
  920. handler: function(){//discoverOnvifSources
  921. addE2UDialog.hide();
  922. }
  923. },'->',{
  924. id: 'con_to_src',
  925. text: 'Add Adapter to Site',
  926. disabled: false,
  927. handler: function(){
  928. var SPD = Ext.getCmp('ued_speed').getValue();
  929. var BIT = Ext.getCmp('ued_bit').getValue();
  930. var STP = Ext.getCmp('ued_stops').getValue();
  931. var PAR = Ext.getCmp('ued_parity').getValue();
  932. var MOD = Ext.getCmp('ued_mode').getValue();
  933. var IP = Ext.getCmp('ued_ip').getValue();
  934. var PORT= Ext.getCmp('ued_port').getValue();
  935. var MAC = '';//Ext.getCmp('ued_mac').getValue();
  936. //var NAME= Ext.getCmp('ued_name').getValue();
  937. //var SRV = Ext.getCmp('ued_servid').getValue();
  938. Ext.Ajax.request({
  939. url: '/lib/controller/addNode.php',
  940. params: {
  941. TYPE: 20,
  942. UART_SPEED: SPD,
  943. UART_BITS: BIT,
  944. UART_STOP: STP,
  945. UART_PAR: PAR,
  946. UART_MODE: MOD,
  947. UART_IP: IP,
  948. UART_PORT: PORT,
  949. UART_MAC: MAC,
  950. //UART_NAME: NAME,
  951. UID: <?=$UserID;?>,
  952. //SRVID: SRV,
  953. SID: '<?=$Session;?>'
  954. },
  955. success: function( response, opts ){
  956. var data = Ext.decode(response.responseText);
  957. if( data.sucess == false ){
  958. Ext.Msg.show({
  959. title:'Request Failure!',
  960. msg: data.error,
  961. buttons: Ext.Msg.OK,
  962. icon: Ext.MessageBox.INFO
  963. });
  964. } else {
  965. loadRessources();
  966. };
  967. addE2UDialog.hide();
  968. },
  969. failure: function( response, opts ) {
  970. failureAJAXFunction( response, opts );
  971. addE2UDialog.hide();
  972. }
  973. });
  974. }
  975. }]
  976. }]
  977. });
  978. };
  979. addE2UDialog.show();
  980. };
  981. var addSensorDialog = null;
  982. var addSensWM = null;
  983. function addSensor(){
  984. if( addSensorDialog == null ){
  985. addSensorDialog = new Ext.Window({
  986. modal: true,
  987. title: '<?=$Labels->GetLabel('_SMM_ADD_LSEN_');?>',
  988. width: 500,
  989. height: 438,
  990. layout: 'form',
  991. closeAction: 'hide',
  992. labelWidth: 160,
  993. labelAlign: 'right',
  994. items:[{
  995. xtype: 'panel',
  996. frame: false,
  997. border: false,
  998. html: '<table width="100%" border=0><tr><td align="center" valign="middle"><div id="asd_img_div" class="node_1_img_set"></div></td></tr></table>'
  999. },{
  1000. xtype: 'spacer',
  1001. height: 8
  1002. },{
  1003. xtype: 'combo',
  1004. id: 'sens_type',
  1005. fieldLabel: "<?=$Labels->GetLabel('SENS_TYPE');?>",
  1006. lazyRender: true,
  1007. mode: 'local',
  1008. forceSelection: true,
  1009. triggerAction: 'all',
  1010. editable: false,
  1011. disableKeyFilter: true,
  1012. store: new Ext.data.ArrayStore({
  1013. fields: ['mode','mode_txt'],
  1014. data: [
  1015. [1,'ALS Sensor'],
  1016. [2,'LFS Sensor'],
  1017. [3,'PLS 200 Sensor'],
  1018. [4,'PLS 360 Sensor']
  1019. ]
  1020. }),
  1021. valueField: 'mode',
  1022. displayField: 'mode_txt',
  1023. value: 1,
  1024. width: 200,
  1025. listeners:{
  1026. select: function( a, v, c ){
  1027. var ii = document.getElementById( 'asd_img_div' );
  1028. ii.className = "node_"+(c+1)+"_img_set";
  1029. }
  1030. }
  1031. },{
  1032. xtype: 'combo',
  1033. id: 'sens_range',
  1034. fieldLabel: "<?=$Labels->GetLabel('SENS_RANGE');?>",
  1035. lazyRender: true,
  1036. mode: 'local',
  1037. forceSelection: true,
  1038. triggerAction: 'all',
  1039. editable: false,
  1040. disableKeyFilter: true,
  1041. store: new Ext.data.ArrayStore({
  1042. fields: ['range','range_txt'],
  1043. data: [
  1044. [15,'15 Meters'],
  1045. [35,'35 Meters'],
  1046. [65,'65 Meters'],
  1047. [75,'75 Meters'],
  1048. [150,'150 Meters'],
  1049. [200,'200 Meters'],
  1050. [300,'300 Meters']
  1051. ]
  1052. }),
  1053. valueField: 'range',
  1054. displayField: 'range_txt',
  1055. value: 15,
  1056. width: 200
  1057. },{
  1058. xtype: 'numberfield',
  1059. id: 'sens_id',
  1060. fieldLabel: '<?=$Labels->GetLabel('_PROTO_DEVICE_ID_');?>',
  1061. width: 200,
  1062. value: 0
  1063. },{
  1064. xtype: 'combo',
  1065. fieldLabel: '<?=$Labels->GetLabel('_UART_PORT_');?>',
  1066. lazyRender: true,
  1067. id: 'uart_id',
  1068. mode: 'local',
  1069. disabled: false,
  1070. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1071. store: new Ext.data.ArrayStore({
  1072. fields: ['uart','uart_txt'],
  1073. data: [<?php
  1074. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )";
  1075. $RR=$DATABASE->Query( $QS );
  1076. if( count( $RR ) ){
  1077. $RE=array();
  1078. foreach( $RR as $R ){
  1079. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  1080. };
  1081. echo implode( ',', $RE );
  1082. } else {
  1083. echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  1084. };
  1085. ?>]
  1086. }),
  1087. valueField: 'uart',
  1088. displayField: 'uart_txt',
  1089. width: 200
  1090. },{
  1091. xtype:'button',
  1092. width: '100%',
  1093. text: '<?=$Labels->GetLabel('_ADD_');?>',
  1094. handler: function(){
  1095. var TYP = parseInt( Ext.getCmp('sens_type').getValue() );
  1096. var RAN = parseInt( Ext.getCmp('sens_range').getValue() );
  1097. var PID = parseInt( Ext.getCmp('sens_id').getValue() );
  1098. var RTI = parseInt( Ext.getCmp('uart_id').getValue() );
  1099. if( RTI > 0 ){
  1100. addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1101. addSensWM.show();
  1102. Ext.Ajax.request({
  1103. url: '/lib/controller/doNodeOperation.php',
  1104. params: {
  1105. UID: <?=$UserID;?>,
  1106. SID: '<?=$Session;?>',
  1107. TYPE: TYP,
  1108. DEVID: PID,
  1109. UART: RTI,
  1110. RANGE: RAN,
  1111. CCMD: 1
  1112. },
  1113. success: function( response, opts ){
  1114. addSensWM.hide();
  1115. var data = Ext.decode(response.responseText);
  1116. if( data.status == 'ok' ){
  1117. loadAttachedSensors();
  1118. } else {
  1119. Ext.Msg.show({
  1120. title:'Error!',
  1121. msg: data.msg,
  1122. buttons: Ext.Msg.OK,
  1123. icon: Ext.MessageBox.WARNING
  1124. });
  1125. };
  1126. addSensorDialog.hide();
  1127. },
  1128. failure: failureAJAXFunction
  1129. });
  1130. } else {
  1131. Ext.Msg.show({
  1132. title:'Error!',
  1133. msg: 'Please Choose UART Port',
  1134. buttons: Ext.Msg.OK,
  1135. icon: Ext.MessageBox.WARNING
  1136. });
  1137. };
  1138. }
  1139. }]
  1140. });
  1141. };
  1142. addSensorDialog.show();
  1143. };
  1144. var addDetCamDialog = null;
  1145. var addDetCamWM = null;
  1146. function addDetectedIPCam(){
  1147. if( addDetCamDialog == null ){
  1148. addDetCamDialog = new Ext.Window({
  1149. modal: true,
  1150. title: '<?=$Labels->GetLabel('_ADD_CAM_DIAL_TTL_');?>',
  1151. width: 400,
  1152. height: 187,
  1153. layout: 'form',
  1154. closeAction: 'hide',
  1155. labelWidth: 160,
  1156. labelAlign: 'right',
  1157. items:[{
  1158. xtype: 'spacer',
  1159. height: 8
  1160. },{
  1161. xtype: 'textfield',
  1162. id: 'ncam_ip',
  1163. fieldLabel: 'Camera IP Address',
  1164. value: ''
  1165. },{
  1166. xtype: 'textfield',
  1167. id: 'ncam_user',
  1168. fieldLabel: 'Access Login',
  1169. value: ''
  1170. },{
  1171. xtype: 'textfield',
  1172. id: 'ncam_pwd',
  1173. inputType: 'password',
  1174. fieldLabel: 'Access Password',
  1175. value: ''
  1176. },{
  1177. xtype: 'combo',
  1178. id: 'ncam_auth_mode',
  1179. fieldLabel: '<?=$Labels->GetLabel('_AUTH_MODE_0_');?>',
  1180. lazyRender: true,
  1181. mode: 'local',
  1182. forceSelection: true,
  1183. triggerAction: 'all',
  1184. editable: false,
  1185. disableKeyFilter: true,
  1186. store: new Ext.data.ArrayStore({
  1187. fields: ['mode','mode_txt'],
  1188. data: [
  1189. [0,'BASIC'],
  1190. [1,'DIGEST'],
  1191. [2,'DIGEST_IE'],
  1192. [3,'BEARER'],
  1193. [4,'NEGOTIATE'],
  1194. [5,'NTLM'],
  1195. [6,'NTLM_WB'],
  1196. [7,'ANY'],
  1197. [8,'ANYSAFE'],
  1198. [9,'ONLY'],
  1199. [10,'AWS_SIGV4']
  1200. ]
  1201. }),
  1202. valueField: 'mode',
  1203. displayField: 'mode_txt',
  1204. value: 0,
  1205. width: 200
  1206. },{
  1207. xtype: 'spacer',
  1208. height: 8
  1209. },{
  1210. xtype:'button',
  1211. width: '100%',
  1212. text: 'Add Camera to List',
  1213. handler: function(){
  1214. addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1215. addDetCamWM.show();
  1216. var NIP = Ext.getCmp('ncam_ip').getValue();
  1217. var NUU = Ext.getCmp('ncam_user').getValue();
  1218. var NPP = Ext.getCmp('ncam_pwd').getValue();
  1219. var NAM = Ext.getCmp('ncam_auth_mode').getValue();
  1220. Ext.Ajax.request({
  1221. url: '/lib/controller/doCameraOperation.php',
  1222. params: {
  1223. UID: <?=$UserID;?>,
  1224. SID: '<?=$Session;?>',
  1225. IP: NIP,
  1226. UU: NUU,
  1227. PP: NPP,
  1228. AU: NAM,
  1229. CMD: 3
  1230. },
  1231. success: function( response, opts ){
  1232. addDetCamWM.hide();
  1233. var data = Ext.decode(response.responseText);
  1234. if( data.status == 'ok' ){
  1235. loadDetectedCameras();
  1236. } else {
  1237. Ext.Msg.show({
  1238. title:'Error!',
  1239. msg: data.msg,
  1240. buttons: Ext.Msg.OK,
  1241. icon: Ext.MessageBox.WARNING
  1242. });
  1243. };
  1244. addDetCamDialog.hide();
  1245. },
  1246. failure: failureAJAXFunction
  1247. });
  1248. }
  1249. }]
  1250. });
  1251. };
  1252. addDetCamDialog.show();
  1253. };
  1254. var devUploadTimeout = null;
  1255. var devUploadID = -1;
  1256. function fetchDeviceUploadStatus(){
  1257. clearTimeout( devUploadTimeout );
  1258. if( devUploadID < 1 ) return;
  1259. Ext.Ajax.request({
  1260. url: '/lib/controller/getDeviceUploadStatus.php',
  1261. params: {
  1262. UID: <?=$UserID;?>,
  1263. SID: '<?=$Session;?>',
  1264. DID: devUploadID
  1265. },
  1266. success: function( response, opts ){
  1267. var data = Ext.decode(response.responseText);
  1268. var tT = Ext.getCmp('upp_ttext');
  1269. if( tT != undefined ){
  1270. if( data.count > 0 ){
  1271. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1272. };
  1273. if( data.current != undefined ){
  1274. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1275. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1276. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1277. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1278. } else {
  1279. Ext.getCmp('upload_progres_panel').hide();
  1280. Ext.getCmp('uploaded_grid').show();
  1281. loadModuleFiles( devUploadID );
  1282. };
  1283. };
  1284. },
  1285. failure: failureAJAXFunction
  1286. });
  1287. };
  1288. function showSettingsGeneral(){
  1289. stopStatusUpdater();
  1290. content_lvl1 = 1;
  1291. content_lvl2 = 0;
  1292. var tPanel = Ext.getCmp('main_content');
  1293. tPanel.removeAll( true );
  1294. <?php
  1295. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  1296. //$SDD = $DATABASE->Query( $QS );
  1297. //$NData = $SDD[0];
  1298. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  1299. $CN = $DATABASE->Query( $QS );
  1300. $IL=array();
  1301. foreach( $CN as $N ){
  1302. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  1303. $NWD = $DATABASE->Query( $QS );
  1304. $NW = $NWD[0];
  1305. $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>";
  1306. };
  1307. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  1308. ?>
  1309. tPanel.add({
  1310. xtype: 'tabpanel',
  1311. frame: false,
  1312. id: 'node_settings_content',
  1313. border: false,
  1314. activeTab: content_lvl3,
  1315. items: [{
  1316. xtype: 'panel',
  1317. id: 'gi_tab',
  1318. title: 'General Info',
  1319. layout: 'hbox',
  1320. items:[{
  1321. xtype: 'panel',
  1322. flex: 1,
  1323. height: PanelH-15,
  1324. autoScroll: false,
  1325. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1326. <tr><td height="100px"><table width="100%" border=0><tr>\
  1327. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut0_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue0">0</text><text x="50%" y="50%" class="chart-label">CPU</text></g></svg></td>\
  1328. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut1_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue1">0</text><text x="50%" y="50%" class="chart-label">MEM</text></g></svg></td>\
  1329. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut2_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue2">0</text><text x="50%" y="50%" class="chart-label">DISK</text></g></svg></td>\
  1330. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut3_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue3">0</text><text x="50%" y="50%" class="chart-label">TEMP</text></g></svg></td>\
  1331. </tr></table></td></tr>\
  1332. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1333. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1334. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1335. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1336. </div></td></tr>\
  1337. <tr><td height="60%">&nbsp;</td></tr></table>'
  1338. },{
  1339. xtype: 'panel',
  1340. id: '_ed_small',
  1341. flex: 1,
  1342. height: PanelH-15,
  1343. autoScroll: false,
  1344. items:[{
  1345. xtype: 'panel',
  1346. baseCls:'servopInfo_item00',
  1347. id: 'servopPanel01',
  1348. items:[{
  1349. xtype: 'panel',
  1350. frame: false,
  1351. border: false,
  1352. unstyled: true,
  1353. html: '<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>'
  1354. },{
  1355. xtype: 'button',
  1356. lazyRender: true,
  1357. iconCls: 'srv_op_restart',
  1358. text: '<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>',
  1359. id: 'tbtn_sop01',
  1360. scale: 'large',
  1361. width: '95%',
  1362. disabled: true,
  1363. handler: function( bt ){
  1364. Ext.Msg.show({
  1365. title:'<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>',
  1366. msg: '<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>',
  1367. buttons: Ext.Msg.YESNO,
  1368. width: 400,
  1369. icon: Ext.MessageBox.INFO,
  1370. fn: function(btn, text){
  1371. if( btn == 'yes' ){
  1372. disableServOps();
  1373. doDeviceOperation( 1, 250,'', true );
  1374. };
  1375. }
  1376. });
  1377. }
  1378. }]
  1379. },{
  1380. xtype: 'spacer',
  1381. height: 8
  1382. },{
  1383. xtype: 'panel',
  1384. baseCls:'servopInfo_item10',
  1385. id: 'servopPanel02',
  1386. items:[{
  1387. xtype: 'panel',
  1388. frame: false,
  1389. border: false,
  1390. unstyled: true,
  1391. html: '<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>'
  1392. },{
  1393. xtype: 'button',
  1394. iconCls: 'srv_op_hw_init',
  1395. text: '<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>',
  1396. id: 'tbtn_sop02',
  1397. scale: 'large',
  1398. width: '95%',
  1399. disabled: true,
  1400. handler: function( bt ){
  1401. Ext.Msg.show({
  1402. title:'<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>',
  1403. msg: '<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>',
  1404. buttons: Ext.Msg.YESNO,
  1405. width: 400,
  1406. icon: Ext.MessageBox.INFO,
  1407. fn: function(btn, text){
  1408. if( btn == 'yes' ){
  1409. disableServOps();
  1410. doDeviceOperation( 1, 251,'', true );
  1411. };
  1412. }
  1413. });
  1414. }
  1415. }]
  1416. },{
  1417. xtype: 'spacer',
  1418. height: 8
  1419. },{
  1420. xtype: 'panel',
  1421. baseCls:'servopInfo_item20',
  1422. id: 'servopPanel03',
  1423. items:[{
  1424. xtype: 'panel',
  1425. frame: false,
  1426. border: false,
  1427. unstyled: true,
  1428. html: '<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>'
  1429. },{
  1430. xtype: 'button',
  1431. iconCls: 'srv_op_power_cycle',
  1432. text: '<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>',
  1433. id: 'tbtn_sop03',
  1434. scale: 'large',
  1435. width: '95%',
  1436. disabled: true,
  1437. handler: function( bt ){
  1438. Ext.Msg.show({
  1439. title:'<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>',
  1440. msg: '<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>',
  1441. buttons: Ext.Msg.YESNO,
  1442. width: 400,
  1443. icon: Ext.MessageBox.WARNING,
  1444. fn: function(btn, text){
  1445. if( btn == 'yes' ){
  1446. cleanupChangeNotifier();
  1447. } else {
  1448. loadEditor = false;
  1449. };
  1450. }
  1451. });
  1452. }
  1453. }]
  1454. },{
  1455. xtype: 'spacer',
  1456. height: 8
  1457. },{
  1458. xtype: 'panel',
  1459. baseCls:'servopInfo_item30',
  1460. id: 'servopPanel04',
  1461. items:[{
  1462. xtype: 'panel',
  1463. frame: false,
  1464. border: false,
  1465. unstyled: true,
  1466. html: '<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>'
  1467. },{
  1468. xtype: 'button',
  1469. iconCls: 'srv_op_factory_reset',
  1470. text: '<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>',
  1471. id: 'tbtn_sop04',
  1472. scale: 'large',
  1473. width: '95%',
  1474. disabled: true,
  1475. handler: function( bt ){
  1476. Ext.Msg.show({
  1477. title:'<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>',
  1478. msg: '<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>',
  1479. buttons: Ext.Msg.YESNO,
  1480. width: 400,
  1481. icon: Ext.MessageBox.ERROR,
  1482. fn: function(btn, text){
  1483. if( btn == 'yes' ){
  1484. disableServOps();
  1485. doDeviceOperation( 1, 254,'', true );
  1486. };
  1487. }
  1488. });
  1489. }
  1490. }]
  1491. }]
  1492. }]
  1493. },{
  1494. xtype: 'panel',
  1495. title: 'Resources',
  1496. id: 'res_tab',
  1497. layout: 'hbox',
  1498. items:[{
  1499. xtype: 'panel',
  1500. id: 'resources_container',
  1501. flex: 1,
  1502. height: PanelH-15,
  1503. autoScroll: 'auto',
  1504. tbar:[{
  1505. text: '<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>',
  1506. handler: function(){
  1507. addEthernet2Uart();
  1508. }
  1509. }],
  1510. items:[]
  1511. },{
  1512. xtype: 'panel',
  1513. id: 'res_ed_small',
  1514. flex: 1,
  1515. height: PanelH-15,
  1516. layout: 'fit',
  1517. items:[{
  1518. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1519. }]
  1520. }]
  1521. },{
  1522. xtype: 'panel',
  1523. title: 'Modules',
  1524. id: 'mod_tab',
  1525. layout: 'hbox',
  1526. items:[{
  1527. xtype: 'panel',
  1528. id: 'modules_container',
  1529. flex: 1,
  1530. height: PanelH-15,
  1531. autoScroll: 'auto',
  1532. tbar:[{
  1533. text: 'Add Module',
  1534. handler: function(){
  1535. var addModuleWindow = new Ext.Window({
  1536. id: 'huha_boa',
  1537. title: 'Add Server Module',
  1538. modal: true,
  1539. width: 400,
  1540. height: 300,
  1541. items:[{
  1542. xtype: 'form',
  1543. items: [{
  1544. xtype: 'combo',
  1545. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1546. id: 'mod_type',
  1547. lazyRender: true,
  1548. mode: 'local',
  1549. forceSelection: true,
  1550. triggerAction: 'all',
  1551. editable: false,
  1552. disableKeyFilter: true,
  1553. store: new Ext.data.ArrayStore({
  1554. fields: ['az_t','az_txt'],
  1555. data: [<?php
  1556. $QS = "SELECT * FROM `module_types`";
  1557. $MM = $DATABASE->Query( $QS );
  1558. $MIMO = array();
  1559. foreach( $MM as $M ) $MIMO[]="[{$M['id']},'".$Labels->GetLabel($M['name'])."']";
  1560. echo implode( ',', $MIMO );
  1561. ?>]
  1562. }),
  1563. valueField: 'az_t',
  1564. displayField: 'az_txt',
  1565. value: 1,
  1566. listeners:{
  1567. select: function( t, r, i ){
  1568. var n = r.data.az_t;
  1569. Ext.Ajax.request({
  1570. url: '/lib/controller/getModuleInfo.php',
  1571. params: {
  1572. MID: n,
  1573. UID: <?=$UserID;?>,
  1574. SID: '<?=$Session;?>'
  1575. },
  1576. success: function( response, opts ){
  1577. Ext.getCmp('infopan').update( response.responseText );
  1578. }
  1579. });
  1580. }
  1581. }
  1582. },{
  1583. xtype: 'panel',
  1584. id: 'infopan',
  1585. html: ''
  1586. }]
  1587. }],
  1588. bbar:[{
  1589. text: 'Cancel',
  1590. handler: function(){
  1591. addModuleWindow.close();
  1592. }
  1593. },{
  1594. text: 'Add Module',
  1595. handler: function(){
  1596. var mtyp = Ext.getCmp('mod_type').getValue();
  1597. Ext.Ajax.request({
  1598. url: '/lib/controller/addModule.php',
  1599. params: {
  1600. SERVID: 1,
  1601. TYPE: mtyp,
  1602. UID: <?=$UserID;?>,
  1603. SID: '<?=$Session;?>'
  1604. },
  1605. success: function( response, opts ){
  1606. // If the response is JSON, you have to decode it
  1607. var data = Ext.decode(response.responseText);
  1608. if( data.status == 'ok' ){
  1609. addModuleWindow.close();
  1610. loadModules();
  1611. } else {
  1612. Ext.Msg.show({
  1613. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  1614. msg: data.message,
  1615. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1616. fn: function(){
  1617. //SettingsLidar3D.hide();
  1618. },
  1619. icon: Ext.MessageBox.INFO //QUESTION
  1620. });
  1621. }
  1622. },
  1623. failure: failureAJAXFunction
  1624. });
  1625. }
  1626. }]
  1627. });
  1628. addModuleWindow.show();
  1629. }
  1630. }],
  1631. items:[]
  1632. },{
  1633. xtype: 'panel',
  1634. id: 'mod_ed_small',
  1635. flex: 1,
  1636. height: PanelH-15,
  1637. layout: 'fit',
  1638. items:[{
  1639. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1640. }]
  1641. }]
  1642. },{
  1643. xtype: 'panel',
  1644. title: 'Filters',
  1645. id: 'flt_tab',
  1646. layout: 'hbox',
  1647. items:[{
  1648. xtype: 'panel',
  1649. id: 'filters_container',
  1650. flex: 1,
  1651. height: PanelH-15,
  1652. autoScroll: 'auto',
  1653. tbar:[{
  1654. text: 'Add Filter',
  1655. handler: function(){
  1656. var addFilterWindow = new Ext.Window({
  1657. id: 'fulu_boa',
  1658. title: 'Add Event Filter',
  1659. modal: true,
  1660. width: 400,
  1661. height: 300,
  1662. items:[{
  1663. xtype: 'form',
  1664. items: [{
  1665. xtype: 'combo',
  1666. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1667. id: 'flt_type',
  1668. lazyRender: true,
  1669. mode: 'local',
  1670. forceSelection: true,
  1671. triggerAction: 'all',
  1672. editable: false,
  1673. disableKeyFilter: true,
  1674. store: new Ext.data.ArrayStore({
  1675. fields: ['az_t','az_txt'],
  1676. data: [<?php
  1677. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1678. $JIJI=$DATABASE->Query( $QS );
  1679. $OOP = array();
  1680. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1681. echo implode(',', $OOP );
  1682. ?>]
  1683. }),
  1684. valueField: 'az_t',
  1685. displayField: 'az_txt',
  1686. value: 1,
  1687. listeners:{
  1688. select: function( t, r, i ){
  1689. var n = r.data.az_t;
  1690. Ext.Ajax.request({
  1691. url: '/lib/controller/getFilterInfo.php',
  1692. params: {
  1693. FID: n,
  1694. UID: <?=$UserID;?>,
  1695. SID: '<?=$Session;?>'
  1696. },
  1697. success: function( response, opts ){
  1698. Ext.getCmp('filt_infopan').update( response.responseText );
  1699. }
  1700. });
  1701. }
  1702. }
  1703. },{
  1704. xtype: 'panel',
  1705. id: 'filt_infopan',
  1706. html: ''
  1707. }]
  1708. }],
  1709. bbar:[{
  1710. text: 'Cancel',
  1711. handler: function(){
  1712. addFilterWindow.close();
  1713. }
  1714. },{
  1715. text: 'Add Filter',
  1716. handler: function(){
  1717. var mtyp = Ext.getCmp('flt_type').getValue();
  1718. Ext.Ajax.request({
  1719. url: '/lib/controller/addFilter.php',
  1720. params: {
  1721. SERVID: 1,
  1722. TYPE: mtyp,
  1723. UID: <?=$UserID;?>,
  1724. SID: '<?=$Session;?>'
  1725. },
  1726. success: function( response, opts ){
  1727. // If the response is JSON, you have to decode it
  1728. var data = Ext.decode(response.responseText);
  1729. if( data.status == 'ok' ){
  1730. addFilterWindow.close();
  1731. loadFilters();
  1732. } else {
  1733. Ext.Msg.show({
  1734. title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
  1735. msg: data.message,
  1736. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1737. fn: function(){
  1738. //SettingsLidar3D.hide();
  1739. },
  1740. icon: Ext.MessageBox.INFO //QUESTION
  1741. });
  1742. }
  1743. },
  1744. failure: failureAJAXFunction
  1745. });
  1746. }
  1747. }]
  1748. });
  1749. addFilterWindow.show();
  1750. Ext.Ajax.request({
  1751. url: '/lib/controller/getFilterInfo.php',
  1752. params: {
  1753. FID: 1,
  1754. UID: <?=$UserID;?>,
  1755. SID: '<?=$Session;?>'
  1756. },
  1757. success: function( response, opts ){
  1758. Ext.getCmp('filt_infopan').update( response.responseText );
  1759. }
  1760. });
  1761. }
  1762. }],
  1763. items:[]
  1764. },{
  1765. xtype: 'panel',
  1766. id: 'flt_ed_small',
  1767. flex: 1,
  1768. height: PanelH-15,
  1769. layout: 'fit',
  1770. items:[{
  1771. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1772. }]
  1773. }]
  1774. }],
  1775. listeners:{
  1776. tabchange: function( tp, t ){
  1777. switch( t.getId() ){
  1778. case 'gi_tab': {
  1779. content_lvl3=0;
  1780. updateServerStatus();
  1781. break;
  1782. };
  1783. case 'res_tab': {
  1784. content_lvl3=1;
  1785. stopStatusUpdater();
  1786. loadRessources();
  1787. break;
  1788. };
  1789. case 'mod_tab':{
  1790. content_lvl3=2;
  1791. stopStatusUpdater();
  1792. loadModules();
  1793. break;
  1794. };
  1795. case 'flt_tab':{
  1796. content_lvl3=3;
  1797. stopStatusUpdater();
  1798. loadFilters();
  1799. break;
  1800. };
  1801. };
  1802. updateUserContent();
  1803. },
  1804. afterrender: function(){
  1805. settingsAreChanged = false;
  1806. }
  1807. },
  1808. updateSettings: function(){
  1809. alert('Update Settings');
  1810. }
  1811. });
  1812. tPanel.doLayout();
  1813. updateServerStatus();
  1814. };
  1815. function showSettingsSensors(){
  1816. stopStatusUpdater();
  1817. content_lvl1 = 1;
  1818. content_lvl2 = 4;
  1819. var tPanel = Ext.getCmp('main_content');
  1820. tPanel.removeAll( true );
  1821. tPanel.add({
  1822. xtype: 'panel',
  1823. id: 'sen_set',
  1824. layout: 'hbox',
  1825. tbar:[{
  1826. text: '<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>',
  1827. handler: function(){
  1828. addSensor();
  1829. }
  1830. }],
  1831. items:[{
  1832. xtype: 'panel',
  1833. id: 'sens_container',
  1834. flex: 1,
  1835. height: PanelH-15,
  1836. autoScroll: 'auto',
  1837. items:[]
  1838. },{
  1839. xtype: 'panel',
  1840. id: 'sens_op_small',
  1841. flex: 1,
  1842. height: PanelH-15,
  1843. layout: 'fit',
  1844. items:[{
  1845. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1846. }]
  1847. }]
  1848. });
  1849. tPanel.doLayout();
  1850. loadAttachedSensors();
  1851. };
  1852. function editSensorHW( cid ){
  1853. SelectedSensor = cid;
  1854. Ext.Ajax.request({
  1855. url: '/lib/controller/getSensorEditor.php',
  1856. params: {
  1857. CID: SelectedSensor,
  1858. UID: <?=$UserID;?>,
  1859. SID: '<?=$Session;?>'
  1860. },
  1861. success: function( response, opts ){
  1862. var data = Ext.decode( response.responseText );
  1863. var tComp = Ext.getCmp('sens_op_small');
  1864. if( data.status == 'ok' ){
  1865. if( tComp!= null ){
  1866. var content = Ext.decode( data.content );
  1867. tComp.removeAll( true );
  1868. tComp.add( content );
  1869. tComp.doLayout();
  1870. };
  1871. } else {
  1872. if( tComp!= null ){
  1873. tComp.removeAll( true );
  1874. tComp.add( data );
  1875. tComp.doLayout();
  1876. };
  1877. };
  1878. },
  1879. failure: function(){
  1880. }
  1881. });
  1882. };
  1883. var cameraEditorContent = null;
  1884. function editCamera( cid, etyp ){
  1885. SelectedCam = cid;
  1886. switch( etyp ){
  1887. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  1888. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  1889. };
  1890. Ext.Ajax.request({
  1891. url: '/lib/controller/getCameraEditor.php',
  1892. params: {
  1893. CID: SelectedCam,
  1894. UID: <?=$UserID;?>,
  1895. SID: '<?=$Session;?>'
  1896. },
  1897. success: function( response, opts ){
  1898. var data = Ext.decode( response.responseText );
  1899. if( data.status == 'ok' ){
  1900. if( cameraEditorContent!= null ){
  1901. var content = Ext.decode( data.content );
  1902. cameraEditorContent.removeAll( true );
  1903. cameraEditorContent.add( content );
  1904. cameraEditorContent.doLayout();
  1905. };
  1906. } else {
  1907. if( cameraEditorContent!= null ){
  1908. cameraEditorContent.removeAll( true );
  1909. cameraEditorContent.add( data );
  1910. cameraEditorContent.doLayout();
  1911. };
  1912. };
  1913. },
  1914. failure: function(){
  1915. }
  1916. });
  1917. };
  1918. function showSettingsVideo(){
  1919. stopStatusUpdater();
  1920. content_lvl1 = 1;
  1921. content_lvl2 = 4;
  1922. var tPanel = Ext.getCmp('main_content');
  1923. tPanel.removeAll( true );
  1924. tPanel.add({
  1925. xtype: 'tabpanel',
  1926. frame: false,
  1927. id: 'node_settings_content',
  1928. border: false,
  1929. activeTab: content_lvl3,
  1930. items: [{
  1931. xtype: 'panel',
  1932. title: 'Detected Cameras',
  1933. id: 'cam_det_tab',
  1934. layout: 'hbox',
  1935. items:[{
  1936. xtype: 'panel',
  1937. id: 'dcam_container',
  1938. flex: 1,
  1939. height: PanelH-15,
  1940. autoScroll: 'auto',
  1941. tbar:[{
  1942. text: '<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>',
  1943. handler: function(){
  1944. addDetectedIPCam();
  1945. }
  1946. }],
  1947. items:[]
  1948. },{
  1949. xtype: 'panel',
  1950. id: 'dcam_op_small',
  1951. flex: 1,
  1952. height: PanelH-15,
  1953. layout: 'fit',
  1954. items:[{
  1955. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1956. }]
  1957. }]
  1958. },{
  1959. xtype: 'panel',
  1960. id: 'cam_ass_tab',
  1961. title: 'Assigned Cameras',
  1962. layout: 'hbox',
  1963. items:[{
  1964. xtype: 'panel',
  1965. id: 'acam_container',
  1966. flex: 1,
  1967. height: PanelH-15,
  1968. autoScroll: 'auto',
  1969. items:[]
  1970. },{
  1971. xtype: 'panel',
  1972. id: 'acam_op_small',
  1973. flex: 1,
  1974. height: PanelH-15,
  1975. layout: 'fit',
  1976. items:[{
  1977. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  1978. }]
  1979. }]
  1980. }],
  1981. listeners:{
  1982. tabchange: function( tp, t ){
  1983. switch( t.getId() ){
  1984. case 'cam_det_tab': {
  1985. content_lvl3=0;
  1986. stopStatusUpdater();
  1987. loadDetectedCameras();
  1988. break;
  1989. };
  1990. case 'cam_ass_tab': {
  1991. content_lvl3=1;
  1992. stopStatusUpdater();
  1993. loadAssignedCameras();
  1994. break;
  1995. };
  1996. case 'mod_tab':{
  1997. content_lvl3=2;
  1998. stopStatusUpdater();
  1999. loadModules();
  2000. break;
  2001. };
  2002. case 'net_tab':{
  2003. content_lvl3=3;
  2004. stopStatusUpdater();
  2005. break;
  2006. };
  2007. };
  2008. updateUserContent();
  2009. },
  2010. afterrender: function(){
  2011. settingsAreChanged = false;
  2012. }
  2013. }
  2014. });
  2015. tPanel.doLayout();
  2016. updateUserContent();
  2017. updateServerStatus();
  2018. };
  2019. function showSettingsApplication(){
  2020. stopStatusUpdater();
  2021. content_lvl1 = 1;
  2022. content_lvl2 = 3;
  2023. var tPanel = Ext.getCmp('main_content');
  2024. tPanel.removeAll( true );
  2025. tPanel.add({
  2026. xtype: 'tabpanel',
  2027. frame: false,
  2028. id: 'settings_a_content',
  2029. border: false,
  2030. activeTab: 0,
  2031. items:[{
  2032. title: '<?=$Labels->GetLabel('_WORKING_MODE_');?>',
  2033. xtype: 'form',
  2034. labelAlign: 'right',
  2035. labelWidth: 180,
  2036. items:[{
  2037. xtype: 'spacer',
  2038. height: 10
  2039. },{
  2040. xtype: 'panel',
  2041. frame: false,
  2042. border: true,
  2043. bodyStyle: 'background-color: white;',
  2044. <?php
  2045. echo "html: '<center><img height=\"120px\" src=\"/style/assets/{$AP_DATA['oem_logo']}.png\"></center>',";
  2046. ?>
  2047. height: 130
  2048. },{
  2049. xtype: 'spacer',
  2050. height: 10
  2051. },{
  2052. xtype: 'textfield',
  2053. fieldLabel: 'Instance Identity',
  2054. width: 300,
  2055. value: '<?php
  2056. $QS = "SELECT `identity` FROM `servers` LIMIT 1";
  2057. $TT = $DATABASE->Query( $QS );
  2058. if( count( $TT ) ){
  2059. echo $TT[0]['identity'];
  2060. } else {
  2061. echo "----No-Identity-Set---";
  2062. };
  2063. ?>'
  2064. },{
  2065. xtype: 'spacer',
  2066. height: 10
  2067. },{
  2068. xtype: 'button',
  2069. text: 'Generate New Identity',
  2070. width: 500,
  2071. handler: function(){
  2072. doApplicationOperation( 3, 0 );
  2073. }
  2074. },{
  2075. xtype: 'spacer',
  2076. height: 10
  2077. },{
  2078. xtype: 'combo',
  2079. fieldLabel: '<?=$Labels->GetLabel('_DEBUGGING_MODE_');?>',
  2080. editable: false,
  2081. typeAhead: true,
  2082. triggerAction: 'all',
  2083. width: '100%',
  2084. lazyRender:true,
  2085. mode: 'local',
  2086. store: new Ext.data.ArrayStore({
  2087. fields: ['sid', 'snam'],
  2088. data: [[0,'<?=$Labels->GetLabel('__DISABLED__');?>'], [1,'<?=$Labels->GetLabel('___ENABLED__');?>']]
  2089. }),
  2090. value: <?=$AP_DATA['work_mode'];?>,
  2091. valueField: 'sid',
  2092. displayField: 'snam',
  2093. listeners:{
  2094. select: function( t, r, i ){
  2095. doApplicationOperation( 1, i );
  2096. }
  2097. }
  2098. }]
  2099. },{
  2100. title: '<?=$Labels->GetLabel('_MONIT_LAYOUT_');?>',
  2101. layout:'table',
  2102. defaults: {
  2103. // applied to each contained panel
  2104. bodyStyle:'padding:5px'
  2105. },
  2106. layoutConfig: {
  2107. // The total column count must be specified here
  2108. columns: 3
  2109. },
  2110. frame: false,
  2111. border: false,
  2112. height: 800,
  2113. items:[{
  2114. xtype: 'spacer',
  2115. width: 100
  2116. },{
  2117. xtype: 'radio',
  2118. width: '100%',
  2119. name: 'layo_apa',
  2120. id: 'db_layout_0',
  2121. checked: ( <?=$AP_DATA['app_layout'];?> == 0 ),
  2122. listeners:{
  2123. check: function( t, state ){
  2124. if( state ) doApplicationOperation( 2, 0 );
  2125. }
  2126. }
  2127. },{
  2128. frame: false,
  2129. border: false,
  2130. html: '<img width="43px" src="/style/assets/ed-0.png" />'
  2131. },{
  2132. xtype: 'spacer',
  2133. width: 100
  2134. },{
  2135. xtype: 'radio',
  2136. width: '100%',
  2137. name: 'layo_apa',
  2138. id: 'db_layout_1',
  2139. checked: ( <?=$AP_DATA['app_layout'];?> == 1 ),
  2140. listeners:{
  2141. check: function( t, state ){
  2142. if( state ) doApplicationOperation( 2, 1 );
  2143. }
  2144. }
  2145. },{
  2146. frame: false,
  2147. border: false,
  2148. html: '<img width="43px" src="/style/assets/ed-1.png" />'
  2149. },{
  2150. xtype: 'spacer',
  2151. width: 100
  2152. },{
  2153. xtype: 'radio',
  2154. name: 'layo_apa',
  2155. id: 'db_layout_2',
  2156. checked: ( <?=$AP_DATA['app_layout'];?> == 2 ),
  2157. listeners:{
  2158. check: function( t, state ){
  2159. if( state ) doApplicationOperation( 2, 2 );
  2160. }
  2161. }
  2162. },{
  2163. frame: false,
  2164. border: false,
  2165. html: '<img width="43px" src="/style/assets/ed-2.png" />'
  2166. },{
  2167. xtype: 'spacer',
  2168. width: 100
  2169. },{
  2170. xtype: 'radio',
  2171. width: '100%',
  2172. name: 'layo_apa',
  2173. id: 'db_layout_3',
  2174. checked: ( <?=$AP_DATA['app_layout'];?> == 3 ),
  2175. listeners:{
  2176. check: function( t, state ){
  2177. if( state ) doApplicationOperation( 2, 3 );
  2178. }
  2179. }
  2180. },{
  2181. frame: false,
  2182. border: false,
  2183. html: '<img width="43px" src="/style/assets/ed-3.png" />'
  2184. },{
  2185. xtype: 'spacer',
  2186. width: 100
  2187. },{
  2188. xtype: 'radio',
  2189. width: '100%',
  2190. name: 'layo_apa',
  2191. id: 'db_layout_4',
  2192. checked: ( <?=$AP_DATA['app_layout'];?> == 4 ),
  2193. listeners:{
  2194. check: function( t, state ){
  2195. if( state ) doApplicationOperation( 2, 4 );
  2196. }
  2197. }
  2198. },{
  2199. frame: false,
  2200. border: false,
  2201. html: '<img width="43px" src="/style/assets/ed-4.png" />'
  2202. },{
  2203. xtype: 'spacer',
  2204. width: 100
  2205. },{
  2206. xtype: 'radio',
  2207. width: '100%',
  2208. name: 'layo_apa',
  2209. id: 'db_layout_5',
  2210. checked: ( <?=$AP_DATA['app_layout'];?> == 5 ),
  2211. listeners:{
  2212. check: function( t, state ){
  2213. if( state ) doApplicationOperation( 2, 5 );
  2214. }
  2215. }
  2216. },{
  2217. frame: false,
  2218. border: false,
  2219. html: '<img width="43px" src="/style/assets/ed-5.png" />'
  2220. }]
  2221. }]
  2222. });
  2223. tPanel.doLayout();
  2224. updateUserContent();
  2225. };
  2226. function showSettingsUpgrade(){
  2227. stopStatusUpdater();
  2228. content_lvl1 = 1;
  2229. content_lvl2 = 4;
  2230. var tPanel = Ext.getCmp('main_content');
  2231. tPanel.removeAll( true );
  2232. initial_md5 = '';
  2233. tPanel.add({
  2234. columnWidth: 1.0,
  2235. frame: false,
  2236. border: false,
  2237. items: [{
  2238. frame: false,
  2239. border: false,
  2240. collapsible: false,
  2241. draggable: false,
  2242. layout: 'vbox',
  2243. //layoutConfig: {
  2244. // align : 'stretch',
  2245. // pack : 'start',
  2246. //},
  2247. height: PanelH,
  2248. items:[{
  2249. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  2250. xtype: 'panel',
  2251. height: PanelH-300,
  2252. //flex: 1,
  2253. frame: true,
  2254. width: '100%',
  2255. border: false,
  2256. layout: {
  2257. type: 'table',
  2258. columns: 2,
  2259. tableAttrs: {
  2260. valign: 'top',
  2261. style: 'valign:top;width:100%;'
  2262. }
  2263. },
  2264. defaults: {
  2265. frame: true,
  2266. border: false,
  2267. height: ( PanelH-400 ) / 2,
  2268. style: 'margin: 5px;width:400px;display:block;'
  2269. },
  2270. items:[{
  2271. title: 'Current System Info',
  2272. width: '100%',
  2273. //flex: 1,
  2274. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2275. },{
  2276. title: 'Tasks',
  2277. //width: 400,
  2278. layout: 'vbox',
  2279. items:[{
  2280. xtype: 'button',
  2281. width: '100%',
  2282. text: 'Create Database Backup',
  2283. handler: function(){
  2284. createNewTask( 2 );
  2285. }
  2286. },{
  2287. xtype: 'button',
  2288. width: '100%',
  2289. text: 'Create Full Snapeshot',
  2290. handler: function(){
  2291. createNewTask( 255 );
  2292. }
  2293. }]
  2294. },{
  2295. title: 'Archives',
  2296. height: 250,
  2297. width: '100%',
  2298. tbar:[{
  2299. text: 'Restore',
  2300. id: 'ar_restore_btn',
  2301. handler: function(){
  2302. createNewTask(1, selectedArchiveRecord.data.file_name );
  2303. }
  2304. },{
  2305. text: 'Download',
  2306. id: 'ar_download_btn',
  2307. handler: function(){
  2308. if( selectedArchiveRecord!= null ){
  2309. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2310. };
  2311. }
  2312. },{
  2313. text: 'Delete',
  2314. id: 'ar_delete_btn',
  2315. handler: function(){
  2316. createNewTask(100, selectedArchiveRecord.data.file_name );
  2317. }
  2318. }],
  2319. items:[{
  2320. xtype: 'grid',
  2321. id: 'archives_grid',
  2322. border: false,
  2323. frame: false,
  2324. autoScroll: true,
  2325. //width: '100%',
  2326. lazyRender: true,
  2327. height: 210,
  2328. ds: archives_store,
  2329. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2330. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2331. viewConfig: {
  2332. // forceFit: true
  2333. },
  2334. }]
  2335. },{
  2336. title: 'Task Status',
  2337. height: 250,
  2338. //flex: 1,
  2339. items:[{
  2340. xtype: 'spacer',
  2341. height: 4
  2342. },{
  2343. id: 'ctask_status',
  2344. border: true,
  2345. html: ''
  2346. },{
  2347. xtype: 'spacer',
  2348. height: 4
  2349. },{
  2350. xtype: 'textarea',
  2351. id: 'task_log',
  2352. height: ( PanelH-320 ) / 2 - 120,
  2353. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2354. readOnly: true,
  2355. autoScroll: true,
  2356. value: ''
  2357. },{
  2358. xtype: 'progress',
  2359. id: 'task_progress',
  2360. value: 1.0,
  2361. text: 'idle',
  2362. disabled: true
  2363. }],
  2364. tbar:[{
  2365. text: 'Cancel Task',
  2366. id: 'ch_ta_btn',
  2367. disabled: true,
  2368. handler: deleteNewTask
  2369. }]
  2370. }]
  2371. },{
  2372. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2373. xtype: 'panel',
  2374. height: 300,
  2375. //flex: 1,
  2376. frame: true,
  2377. border: false,
  2378. //layout: 'vbox',
  2379. items:[{
  2380. xtype:'button',
  2381. id: 'pickfiles',
  2382. width: '100%',
  2383. text: 'Choose File'
  2384. },{
  2385. height: 200,
  2386. xtype: 'grid',
  2387. id: 'upload_grid',
  2388. border: false,
  2389. frame: false,
  2390. mode: 'local',
  2391. lazyRender: true,
  2392. width: '100%',
  2393. autoScroll: true,
  2394. ds: uploads_store,
  2395. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2396. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2397. viewConfig: {
  2398. forceFit: true
  2399. },
  2400. bbar: [{
  2401. text: 'Clear',
  2402. width: '100%',
  2403. handler: function(){
  2404. muploader.splice();
  2405. uploads_store.removeAll();
  2406. }
  2407. }]
  2408. },{
  2409. xtype:'button',
  2410. id: 'umpalumpa',
  2411. width: '100%',
  2412. disabled: true,
  2413. text: 'Upload',
  2414. handler: function(){
  2415. if( muploader!= null ){
  2416. muploader.start();
  2417. };
  2418. }
  2419. }],
  2420. listeners:{
  2421. afterrender: function(){
  2422. muploader = new plupload.Uploader({
  2423. runtimes : 'html5,html4',
  2424. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2425. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2426. max_file_size : '1000mb',
  2427. chunk_size: '200kb',
  2428. max_retries: 3,
  2429. multi_selection: false,
  2430. max_file_count: 1,
  2431. // Fake server response here
  2432. url: '/lib/php/setup_toolkit/upload.php',
  2433. //url: "/echo/json",
  2434. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2435. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2436. filters : [
  2437. //{title : "Image files", extensions : "jpg,gif,png"},
  2438. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2439. ],
  2440. init: {
  2441. PostInit: function() {
  2442. //$('filelist').innerHTML = '';
  2443. //$('uploadfiles').onclick = function() {
  2444. // uploader.start();
  2445. // return false;
  2446. //};
  2447. },
  2448. FilesAdded: function( up, files ) {
  2449. Ext.getCmp('umpalumpa').enable();
  2450. plupload.each( files, function(file) {
  2451. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2452. uploads_store_id++;
  2453. Ext.getCmp('upload_grid').doLayout();
  2454. });
  2455. },
  2456. UploadProgress: function(up, file) {
  2457. var pb = Ext.getCmp( 'progress_'+file.id );
  2458. if( file.percent < 100 ){
  2459. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2460. } else {
  2461. pb.updateProgress( 1.0, 'Uploaded', false );
  2462. };
  2463. },
  2464. Error: function(up, err) {
  2465. Ext.Msg.show({
  2466. title:'Upload Status',
  2467. msg: "Error #" + err.code + ": " + err.message,
  2468. buttons: Ext.Msg.OK,
  2469. icon: Ext.MessageBox.ERROR
  2470. });
  2471. }
  2472. }
  2473. });
  2474. muploader.init();
  2475. }
  2476. }
  2477. }]
  2478. }]
  2479. });
  2480. muploader = null;
  2481. uploads_store.removeAll();
  2482. tPanel.doLayout();
  2483. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2484. updateTaskStatus();
  2485. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2486. };
  2487. function initSettingsView(){
  2488. if( tlInterval!= null ){
  2489. window.clearInterval( tlInterval );
  2490. tlInterval = null;
  2491. timelineObj = null;
  2492. };
  2493. var tP = Ext.getCmp('left_side_menu');
  2494. //tP.doLayout();
  2495. //tP.setVisible( false );
  2496. tP.removeAll( true );
  2497. tP.add({
  2498. id: 'sme_inner',
  2499. layout:'accordion',
  2500. //height: PanelH,
  2501. frame: false,
  2502. border: false,
  2503. layoutConfig:{
  2504. animate: true//,
  2505. //activeOnTop: true
  2506. },
  2507. items:[]
  2508. });
  2509. tP.doLayout();
  2510. tP = Ext.getCmp('sme_inner');
  2511. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2512. tP.add({
  2513. title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>',
  2514. layout: 'vbox',
  2515. height: 120,
  2516. pack: 'center',
  2517. align : 'strech',
  2518. collapsed: ( content_lvl1 != 0 ),
  2519. items:[{
  2520. xtype: 'button',
  2521. width: '100%',
  2522. id:'sys_edit',
  2523. text: '<?=$Labels->GetLabel('_SYS_GENERAL_');?>',
  2524. enableToggle: true,
  2525. pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ),
  2526. allowDepress: false,
  2527. toggleGroup: 'sys_settings',
  2528. handler: showSettingsGeneral
  2529. },{
  2530. xtype: 'button',
  2531. width: '100%',
  2532. id:'map_edit',
  2533. text: '<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>',
  2534. enableToggle: true,
  2535. pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ),
  2536. allowDepress: false,
  2537. toggleGroup: 'sys_settings',
  2538. handler: showSettingsSensors
  2539. },{
  2540. xtype: 'button',
  2541. width: '100%',
  2542. id:'video_set',
  2543. text: '<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>',
  2544. enableToggle: true,
  2545. pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ),
  2546. allowDepress: false,
  2547. toggleGroup: 'sys_settings',
  2548. handler: showSettingsVideo
  2549. },{
  2550. xtype: 'button',
  2551. width: '100%',
  2552. id:'app_set',
  2553. text: '<?=$Labels->GetLabel('_APPLICA_MNGMNT_');?>',
  2554. enableToggle: true,
  2555. pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ),
  2556. allowDepress: false,
  2557. toggleGroup: 'sys_settings',
  2558. handler: showSettingsApplication
  2559. }]
  2560. });
  2561. tP.add({
  2562. title: '<?=$Labels->GetLabel('_DET_SETTINGS_');?>',
  2563. layout: 'vbox',
  2564. height: 120,
  2565. pack: 'center',
  2566. align : 'strech',
  2567. collapsed: ( content_lvl1 != 1 ),
  2568. items:[<?php
  2569. if( $AP_DATA['type'] == 1 ){
  2570. ?>
  2571. {
  2572. xtype: 'button',
  2573. width: '100%',
  2574. id:'go_home',
  2575. text: '<?=$Labels->GetLabel('_UPPER_SENSOR_');?>',
  2576. enableToggle: true,
  2577. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  2578. allowDepress: false,
  2579. toggleGroup: 'det_settings',
  2580. handler: loadMetroControlUpper
  2581. },{
  2582. xtype: 'button',
  2583. width: '100%',
  2584. id:'go_monitor',
  2585. text: '<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>',
  2586. enableToggle: true,
  2587. pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
  2588. allowDepress: false,
  2589. toggleGroup: 'det_settings',
  2590. handler: loadMetroControlBottom
  2591. },{
  2592. xtype: 'button',
  2593. width: '100%',
  2594. id:'go_archive',
  2595. text: '<?=$Labels->GetLabel('_FUSION_ENGINE_');?>',
  2596. enableToggle: true,
  2597. pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
  2598. allowDepress: false,
  2599. toggleGroup: 'det_settings',
  2600. handler: loadMetroControlFusion
  2601. }<?php
  2602. } else {
  2603. if( 1 || intval( $CUser->Data['sipi_enable'] ) ){
  2604. ?>
  2605. {
  2606. xtype: 'button',
  2607. width: '100%',
  2608. id:'go_singleIpi',
  2609. text: '<?=$Labels->GetLabel('_EVT_MONITOR_IPI_');?>',
  2610. enableToggle: true,
  2611. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  2612. allowDepress: false,
  2613. toggleGroup: 'det_settings',
  2614. handler: loadSingleIPI
  2615. },
  2616. <?php
  2617. };
  2618. ?>
  2619. {
  2620. xtype: 'button',
  2621. width: '100%',
  2622. id:'go_out',
  2623. text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
  2624. handler: doLogout
  2625. }<?php
  2626. };
  2627. ?>]
  2628. });
  2629. /*tP.add({
  2630. title: '<?=$Labels->GetLabel('_NET_SETTINGS_');?>',
  2631. collapsed: ( content_lvl1 != 2 ),
  2632. items:[{
  2633. xtype: 'button',
  2634. width: '100%',
  2635. text: 'Ethernet',
  2636. enableToggle: true,
  2637. pressed: ( content_lvl2 == 0 && content_lvl1 == 2 ),
  2638. allowDepress: false,
  2639. id:'ethernet',
  2640. },{
  2641. xtype: 'button',
  2642. width: '100%',
  2643. text: 'WiFi',
  2644. enableToggle: true,
  2645. pressed: ( content_lvl2 == 1 && content_lvl1 == 2 ),
  2646. allowDepress: false,
  2647. id:'wifi',
  2648. },{
  2649. xtype: 'button',
  2650. width: '100%',
  2651. text: 'Integration',
  2652. enableToggle: true,
  2653. pressed: ( content_lvl2 == 2 && content_lvl1 == 2 ),
  2654. allowDepress: false,
  2655. id:'api_serv',
  2656. }]
  2657. });*/
  2658. <?php }; ?>
  2659. tP.add({
  2660. title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
  2661. items:[]
  2662. });
  2663. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2664. tP.add({
  2665. title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>',
  2666. collapsed: ( content_lvl1 != 3 ),
  2667. items:[{
  2668. xtype: 'button',
  2669. width: '100%',
  2670. id:'adm_acc',
  2671. text: '<?=$Labels->GetLabel('_USERS_MNGMT_');?>',
  2672. enableToggle: true,
  2673. pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
  2674. allowDepress: false,
  2675. toggleGroup: 'adm_settings',
  2676. handler: function( b, e ){
  2677. loadUserEditor();
  2678. }
  2679. },{
  2680. xtype: 'button',
  2681. width: '100%',
  2682. id:'adm_acclog',
  2683. text: '<?=$Labels->GetLabel('_ACC_LOG_');?>',
  2684. enableToggle: true,
  2685. pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
  2686. allowDepress: false,
  2687. toggleGroup: 'adm_settings',
  2688. handler: function( b, e ){
  2689. loadAccessLog();
  2690. }
  2691. },{
  2692. xtype: 'button',
  2693. width: '100%',
  2694. id:'adm_servlog',
  2695. text: '<?=$Labels->GetLabel('_SERV_LOG_');?>',
  2696. enableToggle: true,
  2697. pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
  2698. allowDepress: false,
  2699. toggleGroup: 'adm_settings',
  2700. handler: function( b, e ){
  2701. loadServerLog();
  2702. }
  2703. }]
  2704. });
  2705. <?php
  2706. };
  2707. ?>
  2708. tP.setVisible( true );
  2709. tP.doLayout();
  2710. switch( content_lvl1 ){
  2711. case 0:{
  2712. switch( content_lvl2 ){
  2713. case 0: showSettingsGeneral(); break;
  2714. case 1: showSettingsSensors(); break;
  2715. case 2: showSettingsVideo(); break;
  2716. case 3: showSettingsApplication(); break;
  2717. case 4: showSettingsUpgrade(); break;
  2718. };
  2719. };
  2720. case 1:{
  2721. switch( content_lvl2 ){
  2722. case 0: break;
  2723. };
  2724. break;
  2725. };
  2726. case 3:{
  2727. switch( content_lvl2 ){
  2728. case 0: loadUserEditor(); break;
  2729. };
  2730. break;
  2731. };
  2732. };
  2733. };