diff --git a/.gitignore b/.gitignore index 881b5a8..a48aedf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /temp/* /storage/* /saved_images/* +/lib/javascript/extjs/* diff --git a/lib/controller/AddCameraNode.php b/lib/controller/AddCameraNode.php index 2786157..c272f8a 100644 --- a/lib/controller/AddCameraNode.php +++ b/lib/controller/AddCameraNode.php @@ -12,36 +12,47 @@ $Data = array(); if( $CamID ){ if( intval($_POST['PTZ']) > 0 ){ - $CAM_NAM = 'New PTZ IP Camera'; + if( isset( $_POST['NAM'] ) ){ + $CAM_NAM = $DATABASE->escape( $_POST['NAM'] ); + } else { + $CAM_NAM = 'New PTZ IP Camera'; + }; $CCTYPE = ARGUS_IP_PTZ_CAMERA; } else { - $CAM_NAM = 'New Static IP Camera'; + if( isset( $_POST['NAM'] ) ){ + $CAM_NAM = $DATABASE->escape( $_POST['NAM'] ); + } else { + $CAM_NAM = 'New PTZ IP Camera'; + }; $CCTYPE = ARGUS_IP_STATIC_CAMERA; }; - $QS = "UPDATE cameras SET type={$CCTYPE},enabled=1,status=1, lat={$LAT},lon={$LON},alt={$ALT},pitch={$PCH},roll={$ROL},yaw={$YAW} WHERE id={$CamID}"; + $QS = "UPDATE cameras SET type={$CCTYPE}, status=1, lat={$LAT},lon={$LON},alt={$ALT},pitch={$PCH},roll={$ROL},yaw={$YAW} WHERE id={$CamID}"; $DATABASE->Query( $QS, false ); $QS = "INSERT INTO nodes SET site_id={$SiteID},type={$CCTYPE},aux_id={$CamID},name='{$CAM_NAM}'"; $DATABASE->Query( $QS, false ); $NodeID = $DATABASE->getLastInsertID(); if( $NodeID > 0 ){ - if( intval($_POST['PTZ']) > 0 ){ - $MD5 = md5( $NodeID . "_" . $CamID . "_DM" ); - $TY = ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL; - $MO = COM_MODE_OUT; - $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$CamID}, type={$TY}, mode={$MO}, md5='{$MD5}', name='Digital Media'"; + $QS = "SELECT * FROM media_streams WHERE source_id={$CamID}"; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + foreach( $result as $r ){ + $MD5 = md5( $NodeID . "_" . $r['id'] . "_DM" ); + $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$r['id']}, `type`=6, md5='{$MD5}', multidrop=0, mode=2, binded=0, `name`='IPV [{$r['img_width']}x{$r['img_height']}]'"; $DATABASE->Query( $QS, false ); + }; + }; + if( intval($_POST['PTZ']) > 0 ){ $MD5 = md5( $NodeID . "_" . $CamID . "_CTRL" ); - $TY = ARGUS_NODE_SOCK_TYPE_NETWORK; + switch( $_POST['PTZ'] ){ + case 1: $TY = ARGUS_NODE_SOCK_TYPE_NETWORK; + case 2: $TY = ARGUS_NODE_SOCK_TYPE_SERIAL_PORT; + }; $MO = COM_MODE_INOUT; - $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$CamID}, type={$TY}, mode={$MO}, md5='{$MD5}', name='OnVif Control'"; - $DATABASE->Query( $QS, false ); - } else { - $MD5 = md5( $NodeID . "_" . $CamID . "_DM" ); - $TY = ARGUS_NODE_SOCK_TYPE_VIDEO_DIGITAL; - $MO = COM_MODE_OUT; - $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$CamID}, type={$TY}, mode={$MO}, md5='{$MD5}', name='Digital Media'"; + $QS = "INSERT INTO sockets SET node_id={$NodeID}, aux_id={$CamID}, type={$TY}, mode={$MO}, md5='{$MD5}', name='PTZ Control'"; $DATABASE->Query( $QS, false ); }; + $QS = "UPDATE cameras SET node_id={$NodeID} WHERE id={$CamID}"; + $DATABASE->Query( $QS, false ); }; }; } else { diff --git a/lib/controller/addConnection.php b/lib/controller/addConnection.php index fecc2cf..354041d 100644 --- a/lib/controller/addConnection.php +++ b/lib/controller/addConnection.php @@ -2,12 +2,60 @@ require_once('../ajax_asm.php'); if( $CUser->Data['id'] > 1 ){ $SiteID = intval($_POST['NID']); + $SSID = intval($_POST['SOSID']); + $SEID = intval($_POST['SOEID']); $N1ID = intval($_POST['SNID']); $N2ID = intval($_POST['ENID']); - $ConType = intval($_POST['TYPE']); - if( - $RetVal['status'] = true; - $RetVal['edge'] = array('from'=>$N1ID, 'to'=>$N2ID, 'color'=>'red' ); + $QS = "SELECT * FROM `sockets` WHERE `id`={$SSID}"; + $result1 = $DATABASE->Query( $QS, false ); + $QS = "SELECT * FROM `sockets` WHERE `id`={$SEID}"; + $result2 = $DATABASE->Query( $QS, false ); + if( count( $result1 ) && count( $result2 ) ){ + $node1 = $result1[0]; + $node2 = $result2[0]; + $t1 = intval( $node1['type'] ); $m1 = intval( $node1['mode'] ); $n1 = intval( $node1['node_id'] ); $a1 = intval( $node1['aux_id'] ); $d1=intval( $node1['multidrop'] ); + $t2 = intval( $node2['type'] ); $m2 = intval( $node2['mode'] ); $n2 = intval( $node2['node_id'] ); $a2 = intval( $node2['aux_id'] ); $d2=intval( $node2['multidrop'] ); + if( $t1 && $t2 && $m1 && $m2 ){ + if( $m2 == 1 || $m1 == 2 ){ + // from 1 to 2 + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$n1}, `from_aux`={$a1}, `to`={$n2}, `to_aux`={$a2}, `type`={$t1}"; + $DATABASE->Query( $QS, false ); + } else { + // from 2 to 1 + $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$n2}, `from_aux`={$a2}, `to`={$n1}, `to_aux`={$a1}, `type`={$t2}"; + $DATABASE->Query( $QS, false ); + + }; + // Check for Media Channels + if( $t1==6 || $t1 ==7 || $t1==4 || $t1==9 ){ + if( $t1==7 || $t1 == 9 ){ + // 1 is Media Server + // $QS="UPDATE media_streams SET binded=1, destination_id={$a1} WHERE id={$a2}"; + //$DATABASE->Query( $QS, false ); + $QS="INSERT INTO `media_server_streams` SET `site_id`={$SiteID}, `media_server_id`={$a1}, `media_stream_id`={$a2}"; + $DATABASE->Query( $QS, false ); + } else { + // 2 is Media Server + //$QS="UPDATE media_streams SET binded=1, destination_id={$a2} WHERE id={$a1}"; + //$DATABASE->Query( $QS, false ); + $QS="INSERT INTO `media_server_streams` SET `site_id`={$SiteID}, `media_server_id`={$a2}, `media_stream_id`={$a1}"; + $DATABASE->Query( $QS, false ); + }; + }; + if( $d1==0 ){ + $QS="UPDATE `sockets` SET `binded`=1 WHERE id={$SSID}"; + $DATABASE->Query( $QS, false ); + }; + if( $d2==0 ){ + $QS="UPDATE `sockets` SET `binded`=1 WHERE id={$SEID}"; + $DATABASE->Query( $QS, false ); + }; + $RetVal['status'] = true; + $RetVal['edge'] = array('from'=>$N1ID, 'to'=>$N2ID, 'color'=>'red' ); + } else { + $RetVal['status'] = false; + $RetVal['message']='No Possibillty to Make such Connection!'; + }; } else { $RetVal['status'] = false; $RetVal['message']='No Possibillty to Make such Connection!'; diff --git a/lib/controller/dash/node_0.js b/lib/controller/dash/node_0.js index f2f74aa..7466c79 100644 --- a/lib/controller/dash/node_0.js +++ b/lib/controller/dash/node_0.js @@ -1,9 +1,10 @@ { id: 'db_node_%%%NODEID%%%', frame: false, - width: 200, + width: 258, height: 200, border: true, + title: 'R-Goose Server', items:[{ html: '

Server

' }] diff --git a/lib/controller/dash/node_13.js b/lib/controller/dash/node_13.js index 28491ba..acfc418 100644 --- a/lib/controller/dash/node_13.js +++ b/lib/controller/dash/node_13.js @@ -1,10 +1,93 @@ -{ - id: 'db_node_%%%NODEID%%%', - width: 400, - height: 400, - items:[{ - html: '

CAMERA

', - - - }] +{ + id: 'db_node_%%%NODEID%%%', + //xxtype: 'panel', + xtype: 'portlet', + //columnWidth:.33, + //layout: 'fit', + width: 258, + height: 400, + tools: [{ + id:'gear', + handler: function(){ + Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + } + },{ + id:'close', + handler: function(e, target, panel){ + panel.ownerCt.remove(panel, true); + } + }], + frame: true, + bodyStyle: 'padding: 0px;', + plr: null, + title: '%%%NODENAME%%%', + items:[{ + html: '', + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + id: 'src_combo_%%%NODEID%%%', + typeAhead: false, + width: 244, + triggerAction: 'all', + listEmptyText: 'No Video Sources', + lazyRender:true, + mode: 'local', + %%%SELID%%% + listeners:{ + 'select': function( t, r, i ){ + var p = Ext.getCmp('db_node_%%%NODEID%%%'); + if( p != null ){ + if( p.plr!= null ){ + p.plr.src({type: 'application/x-mpegURL', src: r.data.src }); + }; + }; + } + }, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'id', + 'label', + 'src' + ], + data: %%%URLS%%% + }), + valueField: 'id', + displayField: 'label' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + text: 'PTZ Control', + width: 244, + handler: function(){ + alert("ptz "); + } + }], + listeners:{ + afterrender: function( t ){ + t.plr = videojs.getPlayer('hls-%%%NODEID%%%'); + if( t.plr == null ){ + t.plr = videojs('hls-%%%NODEID%%%',{ + autoplay: 'muted', + controls: true, + controlBar: { + volumePanel: false, + playToggle: false, + pictureInPictureToggle: false + } + }); + }; + t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'}); + return true; + }, + destroy: function( t ){ + if( t.plr != null ) t.plr.dispose(); + t.plr = null; + } + } } \ No newline at end of file diff --git a/lib/controller/dash/node_13.js.bk b/lib/controller/dash/node_13.js.bk new file mode 100644 index 0000000..7d7b9b8 --- /dev/null +++ b/lib/controller/dash/node_13.js.bk @@ -0,0 +1,19 @@ +{ + id: 'db_node_%%%NODEID%%%', + xtype: 'panel', + width: 400, + height: 400, + frame: true, + title: 'Camera %%%NODEID%%%', + items:[{ + html: '', + }], + listeners:{ + afterrender: function(){ + var player = videojs('hls-example',{ + autoplay: 'muted' + }); + return true; + }, + } +} \ No newline at end of file diff --git a/lib/controller/dash/node_5.js b/lib/controller/dash/node_5.js index c7100b8..6e061d7 100644 --- a/lib/controller/dash/node_5.js +++ b/lib/controller/dash/node_5.js @@ -1,7 +1,8 @@ { id: 'db_node_%%%NODEID%%%', - width: 800, - height: 200, + width: 258, + height: 200, + title: '3D Lidar', items:[{ html: '3D Lidar' }] diff --git a/lib/controller/dash/tpl.js b/lib/controller/dash/tpl.js index b5af507..d387b49 100644 --- a/lib/controller/dash/tpl.js +++ b/lib/controller/dash/tpl.js @@ -1,14 +1,16 @@ -{ - title: 'System Dashboard', - bodyStyle: 'padding:15px', - layout: 'auto', - //width: 400, - //height: 400, - defaults: { - // applied to each contained panel - bodyStyle: 'padding:15px;border-radius: 20px;background-color: ivory; text-color: black;', - }, - items:[ - %%%ITEMS%%% - ] -} \ No newline at end of file +[{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px', + items:[ + %%%ITEMS%%% + ] +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +}] \ No newline at end of file diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index 629904e..1c88dc1 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -1,38 +1,75 @@ -Data['id'] > 1 ){ - $SiteID = intval( $_POST['SITE'] ); - $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; - $result = $DATABASE->Query( $QS, false ); - $Data = file_get_contents( 'dash/tpl.js' ); - if( count( $result ) > 0 ){ - $index = 0; - $TPL = array(); - foreach( $result as $R ){ - $TPL[$index] = file_get_contents( 'dash/node_' . $R['type'] . '.js' ); - $TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); - switch( $R['type'] ){ - case ARGUS_SERVER:{ - break; - }; - case ARGUS_3D_SENSOR:{ - break; - }; - case ARGUS_IP_PTZ_CAMERA:{ - break; - }; - }; - $index++; - }; - $ITEMS = implode( ',', $TPL ); - $Data = str_replace('%%%ITEMS%%%', ''.$ITEMS , $Data ); - }; - if( $Data != '' ) { - echo $Data; - } else { - echo '{}'; - }; - exit(); - }; - echo "{}"; +Data['id'] > 1 ){ + $SiteID = intval( $_POST['SITE'] ); + $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; + $result = $DATABASE->Query( $QS, false ); + $Data = file_get_contents( 'dash/tpl.js' ); + if( count( $result ) > 0 ){ + $index = 0; + $TPL = array(); + foreach( $result as $R ){ + $TFN = 'dash/node_' . $R['type'] . '.js'; + if(!file_exists( $TFN )) continue; + $TPL[$index] = file_get_contents( $TFN ); + $TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); + switch( $R['type'] ){ + case ARGUS_SERVER:{ + break; + }; + case ARGUS_3D_SENSOR:{ + break; + }; + case ARGUS_IP_PTZ_CAMERA:{ + $QS="SELECT * FROM cameras WHERE node_id={$R['id']}"; + $Z=$DATABASE->Query( $QS ); + $QS="SELECT mss.*, ms.name, ms.img_width, ms.img_height FROM media_server_streams mss LEFT JOIN media_streams ms ON ( mss.media_stream_id = ms.id ) WHERE ms.source_id={$Z[0]['id']} AND mss.valid=1 AND mss.online=1"; + $S=$DATABASE->Query( $QS ); + $TPL[$index] = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL[$index] ); + if( count( $S ) ){ + $CS = array(); + $FID = 0; + $FUL = ''; + foreach( $S as $sou ){ + $QS = "SELECT * FROM media_servers WHERE id = {$sou['media_server_id']}"; + $F = $DATABASE->Query( $QS ); + $FF=$F[0]; + if( $FF['ip']=='127.0.0.1'){ + //Localhost + $FF['ip'] = $_SERVER['SERVER_ADDR']; + }; + $ACC_URL='http://' . $FF['ip'] . ':' . $FF['REST_port']; + $CU = str_replace( $FF['virtual_host'], $ACC_URL, $sou['key'] ) . '/hls.m3u8'; + if( $FID == 0 ){ + // First URL as default + $FID = $sou['id']; + $FUL = $CU; + }; + $CS[] = '[' . $sou['id'] . ',\'[' . $sou['img_width'] . 'x' . $sou['img_height'] . '] '. $sou['name'].'\',\'' . $CU .'\']'; + }; + $TPL[$index] = str_replace( '%%%URLS%%%', '['. implode( ',', $CS ) . ']' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $FID .',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%', $FUL, $TPL[$index] ); + } else { + // Handle No Video From Camera! + $TPL[$index] = str_replace( '%%%URLS%%%', '[]' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: \'No Video Sources\',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%','', $TPL[$index] ); + }; + break; + }; + }; + $index++; + }; + $ITEMS = implode( ',', $TPL ); + $Data = str_replace('%%%ITEMS%%%', ''.$ITEMS , $Data ); + }; + if( $Data != '' ) { + echo $Data; + } else { + echo '{}'; + }; + exit(); + }; + echo "{}"; ?> \ No newline at end of file diff --git a/lib/controller/getOnvifCredentials.php b/lib/controller/getOnvifCredentials.php index ad6b0c4..f0a4909 100644 --- a/lib/controller/getOnvifCredentials.php +++ b/lib/controller/getOnvifCredentials.php @@ -9,7 +9,7 @@ $ECID = intval( $_POST['CID'] ); if( $ECID > 0 ){ //Check if Camera Already has password and discovered sources! - $QS = "SELECT * FROM camera_streams WHERE camera_id={$ECID}"; + $QS = "SELECT * FROM media_streams WHERE source_id={$ECID}"; $Result = $DATABASE->Query($QS,false); if( count( $Result ) > 0 ){ $QS = "SELECT * FROM cameras WHERE id = {$ECID}"; diff --git a/lib/controller/getVideoFeed.php b/lib/controller/getVideoFeed.php index c112775..262a5d0 100644 --- a/lib/controller/getVideoFeed.php +++ b/lib/controller/getVideoFeed.php @@ -15,13 +15,13 @@ $AUX = intval($_GET['AUX']); }; if( $FID > 0 ){ - $QS = "SELECT cs.picture AS pic_url, cs.picture_port AS pic_port, ca.* FROM camera_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.camera_id ) WHERE cs.id={$FID}"; + $QS = "SELECT cs.picture AS pic_url, cs.picture_proto AS pic_proto, cs.picture_port AS pic_port, ca.* FROM media_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.source_id ) WHERE cs.id={$FID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ //var_dump( $Result[0] ); $soap_do = curl_init(); //$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0"; - $URL = str_replace( '%%%IP%%%', $Result[0]['ip'] .':'. $Result[0]['pic_port'], $Result[0]['pic_url'] ); + $URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; curl_setopt($soap_do, CURLOPT_URL, $URL ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); diff --git a/lib/controller/lib - Shortcut.lnk b/lib/controller/lib - Shortcut.lnk new file mode 100644 index 0000000..a3cb615 Binary files /dev/null and b/lib/controller/lib - Shortcut.lnk differ diff --git a/lib/controller/listAndDiscoverOnvifProfiles.php b/lib/controller/listAndDiscoverOnvifProfiles.php index 2a018aa..8cd7ab9 100644 --- a/lib/controller/listAndDiscoverOnvifProfiles.php +++ b/lib/controller/listAndDiscoverOnvifProfiles.php @@ -9,7 +9,7 @@ $ECID = intval( $_POST['CID'] ); if( $ECID > 0 ){ //Check if Camera Already has password and discovered sources! - $QS = "SELECT * FROM camera_streams WHERE camera_id={$ECID}"; + $QS = "SELECT * FROM media_streams WHERE source_id={$ECID} AND source_type='D'"; $Result = $DATABASE->Query($QS,false); if( count( $Result ) > 0 ){ foreach( $Result as $CD ){ @@ -18,7 +18,7 @@ $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; $cnode['encode'] = $CD['compression_type']; $cnode['bitrate'] = $CD['bitrate']; - //$cnode['pic'] = $CD['picture']; + $cnode['pic'] = $CD['picture_proto'] . '://' . $IP . ':' . $CD['picture_port'] . $CD['picture']; $Data['nodes'][] = $cnode; }; $Data['success'] = true; @@ -30,8 +30,9 @@ $EPass = $DATABASE->escape( $_POST['GOG'] ); $QS = "SELECT * FROM cameras WHERE id = {$ECID}"; $Result = $DATABASE->Query( $QS, false ); - if(count($Result)){ + if( count($Result) ){ $IP = $Result[0]['ip']; + $SiteID = $Result[0]['site_id']; $onvif = new Ponvif(); $onvif->setUsername( $EUser ); $onvif->setPassword( $EPass ); @@ -57,22 +58,31 @@ $mrl = $onvif->media_GetStreamUri($source['profiletoken']); $pic = $onvif->media_GetSnapshotUri($source['profiletoken']); $TPArr = explode(':',$mrl); + $mrl_proto = $TPArr[0]; $mrl_port = intval( $TPArr[2] ); - $Emrl = $DATABASE->escape( $mrl ); - $Emrl = str_replace( $IP . ':' . $mrl_port, '%%%IP%%%', $Emrl ); - $Emrl = str_replace( $IP, '%%%IP%%%', $Emrl ); - $TPArr = explode(':',$pic); + if( $mrl_port == 0 ) { + switch( $mrl_proto ){ + case 'rtsp': $mrl_port = 554; break; + case 'http': $mrl_port = 80; break; + case 'https': $mrl_port = 443; break; + }; + }; + $Emrl = $DATABASE->escape( $mrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); + $TPArr = explode(':',$pic ); + $pic_proto = $TPArr[0]; $pic_port = intval( $TPArr[2] ); if($pic_port == 0 ) $pic_port = 80; $Epic = $DATABASE->escape( $pic ); - $Epic = str_replace( $IP . ':' . $pic_port, '%%%IP%%%', $Epic ); - $Epic = str_replace( $IP, '%%%IP%%%', $Epic ); + $Epic = str_replace( $pic_proto . '://' . $IP . ':' . $pic_port, '', $Epic ); + $Epic = str_replace( $pic_proto . '://' . $IP , '', $Epic ); //$media_key = $media_server->addStreamProxy( $mrl, 'argus' ); - $QS = "INSERT INTO camera_streams SET camera_id={$ECID}, name='{$Ename}', token='{$Etoken}', img_width={$Ewidth}, img_height={$Eheight}, compression_type='{$Eencode}', bitrate={$Ebitrate}, fps={$Efps}, ptz_token='{$Eptz}', mrl='{$Emrl}', mrl_port='{$mrl_port}', picture='{$Epic}' ON DUPLICATE KEY UPDATE mrl='{$Emrl}', mrl_port='{$mrl_port}', picture='{$Epic}'"; + $QS = "INSERT INTO media_streams SET site_id={$SiteID}, source_id={$ECID}, source_type='D', valid=1, name='{$Ename}', token='{$Etoken}', img_width={$Ewidth}, img_height={$Eheight}, compression_type='{$Eencode}', bitrate={$Ebitrate}, fps={$Efps}, mrl='{$Emrl}', mrl_proto='{$mrl_proto}', mrl_port='{$mrl_port}', picture_proto='{$pic_proto}', picture_port='{$pic_port}', picture='{$Epic}' ON DUPLICATE KEY UPDATE source_type='D', valid=1, site_id={$SiteID}, mrl='{$Emrl}', mrl_proto='{$mrl_proto}', mrl_port='{$mrl_port}', picture_proto='{$pic_proto}', picture_port='{$pic_port}', picture='{$Epic}'"; $DATABASE->Query( $QS, false ); - + //$CSSS = $DATABASE->getLastInsertID(); }; - $QS = "UPDATE cameras SET access_login = '$EUser', access_pass = '$EPass' WHERE id = {$ECID}"; + $QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', ptz_token='{$Eptz}' WHERE id={$ECID}"; $DATABASE->Query( $QS, false ); } else { $Data['error'] = 'Provided Credentials are Wrong!'; @@ -90,7 +100,7 @@ exit(); }; }; - $QS = "SELECT * FROM camera_streams WHERE camera_id={$ECID}"; + $QS = "SELECT * FROM media_streams WHERE source_type='D' AND source_id={$ECID}"; $Result = $DATABASE->Query($QS,false); foreach( $Result as $CD ){ $cnode['id'] = $CD['id']; @@ -98,7 +108,6 @@ $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; $cnode['encode'] = $CD['compression_type']; $cnode['bitrate'] = $CD['bitrate']; - //$cnode['pic'] = $CD['picture']; $Data['nodes'][] = $cnode; }; $Data['success'] = true; diff --git a/lib/controller/listDiscoveredOnvifProfiles.php b/lib/controller/listDiscoveredOnvifProfiles.php index 564b1cb..c3f7db0 100644 --- a/lib/controller/listDiscoveredOnvifProfiles.php +++ b/lib/controller/listDiscoveredOnvifProfiles.php @@ -13,7 +13,6 @@ $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; $cnode['encode'] = $CD['compression_type']; $cnode['bitrate'] = $CD['bitrate']; - //$cnode['pic'] = $CD['picture']; $Data['nodes'][] = $cnode; }; }; diff --git a/lib/controller/props/0_node_prop.js b/lib/controller/props/0_node_prop.js index ec739bc..716448d 100644 --- a/lib/controller/props/0_node_prop.js +++ b/lib/controller/props/0_node_prop.js @@ -3,10 +3,10 @@ labelWidth: 75, // label settings here cascade unless overridden frame: false, bodyStyle:'padding:5px 5px 0', - width: 190, - defaults: { - width: 190 - }, + //width: 190, + //defaults: { + //width: 190 + //}, defaultType: 'textfield', items: [{ xtype: 'panel', @@ -18,7 +18,7 @@ collapsible: true, autoHeight: true, defaults: { - width: 168 + width: '100%' }, items :[ %%%INFO%%% ] },{ @@ -27,7 +27,7 @@ collapsible: true, autoHeight:true, defaults: { - width: 168 + width: '100%' }, items :[ %%%SOCKETS%%% ] },{ @@ -36,7 +36,7 @@ collapsible: true, autoHeight:true, defaults: { - width: 168 + width: '100%' }, items :[ %%%MODULES%%%,{ xtype: 'button', diff --git a/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js b/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js index b1da35b..c472bc8 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js @@ -475,3 +475,31 @@ function addIpCam(){ addDialog.show(); cameraListStore.load({params:{start:0, limit:50}}); }; +var addE2UDialog = null; +function addEthernet2Uart(){ + if( addE2UDialog == null ){ + addE2UDialog = new Ext.Window({ + modal: true, + title: 'Add Ethernet To Serial Adapter', + width: 800, + height: 600, + layout: 'fit', + closeAction: 'hide', + items:{ + html: '

koko

', + bbar: [{ + text: 'Cancel', + handler: function(){//discoverOnvifSources + addDialog.hide(); + } + },'->',{ + id: 'con_to_src', + text: 'Connect To Selected', + disabled: ( SelectedCam == 0 ), + handler: connectToSeleced + }] + } + }); + }; + addE2UDialog.show(); +}; diff --git a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js index dee6da3..ce06113 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js +++ b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js @@ -15,15 +15,13 @@ function loadDashBoard(){ }, success: function( response, opts ){ var data = Ext.decode(response.responseText); - var tPanel = Ext.getCmp('main_content'); - tPanel.remove(0); - tPanel.add( data ); + var tPanel = Ext.getCmp('main_portal'); + tPanel.removeAll(true); + for( i=0; i < data.length; i++) tPanel.add( data[i] ); tPanel.doLayout(); - var player = videojs('hls-example'); - player.play(); }, failure: function( response, opts ) { - var tPanel = Ext.getCmp('main_content'); + var tPanel = Ext.getCmp('main_portal'); tPanel.remove(0); tPanel.add( { html: 'Failed to load dashboard!' } ); tPanel.doLayout(); diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices_module.js b/lib/javascript/jsapi_dynamic/rgoose_devices_module.js index c9b9ed3..9693815 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices_module.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices_module.js @@ -33,4 +33,5 @@ var devicesStore = new Ext.data.JsonStore({ 'SID': '' } }) -}); \ No newline at end of file +}); + diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index 674c8f5..f902f26 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -2,123 +2,118 @@ Ext.onReady(function(){ var viewport = new Ext.Viewport({ - layout:'border', + id: 'main_viewport', + layout:'border', items: [{ - xtype: 'panel', - region: 'north', - baseCls: 'x-plain', - height: 50, - items:[{ - xtype: 'panel', - id:'top', - baseCls: 'x-plain', - html: '

R-Goose Security System

' - }] - },{ - xtype: 'panel', - id:'btns', + xtype: 'panel', + region: 'north', + baseCls: 'x-plain', + height: 50, + items:[{ + xtype: 'panel', + id:'top', + baseCls: 'x-plain', + html: '

 R-Goose Security System

' + }] + },{ + xtype: 'panel', + id:'btns', region:'west', - baseCls:'x-plain', + bsaseCls:'x-plain', + title: 'R-Goose System', + collapsible: true, split:true, width:150, minWidth: 100, maxWidth: 250, - layout:'fit', + layout:'accordion', margins: '5 0 5 5', - items: [{ - xtype: 'panel', - //baseCls: 'x-plain', - height: 400, - title: 'R-Goose System', - layout:'accordion', - defaults: { - // applied to each contained panel - bodyStyle: 'padding:5px' - }, - layoutConfig: { - // layout-specific configs go here - titleCollapse: false, - animate: true//, - //activeOnTop: true - }, - items: [{ - title: 'Dashboard', - layout: 'vbox', - height: 120, - pack: 'center', - align : 'strech', - items:[{ - xtype: 'button', - width: '100%', - id:'go_home', - text: 'Go Home', - handler: function( b, e ){ - loadDashBoard(); - } - },{ - xtype: 'button', - width: '100%', - id:'go_monitor', - text: 'Monitor Events', - handler: function( b, e ){ - loadTimeLine(); - } - },{ - xtype: 'button', - width: '100%', - id:'go_out', - text: 'Logout', - handler: function( b, e ){ - window.location = '/login.php?UID=1'; - } - }] - },{ - title: 'System Settings', - layout: 'vbox', - height: 120, - pack: 'center', - align : 'strech', - items:[{ - xtype: 'button', - width: '100%', - id:'sys_edit', - text: 'Edit Connections', - handler: function( b, e ){ - loadSystemEditor(); - } - },{ - xtype: 'button', - width: '100%', - id:'map_edit', - text: 'Edit Locations', - handler: function( b, e ){ - loadLocationEditor(); - } - },{ - xtype: 'button', - width: '100%', - id:'logout', - text: 'Logout', - handler: function( b, e ){ - window.location = '/login.php?UID=1'; - } - }] + cmargins:'5 5 5 5', + layoutConfig:{ + animate:true + }, + items: [{ + title: 'Dashboard', + layout: 'vbox', + height: 120, + pack: 'center', + align : 'strech', + items:[{ + xtype: 'button', + width: '100%', + id:'go_home', + text: 'Go Home', + handler: function( b, e ){ + loadDashBoard(); + } + },{ + xtype: 'button', + width: '100%', + id:'go_monitor', + text: 'Monitor Events', + handler: function( b, e ){ + loadTimeLine(); + } + },{ + xtype: 'button', + width: '100%', + id:'go_out', + text: 'Logout', + handler: function( b, e ){ + window.location = '/login.php?UID=1'; + } + }] + },{ + title: 'System Settings', + layout: 'vbox', + height: 120, + pack: 'center', + align : 'strech', + items:[{ + xtype: 'button', + width: '100%', + id:'sys_edit', + text: 'Edit Connections', + handler: function( b, e ){ + loadSystemEditor(); + } + },{ + xtype: 'button', + width: '100%', + id:'map_edit', + text: 'Edit Locations', + handler: function( b, e ){ + loadLocationEditor(); + } + },{ + xtype: 'button', + width: '100%', + id:'logout', + text: 'Logout', + handler: function( b, e ){ + window.location = '/login.php?UID=1'; + } + }] + },{ + title: 'Profile Settings', + html: '

Panel content!

' + }] },{ - title: 'Profile Settings', - html: '

Panel content!

' - }] - }] - },{ + xtype: 'panel', region:'center', margins: '5 5 5 0', - id: 'main_content', - layout: 'fit', + id: 'main_content', + title: 'System Dashboard', items:[{ - xtype: 'panel', - html: '

' - }] - }] + xtype: 'portal', + id: 'main_portal', + frame: false, + border: false, + items:{ + html: '

' + } + }] + }] }); - loadDashBoard(); }); \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js index ad0ff0d..b7e0084 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js @@ -416,127 +416,159 @@ function loadServerProperties( NodeID ){ }; function loadSystemEditor(){ - var tPanel = Ext.getCmp('main_content'); if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; - tPanel.remove(0); - tPanel.add({ - title: 'System Map', -// id: 'sys_map', - frame: false, - border: false, - //layout: 'column', // Specifies that the items will now be arranged in columns - layout:'hbox', - layoutConfig: { - align : 'stretch', - pack : 'start', - //padding:'5', + var tPanel = Ext.getCmp('main_portal'); + tPanel.removeAll( true ); + Ext.getCmp('main_content').setTitle( 'System Map' ); + tPanel.add({ + //title: 'System Map', + //id: 'main_content', + columnWidth: 0.83, + //xtype: 'panel', + //region:'center', + ////id: 'sys_map', + frame: false, + border: false, + ////layout: 'column', // Specifies that the items will now be arranged in columns + //layout: 'vbox', + /* + layoutConfig: { + align : 'stretch', + pack : 'start', + //padding:'5', //align:'middle' - }, + },*/ items: [{ - //columnWidth: 0.60, + xtype: 'panel', layout: 'fit', - //height: 700, - flex: 1, - border: true, - items:{ - id: 'sys_map' - } - },{ - title: 'Properties', - flex: 1, - width: 210, - layout: 'fit', - frame: true, - id: 'prop_content', -// border: true - items:{ - html: 'Select Item From Map' - } - }], - tbar: [{ - xtype: 'splitbutton', - text: 'Add Laser Sensor', - split: true, - enableToggle : undefined, - menu : { - items: [{ - text:'ALS', - icon: '/style/assets/!cid_ii_jvmzuzrq10.png', - handler: function(){ - createNode( 1 ); - } - },{ - text:'LFS', - handler: function(){ - createNode( 2 ); - } - },{ - text:'PLS-200', - handler: function(){ - createNode( 3 ); - } - },{ - text:'PLS-360', - handler: function(){ - createNode( 4 ); - } - },{ - text:'3DLIDAR', - handler: function(){ - createNode( 5 ); - } - }] - } - },{ - xtype: 'splitbutton', - text: 'Add Additional Equipment', - split: true, - enableToggle : true, - menu : { - items: [{ - text:'Static Analog Camera' - },{ - text:'PTZ Analog Camera' - },{ - text:'Static IP Camera', - handler: function(){ - SelectedCamPTZ = false; - addIpCam(); - } - },{ - text:'PTZ IP Camera', - handler: function(){ - SelectedCamPTZ = true; - addIpCam(); - } - },{ - text:'DVR/Video Server/Streamer', - handler: function(){ - addMediaServer(); - } - },{ - text:'Network Video Recorder' - },{ - text:'Ethernet to UART transeiver' - },{ - text:'DC to Ethernet (ADAM)' - }] - } - },{ - xtype: 'button', - id: 'connectstarterbutton', - text: 'Add Connection', - enableToggle : undefined, - handler: function(){ - Ext.getCmp('connectstarterbutton').toggle( true, true ); - startCreateConnection(1); - } - }] - }); + layoutConfig: { + align : 'stretch', + pack : 'start' + //padding:'5', + //align:'middle' + }, + height: 700, + flex: 1, + frame: false, + border: false, + items:{ + id: 'sys_map' + }, + tbar: [{ + xtype: 'splitbutton', + text: 'Add Laser Sensor', + split: true, + enableToggle : undefined, + menu : { + items: [{ + text:'ALS', + icon: '/style/assets/!cid_ii_jvmzuzrq10.png', + handler: function(){ + createNode( 1 ); + } + },{ + text:'LFS', + icon: '/style/assets/!cid_ii_jvmzuzpt0.png', + handler: function(){ + createNode( 2 ); + } + },{ + text:'PLS-200', + icon: '/style/assets/!cid_ii_jvmzuzql4.png', + handler: function(){ + createNode( 3 ); + } + },{ + text:'PLS-360', + icon: '/style/assets/!cid_ii_jvmzuzr87.png', + handler: function(){ + createNode( 4 ); + } + },{ + text:'3DLIDAR', + icon: '/style/assets/unnamed34.png', + handler: function(){ + createNode( 5 ); + } + }] + } + },{ + xtype: 'splitbutton', + text: 'Add Additional Equipment', + split: true, + enableToggle : true, + menu : { + items: [{ + text:'Static Analog Camera', + icon: '/style/assets/11_node.png' + },{ + text:'PTZ Analog Camera', + icon: '/style/assets/12_node.png' + },{ + text:'Static IP Camera', + icon: '/style/assets/11_node.png', + handler: function(){ + SelectedCamPTZ = false; + addIpCam(); + } + },{ + text:'PTZ IP Camera', + icon: '/style/assets/12_node.png', + handler: function(){ + SelectedCamPTZ = true; + addIpCam(); + } + },{ + text:'DVR/Video Server/Streamer', + icon: '/style/assets/videoServer.png', + handler: function(){ + addMediaServer(); + } + },{ + text:'Network Video Recorder', + icon: '/style/assets/15_node.png' + },{ + text:'Ethernet to UART transeiver', + icon: '/style/assets/eth2uart.png', + handler: function(){ + addEthernet2Uart(); + } + },{ + text:'DC to Ethernet (ADAM)', + icon: '/style/assets/adam-1.png', + }] + } + },{ + xtype: 'button', + id: 'connectstarterbutton', + text: 'Add Connection', + enableToggle : undefined, + handler: function(){ + Ext.getCmp('connectstarterbutton').toggle( true, true ); + startCreateConnection(1); + } + }] + }] + }); + tPanel.add({ + title: 'Properties', + xtype: 'panel', + flex: 1, + height: 700, + //width: 210, + columnWidth: 0.17, + layout: 'fit', + //frame: true, + id: 'prop_content', + // border: true + items:{ + html: 'Select Item From Map' + } + }); tPanel.doLayout(); Ext.Ajax.request({ url: '/lib/controller/getNetwork.php', diff --git a/lib/javascript/jsapi_static/rgoose_general.js b/lib/javascript/jsapi_static/rgoose_general.js index e814408..0ad283b 100644 --- a/lib/javascript/jsapi_static/rgoose_general.js +++ b/lib/javascript/jsapi_static/rgoose_general.js @@ -1,202 +1,261 @@ -var netwodkData = { - edges: null, - nodes: null -}; - -var selectedConnection = null; -var selectedNode = null; -var selected_A_socket = null; -var selected_B_socket = null; -var addConnectionDialog = null; -var networkObj = null; - -var ARGUS_SERVER = 0; -var ARGUS_ALS_SENSOR = 1; -var ARGUS_LFS_SENSOR = 2; -var ARGUS_PLS_200_SENSOR = 3; -var ARGUS_PLS_360_SENSOR = 4; -var ARGUS_3D_SENSOR = 5; -var ARGUS_NET_PLS_200 = 6; -var ARGUS_ANALOG_STATIC_CAMERA = 10; -var ARGUS_ANALOG_PTZ_CAMERA = 11; -var ARGUS_IP_STATIC_CAMERA = 12; -var ARGUS_IP_PTZ_CAMERA = 13; -var ARGUS_IP_UART_GATEWAY = 20; -var ARGUS_JAMER = 40; -var ARGUS_IP_VIDEO_SERVER = 50; -var ARGUS_DRONE_CONTROL = 60; -var ARGUS_UNKNOWN = 255; - -var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_SLAVE = 1; -var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_MASTER = 2; -var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_PTZ = 3; -var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_SERVER = 4; -var ARGUS_NODE_SOCK_TYPE_NETWORK_DEVICE = 5; -var ARGUS_NODE_SOCK_TYPE_NETWORK_SERVER = 6; -var ARGUS_NODE_SOCK_TYPE_NETWORK_SENDER = 7; -var ARGUS_NODE_SOCK_TYPE_NETWORK_VIDEO = 8; -var ARGUS_NODE_SOCK_TYPE_DC = 9; -var ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER = 10; -var ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER = 11; - -function sockTypeRenderer( r ){ - switch( r ){ - case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_SLAVE: return 'UART'; - case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_CTRL_MASTER: return 'UART'; - case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_PTZ: return 'UART'; - case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT_SERVER: return 'UART'; - case ARGUS_NODE_SOCK_TYPE_NETWORK_DEVICE: return 'NET'; - case ARGUS_NODE_SOCK_TYPE_NETWORK_SERVER: return 'NET'; - case ARGUS_NODE_SOCK_TYPE_NETWORK_SENDER: return 'NET'; - case ARGUS_NODE_SOCK_TYPE_NETWORK_VIDEO: return 'NET'; - case ARGUS_NODE_SOCK_TYPE_DC: return 'DC'; - case ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER: return 'A-Video'; - case ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER: return 'A-Audio'; - default: return 'Undefined'; - }; -}; - -var A_socketsListStore = new Ext.data.JsonStore({ - root: 'nodes', - totalProperty: 'totalCount', - idProperty: 'id', - remoteSort: true, - fields: [{ - name: 'id', - type: 'int' - },{ - name: 'name', - type: 'string' - },{ - name: 'mode', - type: 'int' - },{ - name: 'type', - type: 'int' - },{ - name: 'binded', - type: 'int' - }] -}); - -var A_socketSelModel = new Ext.grid.RowSelectionModel({ - singleSelect: true, - listeners: { - rowselect: function( sm, row, rec ) { - selected_A_socket = rec.data; - if( selected_B_socket != null ){ - if( selected_A_socket.type == selected_B_socket.type ){ - if( - ( selected_A_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || - ( selected_B_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || - ( selected_B_socket.mode != selected_A_socket.mode ) - ){ - Ext.getCmp('con_to_src').enable(); - }; - } else { - Ext.getCmp('con_to_src').disable(); - }; - }; - } - } -}); - -var B_socketsListStore = new Ext.data.JsonStore({ - root: 'nodes', - totalProperty: 'totalCount', - idProperty: 'id', - remoteSort: true, - fields: [{ - name: 'id', - type: 'int' - },{ - name: 'name', - type: 'string' - },{ - name: 'mode', - type: 'int' - },{ - name: 'type', - type: 'int' - },{ - name: 'binded', - type: 'int' - }] -}); - -var B_socketSelModel = new Ext.grid.RowSelectionModel({ - singleSelect: true, - listeners: { - rowselect: function( sm, row, rec ) { - selected_B_socket = rec.data; - if( selected_A_socket != null ){ - if( selected_A_socket.type == selected_B_socket.type ){ - if( - ( selected_A_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || - ( selected_B_socket.mode == ARGUS_NODE_SOCK_TYPE_NETWORK ) || - ( selected_B_socket.mode != selected_A_socket.mode ) - ){ - Ext.getCmp('con_to_src').enable(); - }; - } else { - Ext.getCmp('con_to_src').disable(); - }; - }; - } - } -}); - -var socketListColModel = new Ext.grid.ColumnModel({ - columns: [ - {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, - {header: "", width: 30, dataIndex: 'binded' }, - {header: "", width: 30, dataIndex: 'mode' }, - {header: "Type",width: 100, sortable: false, fixed: true, renderer: sockTypeRenderer, dataIndex: 'type' }, - {header: "Name",width: 150, dataIndex: 'name' } - ], - defaults: { - sortable: false, - menuDisabled: true - } -}); - - -var networkOpts = { - interaction:{ - hover: true - }, - manipulation: { - enabled: false, - addNode: function (data, callback) { - // filling in the popup DOM elements - //console.log('add', data); - }, - editNode: function (data, callback) { - // filling in the popup DOM elements - //console.log('edit', data); - }, - addEdge: function (data, callback) { - //console.log('add edge', data); - if (data.from == data.to) { - var r = confirm("Do you want to connect the node to itself?"); - if (r === true) { - createConnection( data.from, data.to ); - }; - } else { - createConnection( data.from, data.to ); - }; - networkObj.disableEditMode(); - } - } -}; - -function startCreateConnection(){ - if( networkObj!= null ){ - networkObj.addEdgeMode(); - }; -}; - -function loadLinkProperties( EdgeID, From, To ){ - alert( 'Edge: ' + EdgeID ); -}; - +var netwodkData = { + edges: null, + nodes: null +}; + +var selectedConnection = null; +var selectedNode = null; +var selected_A_socket = null; +var selected_B_socket = null; +var addConnectionDialog = null; +var networkObj = null; + +var ARGUS_SERVER = 0; +var ARGUS_ALS_SENSOR = 1; +var ARGUS_LFS_SENSOR = 2; +var ARGUS_PLS_200_SENSOR = 3; +var ARGUS_PLS_360_SENSOR = 4; +var ARGUS_3D_SENSOR = 5; +var ARGUS_NET_PLS_200 = 6; +var ARGUS_ANALOG_STATIC_CAMERA = 10; +var ARGUS_ANALOG_PTZ_CAMERA = 11; +var ARGUS_IP_STATIC_CAMERA = 12; +var ARGUS_IP_PTZ_CAMERA = 13; +var ARGUS_IP_UART_GATEWAY = 20; +var ARGUS_JAMER = 40; +var ARGUS_IP_VIDEO_SERVER = 50; +var ARGUS_DRONE_CONTROL = 60; +var ARGUS_UNKNOWN = 255; + +var ARGUS_NODE_SOCK_TYPE_SERIAL_PORT = 1; +var ARGUS_NODE_SOCK_TYPE_NET4 = 2; +var ARGUS_NODE_SOCK_TYPE_DC = 3; +var ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER = 4; +var ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER = 5; +var ARGUS_NODE_SOCK_TYPE_IPV = 6; +var ARGUS_NODE_SOCK_TYPE_DVR = 7; +var ARGUS_NODE_SOCK_TYPE_NET6 = 8; + +function sockTypeRenderer( r ){ + switch( r ){ + case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT: return 'UART'; + case ARGUS_NODE_SOCK_TYPE_NET4: return 'NET4'; + case ARGUS_NODE_SOCK_TYPE_NET6: return 'NET6'; + case ARGUS_NODE_SOCK_TYPE_DC: return 'DC'; + case ARGUS_NODE_SOCK_TYPE_ANALOG_VIDEO_GRABBER: return 'A-V'; + case ARGUS_NODE_SOCK_TYPE_ANALOG_AUDIO_GRABBER: return 'A-A'; + case ARGUS_NODE_SOCK_TYPE_IPV: return 'IPV'; + case ARGUS_NODE_SOCK_TYPE_DVR: return 'DVR'; + default: return 'TBD'; + }; +}; + +function sockModeRenderer( r ){ + switch( r ){ + case 1: return 'IN'; + case 2: return 'OUT'; + case 3: return 'IN/OUT'; + default: return 'TBD'; + }; +}; + +var A_socketsListStore = new Ext.data.JsonStore({ + root: 'nodes', + totalProperty: 'totalCount', + idProperty: 'id', + remoteSort: true, + fields: [{ + name: 'id', + type: 'int' + },{ + name: 'name', + type: 'string' + },{ + name: 'mode', + type: 'int' + },{ + name: 'type', + type: 'int' + },{ + name: 'binded', + type: 'int' + }] +}); + +var A_socketSelModel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function( sm, row, rec ) { + selected_A_socket = rec.data; + if( selected_B_socket != null ){ + switch( selected_A_socket.type ){ + case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){ + if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) { + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_NET4:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_IPV:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_DVR:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + default: Ext.getCmp('con_to_src').disable(); + }; + }; + } + } +}); + +var B_socketsListStore = new Ext.data.JsonStore({ + root: 'nodes', + totalProperty: 'totalCount', + idProperty: 'id', + remoteSort: true, + fields: [{ + name: 'id', + type: 'int' + },{ + name: 'name', + type: 'string' + },{ + name: 'mode', + type: 'int' + },{ + name: 'type', + type: 'int' + },{ + name: 'binded', + type: 'int' + }] +}); + +var B_socketSelModel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function( sm, row, rec ) { + selected_B_socket = rec.data; + if( selected_A_socket != null ){ + switch( selected_A_socket.type ){ + case ARGUS_NODE_SOCK_TYPE_SERIAL_PORT:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_SERIAL_PORT ){ + if( ( selected_A_socket.mode == 1 && selected_B_socket.mode == 2 ) || ( selected_A_socket.mode == 3 || selected_B_socket.mode == 3 ) || ( selected_A_socket.mode == 2 && selected_B_socket.mode == 1 )) { + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_NET4:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_NET4 ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_IPV:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_DVR ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + case ARGUS_NODE_SOCK_TYPE_DVR:{ + if( selected_B_socket.type == ARGUS_NODE_SOCK_TYPE_IPV ){ + Ext.getCmp('con_to_src').enable(); + } else { + Ext.getCmp('con_to_src').disable(); + }; + break; + }; + default: Ext.getCmp('con_to_src').disable(); + }; + }; + } + } +}); + +var socketListColModel = new Ext.grid.ColumnModel({ + columns: [ + {header: "id", width: 30, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "", width: 30, dataIndex: 'binded' }, + {header: "", width: 70, renderer: sockModeRenderer, dataIndex: 'mode' }, + {header: "Type",width: 50, sortable: false, fixed: true, renderer: sockTypeRenderer, dataIndex: 'type' }, + {header: "Name",width: 185, dataIndex: 'name' } + ], + defaults: { + sortable: false, + menuDisabled: true + } +}); + + +var networkOpts = { + interaction:{ + hover: true + }, + manipulation: { + enabled: false, + addNode: function (data, callback) { + // filling in the popup DOM elements + //console.log('add', data); + }, + editNode: function (data, callback) { + // filling in the popup DOM elements + //console.log('edit', data); + }, + addEdge: function (data, callback) { + //console.log('add edge', data); + if (data.from == data.to) { + var r = confirm("Do you want to connect the node to itself?"); + if (r === true) { + createConnection( data.from, data.to ); + }; + } else { + createConnection( data.from, data.to ); + }; + networkObj.disableEditMode(); + } + } +}; + +function startCreateConnection(){ + if( networkObj!= null ){ + networkObj.addEdgeMode(); + }; +}; + +function loadLinkProperties( EdgeID, From, To ){ + alert( 'Edge: ' + EdgeID ); +}; + diff --git a/lib/php/ui/UI_functions.php b/lib/php/ui/UI_functions.php index ca58c50..ee1d503 100644 --- a/lib/php/ui/UI_functions.php +++ b/lib/php/ui/UI_functions.php @@ -117,12 +117,17 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ - - - + + + + + + + + diff --git a/lib/php/video/zlMediaServerController.php b/lib/php/video/zlMediaServerController.php index db0236b..5bcf4b3 100644 --- a/lib/php/video/zlMediaServerController.php +++ b/lib/php/video/zlMediaServerController.php @@ -1,114 +1,114 @@ -_secret = $Secret; - $this->_addressREST = '127.0.0.1'; - $this->_accessURL[] = "/index/api/addFFmpegSource"; - $this->_accessURL[] = "/index/api/addStreamProxy"; - $this->_accessURL[] = "/index/api/close_stream"; - $this->_accessURL[] = "/index/api/delFFmepgSource"; - $this->_accessURL[] = "/index/api/delStreamProxy"; - $this->_accessURL[] = "/index/api/getAllSession"; - $this->_accessURL[] = "/index/api/getApiList"; - $this->_accessURL[] = "/index/api/getMediaList"; - $this->_accessURL[] = "/index/api/getServerConfig"; - $this->_accessURL[] = "/index/api/getThreadsLoad"; - $this->_accessURL[] = "/index/api/getWorkThreadsLoad"; - $this->_accessURL[] = "/index/api/kick_session"; - $this->_accessURL[] = "/index/api/restartServer"; - $this->_accessURL[] = "/index/api/setServerConfig"; - } - function __destruct(){ - } - public function setAccessPointREST( $address ){ - $this->_addressREST = $address; - } - private function composeURL( $idx ){ - return "http://" . $this->_addressREST . ':' . $this->_addressPort . $this->_accessURL[$idx] . '?secret=' . $this->_secret; - } - public function getServerConfig(){ - $pack['secret'] = $this->_secret; - $ch = curl_init(); - curl_setopt( $ch, CURLOPT_URL, $this->composeURL( GET_SERVER_CONFIG_IDX ) ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_POST, 1); - curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); - $output = curl_exec( $ch ); - curl_close( $ch ); - $AN = json_decode( $output ); - echo "Returned Transfer: " . $output ."\n\n"; - } - public function addStreamProxy( $src, $appname, $rtsp_ena = 0, $rtmp_ena = 0, $hls_ena = 1, $recode_ena = 0, $rtp_type = FETCH_STREAM_TCP, $vhost=ZL_DEFAULT_VHOST ){ - $pack['secret'] = $this->_secret; - $Params = '&vhost=' . urlencode( $vhost ) . '&app=' . urlencode( $appname ) . '&stream=0&url=' . $src . '&enable_rtsp=' . $rtsp_ena . '&enable_rtmp=' . $rtmp_ena . '&enable_hls=' . $hls_ena . '&enable_mp4=' . $recode_ena . '&rtp_type=' . $rtp_type; - $ch = curl_init(); - curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_POST, 1); - curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); - $output = curl_exec( $ch ); - curl_close( $ch ); - $AN = json_decode( $output ); - print_r( $AN ); - if( $AN->code == 0 ) { - return $AN->data->key; - }; - return ''; - } - public function delStreamProxy( $key ){ - $pack['secret'] = $this->_secret; - $Params = '&key=' . urlencode( $key ); - $ch = curl_init(); - curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_POST, 1); - curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); - $output = curl_exec( $ch ); - curl_close( $ch ); - $AN = json_decode( $output ); - if( $AN['code'] == 0 ){ - return $AN['data']['flag']; - }; - return false; - } - public function listMedia(){ - $pack['secret'] = $this->_secret; - $ch = curl_init(); - curl_setopt( $ch, CURLOPT_URL, $this->composeURL( LIST_MEDIA_IDX ) ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_POST, 1); - curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); - $output = curl_exec( $ch ); - curl_close( $ch ); - echo "Returned Transfer: " . $output ."\n\n"; - } -} +_secret = $Secret; + $this->_addressREST = '127.0.0.1'; + $this->_accessURL[] = "/index/api/addFFmpegSource"; + $this->_accessURL[] = "/index/api/addStreamProxy"; + $this->_accessURL[] = "/index/api/close_stream"; + $this->_accessURL[] = "/index/api/delFFmepgSource"; + $this->_accessURL[] = "/index/api/delStreamProxy"; + $this->_accessURL[] = "/index/api/getAllSession"; + $this->_accessURL[] = "/index/api/getApiList"; + $this->_accessURL[] = "/index/api/getMediaList"; + $this->_accessURL[] = "/index/api/getServerConfig"; + $this->_accessURL[] = "/index/api/getThreadsLoad"; + $this->_accessURL[] = "/index/api/getWorkThreadsLoad"; + $this->_accessURL[] = "/index/api/kick_session"; + $this->_accessURL[] = "/index/api/restartServer"; + $this->_accessURL[] = "/index/api/setServerConfig"; + } + function __destruct(){ + } + public function setAccessPointREST( $address ){ + $this->_addressREST = $address; + } + private function composeURL( $idx ){ + return "http://" . $this->_addressREST . ':' . $this->_addressPort . $this->_accessURL[$idx] . '?secret=' . $this->_secret; + } + public function getServerConfig(){ + $pack['secret'] = $this->_secret; + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_URL, $this->composeURL( GET_SERVER_CONFIG_IDX ) ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); + $output = curl_exec( $ch ); + curl_close( $ch ); + $AN = json_decode( $output ); + echo "Returned Transfer: " . $output ."\n\n"; + } + public function addStreamProxy( $src, $appname, $rtsp_ena = 0, $rtmp_ena = 0, $hls_ena = 1, $recode_ena = 0, $rtp_type = FETCH_STREAM_TCP, $vhost=ZL_DEFAULT_VHOST ){ + $pack['secret'] = $this->_secret; + $Params = '&vhost=' . urlencode( $vhost ) . '&app=' . urlencode( $appname ) . '&stream=0&url=' . $src . '&enable_rtsp=' . $rtsp_ena . '&enable_rtmp=' . $rtmp_ena . '&enable_hls=' . $hls_ena . '&enable_mp4=' . $recode_ena . '&rtp_type=' . $rtp_type; + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); + $output = curl_exec( $ch ); + curl_close( $ch ); + $AN = json_decode( $output ); + print_r( $AN ); + if( $AN->code == 0 ) { + return $AN->data->key; + }; + return ''; + } + public function delStreamProxy( $key ){ + $pack['secret'] = $this->_secret; + $Params = '&key=' . urlencode( $key ); + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_URL, $this->composeURL( ADD_STREAM_PROXY_IDX ) . $Params ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); + $output = curl_exec( $ch ); + curl_close( $ch ); + $AN = json_decode( $output ); + if( $AN['code'] == 0 ){ + return $AN['data']['flag']; + }; + return false; + } + public function listMedia(){ + $pack['secret'] = $this->_secret; + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_URL, $this->composeURL( LIST_MEDIA_IDX ) ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $pack ) ); + $output = curl_exec( $ch ); + curl_close( $ch ); + echo "Returned Transfer: " . $output ."\n\n"; + } +} ?> \ No newline at end of file diff --git a/style/assets/7_node.png b/style/assets/7_node.png new file mode 100644 index 0000000..af217b8 Binary files /dev/null and b/style/assets/7_node.png differ diff --git a/style/assets/Untitleccd-1.png b/style/assets/Untitleccd-1.png new file mode 100644 index 0000000..a91b8ac Binary files /dev/null and b/style/assets/Untitleccd-1.png differ diff --git a/style/assets/Untitled-8891.png b/style/assets/Untitled-8891.png new file mode 100644 index 0000000..9bc015d Binary files /dev/null and b/style/assets/Untitled-8891.png differ diff --git a/style/assets/adam-1.png b/style/assets/adam-1.png new file mode 100644 index 0000000..8e4b4da Binary files /dev/null and b/style/assets/adam-1.png differ diff --git a/style/assets/adam-1b.png b/style/assets/adam-1b.png new file mode 100644 index 0000000..a91b8ac Binary files /dev/null and b/style/assets/adam-1b.png differ diff --git a/style/assets/chch-1.png b/style/assets/chch-1.png new file mode 100644 index 0000000..dc5d2d6 Binary files /dev/null and b/style/assets/chch-1.png differ diff --git a/style/assets/eth2uart.png b/style/assets/eth2uart.png new file mode 100644 index 0000000..71882f1 Binary files /dev/null and b/style/assets/eth2uart.png differ diff --git a/style/assets/zz-3.png b/style/assets/zz-3.png new file mode 100644 index 0000000..ada9c89 Binary files /dev/null and b/style/assets/zz-3.png differ