diff options
author | lpsolit%gmail.com <> | 2005-10-28 18:56:53 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-10-28 18:56:53 +0200 |
commit | 5a69c0bcd929b79ba6cc675058b50fc0d162141e (patch) | |
tree | 05bd423d81561e15b517542c9c3f56946420e271 | |
parent | 05ec759cbdf76b56c55616314a5a19870c728164 (diff) | |
download | bugzilla-5a69c0bcd929b79ba6cc675058b50fc0d162141e.tar.gz bugzilla-5a69c0bcd929b79ba6cc675058b50fc0d162141e.tar.xz |
Bug 308340: General Preferences tab is empty except for submit button when no user prefences are enabled - Patch by Frédéric Buclin <LpSolit@gmail.com> r=GavinS a=justdave
-rw-r--r-- | template/en/default/account/prefs/prefs.html.tmpl | 41 | ||||
-rw-r--r-- | template/en/default/account/prefs/settings.html.tmpl | 68 | ||||
-rwxr-xr-x | userprefs.cgi | 15 |
3 files changed, 77 insertions, 47 deletions
diff --git a/template/en/default/account/prefs/prefs.html.tmpl b/template/en/default/account/prefs/prefs.html.tmpl index e849a4e99..352e303d6 100644 --- a/template/en/default/account/prefs/prefs.html.tmpl +++ b/template/en/default/account/prefs/prefs.html.tmpl @@ -17,6 +17,7 @@ # Rights Reserved. # # Contributor(s): Gervase Markham <gerv@gerv.net> + # Frédéric Buclin <LpSolit@gmail.com> #%] [%# INTERFACE: @@ -32,12 +33,14 @@ # changes_saved: boolean/string. True if the CGI processed form data before # displaying anything, and can contain an optional custom # message if required (which Perl still evaluates as True). + # dont_show_button: boolean. Prevent the display of the "Submit Changes" button. #%] [% filtered_login = user.login FILTER html %] [% PROCESS global/header.html.tmpl title = "User Preferences" h2 = filtered_login + style_urls = ['skins/standard/admin.css'] %] [% tabs = [ { name => "account", label => "Account Preferences", @@ -77,28 +80,28 @@ <h3>[% current_tab.label %]</h3> -<form name="userprefsform" method="post" action="userprefs.cgi"> - <input type="hidden" name="tab" value="[% current_tab.name %]"> +[% IF current_tab.saveable %] + <form name="userprefsform" method="post" action="userprefs.cgi"> + <input type="hidden" name="tab" value="[% current_tab.name %]"> +[% END %] - [% PROCESS "account/prefs/${current_tab.name}.html.tmpl" - IF current_tab.name.defined %] +[% PROCESS "account/prefs/${current_tab.name}.html.tmpl" + IF current_tab.name.defined %] - [% IF current_tab.saveable %] +[% IF current_tab.saveable %] <input type="hidden" name="dosave" value="1"> - <table> - <tr> - <td width="150"></td> - <td> - <input type="submit" value="Submit Changes"> - </td> - </tr> - </table> - [% END %] - -</form> + [% UNLESS dont_show_button %] + <table> + <tr> + <td width="150"> </td> + <td> + <input type="submit" value="Submit Changes"> + </td> + </tr> + </table> + [% END %] + </form> +[% END %] [% PROCESS global/footer.html.tmpl %] - - - diff --git a/template/en/default/account/prefs/settings.html.tmpl b/template/en/default/account/prefs/settings.html.tmpl index a425dcac1..3ef9a5852 100644 --- a/template/en/default/account/prefs/settings.html.tmpl +++ b/template/en/default/account/prefs/settings.html.tmpl @@ -12,6 +12,7 @@ # The Original Code is the Bugzilla Bug Tracking System. # # Contributor(s): Shane H. W. Travis <travis@sedsystems.ca> + # Frédéric Buclin <LpSolit@gmail.com> # #%] @@ -23,40 +24,55 @@ # default_value - string (global default for this setting) # value - string (user-defined preference) # is_default - boolean (true if user has no preference) + # has_settings_enabled : boolean; is true if there is at least one user pref + # enabled by the maintainer. #%] [% PROCESS "global/setting-descs.none.tmpl" %] [% IF settings.size %] + [% UNLESS has_settings_enabled %] + <p class="criticalmessages"> + All user preferences have been disabled by the + <a href="mailto:[% Param("maintainer") %]">maintainer</a> + of this installation, and so you cannot customise any. + </p> + [% END %] + <table border="0" cellpadding="8"> [% FOREACH name = setting_names %] - [% IF settings.${name}.is_enabled %] - [% default_name = name _ '-isdefault' %] - [% default_val = settings.${name}.default_value %] - <tr> - <td align="right"> - [% setting_descs.$name OR name FILTER html %] - </td> - <td> - <select name="[% name %]" id="[% name %]"> - <option value="[% default_name %]" - [% ' selected="selected"' IF settings.${name}.is_default %]> - Site Default ([% setting_descs.${default_val} OR default_val FILTER html %]) - </option> - [% FOREACH x = settings.${name}.legal_values %] - <option value="[% x FILTER html %]" - [% ' selected="selected"' - IF x == settings.${name}.value - AND NOT settings.${name}.is_default %]> - [% setting_descs.${x} OR x FILTER html %] - </option> - [% END %] - </select> - </td> - </tr> - [% END %] + [% default_name = name _ '-isdefault' %] + [% default_val = settings.${name}.default_value %] + <tr> + <td align="right"> + [% setting_descs.$name OR name FILTER html %] + </td> + <td> + [% IF settings.${name}.is_enabled %] + <select name="[% name %]" id="[% name %]"> + <option value="[% default_name %]" + [% ' selected="selected"' IF settings.${name}.is_default %]> + Site Default ([% setting_descs.${default_val} OR default_val FILTER html %]) + </option> + [% FOREACH x = settings.${name}.legal_values %] + <option value="[% x FILTER html %]" + [% ' selected="selected"' + IF x == settings.${name}.value + AND NOT settings.${name}.is_default %]> + [% setting_descs.${x} OR x FILTER html %] + </option> + [% END %] + </select> + [% ELSE %] + <select name="[% name %]" id="[% name %]" disabled="disabled"> + <option value="[% default_name %]"> + Site Default ([% setting_descs.${default_val} OR default_val FILTER html %]) + </option> + </select> + [% END %] + </td> + </tr> [% END %] - </table> [% END %] <br> diff --git a/userprefs.cgi b/userprefs.cgi index 796f2e0f9..ebbcefbab 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -146,10 +146,21 @@ sub SaveAccount { sub DoSettings { - $vars->{'settings'} = Bugzilla->user->settings; + my $settings = Bugzilla->user->settings; + $vars->{'settings'} = $settings; - my @setting_list = keys %{Bugzilla->user->settings}; + my @setting_list = keys %$settings; $vars->{'setting_names'} = \@setting_list; + + $vars->{'has_settings_enabled'} = 0; + # Is there at least one user setting enabled? + foreach my $setting_name (@setting_list) { + if ($settings->{"$setting_name"}->{'is_enabled'}) { + $vars->{'has_settings_enabled'} = 1; + last; + } + } + $vars->{'dont_show_button'} = !$vars->{'has_settings_enabled'}; } sub SaveSettings { |