Index: /trunk/jabberit_messenger/inc/class.uiexternals.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.uiexternals.inc.php	(revision 560)
+++ /trunk/jabberit_messenger/inc/class.uiexternals.inc.php	(revision 560)
@@ -0,0 +1,120 @@
+<?php
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+
+class uiexternals
+{
+	
+	
+	public $public_functions = array(
+		'backPage' => True,
+		'editParticipantsExternals' => True,
+	);
+	
+	final function __construct()
+	{
+		
+	}
+	
+	public final function editParticipantsExternals()
+	{
+		if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
+		{
+			$GLOBALS['phpgw']->redirect_link('/index.php');
+		}		
+
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('Config External Participants');
+		
+		$_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
+    	$_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
+    	$_SESSION['phpgwinfo']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
+    	$_SESSION['phpgwinfo']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
+    	$_SESSION['phpgwinfo']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
+    	$_SESSION['phpgwinfo']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];			
+
+
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+
+		$GLOBALS['phpgw']->common->phpgw_header();
+		echo parse_navbar();
+
+		$organizations = explode(",",$GLOBALS['phpgw_info']['server']['conf_organization_jabberit']);
+		natcasesort($organizations);
+		
+		foreach($organizations as $tmp)
+		{
+			if( $tmp != "" )
+			{
+				$orgs .= "<tr id='".$tmp."' style='width:40%' class='row_off'>";
+				$orgs .= "<td>".$tmp."</td>";
+				$orgs .= "<td><a href=\"javascript:constructScript.removePartExternal('".$tmp."');\">Excluir</a>";
+				$orgs .= "</td></tr>";
+			}
+		}
+		
+		$pExternal = $GLOBALS['phpgw_info']['server']['use_external_participants_jabberit'];
+
+		if( $GLOBALS['phpgw_info']['server']['use_external_participants_jabberit'] === "true")
+		{
+			$optionExternal = "<option value='false'>".lang('No')."</option>".
+							  "<option value='true' selected>".lang('Yes')."</option>";
+			$flagInputs = "selected=\"false\"";
+		}
+		else
+		{
+			$optionExternal = "<option value='false' selected>".lang('No')."</option>".
+							  "<option value='true'>".lang('Yes')."</option>";
+			$flagInputs = "selected=\"true\"";							  
+		}
+		
+		// Load Language;
+		require_once "load_lang.php";
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'confExternals.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','confOrg');	
+		$teste = $GLOBALS['phpgw']->template->set_var(array(
+										'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiexternals.backPage'),
+										'attributes_list' => '',			
+										'lang_add' => 'Adicionar',
+										'lang_Back' => 'Voltar',
+										'lang_cancel' => lang('Cancel'),
+										'lang_Informe_as_Organizacoes_Externas' => 'Informe as Organizações Externas',
+										'lang_Cadastrar_Organizacao' => 'Cadastrar Organização',
+										'lang_Habilitar_Participantes_Externos' => 'Habilitar Participantes Externos',
+										'lang_Delete' => lang('Delete'),										
+										'lang_save' => lang('Save'),
+										'lang_Organization' => lang('Organization'),
+										'lang_Organizacoes_Cadastradas' => 'Organizações Cadastradas',
+										'organizations_attributes' => $orgs,
+										'value_flag' => $flagInputs,
+										'value_use_external_participants_jabberit' => $optionExternal,
+										));
+	
+		$GLOBALS['phpgw']->template->pparse('out','confOrg');
+	}	
+	
+	public final function backPage()
+	{
+		if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
+		{
+			$GLOBALS['phpgw']->redirect_link('/index.php');
+		}		
+		
+		if ($_POST['cancel'])
+		{
+			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+		}
+
+		$GLOBALS['phpgw']->redirect_link('/admin/index.php');
+	}
+}
+?>
Index: /trunk/jabberit_messenger/js/glocked.js
===================================================================
--- /trunk/jabberit_messenger/js/glocked.js	(revision 560)
+++ /trunk/jabberit_messenger/js/glocked.js	(revision 560)
@@ -0,0 +1,132 @@
+(function()
+{
+	var _conn = '';
+	var _xtools = '';
+
+	function addGroup()
+	{
+		var select_ldap = document.getElementById('groups_ldap_jabberit');
+		var select_locked =  document.getElementById('groups_locked_jabberit');
+		
+		for(var i = 0; i < select_locked.options.length; i++)
+		{
+			if(select_locked.options[i].value === "")
+			{
+				select_locked.options[i].parentNode.removeChild(select_locked.options[i]);
+				i--;
+			}
+		}
+		
+		for(var i = 0; i < select_ldap.options.length ; i++)
+		{
+			if( select_ldap.options[i].selected )
+			{
+				
+				var flag = false;
+				for(var j = 0; j < select_locked.options.length ; j++ )
+				{
+					if( select_locked.options[j].value === select_ldap.options[i].value )
+						flag = true;
+				}
+				
+				if ( !flag )
+				{					
+					var option = select_ldap.options[i].value.split(":");
+					select_locked.options[select_locked.length] = new Option(option[0], select_ldap.options[i].value, false, true);
+				}
+			}
+		}
+	}
+
+	function createObject()
+	{
+		if ( typeof(_conn) != "object" )
+			_conn   = new JITConnector(path_jabberit + 'jabberit_messenger/');				
+
+		if ( typeof(_xtools) != "object" )
+			_xtools = new JITXTools(path_jabberit + 'jabberit_messenger/');
+	}
+
+	function CompleteSelect(data)
+	{
+		var select_ldap = document.getElementById('groups_ldap_jabberit');
+		data = _xtools.convert(data);
+
+		while( select_ldap.hasChildNodes())
+			select_ldap.removeChild(select_ldap.firstChild);
+		
+		try
+		{
+			if ( data && data.documentElement && data.documentElement.hasChildNodes() )
+			{
+				data = data.documentElement.firstChild;
+				var label = "";
+				var value = "";
+				
+				while(data)
+				{
+					var no = data.firstChild;
+					while(no)
+					{
+						if( label == "" )
+							var label = no.firstChild.nodeValue;
+						else
+							var value = no.firstChild.nodeValue;
+						no = no.nextSibling;
+					}
+					select_ldap.options[select_ldap.options.length] = new Option(label,label + ":" + value, false, false);
+					label = value = ""; 
+					data = data.nextSibling;
+				}
+			}
+		}catch(e){}
+	}
+
+	function groupsLdap()
+	{
+		createObject();
+		var organization = "";
+		
+		if( arguments.length > 0 )
+		{
+			var element = arguments[0];
+			
+			if( element.options.length > 0 )
+				for(var i = 0; i < element.options.length ; i++ )
+					if( element.options[i].selected )
+						organization =  'ou=' + element.options[i].value;
+	
+			_conn.go('$this.ldap_im.getGroupsLdap', CompleteSelect, organization);
+		}
+	}
+
+	function Selected()
+	{
+		var select_locked = document.getElementById('groups_locked_jabberit');
+		for( var i = 0 ; i < select_locked.options.length; i++ )
+			select_locked.options[i].selected = true;
+	}
+	
+	function removeGroup()
+	{
+		var select_locked = document.getElementById('groups_locked_jabberit');
+		
+		for(var i = 0 ; i < select_locked.options.length; i++ )
+		{
+			if( select_locked.options[i].selected )
+			{
+				select_locked.options[i].parentNode.removeChild(select_locked.options[i]);
+				i--;
+			}
+		}
+	}
+	
+	function Locked(){}
+
+	Locked.prototype.add = addGroup;
+	Locked.prototype.remove = removeGroup;
+	Locked.prototype.gLdap = groupsLdap;
+	Locked.prototype.selectAll = Selected;
+	window.locked = new Locked;
+
+})();
Index: /trunk/jabberit_messenger/js/load.js
===================================================================
--- /trunk/jabberit_messenger/js/load.js	(revision 551)
+++ /trunk/jabberit_messenger/js/load.js	(revision 560)
@@ -33,5 +33,6 @@
 		var _jabberit_content = document.createElement('div');
 		_jabberit_content.setAttribute('id', 'jabberit_messenger_content');
-		_jabberit_content = document.body.appendChild(_jabberit_content);
+		if( !is_ie )
+			_jabberit_content = document.body.appendChild(_jabberit_content);
 	}
 
@@ -42,5 +43,5 @@
 	{
 		/**
-		 * Criada o elemento(div) jabberWriteMsg, dentro da função write_msg do módulo expressoMail1_2,
+		 * Criado o elemento(div) jabberWriteMsg, dentro da função write_msg do módulo expressoMail1_2,
 		 * quando estiver habilitada a opção fora de escritório nos filtros. 
 		 */
@@ -176,7 +177,7 @@
 
 			if(arguments[0].checked)
-				element.innerHTML = "Digite o Email .:";
+				element.innerHTML = "<span style='color:red;'>Digite o Email .: </span>";
 			else
-				element.innerHTML = "Nome do Contato .:";
+				element.innerHTML = "Nome do Contato .: ";
 		}
 	}
@@ -252,5 +253,15 @@
 	{
 		var _win_contacts = _window.load('jabberit_contacts');
-		if( flagOpenIM == 'openWindowJabberit:false' )
+		var flagOpenAux = '';
+		
+		if( flagOpenIM.indexOf(';') != -1 )
+		{
+			var aux = flagOpenIM.split(';');
+			flagOpenAux = aux[0];
+		}
+		else
+			flagOpenAux = flagOpenIM;
+		
+		if( flagOpenAux == 'openWindowJabberit:false' )
 		{
 			_win_contacts.size(215,400);
@@ -286,5 +297,5 @@
 		_win_contacts.content(_xtools.parse(_xtools.xml('contacts_jabberit'), 'contacts_jabberit.xsl', _params));
 
-		if( flagOpenIM == 'openWindowJabberit:false' )
+		if( flagOpenAux == 'openWindowJabberit:false' )
 		{
 			_win_contacts.wm.style.visibility = "visible";
@@ -301,10 +312,46 @@
 					 function(data)
 					 {
+							var autoConnect = '';
 							flagOpenIM = data;
-							if(flagOpenIM == 'openWindowJabberit:true')
+							
+							if( flagOpenIM.indexOf(';') != -1)
 							{
-								setTimeout('loadscript.showW();', 2000);
+								var temp = flagOpenIM.split(';');
+								autoConnect = temp[0];
+							}
+							else
+								autoConnect = flagOpenIM;
+
+							if( autoConnect == 'openWindowJabberit:true' )
+							{
+								setTimeout('loadscript.showW();', 2500);
 							}
 					 });
+		}
+	}
+
+	function openWindowParticipantsExternal()
+	{
+		if( arguments.length > 0)
+		{
+			var element = arguments[0]; 
+			var orgPartExternal = externalParticipantsJabberit.split(",");
+			
+			var _splash = top.document.createElement('span');
+				_splash.setAttribute('id','fast_splash_jabberit');
+				_splash.style.backgroundColor = 'dedede';
+				_splash.style.position = 'absolute';
+				_splash.style.display = 'block';
+				_splash.style.width = '200px';
+				_splash.style.height = 'auto';
+				_splash.style.margin = ( !is_ie ) ? '0px 5px 0px 130px' : '20px 0px 0px 0px';
+				_splash.style.zIndex = '99999';
+				_splash.style.border = '2px outset #000';
+			
+				for(var i = 0; i < orgPartExternal.length; i++)
+					_splash.innerHTML += '<div style="margin:5px;border-bottom:1px dashed #000;cursor:default !important;">' + (i + 1) + " - " + orgPartExternal[i] + '</div>';	
+				
+			_showhidden.action('onmouseover', 'onmouseout', _splash);
+			element.appendChild(_splash);
 		}
 	}
@@ -339,8 +386,13 @@
 
 			var _params = {'path'  : path_jabberit,
-						   'lang1' : jabberitGetLang('Your Preferences'), 	
-						   'lang2' : 'Conectar o IM Automaticamente',
-						   'lang3' : jabberitGetLang('Save'),
-						   'lang4' : jabberitGetLang('Cancel')										   
+						   'lang1' : jabberitGetLang('Your Preferences'),
+						   'lang2' : jabberitGetLang('Auto Connection'),	
+						   'lang3' : jabberitGetLang('Enable Auto Login IM'),
+						   'lang4' : jabberitGetLang('Users OffLine'),
+						   'lang5' : jabberitGetLang('Show friends Offline'),
+						   'lang6' : jabberitGetLang('Save'),
+						   'lang7' : jabberitGetLang('Cancel'),
+						   'langYes': jabberitGetLang('Yes'),
+						   'langNo':  jabberitGetLang('No')											   
 						  };
 			_win_preferences.content(_xtools.parse(_xtools.xml('preferences_jabberit'), 'preferences_jabberit.xsl', _params));
@@ -355,14 +407,38 @@
 			_win_preferences.size(300,250);
 		}
-		
-		var value = flagOpenIM.split(':');
-		var elementSelect = document.getElementById(value[0]);
-		var valueSelect = value[1];
-
-
-		// Preenchendo a Select
-		for(var i = 0; i < elementSelect.options.length; i++)
-			if( elementSelect.options[i].value == valueSelect )
-				elementSelect.options[i].selected = true;
+
+		if( flagOpenIM.indexOf(';') != -1 )
+		{
+			var temp = flagOpenIM.split(';');
+			
+			// Element openWindowJabberit
+			var value1 = temp[0].split(':');
+			var element1 = document.getElementById(value1[0]);
+			var valueSelect1 = value1[1];
+			
+			for(var i = 0; i < element1.options.length; i++)
+				if( element1.options[i].value == valueSelect1 )
+					element1.options[i].selected = true;
+
+			// Element userOfflineJabberit
+			var value2 = temp[1].split(':');
+			var element2 = document.getElementById(value2[0]);
+			var valueSelect2 = value2[1];
+			
+			for(var i = 0; i < element2.options.length; i++)
+				if( element2.options[i].value == valueSelect2 )
+					element2.options[i].selected = true;
+		}
+		else
+		{
+			// Element openWindowJabberit
+			var value1 = flagOpenIM.split(':');
+			var element1 = document.getElementById(value1[0]);
+			var valueSelect1 = value1[1];
+
+			for(var i = 0; i < element1.options.length; i++)
+				if( element1.options[i].value == valueSelect1 )
+					element1.options[i].selected = true;
+		}
 	}
 
@@ -379,10 +455,26 @@
 	function setPreferences()
 	{
-		var element = document.getElementById('openWindowJabberit');
-		
-		for(var i = 0 ; i < element.options.length; i++)
-			if( element.options[i].selected == true)
-				var value = element.options[i].value;
-				
+		// Element openWindowJabberit
+		var elementOpenW = document.getElementById('openWindowJabberit');
+		var value = '';
+		var valueAux = '';
+		
+		for(var i = 0 ; i < elementOpenW.options.length; i++)
+			if( elementOpenW.options[i].selected == true)
+			{
+				value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value;
+				valueAux = 'openWindowJabberit:' + elementOpenW.options[i].value;
+			}
+
+		// Element userOfflineJabberit				
+		var elementUserOff = document.getElementById('userOfflineJabberit');
+		
+		for(var i = 0; i < elementUserOff.options.length; i++)
+			if( elementUserOff.options[i].selected == true )
+			{
+				value += '&preferences2=userOfflineJabberit:' + elementUserOff.options[i].value;
+				valueAux += ';userOfflineJabberit:' + elementUserOff.options[i].value;
+			} 		
+		
 		_conn.go('$this.db_im.setPreferences',
 				 function(data)
@@ -390,5 +482,5 @@
 					if(data == 'true')
 					{
-						flagOpenIM = 'openWindowJabberit:' + value;
+						flagOpenIM = valueAux;
 						alert(jabberitGetLang('Preferences saved with success!'));
 					}
@@ -400,5 +492,5 @@
 											
 				 },
-				'preferences=openWindowJabberit:' + value);
+				value);
 	}
 	
@@ -434,12 +526,14 @@
 	}
 
-	Load.prototype.keyPress = keyPressSearch;
-	Load.prototype.search = searchUser;
-	Load.prototype.show = showDiv;
-	Load.prototype.showW = showWindow;
+	Load.prototype.adIcon	= addIcon;
+	Load.prototype.cLabel	= changeLabel;
+	Load.prototype.closeW	= closeWindow;
+	Load.prototype.keyPress	= keyPressSearch;
+	Load.prototype.openWinParExt = openWindowParticipantsExternal;
+	Load.prototype.search	= searchUser;
 	Load.prototype.setPrefe = setPreferences;
-	Load.prototype.closeW = closeWindow;
-	Load.prototype.cLabel = changeLabel;
-	Load.prototype.adIcon = addIcon;
+	Load.prototype.show		= showDiv;
+	Load.prototype.showW	= showWindow;
+
 	window.loadscript = new Load;
 
Index: /trunk/jabberit_messenger/js/ldap.js
===================================================================
--- /trunk/jabberit_messenger/js/ldap.js	(revision 551)
+++ /trunk/jabberit_messenger/js/ldap.js	(revision 560)
@@ -21,5 +21,5 @@
 			'lang6':jabberitGetLang('add'),
 			'lang7':jabberitGetLang('close'),
-			'lang8':jabberitGetLang('External Participants')			
+			'lang8':jabberitGetLang('Others Expressos')			
 		};
 
@@ -256,5 +256,8 @@
 			}
 			else
+			{
 				alert(jabberitGetLang('Inform a valid e-mail!'));
+				_loading.style.display = "none";	
+			}
 		}
 				
