Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#1908 closed defect (fixed)

add_stylesheet() should be able to handle plugin's resource

Reported by: Shunichi Goto <gotoh@…> Owned by: Christopher Lenz
Priority: high Milestone: 0.9
Component: general Version: devel
Severity: normal Keywords: chrome
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christopher Lenz)

In r2064, trac.web.chrome.add_stylesheet() always makes a href to standard htdocs location. So webadmin and helloworldplugin cannot use its own css file.

Attached patch checks whether the specified stylesheet file is in trac's standard htdocs directory. If exist, makes href /trac/css/xxx.cs, or /proj/chrome/css/xxx.cs.

BTW, This means plugin cannot override existing one. Is it good? I think it might be ok that we always make link via /proj/chrome/

Attachments (2)

chrome.py-plugin-aware-add_stylesheet.patch (3.0 KB ) - added by Shunichi Goto <gotoh@…> 19 years ago.
Patch of add_stylesheet() to support plugin's stylesheet
chrome.py-plugin-aware-add_stylesheet-2.patch (1.0 KB ) - added by Shunichi Goto <gotoh@…> 19 years ago.
Replaced. Previous attachment contains unused codes for my debug, sorry

Download all attachments as: .zip

Change History (5)

by Shunichi Goto <gotoh@…>, 19 years ago

Patch of add_stylesheet() to support plugin's stylesheet

by Shunichi Goto <gotoh@…>, 19 years ago

Replaced. Previous attachment contains unused codes for my debug, sorry

comment:1 by Christopher Lenz, 19 years ago

Milestone: 0.9
Owner: changed from Jonas Borgström to Christopher Lenz
Priority: normallow
Status: newassigned

Note that this is only true if you have the htdocs_location set in trac.ini. If the option is omitted or left blank, the /chrome/ path will be used for all static file URLs.

Anyway, I'm planning to improve both add_stylesheet and the ITemplateProvider extension point to fix this issue.

comment:2 by Christopher Lenz, 19 years ago

Description: modified (diff)

(Fix formatting in description)

comment:3 by Christopher Lenz, 19 years ago

Priority: lowhigh
Resolution: fixed
Status: assignedclosed

Fixed in [2133].

Now there's no longer a htdocs_location option that gets special handling. All static resources are served by Trac unless you configure the web server otherwise, for example:

    Alias /trac.cgi/chrome/common /usr/share/trac/htdocs
    ScriptAlias /trac.cgi /usr/share/trac/cgi-bin/trac.cgi
    ...

Note that the Alias for mapping the static resources to a directory needs to be before the ScriptAlias.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.