def prepare_request(req, environ): href = Href(req.href.all()) anenv = get_allenv(environ, req) req.href = href req.abs_href = Href(req.abs_href.all()) chrome = Chrome(anenv) update_request(req, chrome) # auth must be checked before this method runs, we are not a component yet req.perm = PermissionCache(anenv, req.authname) req.session = Session(anenv, req) loadpaths = chrome.get_all_templates_dirs(); loadpaths.insert(0, os.path.dirname(__file__) + "/templates/") req.hdf = {} populate_hdf(req.hdf, anenv, req) # after populate, add styles and scripts path_info = environ.get('PATH_INFO', '').lstrip('/').split('/') env_name = path_info.pop(0) if len(path_info) == 0 or (len(path_info) == 1 and path_info[0] == ''): add_stylesheet(req, "tram/css/project-list.css") elif path_info[0] == 'roadmap': add_stylesheet(req, 'common/css/roadmap.css') elif path_info[0] == 'timeline': add_stylesheet(req, 'common/css/timeline.css') elif path_info[0] == 'query': add_stylesheet(req, 'common/css/report.css') elif path_info[0] == 'browser': add_stylesheet(req, 'common/css/browser.css') elif path_info[0] == 'search': add_stylesheet(req, 'common/css/search.css') add_stylesheet(req, 'tram/css/whole-search.css') add_script(req, 'tram/js/jquery-1.1.2.pack.js') add_script(req, 'tram/js/jquery.compat-1.0.js') add_script(req, 'tram/js/trac_ws.js') chrome.populate_hdf(req) req.hdf['tram.version'] = "0.3" req.hdf["tram_htdocs_location"] = req.hdf["htdocs_location"].replace("common", "tram") # We want to display the guide whether we are using an "all" env or not # As the elements are already ordered we hijac the about element and reassign it below req.hdf['chrome.nav.metanav.about'] = Markup('<a href="' + href.wiki('TracGuide') + '">Help/Guide</a>') req.hdf['chrome.nav.metanav.help'] = Markup('<a href="' + href.about() + '">About Trac</a>') # Here we are adding some links to plugins as they seem not to be loading now... if (anenv.isall): req.hdf['chrome.nav.mainnav.wiki'] = Markup('<a href="' + href.wiki() + '">Wiki</a>') req.hdf['chrome.nav.mainnav.timeline'] = Markup('<a href="' + href.timeline() + '">' + _('Timeline') + '</a>') req.hdf['chrome.nav.mainnav.roadmap'] = Markup('<a href="' + href.roadmap() + '">' + _('Roadmap') + '</a>') req.hdf['chrome.nav.mainnav.browser'] = Markup('<a href="' + href.browser('/') + '">' + _('Browse Source') + '</a>') req.hdf['chrome.nav.mainnav.tickets'] = Markup('<a href="' + href.query() + '">' + _('View Tickets') + '</a>') req.hdf['chrome.nav.mainnav.search'] = Markup('<a href="' + href.search() + '">' + _('Search') + '</a>') return chrome