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