// var helpContentTopicID = -1; var muploader = null; var uploads_store_id = 0; var uploads_store = new Ext.data.ArrayStore({ autoDestroy: false, storeId: 'up_store', idIndex: 0, fields: [ {name: 'id', type: 'int' }, {name: 'file_name', type: 'string'}, {name: 'file_id', type: 'string'}, {name: 'size', type: 'string'}, {name: 'progress', type: 'int'}, {name: 'status', type: 'string' } ] }); var uploaded_store_id = 0; var uploaded_store = new Ext.data.ArrayStore({ autoDestroy: false, storeId: 'mod_store', idIndex: 0, fields: [ {name: 'id', type: 'int' }, {name: 'file_name', type: 'string'}, {name: 'size', type: 'int'}, {name: 'status', type: 'int'}, {name: 'ts', type: 'string' }, {name: 'memo', type: 'string' } ] }); function progressRenderer( value, meta, record ){ Ext.defer( function( id ){ var p = new Ext.ProgressBar({ id: 'progress_'+id, renderTo: 'div_'+id, animate: false, width: '100%', value: 0, text: 'Upload Pending', }); }, 50, undefined, [ record.data.file_id ] ); return '
'; }; var fileUploadsColModel_ops = { columns: [ {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' }, {header: "GetLabel('_FILE_NAME_');?>", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' }, {header: "GetLabel('_SIZE_');?>", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, {header: "GetLabel('_PROGRESS_');?>", width: 150, renderer: progressRenderer, dataIndex: 'progress' }, {header: " ", width: 50, dataIndex: 'status3' } ], defaults: { sortable: false, fixed: true, menuDisabled: true, width: 100 } }; function onModuleFileRenderer( value, meta, record ){ if( value == 0 ){ rv = '<?=$Labels->GetLabel('_READY_TO_UPLO_');?>'; } else { if( value < 101 ){ rv = '<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>'; } else { rv = '<?=$Labels->GetLabel('_UPLO_DONE_');?>'; }; }; return rv; }; var fileModuleColModel_ops = { columns: [ {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' }, {header: "GetLabel('_FILE_NAME_');?>", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' }, {header: "GetLabel('_SIZE_');?>", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, {header: "GetLabel('_TIME_');?>", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, {header: "GetLabel('_STATUS_');?>", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' }, {header: "GetLabel('_MEMO_');?>", dataIndex: 'memo' } ], defaults: { sortable: false, fixed: true, menuDisabled: true, width: 100 } }; var fileUploadsSelModel_ops = { singleSelect: true }; var targetWidthTable_store = new Ext.data.ArrayStore({ autoDestroy: false, storeId: 'width_table_store', idIndex: 0, fields: [ {name: 'id', type: 'int' }, {name: 'width', type: 'int'}, {name: 'range', type: 'sting'}, {name: 'range_m', type: 'sting'} ] }); var cWTRowSelected = null; var cWTRowSelectedRange = 0; var cWTRowSelectedRangeP = 0; var WTSelectedSensor = 0; var widthTableSelModel_ops = { singleSelect: true, listeners: { rowselect: function( sm, row, rec ) { cWTRowSelected = rec.data.id; cWTRowSelectedRange = rec.data.range_m; cWTRowSelectedRangeP = rec.data.range; //todo Ext.getCmp('edit_btn_width_table').enable(); } } }; function deleteWTRow(){ Ext.Ajax.request({ url: '/lib/controller/delWidthTableRecord.php', params: { UID: , SID: '', DID: WTSelectedSensor, RID: cWTRowSelected }, success: function( response, opts ){ Ext.getCmp('del_btn_width_table').disable(); loadWidthTable( WTSelectedSensor ); }, failure: failureAJAXFunction }); }; var targetWidthTableColModel_ops = { columns: [ {header: "GetLabel('_WIDTH_CORRECT_');?> (%)", width: 250, align: 'center', css: 'vertical-align: middle;', dataIndex: 'width' }, {header: "GetLabel('_RANGE_');?> (%)", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range' }, {header: "GetLabel('_RANGE_').' ('.$Labels->GetLabel('_METERS_') . ')';?>", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range_m' }, ], defaults: { sortable: false, fixed: true, menuDisabled: true } }; var widthTableEditDialog = null; function editWidthTableRecord(){ if( widthTableEditDialog == null ){ widthTableEditDialog = new Ext.Window({ title: 'GetLabel('_EDIT_WTR_');?>', modal: true, layout: 'form', labelWidth: 200, closeAction: 'hide', labelAlign: 'right', items:[{ xtype: 'textfield', id: 'wt_ad_range_val', readOnly: true, fieldLabel: 'GetLabel('_RANGE_');?> (%)', value: cWTRowSelectedRangeP },{ xtype: 'textfield', id: 'wt_ad_rangea_val', readOnly: true, fieldLabel: 'GetLabel('_RANGE_');?> (GetLabel('_METERS_');?>)', value: cWTRowSelectedRange },{ xtype: 'numberfield', id: 'wt_ad_width_val', fieldLabel: 'GetLabel('_WIDTH_');?> (%)', value: '100' },{ xtype: 'button', width: '100%', text: 'GetLabel('_APPLY_CHANGES_');?>', handler: function(){ var tWidth = Ext.getCmp('wt_ad_width_val').getValue(); Ext.Ajax.request({ url: '/lib/controller/updateWidthTableRecord.php', params: { UID: , SID: '', DID: WTSelectedSensor, RID: cWTRowSelected, NWW: tWidth }, success: function( response, opts ){ widthTableEditDialog.hide(); loadWidthTable( WTSelectedSensor ); }, failure: failureAJAXFunction }); } }] }); }; Ext.getCmp('wt_ad_range_val').setValue( cWTRowSelectedRangeP ); Ext.getCmp('wt_ad_rangea_val').setValue( cWTRowSelectedRange ); widthTableEditDialog.show(); }; function loadWidthTable( SensorID ){ WTSelectedSensor = SensorID; Ext.Ajax.request({ url: '/lib/controller/getWidthTable.php', params: { UID: , SID: '', DID: SensorID }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); targetWidthTable_store.removeAll(); targetWidthTable_store.loadData( data.rows ); }, failure: failureAJAXFunction }); }; function loadModuleFiles( sensorID ){ Ext.Ajax.request({ url: '/lib/controller/getDeviceFiles.php', params: { UID: , SID: '', DID: sensorID }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); uploaded_store.removeAll(); uploaded_store.loadData( data.files ); }, failure: failureAJAXFunction }); }; function loadHelpContent( topicID ){ if( helpContentTopicID == topicID ) return; helpContentTopicID = topicID; Ext.Ajax.request({ url: '/lib/controller/getHelpTopic.php', params: { UID: , SID: '', TID: topicID }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('help_content'); tPanel.removeAll( true ); tPanel.add( tData ); tPanel.doLayout(); }, failure: failureAJAXFunction }); }; function clearHelpContent(){ helpContentTopicID = -1; }; function loadRessources(){ Ext.Ajax.request({ url: '/lib/controller/getResources.php', params: { UID: , SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('resources_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.resources ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); } else { }; }, failure: failureAJAXFunction }); }; function loadModules(){ Ext.Ajax.request({ url: '/lib/controller/getModules.php', params: { UID: , SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('modules_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.modules ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); var tPanel = Ext.getCmp('mod_ed_small'); tPanel.removeAll( true ); tPanel.add( { html:"
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); tPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; function loadFilters(){ Ext.Ajax.request({ url: '/lib/controller/getFilters.php', params: { UID: , SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('filters_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.modules ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); }; var tPanel = Ext.getCmp('flt_ed_small'); tPanel.removeAll( true ); tPanel.add( { html:"
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); tPanel.doLayout(); }, failure: failureAJAXFunction }); }; var modem_pb_store = new Ext.data.JsonStore({ autoDestroy: false, storeId: 'pb_store', idIndex: 0, fields: [ {name: 'id', type: 'int' }, {name: 'number', type: 'string'}, {name: 'mode', type: 'int'}, {name: 'trig_special', type: 'int'}, {name: 'label', type: 'string'}, {name: 'custom_msg', type: 'string'} ] }); function pb_mode_renderer( value ){ switch( value ){ case 0: return 'GetLabel('_AUTOMATIC_');?>'; case 1: return 'GetLabel('_CALL_ONLY_');?>'; case 2: return 'GetLabel('_SMS_ONLY_');?>'; }; return ''; }; var modem_pb_ColModel_ops = { columns: [ {header: "GetLabel('__MODE__');?>", width: 100, dataIndex: 'mode', renderer: pb_mode_renderer }, {header: "GetLabel('_PHONE_NUMBER_');?>", width: 200, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' }, {header: "GetLabel('_NAME_LABEL_');?>", width: 200, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'label' }, {header: "GetLabel('_CUSTOM_MSG_');?>", dataIndex: 'custom_msg' } ], defaults: { sortable: false, fixed: true, menuDisabled: true, width: 100 } }; var selected_pb_id = 0; var modem_pb_SelModel_ops = { singleSelect: true, listeners: { rowselect: function(sm, row, rec ) { selected_pb_id = rec.data.id; Ext.getCmp( 'ph_bo_de_bu' ).enable(); } } }; function loadPhoneBook(){ Ext.Ajax.request({ url: '/lib/controller/getPhoneBook.php', params: { UID: , SID: '', }, success: function( response, opts ){ var data = Ext.decode(response.responseText); modem_pb_store.loadData( data ); Ext.getCmp( 'ph_bo_de_bu' ).disable(); selected_pb_id = 0; //var tPanel = Ext.getCmp('main_portal'); //tPanel.removeAll(true); //for( i=0; i < data.length; i++) tPanel.add( data[i] ); //tPanel.doLayout(); }, failure: failureAJAXFunction }); }; var addNPNWindow = null; function addNewPhoneNumber(){ if( addNPNWindow == null ){ addNPNWindow = new Ext.Window({ title: 'GetLabel('_ADD_NEW_PHN_');?>', modal: true, closeAction: 'hide', resizable: false, width: 400, height: 332, items:[{ xtype: 'form', labelWidth: 120, labelAlign: 'right', items: [{ xtype: 'textfield', fieldLabel: 'GetLabel('_NAME_LABEL_');?>', id: 'ph_name', width: 220, value: '' },{ xtype: 'textfield', fieldLabel: 'GetLabel('_PHONE_NUMBER_');?>', id: 'ph_number', width: 220, validator: function( a ){ return true; }, value: '' },{ xtype: 'radio', id: 'r_ph_auto', fieldLabel: 'GetLabel('_AUTOMATIC_');?>', name: 'ph_cam', checked: true, value: '0' },{ xtype: 'radio', id: 'r_ph_call', fieldLabel: 'GetLabel('_CALL_ONLY_');?>', name: 'ph_cam', value: '1' },{ xtype: 'radio', id: 'r_ph_sms', fieldLabel: 'GetLabel('_SMS_ONLY_');?>', name: 'ph_cam', value: '2' },{ xtype: 'textarea', fieldLabel: 'GetLabel('_CUSTOM_MSG_');?>', width: 220, height: 130, id: 'cus_sms', name: 'cus_sms' }] }], bbar:['->',{ text: 'Add', handler: function(){ var num = Ext.getCmp( 'ph_number' ).getValue(); var lbl = Ext.getCmp( 'ph_name' ).getValue(); var con = Ext.getCmp( 'r_ph_auto' ).getValue()?'0':(Ext.getCmp( 'r_ph_call' ).getValue()?1:2); var cust = Ext.getCmp( 'cus_sms' ).getValue(); Ext.Ajax.request({ url: '/lib/controller/doPhonebookOperation.php', params: { UID: , SID: '', OPID: 1, PNUM: num, PNAM: lbl, PCAL: con, PMSG: cust }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data.success ){ loadPhoneBook(); addNPNWindow.hide(); } else { Ext.Msg.show({ title:'GetLabel('_ERROR_');?>', msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); }; }, failure: failureAJAXFunction }); } },{ text: 'Cancel', handler: function(){ addNPNWindow.hide(); } }] }); }; addNPNWindow.show(); }; function deletePhoneNumber(){ if( selected_pb_id ){ Ext.Ajax.request({ url: '/lib/controller/doPhonebookOperation.php', params: { UID: , SID: '', OPID: 2, PBID: selected_pb_id }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data.success ){ loadPhoneBook(); } else { Ext.Msg.show({ title:'GetLabel('_ERROR_');?>', msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); }; }, failure: failureAJAXFunction }); }; }; function loadDetectedCameras(){ Ext.Ajax.request({ url: '/lib/controller/getCameras.php', params: { UID: , TYP: 0, SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('dcam_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.cameras ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); var zPanel = Ext.getCmp('dcam_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); var zPanel = Ext.getCmp('dcam_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; function loadAssignedCameras(){ Ext.Ajax.request({ url: '/lib/controller/getCameras.php', params: { UID: , TYP: 1, SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('acam_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.cameras ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); var zPanel = Ext.getCmp('acam_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); var zPanel = Ext.getCmp('acam_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; function loadApplicationSettings( par ){ Ext.Ajax.request({ url: '/lib/controller/getApplicationSettings.php', params: { UID: , TYP: par, SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); if( tData.status == 'ok' ){ var res = Ext.decode( tData.content ); var tPanel = Ext.getCmp('aps_tab_'+par ); tPanel.removeAll( true ); //debugger; if( Array.isArray( res ) ){ for( i= 0; i < res.length; i++ )tPanel.add( res[i] ); } else { tPanel.add( res ); }; tPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; function loadAttachedSensors(){ Ext.Ajax.request({ url: '/lib/controller/getSensors.php', params: { UID: , SID: '', }, success: function( response, opts ){ var tData = Ext.decode(response.responseText); var tPanel = Ext.getCmp('sens_container'); if( tData.status == 'ok' ){ var res = Ext.decode( tData.sensors ); tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); var zPanel = Ext.getCmp('sens_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); var zPanel = Ext.getCmp('sens_op_small'); zPanel.removeAll( true ); zPanel.add( { html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" } ); zPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; function editResource( rid ){ var loadEditor = true; if( settingsAreChanged ){ Ext.Msg.show({ title:'GetLabel('_SETTINGS_CHANGED_');?>', msg: 'GetLabel('_SET_CHANGED_WOULD_SAVE_');?>', buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.WARNING, fn: function(btn, text){ if( btn == 'yes' ){ cleanupChangeNotifier(); } else { loadEditor = false; }; } }); }; if( loadEditor ){ Ext.Ajax.request({ url: '/lib/controller/getResourceEditor.php', params: { RID: rid, UID: , SID: '', }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var resourceEdPanel = Ext.getCmp('res_ed_small'); if( resourceEdPanel ){ resourceEdPanel.removeAll( true ); resourceEdPanel.add( data ); resourceEdPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; }; function editFilter( fid ){ var loadEditor = true; if( settingsAreChanged ){ Ext.Msg.show({ title: "GetLabel('_SETTINGS_CHANGED_');?>", msg: "GetLabel('_SET_CHANGED_WOULD_SAVE_');?>", buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.WARNING, fn: function(btn, text){ if( btn == 'yes' ){ cleanupChangeNotifier(); } else { loadEditor = false; }; } }); }; if( loadEditor ){ Ext.Ajax.request({ url: '/lib/controller/getFilterEditor.php', params: { FID: fid, UID: , SID: '', }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var resourceEdPanel = Ext.getCmp('flt_ed_small'); if( resourceEdPanel ){ resourceEdPanel.removeAll( true ); resourceEdPanel.add( data ); resourceEdPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; }; function editModule( mid ){ var loadEditor = true; if( settingsAreChanged ){ Ext.Msg.show({ title: "GetLabel('_SETTINGS_CHANGED_');?>", msg: "GetLabel('_SET_CHANGED_WOULD_SAVE_');?>", buttons: Ext.Msg.YESNO, icon: Ext.MessageBox.WARNING, fn: function(btn, text){ if( btn == 'yes' ){ cleanupChangeNotifier(); } else { loadEditor = false; }; } }); }; if( loadEditor ){ Ext.Ajax.request({ url: '/lib/controller/getModuleEditor.php', params: { MID: mid, UID: , SID: '', }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var moduleEdPanel = Ext.getCmp('mod_ed_small'); if( moduleEdPanel ){ moduleEdPanel.removeAll( true ); moduleEdPanel.add( data ); moduleEdPanel.doLayout(); }; }, failure: failureAJAXFunction }); }; }; function doModuleOperation( ID, OPO, OPCO, reload ){ Ext.Ajax.request({ url: '/lib/controller/doModuleOperation.php', params: { OPID: OPO, OPCODE: OPCO, MID: ID, UID: , SID: '' }, success: function(){ if( reload ) loadModules(); } }); }; function enableModule( ID ){ doModuleOperation( ID, 2, 1, true ); }; function disableModule( ID ){ doModuleOperation( ID, 2, 0, true ); }; //cursor: url('data:image/svg+xml;utf8,') 24 24, auto; function doCamOperation( cid, op, param, reload = false ){ Ext.Ajax.request({ url: '/lib/controller/doCameraOperation.php', params: { CID: cid, CMD: 10, OPID: op, OPCODE: param, UID: , SID: '' }, success: function(){ if( reload ) loadDetectedCameras(); if( reload ) loadAssignedCameras(); } }); }; function doApplicationOperation( op, param, reload = false ){ Ext.Ajax.request({ url: '/lib/controller/doApplicationOperation.php', params: { OPID: op, OPCODE: param, UID: , SID: '' }, success: function(){ if( reload ) loadApplicationSettings( content_lvl3 ); //if( reload ) loadAssignedCameras(); } }); }; function setAssignFilterToSensor( nid, fid ){ doSensorOperation(nid,37, fid, true ); Ext.getCmp('afs_window').close(); }; function doSensorOperation( sensorid, op, param, reload = false ){ Ext.Ajax.request({ url: '/lib/controller/doSensorOperation.php', params: { SNID: sensorid, CMD: op, OPID: op, OPCODE: param, UID: , SID: '' }, success: function(){ if( reload ) loadAttachedSensors();//vermont 202 westlake } }); }; function doFilterOperation( FilterID, op, param, reload = false ){ Ext.Ajax.request({ url: '/lib/controller/doFilterOperation.php', params: { OPID: op, OPCODE: param, FID: FilterID, UID: , SID: '' }, success: function(){ if( reload ) loadFilters(); } }); }; function doResourceOperation( resourceid, op, param, value, reload = false ){ Ext.Ajax.request({ url: '/lib/controller/doResourceOperation.php', params: { RID: resourceid, OPID: op, OPCODE: param, OPVAL: value, UID: , SID: '' }, success: function(){ if( reload ) loadAttachedSensors(); } }); }; function removeModule( ID ){ Ext.Msg.show({ title: "GetLabel('_PLS_CONFIRM_');?>", msg: "GetLabel('_RUS_DELETE_MODULE_');?>", buttons: Ext.Msg.YESNOCANCEL, fn: function( btn, text ){ if( btn == 'yes' ){ Ext.Ajax.request({ url: '/lib/controller/doModuleOperation.php', params: { OPID: 1, MID: ID, UID: , SID: '' }, success: function(){ //showSettings( SelectedNodeID, 2 ); loadModules(); } }); }; }, icon: Ext.MessageBox.QUESTION }); }; function disableServOps(){ var tC = Ext.getCmp('servopPanel00'); if( tC != undefined ){ tC.removeClass('servopInfo_item01'); tC.addClass('servopInfo_item00'); tC.disable(); Ext.getCmp('tbtn_sop00').disable(); }; tC = Ext.getCmp('servopPanel01'); if( tC != undefined ){ tC.removeClass('servopInfo_item11'); tC.addClass('servopInfo_item10'); tC.disable(); Ext.getCmp('tbtn_sop01').disable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel02'); if( tC != undefined ){ tC.removeClass('servopInfo_item21'); tC.addClass('servopInfo_item20'); tC.disable(); Ext.getCmp('tbtn_sop02').disable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel03'); if( tC != undefined ){ tC.removeClass('servopInfo_item31'); tC.addClass('servopInfo_item30'); tC.disable(); Ext.getCmp('tbtn_sop03').disable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel04'); if( tC != undefined ){ tC.removeClass('servopInfo_item41'); tC.addClass('servopInfo_item40'); tC.disable(); Ext.getCmp('tbtn_sop04').disable(); }; //tC.doLayout(); }; function enableServOps(){ var tC = Ext.getCmp('servopPanel00'); if( tC != undefined ){ tC.removeClass('servopInfo_item00'); tC.addClass('servopInfo_item01'); Ext.getCmp('tbtn_sop00').enable(); tC.enable(); }; tC = Ext.getCmp('servopPanel01'); if( tC != undefined ){ tC.removeClass('servopInfo_item10'); tC.addClass('servopInfo_item11'); Ext.getCmp('tbtn_sop01').enable(); tC.enable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel02'); if( tC != undefined ){ tC.removeClass('servopInfo_item20'); tC.addClass('servopInfo_item21'); tC.enable(); Ext.getCmp('tbtn_sop02').enable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel03'); if( tC != undefined ){ tC.removeClass('servopInfo_item30'); tC.addClass('servopInfo_item31'); tC.enable(); Ext.getCmp('tbtn_sop03').enable(); }; //tC.doLayout(); tC = Ext.getCmp('servopPanel04'); if( tC != undefined ){ tC.removeClass('servopInfo_item40'); tC.addClass('servopInfo_item41'); tC.enable(); Ext.getCmp('tbtn_sop04').enable(); }; //tC.doLayout(); }; function updateServerStatus(){ Ext.Ajax.request({ url: '/lib/controller/getServerStatus.php', params: { SERVID: 1, UID: , SID: '' }, success: function( response, opts ){ // If the response is JSON, you have to decode it var sps = document.getElementById("INFO_SPS"); if( sps == undefined ) return; var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ serverIsOnLine = true; enableServOps(); //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info; //document.getElementById('OS_NFO').innerHTML = data.stats.os_info; //document.getElementById('BLD_NFO').innerHTML = data.stats.build; setDonatStatus( 1, 0, data.stats.stat_cpu15 ); setDonatStatus( 1, 1, data.stats.stat_mem ); setDonatStatus( 1, 2, data.stats.stat_disk ); setDonatStatus( 1, 3, data.stats.temp0 ); sps.classList.remove('setEd_infoPanel'); sps.classList.add('setEl_infoPanel'); } else { serverIsOnLine = false; disableServOps(); if( data.status == 'na' ){ setDonatStatus( 1, 0, -1 ); setDonatStatus( 1, 1, -1 ); setDonatStatus( 1, 2, -1 ); setDonatStatus( 1, 3, -1 ); sps.classList.remove('setEl_infoPanel'); sps.classList.add('setEd_infoPanel'); } else { Ext.Msg.show({ title: "GetLabel("_INFO_MSG_");?>", msg: data.messages, buttons: Ext.Msg.OK,//YESNOCANCEL, fn: function(){ }, icon: Ext.MessageBox.INFO //QUESTION }); }; }; if( tlInterval == null ){ tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite ); }; }, failure: failureAJAXFunction }); }; var addE2UDialog = null; function addEthernet2Uart(){ if( addE2UDialog == null ){ addE2UDialog = new Ext.Window({ modal: true, title: "GetLabel('_ADD_E2U_DIAL_TTL_');?>", width: 400, height: 560, layout: 'fit', closeAction: 'hide', items:[{ xtype: 'form', labelWidth: 120, // label settings here cascade unless overridden frame: false, width: 400, labelAlign: 'right', //bodyStyle:'padding:5px 5px 0', defaultType: 'textfield', items:[{ xtype: 'panel', height: 200, frame: false, border: false, html: '
' },/*{ fieldLabel: 'Name', id: 'ued_name' },{ xtype: 'combo', fieldLabel: 'GetLabel('_CONNECT_2_');?>', id: 'ued_servid', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ Query( $QS ); $SLIST = array(); $SSID = 0; if( count( $Servers ) ){ foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']'; $SSID = intval( $Servers[0]['id'] ); }; //[1,'Server Node'], [2,'Aux Server'] ?> fields: ['sid', 'snam'], data: [] }), value: , valueField: 'sid', displayField: 'snam' },*/{ xtype: 'combo', fieldLabel: "GetLabel('UART_COM_SPEED');?>", id: 'ued_speed', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['speed'], data: [[19200], [115200]] }), value: 19200, valueField: 'speed', displayField: 'speed' },{ xtype: 'combo', fieldLabel: "GetLabel('UART_COM_BITS');?>", id: 'ued_bit', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['bits'], data: [[5],[6],[7],[8],[9]] }), value: 8, valueField: 'bits', displayField: 'bits' },{ xtype: 'combo', fieldLabel: "GetLabel('UART_COM_SBITS');?>", id: 'ued_stops', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['stops'], data: [[1],[1.5],[2]] }), value: 1, valueField: 'stops', displayField: 'stops' },{ xtype: 'combo', fieldLabel: "GetLabel('UART_COM_PARITY');?>", id: 'ued_parity', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['parity'], data: [['Odd'], ['Even'],['None']] }), value: 'None', valueField: 'parity', displayField: 'parity' },{ xtype: 'combo', fieldLabel: "GetLabel('_WORKING_MODE_');?>", id: 'ued_mode', editable: false, typeAhead: true, triggerAction: 'all', width: '100%', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [[0,"GetLabel('_UDP_CLIENT_');?>"], [1,"GetLabel('_TCP_CLIENT_');?>"], [2,"GetLabel('_UDP_SERVER_');?>"], [3,"GetLabel('_TCP_SERVER_');?>"]] }), value: 3, valueField: 'mode', displayField: 'mode_txt' },{ fieldLabel: "GetLabel('_DEVICE_IP_');?>", id: 'ued_ip' },{ fieldLabel: "GetLabel('_DEVICE_PORT_');?>", value: 8234, id: 'ued_port' }], bbar: [{ text: 'Cancel', handler: function(){//discoverOnvifSources addE2UDialog.hide(); } },'->',{ id: 'con_to_src', text: 'Add Adapter to Site', disabled: false, handler: function(){ var SPD = Ext.getCmp('ued_speed').getValue(); var BIT = Ext.getCmp('ued_bit').getValue(); var STP = Ext.getCmp('ued_stops').getValue(); var PAR = Ext.getCmp('ued_parity').getValue(); var MOD = Ext.getCmp('ued_mode').getValue(); var IP = Ext.getCmp('ued_ip').getValue(); var PORT= Ext.getCmp('ued_port').getValue(); var MAC = '';//Ext.getCmp('ued_mac').getValue(); //var NAME= Ext.getCmp('ued_name').getValue(); //var SRV = Ext.getCmp('ued_servid').getValue(); Ext.Ajax.request({ url: '/lib/controller/addNode.php', params: { TYPE: 20, UART_SPEED: SPD, UART_BITS: BIT, UART_STOP: STP, UART_PAR: PAR, UART_MODE: MOD, UART_IP: IP, UART_PORT: PORT, UART_MAC: MAC, //UART_NAME: NAME, UID: , //SRVID: SRV, SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data.sucess == false ){ Ext.Msg.show({ title:'Request Failure!', msg: data.error, buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); } else { loadRessources(); }; addE2UDialog.hide(); }, failure: function( response, opts ) { failureAJAXFunction( response, opts ); addE2UDialog.hide(); } }); } }] }] }); }; addE2UDialog.show(); }; var addSensorDialog = null; var addSensWM = null; function addSensor(){ if( addSensorDialog == null ){ addSensorDialog = new Ext.Window({ modal: true, title: 'GetLabel('_SMM_ADD_LSEN_');?>', width: 500, height: 438, layout: 'form', closeAction: 'hide', labelWidth: 160, labelAlign: 'right', items:[{ xtype: 'panel', frame: false, border: false, html: '
' },{ xtype: 'spacer', height: 8 },{ xtype: 'combo', id: 'sens_type', fieldLabel: "GetLabel('SENS_TYPE');?>", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [1,"ALS GetLabel('_SENSOR_');?>"], [2,"LFS GetLabel('_SENSOR_');?>"], [3,"PLS 200 GetLabel('_SENSOR_');?>"], [4,"PLS 360 GetLabel('_SENSOR_');?>"], [5,"3D GetLabel('_SENSOR_');?>"] ] }), valueField: 'mode', displayField: 'mode_txt', value: 1, width: 200, listeners:{ select: function( a, v, c ){ var ii = document.getElementById( 'asd_img_div' ); ii.className = "node_"+(c+1)+"_img_set"; if( c == 4 ){ Ext.getCmp('sens_id').hide(); Ext.getCmp('uart_id').hide(); Ext.getCmp('sens_port').show(); Ext.getCmp('sens_ip').show(); } else { Ext.getCmp('sens_id').show(); Ext.getCmp('uart_id').show(); Ext.getCmp('sens_port').hide(); Ext.getCmp('sens_ip').hide(); }; } } },{ xtype: 'combo', id: 'sens_range', fieldLabel: "GetLabel('SENS_RANGE');?>", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['range','range_txt'], data: [ [15,"15 GetLabel('_METERS_RANGE_');?>"], [35,"35 GetLabel('_METERS_RANGE_');?>"], [65,"65 GetLabel('_METERS_RANGE_');?>"], [75,"75 GetLabel('_METERS_RANGE_');?>"], [150,"150 GetLabel('_METERS_RANGE_');?>"], [200,"200 GetLabel('_METERS_RANGE_');?>"], [300,"300 GetLabel('_METERS_RANGE_');?>"], [350,"350 GetLabel('_METERS_RANGE_');?>"] ] }), valueField: 'range', displayField: 'range_txt', value: 15, width: 200 },{ xtype: 'numberfield', id: 'sens_id', fieldLabel: "GetLabel('_PROTO_DEVICE_ID_');?>", width: 200, value: 0 },{ xtype: 'combo', fieldLabel: "GetLabel('_UART_PORT_');?>", lazyRender: true, id: 'uart_id', mode: 'local', disabled: false, forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], data: [Query( $QS ); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; }; echo implode( ',', $RE ); } else { echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; }; ?>] }), valueField: 'uart', displayField: 'uart_txt', width: 200 },{ xtype: 'textfield', id: 'sens_ip', hidden: true, fieldLabel: "GetLabel('_DEVICE_IP_');?>", width: 200, value: '192.168.200.105' },{ xtype: 'numberfield', id: 'sens_port', hidden: true, fieldLabel: "GetLabel('_DEVICE_PORT_');?>", width: 200, value: 2222 },{ xtype:'button', width: '100%', text: "GetLabel('_ADD_');?>", handler: function(){ var TYP = parseInt( Ext.getCmp('sens_type').getValue() ); var RAN = parseInt( Ext.getCmp('sens_range').getValue() ); if( TYP > 4 ){ var RIP = Ext.getCmp('sens_ip').getValue(); var RPP = parseInt( Ext.getCmp('sens_port').getValue() ); addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"GetLabel('_Please_Wait_');?>..."}); addSensWM.show(); Ext.Ajax.request({ url: '/lib/controller/doNodeOperation.php', params: { UID: , SID: '', TYPE: TYP, RANGE: RAN, ADDR: RIP, PORT: RPP, CCMD: 1 }, success: function( response, opts ){ addSensWM.hide(); var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ loadAttachedSensors(); } else { Ext.Msg.show({ title:'Error!', msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); }; addSensorDialog.hide(); }, failure: failureAJAXFunction }); } else { var RTI = parseInt( Ext.getCmp('uart_id').getValue() ); if( RTI > 0 ){ var PID = parseInt( Ext.getCmp('sens_id').getValue() ); addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"GetLabel('_Please_Wait_');?>..."}); addSensWM.show(); Ext.Ajax.request({ url: '/lib/controller/doNodeOperation.php', params: { UID: , SID: '', TYPE: TYP, DEVID: PID, UART: RTI, RANGE: RAN, CCMD: 1 }, success: function( response, opts ){ addSensWM.hide(); var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ loadAttachedSensors(); } else { Ext.Msg.show({ title:'Error!', msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); }; addSensorDialog.hide(); }, failure: failureAJAXFunction }); } else { Ext.Msg.show({ title:'Error!', msg: 'Please Choose UART Port', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); }; }; } }] }); }; addSensorDialog.show(); }; var addDetCamDialog = null; var addDetACamDialog = null; var addDetCamWM = null; function addDetectedAnalogCam(){ if( addDetACamDialog == null ){ addDetACamDialog = new Ext.Window({ modal: true, title: 'GetLabel('_ANAL_SOURCES_LST_');?>', width: 800, height: 600, layout: 'fit', closeAction: 'hide', items:[{ xtype: 'grid', frame: false, border: false, ds: cameraListStore, cm: AnalogCameraListColModel, sm: AnalogCameraListSelModel, viewConfig: { forceFit: true } }], bbar: [{ text: 'GetLabel('_CANCEL_');?>', handler: function(){ addDetACamDialog.hide(); } },'->',{ id: 'cha_an_strim_set', text: 'GetLabel('_SETTINGS_');?>', disabled: ( SelectedSource == 0 ), handler: function(){ editAnalogStream( SelectedSource ); } },{ id: 'con_to_anal_src', text: 'GetLabel('_CONNECT_2_SEL_');?>', disabled: ( SelectedSource == 0 ), handler: function(){ //alert( 'Cam Type:'+SelectedCamTYPE ); showAnalCamPropDialog(); } }] }); }; addDetACamDialog.show(); cameraListStore.load({params:{cam_sources:'anal'}}); }; function addDetectedIPCam(){ if( addDetCamDialog == null ){ addDetCamDialog = new Ext.Window({ modal: true, title: "GetLabel('_ADD_CAM_DIAL_TTL_');?>", width: 400, height: 287, layout: 'form', closeAction: 'hide', labelWidth: 160, labelAlign: 'right', items:[{ xtype: 'spacer', height: 8 },{ xtype: 'textfield', id: 'ncam_ip', fieldLabel: "GetLabel('_CAM_IP_ADDRESS_');?>", value: '' },{ xtype: 'numberfield', id: 'ncam_port', fieldLabel: "GetLabel('_DEVICE_PORT_');?>", value: 'default' },{ xtype: 'combo', id: 'ncam_protocol', fieldLabel: "GetLabel('_CTL_PROTOCOL_');?>", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [0,'OnVif'], [1,'BOSCH RCP+ over CGI'] ] }), valueField: 'mode', displayField: 'mode_txt', value: 0, width: 200 },{ xtype: 'textfield', id: 'ncam_user', fieldLabel: "GetLabel('_ACCESS_LOGIN_');?>", value: '' },{ xtype: 'textfield', id: 'ncam_pwd', inputType: 'password', fieldLabel: "GetLabel('_ACCESS_PASSWORD_');?>", value: '' },{ xtype: 'combo', id: 'ncam_auth_mode', fieldLabel: "GetLabel('_AUTH_MODE_0_');?>", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [0,'BASIC'], [1,'DIGEST'], [2,'DIGEST_IE'], [3,'BEARER'], [4,'NEGOTIATE'], [5,'NTLM'], [6,'NTLM_WB'], [7,'ANY'], [8,'ANYSAFE'], [9,'ONLY'], [10,'AWS_SIGV4'] ] }), valueField: 'mode', displayField: 'mode_txt', value: 0, width: 200 },{ xtype: 'spacer', height: 8 },{ xtype:'button', width: '100%', text: 'Add Camera to List', handler: function(){ addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"GetLabel('_Please_Wait_');?>..."}); addDetCamWM.show(); var NIP = Ext.getCmp('ncam_ip').getValue(); var NUU = Ext.getCmp('ncam_user').getValue(); var NPP = Ext.getCmp('ncam_pwd').getValue(); var NCP = Ext.getCmp('ncam_port').getValue(); var NPA = Ext.getCmp('ncam_protocol').getValue(); var NAM = Ext.getCmp('ncam_auth_mode').getValue(); Ext.Ajax.request({ url: '/lib/controller/doCameraOperation.php', params: { UID: , SID: '', IP: NIP, UU: NUU, PP: NPP, AU: NAM, PO: NCP, PR: NPA, CMD: 3 }, success: function( response, opts ){ addDetCamWM.hide(); var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ loadDetectedCameras(); } else { Ext.Msg.show({ title:'Error!', msg: data.msg, buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING }); }; addDetCamDialog.hide(); }, failure: failureAJAXFunction }); } }] }); }; addDetCamDialog.show(); }; var settingsSelectedDevice = 0; function fetchDeviceStatus(){ if( tlInterval!= null ){ window.clearTimeout( tlInterval ); tlInterval = null; }; Ext.Ajax.request({ url: '/lib/controller/getStatus.php', params: { SITE: , LNID: lastNotificationID, SPID: StatusTS, LSID: log_store_id, //LoadTS, DEVID: settingsSelectedDevice, UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); StatusTS = data.CTS; if( data.nodes.length > 0 ){ for( i=0; i < data.nodes.length; i++ ){ switch( data.nodes[i].type ){ case 1: case 2: case 3: case 4:{ // 2D if( data.nodes[i].status ){ if( data.nodes[i].reload_draw ) { load2DDraw( data.nodes[i].id ); LoadTS = StatusTS; }; if( data.nodes[i].targets != undefined ){ if( data.nodes[i].targets.length ){ targets_2d[data.nodes[i].id]=[]; for( idx = 0; idx < data.nodes[i].targets.length; idx++) targets_2d[data.nodes[i].id][idx]={ range: data.nodes[i].targets[idx].digital, az: data.nodes[i].targets[idx].az, color: data.nodes[i].targets[idx].color, stroke: data.nodes[i].targets[idx].stroke }; draw2DTargets( data.nodes[i].id ); } else cleanup2DDraw( data.nodes[i].id ); } else cleanup2DDraw( data.nodes[i].id ); }; if( data.nodes[i].bubbles !== undefined ){ if( data.nodes[i].bubbles.length ){ bubbles_2d[data.nodes[i].id]=[]; for( idx = 0; idx < data.nodes[i].bubbles.length; idx++) bubbles_2d[data.nodes[i].id][idx]={ range: data.nodes[i].bubbles[idx].digital, az: data.nodes[i].bubbles[idx].az, color: data.nodes[i].bubbles[idx].color, stroke: data.nodes[i].bubbles[idx].stroke }; draw2DBubbles( data.nodes[i].id ); } else cleanup2DBubbles( data.nodes[i].id ); } else cleanup2DBubbles( data.nodes[i].id ); setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status ); break; }; case 5:{ // 3d if( data.nodes[i].reload_draw ){ reload3dTexture( data.nodes[i].id ); }; if( data.nodes[i].targets != undefined ){ if( data.nodes[i].targets.length ){ draw3DTargets( data.nodes[i].id, data.nodes[i].targets ); animateTargets(); } else { cleanup3DDraw( data.nodes[i].id ); animate(); }; } else { cleanup3DDraw( data.nodes[i].id ); animate(); }; setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status ); break; }; case 10: case 11: case 12: case 13: case 14: case 15:{// Cameras var iel = document.getElementById('img-img-'+data.nodes[i].id ); if( iel != null ){ if( data.nodes[i].status == 0 ){ if( iel.src != "/style/assets/no-signal.png" ) iel.src = "/style/assets/no-signal.png"; } else { if( data.nodes[i].src != iel.src ) iel.src = data.nodes[i].src; }; }; break; }; }; }; }; tlInterval = window.setTimeout( fetchDeviceStatus, 333, selectedSite ); }, failure: failureAJAXFunction }); }; var devUploadTimeout = null; var devUploadID = -1; function fetchDeviceUploadStatus(){ clearTimeout( devUploadTimeout ); if( devUploadID < 1 ) return; Ext.Ajax.request({ url: '/lib/controller/getDeviceUploadStatus.php', params: { UID: , SID: '', DID: devUploadID }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var tT = Ext.getCmp('upp_ttext'); if( tT != undefined ){ if( data.count > 0 ){ devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 ); }; if( data.current != undefined ){ tT.update('

Uploading '+data.count+' file(s)

'); document.getElementById('upp_ctext').innerHTML ='

Current File: '+data.current+'

'; Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true ); devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 ); } else { Ext.getCmp('upload_progres_panel').hide(); Ext.getCmp('uploaded_grid').show(); loadModuleFiles( devUploadID ); }; }; }, failure: failureAJAXFunction }); }; function downloadSettings(){ ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"GetLabel('_Please_Wait_');?>..."}); ReportMask.show(); const formData = new FormData(); formData.append("UID",); formData.append("SID",''); fetch('/lib/controller/downloadSettings.php',{ method: "POST", body: formData }) .then(resp => resp.blob()) .then(blob => { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; var today=new Date(); var SY=1900+today.getYear(); var SMO=today.getMonth()+1; var SD=today.getDate(); var SH = today.getHours(); var SM = today.getMinutes(); var SS = today.getSeconds(); a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db'; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); ReportMask.hide(); Ext.Msg.show({ title:'GetLabel('_SUCCESS_');?>', msg: 'GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); }) .catch(() => { ReportMask.hide(); Ext.Msg.show({ title:'GetLabel('_REQ_FAILURE_');?>', msg: 'GetLabel('_AJX_REQFAILURE_');?>', buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); }); }; function showSettingsGeneral(){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 0; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); Query( $QS ); //$NData = $SDD[0]; $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )"; $CN = $DATABASE->Query( $QS ); $IL=array(); foreach( $CN as $N ){ $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0"; $NWD = $DATABASE->Query( $QS ); $NW = $NWD[0]; $IL[]="{$N['device']}:{$NW['address']}"; }; $NIFO = '' . implode( '', $IL ) . '
'; ?> tPanel.add({ xtype: 'tabpanel', frame: false, id: 'node_settings_content', border: false, activeTab: content_lvl3, items: [{ xtype: 'panel', id: 'gi_tab', title: "GetLabel( '_GENERAL_NFO_' );?>", layout: 'hbox', items:[{ xtype: 'panel', flex: 1, height: PanelH-15, autoScroll: false, html: '\ \ \
\ \ \ \ \
0CPU0MEM0DISK0TEMP
\
\
\
\
 
' },{ xtype: 'panel', id: '_ed_small', flex: 1, height: PanelH-15, autoScroll: false, items:[{ xtype: 'panel', baseCls:'servopInfo_item00', id: 'servopPanel00', items:[{ xtype: 'panel', frame: false, border: false, unstyled: true, html: "

GetLabel('_SENS_ALL_RESTART_DESC_');?>


" },{ xtype: 'button', lazyRender: true, iconCls: 'srv_op_restart', text: "GetLabel('_SENS_ALL_RESTART_OP_');?>", id: 'tbtn_sop00', scale: 'large', width: '95%', disabled: true, handler: function( bt ){ Ext.Msg.show({ title:"GetLabel('_SENS_ALL_RESTART_QT_');?>", msg: "GetLabel('_SENS_ALL_RESTART_QM_');?>", buttons: Ext.Msg.YESNO, width: 400, icon: Ext.MessageBox.INFO, fn: function(btn, text){ if( btn == 'yes' ){ disableServOps(); doDeviceOperation( 1, 213,'', true ); }; } }); } }] },{ xtype: 'spacer', height: 8 } Data['access'] > 3 ){ ?> ,{ xtype: 'panel', baseCls:'servopInfo_item10', id: 'servopPanel01', items:[{ xtype: 'panel', frame: false, border: false, unstyled: true, html: "

GetLabel('_SERV_RESTART_DESC_');?>


" },{ xtype: 'button', lazyRender: true, iconCls: 'srv_op_restart', text: "GetLabel('_SERV_RESTART_OP_');?>", id: 'tbtn_sop01', scale: 'large', width: '95%', disabled: true, handler: function( bt ){ Ext.Msg.show({ title:"GetLabel('_SERV_RESTART_QT_');?>", msg: "GetLabel('_SERV_RESTART_QM_');?>", buttons: Ext.Msg.YESNO, width: 400, icon: Ext.MessageBox.INFO, fn: function(btn, text){ if( btn == 'yes' ){ disableServOps(); doDeviceOperation( 1, 250,'', true ); }; } }); } }] },{ xtype: 'spacer', height: 8 } Data['access'] > 4 ){ ?> ,{ xtype: 'panel', baseCls:'servopInfo_item20', id: 'servopPanel02', items:[{ xtype: 'panel', frame: false, border: false, unstyled: true, html: "

GetLabel('_SERV_HW_DET_DESC_');?>


" },{ xtype: 'button', iconCls: 'srv_op_hw_init', text: "GetLabel('_SERV_HW_DET_OP_');?>", id: 'tbtn_sop02', scale: 'large', width: '95%', disabled: true, handler: function( bt ){ Ext.Msg.show({ title:"GetLabel('_SERV_HW_DET_QT_');?>", msg: "GetLabel('_SERV_HW_DET_QM_');?>", buttons: Ext.Msg.YESNO, width: 400, icon: Ext.MessageBox.INFO, fn: function(btn, text){ if( btn == 'yes' ){ disableServOps(); doDeviceOperation( 1, 251,'', true ); }; } }); } }] },{ xtype: 'spacer', height: 8 } Data['access'] > 5 ){ ?> ,{ xtype: 'panel', baseCls:'servopInfo_item30', id: 'servopPanel03', items:[{ xtype: 'panel', frame: false, border: false, unstyled: true, html: "

GetLabel('_SERV_OSRESET_DESC_');?>


" },{ xtype: 'button', iconCls: 'srv_op_power_cycle', text: "GetLabel('_SERV_OSRESET_OP_');?>", id: 'tbtn_sop03', scale: 'large', width: '95%', disabled: true, handler: function( bt ){ Ext.Msg.show({ title: "GetLabel('_SERV_OSRESET_QT_');?>", msg: "GetLabel('_SERV_OSRESET_QM_');?>", buttons: Ext.Msg.YESNO, width: 400, icon: Ext.MessageBox.WARNING, fn: function(btn, text){ if( btn == 'yes' ){ cleanupChangeNotifier(); } else { loadEditor = false; }; } }); } }] },{ xtype: 'spacer', height: 8 },{ xtype: 'panel', baseCls:'servopInfo_item40', id: 'servopPanel04', items:[{ xtype: 'panel', frame: false, border: false, unstyled: true, html: "

GetLabel('_SERV_FACTORY_DESC_');?>


" },{ xtype: 'button', iconCls: 'srv_op_factory_reset', text: "GetLabel('_SERV_FACTORY_OP_');?>", id: 'tbtn_sop04', scale: 'large', width: '95%', disabled: true, handler: function( bt ){ Ext.Msg.show({ title: "GetLabel('_SERV_FACTORY_QT_');?>", msg: "GetLabel('_SERV_FACTORY_QM_');?>", buttons: Ext.Msg.YESNO, width: 400, icon: Ext.MessageBox.ERROR, fn: function(btn, text){ if( btn == 'yes' ){ disableServOps(); doDeviceOperation( 1, 254,'', true ); }; } }); } }] } ] }] } Data['access'] > 4 ){ ?> ,{ xtype: 'panel', title: "GetLabel( '_RESOURCES_' );?>", id: 'res_tab', layout: 'hbox', items:[{ xtype: 'panel', id: 'resources_container', flex: 1, height: PanelH-15, autoScroll: 'auto', tbar:[{ text: "GetLabel( '_ADD_REMOTE_UART_' );?>", handler: function(){ addEthernet2Uart(); } }], items:[] },{ xtype: 'panel', id: 'res_ed_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] },{ xtype: 'panel', title: "GetLabel( '_SERVER_MODULES_' );?>", id: 'mod_tab', layout: 'hbox', items:[{ xtype: 'panel', id: 'modules_container', flex: 1, height: PanelH-15, autoScroll: 'auto', tbar:[{ text: "GetLabel( '_ADD_MODULE_' );?>", handler: function(){ var addModuleWindow = new Ext.Window({ id: 'huha_boa', title: "GetLabel( '_AS_MODULE_' );?>", modal: true, width: 400, height: 300, items:[{ xtype: 'form', items: [{ xtype: 'combo', fieldLabel: "GetLabel( 'MOD_TYPE' );?>", id: 'mod_type', lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['az_t','az_txt'], data: [Query( $QS ); $MIMO = array(); foreach( $MM as $M ) $MIMO[]="[{$M['id']},\"".$Labels->GetLabel($M['name'])."\"]"; echo implode( ',', $MIMO ); ?>] }), valueField: 'az_t', displayField: 'az_txt', value: 1, listeners:{ select: function( t, r, i ){ var n = r.data.az_t; Ext.Ajax.request({ url: '/lib/controller/getModuleInfo.php', params: { MID: n, UID: , SID: '' }, success: function( response, opts ){ Ext.getCmp('infopan').update( response.responseText ); } }); } } },{ xtype: 'panel', id: 'infopan', html: '' }] }], bbar:[{ text: 'GetLabel( '_CANCEL_' );?>', handler: function(){ addModuleWindow.close(); } },{ text: 'GetLabel( '_ADD_' );?>', handler: function(){ var mtyp = Ext.getCmp('mod_type').getValue(); Ext.Ajax.request({ url: '/lib/controller/addModule.php', params: { SERVID: 1, TYPE: mtyp, UID: , SID: '' }, success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ addModuleWindow.close(); loadModules(); } else { Ext.Msg.show({ title: "GetLabel("_INFO_MSG_");?>", msg: data.message, buttons: Ext.Msg.OK,//YESNOCANCEL, fn: function(){ //SettingsLidar3D.hide(); }, icon: Ext.MessageBox.INFO //QUESTION }); } }, failure: failureAJAXFunction }); } }] }); addModuleWindow.show(); } }], items:[] },{ xtype: 'panel', id: 'mod_ed_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] },{ xtype: 'panel', title: "GetLabel( '_TARGET_FILTERS_' );?>", id: 'flt_tab', layout: 'hbox', items:[{ xtype: 'panel', id: 'filters_container', flex: 1, height: PanelH-15, autoScroll: 'auto', tbar:[{ text: "GetLabel( '_ADD_FILTER_' );?>", handler: function(){ var addFilterWindow = new Ext.Window({ id: 'fulu_boa', title: "GetLabel( '_ADD_EVT_FILTER_' );?>", modal: true, width: 400, height: 300, items:[{ xtype: 'form', items: [{ xtype: 'combo', fieldLabel: "GetLabel( 'MOD_TYPE' );?>", id: 'flt_type', lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['az_t','az_txt'], data: [Query( $QS ); $OOP = array(); foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']"; echo implode(',', $OOP ); ?>] }), valueField: 'az_t', displayField: 'az_txt', value: 1, listeners:{ select: function( t, r, i ){ var n = r.data.az_t; Ext.Ajax.request({ url: '/lib/controller/getFilterInfo.php', params: { FID: n, UID: , SID: '' }, success: function( response, opts ){ Ext.getCmp('filt_infopan').update( response.responseText ); } }); } } },{ xtype: 'panel', id: 'filt_infopan', html: '' }] }], bbar:[{ text: "GetLabel( '_CANCEL_' );?>", handler: function(){ addFilterWindow.close(); } },{ text: "GetLabel( '_ADD_' );?>", handler: function(){ var mtyp = Ext.getCmp('flt_type').getValue(); Ext.Ajax.request({ url: '/lib/controller/addFilter.php', params: { SERVID: 1, TYPE: mtyp, UID: , SID: '' }, success: function( response, opts ){ // If the response is JSON, you have to decode it var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ addFilterWindow.close(); loadFilters(); } else { Ext.Msg.show({ title: "GetLabel("_INFO_MSG_");?>", msg: data.message, buttons: Ext.Msg.OK,//YESNOCANCEL, fn: function(){ //SettingsLidar3D.hide(); }, icon: Ext.MessageBox.INFO //QUESTION }); } }, failure: failureAJAXFunction }); } }] }); addFilterWindow.show(); Ext.Ajax.request({ url: '/lib/controller/getFilterInfo.php', params: { FID: 1, UID: , SID: '' }, success: function( response, opts ){ Ext.getCmp('filt_infopan').update( response.responseText ); } }); } }], items:[] },{ xtype: 'panel', id: 'flt_ed_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] } ], listeners:{ tabchange: function( tp, t ){ switch( t.getId() ){ case 'gi_tab': { //content_lvl3=0; updateServerStatus(); break; }; case 'res_tab': { //content_lvl3=1; stopStatusUpdater(); loadRessources(); break; }; case 'mod_tab':{ //content_lvl3=2; stopStatusUpdater(); loadModules(); break; }; case 'flt_tab':{ //content_lvl3=3; stopStatusUpdater(); loadFilters(); break; }; }; //updateUserContent(); }, afterrender: function(){ settingsAreChanged = false; } }, updateSettings: function(){ alert('Update Settings'); } }); tPanel.doLayout(); updateServerStatus(); }; function showSettingsSensors(){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 4; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); tPanel.add({ xtype: 'panel', id: 'sen_set', layout: 'hbox', tbar:[{ text: "GetLabel( '_SMM_ADD_LSEN_' );?>", handler: function(){ addSensor(); } }], items:[{ xtype: 'panel', id: 'sens_container', flex: 1, height: PanelH-15, autoScroll: 'auto', items:[] },{ xtype: 'panel', id: 'sens_op_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] }); tPanel.doLayout(); loadAttachedSensors(); }; function showSettingsDetection(){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 4; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); tPanel.add({ xtype: 'panel', id: 'sen_set', layout: 'hbox', tbar:[{ text: "GetLabel( '_SMM_ADD_LSEN_' );?>", handler: function(){ addSensor(); } }], items:[{ xtype: 'panel', id: 'sens_container', flex: 1, height: PanelH-15, autoScroll: 'auto', items:[] },{ xtype: 'panel', id: 'sens_op_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] }); tPanel.doLayout(); loadAttachedSensors(); }; function editSensorHW( cid ){ SelectedSensor = cid; Ext.Ajax.request({ url: '/lib/controller/getSensorEditor.php', params: { CID: SelectedSensor, UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); var tComp = Ext.getCmp('sens_op_small'); if( data.status == 'ok' ){ if( tComp!= null ){ var content = Ext.decode( data.content ); tComp.removeAll( true ); tComp.add( content ); tComp.doLayout(); }; } else { if( tComp!= null ){ tComp.removeAll( true ); tComp.add( data ); tComp.doLayout(); }; }; }, failure: function(){ } }); }; var cameraEditorContent = null; function editCamera( cid, etyp ){ SelectedCam = cid; switch( etyp ){ case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break; case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break; }; Ext.Ajax.request({ url: '/lib/controller/getCameraEditor.php', params: { CID: SelectedCam, UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); if( data.status == 'ok' ){ if( cameraEditorContent!= null ){ var content = Ext.decode( data.content ); cameraEditorContent.removeAll( true ); cameraEditorContent.add( content ); cameraEditorContent.doLayout(); }; } else { if( cameraEditorContent!= null ){ cameraEditorContent.removeAll( true ); cameraEditorContent.add( data ); cameraEditorContent.doLayout(); }; }; }, failure: function(){ } }); }; function showSettingsVideo(){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 4; content_lvl3 = 0; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); tPanel.add({ xtype: 'tabpanel', frame: false, id: 'node_settings_content', border: false, activeTab: content_lvl3, items: [{ xtype: 'panel', id: 'cam_ass_tab', title: "GetLabel('_CAM_ASS_LIST_');?>", layout: 'hbox', items:[{ xtype: 'panel', id: 'acam_container', flex: 1, height: PanelH-15, autoScroll: 'auto', items:[] },{ xtype: 'panel', id: 'acam_op_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] },{ xtype: 'panel', title: "GetLabel('_CAM_DET_LIST_');?>", id: 'cam_det_tab', layout: 'hbox', items:[{ xtype: 'panel', id: 'dcam_container', flex: 1, height: PanelH-15, autoScroll: 'auto', tbar:[{ text: "GetLabel( '_MANUADD_CAMERA_' );?>", handler: function(){ addDetectedIPCam(); } },{ text: "GetLabel( '_MANUADD_ACAMERA_' );?>", handler: function(){ addDetectedAnalogCam(); } }], items:[] },{ xtype: 'panel', id: 'dcam_op_small', flex: 1, height: PanelH-15, layout: 'fit', items:[{ html: "
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
" }] }] }], listeners:{ tabchange: function( tp, t ){ switch( t.getId() ){ case 'cam_det_tab': { content_lvl3=0; stopStatusUpdater(); loadDetectedCameras(); break; }; case 'cam_ass_tab': { content_lvl3=1; stopStatusUpdater(); loadAssignedCameras(); break; }; case 'mod_tab':{ content_lvl3=2; stopStatusUpdater(); loadModules(); break; }; case 'net_tab':{ content_lvl3=3; stopStatusUpdater(); break; }; }; updateUserContent(); }, afterrender: function(){ settingsAreChanged = false; } } }); tPanel.doLayout(); updateUserContent(); updateServerStatus(); }; function showSettingsApplication( ap_sid ){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 3; //Load Location prepareMapData(); if( ap_sid == undefined ) ap_sid = 0; content_lvl3 = ap_sid; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); tPanel.add({ xtype: 'tabpanel', frame: false, id: 'settings_a_content', border: false, activeTab: 'aps_tab_'+content_lvl3, items:[{ title: "GetLabel('_WORKING_MODE_');?>", xtype: 'form', id: 'aps_tab_0', labelAlign: 'right', labelWidth: 250, height: PanelH - 30, items:[] }, { title: "GetLabel('_GEO_LOCATION_');?>", layout: 'column', id: 'aps_tab_1', items:[] }, { title: "GetLabel('_BACKUP_SETTINGS_');?>", xtype: 'form', id: 'aps_tab_2', fileUpload: true, labelAlign: 'right', labelWidth: 180, height: PanelH - 30, items:[{ xtype: 'spacer', height: 10 },{ xtype: 'button', text: "GetLabel( '_DOWNLOAD_SETTINGS_' );?>", width: 500, handler: downloadSettings },{ xtype: 'spacer', height: 10 },{ xtype: 'fileuploadfield', id: 'db_file', emptyText: "GetLabel('_DB_BACKUP_');?>", fieldLabel: "GetLabel('_SELE_DBBACKUP_');?>", width: 300, name: 'db_file', buttonText: "GetLabel('_BROWSE_');?>" },{ xtype: 'spacer', height: 10 },{ xtype: 'button', text: "GetLabel( '_APLY_DBBACKUP_' );?>", width: 500, handler: function(){ if( Ext.getCmp('as_dbbackup').getForm().isValid()){ Ext.getCmp('as_dbbackup').getForm().submit({ url: '/lib/controller/doDatabaseOperation.php', waitMsg: "GetLabel('_DB_UPLOAD_BACKUP_');?>...", encoding: 'multipart/form-data', success: function(fp, o){ } }); }; } },{ xtype: 'spacer', height: 10 },{ xtype: 'button', text: "GetLabel( '_FACTORY_RESET_' );?>", width: 500, handler: function(){ doDeviceOperation( 1, 254, '', true ); } }] },{ title: "GetLabel('_REPORT_STORAGE_');?>", xtype: 'form', id: 'aps_tab_3', labelAlign: 'right', labelWidth: 180, height: PanelH - 30, items:[{ xtype: 'spacer', height: 10 },{ xtype: 'numberfield', id: 'stor_days', fieldLabel: "GetLabel('_STORE_DAYS_');?>", width: 300, value: , name: 'stor_time', listeners: { change: function( t, b, o ){ doApplicationOperation( 4, b ); } } },{ xtype: 'spacer', height: 10 },{ xtype: 'slider', id: 'stor_space', fieldLabel: "GetLabel('_STORE_EMPTY_SPACE_');?>", value: , width: 300, name: 'stor_space', listeners: { change: function( t, b, o ){ doApplicationOperation( 5, b ); } } },{ xtype: 'spacer', height: 10 },{ xtype: 'button', text: "GetLabel( '_APPLY_SETTINGS_' );?>", width: 500, handler: function(){ doDeviceOperation( 1, 250, '', true ); } },{ xtype: 'spacer', height: 10 }] },{ title: "GetLabel('_MULTI_LAYOUT_');?>", xtype: 'form', id: 'aps_tab_4', labelAlign: 'right', labelWidth: 180, height: PanelH - 30, items:[] }], listeners:{ tabchange: function( tp, t ){ switch( t.getId() ){ case 'aps_tab_0': content_lvl3 = 0; break; case 'aps_tab_1': content_lvl3 = 1; break; case 'aps_tab_2': content_lvl3 = 2; break; case 'aps_tab_3': content_lvl3 = 3; break; case 'aps_tab_4': content_lvl3 = 4; break; case 'aps_tab_5': content_lvl3 = 5; break; }; loadApplicationSettings( content_lvl3 ); updateUserContent(); }, afterrender: function(){ //settingsAreChanged = false; } } }); tPanel.doLayout(); loadApplicationSettings( content_lvl3 ); //updateUserContent(); }; function showMultyLayoutEditor(){ alert('KAKA'); }; function showSettingsUpgrade(){ stopStatusUpdater(); content_lvl1 = 1; content_lvl2 = 4; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); initial_md5 = ''; tPanel.add({ columnWidth: 1.0, frame: false, border: false, items: [{ frame: false, border: false, collapsible: false, draggable: false, layout: 'vbox', //layoutConfig: { // align : 'stretch', // pack : 'start', //}, height: PanelH, items:[{ title: "getLabel('_MAP_MONITORING_');?>", xtype: 'panel', height: PanelH-300, //flex: 1, frame: true, width: '100%', border: false, layout: { type: 'table', columns: 2, tableAttrs: { valign: 'top', style: 'valign:top;width:100%;' } }, defaults: { frame: true, border: false, height: ( PanelH-400 ) / 2, style: 'margin: 5px;width:400px;display:block;' }, items:[{ title: 'Current System Info', width: '100%', //flex: 1, html: '

Current Web Version: 

' },{ title: 'Tasks', //width: 400, layout: 'vbox', items:[{ xtype: 'button', width: '100%', text: 'Create Database Backup', handler: function(){ createNewTask( 2 ); } },{ xtype: 'button', width: '100%', text: 'Create Full Snapeshot', handler: function(){ createNewTask( 255 ); } }] },{ title: 'Archives', height: 250, width: '100%', tbar:[{ text: 'Restore', id: 'ar_restore_btn', handler: function(){ createNewTask(1, selectedArchiveRecord.data.file_name ); } },{ text: 'Download', id: 'ar_download_btn', handler: function(){ if( selectedArchiveRecord!= null ){ window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name ); }; } },{ text: 'Delete', id: 'ar_delete_btn', handler: function(){ createNewTask(100, selectedArchiveRecord.data.file_name ); } }], items:[{ xtype: 'grid', id: 'archives_grid', border: false, frame: false, autoScroll: true, //width: '100%', lazyRender: true, height: 210, ds: archives_store, cm: new Ext.grid.ColumnModel( archivesColModel_ops ), sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ), viewConfig: { // forceFit: true }, }] },{ title: 'Task Status', height: 250, //flex: 1, items:[{ xtype: 'spacer', height: 4 },{ id: 'ctask_status', border: true, html: '' },{ xtype: 'spacer', height: 4 },{ xtype: 'textarea', id: 'task_log', height: ( PanelH-320 ) / 2 - 120, style: 'font-size:9px;width:100%;margin-bottom:4px;', readOnly: true, autoScroll: true, value: '' },{ xtype: 'progress', id: 'task_progress', value: 1.0, text: 'idle', disabled: true }], tbar:[{ text: 'Cancel Task', id: 'ch_ta_btn', disabled: true, handler: deleteNewTask }] }] },{ title: 'getLabel('_UPLOAD_PACKAGE_');?>', xtype: 'panel', height: 300, //flex: 1, frame: true, border: false, //layout: 'vbox', items:[{ xtype:'button', id: 'pickfiles', width: '100%', text: 'Choose File' },{ height: 200, xtype: 'grid', id: 'upload_grid', border: false, frame: false, mode: 'local', lazyRender: true, width: '100%', autoScroll: true, ds: uploads_store, cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ), sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), viewConfig: { forceFit: true }, bbar: [{ text: 'Clear', width: '100%', handler: function(){ muploader.splice(); uploads_store.removeAll(); } }] },{ xtype:'button', id: 'umpalumpa', width: '100%', disabled: true, text: 'Upload', handler: function(){ if( muploader!= null ){ muploader.start(); }; } }], listeners:{ afterrender: function(){ muploader = new plupload.Uploader({ runtimes : 'html5,html4', browse_button : Ext.getDom('pickfiles'), // you can pass in id... //container: document.getElementById('upupu'), // ... or DOM Element itself max_file_size : '1000mb', chunk_size: '200kb', max_retries: 3, multi_selection: false, max_file_count: 1, // Fake server response here url: '/lib/php/setup_toolkit/upload.php', //url: "/echo/json", //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf', //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap', filters : [ //{title : "Image files", extensions : "jpg,gif,png"}, {title : "Archive files", extensions : "rar,zip,gz,bz2"} ], init: { PostInit: function() { //$('filelist').innerHTML = ''; //$('uploadfiles').onclick = function() { // uploader.start(); // return false; //}; }, FilesAdded: function( up, files ) { Ext.getCmp('umpalumpa').enable(); plupload.each( files, function(file) { uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true ); uploads_store_id++; Ext.getCmp('upload_grid').doLayout(); }); }, UploadProgress: function(up, file) { var pb = Ext.getCmp( 'progress_'+file.id ); if( file.percent < 100 ){ pb.updateProgress( file.percent / 100, file.percent + '%', false ); } else { pb.updateProgress( 1.0, 'Uploaded', false ); }; }, Error: function(up, err) { Ext.Msg.show({ title:'Upload Status', msg: "Error #" + err.code + ": " + err.message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }); muploader.init(); } } }] }] }); muploader = null; uploads_store.removeAll(); tPanel.doLayout(); archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }}); updateTaskStatus(); tlInterval = window.setInterval( updateTaskStatus, 333 ); }; function loadSensorDetectionSettings( sensid ){ Ext.Ajax.request({ url: '/lib/controller/getSensorDetectionEditor.php', params: { UID: , SID: '', SEN: sensid }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); var tComp = Ext.getCmp('main_content'); if( data.status == 'ok' ){ if( tComp!= null ){ var content = Ext.decode( data.content ); tComp.removeAll( true ); tComp.add( content ); tComp.doLayout(); }; } else { if( tComp!= null ){ tComp.removeAll( true ); tComp.add( data ); tComp.doLayout(); }; }; }, failure: function(){ } }); }; function initSettingsView(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; var tP = Ext.getCmp('left_side_menu'); //tP.doLayout(); //tP.setVisible( false ); tP.removeAll( true ); tP.add({ id: 'sme_inner', layout:'accordion', //height: PanelH, frame: false, border: false, layoutConfig:{ animate: true//, //activeOnTop: true }, items:[] }); tP.doLayout(); tP = Ext.getCmp('sme_inner'); Data['access'] > 3 ){ ?> tP.add({ title: "GetLabel('_SYS_SETTINGS_');?>", layout: 'vbox', height: 120, pack: 'center', align : 'strech', collapsed: ( content_lvl1 != 0 ), items:[{ xtype: 'button', width: '100%', id:'sys_edit', text: "GetLabel('_SYS_GENERAL_');?>", enableToggle: true, pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsGeneral } Data['access'] > 4 ){ ?> ,{ xtype: 'button', width: '100%', id:'map_edit', text: "GetLabel('_SENSOR_CONNECTION_');?>", enableToggle: true, pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsSensors },{ xtype: 'button', width: '100%', id:'video_set', text: "GetLabel('_CAMERA_MNGMNT_');?>", enableToggle: true, pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsVideo } ,{ xtype: 'button', width: '100%', id:'app_set', text: "GetLabel('_APPLICA_MNGMNT_');?>", enableToggle: true, pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'sys_settings', handler: function(){ showSettingsApplication( content_lvl3 ); } } ] }); Data['access'] > 4 ){ ?> tP.add({ title: "GetLabel('_DET_SETTINGS_');?>", layout: 'vbox', height: 120, pack: 'center', align : 'strech', collapsed: ( content_lvl1 != 1 ), items:[ { xtype: 'button', width: '100%', id:'go_home', text: "GetLabel('_UPPER_SENSOR_');?>", enableToggle: true, pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadMetroControlUpper },{ xtype: 'button', width: '100%', id:'go_monitor', text: "GetLabel('_BOTTOM_SENSOR_');?>", enableToggle: true, pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadMetroControlBottom },{ xtype: 'button', width: '100%', id:'go_archive', text: "GetLabel('_FUSION_ENGINE_');?>", enableToggle: true, pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadMetroControlFusion }0 AND `type`<5"; $RR = $DATABASE->Query( $QS ); if( count( $RR ) ){ foreach( $RR as $CR ){ ?> { xtype: 'button', width: '100%', text: '', enableToggle: true, pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', handler: function(){ loadSensorDetectionSettings( ); } }, { xtype: 'spacer', html: "GetLabel('_NO_SENSORS_DEF_');?>", height: 32 }, { xtype: 'spacer', height: 10 }] }); tP.add({ title: "GetLabel('_PROF_SETTINGS_');?>", items:[Data['language'] ){ $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }"; } else { $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }"; }; }; echo implode(',',$ZIGA ); ?>] }); Data['access'] > 5 ){ ?> tP.add({ title: "GetLabel('_ADM_SETTINGS_');?>", collapsed: ( content_lvl1 != 3 ), items:[{ xtype: 'button', width: '100%', id:'adm_acc', text: "GetLabel('_USERS_MNGMT_');?>", enableToggle: true, pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ), allowDepress: false, toggleGroup: 'adm_settings', handler: function( b, e ){ loadUserEditor(); } },{ xtype: 'button', width: '100%', id:'adm_acclog', text: "GetLabel('_ACC_LOG_');?>", enableToggle: true, pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ), allowDepress: false, toggleGroup: 'adm_settings', handler: function( b, e ){ loadAccessLog(); } },{ xtype: 'button', width: '100%', id:'adm_servlog', text: "GetLabel('_SERV_LOG_');?>", enableToggle: true, pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ), allowDepress: false, toggleGroup: 'adm_settings', handler: function( b, e ){ loadServerLog(); } }] }); tP.setVisible( true ); tP.doLayout(); switch( content_lvl1 ){ default:{ switch( content_lvl2 ){ default: showSettingsGeneral(); break; Data['access'] > 5 ){ ?> case 1: showSettingsSensors(); break; case 2: showSettingsVideo(); break; case 3: showSettingsApplication(); break; //case 4: showSettingsUpgrade(); break; }; }; case 1:{ switch( content_lvl2 ){ case 0: break; }; break; }; Data['access'] > 5 ){ ?> case 3:{ switch( content_lvl2 ){ case 0: loadUserEditor(); break; }; break; }; }; }; function zdonut(cx, cy, radius, data) { function arcradius(cx, cy, radius, degrees) { var radians = (degrees - 90) * Math.PI / 180.0; return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) }; } var decimals = 4; var total = 0; var arr = []; var beg = 0; var end = 0; var count = 0; var half = radius / 2; var midpoint = radius / 2.4; for( var i = 0; i < data.length; i++) total += data[i].value; for( var i = 0; i < data.length; i++) { var item = data[i]; var tmp = {}; //var p = Math.floor((((item.value + 1) / total) * 100), decimals ); var p = (( item.value / total ) * 100.0 ); count += p; if( i === length - 1 && count < 100 ) p = p + (100 - count); end = beg + ((360 / 100) * p); tmp.index = i; tmp.value = item.value; tmp.data = item; var b = arcradius(cx, cy, radius, end); var e = arcradius(cx, cy, radius, beg); var la = (end - beg) <= 180 ? 0 : 1; tmp.d = ['M', Math.floor( b.x, decimals ), Math.floor( b.y, decimals ), 'A', radius, radius, 0, la, 0, Math.floor( e.x, decimals ), Math.floor( e.y, decimals ) ].join(' '); arr.push(tmp); beg = end; }; return arr; }; var selectedPresetsBackgroundSensor = 0; function altPTZCmd( me ){ var name = me.target.id; const myArray = name.split("_"); Ext.Ajax.request({ url: '/lib/controller/doCameraOperation.php', params: { UID: , SID: '', CMD: 11, CID: myArray[3], MOV: myArray[2] }, failure: failureAJAXFunction }); }; function showCameraPresets( AA, camID ){ Ext.Ajax.request({ url: '/lib/controller/getCameraPresets.php', params: { CID: camID, UID: , SID: '', }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var hgy = Ext.getCmp('pres_count'); if( hgy!= undefined ) hgy.setValue( data.count ); var hgy = Ext.getCmp('pres_p_seg'); if( hgy!= undefined ) hgy.setValue( data.pres_cols ); var hgy = Ext.getCmp('pres_z_seg'); if( hgy!= undefined ) hgy.setValue( data.pres_rows ); if( data.special_iron != undefined ){ var hgy = Ext.getCmp('pres_iron'); if( hgy!= undefined ) hgy.setValue( data.special_iron ); var juja = document.getElementById('img_btn_035_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn'); juja.classList.remove('ptz_ctrl_btn_hdn'); juja.addEventListener( 'mousedown', altPTZCmd ); }; } else { var juja = document.getElementById('img_btn_035_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn_hdn'); juja.classList.remove('ptz_ctrl_btn'); juja.removeEventListener( 'mousedown', altPTZCmd ); }; }; if( data.special_iroff != undefined ){ var hgy = Ext.getCmp('pres_iroff'); if( hgy!= undefined ) hgy.setValue( data.special_iroff ); var juja = document.getElementById('img_btn_036_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn'); juja.classList.remove('ptz_ctrl_btn_hdn'); juja.addEventListener( 'mousedown', altPTZCmd ); }; } else { var juja = document.getElementById('img_btn_036_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn_hdn'); juja.classList.remove('ptz_ctrl_btn'); juja.removeEventListener( 'mousedown', altPTZCmd ); }; }; if( data.special_irauto != undefined ){ var hgy = Ext.getCmp('pres_irauto'); if( hgy!= undefined ) hgy.setValue( data.special_irauto ); }; if( data.special_wiper != undefined ){ var hgy = Ext.getCmp('pres_wiper'); if( hgy!= undefined ) hgy.setValue( data.special_wiper ); var juja = document.getElementById('img_btn_037_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn'); juja.classList.remove('ptz_ctrl_btn_hdn'); juja.addEventListener( 'mousedown', altPTZCmd ); }; } else { var juja = document.getElementById('img_btn_037_'+camID ); if( juja != undefined ){ juja.classList.add('ptz_ctrl_btn_hdn'); juja.classList.remove('ptz_ctrl_btn'); juja.removeEventListener( 'mousedown', altPTZCmd ); }; }; var svg = document.getElementById( AA ); svg.innerHTML = ""; var centerX = svg.clientWidth / 2.0; var centerY = svg.clientHeight / 2.0; var radius = svg.clientHeight / 2.0 - (data.pres_rows*2.0); var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453']; var max_lines = data.pres_rows; for( var cl = max_lines; cl > 0; cl--){ var segnum = data.pres_cols * Math.pow( 2, ( cl-1 ) ); var dta = []; for( var j = 0; j< segnum; j++) dta[j]={ value: (180/segnum) }; var crad = cl * ( radius/(max_lines+1)); var arr = zdonut(centerX, centerY, crad, dta ); for (var i = 0; i < arr.length; i++) { var item = arr[i]; var tP = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); tP.setAttribute( 'd', item.d ); var test = false; var ll = []; if( data.presets.length ){ for( var z = 0; z < data.presets.length; z++) if( data.presets[z].row == cl && data.presets[z].column == i ){ ll = data.presets[z]; test = true; break; }; }; if( test ){ tP.setAttribute( 'stroke', '#000000' ); tP.setAttribute( 'class', 'preset_ctrl_btn_a' ); tP.setAttribute( 'onclick', 'triggerPreset('+camID+','+ll.id+')' ); tP.setAttribute( 'oncontextmenu', 'removePreset('+camID+','+ll.id+')' ); } else { tP.setAttribute( 'stroke', color[(i+cl)%5] ); tP.setAttribute( 'class', 'preset_ctrl_btn' ); tP.setAttribute( 'ondblclick', 'setPreset('+camID+','+i+','+cl+')' ); }; tP.setAttribute( 'fill', 'none' ); tP.setAttribute( 'stroke-width', ( radius/(max_lines+1)) ); svg.appendChild( tP ); } }; if( selectedPresetsBackgroundSensor ) preview2DDraw( selectedPresetsBackgroundSensor, 'ptz_presets_'); }, failure: failureAJAXFunction }); }; function triggerPreset( camID, presetID ){ //alert( "Call Preset["+presetID+"] for camera["+camID+"]" ); doCamOperation( camID, 30, presetID ); return false; }; function removePreset( camID, presetID ){ //alert( "Remove Preset["+presetID+"] for camera["+camID+"]" ); doCamOperation( camID, 29, presetID ); window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 ); return false; }; function setPreset( camID, colID, rowID ){ //alert( "Set new Preset for camera["+camID+"] x:"+colID+" y:"+rowID ); doCamOperation( camID, 28, colID+"_"+rowID ); window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 ); return false; };