Show More
@@ -26,10 +26,11 b' from pylons import request, response, se' | |||||
26 | from pylons.controllers.util import abort, redirect |
|
26 | from pylons.controllers.util import abort, redirect | |
27 | from pylons_app.lib.auth import LoginRequired |
|
27 | from pylons_app.lib.auth import LoginRequired | |
28 | from pylons_app.lib.base import BaseController, render |
|
28 | from pylons_app.lib.base import BaseController, render | |
29 | from pylons_app.lib.indexers import ANALYZER, IDX_LOCATION, SCHEMA |
|
29 | from pylons_app.lib.indexers import ANALYZER, IDX_LOCATION, SCHEMA, IDX_NAME | |
30 | from webhelpers.html.builder import escape |
|
30 | from webhelpers.html.builder import escape | |
31 | from whoosh.highlight import highlight, SimpleFragmenter, HtmlFormatter, \ |
|
31 | from whoosh.highlight import highlight, SimpleFragmenter, HtmlFormatter, \ | |
32 | ContextFragmenter |
|
32 | ContextFragmenter | |
|
33 | from pylons.i18n.translation import _ | |||
33 | from whoosh.index import open_dir, EmptyIndexError |
|
34 | from whoosh.index import open_dir, EmptyIndexError | |
34 | from whoosh.qparser import QueryParser, QueryParserError |
|
35 | from whoosh.qparser import QueryParser, QueryParserError | |
35 | from whoosh.query import Phrase |
|
36 | from whoosh.query import Phrase | |
@@ -56,7 +57,7 b' class SearchController(BaseController):' | |||||
56 |
|
57 | |||
57 | if c.cur_query: |
|
58 | if c.cur_query: | |
58 | try: |
|
59 | try: | |
59 |
idx = open_dir(IDX_LOCATION, indexname= |
|
60 | idx = open_dir(IDX_LOCATION, indexname=IDX_NAME) | |
60 | searcher = idx.searcher() |
|
61 | searcher = idx.searcher() | |
61 |
|
62 | |||
62 | qp = QueryParser("content", schema=SCHEMA) |
|
63 | qp = QueryParser("content", schema=SCHEMA) | |
@@ -99,12 +100,12 b' class SearchController(BaseController):' | |||||
99 | c.formated_results.append(d) |
|
100 | c.formated_results.append(d) | |
100 |
|
101 | |||
101 | except QueryParserError: |
|
102 | except QueryParserError: | |
102 | c.runtime = 'Invalid search query. Try quoting it.' |
|
103 | c.runtime = _('Invalid search query. Try quoting it.') | |
103 |
|
104 | |||
104 | except (EmptyIndexError, IOError): |
|
105 | except (EmptyIndexError, IOError): | |
105 | log.error(traceback.format_exc()) |
|
106 | log.error(traceback.format_exc()) | |
106 | log.error('Empty Index data') |
|
107 | log.error('Empty Index data') | |
107 | c.runtime = 'There is no index to search in. Please run whoosh indexer' |
|
108 | c.runtime = _('There is no index to search in. Please run whoosh indexer') | |
108 |
|
109 | |||
109 |
|
110 | |||
110 |
|
111 |
@@ -77,7 +77,8 b' class SummaryController(BaseController):' | |||||
77 | y = td.year |
|
77 | y = td.year | |
78 | m = td.month |
|
78 | m = td.month | |
79 | d = td.day |
|
79 | d = td.day | |
80 |
c.ts_min = mktime((y, (td - timedelta(days=calendar.mdays[m] - 1)).month, |
|
80 | c.ts_min = mktime((y, (td - timedelta(days=calendar.mdays[m] - 1)).month, | |
|
81 | d, 0, 0, 0, 0, 0, 0,)) | |||
81 | c.ts_max = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) |
|
82 | c.ts_max = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) | |
82 |
|
83 | |||
83 |
|
84 | |||
@@ -93,25 +94,44 b' class SummaryController(BaseController):' | |||||
93 | k = mktime(timetupple) |
|
94 | k = mktime(timetupple) | |
94 | if aggregate.has_key(author_key_cleaner(cs.author)): |
|
95 | if aggregate.has_key(author_key_cleaner(cs.author)): | |
95 | if aggregate[author_key_cleaner(cs.author)].has_key(k): |
|
96 | if aggregate[author_key_cleaner(cs.author)].has_key(k): | |
96 | aggregate[author_key_cleaner(cs.author)][k] += 1 |
|
97 | aggregate[author_key_cleaner(cs.author)][k]["commits"] += 1 | |
|
98 | aggregate[author_key_cleaner(cs.author)][k]["added"] += len(cs.added) | |||
|
99 | aggregate[author_key_cleaner(cs.author)][k]["changed"] += len(cs.changed) | |||
|
100 | aggregate[author_key_cleaner(cs.author)][k]["removed"] += len(cs.removed) | |||
|
101 | ||||
97 | else: |
|
102 | else: | |
98 | #aggregate[author_key_cleaner(cs.author)].update(dates_range) |
|
103 | #aggregate[author_key_cleaner(cs.author)].update(dates_range) | |
99 | if k >= c.ts_min and k <= c.ts_max: |
|
104 | if k >= c.ts_min and k <= c.ts_max: | |
100 |
aggregate[author_key_cleaner(cs.author)][k] = |
|
105 | aggregate[author_key_cleaner(cs.author)][k] = {} | |
|
106 | aggregate[author_key_cleaner(cs.author)][k]["commits"] = 1 | |||
|
107 | aggregate[author_key_cleaner(cs.author)][k]["added"] = len(cs.added) | |||
|
108 | aggregate[author_key_cleaner(cs.author)][k]["changed"] = len(cs.changed) | |||
|
109 | aggregate[author_key_cleaner(cs.author)][k]["removed"] = len(cs.removed) | |||
|
110 | ||||
101 | else: |
|
111 | else: | |
102 | if k >= c.ts_min and k <= c.ts_max: |
|
112 | if k >= c.ts_min and k <= c.ts_max: | |
103 | aggregate[author_key_cleaner(cs.author)] = OrderedDict() |
|
113 | aggregate[author_key_cleaner(cs.author)] = OrderedDict() | |
104 | #aggregate[author_key_cleaner(cs.author)].update(dates_range) |
|
114 | #aggregate[author_key_cleaner(cs.author)].update(dates_range) | |
105 |
aggregate[author_key_cleaner(cs.author)][k] = |
|
115 | aggregate[author_key_cleaner(cs.author)][k] = {} | |
|
116 | aggregate[author_key_cleaner(cs.author)][k]["commits"] = 1 | |||
|
117 | aggregate[author_key_cleaner(cs.author)][k]["added"] = len(cs.added) | |||
|
118 | aggregate[author_key_cleaner(cs.author)][k]["changed"] = len(cs.changed) | |||
|
119 | aggregate[author_key_cleaner(cs.author)][k]["removed"] = len(cs.removed) | |||
106 |
|
120 | |||
107 | d = '' |
|
121 | d = '' | |
108 | tmpl0 = u""""%s":%s""" |
|
122 | tmpl0 = u""""%s":%s""" | |
109 | tmpl1 = u"""{label:"%s",data:%s},""" |
|
123 | tmpl1 = u"""{label:"%s",data:%s,schema:["commits"]},""" | |
110 | for author in aggregate: |
|
124 | for author in aggregate: | |
|
125 | ||||
111 | d += tmpl0 % (author.decode('utf8'), |
|
126 | d += tmpl0 % (author.decode('utf8'), | |
112 | tmpl1 \ |
|
127 | tmpl1 \ | |
113 | % (author.decode('utf8'), |
|
128 | % (author.decode('utf8'), | |
114 | [[x, aggregate[author][x]] for x in aggregate[author]])) |
|
129 | [{"time":x, | |
|
130 | "commits":aggregate[author][x]['commits'], | |||
|
131 | "added":aggregate[author][x]['added'], | |||
|
132 | "changed":aggregate[author][x]['changed'], | |||
|
133 | "removed":aggregate[author][x]['removed'], | |||
|
134 | } for x in aggregate[author]])) | |||
115 | if d == '': |
|
135 | if d == '': | |
116 | d = '"%s":{label:"%s",data:[[0,1],]}' \ |
|
136 | d = '"%s":{label:"%s",data:[[0,1],]}' \ | |
117 | % (author_key_cleaner(repo.contact), |
|
137 | % (author_key_cleaner(repo.contact), |
@@ -67,7 +67,7 b' table.code-difftable td {' | |||||
67 | padding-left:2px; |
|
67 | padding-left:2px; | |
68 | padding-right:2px; |
|
68 | padding-right:2px; | |
69 | text-align:right; |
|
69 | text-align:right; | |
70 |
width: |
|
70 | width:30px; | |
71 | -moz-user-select:none; |
|
71 | -moz-user-select:none; | |
72 | -webkit-user-select: none; |
|
72 | -webkit-user-select: none; | |
73 | } |
|
73 | } |
@@ -185,7 +185,7 b' div.options a:hover' | |||||
185 | #header |
|
185 | #header | |
186 | { |
|
186 | { | |
187 | margin: 0; |
|
187 | margin: 0; | |
188 |
padding: 0 |
|
188 | padding: 0 30px 0 30px; | |
189 | background: #b0b0b0 url("../images/header_background.png") repeat; |
|
189 | background: #b0b0b0 url("../images/header_background.png") repeat; | |
190 | } |
|
190 | } | |
191 |
|
191 |
@@ -2,7 +2,7 b'' | |||||
2 | GLOBAL WIDTH |
|
2 | GLOBAL WIDTH | |
3 | ----------------------------------------------------------- */ |
|
3 | ----------------------------------------------------------- */ | |
4 | #header,#content,#footer{ |
|
4 | #header,#content,#footer{ | |
5 |
min-width: 1 |
|
5 | min-width: 1224px; | |
6 | } |
|
6 | } | |
7 |
|
7 | |||
8 | /* ----------------------------------------------------------- |
|
8 | /* ----------------------------------------------------------- | |
@@ -11,7 +11,7 b'' | |||||
11 |
|
11 | |||
12 | #content |
|
12 | #content | |
13 | { |
|
13 | { | |
14 |
margin: 10px |
|
14 | margin: 10px 30px 0 30px; | |
15 | padding: 0; |
|
15 | padding: 0; | |
16 | min-height: 100%; |
|
16 | min-height: 100%; | |
17 | clear: both; |
|
17 | clear: both; |
@@ -26,7 +26,8 b'' | |||||
26 | <h2>${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h2> |
|
26 | <h2>${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h2> | |
27 | <dl class="overview"> |
|
27 | <dl class="overview"> | |
28 | <dt>${_('Last revision')}</dt> |
|
28 | <dt>${_('Last revision')}</dt> | |
29 |
<dd> |
|
29 | <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short), | |
|
30 | h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file.last_changeset._short,f_path=c.f_path))} </dd> | |||
30 | <dt>${_('Size')}</dt> |
|
31 | <dt>${_('Size')}</dt> | |
31 | <dd>${h.format_byte_size(c.file.size,binary=True)}</dd> |
|
32 | <dd>${h.format_byte_size(c.file.size,binary=True)}</dd> | |
32 | <dt>${_('Options')}</dt> |
|
33 | <dt>${_('Options')}</dt> |
@@ -1,6 +1,9 b'' | |||||
1 | <dl> |
|
1 | <dl> | |
2 | <dt>${_('Last revision')}</dt> |
|
2 | <dt>${_('Last revision')}</dt> | |
3 | <dd>r${c.files_list.last_changeset.revision}:${c.files_list.last_changeset._short}</dd> |
|
3 | <dd> | |
|
4 | ${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,c.files_list.last_changeset._short), | |||
|
5 | h.url('files_home',repo_name=c.repo_name,revision=c.files_list.last_changeset._short,f_path=c.f_path))} | |||
|
6 | </dd> | |||
4 | <dt>${_('Size')}</dt> |
|
7 | <dt>${_('Size')}</dt> | |
5 | <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd> |
|
8 | <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd> | |
6 | <dt>${_('Options')}</dt> |
|
9 | <dt>${_('Options')}</dt> | |
@@ -11,11 +14,13 b'' | |||||
11 | </dd> |
|
14 | </dd> | |
12 | <dt>${_('History')}</dt> |
|
15 | <dt>${_('History')}</dt> | |
13 | <dd> |
|
16 | <dd> | |
14 | ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='GET')} |
|
17 | <div> | |
|
18 | ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')} | |||
15 | ${h.hidden('diff2',c.files_list.last_changeset._short)} |
|
19 | ${h.hidden('diff2',c.files_list.last_changeset._short)} | |
16 | ${h.select('diff1','',c.file_history)} |
|
20 | ${h.select('diff1','',c.file_history)} | |
17 | ${h.submit('diff','diff',class_="ui-button ui-widget ui-state-default ui-corner-all")} |
|
21 | ${h.submit('diff','diff',class_="ui-button ui-widget ui-state-default ui-corner-all")} | |
18 | ${h.end_form()} |
|
22 | ${h.end_form()} | |
|
23 | </div> | |||
19 | </dd> |
|
24 | </dd> | |
20 | </dl> |
|
25 | </dl> | |
21 |
|
26 |
@@ -118,14 +118,14 b' E.onDOMReady(function(e){' | |||||
118 | </div> |
|
118 | </div> | |
119 | </div> |
|
119 | </div> | |
120 |
|
120 | |||
121 | <div class="box box-right"> |
|
121 | <div class="box box-right" style="min-height:455px"> | |
122 | <!-- box / title --> |
|
122 | <!-- box / title --> | |
123 | <div class="title"> |
|
123 | <div class="title"> | |
124 | <h5>${_('Last month commit activity')}</h5> |
|
124 | <h5>${_('Last month commit activity')}</h5> | |
125 | </div> |
|
125 | </div> | |
126 |
|
126 | |||
127 | <div class="table"> |
|
127 | <div class="table"> | |
128 |
<div id="commit_history" style="width: |
|
128 | <div id="commit_history" style="width:560px;height:300px;float:left"></div> | |
129 | <div id="legend_data"> |
|
129 | <div id="legend_data"> | |
130 | <div id="legend_container"></div> |
|
130 | <div id="legend_container"></div> | |
131 | <div id="legend_choices"> |
|
131 | <div id="legend_choices"> | |
@@ -142,11 +142,10 b' E.onDOMReady(function(e){' | |||||
142 | for(var key in datasets) { |
|
142 | for(var key in datasets) { | |
143 | datasets[key].color = i; |
|
143 | datasets[key].color = i; | |
144 | i++; |
|
144 | i++; | |
145 | choiceContainerTable.innerHTML += '<tr>'+ |
|
145 | choiceContainerTable.innerHTML += '<tr><td>'+ | |
146 | '<td>'+ |
|
146 | '<input type="checkbox" name="' + key +'" checked="checked" />' | |
147 | '<input type="checkbox" name="' + key +'" checked="checked" />'+datasets[key].label+ |
|
147 | +datasets[key].label+ | |
148 |
|
|
148 | '</td></tr>'; | |
149 | '</tr>'; |
|
|||
150 | }; |
|
149 | }; | |
151 |
|
150 | |||
152 |
|
151 | |||
@@ -164,6 +163,7 b' E.onDOMReady(function(e){' | |||||
164 | }; |
|
163 | }; | |
165 |
|
164 | |||
166 | if (data.length > 0){ |
|
165 | if (data.length > 0){ | |
|
166 | ||||
167 | var plot = YAHOO.widget.Flot("commit_history", data, |
|
167 | var plot = YAHOO.widget.Flot("commit_history", data, | |
168 | { bars: { show: true, align:'center',lineWidth:4 }, |
|
168 | { bars: { show: true, align:'center',lineWidth:4 }, | |
169 | points: { show: true, radius:0,fill:true }, |
|
169 | points: { show: true, radius:0,fill:true }, | |
@@ -211,18 +211,36 b' E.onDOMReady(function(e){' | |||||
211 | } |
|
211 | } | |
212 | var x = item.datapoint.x.toFixed(2); |
|
212 | var x = item.datapoint.x.toFixed(2); | |
213 | var y = item.datapoint.y.toFixed(2); |
|
213 | var y = item.datapoint.y.toFixed(2); | |
214 |
|
214 | |||
215 | if (!item.series.label){ |
|
215 | if (!item.series.label){ | |
216 | item.series.label = 'commits'; |
|
216 | item.series.label = 'commits'; | |
217 | } |
|
217 | } | |
218 | var d = new Date(x*1000); |
|
218 | var d = new Date(x*1000); | |
219 | var fd = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate(); |
|
219 | var fd = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate(); | |
220 | var nr_commits = parseInt(y); |
|
220 | var nr_commits = parseInt(y); | |
221 |
|
|
221 | ||
222 | if(nr_commits > 1){ |
|
222 | var cur_data = datasets[item.series.label].data[item.dataIndex]; | |
223 | var suffix = 's'; |
|
223 | var added = cur_data.added; | |
224 | } |
|
224 | var changed = cur_data.changed; | |
225 | showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd + ": " + nr_commits+" commit" + suffix); |
|
225 | var removed = cur_data.removed; | |
|
226 | ||||
|
227 | var nr_commits_suffix = " ${_('commits')} "; | |||
|
228 | var added_suffix = " ${_('files added')} "; | |||
|
229 | var changed_suffix = " ${_('files changed')} "; | |||
|
230 | var removed_suffix = " ${_('files removed')} "; | |||
|
231 | ||||
|
232 | ||||
|
233 | if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";} | |||
|
234 | if(added==1){added_suffix=" ${_('file added')} ";} | |||
|
235 | if(changed==1){changed_suffix=" ${_('file changed')} ";} | |||
|
236 | if(removed==1){removed_suffix=" ${_('file removed')} ";} | |||
|
237 | ||||
|
238 | showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd | |||
|
239 | +'<br/>'+ | |||
|
240 | nr_commits + nr_commits_suffix+'<br/>'+ | |||
|
241 | added + added_suffix +'<br/>'+ | |||
|
242 | changed + changed_suffix + '<br/>'+ | |||
|
243 | removed + removed_suffix + '<br/>'); | |||
226 | } |
|
244 | } | |
227 | } |
|
245 | } | |
228 | else { |
|
246 | else { | |
@@ -253,6 +271,7 b' E.onDOMReady(function(e){' | |||||
253 | </div> |
|
271 | </div> | |
254 | <div class="table"> |
|
272 | <div class="table"> | |
255 | <%include file='../shortlog/shortlog_data.html'/> |
|
273 | <%include file='../shortlog/shortlog_data.html'/> | |
|
274 | ${h.link_to(_('show more'),h.url('changelog_home',repo_name=c.repo_name))} | |||
256 | </div> |
|
275 | </div> | |
257 | </div> |
|
276 | </div> | |
258 | <div class="box"> |
|
277 | <div class="box"> | |
@@ -261,6 +280,7 b' E.onDOMReady(function(e){' | |||||
261 | </div> |
|
280 | </div> | |
262 | <div class="table"> |
|
281 | <div class="table"> | |
263 | <%include file='../tags/tags_data.html'/> |
|
282 | <%include file='../tags/tags_data.html'/> | |
|
283 | ${h.link_to(_('show more'),h.url('tags_home',repo_name=c.repo_name))} | |||
264 | </div> |
|
284 | </div> | |
265 | </div> |
|
285 | </div> | |
266 | <div class="box"> |
|
286 | <div class="box"> | |
@@ -269,6 +289,7 b' E.onDOMReady(function(e){' | |||||
269 | </div> |
|
289 | </div> | |
270 | <div class="table"> |
|
290 | <div class="table"> | |
271 | <%include file='../branches/branches_data.html'/> |
|
291 | <%include file='../branches/branches_data.html'/> | |
|
292 | ${h.link_to(_('show more'),h.url('branches_home',repo_name=c.repo_name))} | |||
272 | </div> |
|
293 | </div> | |
273 | </div> |
|
294 | </div> | |
274 |
|
295 |
General Comments 0
You need to be logged in to leave comments.
Login now