Show More
@@ -160,7 +160,6 b' class ReposGroupsController(BaseControll' | |||||
160 |
|
160 | |||
161 | return redirect(url('repos_groups')) |
|
161 | return redirect(url('repos_groups')) | |
162 |
|
162 | |||
163 |
|
||||
164 | @HasPermissionAnyDecorator('hg.admin') |
|
163 | @HasPermissionAnyDecorator('hg.admin') | |
165 | def delete(self, id): |
|
164 | def delete(self, id): | |
166 | """DELETE /repos_groups/id: Delete an existing item""" |
|
165 | """DELETE /repos_groups/id: Delete an existing item""" |
@@ -112,11 +112,11 b'' | |||||
112 | <%include file="repo_edit_perms.html"/> |
|
112 | <%include file="repo_edit_perms.html"/> | |
113 | </div> |
|
113 | </div> | |
114 |
|
114 | |||
115 | <div class="buttons"> |
|
115 | <div class="buttons"> | |
116 | ${h.submit('save','Save',class_="ui-button")} |
|
116 | ${h.submit('save','Save',class_="ui-button")} | |
117 | ${h.reset('reset','Reset',class_="ui-button")} |
|
117 | ${h.reset('reset','Reset',class_="ui-button")} | |
|
118 | </div> | |||
118 | </div> |
|
119 | </div> | |
119 | </div> |
|
|||
120 | </div> |
|
120 | </div> | |
121 | </div> |
|
121 | </div> | |
122 | ${h.end_form()} |
|
122 | ${h.end_form()} |
@@ -137,9 +137,9 b'' | |||||
137 | %for repo in c.user_repos: |
|
137 | %for repo in c.user_repos: | |
138 | <tr> |
|
138 | <tr> | |
139 | <td> |
|
139 | <td> | |
140 |
%if repo['dbrepo']['repo_type'] |
|
140 | %if h.is_hg(repo['dbrepo']['repo_type']): | |
141 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> |
|
141 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
142 |
%elif repo['dbrepo']['repo_type'] |
|
142 | %elif h.is_git(repo['dbrepo']['repo_type']): | |
143 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> |
|
143 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
144 | %else: |
|
144 | %else: | |
145 |
|
145 |
@@ -140,151 +140,141 b'' | |||||
140 | </div> |
|
140 | </div> | |
141 | </div> |
|
141 | </div> | |
142 | <script type="text/javascript"> |
|
142 | <script type="text/javascript"> | |
143 |
|
|
143 | YAHOO.util.Event.onDOMReady(function(){ | |
144 |
|
|
144 | var D = YAHOO.util.Dom; | |
145 |
|
|
145 | var E = YAHOO.util.Event; | |
146 |
|
||||
147 | //definition of containers ID's |
|
|||
148 | var available_container = 'available_members'; |
|
|||
149 | var selected_container = 'users_group_members'; |
|
|||
150 |
|
146 | |||
151 | //form containing containers id |
|
147 | //definition of containers ID's | |
152 | var form_id = 'edit_users_group'; |
|
148 | var available_container = 'available_members'; | |
|
149 | var selected_container = 'users_group_members'; | |||
153 |
|
150 | |||
154 | //temp container for selected storage. |
|
151 | //form containing containers id | |
155 | var cache = new Array(); |
|
152 | var form_id = 'edit_users_group'; | |
156 | var av_cache = new Array(); |
|
|||
157 | var c = D.get(selected_container); |
|
|||
158 | var ac = D.get(available_container); |
|
|||
159 |
|
153 | |||
160 | //get only selected options for further fullfilment |
|
154 | //temp container for selected storage. | |
161 | for(var i = 0;node =c.options[i];i++){ |
|
155 | var cache = new Array(); | |
162 | if(node.selected){ |
|
156 | var av_cache = new Array(); | |
163 | //push selected to my temp storage left overs :) |
|
157 | var c = D.get(selected_container); | |
164 | cache.push(node); |
|
158 | var ac = D.get(available_container); | |
165 | } |
|
|||
166 | } |
|
|||
167 |
|
159 | |||
168 | //clear 'selected' select |
|
160 | //get only selected options for further fullfilment | |
169 | //c.options.length = 0; |
|
161 | for(var i = 0;node =c.options[i];i++){ | |
|
162 | if(node.selected){ | |||
|
163 | //push selected to my temp storage left overs :) | |||
|
164 | cache.push(node); | |||
|
165 | } | |||
|
166 | } | |||
170 |
|
167 | |||
171 | //fill it with remembered options |
|
168 | //get all available options to cache | |
172 |
|
|
169 | for(var i = 0;node =ac.options[i];i++){ | |
173 | // c.options[i]=new Option(node.text, node.value, false, false); |
|
170 | //push selected to my temp storage left overs :) | |
174 | //} |
|
171 | av_cache.push(node); | |
175 |
|
172 | } | ||
176 |
|
173 | |||
177 | //get all available options to cache |
|
174 | //fill available only with those not in choosen | |
178 | for(var i = 0;node =ac.options[i];i++){ |
|
175 | ac.options.length=0; | |
179 | //push selected to my temp storage left overs :) |
|
176 | tmp_cache = new Array(); | |
180 | av_cache.push(node); |
|
|||
181 | } |
|
|||
182 |
|
||||
183 | //fill available only with those not in choosen |
|
|||
184 | ac.options.length=0; |
|
|||
185 | tmp_cache = new Array(); |
|
|||
186 |
|
177 | |||
187 |
|
|
178 | for(var i = 0;node = av_cache[i];i++){ | |
188 |
|
|
179 | var add = true; | |
189 |
|
|
180 | for(var i2 = 0;node_2 = cache[i2];i2++){ | |
190 |
|
|
181 | if(node.value == node_2.value){ | |
191 |
|
|
182 | add=false; | |
192 |
|
|
183 | break; | |
193 |
|
|
184 | } | |
194 | } |
|
185 | } | |
195 |
|
|
186 | if(add){ | |
196 |
|
|
187 | tmp_cache.push(new Option(node.text, node.value, false, false)); | |
197 | } |
|
188 | } | |
198 | } |
|
189 | } | |
199 |
|
190 | |||
200 |
|
|
191 | for(var i = 0;node = tmp_cache[i];i++){ | |
201 |
|
|
192 | ac.options[i] = node; | |
202 | } |
|
193 | } | |
203 |
|
194 | |||
204 |
|
|
195 | function prompts_action_callback(e){ | |
205 |
|
196 | |||
206 |
|
|
197 | var choosen = D.get(selected_container); | |
207 |
|
|
198 | var available = D.get(available_container); | |
208 |
|
199 | |||
209 |
|
|
200 | //get checked and unchecked options from field | |
210 |
|
|
201 | function get_checked(from_field){ | |
211 |
|
|
202 | //temp container for storage. | |
212 |
|
|
203 | var sel_cache = new Array(); | |
213 |
|
|
204 | var oth_cache = new Array(); | |
214 |
|
205 | |||
215 |
|
|
206 | for(var i = 0;node = from_field.options[i];i++){ | |
216 |
|
|
207 | if(node.selected){ | |
217 |
|
|
208 | //push selected fields :) | |
218 |
|
|
209 | sel_cache.push(node); | |
219 |
|
|
210 | } | |
220 |
|
|
211 | else{ | |
221 |
|
|
212 | oth_cache.push(node) | |
222 |
|
|
213 | } | |
223 |
|
|
214 | } | |
224 |
|
215 | |||
225 |
|
|
216 | return [sel_cache,oth_cache] | |
226 | } |
|
217 | } | |
227 |
|
218 | |||
228 |
|
|
219 | //fill the field with given options | |
229 |
|
|
220 | function fill_with(field,options){ | |
230 |
|
|
221 | //clear firtst | |
231 |
|
|
222 | field.options.length=0; | |
232 |
|
|
223 | for(var i = 0;node = options[i];i++){ | |
233 |
|
|
224 | field.options[i]=new Option(node.text, node.value, | |
234 |
|
|
225 | false, false); | |
235 |
|
|
226 | } | |
236 |
|
227 | |||
237 | } |
|
228 | } | |
238 |
|
|
229 | //adds to current field | |
239 |
|
|
230 | function add_to(field,options){ | |
240 |
|
|
231 | for(var i = 0;node = options[i];i++){ | |
241 |
|
|
232 | field.appendChild(new Option(node.text, node.value, | |
242 |
|
|
233 | false, false)); | |
243 |
|
|
234 | } | |
244 | } |
|
235 | } | |
245 |
|
236 | |||
246 |
|
|
237 | // add action | |
247 |
|
|
238 | if (this.id=='add_element'){ | |
248 |
|
|
239 | var c = get_checked(available); | |
249 |
|
|
240 | add_to(choosen,c[0]); | |
250 |
|
|
241 | fill_with(available,c[1]); | |
251 | } |
|
242 | } | |
252 |
|
|
243 | // remove action | |
253 |
|
|
244 | if (this.id=='remove_element'){ | |
254 |
|
|
245 | var c = get_checked(choosen); | |
255 |
|
|
246 | add_to(available,c[0]); | |
256 |
|
|
247 | fill_with(choosen,c[1]); | |
257 | } |
|
248 | } | |
258 |
|
|
249 | // add all elements | |
259 |
|
|
250 | if(this.id=='add_all_elements'){ | |
260 |
|
|
251 | for(var i=0; node = available.options[i];i++){ | |
261 |
|
|
252 | choosen.appendChild(new Option(node.text, | |
262 |
|
|
253 | node.value, false, false)); | |
263 |
|
|
254 | } | |
264 |
|
|
255 | available.options.length = 0; | |
265 | } |
|
256 | } | |
266 |
|
|
257 | //remove all elements | |
267 |
|
|
258 | if(this.id=='remove_all_elements'){ | |
268 |
|
|
259 | for(var i=0; node = choosen.options[i];i++){ | |
269 |
|
|
260 | available.appendChild(new Option(node.text, | |
270 |
|
|
261 | node.value, false, false)); | |
271 |
|
|
262 | } | |
272 |
|
|
263 | choosen.options.length = 0; | |
273 | } |
|
264 | } | |
274 |
|
265 | |||
275 | } |
|
266 | } | |
276 |
|
||||
277 |
|
267 | |||
278 |
|
|
268 | E.addListener(['add_element','remove_element', | |
279 |
|
|
269 | 'add_all_elements','remove_all_elements'],'click', | |
280 |
|
|
270 | prompts_action_callback) | |
281 |
|
271 | |||
282 |
|
|
272 | E.addListener(form_id,'submit',function(){ | |
283 |
|
|
273 | var choosen = D.get(selected_container); | |
284 |
|
|
274 | for (var i = 0; i < choosen.options.length; i++) { | |
285 |
|
|
275 | choosen.options[i].selected = 'selected'; | |
286 | } |
|
276 | } | |
287 | }) |
|
277 | }); | |
288 | }); |
|
278 | }); | |
289 | </script> |
|
279 | </script> | |
290 | </%def> |
|
280 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now