comparison rhodecode/templates/summary/summary.html @ 547:1e757ac98988

renamed project to rhodecode
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 06 Oct 2010 03:18:16 +0200
parents pylons_app/templates/summary/summary.html@946ed2955f48
children edf8567be8ed
comparison
equal deleted inserted replaced
546:7c2f5e4d7bbf 547:1e757ac98988
1 <%inherit file="/base/base.html"/>
2
3 <%def name="title()">
4 ${_('Mercurial Repository Overview')}
5 </%def>
6
7 <%def name="breadcrumbs_links()">
8 ${h.link_to(u'Home',h.url('/'))}
9 &raquo;
10 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 &raquo;
12 ${_('summary')}
13 </%def>
14
15 <%def name="page_nav()">
16 ${self.menu('summary')}
17 </%def>
18
19 <%def name="main()">
20 <script type="text/javascript">
21 var E = YAHOO.util.Event;
22 var D = YAHOO.util.Dom;
23
24 E.onDOMReady(function(e){
25 id = 'clone_url';
26 E.addListener(id,'click',function(e){
27 D.get('clone_url').select();
28 })
29 })
30 </script>
31 <div class="box box-left">
32 <!-- box / title -->
33 <div class="title">
34 ${self.breadcrumbs()}
35 </div>
36 <!-- end box / title -->
37 <div class="form">
38 <div class="fields">
39
40 <div class="field">
41 <div class="label">
42 <label>${_('Name')}:</label>
43 </div>
44 <div class="input-short">
45 %if c.repo_info.dbrepo.private:
46 <img style="margin-bottom:2px" class="icon" title="${_('private repository')}" alt="${_('private')}" src="/images/icons/lock.png"/>
47 %else:
48 <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public')}" src="/images/icons/lock_open.png"/>
49 %endif
50 <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span>
51 <br/>
52 %if c.repo_info.dbrepo.fork:
53 <span style="margin-top:5px">
54 <a href="${h.url('summary_home',repo_name=c.repo_info.dbrepo.fork.repo_name)}">
55 <img class="icon" alt="${_('public')}"
56 title="${_('Fork of')} ${c.repo_info.dbrepo.fork.repo_name}"
57 src="/images/icons/arrow_divide.png"/>
58 ${_('Fork of')} ${c.repo_info.dbrepo.fork.repo_name}
59 </a>
60 </span>
61 %endif
62 </div>
63 </div>
64
65
66 <div class="field">
67 <div class="label">
68 <label>${_('Description')}:</label>
69 </div>
70 <div class="input-short">
71 ${c.repo_info.description}
72 </div>
73 </div>
74
75
76 <div class="field">
77 <div class="label">
78 <label>${_('Contact')}:</label>
79 </div>
80 <div class="input-short">
81 <div class="gravatar">
82 <img alt="gravatar" src="${h.gravatar_url(c.repo_info.dbrepo.user.email)}"/>
83 </div>
84 ${_('Username')}: ${c.repo_info.dbrepo.user.username}<br/>
85 ${_('Name')}: ${c.repo_info.dbrepo.user.name} ${c.repo_info.dbrepo.user.lastname}<br/>
86 ${_('Email')}: <a href="mailto:${c.repo_info.dbrepo.user.email}">${c.repo_info.dbrepo.user.email}</a>
87 </div>
88 </div>
89
90 <div class="field">
91 <div class="label">
92 <label>${_('Last change')}:</label>
93 </div>
94 <div class="input-short">
95 ${h.age(c.repo_info.last_change)} - ${h.rfc822date_notz(c.repo_info.last_change)}
96 ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author}
97
98 </div>
99 </div>
100
101 <div class="field">
102 <div class="label">
103 <label>${_('Clone url')}:</label>
104 </div>
105 <div class="input-short">
106 <input type="text" id="clone_url" readonly="readonly" value="hg clone ${c.clone_repo_url}" size="70"/>
107 </div>
108 </div>
109
110 <div class="field">
111 <div class="label">
112 <label>${_('Trending languages')}:</label>
113 </div>
114 <div class="input-short">
115 <div id="lang_stats">
116
117 </div>
118 <script type="text/javascript">
119 var data = ${c.trending_languages|n};
120 var total = 0;
121 var no_data = true;
122 for (k in data){
123 total += data[k];
124 no_data = false;
125 }
126 var tbl = document.createElement('table');
127 tbl.setAttribute('class','trending_language_tbl');
128 for (k in data){
129 var tr = document.createElement('tr');
130 var percentage = Math.round((data[k]/total*100),2);
131 var value = data[k];
132 var td1 = document.createElement('td');
133 td1.width=150;
134 var trending_language_label = document.createElement('div');
135 trending_language_label.innerHTML = k;
136 td1.appendChild(trending_language_label);
137
138 var td2 = document.createElement('td');
139 var trending_language = document.createElement('div');
140 trending_language.title = k;
141 trending_language.innerHTML = "<b>"+percentage+"% "+value+" ${_('files')}</b>";
142 trending_language.setAttribute("class", 'trending_language');
143 trending_language.style.width=percentage+"%";
144 td2.appendChild(trending_language);
145
146 tr.appendChild(td1);
147 tr.appendChild(td2);
148 tbl.appendChild(tr);
149
150 }
151 if(no_data){
152 var tr = document.createElement('tr');
153 var td1 = document.createElement('td');
154 td1.innerHTML = "${_('No data loaded yet')}";
155 tr.appendChild(td1);
156 tbl.appendChild(tr);
157 }
158 YAHOO.util.Dom.get('lang_stats').appendChild(tbl);
159 </script>
160
161 </div>
162 </div>
163
164 <div class="field">
165 <div class="label">
166 <label>${_('Download')}:</label>
167 </div>
168 <div class="input-short">
169 %for cnt,archive in enumerate(c.repo_info._get_archives()):
170 %if cnt >=1:
171 |
172 %endif
173 ${h.link_to(c.repo_info.name+'.'+archive['type'],
174 h.url('files_archive_home',repo_name=c.repo_info.name,
175 revision='tip',fileformat=archive['extension']),class_="archive_icon")}
176 %endfor
177 </div>
178 </div>
179
180 <div class="field">
181 <div class="label">
182 <label>${_('Feeds')}:</label>
183 </div>
184 <div class="input-short">
185 ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')}
186 ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')}
187 </div>
188 </div>
189 </div>
190 </div>
191 </div>
192
193 <div class="box box-right" style="min-height:455px">
194 <!-- box / title -->
195 <div class="title">
196 <h5>${_('Commit activity by day / author')}</h5>
197 </div>
198
199 <div class="table">
200 <div id="commit_history" style="width:560px;height:300px;float:left"></div>
201 <div style="clear: both;height: 10px"></div>
202 <div id="overview" style="width:560px;height:100px;float:left"></div>
203
204 <div id="legend_data" style="clear:both;margin-top:10px;">
205 <div id="legend_container"></div>
206 <div id="legend_choices">
207 <table id="legend_choices_tables" style="font-size:smaller;color:#545454"></table>
208 </div>
209 </div>
210 <script type="text/javascript">
211 /**
212 * Plots summary graph
213 *
214 * @class SummaryPlot
215 * @param {from} initial from for detailed graph
216 * @param {to} initial to for detailed graph
217 * @param {dataset}
218 * @param {overview_dataset}
219 */
220 function SummaryPlot(from,to,dataset,overview_dataset) {
221 var initial_ranges = {
222 "xaxis":{
223 "from":from,
224 "to":to,
225 },
226 };
227 var dataset = dataset;
228 var overview_dataset = [overview_dataset];
229 var choiceContainer = YAHOO.util.Dom.get("legend_choices");
230 var choiceContainerTable = YAHOO.util.Dom.get("legend_choices_tables");
231 var plotContainer = YAHOO.util.Dom.get('commit_history');
232 var overviewContainer = YAHOO.util.Dom.get('overview');
233
234 var plot_options = {
235 bars: {show:true,align:'center',lineWidth:4},
236 legend: {show:true, container:"legend_container"},
237 points: {show:true,radius:0,fill:false},
238 yaxis: {tickDecimals:0,},
239 xaxis: {
240 mode: "time",
241 timeformat: "%d/%m",
242 min:from,
243 max:to,
244 },
245 grid: {
246 hoverable: true,
247 clickable: true,
248 autoHighlight:true,
249 color: "#999"
250 },
251 //selection: {mode: "x"}
252 };
253 var overview_options = {
254 legend:{show:false},
255 bars: {show:true,barWidth: 2,},
256 shadowSize: 0,
257 xaxis: {mode: "time", timeformat: "%d/%m/%y",},
258 yaxis: {ticks: 3, min: 0,},
259 grid: {color: "#999",},
260 selection: {mode: "x"}
261 };
262
263 /**
264 *get dummy data needed in few places
265 */
266 function getDummyData(label){
267 return {"label":label,
268 "data":[{"time":0,
269 "commits":0,
270 "added":0,
271 "changed":0,
272 "removed":0,
273 }],
274 "schema":["commits"],
275 "color":'#ffffff',
276 }
277 }
278
279 /**
280 * generate checkboxes accordindly to data
281 * @param keys
282 * @returns
283 */
284 function generateCheckboxes(data) {
285 //append checkboxes
286 var i = 0;
287 choiceContainerTable.innerHTML = '';
288 for(var pos in data) {
289
290 data[pos].color = i;
291 i++;
292 if(data[pos].label != ''){
293 choiceContainerTable.innerHTML += '<tr><td>'+
294 '<input type="checkbox" name="' + data[pos].label +'" checked="checked" />'
295 +data[pos].label+
296 '</td></tr>';
297 }
298 }
299 }
300
301 /**
302 * ToolTip show
303 */
304 function showTooltip(x, y, contents) {
305 var div=document.getElementById('tooltip');
306 if(!div) {
307 div = document.createElement('div');
308 div.id="tooltip";
309 div.style.position="absolute";
310 div.style.border='1px solid #fdd';
311 div.style.padding='2px';
312 div.style.backgroundColor='#fee';
313 document.body.appendChild(div);
314 }
315 YAHOO.util.Dom.setStyle(div, 'opacity', 0);
316 div.innerHTML = contents;
317 div.style.top=(y + 5) + "px";
318 div.style.left=(x + 5) + "px";
319
320 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
321 anim.animate();
322 }
323
324 /**
325 * This function will detect if selected period has some changesets for this user
326 if it does this data is then pushed for displaying
327 Additionally it will only display users that are selected by the checkbox
328 */
329 function getDataAccordingToRanges(ranges) {
330
331 var data = [];
332 var keys = [];
333 for(var key in dataset){
334 var push = false;
335 //method1 slow !!
336 ///*
337 for(var ds in dataset[key].data){
338 commit_data = dataset[key].data[ds];
339 //console.log(key);
340 //console.log(new Date(commit_data.time*1000));
341 //console.log(new Date(ranges.xaxis.from*1000));
342 //console.log(new Date(ranges.xaxis.to*1000));
343 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
344 push = true;
345 break;
346 }
347 }
348 //*/
349 /*//method2 sorted commit data !!!
350 var first_commit = dataset[key].data[0].time;
351 var last_commit = dataset[key].data[dataset[key].data.length-1].time;
352
353 console.log(first_commit);
354 console.log(last_commit);
355
356 if (first_commit >= ranges.xaxis.from && last_commit <= ranges.xaxis.to){
357 push = true;
358 }
359 */
360 if(push){
361 data.push(dataset[key]);
362 }
363 }
364 if(data.length >= 1){
365 return data;
366 }
367 else{
368 //just return dummy data for graph to plot itself
369 return [getDummyData('')];
370 }
371
372 }
373
374 /**
375 * redraw using new checkbox data
376 */
377 function plotchoiced(e,args){
378 var cur_data = args[0];
379 var cur_ranges = args[1];
380
381 var new_data = [];
382 var inputs = choiceContainer.getElementsByTagName("input");
383
384 //show only checked labels
385 for(var i=0; i<inputs.length; i++) {
386 var checkbox_key = inputs[i].name;
387
388 if(inputs[i].checked){
389 for(var d in cur_data){
390 if(cur_data[d].label == checkbox_key){
391 new_data.push(cur_data[d]);
392 }
393 }
394 }
395 else{
396 //push dummy data to not hide the label
397 new_data.push(getDummyData(checkbox_key));
398 }
399 }
400
401 var new_options = YAHOO.lang.merge(plot_options, {
402 xaxis: {
403 min: cur_ranges.xaxis.from,
404 max: cur_ranges.xaxis.to,
405 mode:"time",
406 timeformat: "%d/%m",
407 }
408 });
409 if (!new_data){
410 new_data = [[0,1]];
411 }
412 // do the zooming
413 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
414
415 plot.subscribe("plotselected", plotselected);
416
417 //resubscribe plothover
418 plot.subscribe("plothover", plothover);
419
420 // don't fire event on the overview to prevent eternal loop
421 overview.setSelection(cur_ranges, true);
422
423 }
424
425 /**
426 * plot only selected items from overview
427 * @param ranges
428 * @returns
429 */
430 function plotselected(ranges,cur_data) {
431 //updates the data for new plot
432 data = getDataAccordingToRanges(ranges);
433 generateCheckboxes(data);
434
435 var new_options = YAHOO.lang.merge(plot_options, {
436 xaxis: {
437 min: ranges.xaxis.from,
438 max: ranges.xaxis.to,
439 mode:"time",
440 timeformat: "%d/%m",
441 }
442 });
443 // do the zooming
444 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
445
446 plot.subscribe("plotselected", plotselected);
447
448 //resubscribe plothover
449 plot.subscribe("plothover", plothover);
450
451 // don't fire event on the overview to prevent eternal loop
452 overview.setSelection(ranges, true);
453
454 //resubscribe choiced
455 YAHOO.util.Event.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
456 }
457
458 var previousPoint = null;
459
460 function plothover(o) {
461 var pos = o.pos;
462 var item = o.item;
463
464 //YAHOO.util.Dom.get("x").innerHTML = pos.x.toFixed(2);
465 //YAHOO.util.Dom.get("y").innerHTML = pos.y.toFixed(2);
466 if (item) {
467 if (previousPoint != item.datapoint) {
468 previousPoint = item.datapoint;
469
470 var tooltip = YAHOO.util.Dom.get("tooltip");
471 if(tooltip) {
472 tooltip.parentNode.removeChild(tooltip);
473 }
474 var x = item.datapoint.x.toFixed(2);
475 var y = item.datapoint.y.toFixed(2);
476
477 if (!item.series.label){
478 item.series.label = 'commits';
479 }
480 var d = new Date(x*1000);
481 var fd = d.toDateString()
482 var nr_commits = parseInt(y);
483
484 var cur_data = dataset[item.series.label].data[item.dataIndex];
485 var added = cur_data.added;
486 var changed = cur_data.changed;
487 var removed = cur_data.removed;
488
489 var nr_commits_suffix = " ${_('commits')} ";
490 var added_suffix = " ${_('files added')} ";
491 var changed_suffix = " ${_('files changed')} ";
492 var removed_suffix = " ${_('files removed')} ";
493
494
495 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
496 if(added==1){added_suffix=" ${_('file added')} ";}
497 if(changed==1){changed_suffix=" ${_('file changed')} ";}
498 if(removed==1){removed_suffix=" ${_('file removed')} ";}
499
500 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
501 +'<br/>'+
502 nr_commits + nr_commits_suffix+'<br/>'+
503 added + added_suffix +'<br/>'+
504 changed + changed_suffix + '<br/>'+
505 removed + removed_suffix + '<br/>');
506 }
507 }
508 else {
509 var tooltip = YAHOO.util.Dom.get("tooltip");
510
511 if(tooltip) {
512 tooltip.parentNode.removeChild(tooltip);
513 }
514 previousPoint = null;
515 }
516 }
517
518 /**
519 * MAIN EXECUTION
520 */
521
522 var data = getDataAccordingToRanges(initial_ranges);
523 generateCheckboxes(data);
524
525 //main plot
526 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
527
528 //overview
529 var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options);
530
531 //show initial selection on overview
532 overview.setSelection(initial_ranges);
533
534 plot.subscribe("plotselected", plotselected);
535
536 overview.subscribe("plotselected", function (ranges) {
537 plot.setSelection(ranges);
538 });
539
540 plot.subscribe("plothover", plothover);
541
542 YAHOO.util.Event.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
543 }
544 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
545 </script>
546
547 </div>
548 </div>
549
550 <div class="box">
551 <div class="title">
552 <div class="breadcrumbs">${h.link_to(_('Last ten changes'),h.url('changelog_home',repo_name=c.repo_name))}</div>
553 </div>
554 <div class="table">
555 <%include file='../shortlog/shortlog_data.html'/>
556 %if c.repo_changesets:
557 ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))}
558 %endif
559 </div>
560 </div>
561 <div class="box">
562 <div class="title">
563 <div class="breadcrumbs">${h.link_to(_('Last ten tags'),h.url('tags_home',repo_name=c.repo_name))}</div>
564 </div>
565 <div class="table">
566 <%include file='../tags/tags_data.html'/>
567 %if c.repo_changesets:
568 ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))}
569 %endif
570 </div>
571 </div>
572 <div class="box">
573 <div class="title">
574 <div class="breadcrumbs">${h.link_to(_('Last ten branches'),h.url('branches_home',repo_name=c.repo_name))}</div>
575 </div>
576 <div class="table">
577 <%include file='../branches/branches_data.html'/>
578 %if c.repo_changesets:
579 ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))}
580 %endif
581 </div>
582 </div>
583
584 </%def>