From b290319df4a576683b383138c29873a65e1aa792 Mon Sep 17 00:00:00 2001 From: stan Date: Thu, 20 Oct 2005 17:02:45 +0000 Subject: [PATCH] Bug 108 - Added max bandwidth setting to users. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1537 e3e1d417-86f3-4887-817a-d78f3d33393f --- db/zmalter-1.21.3.sql | 1 + web/zm_actions.php | 1 + web/zm_config.php.z | 2 +- web/zm_html.php | 16 ++++++++++++++++ web/zm_html_view_bandwidth.php | 13 +++++++++++++ web/zm_html_view_console.php | 2 +- web/zm_html_view_options.php | 8 +++++--- web/zm_html_view_user.php | 5 +++++ web/zm_lang_en_gb.php | 1 + 9 files changed, 44 insertions(+), 5 deletions(-) diff --git a/db/zmalter-1.21.3.sql b/db/zmalter-1.21.3.sql index d5028b8ae..3e43906d3 100644 --- a/db/zmalter-1.21.3.sql +++ b/db/zmalter-1.21.3.sql @@ -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 -- diff --git a/web/zm_actions.php b/web/zm_actions.php index 70bd9f7ca..d345437df 100644 --- a/web/zm_actions.php +++ b/web/zm_actions.php @@ -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 ) ) diff --git a/web/zm_config.php.z b/web/zm_config.php.z index abd7c3cb6..a084e71d1 100644 --- a/web/zm_config.php.z +++ b/web/zm_config.php.z @@ -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 ), diff --git a/web/zm_html.php b/web/zm_html.php index 2dc4978fc..dfa6a0d21 100644 --- a/web/zm_html.php +++ b/web/zm_html.php @@ -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"; diff --git a/web/zm_html_view_bandwidth.php b/web/zm_html_view_bandwidth.php index 7ad9711e9..1e1f1840b 100644 --- a/web/zm_html_view_bandwidth.php +++ b/web/zm_html_view_bandwidth.php @@ -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'] ); + } +} + ?> diff --git a/web/zm_html_view_console.php b/web/zm_html_view_console.php index 31448cc89..01da25fe6 100644 --- a/web/zm_html_view_console.php +++ b/web/zm_html_view_console.php @@ -235,7 +235,7 @@ else + + @@ -191,14 +192,15 @@ if ( $tab == "users" ) + - - + +$zmSlangNone, 'View'=>$zmSlangView, 'Edit'=>$zmSlangEdit ) +"" ), $bw_array ); +?> + diff --git a/web/zm_lang_en_gb.php b/web/zm_lang_en_gb.php index 1c0789bcd..de75b1328 100644 --- a/web/zm_lang_en_gb.php +++ b/web/zm_lang_en_gb.php @@ -317,6 +317,7 @@ $zmSlangMain = 'Main'; $zmSlangMan = 'Man'; $zmSlangManual = 'Manual'; $zmSlangMark = 'Mark'; +$zmSlangMaxBandwidth = 'Max Bandwidth'; $zmSlangMaxBrScore = 'Max.
Score'; $zmSlangMaxFocusRange = 'Max Focus Range'; $zmSlangMaxFocusSpeed = 'Max Focus Speed';
1 ) diff --git a/web/zm_html_view_options.php b/web/zm_html_view_options.php index bcb02ce3b..5c9eb0144 100644 --- a/web/zm_html_view_options.php +++ b/web/zm_html_view_options.php @@ -144,7 +144,7 @@ foreach ( $tabs as $name=>$value ) else { ?> -
disabled>
 
disabled 
 
disabled