summaryrefslogtreecommitdiffstats
path: root/userprefs.cgi
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-03-11 00:51:40 +0100
committertravis%sedsystems.ca <>2005-03-11 00:51:40 +0100
commit6674f61905d98aee08b95c22181aa439bfb041e5 (patch)
tree1b220ecddbfbc5a433982841508571696e211c60 /userprefs.cgi
parent9ffc6eb52bb9c549dae85a51aaf2b29750b7ba14 (diff)
downloadbugzilla-6674f61905d98aee08b95c22181aa439bfb041e5.tar.gz
bugzilla-6674f61905d98aee08b95c22181aa439bfb041e5.tar.xz
Bug 98123 : Create a user preferences infrastructure (became 'General Settings')
Patch by Shane H. W. Travis <travis@sedsystems.ca> r=jouni, mkanat a=myk
Diffstat (limited to 'userprefs.cgi')
-rwxr-xr-xuserprefs.cgi39
1 files changed, 39 insertions, 0 deletions
diff --git a/userprefs.cgi b/userprefs.cgi
index 342df065b..3331d5b91 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -20,6 +20,7 @@
# Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net>
# Vlad Dascalu <jocuri@softhome.net>
+# Shane H. W. Travis <travis@sedsystems.ca>
use strict;
@@ -139,6 +140,39 @@ sub SaveAccount {
}
+sub DoSettings {
+ $vars->{'settings'} = Bugzilla->user->settings;
+
+ my @setting_list = keys %{Bugzilla->user->settings};
+ $vars->{'setting_names'} = \@setting_list;
+}
+
+sub SaveSettings {
+ my $cgi = Bugzilla->cgi;
+
+ my $settings = Bugzilla->user->settings;
+ my @setting_list = keys %{Bugzilla->user->settings};
+
+ foreach my $name (@setting_list) {
+ next if ! ($settings->{$name}->{'is_enabled'});
+ my $value = $cgi->param($name);
+
+ # de-taint the value.
+ if ($value =~ /^([-\w]+)$/ ) {
+ $value = $1;
+ }
+ if ($value eq "${name}-isdefault" ) {
+ if (! $settings->{$name}->{'is_default'}) {
+ $settings->{$name}->reset_to_default;
+ }
+ }
+ else {
+ $settings->{$name}->set($value);
+ }
+ }
+ $vars->{'settings'} = Bugzilla->user->settings(1);
+}
+
sub DoEmail {
my $dbh = Bugzilla->dbh;
@@ -367,6 +401,11 @@ SWITCH: for ($current_tab_name) {
DoAccount();
last SWITCH;
};
+ /^settings$/ && do {
+ SaveSettings() if $cgi->param('dosave');
+ DoSettings();
+ last SWITCH;
+ };
/^email$/ && do {
SaveEmail() if $cgi->param('dosave');
DoEmail();