add Type to Storage
This commit is contained in:
parent
a1b13a2555
commit
8abb8a9259
|
@ -593,6 +593,7 @@ CREATE TABLE `Storage` (
|
|||
`Id` smallint(5) unsigned NOT NULL auto_increment,
|
||||
`Path` varchar(64) NOT NULL default '',
|
||||
`Name` varchar(64) NOT NULL default '',
|
||||
`Type` enum('local','s3fs') NOT NULL default 'local',
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class Event {
|
|||
if ( $new ) {
|
||||
$this->{'Storage'} = $new;
|
||||
}
|
||||
if ( ! ( array_key_exists( 'Storage', $this ) or $this->{'Storage'} ) ) {
|
||||
if ( ! ( array_key_exists( 'Storage', $this ) and $this->{'Storage'} ) ) {
|
||||
$this->{'Storage'} = new Storage( isset($this->{'StorageId'}) ? $this->{'StorageId'} : NULL );
|
||||
}
|
||||
return $this->{'Storage'};
|
||||
|
|
|
@ -181,5 +181,33 @@ public $defaults = array(
|
|||
return $groupSql;
|
||||
} # end public static function get_group_sql( $group_id )
|
||||
|
||||
public static function get_monitors_dropdown( $options = null ) {
|
||||
$monitor_id = 0;
|
||||
if ( isset( $_REQUEST['monitor_id'] ) ) {
|
||||
$monitor_id = $_REQUEST['monitor_id'];
|
||||
} else if ( isset($_COOKIE['zmMonitorId']) ) {
|
||||
$monitor_id = $_COOKIE['zmMonitorId'];
|
||||
}
|
||||
$sql = 'SELECT * FROM Monitors';
|
||||
if ( $options ) {
|
||||
$sql .= ' WHERE '. implode(' AND ', array(
|
||||
( isset($options['groupSql']) ? $options['groupSql']:'')
|
||||
) ).' ORDER BY Sequence ASC';
|
||||
}
|
||||
$monitors_dropdown = array(''=>'All');
|
||||
|
||||
foreach ( dbFetchAll( $sql ) as $monitor ) {
|
||||
if ( !visibleMonitor( $monitor['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitor['Id']] = $monitor['Name'];
|
||||
}
|
||||
|
||||
echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') );
|
||||
return $monitor_id;
|
||||
}
|
||||
|
||||
} # end class Group
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -29,6 +29,7 @@ class Storage {
|
|||
} else {
|
||||
$this->{'Name'} = '';
|
||||
$this->{'Path'} = '';
|
||||
$this->{'Type'} = 'local';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ class Storage {
|
|||
# This isn't a function like this in php, so we have to add up the space used in each event.
|
||||
if ( ! array_key_exists( 'disk_used_space', $this ) ) {
|
||||
$used = 0;
|
||||
if ( $this->{'type'} == 's3' ) {
|
||||
if ( $this->{'Type'} == 's3fs' ) {
|
||||
foreach ( Event::find_all( array( 'StorageId'=>$this->Id() ) ) as $Event ) {
|
||||
$Event->Storage( $this ); // Prevent further db hit
|
||||
$used += $Event->DiskSpace();
|
||||
|
|
|
@ -672,7 +672,7 @@ switch ( $tab ) {
|
|||
case 'general' :
|
||||
{
|
||||
?>
|
||||
<tr><td><?php echo translate('Name') ?></td><td><input type="text" name="newMonitor[Name]" value="<?php echo validHtmlStr($monitor->Name()) ?>" size="16"/></td></tr>
|
||||
<tr class="Name"><td><?php echo translate('Name') ?></td><td><input type="text" name="newMonitor[Name]" value="<?php echo validHtmlStr($monitor->Name()) ?>" /></td></tr>
|
||||
<tr><td><?php echo translate('Server') ?></td><td>
|
||||
<?php
|
||||
$servers = array(''=>'None');
|
||||
|
|
|
@ -114,7 +114,7 @@ if ( ! empty( $user['MonitorIds'] ) ) {
|
|||
$frameSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')';
|
||||
}
|
||||
if ( $monitor_id ) {
|
||||
$monitorsSql .= ' AND Id='.$monitor_id;
|
||||
$monitorsSql .= ' AND Id='.$monitor_id;
|
||||
$eventsSql .= ' AND M.Id='.$monitor_id;
|
||||
$frameSql .= ' AND E.MonitorId='.$monitor_id;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
|
|||
<?php echo $group_dropdowns; ?>
|
||||
</span>
|
||||
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
|
||||
<?php echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') ); ?>
|
||||
<?php Group::get_monitors_dropdown( array( 'groupSql'=>$groupSql) ); ?>
|
||||
</span>
|
||||
<div id="DateTimeDiv">
|
||||
<input type="datetime-local" name="minTime" id="minTime" value="<?php echo preg_replace('/ /', 'T', $minTime ) ?>" onchange="changeDateTime(this);"> to
|
||||
|
|
Loading…
Reference in New Issue