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