css_class_quote filter (escaping CSS attribute names)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

css_class_quote filter (escaping CSS attribute names)

Peter Bittner
Hi!

In our customized Bugzilla installation we have values for Bug Priority and
Severity that unfortunately are not unproblematic for Bugzilla:

@severities = (
        "Bug (Fehler)",
        "Change Request (Änderung)",
        "Request For Quotation (Anfrage)"
);

@priorities = (
        "P1 Urgent (Höchste)",
        "P2 High (Hoch)",
        "P3 Normal (Mittel)",
        "P4 Low (Gering)",
        "P5 None (Anfrage)"
);

The problem about this is that the values contain characters that are
escaped by the css_class_quote filter in a way that does not work out with
CSS for the web browser to successfully interpret the HTML document.

When I go to the "My Calls" list in our Bugzilla system and examine the
source code I see

<tr class="bz_Bug_&#X28;Fehler&#X29;  bz_P3_Normal_&#X28;Mittel&#X29;  ...">

which evidentially can not be evaluated the way it should. And because of
that I can forget about letting Bugzilla show the table rows in different
colors according to, e.g., priority or severity.  :-(

The beast that creates the escaped code in the templates is somewhat like

  [% class FILTER css_class_quote %]

(see: default/global/header.html.tmpl or default/list/table.html.tmpl).
If this filter would escape CSS attribute names in a somewhat compatible
way, maybe replacing all parenteses and other special characters by
underscores or so, I could define valid pseud-classes in the buglist.css
CSS file.

Currently, what I have tried to put into
<DocumentRoot>/bugzilla/css/buglist.css is:

/* Style bug rows according to priority */
.bz_P1_Urgent_&#X28;H&#XF6;chste&#X29;  { color: red; font-weight: bold; }
.bz_P2_High_&#X28;Hoch&#X29;            { color: red; }
.bz_P3_Normal_&#X28;Mittel&#X29;        {  }
.bz_P4_Low_&#X28;Gering&#X29;           {  }
.bz_P5_None_&#X28;Anfrage&#X29;         { color: #888; background-color:
white; }

This, however, does not work at all. To my knowledge, semicolons (;), for
example, can not be used in attribute names since they separate attributes.
I have experimented a little bit (e.g. stripping everything from the
semicolon on or from the apersand sign on), but without success.

I have been unable to find the definition/implementation of css_class_quote
in order to adapt the way it works. Where can I find it?

Or is there a better solution to this problem than modifying
css_class_quote? (I dunno about any side-effects then!)

Greatly appreciating any help or comments!
Cheers, Peter
_______________________________________________
mozilla-webtools mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-webtools
Reply | Threaded
Open this post in threaded view
|

Re: css_class_quote filter (escaping CSS attribute names)

Marc Schumann
Peter,

2005/6/15, Peter Bittner <[hidden email]>:
> The problem about this is that the values contain characters that are
> escaped by the css_class_quote filter in a way that does not work out with
> CSS for the web browser to successfully interpret the HTML document.

I think it might be easier for you to keep symbolic priority and
severity names in localconfig (and thus the db and css). For display,
you can go the way of bug 215148
(https://bugzilla.mozilla.org/show_bug.cgi?id=215148).

   Regards
      Marc

--
http://wurblzap.net/
Bugzilla hosting and professional support

_______________________________________________
mozilla-webtools mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-webtools
Reply | Threaded
Open this post in threaded view
|

Re: css_class_quote filter (escaping CSS attribute names)

Peter Bittner
In reply to this post by Peter Bittner
Marc,

> I think it might be easier for you to keep symbolic priority and
> severity names in localconfig (and thus the db and css). For display,
> you can go the way of bug 215148

I would love to.

The problem is, we are running this Bugzilla installation for about half a
year. The values are in the database already. (Well, and apart from the
fact that I could theoretically update all corresponding database values I
am not sure how I can get a diff from my customized 2.18 version
en-template to the current 2.20 version template and apply it. All this
might be much work and if something goes wrong I'm f***ed up.)

The safer and faster way to fix the CSS problem, I guess, would be to modify
the code of css_class_quote. Apart from that I do not see a sense in why
escaping of CSS attribute names should be kept illegal. The code produced
does not work, so this is a bug according to my understanding. (If you
confirm I'm ready to file a bug report about it after doing the fix.)

Where can I find css_class_quote?

Cheers, Peter
_______________________________________________
mozilla-webtools mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-webtools
Reply | Threaded
Open this post in threaded view
|

Re: css_class_quote filter (escaping CSS attribute names)

Marc Schumann
Peter,

2005/6/16, Peter Bittner <[hidden email]>:
> Where can I find css_class_quote?

in Bugzilla/Util.pm:
c:\bin\bugzilla\head>grep -r "sub css_class_quote" *
Bugzilla/Util.pm:sub css_class_quote {

You can find all template filter definitions in Bugzilla/Template.pm
(look for FILTERS).

   Regards
      Marc

--
http://wurblzap.net/
Bugzilla hosting and professional support

_______________________________________________
mozilla-webtools mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-webtools