Index: trunk/extendedversion/htdocs/css/version.css
===================================================================
--- trunk/extendedversion/htdocs/css/version.css	(revision 16179)
+++ trunk/extendedversion/htdocs/css/version.css	(working copy)
@@ -14,4 +14,7 @@
 .milestone .info h3 :link:hover, .milestone .info h3 :visited:hover {
  color: #000;
 }
-.milestone .info h3 em { color: #b00; font-style: normal }
\ No newline at end of file
+.milestone .info h3 em { color: #b00; font-style: normal }
+.milestone .milestones {
+    border: 1px solid lightgray;
+}
Index: trunk/extendedversion/milestone.py
===================================================================
--- trunk/extendedversion/milestone.py	(revision 16179)
+++ trunk/extendedversion/milestone.py	(working copy)
@@ -143,21 +143,21 @@
         return stream | filter
 
     def _version_display(self, req, milestone):
-        db = self.env.get_db_cnx()
-        cursor = db.cursor()
-        cursor.execute("""
-            SELECT version FROM milestone_version
-            WHERE milestone=%s""", (milestone,))
-        row = cursor.fetchone()
+        with self.env.db_transaction as db:
+            cursor = db.cursor()
+            cursor.execute("""
+                SELECT version FROM milestone_version
+                WHERE milestone=%s""", (milestone,))
+            row = cursor.fetchone()
 
-        if row:
-            ver = row[0]
-            resource = Resource('milestone', milestone)
-            context = Context.from_request(req, resource)
-            link = VisibleVersion(self.env)._render_link(context, ver, ver)
-            return tag.span("; For ", link, class_='date')
-        else:
-            return []
+            if row:
+                ver = row[0]
+                resource = Resource('milestone', milestone)
+                context = Context.from_request(req, resource)
+                link = VisibleVersion(self.env)._render_link(context, ver, ver)
+                return tag.span("; For ", link, class_='date')
+            else:
+                return []
 
     def _version_edit(self, data):
         if data.get('milestone'):
@@ -164,26 +164,26 @@
             milestone = data.get('milestone').name
         else:
             milestone = ""
-        db = self.env.get_db_cnx()
-        cursor = db.cursor()
-        cursor.execute("""
-            SELECT version FROM milestone_version
-            WHERE milestone=%s""", (milestone,))
-        row = cursor.fetchone()
-        value = row and row[0]
+        with self.env.db_transaction as db:
+            cursor = db.cursor()
+            cursor.execute("""
+                SELECT version FROM milestone_version
+                WHERE milestone=%s""", (milestone,))
+            row = cursor.fetchone()
+            value = row and row[0]
 
-        cursor.execute("""
-            SELECT name FROM version
-            WHERE time IS NULL OR time = 0 OR time>%s OR name = %s
-            ORDER BY name""", (to_timestamp(None), value))
+            cursor.execute("""
+                SELECT name FROM version
+                WHERE time IS NULL OR time = 0 OR time>%s OR name = %s
+                ORDER BY name""", (to_timestamp(None), value))
 
-        return tag.div(
-            tag.label(
-                'Version:',
-                tag.br(),
-                tag.select(
-                    tag.option(),
-                    [tag.option(row[0], selected=(value == row[0] or None))
-                     for row in cursor],
-                    name="version")),
-            class_="field")
+            return tag.div(
+                tag.label(
+                    'Version:',
+                    tag.br(),
+                    tag.select(
+                        tag.option(),
+                        [tag.option(row[0], selected=(value == row[0] or None))
+                         for row in cursor],
+                        name="version")),
+                class_="field")
Index: trunk/extendedversion/roadmap.py
===================================================================
--- trunk/extendedversion/roadmap.py	(revision 16179)
+++ trunk/extendedversion/roadmap.py	(working copy)
@@ -11,6 +11,7 @@
 from datetime import datetime
 
 from genshi.builder import tag
+from trac.config import BoolOption
 from trac.core import Component, implements
 from trac.resource import Resource
 from trac.ticket.model import Version
@@ -20,10 +21,16 @@
 from trac.web.api import IRequestHandler
 from trac.web.chrome import INavigationContributor, add_stylesheet
 
+from extendedversion.version import VisibleVersion
 
 class ReleasesModule(Component):
     implements(INavigationContributor, IRequestHandler)
 
+    show_tickets_in_overview = BoolOption('extended_version', 'show_tickets_in_overview', True,
+        """whether to display the ticket bars in the version overview page.""")
+    show_milestones_in_overview = BoolOption('extended_version', 'show_milestones_in_overview', False,
+        """whether to display milestone information in the overview page.""")
+                                                     
     # INavigationContributor methods
 
     def get_active_navigation_item(self, req):
@@ -47,8 +54,10 @@
         req.perm.require('VERSION_VIEW')
 
         showall = req.args.get('show') == 'all'
+        version_component = self.env[VisibleVersion]
 
         versions = []
+        version_datasets = []
         for version in Version.select(self.env):
             resource = Resource('version', version.name)
             is_released = version.time and version.time < datetime.now(utc)
@@ -58,13 +67,21 @@
                 version.is_released = is_released
                 version.resource = resource
                 versions.append(version)
+                with self.env.db_transaction as db:
+                    version_data = version_component.get_version_data(req, db, version)
+                version_datasets.append(version_data)
 
         versions.reverse()
+        version_datasets.reverse()
 
         data = {
             'versions': versions,
             'showall': showall,
-            'roadmapmodule_disabled': not self.env.enabled[RoadmapModule]
+            'roadmapmodule_disabled': not self.env.enabled[RoadmapModule],
+            'show_tickets_in_overview' : self.show_tickets_in_overview,
+            'show_milestones_in_overview' : self.show_milestones_in_overview,
+            'version_datasets' : version_datasets,
         }
         add_stylesheet(req, 'common/css/roadmap.css')
+        add_stylesheet(req, 'extendedversion/css/roadmap.css')
         return 'versions.html', data, None
Index: trunk/extendedversion/templates/versions.html
===================================================================
--- trunk/extendedversion/templates/versions.html	(revision 16179)
+++ trunk/extendedversion/templates/versions.html	(working copy)
@@ -5,7 +5,9 @@
       xmlns:py="http://genshi.edgewall.org/"
       xmlns:xi="http://www.w3.org/2001/XInclude">
   <xi:include href="layout.html" />
-  <xi:include href="macros.html" />
+  <py:def function="progress_bar(stats, interval_hrefs, percent=None, legend=True, style=None, stats_href=None)">
+      <xi:include href="progress_bar.html"/>
+    </py:def>
   <head>
     <title>Roadmap</title>
   </head>
@@ -25,10 +27,10 @@
         </div>
       </form>
 
-      <ul class="milestones">
-        <li py:for="version in versions" class="milestone">
+      <div class="milestones">
+        <div py:for="idx, version in enumerate(versions)" class="milestone">
 
-          <div class="info">
+          <div class="info trac-progress">
             <h2><a href="${href.version(version.name)}">
               Version: <em>${version.name}</em>
             </a></h2>
@@ -45,6 +47,16 @@
                 No date set
               </p>
             </py:choose>
+            <py:if test="show_tickets_in_overview and version_datasets[idx].stats.count">
+              <table><tr>
+                <td>
+                  Milestone tickets
+                </td>
+                <td>
+                  ${progress_bar(version_datasets[idx].stats, version_datasets[idx].interval_hrefs)}
+                </td>
+              </tr></table>
+            </py:if>
           </div>
 
           <div class="description" xml:space="preserve">
@@ -51,8 +63,25 @@
             ${wiki_to_html(context(version.resource), version.description)}
           </div>
 
-        </li>
-      </ul>
+          <div py:if="show_milestones_in_overview and version_datasets[idx].milestones">
+            <h3>Milestones</h3>
+              <table class="milestones">
+                <py:for each="idx2, milestone in enumerate(version_datasets[idx].milestones)">
+                  <tr class="milestone">
+                    <td class="info">
+                      <a href="${href.milestone(milestone.name)}">
+                        ${milestone.name}
+                      </a>
+                    </td>
+                  <td py:with="mstats = version_datasets[idx].milestone_stats[idx2]" class="info trac-progress">
+                    <py:if test="mstats.stats.count">${progress_bar(mstats.stats, mstats.interval_hrefs, legend=False, stats_href=mstats.stats_href)}</py:if>
+                  </td>
+                </tr>
+              </py:for>
+            </table>
+          </div>
+        </div>
+      </div>
 
       <py:with vars="version_create = 'VERSION_CREATE' in perm;
                      milestone_create = roadmapmodule_disabled and 'MILESTONE_CREATE' in perm;">
Index: trunk/extendedversion/version.py
===================================================================
--- trunk/extendedversion/version.py	(revision 16179)
+++ trunk/extendedversion/version.py	(working copy)
@@ -153,30 +153,30 @@
         version_id = req.args.get('id')
         req.perm('version', version_id).require('VERSION_VIEW')
 
-        db = self.env.get_db_cnx()
-        version = Version(self.env, version_id, db)
-        action = req.args.get('action', 'view')
+        with self.env.db_transaction as db:
+            version = Version(self.env, version_id)
+            action = req.args.get('action', 'view')
 
-        if req.method == 'POST':
-            if 'cancel' in req.args:
-                if version.exists:
-                    req.redirect(req.href.version(version.name))
-                else:
-                    req.redirect(req.href.versions())
-            elif action == 'edit':
-                return self._do_save(req, db, version)
+            if req.method == 'POST':
+                if 'cancel' in req.args:
+                    if version.exists:
+                        req.redirect(req.href.version(version.name))
+                    else:
+                        req.redirect(req.href.versions())
+                elif action == 'edit':
+                    return self._do_save(req, db, version)
+                elif action == 'delete':
+                    self._do_delete(req, db, version)
+            elif action in ('new', 'edit'):
+                return self._render_editor(req, db, version)
             elif action == 'delete':
-                self._do_delete(req, db, version)
-        elif action in ('new', 'edit'):
-            return self._render_editor(req, db, version)
-        elif action == 'delete':
-            return self._render_confirm(req, db, version)
+                return self._render_confirm(req, db, version)
 
-        if not version.name:
-            req.redirect(req.href.versions())
+            if not version.name:
+                req.redirect(req.href.versions())
 
-        add_stylesheet(req, 'common/css/roadmap.css')
-        return self._render_view(req, db, version)
+            add_stylesheet(req, 'common/css/roadmap.css')
+            return self._render_view(req, db, version)
 
     # IResourceManager methods
 
@@ -223,6 +223,39 @@
     def get_link_resolvers(self):
         yield ('version', self._format_link)
 
+    # Utility methods
+    def get_version_data(self, req, db, version):
+        sql = "SELECT name,due,completed,description FROM milestone " \
+              "INNER JOIN milestone_version ON (name = milestone) " \
+              "WHERE version = %s " \
+              "ORDER BY name "
+        cursor = db.cursor()
+        cursor.execute(sql, (version.name,))
+
+        milestones = []
+        tickets = []
+        milestone_stats = []
+
+        for row in cursor:
+            milestone = Milestone(self.env, row[0])
+            milestones.append(milestone)
+
+            mtickets = get_tickets_for_milestone(self.env, milestone.name, 'owner')
+            mtickets = apply_ticket_permissions(self.env, req, mtickets)
+            tickets += mtickets
+            stat = get_ticket_stats(self.milestone_stats_provider, mtickets)
+            milestone_stats.append(milestone_stats_data(self.env, req, stat, milestone.name))
+            
+        stats = get_ticket_stats(self.version_stats_provider, tickets)
+        interval_hrefs = version_interval_hrefs(self.env, req, stats, [ milestone.name for milestone in milestones ])
+        data = {
+            'stats' : stats,
+            'interval_hrefs' : interval_hrefs,
+            'milestones' : milestones,
+            'milestone_stats' : milestone_stats,
+        }
+        return data
+    
     # Internal methods
 
     def _do_delete(self, req, db, version):
@@ -366,42 +399,14 @@
 
     def _render_view(self, req, db, version):
 
-        db = self.env.get_db_cnx()
-        cursor = db.cursor()
-        cursor.execute("""
-            SELECT name FROM milestone
-              INNER JOIN milestone_version ON (name = milestone)
-            WHERE version = %s
-            ORDER BY due""", (version.name,))
-
-        milestones = []
-        tickets = []
-        milestone_stats = []
-
-        for row in cursor:
-            milestone = Milestone(self.env, row[0])
-            milestones.append(milestone)
-
-            mtickets = get_tickets_for_milestone(self.env, db, milestone.name,
-                                                 'owner')
-            mtickets = apply_ticket_permissions(self.env, req, mtickets)
-            tickets += mtickets
-            stat = get_ticket_stats(self.milestone_stats_provider, mtickets)
-            milestone_stats.append(milestone_stats_data(self.env, req, stat,
-                                                        milestone.name))
-
-        stats = get_ticket_stats(self.version_stats_provider, tickets)
-        interval_hrefs = version_interval_hrefs(self.env, req, stats,
-                                                [milestone.name
-                                                 for milestone in milestones])
-
+        version_data = self.get_version_data(req, db, version)
         version.resource = Resource('version', version.name)
         context = Context.from_request(req, version.resource)
 
         version.is_released = version.time \
             and version.time < datetime.now(utc)
-        version.stats = stats
-        version.interval_hrefs = interval_hrefs
+        version.stats = version_data['stats']
+        version.interval_hrefs = version_data['interval_hrefs']
         names = [milestone.name for milestone in milestones]
         version.stats_href = version_stats_href(self.env, req, names)
         data = {
@@ -408,8 +413,8 @@
             'version': version,
             'attachments': AttachmentModule(self.env)
                            .attachment_data(context),
-            'milestones': milestones,
-            'milestone_stats': milestone_stats,
+            'milestones': version_data['milestones'],
+            'milestone_stats': version_data['milestone_stats'],
             'show_milestone_description': self.show_milestone_description  # Not implemented yet
         }
 
