Index: trunk/expressoAdmin1_2/js/jscode/groups.js
===================================================================
--- trunk/expressoAdmin1_2/js/jscode/groups.js	(revision 2)
+++ trunk/expressoAdmin1_2/js/jscode/groups.js	(revision 33)
@@ -277,2 +277,37 @@
 	}
 }
+
+function use_samba_attrs(value)
+{
+	document.forms[0].sambadomain.disabled = !value;
+}
+
+function get_available_sambadomains(context, type)
+{
+	if ((type == 'create_group') && (document.getElementById('ea_div_display_samba_options').style.display != 'none'))
+	{
+		var handler_get_available_sambadomains = function(data)
+		{
+			document.forms[0].use_attrs_samba.checked = data.status;
+			use_samba_attrs(data.status);
+			
+			if (data.status)
+			{
+				combo_sambadomains = document.getElementById('ea_combo_sambadomains');
+				for (i=0; i<data.sambaDomains.length; i++)
+				{
+					for (j=0; j<combo_sambadomains.length; j++)
+					{
+						if (combo_sambadomains.options[j].text == data.sambaDomains[i])
+						{
+							combo_sambadomains.options[j].selected = true;
+							break;
+						}
+					}
+				}
+				
+			}
+		}
+		cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains);
+	}
+}
Index: trunk/expressoAdmin1_2/js/jscode/users.js
===================================================================
--- trunk/expressoAdmin1_2/js/jscode/users.js	(revision 32)
+++ trunk/expressoAdmin1_2/js/jscode/users.js	(revision 33)
@@ -199,53 +199,4 @@
 }
 
-/*
-function get_sectors(organization, user_context, user_sector)
-{
-	return;
-	var handler_get_sectors = function(data)
-	{
-		select_sector = document.getElementById('ea_select_sectors');
-		//Limpa o select
-		for(var i=0; i<select_sector.options.length; i++)
-		{
-			if(select_sector.options[i].selected == true)
-			{
-				select_sector.options[i] = null;
-				i--;
-			}
-		}
-		
-		if (data.length > 0)
-		{
-			option_seleted = false;
-
-			new_option = new Option('Sem Setor','',false,false);
-			select_sector.options[0] = new_option;
-
-			for (i=0; i<data.length; i++)
-			{
-				new_option = new Option(data[i].sector,data[i].sector,false,false);
-				select_sector.options[i+1] = new_option;
-				if ((user_sector == data[i].sector) && (user_context == organization))
-				{
-					select_sector.options[i+1].selected = true;
-					option_seleted = true;
-				}
-			}
-			select_sector.disabled = false;
-			if (!option_seleted)
-				select_sector.options[0].selected = true;
-		}
-		else
-		{
-			new_option = new Option('Nenhum setor cadastrado para esta organização.','',false,false);
-			select_sector.options[0] = new_option;
-			select_sector.options[0].selected = true;
-		}	
-	}
-	cExecute ('$this.db_functions.get_sectors&organization='+organization, handler_get_sectors);
-}
-*/
-
 function get_available_groups(context)
 {
@@ -253,30 +204,24 @@
 	{
 		select_available_groups = document.getElementById('ea_select_available_groups');
-		//Limpa o select
-		for(var i=0; i<select_available_groups.options.length; i++)
-		{
-			select_available_groups.options[i] = null;
-			i--;
-		}
-
-		if (data.length > 0)
-		{
-			for (i=0; i<data.length; i++)
-			{
-				new_option = new Option(data[i].cn[0],data[i].gidnumber[0],false,false);
-				select_available_groups.options[i] = new_option;
-			}
-			//select_available_groups.disabled = false;
-			select_available_groups.options[0].selected = true;
+
+		if ((data) && (data.length > 0))
+		{
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_groups.innerHTML = '#' + data;
+			select_available_groups.outerHTML = select_available_groups.outerHTML;
 			select_available_groups_clone = select_available_groups.cloneNode(true);
 			document.getElementById('ea_input_searchGroup').value = '';
-			
+		}
+		else
+		{
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_groups.innerHTML = '#';
+			select_available_groups.outerHTML = select_available_groups.outerHTML;
 		}
 	}	
 		
-cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups);
-}
-	
-
+	cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups);
+}
+	
 function add_user2group()
 {
@@ -348,31 +293,4 @@
 		}
 	}
-	
-	//return;
-	/*
-	//Refaz combo do primary group
-	for(var i=0; i<combo_primary_user_group.options.length; i++)
-	{
-		if(combo_primary_user_group.options[i].selected == true)
-		{
-			var user_primary_group = combo_primary_user_group.options[i].value;
-			alert(user_primary_group);
-		}
-		
-		combo_primary_user_group.options[i] = null;
-		i--;
-	}
-	
-	for(var i = 0;i < select_user_groups.options.length; i++)
-	{
-		new_option = document.createElement('option');
-		new_option.value= select_user_groups.options[i].value;
-		new_option.text = select_user_groups.options[i].text;
-		
-		if (user_primary_group == select_user_groups.options[i].value)
-			new_option.selected = true;
-		
-		combo_primary_user_group.options[i] = new_option;
-	}*/
 }
 	
@@ -382,25 +300,20 @@
 	{
 		select_available_maillists = document.getElementById('ea_select_available_maillists');
-		//Limpa o select
-		for(var i=0; i<select_available_maillists.options.length; i++)
-		{
-			select_available_maillists.options[i] = null;
-			i--;
-		}
-
-		if (data.length > 0)
-		{
-			for (i=0; i<data.length; i++)
-			{
-				new_option = new Option(data[i].uid[0]+' ('+data[i].mail[0]+')', data[i].uidnumber[0], false, false);
-				select_available_maillists.options[i] = new_option;
-			}
-			select_available_maillists.disabled = false;
-			select_available_maillists.options[0].selected = true;
+
+		if ((data) && (data.length > 0))
+		{
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_maillists.innerHTML = '#' + data;
+			select_available_maillists.outerHTML = select_available_maillists.outerHTML;
 			select_available_maillists_clone = select_available_maillists.cloneNode(true);
 			document.getElementById('ea_input_searchMailList').value = '';
 		}
-	}	
-		
+		else
+		{
+			// Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio.
+			select_available_maillists.innerHTML = '#';
+			select_available_maillists.outerHTML = select_available_maillists.outerHTML;
+		}
+	}
 	cExecute ('$this.ldap_functions.get_available_maillists&context='+context, handler_get_available_maillists);
 }
@@ -663,3 +576,33 @@
 	}
 	oWait.innerHTML = '&nbsp;';
-}			
+}
+
+function get_available_sambadomains(context, type)
+{
+	if ((type == 'create_user') && (document.getElementById('tabcontent6').style.display != 'none'))
+	{
+		var handler_get_available_sambadomains = function(data)
+		{
+			document.forms[0].use_attrs_samba.checked = data.status;
+			use_samba_attrs(data.status);
+			
+			if (data.status)
+			{
+				combo_sambadomains = document.getElementById('ea_combo_sambadomains');
+				for (i=0; i<data.sambaDomains.length; i++)
+				{
+					for (j=0; j<combo_sambadomains.length; j++)
+					{
+						if (combo_sambadomains.options[j].text == data.sambaDomains[i])
+						{
+							combo_sambadomains.options[j].selected = true;
+							break;
+						}
+					}
+				}
+				
+			}
+		}
+		cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains);
+	}
+}
