how to extend an existing Admin panel page?

21 views
Skip to first unread message

Brettschneider Falk

unread,
Jun 18, 2012, 4:31:25 AM6/18/12
to trac...@googlegroups.com
Hi,

while programming on http://trac-hacks.org/wiki/SimpleMultiProjectPlugin this question occurs to us:
Currently, we have an additional page Admin=>Projects=>Components for mapping the components to certain projects. We'd rather use the already existing edit page of Admin=>TicketSystem=>Components to add a multi-selection box for projects there. What is the data manipulation hook for those pages?

There is http://www.edgewall.org/docs/branches-0.12-stable/epydoc/trac.web.api.IRequestFilter-class.html but it doesn't work for us with Admin panels, or we made a simple stupid mistake in using it. We know how to edit the component edit web page on client side, but we need the something we can hook on on server side to let the plugin do its work there.

CU, F@lk

----
Falk Brettschneider
R&D Software
Baumer Optronic GmbH
www.baumer.com


Gesch?ftsf?hrer: Marcel Seeber * Dr. Oliver Vietze
Sitz der Gesellschaft: Radeberg
Amtsgericht Dresden: HRB 15379
Ust. ID: DE 189714583


RjOllos

unread,
Jun 19, 2012, 4:08:36 AM6/19/12
to trac...@googlegroups.com


On Monday, June 18, 2012 1:31:25 AM UTC-7, Brettschneider Falk wrote:
while programming on http://trac-hacks.org/wiki/SimpleMultiProjectPlugin this question occurs to us:
Currently, we have an additional page Admin=>Projects=>Components for mapping the components to certain projects. We'd rather use the already existing edit page of Admin=>TicketSystem=>Components to add a multi-selection box for projects there. What is the data manipulation hook for those pages?

There is http://www.edgewall.org/docs/branches-0.12-stable/epydoc/trac.web.api.IRequestFilter-class.html but it doesn't work for us with Admin panels, or we made a simple stupid mistake in using it. We know how to edit the component edit web page on client side, but we need the something we can hook on on server side to let the plugin do its work there.


I think you'll want to work with ITemplateStreamFilter, to implement something like this:
 


from genshi.builder import tag
from genshi.filters import Transformer
from trac.core import *
from trac.web.api import ITemplateStreamFilter

class AdminPanelStreamFilter(Component):
    implements(ITemplateStreamFilter)       
   
    def filter_stream(self, req, method, filename, stream, data):
       
        if req.path_info == '/admin/general/logging':
            stream = stream | Transformer("//div[@class='field']//input[@id='log_file']").after(
                tag.input(type='button', value='Browse...'))
       
        return stream




RjOllos

unread,
Jun 19, 2012, 1:32:15 PM6/19/12
to trac...@googlegroups.com


On Monday, June 18, 2012 1:31:25 AM UTC-7, Brettschneider Falk wrote:
We know how to edit the component edit web page on client side, but we need the something we can hook on on server side to let the plugin do its work there.

Just wondering how you would propose to do this client side. Using jQuery? (just a guess, I don't know how to go about this using jQuery).
Reply all
Reply to author
Forward
0 new messages