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