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