[Slim-Checkins] r10745 - /trunk/server/Slim/Web/Settings/Server/Network.pm

dsully at svn.slimdevices.com dsully at svn.slimdevices.com
Tue Nov 21 15:25:14 PST 2006


Author: dsully
Date: Tue Nov 21 15:25:14 2006
New Revision: 10745

URL: http://svn.slimdevices.com?rev=10745&view=rev
Log:
Bug: N/A
Description: Revert - not ready yet.

Modified:
    trunk/server/Slim/Web/Settings/Server/Network.pm

Modified: trunk/server/Slim/Web/Settings/Server/Network.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Settings/Server/Network.pm?rev=10745&r1=10744&r2=10745&view=diff
==============================================================================
--- trunk/server/Slim/Web/Settings/Server/Network.pm (original)
+++ trunk/server/Slim/Web/Settings/Server/Network.pm Tue Nov 21 15:25:14 2006
@@ -13,8 +13,6 @@
 use Slim::Utils::Misc;
 use Slim::Utils::Prefs;
 use Slim::Utils::Strings qw(string);
-
-use FormValidator::Simple;
 
 sub name {
 	return 'NETWORK_SETTINGS';
@@ -38,21 +36,6 @@
 		udpChunkSize
 	);
 
-	if ($paramRef->{'validate'}) {
-
-		my $result = FormValidator::Simple->check($paramRef => [
-			'webproxy' => [ 'HTTP_URL' ],
-		]);
-
-		#$paramRef->{'result'} = $result;
-		if ($result->has_error) {
-			
-			return \"webproxy is invalid!";
-		} else {
-			return \"";
-		}
-	}
-
 	my $homeURL = Slim::Utils::Prefs::homeURL();
 
 	# Bug 2724 - only show the mDNS settings if we have a binary for it.
@@ -64,33 +47,66 @@
 	# If this is a settings update
 	if ($paramRef->{'submit'}) {
 
-		my $result = FormValidator::Simple->check($paramRef => [
-			'httpport'            => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 1025, 65535 ] ],
-			'tcpReadMaximum'      => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 1, 65535 ] ],
-			'tcpWriteMaximum'     => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 1, 65535 ] ],
-			'bufferSecs'          => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 3, 30 ] ],
-			'udpChunkSize'        => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 1, 4096 ] ],
-			'remotestreamtimeout' => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 0, 600 ] ],
-			'maxWMArate'          => [ 'NOT_BLANK', 'INT', [ 'BETWEEN', 0, 9999 ] ],
-			'webproxy'            => [ 'HTTP_URL' ],
-		]);
-
 		$paramRef->{'warning'} = "";
 
 		if ($paramRef->{'httpport'} ne Slim::Utils::Prefs::get('httpport')) {
+		
+			if ($paramRef->{'httpport'} < 1025)  { $paramRef->{'httpport'}  = 1025 };
+			if ($paramRef->{'httpport'} > 65535) { $paramRef->{'httpport'} = 65535 };
+		
+			Slim::Utils::Prefs::set('httpport', $paramRef->{'httpport'});
 
-			Slim::Utils::Prefs::set('httpport', $paramRef->{'httpport'});
+			$paramRef->{'warning'} .= join('',
+				string("SETUP_HTTPPORT_OK"),
+				'<blockquote><a target="_top" href="',
+				$homeURL,
+				'">',
+				$homeURL,
+				"</a></blockquote><br>"
+			);
 		}
 
 		for my $pref (@prefs) {
+
+			if ($pref =~ /^tcp/ || $pref eq 'validate') {
+
+				if ($paramRef->{$pref} < 1) {
+
+					$paramRef->{$pref} = 1
+				}
+			}
+
+			if ($pref eq 'bufferSecs') {
+
+				if ($paramRef->{'bufferSecs'} > 30) {
+
+					$paramRef->{'bufferSecs'} = 30
+				}
+
+				if ($paramRef->{'bufferSecs'} < 3) {
+
+					$paramRef->{'bufferSecs'} = 3
+				}
+			}
+
+			if ($pref eq 'udpChunkSize') {
+
+				if ($paramRef->{'udpChunkSize'} < 1) {
+
+					$paramRef->{'udpChunkSize'} = 1
+				}
+
+				if ($paramRef->{'udpChunkSize'} > 4096) {
+
+					$paramRef->{'udpChunkSize'} = 4096
+				}
+			}
 
 			if ($paramRef->{$pref}) {
 
 				Slim::Utils::Prefs::set($pref, $paramRef->{$pref});
 			}
 		}
-
-		#$paramRef->{'result'} = $result;
 	}
 
 	for my $pref (@prefs) {



More information about the checkins mailing list