fix missing bits. Implement UrlToIndex in Monitor and fix use of Url(). Implement PathToApi as well
This commit is contained in:
parent
1e915e9567
commit
1c17f334d3
|
@ -561,6 +561,7 @@ CREATE TABLE `Servers` (
|
|||
`Port` INTEGER UNSIGNED,
|
||||
`PathToIndex` TEXT,
|
||||
`PathToZMS` TEXT,
|
||||
`PathToApi` TEXT,
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`State_Id` int(10) unsigned,
|
||||
`Status` enum('Unknown','NotRunning','Running') NOT NULL default 'Unknown',
|
||||
|
|
|
@ -329,6 +329,22 @@ SET @s = (SELECT IF(
|
|||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add PathToApi column to Storage
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE()
|
||||
AND table_name = 'Servers'
|
||||
AND column_name = 'PathToApi'
|
||||
) > 0,
|
||||
"SELECT 'Column PathToApi already exists in Servers'",
|
||||
"ALTER TABLE Servers ADD `PathToApi` TEXT AFTER `PathToZMS`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add Port column to Storage
|
||||
--
|
||||
|
|
|
@ -221,11 +221,11 @@ class Event {
|
|||
null);
|
||||
|
||||
if ( $this->{'DefaultVideo'} and $args['mode'] != 'jpeg' ) {
|
||||
$streamSrc .= ( ZM_BASE_PATH != '/' ? ZM_BASE_PATH : '' ).'/index.php';
|
||||
$streamSrc .= $Server->PathToIndex();
|
||||
$args['eid'] = $this->{'Id'};
|
||||
$args['view'] = 'view_video';
|
||||
} else {
|
||||
$streamSrc .= ZM_PATH_ZMS;
|
||||
$streamSrc .= $Server->PathToZMS();
|
||||
|
||||
$args['source'] = 'event';
|
||||
$args['event'] = $this->{'Id'};
|
||||
|
@ -340,12 +340,11 @@ class Event {
|
|||
} else {
|
||||
$Server = new Server();
|
||||
}
|
||||
$streamSrc .= $Server->Url(
|
||||
$streamSrc .= $Server->UrlToIndex(
|
||||
ZM_MIN_STREAMING_PORT ?
|
||||
ZM_MIN_STREAMING_PORT+$this->{'MonitorId'} :
|
||||
null);
|
||||
|
||||
$streamSrc .= ( ZM_BASE_PATH != '/' ? ZM_BASE_PATH : '' ).'/index.php';
|
||||
$args['eid'] = $this->{'Id'};
|
||||
$args['fid'] = 'snapshot';
|
||||
$args['view'] = 'image';
|
||||
|
@ -573,7 +572,7 @@ class Event {
|
|||
$Server = $Storage->ServerId() ? $Storage->Server() : $this->Monitor()->Server();
|
||||
if ( $Server->Id() != ZM_SERVER_ID ) {
|
||||
|
||||
$url = $Server->Url() . '/zm/api/events/'.$this->{'Id'}.'.json';
|
||||
$url = $Server->UrlToApi() . '/events/'.$this->{'Id'}.'.json';
|
||||
if ( ZM_OPT_USE_AUTH ) {
|
||||
if ( ZM_AUTH_RELAY == 'hashed' ) {
|
||||
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||
|
@ -617,7 +616,7 @@ class Event {
|
|||
$Server = $Storage->ServerId() ? $Storage->Server() : $this->Monitor()->Server();
|
||||
if ( $Server->Id() != ZM_SERVER_ID ) {
|
||||
|
||||
$url = $Server->Url() . '/zm/api/events/'.$this->{'Id'}.'.json';
|
||||
$url = $Server->UrlToApi() . '/events/'.$this->{'Id'}.'.json';
|
||||
if ( ZM_OPT_USE_AUTH ) {
|
||||
if ( ZM_AUTH_RELAY == 'hashed' ) {
|
||||
$url .= '?auth='.generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||
|
|
|
@ -282,13 +282,11 @@ private $control_fields = array(
|
|||
|
||||
public function getStreamSrc($args, $querySep='&') {
|
||||
|
||||
$streamSrc = $this->Server()->Url(
|
||||
$streamSrc = $this->Server()->UrlToZMS(
|
||||
ZM_MIN_STREAMING_PORT ?
|
||||
ZM_MIN_STREAMING_PORT+$this->{'Id'} :
|
||||
null);
|
||||
|
||||
$streamSrc .= ZM_PATH_ZMS;
|
||||
|
||||
$args['monitor'] = $this->{'Id'};
|
||||
|
||||
if ( ZM_OPT_USE_AUTH ) {
|
||||
|
@ -620,8 +618,8 @@ private $control_fields = array(
|
|||
return $source;
|
||||
} // end function Source
|
||||
|
||||
public function Url() {
|
||||
return $this->Server()->Url( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : null );
|
||||
public function UrlToIndex() {
|
||||
return $this->Server()->UrlToIndex(ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : null);
|
||||
}
|
||||
|
||||
} // end class Monitor
|
||||
|
|
|
@ -10,7 +10,9 @@ class Server {
|
|||
'Protocol' => '',
|
||||
'Hostname' => '',
|
||||
'Port' => null,
|
||||
'PathPrefix' => '/zm',
|
||||
'PathToIndex' => '/zm',
|
||||
'PathToZMS' => ZM_PATH_ZMS,
|
||||
'PathToApi' => '/zm/api',
|
||||
'zmaudit' => 1,
|
||||
'zmstats' => 1,
|
||||
'zmtrigger' => 0,
|
||||
|
@ -81,6 +83,7 @@ class Server {
|
|||
return ZM_PATH_ZMS;
|
||||
}
|
||||
}
|
||||
|
||||
public function UrlToZMS( ) {
|
||||
return $this->Url().$this->PathToZMS();
|
||||
}
|
||||
|
@ -113,6 +116,18 @@ class Server {
|
|||
public function UrlToIndex( ) {
|
||||
return $this->Url().$this->PathToIndex();
|
||||
}
|
||||
public function UrlToApi( ) {
|
||||
return $this->Url().$this->PathToApi();
|
||||
}
|
||||
public function PathToApi( $new = null ) {
|
||||
if ( $new != null )
|
||||
$this->{'PathToApi'} = $new;
|
||||
|
||||
if ( isset($this->{'PathToApi'}) and $this->{'PathToApi'} ) {
|
||||
return $this->{'PathToApi'};
|
||||
}
|
||||
return '/zm/api';
|
||||
}
|
||||
|
||||
public function __call($fn, array $args){
|
||||
if ( count($args) ) {
|
||||
|
|
|
@ -586,6 +586,7 @@ $SLANG = array(
|
|||
'PasswordsDifferent' => 'The new and confirm passwords are different',
|
||||
'PathToIndex' => 'Path To Index',
|
||||
'PathToZMS' => 'Path To ZMS',
|
||||
'PathToApi' => 'Path To Api',
|
||||
'Paths' => 'Paths',
|
||||
'Pause' => 'Pause',
|
||||
'PhoneBW' => 'Phone B/W',
|
||||
|
|
|
@ -211,6 +211,7 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
|
|||
<th class="colUrl"><?php echo translate('Url') ?></th>
|
||||
<th class="colPathToIndex"><?php echo translate('PathToIndex') ?></th>
|
||||
<th class="colPathToZMS"><?php echo translate('PathToZMS') ?></th>
|
||||
<th class="colPathToApi"><?php echo translate('PathToApi') ?></th>
|
||||
<th class="colStatus"><?php echo translate('Status') ?></th>
|
||||
<th class="colMonitorCount"><?php echo translate('Monitors') ?></th>
|
||||
<th class="colCpuLoad"><?php echo translate('CpuLoad') ?></th>
|
||||
|
@ -232,6 +233,7 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
|
|||
<td class="colUrl"><?php echo makePopupLink('?view=server&id='.$Server->Id(), 'zmServer', 'server', validHtmlStr($Server->Url()), $canEdit) ?></td>
|
||||
<td class="colPathToIndex"><?php echo makePopupLink('?view=server&id='.$Server->Id(), 'zmServer', 'server', validHtmlStr($Server->PathToIndex()), $canEdit) ?></td>
|
||||
<td class="colPathToZMS"><?php echo makePopupLink('?view=server&id='.$Server->Id(), 'zmServer', 'server', validHtmlStr($Server->PathToZMS()), $canEdit) ?></td>
|
||||
<td class="colPathToApi"><?php echo makePopupLink('?view=server&id='.$Server->Id(), 'zmServer', 'server', validHtmlStr($Server->PathToApi()), $canEdit) ?></td>
|
||||
<td class="colStatus <?php if ( $Server->Status() == 'NotRunning' ) { echo 'danger'; } ?>">
|
||||
<?php echo makePopupLink('?view=server&id='.$Server->Id(), 'zmServer', 'server', validHtmlStr($Server->Status()), $canEdit) ?></td>
|
||||
<td class="colMonitorCount">
|
||||
|
|
|
@ -69,6 +69,10 @@ xhtmlHeaders(__FILE__, translate('Server').' - '.$Server->Name());
|
|||
<th scope="row"><?php echo translate('PathToZMS') ?></th>
|
||||
<td><input type="text" name="newServer[PathToZMS]" value="<?php echo $Server->PathToZMS() ?>"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo translate('PathToApi') ?></th>
|
||||
<td><input type="text" name="newServer[PathToApi]" value="<?php echo $Server->PathToApi() ?>"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo translate('RunStats') ?></th>
|
||||
<td>
|
||||
|
|
Loading…
Reference in New Issue