Index: /trunk/jabberit_messenger/inc/class.bohostsjabber.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.bohostsjabber.inc.php	(revision 915)
+++ /trunk/jabberit_messenger/inc/class.bohostsjabber.inc.php	(revision 915)
@@ -0,0 +1,31 @@
+<?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.                                               *
+  \***************************************************************************/
+
+require_once "class.db_im.inc.php";
+require_once "jabberit_sessions.inc.php";
+
+class bohostsjabber
+{
+	private $db;	
+	
+	function __construct()
+	{
+		$this->db = new db_im();
+	}
+	
+	public final function getHostsJabber()
+	{
+		return $this->db->getHostsJabber();				
+	}	
+}
+
+?>
Index: /trunk/jabberit_messenger/inc/class.uihostsjabber.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.uihostsjabber.inc.php	(revision 915)
+++ /trunk/jabberit_messenger/inc/class.uihostsjabber.inc.php	(revision 915)
@@ -0,0 +1,129 @@
+<?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.                                               *
+  \***************************************************************************/
+
+require_once "class.bohostsjabber.inc.php";
+
+class uihostsjabber
+{
+	private $bo;
+	private $ldap;
+
+	public $public_functions = array(
+		'backPage'  => True,
+		'edit_conf' => True,
+	);
+
+	function __construct()
+	{
+		$this->bo = new bohostsjabber();
+	}
+	
+	public final function edit_conf()
+	{
+		if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
+		{
+			$GLOBALS['phpgw']->redirect_link('/index.php');
+		}		
+		
+		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar Organizações e Servidores Jabber';	
+		
+		$_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();
+
+		// Load Language;
+		require_once "load_lang.php";
+
+
+		// Load Ldap;
+		require_once "class.ldap_im.inc.php";
+		
+		$ldap = new ldap_im();
+		
+		$ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";	
+		if( ($LdapOus = $ldap->listOrganizationsLdap()) )
+		{
+			foreach($LdapOus as $tmp )
+				$ous .= "<option value='".$tmp."'>".$tmp."</option>";
+		}
+		
+		$ConfHosts = $this->bo->getHostsJabber();
+		
+		if( $ConfHosts )
+		{
+			$ConfHosts = unserialize($this->bo->getHostsJabber());
+			$ConfHosts = explode(";", $ConfHosts);
+			natcasesort($ConfHosts);
+		}
+		
+		$value_Organizations_Servers = "";
+		
+		if(is_array($ConfHosts))	
+		{
+			foreach($ConfHosts as $values)
+			{
+				$itens = explode(":", $values);
+			
+				$value_Organizations_Servers .= "<tr id='".$values."' style='width:40%' class='row_off'>";
+				$value_Organizations_Servers .=	"<td>".$itens[0]."</td>";
+				$value_Organizations_Servers .=	"<td>".$itens[1]."</td>";
+				$value_Organizations_Servers .=	"<td><a href='javascript:constructScript.removeHostsJ(\"".$values."\");'>".lang('Delete')."</a></td>";
+				$value_Organizations_Servers .= "</tr>";
+			}
+		}
+		
+		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger' => 'confServersJabber.tpl'));
+		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','confServersJabber');	
+		$GLOBALS['phpgw']->template->set_var(array(
+												    'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uihostsjabber.backPage'),
+													'lang_Add_Organizations_and_Servers_Jabber' => lang('Add organizations and servers jabber'),
+													'lang_Back' => lang('Back'),
+												    'lang_Delete' => lang('Delete'),
+												    'lang_Example' => lang('Example'),
+												    'lang_Organization' => lang('Organization'),
+													'lang_save' => lang('Save'),
+												    'lang_ServerJabber' => lang('Servers Jabber'),
+													'lang_Registration_Organizations_and_Server_Jabber' => lang("Registration of Organizations and Servers Jabber"),													
+													'options_ous_ldap' => $ous,
+													'value_Organizations_Servers' => $value_Organizations_Servers,
+										));
+	
+		$GLOBALS['phpgw']->template->pparse('out','confServersJabber');
+	}
+	
+	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');
+	}
+	
+}
+
+?>
