From 19ae94cd2c224c1200485291a110c850dd5888d6 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 29 Nov 2015 23:35:49 +0000 Subject: [PATCH] support untrimmed settings git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2556 2a923420-c742-0410-a762-8d5b09965624 --- webif/html/settings/settings.jim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/webif/html/settings/settings.jim b/webif/html/settings/settings.jim index 4dd043ba..fd1d7552 100755 --- a/webif/html/settings/settings.jim +++ b/webif/html/settings/settings.jim @@ -59,12 +59,15 @@ set dedup_template [$settings dedup_template] if {![dict exists $env SCRIPT_NAME]} { set env(SCRIPT_NAME) "" } -proc _handle_update {class var old text} { +proc _handle_update {class var old text {trim 1}} { global _cgi global settings if {[dict exists $_cgi $var]} { - set new [string trim [dict get $_cgi $var]] + set new [dict get $_cgi $var] + if {$trim} { + set new [string trim $new] + } if {$new == $old} { puts "$text unchanged." } elseif {[string is $class -strict $new]} { @@ -77,12 +80,12 @@ proc _handle_update {class var old text} { } } -proc handle_int_update {var old {text "Value"}} { - _handle_update digit $var $old $text +proc handle_int_update {var old {text "Value"} {trim 1}} { + _handle_update digit $var $old $text $trim } -proc handle_str_update {var old {text "Value"} {class alnum}} { - _handle_update $class $var $old $text +proc handle_str_update {var old {text "Value"} {class alnum} {trim 1}} { + _handle_update $class $var $old $text $trim } handle_str_update hostname $hostname Hostname @@ -106,7 +109,7 @@ handle_int_update nounwatchedcount $nounwatchedcount "Disable unwatched count" handle_int_update genrededup $genrededup "Genre search dedup" handle_int_update autolog $autolog "Auto-processing log level" handle_int_update audiomp3 $audiomp3 "MP3 type" -handle_str_update dedup_template $dedup_template "Dedup Template" print +handle_str_update dedup_template $dedup_template "Dedup Template" print 0 set acluser [cgi_get acluser "-"] set aclpass [cgi_get aclpass "-"]