Changeset - 6b37f08de732
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-02-11 13:07:26
marcin@python-works.com
#56 available options from users groups are now self avare of choosen options and doesn't display.
1 file changed with 32 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/admin/users_groups/users_group_edit.html
Show inline comments
 
@@ -99,35 +99,66 @@ ${h.end_form()}
 
            var D = YAHOO.util.Dom;
 
            var E = YAHOO.util.Event;
 
            
 
            //definition of containers ID's
 
            var available_container = 'available_members';
 
            var selected_container = 'users_group_members';
 
            
 
            //form containing containers id
 
            var form_id = 'edit_users_group';
 
            
 
            //temp container for selected storage.
 
            var cache = new Array();
 
            var av_cache = new Array();
 
            var c =  D.get(selected_container);
 
            var ac = D.get(available_container);
 
            
 
            //get only selected options for further fullfilment
 
            for(var i = 0;node =c.options[i];i++){
 
                if(node.selected){
 
                    //push selected to my temp storage left overs :)
 
                    cache.push(node);
 
                }   
 
                }
 
            }
 
            
 
            //clear 'selected' select
 
            c.options.length = 0;
 

	
 
            //fill it with remembered options
 
            for(var i = 0;node = cache[i];i++){
 
                c.options[i]=new Option(node.text, node.value, false, false);
 
            }
 
            
 
           
 
            //get all available options to cache
 
            for(var i = 0;node =ac.options[i];i++){
 
                    //push selected to my temp storage left overs :)
 
                    av_cache.push(node);
 
            }            
 
            
 
            //fill available only with those not in choosen
 
            ac.options.length=0;
 
            tmp_cache = new Array();
 
            
 
            for(var i = 0;node = av_cache[i];i++){
 
            	var add = true;
 
	            for(var i2 = 0;node_2 = cache[i2];i2++){
 
	                if(node.value == node_2.value){
 
	                	add=false;
 
	                	break;
 
	                }
 
	            }
 
	            if(add){
 
	            	tmp_cache.push(new Option(node.text, node.value, false, false));
 
	            }
 
            }            
 
            
 
            for(var i = 0;node = tmp_cache[i];i++){
 
                ac.options[i] = node;
 
            }
 
            
 
            function prompts_action_callback(e){
 
                
 
                var choosen = D.get(selected_container);  
 
                var available = D.get(available_container);
 
                
 
                //get checked and unchecked options from field
0 comments (0 inline, 0 general)