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