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