Closed Bug 190223 Opened 23 years ago Closed 22 years ago

templatize editkeywords.cgi

Categories

(Bugzilla :: Administration, task)

2.17.6
task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: justdave, Assigned: goobix)

References

Details

Attachments

(1 file, 4 obsolete files)

templatize editkeywords.cgi
Severity: normal → enhancement
Target Milestone: --- → Bugzilla 2.18
Attached patch Version 1 (obsolete) — — Splinter Review
<-- me
Assignee: justdave → jocuri
Attachment #136697 - Flags: review?(kiko)
Status: NEW → ASSIGNED
Version: 2.17.3 → 2.17.6
Comment on attachment 136697 [details] [diff] [review] Version 1 Note that it seems to be half expected that admin templatization also fixes taint issues in edit*.cgi. I don't know Dave's current opinion on this, but I'd put -T on the shebang line in the same patch and make the templatized version to work under taint mode. That is probably easiest for all of us, because input value handling code will get heavily shuffled in the templatization anyway. I haven't had the time to take a good look at your code, but can contribute a second review later on. Some quick notes, some of which concern stuff that was probably already broken earlier (though I don't think it's a bad idea to fix some such things with this big changes)... You can easily tell I didn't really review, which is why I'm not flagging anything. >+ $vars->{'max_table_size'} = 50; This sort of display-centric constant values would be better off set in default blocks of the template, wouldn't they? >+ $bugs = $bugs || 'none'; A true Perl hacker says this as "$bugs ||= 'none'" ;-) >+ [% title = "Blank Keyword Description Not Allowed" %] I'm horrified by the capitalization of this. Despite the fact that it's called title, for me it's not something like a book title but rather an error message. I haven't checked out if this is our normal approach, though. :-) A passing observation: We don't have interface documentation for user-error messages that use the vars array. Don't know if we should. >+ [% ELSIF error == "keyword_invalid_name" %] >+ [% title = "Invalid Keyword Name" %] >+ You may not use commas or whitespace in a keyword name. You may be better off specifying what you _can_ do here - it's also a guide to better writing of keywords. >+ [% ELSIF error == "invalid_keyword_id" %] >+ The keyword ID <em>[% id FILTER html %]</em> couldn't be >+ found. Why <em>? Rather <code>, if you must emphasize, but do we usually do that for variable values in errors? >+ <input type="hidden" name="id" value="[% keyword_id FILTER html %]"> I am, again, tilted towards marking id and count type fields as safe in filterexceptions and skipping the filtering... >+ # max_table_size: number. Determines the maximum number of >+ rows in each keywords table. Since this will easily fit, indent "rows" to start below the "number" - that will be more readable.
Comment on attachment 136697 [details] [diff] [review] Version 1 >Note that it seems to be half expected that admin templatization also fixes >taint issues in edit*.cgi. I don't know Dave's current opinion on this, but I'd >put -T on the shebang line in the same patch and make the templatized version >to work under taint mode. That is probably easiest for all of us, because input >value handling code will get heavily shuffled in the templatization anyway. Yes! Please do. That's about the way we did it for the user-facing pages, too. We took the opportunity, while the files were getting major spankage anyway for templatization, to do other cleanups as well, such as ensuring taint mode operation and general code cleanup. >>+ $bugs = $bugs || 'none'; > >A true Perl hacker says this as "$bugs ||= 'none'" ;-) Why are we doing this here? This should be up to the template to convert a 0 to a 'none'. "None" is an English word, and you'll unnecessarily make life difficult on the localizers otherwise.
Attachment #136697 - Flags: review?(kiko) → review-
Attached patch Version 2 (obsolete) — — Splinter Review
>>+ [% title = "Blank Keyword Description Not Allowed" %] >I'm horrified by the capitalization of this. Despite the fact that it's called >title, for me it's not something like a book title but rather an error message. >I haven't checked out if this is our normal approach, though. :-) This is our normal approach. :-) Changing all its appearances according to a new policy of capitalization is beyond the scope of editkeywords.cgi and therefore outside the scope of this bug. >>+ You may not use commas or whitespace in a keyword name. >You may be better off specifying what you _can_ do here - it's also a guide to >better writing of keywords. Currently our code allows anything, except commans and whitespaces. If you want some policy more restricted than that, I'll be happy to change the code and the error message according to that. (is that inside the scope of this bug? :) ) >>+ [% ELSIF error == "invalid_keyword_id" %] >>+ The keyword ID <em>[% id FILTER html %]</em> couldn't be >>+ found. >Why <em>? Rather <code>, if you must emphasize, but do we usually do that for >variable values in errors? In a lot of cases we use <em>, and we usually do that, as far as I could see. The other issues have been addressed, thanks for those taking the time to review it :)
Attachment #136697 - Attachment is obsolete: true
Attachment #137049 - Flags: review?(kiko)
Comment on attachment 137049 [details] [diff] [review] Version 2 A few quick thoughts: >+ [% ELSIF error == "keyword_access_denied" %] >+ [% title = "Access Denied" %] >+ Sorry, you aren't a member of the 'editkeywords' group. And so, >+ you aren't allowed to add, modify or delete keywords. Comma after "group", but not after "so". >+ [% ELSIF error == "keyword_blank_description" %] >+ [% title = "Blank Keyword Description Not Allowed" %] >+ You must enter a non-blank description of the keyword. "for the keyword" is probably better. >+<p>OK, done.</p> The usual form here is "The keyword <name> has been added." >+<p>Go back to the <a href="query.cgi">query page</a>, We don't need this link, surely? It's not particularly relevant, and it's in the footer. Also, it's called the search page these days ;-) >+[% PROCESS global/header.html.tmpl >+ title = "Edit keyword" >+ h2 = "This page allows you to edit a keyword." >+%] The H2 doesn't really expand on the title - I'd leave it out. >+<p>Go back to the <a href="query.cgi">query page</a> Same comment. >+++ template/en/default/admin/keywords/list.html.tmpl 2003-12-08 19:30:20.000000000 +0200 >+[% PROCESS global/header.html.tmpl >+ title = "Select keyword" >+ h2 = "This page allows you to view a list with current keywords." Again, not really any more enlightening IMO. >+[% max_table_size = 50 %] <snip> Is all this table code copied from somewhere? If so, can we abstract it out? >+<p>Go back to the <a href="query.cgi">query page</a>.</p> Same again. Gerv
Attachment #137049 - Attachment is obsolete: true
Attachment #137049 - Flags: review?(kiko)
Attached patch Version 3 (obsolete) — — Splinter Review
>>+[% max_table_size = 50 %] ><snip> >Is all this table code copied from somewhere? If so, can we abstract it out? If you're talking about "50", the value, then no, as far as I could see it's different across the templates. For example, its value is 100 in buglist.cgi, etc. However, it's scope remains the same ("number of entries displayed until the table headers must be repeated"). If we want to put it at 50 or 100 in ALL templates, then I guess we could set it in only one template and use it across the entire template system. If you're talking about the code that generates table headers and footers, then editkeywords.cgi has some particularities that make it not suitable for abstractization. For example, the last row is not a keyword; it's the "Add new keyword" row, so the code must do some "tricks" to assure correct table header and footer generation. All other issues fixed, thanks!
Attachment #137101 - Flags: review?(kiko)
>Changing all its appearances according to a new policy of capitalization is >beyond the scope of editkeywords.cgi and therefore outside the scope of this >bug. Agreed. It's still horrible. O:-) >Currently our code allows anything, except commans and whitespaces. If you want >some policy more restricted than that, I'll be happy to change the code and the >error message according to that. (is that inside the scope of this bug? :) ) No, it's not. Let's reconsider this elsewhere. UI-wise, I find inclusive statements usually easier to follow (especially if the list of special chars is short), but this isn't particularly important. >>Why <em>? Rather <code>, if you must emphasize, but do we usually do that for >>variable values in errors? >In a lot of cases we use <em>, and we usually do that, as far as I could see. Right... But just blindly emphasizing all variable values doesn't sound like a very good use of HTML to me. For example, IDs are practically "code", so <code> would be appropriate markup. Besides, the usual rendering for code (monospace font) is also decent for clarity (with short strings like ids). But yeah, forget this part. We can go into these details in another bug somewhere. It's not like we uniformly used <kbd> to indicate keyboard input either.
> If you're talking about the code that generates table headers and footers, then > editkeywords.cgi has some particularities that make it not suitable for > abstractization. For example, the last row is not a keyword; it's the "Add new > keyword" row, so the code must do some "tricks" to assure correct table header > and footer generation. Well, unless I'm terribly mistaken, most of the edit*.cgi pages have a very similar table; since this is the first one to go, I'd say you don't have to abstract it *now* -- we just need to make *sure* that when the next template goes in we make a version that is suitable for both, and so forth for the other templatized edit*.cgi pages that I feel you are anxious to implement <wink>.
Comment on attachment 137101 [details] [diff] [review] Version 3 >Index: template/en/default/global/user-error.html.tmpl >+ [% ELSIF error == "keyword_already_exists" %] >+ [% title = "Keyword Already Exists" %] >+ The keyword [% name FILTER html %] already exists. Would the correct message here be "A keyword with the name 'foo' already exists." -- ? >+++ template/en/default/admin/keywords/edit.html.tmpl Given that you use terms.Bug etc here you should probably process variables.none.tmpl instead of relying on header importing it. >+ <hr> >+ <input type="submit" value="Update"> >+ <input type="hidden" name="action" value="update"> Err, isn't this <hr> new here? >+++ template/en/default/admin/keywords/list.html.tmpl Same for variables.none.html Looks good to go by me, just comment or fix the nits above and ask for the big A.
Attachment #137101 - Flags: review?(kiko) → review+
Attached patch Version 4 (obsolete) — — Splinter Review
Nice catches :-) Fixed, thanks!
Attachment #137101 - Attachment is obsolete: true
Flags: approval?
Comment on attachment 137147 [details] [diff] [review] Version 4 I never got the time to take a proper look at this, but I've still got three nits :-) >+ # name: string. Contains the name of the current keyword. Interface comments don't usually have verbs like this; you could just say "The name of the current keyword". >+ <a href="editkeywords.cgi?action=edit&id=[% keyword.id %]">[% keyword.name FILTER html %]</a> Make that & sign there &amp; >+ <th valign="top"><a href="editkeywords.cgi?action=delete&id=[% keyword.id %]">Delete</th> Ditto here.
Comment on attachment 137147 [details] [diff] [review] Version 4 Jouni found important stuff (the & thing). Fix it :)
Attachment #137147 - Flags: review-
Flags: approval?
Attached patch Version 5 — — Splinter Review
Fixed :)
Attachment #137147 - Attachment is obsolete: true
Attachment #137150 - Flags: review+
Flags: approval+
Damned &amp;s. It's hard to test the HTML against the validator if you don't product HTML dumps of the pages, given that they require authentication. So moral of the story: when templatizing, generate HTML output and run it through the validator :-)
Checking in editkeywords.cgi; /cvsroot/mozilla/webtools/bugzilla/editkeywords.cgi,v <-- editkeywords.cgi new revision: 1.19; previous revision: 1.18 done Checking in template/en/default/filterexceptions.pl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl,v <-- filterexceptions.pl new revision: 1.14; previous revision: 1.13 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 new revision: 1.2; previous revision: 1.1 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 new revision: 1.2; previous revision: 1.1 done RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/created.html.tmpl,v done Checking in template/en/default/admin/keywords/created.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/created.html.tmpl,v <-- created.html.tmpl initial revision: 1.1 done RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/edit.html.tmpl,v done Checking in template/en/default/admin/keywords/edit.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/edit.html.tmpl,v <-- edit.html.tmpl initial revision: 1.1 done RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/list.html.tmpl,v done Checking in template/en/default/admin/keywords/list.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/admin/keywords/list.html.tmpl,v <-- list.html.tmpl initial revision: 1.1 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 new revision: 1.2; previous revision: 1.1 done Checking in template/en/default/global/code-error.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl,v <-- code-error.html.tmpl new revision: 1.35; previous revision: 1.34 done Checking in template/en/default/global/user-error.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/global/user-error.html.tmpl,v <-- user-error.html.tmpl new revision: 1.42; previous revision: 1.41 done
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
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: