##// END OF EJS Templates
fixes #211
marcink -
r1384:4fd86e3d beta
parent child Browse files
Show More
@@ -1,704 +1,711 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.dbrepo.just_name,h.url('summary_home',repo_name=c.repo_name))}
10 ${h.link_to(c.dbrepo.just_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 <div class="box box-left">
20 <div class="box box-left">
21 <!-- box / title -->
21 <!-- box / title -->
22 <div class="title">
22 <div class="title">
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 </div>
24 </div>
25 <!-- end box / title -->
25 <!-- end box / title -->
26 <div class="form">
26 <div class="form">
27 <div id="summary" class="fields">
27 <div id="summary" class="fields">
28
28
29 <div class="field">
29 <div class="field">
30 <div class="label">
30 <div class="label">
31 <label>${_('Name')}:</label>
31 <label>${_('Name')}:</label>
32 </div>
32 </div>
33 <div class="input-short">
33 <div class="input-short">
34 %if c.rhodecode_user.username != 'default':
34 %if c.rhodecode_user.username != 'default':
35 %if c.following:
35 %if c.following:
36 <span id="follow_toggle" class="following" title="${_('Stop following this repository')}"
36 <span id="follow_toggle" class="following" title="${_('Stop following this repository')}"
37 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
37 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
38 </span>
38 </span>
39 %else:
39 %else:
40 <span id="follow_toggle" class="follow" title="${_('Start following this repository')}"
40 <span id="follow_toggle" class="follow" title="${_('Start following this repository')}"
41 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
41 onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')">
42 </span>
42 </span>
43 %endif
43 %endif
44 %endif:
44 %endif:
45
45
46 ##REPO TYPE
46 ##REPO TYPE
47 %if c.dbrepo.repo_type =='hg':
47 %if c.dbrepo.repo_type =='hg':
48 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url("/images/icons/hgicon.png")}"/>
48 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url("/images/icons/hgicon.png")}"/>
49 %endif
49 %endif
50 %if c.dbrepo.repo_type =='git':
50 %if c.dbrepo.repo_type =='git':
51 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url("/images/icons/giticon.png")}"/>
51 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url("/images/icons/giticon.png")}"/>
52 %endif
52 %endif
53
53
54 ##PUBLIC/PRIVATE
54 ##PUBLIC/PRIVATE
55 %if c.dbrepo.private:
55 %if c.dbrepo.private:
56 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url("/images/icons/lock.png")}"/>
56 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url("/images/icons/lock.png")}"/>
57 %else:
57 %else:
58 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url("/images/icons/lock_open.png")}"/>
58 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url("/images/icons/lock_open.png")}"/>
59 %endif
59 %endif
60
60
61 ##REPO NAME
61 ##REPO NAME
62 <span class="repo_name">${h.repo_link(c.dbrepo.groups_and_repo)}</span>
62 <span class="repo_name">${h.repo_link(c.dbrepo.groups_and_repo)}</span>
63
63
64 ##FORK
64 ##FORK
65 %if c.dbrepo.fork:
65 %if c.dbrepo.fork:
66 <div style="margin-top:5px;clear:both"">
66 <div style="margin-top:5px;clear:both"">
67 <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}">
67 <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}">
68 <img class="icon" alt="${_('public')}"
68 <img class="icon" alt="${_('public')}"
69 title="${_('Fork of')} ${c.dbrepo.fork.repo_name}"
69 title="${_('Fork of')} ${c.dbrepo.fork.repo_name}"
70 src="${h.url("/images/icons/arrow_divide.png")}"/>
70 src="${h.url("/images/icons/arrow_divide.png")}"/>
71 ${_('Fork of')} ${c.dbrepo.fork.repo_name}
71 ${_('Fork of')} ${c.dbrepo.fork.repo_name}
72 </a>
72 </a>
73 </div>
73 </div>
74 %endif
74 %endif
75 ##REMOTE
75 ##REMOTE
76 %if c.dbrepo.clone_uri:
76 %if c.dbrepo.clone_uri:
77 <div style="margin-top:5px;clear:both">
77 <div style="margin-top:5px;clear:both">
78 <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}">
78 <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}">
79 <img class="icon" alt="${_('remote clone')}"
79 <img class="icon" alt="${_('remote clone')}"
80 title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}"
80 title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}"
81 src="${h.url("/images/icons/connect.png")}"/>
81 src="${h.url("/images/icons/connect.png")}"/>
82 ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
82 ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}
83 </a>
83 </a>
84 </div>
84 </div>
85 %endif
85 %endif
86 </div>
86 </div>
87 </div>
87 </div>
88
88
89
89
90 <div class="field">
90 <div class="field">
91 <div class="label">
91 <div class="label">
92 <label>${_('Description')}:</label>
92 <label>${_('Description')}:</label>
93 </div>
93 </div>
94 <div class="input-short desc">${c.dbrepo.description}</div>
94 <div class="input-short desc">${c.dbrepo.description}</div>
95 </div>
95 </div>
96
96
97
97
98 <div class="field">
98 <div class="field">
99 <div class="label">
99 <div class="label">
100 <label>${_('Contact')}:</label>
100 <label>${_('Contact')}:</label>
101 </div>
101 </div>
102 <div class="input-short">
102 <div class="input-short">
103 <div class="gravatar">
103 <div class="gravatar">
104 <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
104 <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/>
105 </div>
105 </div>
106 ${_('Username')}: ${c.dbrepo.user.username}<br/>
106 ${_('Username')}: ${c.dbrepo.user.username}<br/>
107 ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
107 ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/>
108 ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
108 ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a>
109 </div>
109 </div>
110 </div>
110 </div>
111
111
112 <div class="field">
112 <div class="field">
113 <div class="label">
113 <div class="label">
114 <label>${_('Last change')}:</label>
114 <label>${_('Last change')}:</label>
115 </div>
115 </div>
116 <div class="input-short">
116 <div class="input-short">
117 <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision,
117 <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision,
118 h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> -
118 h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> -
119 <span class="tooltip" title="${c.rhodecode_repo.last_change}">
119 <span class="tooltip" title="${c.rhodecode_repo.last_change}">
120 ${h.age(c.rhodecode_repo.last_change)}</span><br/>
120 ${h.age(c.rhodecode_repo.last_change)}</span><br/>
121 ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author}
121 ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author}
122
122
123 </div>
123 </div>
124 </div>
124 </div>
125
125
126 <div class="field">
126 <div class="field">
127 <div class="label">
127 <div class="label">
128 <label>${_('Clone url')}:</label>
128 <label>${_('Clone url')}:</label>
129 </div>
129 </div>
130 <div class="input-short">
130 <div class="input-short">
131 <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/>
131 <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/>
132 </div>
132 </div>
133 </div>
133 </div>
134
134
135 <div class="field">
135 <div class="field">
136 <div class="label">
136 <div class="label">
137 <label>${_('Trending source files')}:</label>
137 <label>${_('Trending source files')}:</label>
138 </div>
138 </div>
139 <div class="input-short">
139 <div class="input-short">
140 <div id="lang_stats"></div>
140 <div id="lang_stats"></div>
141 </div>
141 </div>
142 </div>
142 </div>
143
143
144 <div class="field">
144 <div class="field">
145 <div class="label">
145 <div class="label">
146 <label>${_('Download')}:</label>
146 <label>${_('Download')}:</label>
147 </div>
147 </div>
148 <div class="input-short">
148 <div class="input-short">
149 %if len(c.rhodecode_repo.revisions) == 0:
149 %if len(c.rhodecode_repo.revisions) == 0:
150 ${_('There are no downloads yet')}
150 ${_('There are no downloads yet')}
151 %elif c.enable_downloads is False:
151 %elif c.enable_downloads is False:
152 ${_('Downloads are disabled for this repository')}
152 ${_('Downloads are disabled for this repository')}
153 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
153 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
154 [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
154 [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
155 %endif
155 %endif
156 %else:
156 %else:
157 ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
157 ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)}
158 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
158 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
159 %if cnt >=1:
159 %if cnt >=1:
160 |
160 |
161 %endif
161 %endif
162 <span class="tooltip" title="${_('Download %s as %s') %('tip',archive['type'])}"
162 <span class="tooltip" title="${_('Download %s as %s') %('tip',archive['type'])}"
163 id="${archive['type']+'_link'}">${h.link_to(archive['type'],
163 id="${archive['type']+'_link'}">${h.link_to(archive['type'],
164 h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
164 h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
165 fname='tip'+archive['extension']),class_="archive_icon")}</span>
165 fname='tip'+archive['extension']),class_="archive_icon")}</span>
166 %endfor
166 %endfor
167 %endif
167 %endif
168 </div>
168 </div>
169 </div>
169 </div>
170
170
171 <div class="field">
171 <div class="field">
172 <div class="label">
172 <div class="label">
173 <label>${_('Feeds')}:</label>
173 <label>${_('Feeds')}:</label>
174 </div>
174 </div>
175 <div class="input-short">
175 <div class="input-short">
176 %if c.rhodecode_user.username != 'default':
176 %if c.rhodecode_user.username != 'default':
177 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='rss_icon')}
177 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='rss_icon')}
178 ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='atom_icon')}
178 ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='atom_icon')}
179 %else:
179 %else:
180 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
180 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.dbrepo.repo_name),class_='rss_icon')}
181 ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}
181 ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='atom_icon')}
182 %endif
182 %endif
183 </div>
183 </div>
184 </div>
184 </div>
185 </div>
185 </div>
186 </div>
186 </div>
187 <script type="text/javascript">
187 <script type="text/javascript">
188 YUE.onDOMReady(function(e){
188 YUE.onDOMReady(function(e){
189 id = 'clone_url';
189 id = 'clone_url';
190 YUE.on(id,'click',function(e){
190 YUE.on(id,'click',function(e){
191 YUD.get('clone_url').select();
191 if(YUD.hasClass(id,'selected')){
192 return
193 }
194 else{
195 YUD.addClass(id,'selected');
196 YUD.get(id).select();
197 }
198
192 })
199 })
193 })
200 })
194 var data = ${c.trending_languages|n};
201 var data = ${c.trending_languages|n};
195 var total = 0;
202 var total = 0;
196 var no_data = true;
203 var no_data = true;
197 for (k in data){
204 for (k in data){
198 total += data[k].count;
205 total += data[k].count;
199 no_data = false;
206 no_data = false;
200 }
207 }
201 var tbl = document.createElement('table');
208 var tbl = document.createElement('table');
202 tbl.setAttribute('class','trending_language_tbl');
209 tbl.setAttribute('class','trending_language_tbl');
203 var cnt = 0;
210 var cnt = 0;
204 for (k in data){
211 for (k in data){
205 cnt += 1;
212 cnt += 1;
206 var hide = cnt>2;
213 var hide = cnt>2;
207 var tr = document.createElement('tr');
214 var tr = document.createElement('tr');
208 if (hide){
215 if (hide){
209 tr.setAttribute('style','display:none');
216 tr.setAttribute('style','display:none');
210 tr.setAttribute('class','stats_hidden');
217 tr.setAttribute('class','stats_hidden');
211 }
218 }
212 var percentage = Math.round((data[k].count/total*100),2);
219 var percentage = Math.round((data[k].count/total*100),2);
213 var value = data[k].count;
220 var value = data[k].count;
214 var td1 = document.createElement('td');
221 var td1 = document.createElement('td');
215 td1.width = 150;
222 td1.width = 150;
216 var trending_language_label = document.createElement('div');
223 var trending_language_label = document.createElement('div');
217 trending_language_label.innerHTML = data[k].desc+" ("+k+")";
224 trending_language_label.innerHTML = data[k].desc+" ("+k+")";
218 td1.appendChild(trending_language_label);
225 td1.appendChild(trending_language_label);
219
226
220 var td2 = document.createElement('td');
227 var td2 = document.createElement('td');
221 td2.setAttribute('style','padding-right:14px !important');
228 td2.setAttribute('style','padding-right:14px !important');
222 var trending_language = document.createElement('div');
229 var trending_language = document.createElement('div');
223 var nr_files = value+" ${_('files')}";
230 var nr_files = value+" ${_('files')}";
224
231
225 trending_language.title = k+" "+nr_files;
232 trending_language.title = k+" "+nr_files;
226
233
227 if (percentage>22){
234 if (percentage>22){
228 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
235 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
229 }
236 }
230 else{
237 else{
231 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
238 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
232 }
239 }
233
240
234 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
241 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
235 trending_language.style.width=percentage+"%";
242 trending_language.style.width=percentage+"%";
236 td2.appendChild(trending_language);
243 td2.appendChild(trending_language);
237
244
238 tr.appendChild(td1);
245 tr.appendChild(td1);
239 tr.appendChild(td2);
246 tr.appendChild(td2);
240 tbl.appendChild(tr);
247 tbl.appendChild(tr);
241 if(cnt == 3){
248 if(cnt == 3){
242 var show_more = document.createElement('tr');
249 var show_more = document.createElement('tr');
243 var td = document.createElement('td');
250 var td = document.createElement('td');
244 lnk = document.createElement('a');
251 lnk = document.createElement('a');
245
252
246 lnk.href='#';
253 lnk.href='#';
247 lnk.innerHTML = "${_('show more')}";
254 lnk.innerHTML = "${_('show more')}";
248 lnk.id='code_stats_show_more';
255 lnk.id='code_stats_show_more';
249 td.appendChild(lnk);
256 td.appendChild(lnk);
250
257
251 show_more.appendChild(td);
258 show_more.appendChild(td);
252 show_more.appendChild(document.createElement('td'));
259 show_more.appendChild(document.createElement('td'));
253 tbl.appendChild(show_more);
260 tbl.appendChild(show_more);
254 }
261 }
255
262
256 }
263 }
257 if(no_data){
264 if(no_data){
258 var tr = document.createElement('tr');
265 var tr = document.createElement('tr');
259 var td1 = document.createElement('td');
266 var td1 = document.createElement('td');
260 td1.innerHTML = "${c.no_data_msg}";
267 td1.innerHTML = "${c.no_data_msg}";
261 tr.appendChild(td1);
268 tr.appendChild(td1);
262 tbl.appendChild(tr);
269 tbl.appendChild(tr);
263 }
270 }
264 YUD.get('lang_stats').appendChild(tbl);
271 YUD.get('lang_stats').appendChild(tbl);
265 YUE.on('code_stats_show_more','click',function(){
272 YUE.on('code_stats_show_more','click',function(){
266 l = YUD.getElementsByClassName('stats_hidden')
273 l = YUD.getElementsByClassName('stats_hidden')
267 for (e in l){
274 for (e in l){
268 YUD.setStyle(l[e],'display','');
275 YUD.setStyle(l[e],'display','');
269 };
276 };
270 YUD.setStyle(YUD.get('code_stats_show_more'),
277 YUD.setStyle(YUD.get('code_stats_show_more'),
271 'display','none');
278 'display','none');
272 })
279 })
273
280
274
281
275 YUE.on('download_options','change',function(e){
282 YUE.on('download_options','change',function(e){
276 var new_cs = e.target.options[e.target.selectedIndex];
283 var new_cs = e.target.options[e.target.selectedIndex];
277 var tmpl_links = {}
284 var tmpl_links = {}
278 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
285 %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()):
279 tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
286 tmpl_links['${archive['type']}'] = '${h.link_to(archive['type'],
280 h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
287 h.url('files_archive_home',repo_name=c.dbrepo.repo_name,
281 fname='__CS__'+archive['extension']),class_="archive_icon")}';
288 fname='__CS__'+archive['extension']),class_="archive_icon")}';
282 %endfor
289 %endfor
283
290
284
291
285 for(k in tmpl_links){
292 for(k in tmpl_links){
286 var s = YUD.get(k+'_link')
293 var s = YUD.get(k+'_link')
287 title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
294 title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
288 s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
295 s.title = title_tmpl.replace('__CS_NAME__',new_cs.text);
289 s.title = s.title.replace('__CS_EXT__',k);
296 s.title = s.title.replace('__CS_EXT__',k);
290 s.innerHTML = tmpl_links[k].replace('__CS__',new_cs.value);
297 s.innerHTML = tmpl_links[k].replace('__CS__',new_cs.value);
291 }
298 }
292
299
293 })
300 })
294
301
295 </script>
302 </script>
296 </div>
303 </div>
297
304
298 <div class="box box-right" style="min-height:455px">
305 <div class="box box-right" style="min-height:455px">
299 <!-- box / title -->
306 <!-- box / title -->
300 <div class="title">
307 <div class="title">
301 <h5>${_('Commit activity by day / author')}</h5>
308 <h5>${_('Commit activity by day / author')}</h5>
302 </div>
309 </div>
303
310
304 <div class="graph">
311 <div class="graph">
305 <div style="padding:0 10px 10px 15px;font-size: 1.2em;">
312 <div style="padding:0 10px 10px 15px;font-size: 1.2em;">
306 %if c.no_data:
313 %if c.no_data:
307 ${c.no_data_msg}
314 ${c.no_data_msg}
308 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
315 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
309 [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
316 [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
310 %endif
317 %endif
311
318
312 %else:
319 %else:
313 ${_('Loaded in')} ${c.stats_percentage} %
320 ${_('Loaded in')} ${c.stats_percentage} %
314 %endif
321 %endif
315 </div>
322 </div>
316 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
323 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
317 <div style="clear: both;height: 10px"></div>
324 <div style="clear: both;height: 10px"></div>
318 <div id="overview" style="width:450px;height:100px;float:left"></div>
325 <div id="overview" style="width:450px;height:100px;float:left"></div>
319
326
320 <div id="legend_data" style="clear:both;margin-top:10px;">
327 <div id="legend_data" style="clear:both;margin-top:10px;">
321 <div id="legend_container"></div>
328 <div id="legend_container"></div>
322 <div id="legend_choices">
329 <div id="legend_choices">
323 <table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table>
330 <table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table>
324 </div>
331 </div>
325 </div>
332 </div>
326 <script type="text/javascript">
333 <script type="text/javascript">
327 /**
334 /**
328 * Plots summary graph
335 * Plots summary graph
329 *
336 *
330 * @class SummaryPlot
337 * @class SummaryPlot
331 * @param {from} initial from for detailed graph
338 * @param {from} initial from for detailed graph
332 * @param {to} initial to for detailed graph
339 * @param {to} initial to for detailed graph
333 * @param {dataset}
340 * @param {dataset}
334 * @param {overview_dataset}
341 * @param {overview_dataset}
335 */
342 */
336 function SummaryPlot(from,to,dataset,overview_dataset) {
343 function SummaryPlot(from,to,dataset,overview_dataset) {
337 var initial_ranges = {
344 var initial_ranges = {
338 "xaxis":{
345 "xaxis":{
339 "from":from,
346 "from":from,
340 "to":to,
347 "to":to,
341 },
348 },
342 };
349 };
343 var dataset = dataset;
350 var dataset = dataset;
344 var overview_dataset = [overview_dataset];
351 var overview_dataset = [overview_dataset];
345 var choiceContainer = YUD.get("legend_choices");
352 var choiceContainer = YUD.get("legend_choices");
346 var choiceContainerTable = YUD.get("legend_choices_tables");
353 var choiceContainerTable = YUD.get("legend_choices_tables");
347 var plotContainer = YUD.get('commit_history');
354 var plotContainer = YUD.get('commit_history');
348 var overviewContainer = YUD.get('overview');
355 var overviewContainer = YUD.get('overview');
349
356
350 var plot_options = {
357 var plot_options = {
351 bars: {show:true,align:'center',lineWidth:4},
358 bars: {show:true,align:'center',lineWidth:4},
352 legend: {show:true, container:"legend_container"},
359 legend: {show:true, container:"legend_container"},
353 points: {show:true,radius:0,fill:false},
360 points: {show:true,radius:0,fill:false},
354 yaxis: {tickDecimals:0,},
361 yaxis: {tickDecimals:0,},
355 xaxis: {
362 xaxis: {
356 mode: "time",
363 mode: "time",
357 timeformat: "%d/%m",
364 timeformat: "%d/%m",
358 min:from,
365 min:from,
359 max:to,
366 max:to,
360 },
367 },
361 grid: {
368 grid: {
362 hoverable: true,
369 hoverable: true,
363 clickable: true,
370 clickable: true,
364 autoHighlight:true,
371 autoHighlight:true,
365 color: "#999"
372 color: "#999"
366 },
373 },
367 //selection: {mode: "x"}
374 //selection: {mode: "x"}
368 };
375 };
369 var overview_options = {
376 var overview_options = {
370 legend:{show:false},
377 legend:{show:false},
371 bars: {show:true,barWidth: 2,},
378 bars: {show:true,barWidth: 2,},
372 shadowSize: 0,
379 shadowSize: 0,
373 xaxis: {mode: "time", timeformat: "%d/%m/%y",},
380 xaxis: {mode: "time", timeformat: "%d/%m/%y",},
374 yaxis: {ticks: 3, min: 0,tickDecimals:0,},
381 yaxis: {ticks: 3, min: 0,tickDecimals:0,},
375 grid: {color: "#999",},
382 grid: {color: "#999",},
376 selection: {mode: "x"}
383 selection: {mode: "x"}
377 };
384 };
378
385
379 /**
386 /**
380 *get dummy data needed in few places
387 *get dummy data needed in few places
381 */
388 */
382 function getDummyData(label){
389 function getDummyData(label){
383 return {"label":label,
390 return {"label":label,
384 "data":[{"time":0,
391 "data":[{"time":0,
385 "commits":0,
392 "commits":0,
386 "added":0,
393 "added":0,
387 "changed":0,
394 "changed":0,
388 "removed":0,
395 "removed":0,
389 }],
396 }],
390 "schema":["commits"],
397 "schema":["commits"],
391 "color":'#ffffff',
398 "color":'#ffffff',
392 }
399 }
393 }
400 }
394
401
395 /**
402 /**
396 * generate checkboxes accordindly to data
403 * generate checkboxes accordindly to data
397 * @param keys
404 * @param keys
398 * @returns
405 * @returns
399 */
406 */
400 function generateCheckboxes(data) {
407 function generateCheckboxes(data) {
401 //append checkboxes
408 //append checkboxes
402 var i = 0;
409 var i = 0;
403 choiceContainerTable.innerHTML = '';
410 choiceContainerTable.innerHTML = '';
404 for(var pos in data) {
411 for(var pos in data) {
405
412
406 data[pos].color = i;
413 data[pos].color = i;
407 i++;
414 i++;
408 if(data[pos].label != ''){
415 if(data[pos].label != ''){
409 choiceContainerTable.innerHTML += '<tr><td>'+
416 choiceContainerTable.innerHTML += '<tr><td>'+
410 '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />'
417 '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />'
411 +data[pos].label+
418 +data[pos].label+
412 '</td></tr>';
419 '</td></tr>';
413 }
420 }
414 }
421 }
415 }
422 }
416
423
417 /**
424 /**
418 * ToolTip show
425 * ToolTip show
419 */
426 */
420 function showTooltip(x, y, contents) {
427 function showTooltip(x, y, contents) {
421 var div=document.getElementById('tooltip');
428 var div=document.getElementById('tooltip');
422 if(!div) {
429 if(!div) {
423 div = document.createElement('div');
430 div = document.createElement('div');
424 div.id="tooltip";
431 div.id="tooltip";
425 div.style.position="absolute";
432 div.style.position="absolute";
426 div.style.border='1px solid #fdd';
433 div.style.border='1px solid #fdd';
427 div.style.padding='2px';
434 div.style.padding='2px';
428 div.style.backgroundColor='#fee';
435 div.style.backgroundColor='#fee';
429 document.body.appendChild(div);
436 document.body.appendChild(div);
430 }
437 }
431 YUD.setStyle(div, 'opacity', 0);
438 YUD.setStyle(div, 'opacity', 0);
432 div.innerHTML = contents;
439 div.innerHTML = contents;
433 div.style.top=(y + 5) + "px";
440 div.style.top=(y + 5) + "px";
434 div.style.left=(x + 5) + "px";
441 div.style.left=(x + 5) + "px";
435
442
436 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
443 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
437 anim.animate();
444 anim.animate();
438 }
445 }
439
446
440 /**
447 /**
441 * This function will detect if selected period has some changesets
448 * This function will detect if selected period has some changesets
442 for this user if it does this data is then pushed for displaying
449 for this user if it does this data is then pushed for displaying
443 Additionally it will only display users that are selected by the checkbox
450 Additionally it will only display users that are selected by the checkbox
444 */
451 */
445 function getDataAccordingToRanges(ranges) {
452 function getDataAccordingToRanges(ranges) {
446
453
447 var data = [];
454 var data = [];
448 var keys = [];
455 var keys = [];
449 for(var key in dataset){
456 for(var key in dataset){
450 var push = false;
457 var push = false;
451
458
452 //method1 slow !!
459 //method1 slow !!
453 //*
460 //*
454 for(var ds in dataset[key].data){
461 for(var ds in dataset[key].data){
455 commit_data = dataset[key].data[ds];
462 commit_data = dataset[key].data[ds];
456 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
463 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
457 push = true;
464 push = true;
458 break;
465 break;
459 }
466 }
460 }
467 }
461 //*/
468 //*/
462
469
463 /*//method2 sorted commit data !!!
470 /*//method2 sorted commit data !!!
464
471
465 var first_commit = dataset[key].data[0].time;
472 var first_commit = dataset[key].data[0].time;
466 var last_commit = dataset[key].data[dataset[key].data.length-1].time;
473 var last_commit = dataset[key].data[dataset[key].data.length-1].time;
467
474
468 if (first_commit >= ranges.xaxis.from && last_commit <= ranges.xaxis.to){
475 if (first_commit >= ranges.xaxis.from && last_commit <= ranges.xaxis.to){
469 push = true;
476 push = true;
470 }
477 }
471 //*/
478 //*/
472
479
473 if(push){
480 if(push){
474 data.push(dataset[key]);
481 data.push(dataset[key]);
475 }
482 }
476 }
483 }
477 if(data.length >= 1){
484 if(data.length >= 1){
478 return data;
485 return data;
479 }
486 }
480 else{
487 else{
481 //just return dummy data for graph to plot itself
488 //just return dummy data for graph to plot itself
482 return [getDummyData('')];
489 return [getDummyData('')];
483 }
490 }
484
491
485 }
492 }
486
493
487 /**
494 /**
488 * redraw using new checkbox data
495 * redraw using new checkbox data
489 */
496 */
490 function plotchoiced(e,args){
497 function plotchoiced(e,args){
491 var cur_data = args[0];
498 var cur_data = args[0];
492 var cur_ranges = args[1];
499 var cur_ranges = args[1];
493
500
494 var new_data = [];
501 var new_data = [];
495 var inputs = choiceContainer.getElementsByTagName("input");
502 var inputs = choiceContainer.getElementsByTagName("input");
496
503
497 //show only checked labels
504 //show only checked labels
498 for(var i=0; i<inputs.length; i++) {
505 for(var i=0; i<inputs.length; i++) {
499 var checkbox_key = inputs[i].name;
506 var checkbox_key = inputs[i].name;
500
507
501 if(inputs[i].checked){
508 if(inputs[i].checked){
502 for(var d in cur_data){
509 for(var d in cur_data){
503 if(cur_data[d].label == checkbox_key){
510 if(cur_data[d].label == checkbox_key){
504 new_data.push(cur_data[d]);
511 new_data.push(cur_data[d]);
505 }
512 }
506 }
513 }
507 }
514 }
508 else{
515 else{
509 //push dummy data to not hide the label
516 //push dummy data to not hide the label
510 new_data.push(getDummyData(checkbox_key));
517 new_data.push(getDummyData(checkbox_key));
511 }
518 }
512 }
519 }
513
520
514 var new_options = YAHOO.lang.merge(plot_options, {
521 var new_options = YAHOO.lang.merge(plot_options, {
515 xaxis: {
522 xaxis: {
516 min: cur_ranges.xaxis.from,
523 min: cur_ranges.xaxis.from,
517 max: cur_ranges.xaxis.to,
524 max: cur_ranges.xaxis.to,
518 mode:"time",
525 mode:"time",
519 timeformat: "%d/%m",
526 timeformat: "%d/%m",
520 },
527 },
521 });
528 });
522 if (!new_data){
529 if (!new_data){
523 new_data = [[0,1]];
530 new_data = [[0,1]];
524 }
531 }
525 // do the zooming
532 // do the zooming
526 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
533 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
527
534
528 plot.subscribe("plotselected", plotselected);
535 plot.subscribe("plotselected", plotselected);
529
536
530 //resubscribe plothover
537 //resubscribe plothover
531 plot.subscribe("plothover", plothover);
538 plot.subscribe("plothover", plothover);
532
539
533 // don't fire event on the overview to prevent eternal loop
540 // don't fire event on the overview to prevent eternal loop
534 overview.setSelection(cur_ranges, true);
541 overview.setSelection(cur_ranges, true);
535
542
536 }
543 }
537
544
538 /**
545 /**
539 * plot only selected items from overview
546 * plot only selected items from overview
540 * @param ranges
547 * @param ranges
541 * @returns
548 * @returns
542 */
549 */
543 function plotselected(ranges,cur_data) {
550 function plotselected(ranges,cur_data) {
544 //updates the data for new plot
551 //updates the data for new plot
545 data = getDataAccordingToRanges(ranges);
552 data = getDataAccordingToRanges(ranges);
546 generateCheckboxes(data);
553 generateCheckboxes(data);
547
554
548 var new_options = YAHOO.lang.merge(plot_options, {
555 var new_options = YAHOO.lang.merge(plot_options, {
549 xaxis: {
556 xaxis: {
550 min: ranges.xaxis.from,
557 min: ranges.xaxis.from,
551 max: ranges.xaxis.to,
558 max: ranges.xaxis.to,
552 mode:"time",
559 mode:"time",
553 timeformat: "%d/%m",
560 timeformat: "%d/%m",
554 },
561 },
555 yaxis: {
562 yaxis: {
556 min: ranges.yaxis.from,
563 min: ranges.yaxis.from,
557 max: ranges.yaxis.to,
564 max: ranges.yaxis.to,
558 },
565 },
559
566
560 });
567 });
561 // do the zooming
568 // do the zooming
562 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
569 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
563
570
564 plot.subscribe("plotselected", plotselected);
571 plot.subscribe("plotselected", plotselected);
565
572
566 //resubscribe plothover
573 //resubscribe plothover
567 plot.subscribe("plothover", plothover);
574 plot.subscribe("plothover", plothover);
568
575
569 // don't fire event on the overview to prevent eternal loop
576 // don't fire event on the overview to prevent eternal loop
570 overview.setSelection(ranges, true);
577 overview.setSelection(ranges, true);
571
578
572 //resubscribe choiced
579 //resubscribe choiced
573 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
580 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
574 }
581 }
575
582
576 var previousPoint = null;
583 var previousPoint = null;
577
584
578 function plothover(o) {
585 function plothover(o) {
579 var pos = o.pos;
586 var pos = o.pos;
580 var item = o.item;
587 var item = o.item;
581
588
582 //YUD.get("x").innerHTML = pos.x.toFixed(2);
589 //YUD.get("x").innerHTML = pos.x.toFixed(2);
583 //YUD.get("y").innerHTML = pos.y.toFixed(2);
590 //YUD.get("y").innerHTML = pos.y.toFixed(2);
584 if (item) {
591 if (item) {
585 if (previousPoint != item.datapoint) {
592 if (previousPoint != item.datapoint) {
586 previousPoint = item.datapoint;
593 previousPoint = item.datapoint;
587
594
588 var tooltip = YUD.get("tooltip");
595 var tooltip = YUD.get("tooltip");
589 if(tooltip) {
596 if(tooltip) {
590 tooltip.parentNode.removeChild(tooltip);
597 tooltip.parentNode.removeChild(tooltip);
591 }
598 }
592 var x = item.datapoint.x.toFixed(2);
599 var x = item.datapoint.x.toFixed(2);
593 var y = item.datapoint.y.toFixed(2);
600 var y = item.datapoint.y.toFixed(2);
594
601
595 if (!item.series.label){
602 if (!item.series.label){
596 item.series.label = 'commits';
603 item.series.label = 'commits';
597 }
604 }
598 var d = new Date(x*1000);
605 var d = new Date(x*1000);
599 var fd = d.toDateString()
606 var fd = d.toDateString()
600 var nr_commits = parseInt(y);
607 var nr_commits = parseInt(y);
601
608
602 var cur_data = dataset[item.series.label].data[item.dataIndex];
609 var cur_data = dataset[item.series.label].data[item.dataIndex];
603 var added = cur_data.added;
610 var added = cur_data.added;
604 var changed = cur_data.changed;
611 var changed = cur_data.changed;
605 var removed = cur_data.removed;
612 var removed = cur_data.removed;
606
613
607 var nr_commits_suffix = " ${_('commits')} ";
614 var nr_commits_suffix = " ${_('commits')} ";
608 var added_suffix = " ${_('files added')} ";
615 var added_suffix = " ${_('files added')} ";
609 var changed_suffix = " ${_('files changed')} ";
616 var changed_suffix = " ${_('files changed')} ";
610 var removed_suffix = " ${_('files removed')} ";
617 var removed_suffix = " ${_('files removed')} ";
611
618
612
619
613 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
620 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
614 if(added==1){added_suffix=" ${_('file added')} ";}
621 if(added==1){added_suffix=" ${_('file added')} ";}
615 if(changed==1){changed_suffix=" ${_('file changed')} ";}
622 if(changed==1){changed_suffix=" ${_('file changed')} ";}
616 if(removed==1){removed_suffix=" ${_('file removed')} ";}
623 if(removed==1){removed_suffix=" ${_('file removed')} ";}
617
624
618 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
625 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
619 +'<br/>'+
626 +'<br/>'+
620 nr_commits + nr_commits_suffix+'<br/>'+
627 nr_commits + nr_commits_suffix+'<br/>'+
621 added + added_suffix +'<br/>'+
628 added + added_suffix +'<br/>'+
622 changed + changed_suffix + '<br/>'+
629 changed + changed_suffix + '<br/>'+
623 removed + removed_suffix + '<br/>');
630 removed + removed_suffix + '<br/>');
624 }
631 }
625 }
632 }
626 else {
633 else {
627 var tooltip = YUD.get("tooltip");
634 var tooltip = YUD.get("tooltip");
628
635
629 if(tooltip) {
636 if(tooltip) {
630 tooltip.parentNode.removeChild(tooltip);
637 tooltip.parentNode.removeChild(tooltip);
631 }
638 }
632 previousPoint = null;
639 previousPoint = null;
633 }
640 }
634 }
641 }
635
642
636 /**
643 /**
637 * MAIN EXECUTION
644 * MAIN EXECUTION
638 */
645 */
639
646
640 var data = getDataAccordingToRanges(initial_ranges);
647 var data = getDataAccordingToRanges(initial_ranges);
641 generateCheckboxes(data);
648 generateCheckboxes(data);
642
649
643 //main plot
650 //main plot
644 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
651 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
645
652
646 //overview
653 //overview
647 var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options);
654 var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options);
648
655
649 //show initial selection on overview
656 //show initial selection on overview
650 overview.setSelection(initial_ranges);
657 overview.setSelection(initial_ranges);
651
658
652 plot.subscribe("plotselected", plotselected);
659 plot.subscribe("plotselected", plotselected);
653
660
654 overview.subscribe("plotselected", function (ranges) {
661 overview.subscribe("plotselected", function (ranges) {
655 plot.setSelection(ranges);
662 plot.setSelection(ranges);
656 });
663 });
657
664
658 plot.subscribe("plothover", plothover);
665 plot.subscribe("plothover", plothover);
659
666
660 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
667 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
661 }
668 }
662 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
669 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
663 </script>
670 </script>
664
671
665 </div>
672 </div>
666 </div>
673 </div>
667
674
668 <div class="box">
675 <div class="box">
669 <div class="title">
676 <div class="title">
670 <div class="breadcrumbs">${h.link_to(_('Shortlog'),h.url('shortlog_home',repo_name=c.repo_name))}</div>
677 <div class="breadcrumbs">${h.link_to(_('Shortlog'),h.url('shortlog_home',repo_name=c.repo_name))}</div>
671 </div>
678 </div>
672 <div class="table">
679 <div class="table">
673 <div id="shortlog_data">
680 <div id="shortlog_data">
674 <%include file='../shortlog/shortlog_data.html'/>
681 <%include file='../shortlog/shortlog_data.html'/>
675 </div>
682 </div>
676 ##%if c.repo_changesets:
683 ##%if c.repo_changesets:
677 ## ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
684 ## ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
678 ##%endif
685 ##%endif
679 </div>
686 </div>
680 </div>
687 </div>
681 <div class="box">
688 <div class="box">
682 <div class="title">
689 <div class="title">
683 <div class="breadcrumbs">${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</div>
690 <div class="breadcrumbs">${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</div>
684 </div>
691 </div>
685 <div class="table">
692 <div class="table">
686 <%include file='../tags/tags_data.html'/>
693 <%include file='../tags/tags_data.html'/>
687 %if c.repo_changesets:
694 %if c.repo_changesets:
688 ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
695 ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
689 %endif
696 %endif
690 </div>
697 </div>
691 </div>
698 </div>
692 <div class="box">
699 <div class="box">
693 <div class="title">
700 <div class="title">
694 <div class="breadcrumbs">${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</div>
701 <div class="breadcrumbs">${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</div>
695 </div>
702 </div>
696 <div class="table">
703 <div class="table">
697 <%include file='../branches/branches_data.html'/>
704 <%include file='../branches/branches_data.html'/>
698 %if c.repo_changesets:
705 %if c.repo_changesets:
699 ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
706 ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
700 %endif
707 %endif
701 </div>
708 </div>
702 </div>
709 </div>
703
710
704 </%def>
711 </%def>
General Comments 0
You need to be logged in to leave comments. Login now