From 324479e5c3f9fb77f85bfedee1e870f11076ee48 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 17 Jul 2006 06:02:32 +0000 Subject: Bug 95923: Don't let users change fields they aren't allowed to change - Patch by Olav Vitters r=LpSolit a=justdave --- template/en/default/bug/edit.html.tmpl | 110 +++++++++++++++++++++----------- template/en/default/filterexceptions.pl | 4 ++ 2 files changed, 78 insertions(+), 36 deletions(-) diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 2ea8d0db6..dc80079d5 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -159,10 +159,7 @@ : - - - + [% PROCESS input inputname => "alias" size => "20" maxlength => "20" %] [% END %] @@ -340,13 +337,25 @@ : - [% INCLUDE global/userselect.html.tmpl - id => "qa_contact" - name => "qa_contact" - value => bug.qa_contact.login - size => 60 - emptyok => 1 - %] + [% IF bug.check_can_change_field("qa_contact", 0, 1) || !user.id %] + [% INCLUDE global/userselect.html.tmpl + id => "qa_contact" + name => "qa_contact" + value => bug.qa_contact.login + size => 60 + emptyok => 1 + %] + [% ELSE %] + + [% IF bug.qa_contact.login && bug.qa_contact.login.length > 60 %] + + [% bug.qa_contact.login FILTER truncate(60) FILTER html %] + + [% ELSE %] + [% bug.qa_contact.login FILTER html %] + [% END %] + [% END %] [% END %] @@ -362,21 +371,15 @@ [% END %] [%%]: - - - + [% PROCESS input inputname => "bug_file_loc" size => "60" colspan => 5 %] : - - - + [% PROCESS input inputname => "short_desc" size => "60" colspan => 5 + maxlength => 255 %] [% IF Param('usestatuswhiteboard') %] @@ -385,10 +388,8 @@ : - - - + [% PROCESS input inputname => "status_whiteboard" size => "60" + colspan => 5 %] [% END %] @@ -396,10 +397,8 @@ : - - - + [% PROCESS input inputname => "keywords" size => 60 colspan => 5 + value => bug.keywords.join(', ') %] [% END %] @@ -683,8 +682,13 @@ [% END %] - + [% IF bug.check_can_change_field(dep.fieldname, 0, 1) || !user.id %] + + [% ELSE %] + + [% END %] [% END %] @@ -695,12 +699,46 @@ [% BLOCK select %] - + [% FOREACH x = bug.choices.${selname} %] + + [% END %] + + [% ELSE %] + + [% bug.${selname} FILTER html %] + [% END %] + +[% END %] + +[%############################################################################%] +[%# Block for INPUT fields #%] +[%############################################################################%] + +[% BLOCK input %] + + [% val = value ? value : bug.$inputname %] + [% IF bug.check_can_change_field(inputname, 0, 1) || !user.id %] + + [% ELSE %] + + [% IF size && val.length > size %] + + [% val FILTER truncate(size) FILTER html %] + + [% ELSE %] + [% val FILTER html %] [% END %] - + [% END %] + [% maxlength = 0 %] + [% colspan = 0 %] + [% size = 0 %] + [% value = undef %] [% END %] diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index 8008036d7..78bbd27dc 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -324,6 +324,10 @@ 'depbug FILTER bug_link(depbug)', '"${bug.dup_id}" FILTER bug_link(bug.dup_id)', '" accesskey=\"$accesskey\"" IF accesskey', + 'inputname', + '" colspan=\"$colspan\"" IF $colspan', + '" size=\"$size\"" IF size', + '" maxlength=\"$maxlength\"" IF maxlength' ], 'bug/knob.html.tmpl' => [ -- cgit v1.2.3-24-g4f1b