Changeset 2466
- Timestamp:
- 07/13/07 16:03:43 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tracmetrixplugin/0.11/tracmetrixplugin/templates/mdashboard.html
r2459 r2466 76 76 </div> 77 77 </div> 78 79 78 80 79 <div> <img src="${href.mdashboard(' cummulativeflow_%s.png' % (milestone.name,))}"/></div>81 <div> <img src="${href.mdashboard('%s/cummulativeflow.png' % (milestone.name,))}"/></div> 80 82 81 83 tracmetrixplugin/0.11/tracmetrixplugin/web_ui.py
r2459 r2466 9 9 import os 10 10 11 from string import find 11 12 from bisect import bisect 12 13 from itertools import groupby … … 21 22 22 23 from trac import __version__ 24 from trac import mimeview 23 25 from trac.core import * 24 26 from trac.context import Context … … 335 337 import re, urllib 336 338 339 self.env.log.info("mdashboard match request %s" % (req.path_info,)) 340 337 341 match = re.match(r'/mdashboard(?:/(.+))?', req.path_info) 338 342 339 343 if match: 340 344 if match.group(1): 341 req.args['id'] = match.group(1) 345 346 # split the milestone name. This part can be 'milestone name' or 347 # 'milestone name/image name' 348 349 urlcomp = match.group(1).split('/') 350 351 if len(urlcomp) == 1: #url has 2 352 req.args['id'] = urlcomp[0] 353 req.args['imagename'] = None 354 else: 355 req.args['id'] = urlcomp[0] 356 req.args['imagename'] = urlcomp[1] 357 342 358 return True 343 344 359 # This code should do what above does. 345 360 #req.path_info.startswith('/mdashboard') … … 352 367 milestone_id = req.args.get('id') 353 368 369 self.env.log.info("mdashboard process request %s, %s" % (req.path_info,req.args.get('id'))) 370 354 371 add_link(req, 'up', req.href.pdashboard(), 'Dashboard') 355 372 … … 358 375 359 376 if not milestone_id: 360 req.redirect(req.href.pdashboard()) 361 362 add_stylesheet(req, 'pd/css/dashboard.css') 363 364 return self._render_view(req, db, milestone) 365 366 377 req.redirect(req.href.pdashboard()) 378 379 if req.args.get('imagename') == 'cummulativeflow.png': 380 381 self.env.log.info("request for image") 382 filename = "cummulativeflow_%s.png" % (milestone.name,) 383 path = os.path.join(self.env.path, 'cache', 'tracmetrixplugin', filename) 384 req.send_file(path, mimeview.get_mimetype(path)) 385 386 else: 387 388 self.env.log.info("request mdashboard") 389 390 add_stylesheet(req, 'pd/css/dashboard.css') 391 392 return self._render_view(req, db, milestone) 367 393 368 394 … … 567 593 # IRequestHandler methods 568 594 595 569 596 def match_request(self, req): 597 598 self.env.log.info("pdashboard match request %s" % (req.path_info,)) 599 570 600 return re.match(r'/pdashboard/?', req.path_info) is not None 571 601
