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