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