Bug 108 - Added max bandwidth setting to users.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1537 e3e1d417-86f3-4887-817a-d78f3d33393f
pull/27/merge
stan 2005-10-20 17:02:45 +00:00
parent 79bfb8fa9f
commit b290319df4
9 changed files with 44 additions and 5 deletions

View File

@ -11,6 +11,7 @@ alter table Monitors add column DefaultScale smallint unsigned after ReturnDelay
alter table Monitors modify column Type enum('Local','Remote','File') NOT NULL default 'Local';
alter table Events add column Height smallint(5) unsigned not null default '0' after EndTime;
alter table Events add column Width smallint(5) unsigned not null default '0' after EndTime;
alter table Users add column MaxBandwidth varchar(16) not null default '' after System;
--
-- These are optional, but we might as well do it now
--

View File

@ -1254,6 +1254,7 @@ if ( isset($action) )
if ( $new_control != $row['Control'] ) $changes[] = "Control = '$new_control'";
if ( $new_monitors != $row['Monitors'] ) $changes[] = "Monitors = '$new_monitors'";
if ( $new_system != $row['System'] ) $changes[] = "System = '$new_system'";
if ( $new_max_bandwidth != $row['MaxBandwidth'] ) $changes[] = "MaxBandwidth = '$new_max_bandwidth'";
if ( $new_monitor_ids != $row['MonitorIds'] ) $changes[] = "MonitorIds = '$new_monitor_ids'";
if ( count( $changes ) )

View File

@ -188,7 +188,7 @@ $jws = array(
'state' => array( 'w'=>300, 'h'=>120 ),
'stats' => array( 'w'=>680, 'h'=>200 ),
'timeline' => array( 'w'=>760, 'h'=>500 ),
'user' => array( 'w'=>280, 'h'=>340 ),
'user' => array( 'w'=>280, 'h'=>372 ),
'version' => array( 'w'=>320, 'h'=>140 ),
'video' => array( 'w'=>100, 'h'=>80 ),
'watch' => array( 'w'=>96, 'h'=>384 ),

View File

@ -102,6 +102,22 @@ if ( !isset($user) )
}
}
}
else
{
// Bandwidth Limiter
if ( !empty($user['MaxBandwidth']) )
{
if ( $user['MaxBandwidth'] == "low" )
{
$bandwidth = "low";
}
elseif ( $user['MaxBandwidth'] == "medium" && $bandwidth = "high" )
{
$bandwidth = "medium";
}
}
}
if ( !isset($view) )
{
$view = "console";

View File

@ -20,6 +20,19 @@
$new_bandwidth = $bandwidth;
if ( $user && !empty($user['MaxBandwidth']) )
{
if ( $user['MaxBandwidth'] == "low" )
{
unset( $bw_array['high'] );
unset( $bw_array['medium'] );
}
elseif ( $user['MaxBandwidth'] == "medium" )
{
unset( $bw_array['high'] );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

View File

@ -235,7 +235,7 @@ else
<?php
}
?>
&nbsp;<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=bandwidth', 'zmBandwidth', <?= $jws['bandwidth']['w'] ?>, <?= $jws['bandwidth']['h'] ?>);"><?= strtolower( $bw_array[$bandwidth] ) ?></a> <?= strtolower( $zmSlangBandwidth ) ?></td>
&nbsp;<?= makeLink( "javascript: newWindow( '$PHP_SELF?view=bandwidth', 'zmBandwidth', ".$jws['bandwidth']['w'].", ".$jws['bandwidth']['h']." );", strtolower( $bw_array[$bandwidth] ), ($user && $user['MaxBandwidth'] != 'low' ) ) ?> <?= strtolower( $zmSlangBandwidth ) ?></td>
<td class="smallhead" align="right"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="smallhead" align="left">
<?php
if ( canView( 'Stream' ) && $cycle_count > 1 )

View File

@ -144,7 +144,7 @@ foreach ( $tabs as $name=>$value )
else
{
?>
<td width="10" class="passivetab"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&tab=<?= $name ?>"?><?= $value ?></a></td>
<td width="10" class="passivetab"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&tab=<?= $name ?>"><?= $value ?></a></td>
<?php
}
}
@ -171,6 +171,7 @@ if ( $tab == "users" )
<td align="left" class="smallhead"><?= $zmSlangControl ?></td>
<td align="left" class="smallhead"><?= $zmSlangMonitors ?></td>
<td align="left" class="smallhead"><?= $zmSlangSystem ?></td>
<td align="left" class="smallhead"><?= $zmSlangBandwidth ?></td>
<td align="left" class="smallhead"><?= $zmSlangMonitor ?></td>
<td align="left" class="smallhead"><?= $zmSlangMark ?></td>
</tr>
@ -191,14 +192,15 @@ if ( $tab == "users" )
<td align="left" class="ruled"><?= $row['Control'] ?></td>
<td align="left" class="ruled"><?= $row['Monitors'] ?></td>
<td align="left" class="ruled"><?= $row['System'] ?></td>
<td align="left" class="ruled"><?= $row['MaxBandwidth']?$bw_array[$row['MaxBandwidth']]:'&nbsp;' ?></td>
<td align="left" class="ruled"><?= $row['MonitorIds']?$row['MonitorIds']:"&nbsp;" ?></td>
<td align="center" class="ruled"><input type="checkbox" name="mark_uids[]" value="<?= $row['Id'] ?>" onClick="configureButton( document.user_form, 'mark_uids' );"<?php if ( !canEdit( 'System' ) ) { ?> disabled<?php } ?>></td>
</tr>
<?php
}
?>
<tr><td colspan="10" class="ruled">&nbsp;</td></tr>
<tr><td colspan="10" align="right"><input type="button" value="<?= $zmSlangAddNewUser ?>" class="form" onClick="javascript: newWindow( '<?= $PHP_SELF ?>?view=user&uid=-1', 'zmUser', <?= $jws['user']['w'] ?>, <?= $jws['user']['h'] ?> );"<?php if ( !canEdit( 'System' ) ) { ?> disabled<?php } ?>>&nbsp;<input type="submit" name="delete_btn" value="<?= $zmSlangDelete ?>" class="form" disabled>&nbsp;<input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow();"></td></tr>
<tr><td colspan="12" class="ruled">&nbsp;</td></tr>
<tr><td colspan="12" align="right"><input type="button" value="<?= $zmSlangAddNewUser ?>" class="form" onClick="javascript: newWindow( '<?= $PHP_SELF ?>?view=user&uid=-1', 'zmUser', <?= $jws['user']['w'] ?>, <?= $jws['user']['h'] ?> );"<?php if ( !canEdit( 'System' ) ) { ?> disabled<?php } ?>>&nbsp;<input type="submit" name="delete_btn" value="<?= $zmSlangDelete ?>" class="form" disabled>&nbsp;<input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow();"></td></tr>
</form>
<?php
}

View File

@ -119,6 +119,11 @@ $nve = array( 'None'=>$zmSlangNone, 'View'=>$zmSlangView, 'Edit'=>$zmSlangEdit )
<tr><td align="right" class="text"><?= $zmSlangControl ?></td><td align="left" class="text"><?= buildSelect( "new_control", $nve ) ?></td></tr>
<tr><td align="right" class="text"><?= $zmSlangMonitors ?></td><td align="left" class="text"><?= buildSelect( "new_monitors", $nve ) ?></td></tr>
<tr><td align="right" class="text"><?= $zmSlangSystem ?></td><td align="left" class="text"><?= buildSelect( "new_system", $nve ) ?></td></tr>
<?php
$new_max_bandwidth = $row['MaxBandwidth'];
$bandwidths = array_merge( array( ""=>"" ), $bw_array );
?>
<tr><td align="right" class="text"><?= $zmSlangMaxBandwidth ?></td><td align="left" class="text"><?= buildSelect( "new_max_bandwidth", $bandwidths ) ?></td></tr>
<tr><td align="right" class="text"><?= $zmSlangRestrictedCameraIds ?></td><td align="left" class="text"><input type="text" name="new_monitor_ids" value="<?= $row['MonitorIds'] ?>" size="16" class="form"></td></tr>
<tr>
<td align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"></td><td align="left"><input type="button" value="<?= $zmSlangClose ?>" class="form" onClick="closeWindow()"></td>

View File

@ -317,6 +317,7 @@ $zmSlangMain = 'Main';
$zmSlangMan = 'Man';
$zmSlangManual = 'Manual';
$zmSlangMark = 'Mark';
$zmSlangMaxBandwidth = 'Max Bandwidth';
$zmSlangMaxBrScore = 'Max.<br/>Score';
$zmSlangMaxFocusRange = 'Max Focus Range';
$zmSlangMaxFocusSpeed = 'Max Focus Speed';