Show More
@@ -1,108 +1,113 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # encoding: utf-8 |
|
3 | 3 | # summary controller for pylons |
|
4 | 4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
5 | 5 | # |
|
6 | 6 | # This program is free software; you can redistribute it and/or |
|
7 | 7 | # modify it under the terms of the GNU General Public License |
|
8 | 8 | # as published by the Free Software Foundation; version 2 |
|
9 | 9 | # of the License or (at your opinion) any later version of the license. |
|
10 | 10 | # |
|
11 | 11 | # This program is distributed in the hope that it will be useful, |
|
12 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | # GNU General Public License for more details. |
|
15 | 15 | # |
|
16 | 16 | # You should have received a copy of the GNU General Public License |
|
17 | 17 | # along with this program; if not, write to the Free Software |
|
18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 | # MA 02110-1301, USA. |
|
20 | 20 | """ |
|
21 | 21 | Created on April 18, 2010 |
|
22 | 22 | summary controller for pylons |
|
23 | 23 | @author: marcink |
|
24 | 24 | """ |
|
25 | 25 | from pylons import tmpl_context as c, request, url |
|
26 | 26 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
27 | 27 | from rhodecode.lib.base import BaseController, render |
|
28 | 28 | from rhodecode.lib.utils import OrderedDict |
|
29 | 29 | from rhodecode.model.hg import HgModel |
|
30 | 30 | from rhodecode.model.db import Statistics |
|
31 | 31 | from webhelpers.paginate import Page |
|
32 | 32 | from rhodecode.lib.celerylib import run_task |
|
33 | 33 | from rhodecode.lib.celerylib.tasks import get_commits_stats |
|
34 | 34 | from datetime import datetime, timedelta |
|
35 | 35 | from time import mktime |
|
36 | 36 | import calendar |
|
37 | 37 | import logging |
|
38 | 38 | try: |
|
39 | 39 | import json |
|
40 | 40 | except ImportError: |
|
41 | 41 | #python 2.5 compatibility |
|
42 | 42 | import simplejson as json |
|
43 | 43 | log = logging.getLogger(__name__) |
|
44 | 44 | |
|
45 | 45 | class SummaryController(BaseController): |
|
46 | ||
|
46 | ||
|
47 | 47 | @LoginRequired() |
|
48 | 48 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
49 |
'repository.admin') |
|
|
49 | 'repository.admin') | |
|
50 | 50 | def __before__(self): |
|
51 | 51 | super(SummaryController, self).__before__() |
|
52 | ||
|
52 | ||
|
53 | 53 | def index(self): |
|
54 | 54 | hg_model = HgModel() |
|
55 | 55 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
56 | c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20) | |
|
56 | def url_generator(**kw): | |
|
57 | return url('shortlog_home', repo_name=c.repo_name, **kw) | |
|
58 | ||
|
59 | c.repo_changesets = Page(c.repo_info, page=1, items_per_page=10, | |
|
60 | url=url_generator) | |
|
61 | ||
|
57 | 62 | e = request.environ |
|
58 | ||
|
63 | ||
|
59 | 64 | uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % { |
|
60 | 65 | 'protocol': e.get('wsgi.url_scheme'), |
|
61 | 66 | 'user':str(c.rhodecode_user.username), |
|
62 | 67 | 'host':e.get('HTTP_HOST'), |
|
63 | 68 | 'prefix':e.get('SCRIPT_NAME'), |
|
64 | 69 | 'repo_name':c.repo_name, } |
|
65 | 70 | c.clone_repo_url = uri |
|
66 | 71 | c.repo_tags = OrderedDict() |
|
67 | 72 | for name, hash in c.repo_info.tags.items()[:10]: |
|
68 | 73 | c.repo_tags[name] = c.repo_info.get_changeset(hash) |
|
69 | ||
|
74 | ||
|
70 | 75 | c.repo_branches = OrderedDict() |
|
71 | 76 | for name, hash in c.repo_info.branches.items()[:10]: |
|
72 | 77 | c.repo_branches[name] = c.repo_info.get_changeset(hash) |
|
73 | ||
|
74 |
td = datetime.today() + timedelta(days=1) |
|
|
78 | ||
|
79 | td = datetime.today() + timedelta(days=1) | |
|
75 | 80 | y, m, d = td.year, td.month, td.day |
|
76 | ||
|
81 | ||
|
77 | 82 | ts_min_y = mktime((y - 1, (td - timedelta(days=calendar.mdays[m])).month, |
|
78 | 83 | d, 0, 0, 0, 0, 0, 0,)) |
|
79 | 84 | ts_min_m = mktime((y, (td - timedelta(days=calendar.mdays[m])).month, |
|
80 | 85 | d, 0, 0, 0, 0, 0, 0,)) |
|
81 | ||
|
86 | ||
|
82 | 87 | ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) |
|
83 | ||
|
88 | ||
|
84 | 89 | run_task(get_commits_stats, c.repo_info.name, ts_min_y, ts_max_y) |
|
85 | 90 | c.ts_min = ts_min_m |
|
86 | 91 | c.ts_max = ts_max_y |
|
87 | ||
|
92 | ||
|
88 | 93 | stats = self.sa.query(Statistics)\ |
|
89 | 94 | .filter(Statistics.repository == c.repo_info.dbrepo)\ |
|
90 | 95 | .scalar() |
|
91 | ||
|
92 | ||
|
96 | ||
|
97 | ||
|
93 | 98 | if stats and stats.languages: |
|
94 | 99 | lang_stats = json.loads(stats.languages) |
|
95 | 100 | c.commit_data = stats.commit_activity |
|
96 | 101 | c.overview_data = stats.commit_activity_combined |
|
97 | 102 | c.trending_languages = json.dumps(OrderedDict( |
|
98 | 103 | sorted(lang_stats.items(), reverse=True, |
|
99 | 104 | key=lambda k: k[1])[:2] |
|
100 | 105 | ) |
|
101 | 106 | ) |
|
102 | 107 | else: |
|
103 | 108 | c.commit_data = json.dumps({}) |
|
104 | 109 | c.overview_data = json.dumps([[ts_min_y, 0], [ts_max_y, 0] ]) |
|
105 | 110 | c.trending_languages = json.dumps({}) |
|
106 | ||
|
111 | ||
|
107 | 112 | return render('summary/summary.html') |
|
108 | 113 |
@@ -1,283 +1,283 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|
3 | 3 | <html xmlns="http://www.w3.org/1999/xhtml" id="mainhtml"> |
|
4 | 4 | <head> |
|
5 | 5 | <title>${next.title()}</title> |
|
6 | 6 | <link rel="icon" href="/images/hgicon.png" type="image/png" /> |
|
7 | 7 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
|
8 | 8 | <meta name="robots" content="index, nofollow"/> |
|
9 | 9 | <!-- stylesheets --> |
|
10 | 10 | ${self.css()} |
|
11 | 11 | <!-- scripts --> |
|
12 | 12 | ${self.js()} |
|
13 | 13 | </head> |
|
14 | 14 | <body> |
|
15 | 15 | <!-- header --> |
|
16 | 16 | <div id="header"> |
|
17 | 17 | <!-- user --> |
|
18 | 18 | <ul id="logged-user"> |
|
19 | 19 | <li class="first"> |
|
20 | 20 | <div class="gravatar"> |
|
21 | 21 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,24)}" /> |
|
22 | 22 | </div> |
|
23 | 23 | <div class="account"> |
|
24 | 24 | ${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/> |
|
25 | 25 | ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))} |
|
26 | 26 | </div> |
|
27 | 27 | </li> |
|
28 | 28 | <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li> |
|
29 | 29 | </ul> |
|
30 | 30 | <!-- end user --> |
|
31 | 31 | <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner"> |
|
32 | 32 | <!-- logo --> |
|
33 | 33 | <div id="logo"> |
|
34 | 34 | <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1> |
|
35 | 35 | </div> |
|
36 | 36 | <!-- end logo --> |
|
37 | 37 | <!-- menu --> |
|
38 | 38 | ${self.page_nav()} |
|
39 | 39 | <!-- quick --> |
|
40 | 40 | </div> |
|
41 | 41 | </div> |
|
42 | 42 | <!-- end header --> |
|
43 | 43 | |
|
44 | 44 | <!-- CONTENT --> |
|
45 | 45 | <div id="content"> |
|
46 | 46 | <div class="flash_msg"> |
|
47 | 47 | <% messages = h.flash.pop_messages() %> |
|
48 | 48 | % if messages: |
|
49 | 49 | <ul id="flash-messages"> |
|
50 | 50 | % for message in messages: |
|
51 | 51 | <li class="${message.category}_msg">${message}</li> |
|
52 | 52 | % endfor |
|
53 | 53 | </ul> |
|
54 | 54 | % endif |
|
55 | 55 | </div> |
|
56 | 56 | <div id="main"> |
|
57 | 57 | ${next.main()} |
|
58 | 58 | </div> |
|
59 | 59 | </div> |
|
60 | 60 | <!-- END CONTENT --> |
|
61 | 61 | |
|
62 | 62 | <!-- footer --> |
|
63 | 63 | <div id="footer"> |
|
64 | 64 | <div id="footer-inner" class="title bottom-left-rounded-corner bottom-right-rounded-corner"> |
|
65 | 65 | <div> |
|
66 | 66 | <p class="footer-link">${h.link_to(_('Submit a bug'),h.url('bugtracker'))}</p> |
|
67 | 67 | <p class="footer-link">${h.link_to(_('GPL license'),h.url('gpl_license'))}</p> |
|
68 | 68 | <p>RhodeCode ${c.rhodecode_version} © 2010 by Marcin Kuzminski</p> |
|
69 | 69 | </div> |
|
70 | 70 | </div> |
|
71 | 71 | <script type="text/javascript">${h.tooltip.activate()}</script> |
|
72 | 72 | </div> |
|
73 | 73 | <!-- end footer --> |
|
74 | 74 | </body> |
|
75 | 75 | |
|
76 | 76 | </html> |
|
77 | 77 | |
|
78 | 78 | ### MAKO DEFS ### |
|
79 | 79 | <%def name="page_nav()"> |
|
80 | 80 | ${self.menu()} |
|
81 | 81 | </%def> |
|
82 | 82 | |
|
83 | 83 | <%def name="menu(current=None)"> |
|
84 | 84 | <% |
|
85 | 85 | def is_current(selected): |
|
86 | 86 | if selected == current: |
|
87 | 87 | return h.literal('class="current"') |
|
88 | 88 | %> |
|
89 | 89 | %if current not in ['home','admin']: |
|
90 | 90 | ##REGULAR MENU |
|
91 | 91 | <ul id="quick"> |
|
92 | 92 | <!-- repo switcher --> |
|
93 | 93 | <li> |
|
94 | 94 | <a id="repo_switcher" title="${_('Switch repository')}" href="#"> |
|
95 | 95 | <span class="icon"> |
|
96 | 96 | <img src="/images/icons/database.png" alt="${_('Products')}" /> |
|
97 | 97 | </span> |
|
98 | 98 | <span>↓</span> |
|
99 | 99 | </a> |
|
100 | 100 | <ul class="repo_switcher"> |
|
101 | 101 | %for repo,private in c.repo_switcher_list: |
|
102 | 102 | %if private: |
|
103 | 103 | <li>${h.link_to(repo,h.url('summary_home',repo_name=repo),class_="private_repo")}</li> |
|
104 | 104 | %else: |
|
105 | 105 | <li>${h.link_to(repo,h.url('summary_home',repo_name=repo),class_="public_repo")}</li> |
|
106 | 106 | %endif |
|
107 | 107 | %endfor |
|
108 | 108 | </ul> |
|
109 | 109 | </li> |
|
110 | 110 | |
|
111 | 111 | <li ${is_current('summary')}> |
|
112 | 112 | <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}"> |
|
113 | 113 | <span class="icon"> |
|
114 | 114 | <img src="/images/icons/clipboard_16.png" alt="${_('Summary')}" /> |
|
115 | 115 | </span> |
|
116 | 116 | <span>${_('Summary')}</span> |
|
117 | 117 | </a> |
|
118 | 118 | </li> |
|
119 | <li ${is_current('shortlog')}> | |
|
120 | <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}"> | |
|
121 | <span class="icon"> | |
|
122 | <img src="/images/icons/application_view_list.png" alt="${_('Shortlog')}" /> | |
|
123 | </span> | |
|
124 | <span>${_('Shortlog')}</span> | |
|
125 | </a> | |
|
126 | </li> | |
|
119 | ##<li ${is_current('shortlog')}> | |
|
120 | ## <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}"> | |
|
121 | ## <span class="icon"> | |
|
122 | ## <img src="/images/icons/application_view_list.png" alt="${_('Shortlog')}" /> | |
|
123 | ## </span> | |
|
124 | ## <span>${_('Shortlog')}</span> | |
|
125 | ## </a> | |
|
126 | ##</li> | |
|
127 | 127 | <li ${is_current('changelog')}> |
|
128 | 128 | <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}"> |
|
129 | 129 | <span class="icon"> |
|
130 | 130 | <img src="/images/icons/time.png" alt="${_('Changelog')}" /> |
|
131 | 131 | </span> |
|
132 | 132 | <span>${_('Changelog')}</span> |
|
133 | 133 | </a> |
|
134 | 134 | </li> |
|
135 | 135 | |
|
136 | 136 | <li ${is_current('switch_to')}> |
|
137 | 137 | <a title="${_('Switch to')}" href="#"> |
|
138 | 138 | <span class="icon"> |
|
139 | 139 | <img src="/images/icons/arrow_switch.png" alt="${_('Switch to')}" /> |
|
140 | 140 | </span> |
|
141 | 141 | <span>${_('Switch to')}</span> |
|
142 | 142 | </a> |
|
143 | 143 | <ul> |
|
144 | 144 | <li> |
|
145 | ${h.link_to(_('branches'),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} | |
|
145 | ${h.link_to('%s (%s)' % (_('branches'),len(c.repository_branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} | |
|
146 | 146 | <ul> |
|
147 | 147 | %if c.repository_branches.values(): |
|
148 | 148 | %for cnt,branch in enumerate(c.repository_branches.items()): |
|
149 | 149 | <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li> |
|
150 | 150 | %endfor |
|
151 | 151 | %else: |
|
152 | 152 | <li>${h.link_to(_('There are no branches yet'),'#')}</li> |
|
153 | 153 | %endif |
|
154 | 154 | </ul> |
|
155 | 155 | </li> |
|
156 | 156 | <li> |
|
157 | ${h.link_to(_('tags'),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')} | |
|
157 | ${h.link_to('%s (%s)' % (_('tags'),len(c.repository_tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')} | |
|
158 | 158 | <ul> |
|
159 | 159 | %if c.repository_tags.values(): |
|
160 | 160 | %for cnt,tag in enumerate(c.repository_tags.items()): |
|
161 | 161 | <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li> |
|
162 | 162 | %endfor |
|
163 | 163 | %else: |
|
164 | 164 | <li>${h.link_to(_('There are no tags yet'),'#')}</li> |
|
165 | 165 | %endif |
|
166 | 166 | </ul> |
|
167 | 167 | </li> |
|
168 | 168 | </ul> |
|
169 | 169 | </li> |
|
170 | 170 | <li ${is_current('files')}> |
|
171 | 171 | <a title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}"> |
|
172 | 172 | <span class="icon"> |
|
173 | 173 | <img src="/images/icons/file.png" alt="${_('Files')}" /> |
|
174 | 174 | </span> |
|
175 | 175 | <span>${_('Files')}</span> |
|
176 | 176 | </a> |
|
177 | 177 | </li> |
|
178 | 178 | |
|
179 | 179 | <li ${is_current('options')}> |
|
180 | 180 | <a title="${_('Options')}" href="#"> |
|
181 | 181 | <span class="icon"> |
|
182 | 182 | <img src="/images/icons/table_gear.png" alt="${_('Admin')}" /> |
|
183 | 183 | </span> |
|
184 | 184 | <span>${_('Options')}</span> |
|
185 | 185 | </a> |
|
186 | 186 | <ul> |
|
187 | 187 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
188 | 188 | <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li> |
|
189 | 189 | %endif |
|
190 | 190 | <li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li> |
|
191 | 191 | <li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li> |
|
192 | 192 | |
|
193 | 193 | %if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
194 | 194 | <li> |
|
195 | 195 | ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')} |
|
196 | 196 | <ul> |
|
197 | 197 | <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li> |
|
198 | 198 | <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li> |
|
199 | 199 | <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li> |
|
200 | 200 | <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li> |
|
201 | 201 | <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li> |
|
202 | 202 | </ul> |
|
203 | 203 | </li> |
|
204 | 204 | %endif |
|
205 | 205 | |
|
206 | 206 | |
|
207 | 207 | ## %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
208 | 208 | ## <li class="last"> |
|
209 | 209 | ## ${h.link_to(_('delete'),'#',class_='delete')} |
|
210 | 210 | ## ${h.form(url('repo_settings_delete', repo_name=c.repo_name),method='delete')} |
|
211 | 211 | ## ${h.submit('remove_%s' % c.repo_name,'delete',class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")} |
|
212 | 212 | ## ${h.end_form()} |
|
213 | 213 | ## </li> |
|
214 | 214 | ## %endif |
|
215 | 215 | </ul> |
|
216 | 216 | </li> |
|
217 | 217 | </ul> |
|
218 | 218 | %else: |
|
219 | 219 | ##ROOT MENU |
|
220 | 220 | <ul id="quick"> |
|
221 | 221 | <li> |
|
222 | 222 | <a title="${_('Home')}" href="${h.url('home')}"> |
|
223 | 223 | <span class="icon"> |
|
224 | 224 | <img src="/images/icons/home_16.png" alt="${_('Home')}" /> |
|
225 | 225 | </span> |
|
226 | 226 | <span>${_('Home')}</span> |
|
227 | 227 | </a> |
|
228 | 228 | </li> |
|
229 | 229 | |
|
230 | 230 | <li> |
|
231 | 231 | <a title="${_('Search')}" href="${h.url('search')}"> |
|
232 | 232 | <span class="icon"> |
|
233 | 233 | <img src="/images/icons/search_16.png" alt="${_('Search')}" /> |
|
234 | 234 | </span> |
|
235 | 235 | <span>${_('Search')}</span> |
|
236 | 236 | </a> |
|
237 | 237 | </li> |
|
238 | 238 | |
|
239 | 239 | %if h.HasPermissionAll('hg.admin')('access admin main page'): |
|
240 | 240 | <li ${is_current('admin')}> |
|
241 | 241 | <a title="${_('Admin')}" href="${h.url('admin_home')}"> |
|
242 | 242 | <span class="icon"> |
|
243 | 243 | <img src="/images/icons/cog_edit.png" alt="${_('Admin')}" /> |
|
244 | 244 | </span> |
|
245 | 245 | <span>${_('Admin')}</span> |
|
246 | 246 | </a> |
|
247 | 247 | <ul> |
|
248 | 248 | <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li> |
|
249 | 249 | <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li> |
|
250 | 250 | <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li> |
|
251 | 251 | <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li> |
|
252 | 252 | <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li> |
|
253 | 253 | </ul> |
|
254 | 254 | </li> |
|
255 | 255 | %endif |
|
256 | 256 | |
|
257 | 257 | </ul> |
|
258 | 258 | %endif |
|
259 | 259 | </%def> |
|
260 | 260 | |
|
261 | 261 | |
|
262 | 262 | <%def name="css()"> |
|
263 | 263 | <link rel="stylesheet" type="text/css" href="/css/style.css" media="screen" /> |
|
264 | 264 | <link rel="stylesheet" type="text/css" href="/css/pygments.css" /> |
|
265 | 265 | <link rel="stylesheet" type="text/css" href="/css/diff.css" /> |
|
266 | 266 | </%def> |
|
267 | 267 | |
|
268 | 268 | <%def name="js()"> |
|
269 | 269 | ##<script type="text/javascript" src="/js/yui/utilities/utilities.js"></script> |
|
270 | 270 | ##<script type="text/javascript" src="/js/yui/container/container.js"></script> |
|
271 | 271 | ##<script type="text/javascript" src="/js/yui/datasource/datasource.js"></script> |
|
272 | 272 | ##<script type="text/javascript" src="/js/yui/autocomplete/autocomplete.js"></script> |
|
273 | 273 | |
|
274 | 274 | <script type="text/javascript" src="/js/yui2.js"></script> |
|
275 | 275 | <!--[if IE]><script language="javascript" type="text/javascript" src="/js/excanvas.min.js"></script><![endif]--> |
|
276 | 276 | <script type="text/javascript" src="/js/yui.flot.js"></script> |
|
277 | 277 | </%def> |
|
278 | 278 | |
|
279 | 279 | <%def name="breadcrumbs()"> |
|
280 | 280 | <div class="breadcrumbs"> |
|
281 | 281 | ${self.breadcrumbs_links()} |
|
282 | 282 | </div> |
|
283 | 283 | </%def> No newline at end of file |
@@ -1,593 +1,593 b'' | |||
|
1 | 1 | <%inherit file="/base/base.html"/> |
|
2 | 2 | |
|
3 | 3 | <%def name="title()"> |
|
4 | 4 | ${c.repo_name} ${_('Summary')} - ${c.rhodecode_name} |
|
5 | 5 | </%def> |
|
6 | 6 | |
|
7 | 7 | <%def name="breadcrumbs_links()"> |
|
8 | 8 | ${h.link_to(u'Home',h.url('/'))} |
|
9 | 9 | » |
|
10 | 10 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} |
|
11 | 11 | » |
|
12 | 12 | ${_('summary')} |
|
13 | 13 | </%def> |
|
14 | 14 | |
|
15 | 15 | <%def name="page_nav()"> |
|
16 | 16 | ${self.menu('summary')} |
|
17 | 17 | </%def> |
|
18 | 18 | |
|
19 | 19 | <%def name="main()"> |
|
20 | 20 | <script type="text/javascript"> |
|
21 | 21 | var E = YAHOO.util.Event; |
|
22 | 22 | var D = YAHOO.util.Dom; |
|
23 | 23 | |
|
24 | 24 | E.onDOMReady(function(e){ |
|
25 | 25 | id = 'clone_url'; |
|
26 | 26 | E.addListener(id,'click',function(e){ |
|
27 | 27 | D.get('clone_url').select(); |
|
28 | 28 | }) |
|
29 | 29 | }) |
|
30 | 30 | </script> |
|
31 | 31 | <div class="box box-left"> |
|
32 | 32 | <!-- box / title --> |
|
33 | 33 | <div class="title"> |
|
34 | 34 | ${self.breadcrumbs()} |
|
35 | 35 | </div> |
|
36 | 36 | <!-- end box / title --> |
|
37 | 37 | <div class="form"> |
|
38 | 38 | <div class="fields"> |
|
39 | 39 | |
|
40 | 40 | <div class="field"> |
|
41 | 41 | <div class="label"> |
|
42 | 42 | <label>${_('Name')}:</label> |
|
43 | 43 | </div> |
|
44 | 44 | <div class="input-short"> |
|
45 | ||
|
46 | %if c.repo_info.dbrepo.repo_type =='hg': | |
|
47 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/> | |
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 | ||
|
52 | %endif | |
|
45 | %if c.repo_info.dbrepo.repo_type =='hg': | |
|
46 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/> | |
|
47 | %endif | |
|
48 | %if c.repo_info.dbrepo.repo_type =='git': | |
|
49 | <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="/images/icons/giticon.png"/> | |
|
50 | %endif | |
|
53 | 51 | |
|
54 | 52 | %if c.repo_info.dbrepo.private: |
|
55 | 53 | <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/> |
|
56 | 54 | %else: |
|
57 | 55 | <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/> |
|
58 | 56 | %endif |
|
59 | 57 | <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span> |
|
60 | 58 | <br/> |
|
61 | 59 | %if c.repo_info.dbrepo.fork: |
|
62 | 60 | <span style="margin-top:5px"> |
|
63 | 61 | <a href="${h.url('summary_home',repo_name=c.repo_info.dbrepo.fork.repo_name)}"> |
|
64 | 62 | <img class="icon" alt="${_('public')}" |
|
65 | 63 | title="${_('Fork of')} ${c.repo_info.dbrepo.fork.repo_name}" |
|
66 | 64 | src="/images/icons/arrow_divide.png"/> |
|
67 | 65 | ${_('Fork of')} ${c.repo_info.dbrepo.fork.repo_name} |
|
68 | 66 | </a> |
|
69 | 67 | </span> |
|
70 | 68 | %endif |
|
71 | 69 | </div> |
|
72 | 70 | </div> |
|
73 | 71 | |
|
74 | 72 | |
|
75 | 73 | <div class="field"> |
|
76 | 74 | <div class="label"> |
|
77 | 75 | <label>${_('Description')}:</label> |
|
78 | 76 | </div> |
|
79 | 77 | <div class="input-short"> |
|
80 | 78 | ${c.repo_info.description} |
|
81 | 79 | </div> |
|
82 | 80 | </div> |
|
83 | 81 | |
|
84 | 82 | |
|
85 | 83 | <div class="field"> |
|
86 | 84 | <div class="label"> |
|
87 | 85 | <label>${_('Contact')}:</label> |
|
88 | 86 | </div> |
|
89 | 87 | <div class="input-short"> |
|
90 | 88 | <div class="gravatar"> |
|
91 | 89 | <img alt="gravatar" src="${h.gravatar_url(c.repo_info.dbrepo.user.email)}"/> |
|
92 | 90 | </div> |
|
93 | 91 | ${_('Username')}: ${c.repo_info.dbrepo.user.username}<br/> |
|
94 | 92 | ${_('Name')}: ${c.repo_info.dbrepo.user.name} ${c.repo_info.dbrepo.user.lastname}<br/> |
|
95 | 93 | ${_('Email')}: <a href="mailto:${c.repo_info.dbrepo.user.email}">${c.repo_info.dbrepo.user.email}</a> |
|
96 | 94 | </div> |
|
97 | 95 | </div> |
|
98 | 96 | |
|
99 | 97 | <div class="field"> |
|
100 | 98 | <div class="label"> |
|
101 | 99 | <label>${_('Last change')}:</label> |
|
102 | 100 | </div> |
|
103 | 101 | <div class="input-short"> |
|
104 | 102 | ${h.age(c.repo_info.last_change)} - ${c.repo_info.last_change} |
|
105 | 103 | ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author} |
|
106 | 104 | |
|
107 | 105 | </div> |
|
108 | 106 | </div> |
|
109 | 107 | |
|
110 | 108 | <div class="field"> |
|
111 | 109 | <div class="label"> |
|
112 | 110 | <label>${_('Clone url')}:</label> |
|
113 | 111 | </div> |
|
114 | 112 | <div class="input-short"> |
|
115 | 113 | <input type="text" id="clone_url" readonly="readonly" value="hg clone ${c.clone_repo_url}" size="70"/> |
|
116 | 114 | </div> |
|
117 | 115 | </div> |
|
118 | 116 | |
|
119 | 117 | <div class="field"> |
|
120 | 118 | <div class="label"> |
|
121 | 119 | <label>${_('Trending languages')}:</label> |
|
122 | 120 | </div> |
|
123 | 121 | <div class="input-short"> |
|
124 | 122 | <div id="lang_stats"> |
|
125 | 123 | |
|
126 | 124 | </div> |
|
127 | 125 | <script type="text/javascript"> |
|
128 | 126 | var data = ${c.trending_languages|n}; |
|
129 | 127 | var total = 0; |
|
130 | 128 | var no_data = true; |
|
131 | 129 | for (k in data){ |
|
132 | 130 | total += data[k]; |
|
133 | 131 | no_data = false; |
|
134 | 132 | } |
|
135 | 133 | var tbl = document.createElement('table'); |
|
136 | 134 | tbl.setAttribute('class','trending_language_tbl'); |
|
137 | 135 | for (k in data){ |
|
138 | 136 | var tr = document.createElement('tr'); |
|
139 | 137 | var percentage = Math.round((data[k]/total*100),2); |
|
140 | 138 | var value = data[k]; |
|
141 | 139 | var td1 = document.createElement('td'); |
|
142 | 140 | td1.width=150; |
|
143 | 141 | var trending_language_label = document.createElement('div'); |
|
144 | 142 | trending_language_label.innerHTML = k; |
|
145 | 143 | td1.appendChild(trending_language_label); |
|
146 | 144 | |
|
147 | 145 | var td2 = document.createElement('td'); |
|
148 | 146 | var trending_language = document.createElement('div'); |
|
149 | 147 | trending_language.title = k; |
|
150 | 148 | trending_language.innerHTML = "<b>"+percentage+"% "+value+" ${_('files')}</b>"; |
|
151 | 149 | trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner'); |
|
152 | 150 | trending_language.style.width=percentage+"%"; |
|
153 | 151 | td2.appendChild(trending_language); |
|
154 | 152 | |
|
155 | 153 | tr.appendChild(td1); |
|
156 | 154 | tr.appendChild(td2); |
|
157 | 155 | tbl.appendChild(tr); |
|
158 | 156 | |
|
159 | 157 | } |
|
160 | 158 | if(no_data){ |
|
161 | 159 | var tr = document.createElement('tr'); |
|
162 | 160 | var td1 = document.createElement('td'); |
|
163 | 161 | td1.innerHTML = "${_('No data loaded yet')}"; |
|
164 | 162 | tr.appendChild(td1); |
|
165 | 163 | tbl.appendChild(tr); |
|
166 | 164 | } |
|
167 | 165 | YAHOO.util.Dom.get('lang_stats').appendChild(tbl); |
|
168 | 166 | </script> |
|
169 | 167 | |
|
170 | 168 | </div> |
|
171 | 169 | </div> |
|
172 | 170 | |
|
173 | 171 | <div class="field"> |
|
174 | 172 | <div class="label"> |
|
175 | 173 | <label>${_('Download')}:</label> |
|
176 | 174 | </div> |
|
177 | 175 | <div class="input-short"> |
|
178 | 176 | %for cnt,archive in enumerate(c.repo_info._get_archives()): |
|
179 | 177 | %if cnt >=1: |
|
180 | 178 | | |
|
181 | 179 | %endif |
|
182 | 180 | ${h.link_to(c.repo_info.name+'.'+archive['type'], |
|
183 | 181 | h.url('files_archive_home',repo_name=c.repo_info.name, |
|
184 | 182 | revision='tip',fileformat=archive['extension']),class_="archive_icon")} |
|
185 | 183 | %endfor |
|
186 | 184 | </div> |
|
187 | 185 | </div> |
|
188 | 186 | |
|
189 | 187 | <div class="field"> |
|
190 | 188 | <div class="label"> |
|
191 | 189 | <label>${_('Feeds')}:</label> |
|
192 | 190 | </div> |
|
193 | 191 | <div class="input-short"> |
|
194 | 192 | ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')} |
|
195 | 193 | ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')} |
|
196 | 194 | </div> |
|
197 | 195 | </div> |
|
198 | 196 | </div> |
|
199 | 197 | </div> |
|
200 | 198 | </div> |
|
201 | 199 | |
|
202 | 200 | <div class="box box-right" style="min-height:455px"> |
|
203 | 201 | <!-- box / title --> |
|
204 | 202 | <div class="title"> |
|
205 | 203 | <h5>${_('Commit activity by day / author')}</h5> |
|
206 | 204 | </div> |
|
207 | 205 | |
|
208 | 206 | <div class="table"> |
|
209 | 207 | <div id="commit_history" style="width:560px;height:300px;float:left"></div> |
|
210 | 208 | <div style="clear: both;height: 10px"></div> |
|
211 | 209 | <div id="overview" style="width:560px;height:100px;float:left"></div> |
|
212 | 210 | |
|
213 | 211 | <div id="legend_data" style="clear:both;margin-top:10px;"> |
|
214 | 212 | <div id="legend_container"></div> |
|
215 | 213 | <div id="legend_choices"> |
|
216 | 214 | <table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table> |
|
217 | 215 | </div> |
|
218 | 216 | </div> |
|
219 | 217 | <script type="text/javascript"> |
|
220 | 218 | /** |
|
221 | 219 | * Plots summary graph |
|
222 | 220 | * |
|
223 | 221 | * @class SummaryPlot |
|
224 | 222 | * @param {from} initial from for detailed graph |
|
225 | 223 | * @param {to} initial to for detailed graph |
|
226 | 224 | * @param {dataset} |
|
227 | 225 | * @param {overview_dataset} |
|
228 | 226 | */ |
|
229 | 227 | function SummaryPlot(from,to,dataset,overview_dataset) { |
|
230 | 228 | var initial_ranges = { |
|
231 | 229 | "xaxis":{ |
|
232 | 230 | "from":from, |
|
233 | 231 | "to":to, |
|
234 | 232 | }, |
|
235 | 233 | }; |
|
236 | 234 | var dataset = dataset; |
|
237 | 235 | var overview_dataset = [overview_dataset]; |
|
238 | 236 | var choiceContainer = YAHOO.util.Dom.get("legend_choices"); |
|
239 | 237 | var choiceContainerTable = YAHOO.util.Dom.get("legend_choices_tables"); |
|
240 | 238 | var plotContainer = YAHOO.util.Dom.get('commit_history'); |
|
241 | 239 | var overviewContainer = YAHOO.util.Dom.get('overview'); |
|
242 | 240 | |
|
243 | 241 | var plot_options = { |
|
244 | 242 | bars: {show:true,align:'center',lineWidth:4}, |
|
245 | 243 | legend: {show:true, container:"legend_container"}, |
|
246 | 244 | points: {show:true,radius:0,fill:false}, |
|
247 | 245 | yaxis: {tickDecimals:0,}, |
|
248 | 246 | xaxis: { |
|
249 | 247 | mode: "time", |
|
250 | 248 | timeformat: "%d/%m", |
|
251 | 249 | min:from, |
|
252 | 250 | max:to, |
|
253 | 251 | }, |
|
254 | 252 | grid: { |
|
255 | 253 | hoverable: true, |
|
256 | 254 | clickable: true, |
|
257 | 255 | autoHighlight:true, |
|
258 | 256 | color: "#999" |
|
259 | 257 | }, |
|
260 | 258 | //selection: {mode: "x"} |
|
261 | 259 | }; |
|
262 | 260 | var overview_options = { |
|
263 | 261 | legend:{show:false}, |
|
264 | 262 | bars: {show:true,barWidth: 2,}, |
|
265 | 263 | shadowSize: 0, |
|
266 | 264 | xaxis: {mode: "time", timeformat: "%d/%m/%y",}, |
|
267 | 265 | yaxis: {ticks: 3, min: 0,}, |
|
268 | 266 | grid: {color: "#999",}, |
|
269 | 267 | selection: {mode: "x"} |
|
270 | 268 | }; |
|
271 | 269 | |
|
272 | 270 | /** |
|
273 | 271 | *get dummy data needed in few places |
|
274 | 272 | */ |
|
275 | 273 | function getDummyData(label){ |
|
276 | 274 | return {"label":label, |
|
277 | 275 | "data":[{"time":0, |
|
278 | 276 | "commits":0, |
|
279 | 277 | "added":0, |
|
280 | 278 | "changed":0, |
|
281 | 279 | "removed":0, |
|
282 | 280 | }], |
|
283 | 281 | "schema":["commits"], |
|
284 | 282 | "color":'#ffffff', |
|
285 | 283 | } |
|
286 | 284 | } |
|
287 | 285 | |
|
288 | 286 | /** |
|
289 | 287 | * generate checkboxes accordindly to data |
|
290 | 288 | * @param keys |
|
291 | 289 | * @returns |
|
292 | 290 | */ |
|
293 | 291 | function generateCheckboxes(data) { |
|
294 | 292 | //append checkboxes |
|
295 | 293 | var i = 0; |
|
296 | 294 | choiceContainerTable.innerHTML = ''; |
|
297 | 295 | for(var pos in data) { |
|
298 | 296 | |
|
299 | 297 | data[pos].color = i; |
|
300 | 298 | i++; |
|
301 | 299 | if(data[pos].label != ''){ |
|
302 | 300 | choiceContainerTable.innerHTML += '<tr><td>'+ |
|
303 | 301 | '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />' |
|
304 | 302 | +data[pos].label+ |
|
305 | 303 | '</td></tr>'; |
|
306 | 304 | } |
|
307 | 305 | } |
|
308 | 306 | } |
|
309 | 307 | |
|
310 | 308 | /** |
|
311 | 309 | * ToolTip show |
|
312 | 310 | */ |
|
313 | 311 | function showTooltip(x, y, contents) { |
|
314 | 312 | var div=document.getElementById('tooltip'); |
|
315 | 313 | if(!div) { |
|
316 | 314 | div = document.createElement('div'); |
|
317 | 315 | div.id="tooltip"; |
|
318 | 316 | div.style.position="absolute"; |
|
319 | 317 | div.style.border='1px solid #fdd'; |
|
320 | 318 | div.style.padding='2px'; |
|
321 | 319 | div.style.backgroundColor='#fee'; |
|
322 | 320 | document.body.appendChild(div); |
|
323 | 321 | } |
|
324 | 322 | YAHOO.util.Dom.setStyle(div, 'opacity', 0); |
|
325 | 323 | div.innerHTML = contents; |
|
326 | 324 | div.style.top=(y + 5) + "px"; |
|
327 | 325 | div.style.left=(x + 5) + "px"; |
|
328 | 326 | |
|
329 | 327 | var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2); |
|
330 | 328 | anim.animate(); |
|
331 | 329 | } |
|
332 | 330 | |
|
333 | 331 | /** |
|
334 | 332 | * This function will detect if selected period has some changesets for this user |
|
335 | 333 | if it does this data is then pushed for displaying |
|
336 | 334 | Additionally it will only display users that are selected by the checkbox |
|
337 | 335 | */ |
|
338 | 336 | function getDataAccordingToRanges(ranges) { |
|
339 | 337 | |
|
340 | 338 | var data = []; |
|
341 | 339 | var keys = []; |
|
342 | 340 | for(var key in dataset){ |
|
343 | 341 | var push = false; |
|
344 | 342 | //method1 slow !! |
|
345 | 343 | ///* |
|
346 | 344 | for(var ds in dataset[key].data){ |
|
347 | 345 | commit_data = dataset[key].data[ds]; |
|
348 | 346 | //console.log(key); |
|
349 | 347 | //console.log(new Date(commit_data.time*1000)); |
|
350 | 348 | //console.log(new Date(ranges.xaxis.from*1000)); |
|
351 | 349 | //console.log(new Date(ranges.xaxis.to*1000)); |
|
352 | 350 | if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){ |
|
353 | 351 | push = true; |
|
354 | 352 | break; |
|
355 | 353 | } |
|
356 | 354 | } |
|
357 | 355 | //*/ |
|
358 | 356 | /*//method2 sorted commit data !!! |
|
359 | 357 | var first_commit = dataset[key].data[0].time; |
|
360 | 358 | var last_commit = dataset[key].data[dataset[key].data.length-1].time; |
|
361 | 359 | |
|
362 | 360 | console.log(first_commit); |
|
363 | 361 | console.log(last_commit); |
|
364 | 362 | |
|
365 | 363 | if (first_commit >= ranges.xaxis.from && last_commit <= ranges.xaxis.to){ |
|
366 | 364 | push = true; |
|
367 | 365 | } |
|
368 | 366 | */ |
|
369 | 367 | if(push){ |
|
370 | 368 | data.push(dataset[key]); |
|
371 | 369 | } |
|
372 | 370 | } |
|
373 | 371 | if(data.length >= 1){ |
|
374 | 372 | return data; |
|
375 | 373 | } |
|
376 | 374 | else{ |
|
377 | 375 | //just return dummy data for graph to plot itself |
|
378 | 376 | return [getDummyData('')]; |
|
379 | 377 | } |
|
380 | 378 | |
|
381 | 379 | } |
|
382 | 380 | |
|
383 | 381 | /** |
|
384 | 382 | * redraw using new checkbox data |
|
385 | 383 | */ |
|
386 | 384 | function plotchoiced(e,args){ |
|
387 | 385 | var cur_data = args[0]; |
|
388 | 386 | var cur_ranges = args[1]; |
|
389 | 387 | |
|
390 | 388 | var new_data = []; |
|
391 | 389 | var inputs = choiceContainer.getElementsByTagName("input"); |
|
392 | 390 | |
|
393 | 391 | //show only checked labels |
|
394 | 392 | for(var i=0; i<inputs.length; i++) { |
|
395 | 393 | var checkbox_key = inputs[i].name; |
|
396 | 394 | |
|
397 | 395 | if(inputs[i].checked){ |
|
398 | 396 | for(var d in cur_data){ |
|
399 | 397 | if(cur_data[d].label == checkbox_key){ |
|
400 | 398 | new_data.push(cur_data[d]); |
|
401 | 399 | } |
|
402 | 400 | } |
|
403 | 401 | } |
|
404 | 402 | else{ |
|
405 | 403 | //push dummy data to not hide the label |
|
406 | 404 | new_data.push(getDummyData(checkbox_key)); |
|
407 | 405 | } |
|
408 | 406 | } |
|
409 | 407 | |
|
410 | 408 | var new_options = YAHOO.lang.merge(plot_options, { |
|
411 | 409 | xaxis: { |
|
412 | 410 | min: cur_ranges.xaxis.from, |
|
413 | 411 | max: cur_ranges.xaxis.to, |
|
414 | 412 | mode:"time", |
|
415 | 413 | timeformat: "%d/%m", |
|
416 | 414 | } |
|
417 | 415 | }); |
|
418 | 416 | if (!new_data){ |
|
419 | 417 | new_data = [[0,1]]; |
|
420 | 418 | } |
|
421 | 419 | // do the zooming |
|
422 | 420 | plot = YAHOO.widget.Flot(plotContainer, new_data, new_options); |
|
423 | 421 | |
|
424 | 422 | plot.subscribe("plotselected", plotselected); |
|
425 | 423 | |
|
426 | 424 | //resubscribe plothover |
|
427 | 425 | plot.subscribe("plothover", plothover); |
|
428 | 426 | |
|
429 | 427 | // don't fire event on the overview to prevent eternal loop |
|
430 | 428 | overview.setSelection(cur_ranges, true); |
|
431 | 429 | |
|
432 | 430 | } |
|
433 | 431 | |
|
434 | 432 | /** |
|
435 | 433 | * plot only selected items from overview |
|
436 | 434 | * @param ranges |
|
437 | 435 | * @returns |
|
438 | 436 | */ |
|
439 | 437 | function plotselected(ranges,cur_data) { |
|
440 | 438 | //updates the data for new plot |
|
441 | 439 | data = getDataAccordingToRanges(ranges); |
|
442 | 440 | generateCheckboxes(data); |
|
443 | 441 | |
|
444 | 442 | var new_options = YAHOO.lang.merge(plot_options, { |
|
445 | 443 | xaxis: { |
|
446 | 444 | min: ranges.xaxis.from, |
|
447 | 445 | max: ranges.xaxis.to, |
|
448 | 446 | mode:"time", |
|
449 | 447 | timeformat: "%d/%m", |
|
450 | 448 | } |
|
451 | 449 | }); |
|
452 | 450 | // do the zooming |
|
453 | 451 | plot = YAHOO.widget.Flot(plotContainer, data, new_options); |
|
454 | 452 | |
|
455 | 453 | plot.subscribe("plotselected", plotselected); |
|
456 | 454 | |
|
457 | 455 | //resubscribe plothover |
|
458 | 456 | plot.subscribe("plothover", plothover); |
|
459 | 457 | |
|
460 | 458 | // don't fire event on the overview to prevent eternal loop |
|
461 | 459 | overview.setSelection(ranges, true); |
|
462 | 460 | |
|
463 | 461 | //resubscribe choiced |
|
464 | 462 | YAHOO.util.Event.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]); |
|
465 | 463 | } |
|
466 | 464 | |
|
467 | 465 | var previousPoint = null; |
|
468 | 466 | |
|
469 | 467 | function plothover(o) { |
|
470 | 468 | var pos = o.pos; |
|
471 | 469 | var item = o.item; |
|
472 | 470 | |
|
473 | 471 | //YAHOO.util.Dom.get("x").innerHTML = pos.x.toFixed(2); |
|
474 | 472 | //YAHOO.util.Dom.get("y").innerHTML = pos.y.toFixed(2); |
|
475 | 473 | if (item) { |
|
476 | 474 | if (previousPoint != item.datapoint) { |
|
477 | 475 | previousPoint = item.datapoint; |
|
478 | 476 | |
|
479 | 477 | var tooltip = YAHOO.util.Dom.get("tooltip"); |
|
480 | 478 | if(tooltip) { |
|
481 | 479 | tooltip.parentNode.removeChild(tooltip); |
|
482 | 480 | } |
|
483 | 481 | var x = item.datapoint.x.toFixed(2); |
|
484 | 482 | var y = item.datapoint.y.toFixed(2); |
|
485 | 483 | |
|
486 | 484 | if (!item.series.label){ |
|
487 | 485 | item.series.label = 'commits'; |
|
488 | 486 | } |
|
489 | 487 | var d = new Date(x*1000); |
|
490 | 488 | var fd = d.toDateString() |
|
491 | 489 | var nr_commits = parseInt(y); |
|
492 | 490 | |
|
493 | 491 | var cur_data = dataset[item.series.label].data[item.dataIndex]; |
|
494 | 492 | var added = cur_data.added; |
|
495 | 493 | var changed = cur_data.changed; |
|
496 | 494 | var removed = cur_data.removed; |
|
497 | 495 | |
|
498 | 496 | var nr_commits_suffix = " ${_('commits')} "; |
|
499 | 497 | var added_suffix = " ${_('files added')} "; |
|
500 | 498 | var changed_suffix = " ${_('files changed')} "; |
|
501 | 499 | var removed_suffix = " ${_('files removed')} "; |
|
502 | 500 | |
|
503 | 501 | |
|
504 | 502 | if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";} |
|
505 | 503 | if(added==1){added_suffix=" ${_('file added')} ";} |
|
506 | 504 | if(changed==1){changed_suffix=" ${_('file changed')} ";} |
|
507 | 505 | if(removed==1){removed_suffix=" ${_('file removed')} ";} |
|
508 | 506 | |
|
509 | 507 | showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd |
|
510 | 508 | +'<br/>'+ |
|
511 | 509 | nr_commits + nr_commits_suffix+'<br/>'+ |
|
512 | 510 | added + added_suffix +'<br/>'+ |
|
513 | 511 | changed + changed_suffix + '<br/>'+ |
|
514 | 512 | removed + removed_suffix + '<br/>'); |
|
515 | 513 | } |
|
516 | 514 | } |
|
517 | 515 | else { |
|
518 | 516 | var tooltip = YAHOO.util.Dom.get("tooltip"); |
|
519 | 517 | |
|
520 | 518 | if(tooltip) { |
|
521 | 519 | tooltip.parentNode.removeChild(tooltip); |
|
522 | 520 | } |
|
523 | 521 | previousPoint = null; |
|
524 | 522 | } |
|
525 | 523 | } |
|
526 | 524 | |
|
527 | 525 | /** |
|
528 | 526 | * MAIN EXECUTION |
|
529 | 527 | */ |
|
530 | 528 | |
|
531 | 529 | var data = getDataAccordingToRanges(initial_ranges); |
|
532 | 530 | generateCheckboxes(data); |
|
533 | 531 | |
|
534 | 532 | //main plot |
|
535 | 533 | var plot = YAHOO.widget.Flot(plotContainer,data,plot_options); |
|
536 | 534 | |
|
537 | 535 | //overview |
|
538 | 536 | var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options); |
|
539 | 537 | |
|
540 | 538 | //show initial selection on overview |
|
541 | 539 | overview.setSelection(initial_ranges); |
|
542 | 540 | |
|
543 | 541 | plot.subscribe("plotselected", plotselected); |
|
544 | 542 | |
|
545 | 543 | overview.subscribe("plotselected", function (ranges) { |
|
546 | 544 | plot.setSelection(ranges); |
|
547 | 545 | }); |
|
548 | 546 | |
|
549 | 547 | plot.subscribe("plothover", plothover); |
|
550 | 548 | |
|
551 | 549 | YAHOO.util.Event.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]); |
|
552 | 550 | } |
|
553 | 551 | SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n}); |
|
554 | 552 | </script> |
|
555 | 553 | |
|
556 | 554 | </div> |
|
557 | 555 | </div> |
|
558 | 556 | |
|
559 | 557 | <div class="box"> |
|
560 | 558 | <div class="title"> |
|
561 | 559 | <div class="breadcrumbs">${h.link_to(_('Last ten changes'),h.url('changelog_home',repo_name=c.repo_name))}</div> |
|
562 | 560 | </div> |
|
563 | 561 | <div class="table"> |
|
564 | <%include file='../shortlog/shortlog_data.html'/> | |
|
565 | %if c.repo_changesets: | |
|
566 | ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))} | |
|
567 | %endif | |
|
562 | <div id="shortlog_data"> | |
|
563 | <%include file='../shortlog/shortlog_data.html'/> | |
|
564 | </div> | |
|
565 | ##%if c.repo_changesets: | |
|
566 | ## ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))} | |
|
567 | ##%endif | |
|
568 | 568 | </div> |
|
569 | 569 | </div> |
|
570 | 570 | <div class="box"> |
|
571 | 571 | <div class="title"> |
|
572 | 572 | <div class="breadcrumbs">${h.link_to(_('Last ten tags'),h.url('tags_home',repo_name=c.repo_name))}</div> |
|
573 | 573 | </div> |
|
574 | 574 | <div class="table"> |
|
575 | 575 | <%include file='../tags/tags_data.html'/> |
|
576 | 576 | %if c.repo_changesets: |
|
577 | 577 | ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))} |
|
578 | 578 | %endif |
|
579 | 579 | </div> |
|
580 | 580 | </div> |
|
581 | 581 | <div class="box"> |
|
582 | 582 | <div class="title"> |
|
583 | 583 | <div class="breadcrumbs">${h.link_to(_('Last ten branches'),h.url('branches_home',repo_name=c.repo_name))}</div> |
|
584 | 584 | </div> |
|
585 | 585 | <div class="table"> |
|
586 | 586 | <%include file='../branches/branches_data.html'/> |
|
587 | 587 | %if c.repo_changesets: |
|
588 | 588 | ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))} |
|
589 | 589 | %endif |
|
590 | 590 | </div> |
|
591 | 591 | </div> |
|
592 | 592 | |
|
593 | 593 | </%def> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now