Closed Bug 225703 Opened 21 years ago Closed 21 years ago

Partial templatization for editkeywords.cgi

Categories

(Bugzilla :: Administration, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: goobix, Assigned: goobix)

Details

Attachments

(1 file, 7 obsolete files)

Partial templatization for editkeywords.cgi.
Attached patch Partial templatization (obsolete) — Splinter Review
Smaller patches are easier to review.

If someone likes a complete rewrite instead of a partial patch, let me know.
Attachment #135486 - Flags: review?(timeless)
Comment on attachment 135486 [details] [diff] [review]
Partial templatization

r=gerv, but it should have a second review. Looks mostly OK to me. I have a few
language nits, some of which may well have been present in the original.

>+[% IF action == "update" %]
>+  [% title = "Update keyword" %]
>+[% ELSIF action == "delete" %]
>+  [% title = "Delete keyword" %]
>+[% END %]
>+
>+[% PROCESS global/header.html.tmpl %]
>+
>+Keyword [% name %] [%+action %]d.

This is rather inconvenient for localisers. Can you spell it out explicitly
with an IF test?

>+
>+<p>
>+  <b>You have deleted or modified a keyword. You must
>+  rebuild the keyword cache!</b><br>

A bit excitable! "After you have finished deleting or modifying keywords, you
need to rebuild the keyword cache." would do.

>+  You can rebuild the cache using sanitycheck.cgi.

This sentence is unnecessary.

>+  On very large installations of Bugzilla,<br>
>+  this can take several minutes.

"Warning: on a very..."

>+</p>
>+
>+<p>
>+  <b><a href="sanitycheck.cgi?rebuildkeywordcache=1">Rebuild
>+  cache</a></b>

Rebuild _keyword_ cache.

>+</p>
>+
>+<p>Back to the <a href="query.cgi">query page</a> or <a href="editkeywords.cgi">edit</a> more keywords.</p>

"_Go_ back to the..." (here and in other templates.)

Gerv
Attachment #135486 - Flags: review+
Comment on attachment 135486 [details] [diff] [review]
Partial templatization

Canceling request review on obsolete patch.
Attachment #135486 - Flags: review?(timeless)
Attached patch Ver 2 (obsolete) — Splinter Review
Thanks for the comments!

This version addresses Gerv's suggestions.
Attachment #135486 - Attachment is obsolete: true
Comment on attachment 135511 [details] [diff] [review]
Ver 2

Gerv, can you do the second review? Or did you mean someone else?
Attachment #135511 - Flags: review?(gerv)
Note to myself: The <br> from the "Warning: on a very large installation of
Bugzilla,<br>" needs to go away because I eliminated an unnecessary sentence
before it.
I meant someone else :-)

Gerv
Attachment #135511 - Flags: review?(gerv)
Attached patch Version 3 (obsolete) — Splinter Review
Eliminating <br>, and doing Bugzilla --> [% terms.Bugzilla %].
Attachment #135511 - Attachment is obsolete: true
Attachment #135521 - Flags: review?(kiko)
Comment on attachment 135521 [details] [diff] [review]
Version 3

Since kiko seems away, anybody should feel free to take upon this r? thing :)
Attachment #135521 - Flags: review?(jouni)
Templatization patches... oh the pain :-) I'll try to check this out tomorrow
morning. 

-> patch author
Assignee: justdave → jocuri
Comment on attachment 135521 [details] [diff] [review]
Version 3

>Smaller patches are easier to review.
>If someone likes a complete rewrite instead of a partial patch, let me know.

I agree, and a partial patch is fine with me. Anyway, you should clearly say
when you're templatizing "the rest of editkeywords", because otherwise stuff
will get missed (like now, when there are plenty of comments but I'll skip most
because this is just a partial patch and it's not that fair to require new
thing in review phase). There has to be the moment when the editkeywords page
in its entirety is reviewed.


>Index: editkeywords.cgi

>+            $template->process("admin/keywords/confirm-delete.html.tmpl",
>+              $vars) || ThrowTemplateError($template->error());

Nit: This wrapping bites. Make $vars aligned to "admin", with something like

$template->process("foo",
		   $vars)
  || ThrowTemplateError...



>+++ template/en/default/admin/keywords/add-keyword.html.tmpl

>+<p>Go back to the <a href="query.cgi">query page</a> or <a href="editkeywords.cgi">edit</a> other keywords.</p>

This line exceeds 80 chars. Also, please make the latter link text encompass
the whole phrase "edit other keywords". For this stuff, the rule of thumb is
that link texts should be understandable without context (text browsers can
collect the links and show them separately). Usually that's not worth doing,
but in this case it's so easy...



>+++ template/en/default/admin/keywords/confirm-delete.html.tmpl

I see we've slipped a bit recently on the template documentation part (and even
all of the old stuff may not be well documented anyway), but I see no good
reason for not having an interface comment explaining the contents of the $vars
array. See for example the global/header template for an example of a good if
comment.

If Gerv, who's sort of a template czar here, says the comment is not necessary,
I'll reconsider. Anyway, for now, I believe he just forgot. O:-) I also suggest
you add an interface doc part to templates that don't have variables (just say
"none" or something similar), so that it's easy to tell apart an interfaceless
template from one without documentation.


>+  There are [% bugs %] [%+terms.bugs %] which have this keyword set.

I have a problem with a "bug_count" being called "bugs". I suggest renaming
that variable.

Also, the sentence is grammatically wrong when there's only one bug.

>+  <input type="hidden" name="id" value="[% id %]">

Here, let's go for "keyword_id" or a similar template variable (I don't care
about the form field name) for the sake of clarity.

>+<p>Go back to the <a href="query.cgi">query page</a> or <a href="editkeywords.cgi">edit</a> other keywords.</p>

Wrap and refine link text, as before. :-)



>+++ template/en/default/admin/keywords/rebuild-cache.html.tmpl


>+<a href="editkeywords.cgi">edit</a> more keywords.</p>

And finally, this link text should be "edit more keywords".
Attachment #135521 - Flags: review?(jouni) → review-
Attachment #135521 - Flags: review?(kiko)
Attached patch Version 4 (obsolete) — Splinter Review
Great comments! This version addresses Jouni's concerns.

I plan to start working on the rest of templatization for editkeywords.cgi as
soon as I get this checked into the CVS.
Attachment #135521 - Attachment is obsolete: true
Attachment #135633 - Flags: review?(jouni)
Attachment #135633 - Flags: review?(jouni)
Attached patch Version 5 (obsolete) — Splinter Review
(missed one $template ident last time)
Attachment #135633 - Attachment is obsolete: true
Attachment #135634 - Flags: review?(jouni)
Comment on attachment 135634 [details] [diff] [review]
Version 5

>+++ template/en/default/admin/keywords/confirm-delete.html.tmpl

>+  # bug_count: number. The number of bugs containing specified keyword.

Nit: "number of bugs with the keyword" or something like that; "containing"
sounds like a string search.

>+<p>
>+  There are [% bug_count %]
>+  
>+  [% IF bug_count == 1 %]
>+    [%+terms.bug %]
>+  [% ELSE %]
>+    [%+terms.bugs %]
>+  [% END %]
>+  
>+  which have this keyword set.

It's not just "bug" or "bugs", it's also the verb forms. 

"There is one bug with this keyword set" 
OR
"There are X bugs with this keyword set"

(or "which has/have this keyword set", I don't care :-)

Fix that, and r=jouni.
Attachment #135634 - Flags: review?(jouni) → review+
Attached patch Version 6 (obsolete) — Splinter Review
Guess we aren't going to make it to no 17 after all :)
Attachment #135634 - Attachment is obsolete: true
Attachment #135635 - Flags: review?(jouni)
Comment on attachment 135635 [details] [diff] [review]
Version 6

>+    There is one bug with this keyword set.
		   ---
[% terms.bug %] 


Get approval and fix that before you check it in, I'm done with this.
Attachment #135635 - Flags: review?(jouni) → review+
Comment on attachment 135635 [details] [diff] [review]
Version 6

Nevermind that "ok"; this seems to fail 008filter tests. You'll probably want
to edit filterexceptions.pl to mark the numeric fields as safe and check out
the couple of occasions of html filtering the keyword. 

Sorry for not noticing this earlier :-(
Attachment #135635 - Flags: review+ → review-
Attached patch Version 7 (obsolete) — Splinter Review
I forgot about FILTER html, sorry. :)

This is fixed now, and all 9 tests are passed. :)
Attachment #135635 - Attachment is obsolete: true
Attachment #135637 - Flags: review?(jouni)
I'd prefer to have numeric values marked safe in filterexceptions.pl for
clarity, and then filter only stuff that really needs the filtering (the keyword
itself). However, I can't seem to find a real documentation on what are the real
intentions behind filterexceptions.pl - what should be there and what should
just be filtered? We should probably have rules for this. 

Ccing Gerv for comment.
The real intention is to avoid cross-site scripting holes :-)

If it's a numeric value, you can either filter it, or mark it safe. Filtering is
preferred if there is any doubt whatsoever that the value may have come from the
user's browser. If it's a direct database read of a numeric field, then you can
mark it safe.

Gerv
Very well. In that case, I think we should mark bug counts and keyword numeric
ids as safe in filterexceptions rather than filtering them at output. That's
semantically more clear - to me, |123 FILTER html| sounds just like |"123"| - an
overly complex presentation of an integer.

Besides, using filterexceptions is also good for consistency - many (perhaps
most) of the other templates do this, too. 
Comment on attachment 135637 [details] [diff] [review]
Version 7

I don't think there's going to be any more of this reviewers@ consensus stuff
on the template names. I'd say let's go for what Myk suggested: add-keyword
becomes create, otherwise the names seem good.
Attachment #135637 - Flags: review?(jouni) → review-
Attached patch Version 8Splinter Review
This should do it. :)
Attachment #135637 - Attachment is obsolete: true
Attachment #135833 - Flags: review?(jouni)
Ran runtests.pl on it and it passes all safety-checks.
Status: NEW → ASSIGNED
Comment on attachment 135833 [details] [diff] [review]
Version 8

r=jouni
Attachment #135833 - Flags: review?(jouni) → review+
Flags: approval?
I have a question. The delete action used to have a &RebuildCacheWarning call at
the end of it; I don't see one here for that specific action (it's there for
update, though). Was it forgotten, or left out intentionally, or have I not had
enough sleep?

If it's missing, maybe the proper way to do it is implement a BLOCK that you can
add as necessary? 
The RebuildCacheWarning sub was removed in the diff:

-sub RebuildCacheWarning {
-
-    print "<BR><BR><B>You have deleted or modified a keyword. You must rebuild
the keyword cache!<BR></B>";
-    print "You can rebuild the cache using sanitycheck.cgi. On very large
installations of Bugzilla,<BR>";
-    print "This can take several minutes.<BR><BR><B><A
HREF=\"sanitycheck.cgi?rebuildkeywordcache=1\">Rebuild cache</A><BR></B>";
 }


It contained only HTML tags, that have been moved in the rebuild-cache.html.tmpl
template. The template mainly says "keyword updated" / "keyword deleted", but
its main purpose is to notify after that message about the need to rebuild the
keyword cache.

The template rebuild-cache.html.tmpl is called both after an update and after a
delete. I don't see any difference between "update" and "delete" regarding the
call for the rebuild-cache.html.tmpl template.
Attachment #135833 - Flags: review?(gerv)
Comment on attachment 135833 [details] [diff] [review]
Version 8

Looks fine to me.

Gerv
Attachment #135833 - Flags: review?(gerv)
Flags: approval? → approval+
RCS file:
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/create.html.tmpl,v
done
Checking in template/en/default/admin/keywords/create.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/create.html.tmpl,v
 <--  create.html.tmpl
initial revision: 1.1
done
RCS file:
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/confirm-delete.html.tmpl,v
done
Checking in template/en/default/admin/keywords/confirm-delete.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/confirm-delete.html.tmpl,v
 <--  confirm-delete.html.tmpl
initial revision: 1.1
done
RCS file:
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/rebuild-cache.html.tmpl,v
done
Checking in template/en/default/admin/keywords/rebuild-cache.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/rebuild-cache.html.tmpl,v
 <--  rebuild-cache.html.tmpl
initial revision: 1.1
done
Checking in template/en/default/filterexceptions.pl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl,v 
<--  filterexceptions.pl
new revision: 1.12; previous revision: 1.11
done
Checking in editkeywords.cgi;
/cvsroot/mozilla/webtools/bugzilla/editkeywords.cgi,v  <--  editkeywords.cgi
new revision: 1.17; previous revision: 1.16
done

Thanks!
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment on attachment 135833 [details] [diff] [review]
Version 8

Yeah, I was sleepy. It was pretty hard to find in the diff, too ;)
Target Milestone: --- → Bugzilla 2.18
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: