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