Index: trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uigroups.inc.php	(revision 309)
+++ trunk/expressoAdmin1_2/inc/class.uigroups.inc.php	(revision 414)
@@ -89,16 +89,8 @@
 				'add_action'			=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.add_groups'),
 				'add_group_disabled'	=> $this->functions->check_acl($account_lid,'add_groups') ? '' : 'disabled',
-				//'context'				=> $context,
-				'context_display'		=> $context_display,
-				'lang_groups_names'		=> lang('Groups Names'),
-				'lang_description'		=> lang('Description'),
-				'lang_add_groups'		=> lang('Add Groups'),
-				'lang_edit'  			=> lang('Edit'),
-				'lang_delete'			=> lang('Delete'),
-				'lang_back'				=> lang('back'),
-				'lang_context'			=> lang('context'),
-				'lang_search'			=> lang('search')
+				'context_display'		=> $context_display
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 			
 			// Save query
@@ -196,4 +188,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_group' => 'groups_form.tpl'));
+			$p->set_block('create_group','list','list');
 
 			// Pega combo das organizações e seleciona um dos setores em caso de um erro na validaçao dos dados.
@@ -232,21 +225,7 @@
 				'ldap_context'				=> $GLOBALS['phpgw_info']['server']['ldap_context'],
 				'ufn_ldap_context'			=> ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']),
-				'lang_back'					=> lang('Back'),
-				'lang_save'					=> lang('save'),
-				'lang_group_organization'	=> lang('Group Organization'),
-				'lang_search_organization'	=> lang('Search Organiztion'),
-				'lang_org'					=> lang('Organizations'),
-				'lang_group_name'			=> lang('group name'),
-				'lang_description'			=> lang('Description'),
-				'lang_email'				=> lang('E-mail'),
 				'concatenateDomain'			=> $this->current_config['expressoAdmin_concatenateDomain'],
 				'defaultDomain'				=> $this->current_config['expressoAdmin_defaultDomain'],
-				'lang_group_users'			=> lang('Group users'),
-				'lang_applications'			=> lang('Applications'),
-				'lang_add_user'				=> lang('Add User'),
-				'lang_rem_user'				=> lang('Remove User'),
-				'lang_all_users'			=> lang('Select users from all sub-organizations'),
 				'apps'						=> $apps,
-				//'use_attrs_samba_checked'	=> $this->current_config['expressoAdmin_samba_support'] == 'true' ? 'CHECKED' : '',
 				'use_attrs_samba_checked'	=> '',
 				'disabled_samba'			=> 'disabled',
@@ -259,5 +238,6 @@
 			);
 			$p->set_var($var);
-
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
+			
 			$p->pfp('out','create_group');
 		}
@@ -288,4 +268,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_group' => 'groups_form.tpl'));
+			$p->set_block('create_group','list','list');
 
 			// Obtem combo das organizações e seleciona a org do grupo.
@@ -357,19 +338,5 @@
 				'type'						=> 'edit_group',
 				'ldap_context'				=> $GLOBALS['phpgw_info']['server']['ldap_context'],
-				'lang_back'					=> lang('Back'),
-				'lang_save'					=> lang('save'),
-				'lang_group_organization'	=> lang('Group Organization'),
-				'lang_search_organization'	=> lang('Search Organiztion'),
-				'lang_org'					=> lang('Organizations'),
-				'lang_group_name'			=> lang('group name'),
-				'lang_description'			=> lang('Description'),
-				'lang_email'				=> lang('E-mail'),
-				'lang_group_users'			=> lang('Group users'),
-				'lang_applications'			=> lang('Applications'),
-				'lang_add_user'				=> lang('Add User'),
-				'lang_rem_user'				=> lang('Remove User'),
-				'lang_all_users'			=> lang('Select users from all sub-organizations'),
 				'gidnumber'					=> $group_info['gidnumber'],
-				//'manager_context'			=> $manager_context,
 				'cn'						=> $group_info['cn'],
 				'user_count'				=> $user_count,
@@ -388,5 +355,5 @@
 			);
 			$p->set_var($var);
-
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 			$p->pfp('out','create_group');
 		}
@@ -404,34 +371,4 @@
 		{
 			$appCSS = '';
-/*			'th.activetab
-			{
-				color:#000000;
-				background-color:#D3DCE3;
-				border-top-width : 1px;
-				border-top-style : solid;
-				border-top-color : Black;
-				border-left-width : 1px;
-				border-left-style : solid;
-				border-left-color : Black;
-				border-right-width : 1px;
-				border-right-style : solid;
-				border-right-color : Black;
-			}
-			
-			th.inactivetab
-			{
-				color:#000000;
-				background-color:#E8F0F0;
-				border-bottom-width : 1px;
-				border-bottom-style : solid;
-				border-bottom-color : Black;
-			}
-			
-			.td_left { border-left : 1px solid Gray; border-top : 1px solid Gray; }
-			.td_right { border-right : 1px solid Gray; border-top : 1px solid Gray; }
-			
-			div.activetab{ display:inline; }
-			div.inactivetab{ display:none; }';*/
-			
 			return $appCSS;
 		}
Index: trunk/expressoAdmin1_2/inc/class.db_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 180)
+++ trunk/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 414)
@@ -106,5 +106,5 @@
         {
         	$return['status'] = false;
-			$return['msg'] = "Problemas executando a query accounts no Banco de Dados.";
+			$result['msg'] = $this->functions->lang('Problems running query on DB') . '.';
 			$db->disconnect();
         	return $return;
@@ -120,5 +120,5 @@
         {
         	$return['status'] = false;
-			$return['msg'] = "Problemas executando a query groups no Banco de Dados.";
+			$result['msg'] = $this->functions->lang('Problems running query on DB') . '.';
 			$db->disconnect();
         	return $return;
@@ -142,5 +142,5 @@
 		{
         	$return['status'] = false;
-			$return['msg'] = "Problemas executando a query update id no Banco de Dados.";
+			$result['msg'] = $this->functions->lang('Problems running query on DB') . '.';
 		}
 		$db->disconnect();
@@ -148,40 +148,4 @@
 	}
 	
-	/*
-	function increment_id($id, $type)
-	{
-		$current_config = $_SESSION['phpgw_info']['expresso']['expressoAdmin'];
-		if ($current_config['expressoAdmin_nextid_db_host'] != '')
-		{
-			$this->db->disconnect();
-			$host = $current_config['expressoAdmin_nextid_db_host'];
-			$port = $current_config['expressoAdmin_nextid_db_port'];
-			$name = $current_config['expressoAdmin_nextid_db_name'];
-			$user = $current_config['expressoAdmin_nextid_db_user'];
-			$pass = $current_config['expressoAdmin_nextid_db_pass'];
-			
-			$db = new db();
-			$db->Halt_On_Error = 'no';
-			$db->connect($name, $host, $port, $user, $pass, 'pgsql');
-		}
-		else
-		{
-			$db = $this->db;
-		}
-
-		$sql = "UPDATE phpgw_nextid set id = '".$id."' WHERE appname = '" . $type . "'";
-		if (!$db->query($sql))
-		{
-			$db->disconnect();
-			return 'Erro em increment_id:' . pg_last_error();
-		}
-		else
-		{
-			$db->disconnect();
-			return true;
-		}
-	}
-	*/
-	
 	function add_user2group($gidnumber, $uidnumber)
 	{
@@ -190,5 +154,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Erro em add_user2group:' . pg_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_user2group.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 			return $result;
 		}
@@ -203,5 +167,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Erro em add_user2group:' . pg_last_error();
+				$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_user2group.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 				return $result;
 			}
@@ -217,5 +181,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Erro em add_user2group:' . pg_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_user2group.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 			return $result;
 		}
@@ -229,5 +193,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Erro em add_user2group:' . pg_last_error();
+				$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_user2group.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 				return $result;
 			}
@@ -243,5 +207,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Erro em add_pref_changepassword:' . pg_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_pref_changepassword.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 			return $result;
 		}
@@ -256,5 +220,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Erro em add_pref_changepassword:' . pg_last_error();
+				$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_pref_changepassword.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 				return $result;
 			}
@@ -270,5 +234,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Erro em add_pref_changepassword:' . pg_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_pref_changepassword.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 			return $result;
 		}
@@ -282,5 +246,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Erro em remove_pref_changepassword:' . pg_last_error();
+				$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_pref_changepassword.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 				return $result;
 			}
@@ -301,5 +265,5 @@
 				{
 					$result['status'] = false;
-					$result['msg'] = 'Erro em add_id2apps: ' . pg_last_error();
+					$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_id2apps.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 					return $result;
 				}
@@ -316,10 +280,10 @@
 					{
 						$result['status'] = false;
-						$result['msg'] = 'Erro em add_id2apps: ' . pg_last_error();
+						$result['msg'] = $this->functions->lang('Error on function') . " db_functions->add_id2apps.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 						return $result;
 					}
 					else
 					{
-						$this->write_log("Adicionado aplicativo $app ao id",$id,'','','');	
+						$this->write_log("Added application","$id:$app");	
 					}
 				}
@@ -341,5 +305,5 @@
 				{
 					$result['status'] = false;
-					$result['msg'] = 'Erro em remove_id2apps:' . pg_last_error();
+					$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_id2apps.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 					return $result;
 				}
@@ -353,10 +317,10 @@
 					{
 						$result['status'] = false;
-						$result['msg'] = 'Erro em remove_id2apps:' . pg_last_error();
+						$result['msg'] = $this->functions->lang('Error on function') . " db_functions->remove_id2apps.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 						return $result;
 					}
 					else
 					{
-						$this->write_log("Removido aplicativo $app do id",$id,'','','');	
+						$this->write_log("Removed application from id","$id: $app");	
 					}
 				}
@@ -467,5 +431,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Erro em set_user_password: ' . pg_last_error();
+				$result['msg'] = $this->functions->lang('Error on function') . " db_functions->set_user_password.\n" . $this->functions->lang('Server returns') . ': ' . pg_last_error();
 				return $result;
 			}
@@ -578,8 +542,8 @@
 	}
 	
-	function write_log($action, $groupinfo='', $userinfo='', $appinfo='', $msg_log='')
-	{
-		$sql = "INSERT INTO phpgw_expressoadmin_log (date, manager, action, groupinfo, userinfo, appinfo, msg) "
-		. "VALUES('now','" . $_SESSION['phpgw_info']['expresso']['user']['account_lid'] . "','" . strtolower($action) . "','" . strtolower($groupinfo) . "','" . strtolower($userinfo) . "','" . strtolower($appinfo) . "','" .strtolower($msg_log) . "')";
+	function write_log($action, $about)
+	{
+		$sql = "INSERT INTO phpgw_expressoadmin_log (date, manager, action, userinfo) "
+		. "VALUES('now','" . $_SESSION['phpgw_info']['expresso']['user']['account_lid'] . "','" . strtolower($action) . "','" . strtolower($about) . "')";
 		$this->db->query($sql);
 		return;
Index: trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 401)
+++ trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 414)
@@ -91,29 +91,15 @@
 				'bg_color'					=> $GLOBALS['phpgw_info']['theme']['bg_color'],
 				'th_bg'						=> $GLOBALS['phpgw_info']['theme']['th_bg'],
-				
 				'accounts_url'				=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'),
 				'back_url'					=> $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
 				'add_action'				=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.add_users'),
-				
 				'create_user_disabled'		=> $this->functions->check_acl($account_lid,'add_users') ? '' : 'disabled',
 				'context'					=> $raw_context,
 				'context_display'			=> $context_display,
-				'imapDelimiter'				=> $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'], 
-				
-				'lang_create_user'			=> lang('Create User'),
-				'lang_loginid'				=> lang('LoginID'),
-				'lang_cn'					=> lang('Name'),
-				'lang_mail'					=> lang('E-mail'),
-				'lang_edit'					=> lang('edit'),
-				'lang_rename'				=> lang('rename'),
-				'lang_delete'				=> lang('delete'),
-				'lang_search'				=> lang('Search'),
-				'lang_back'					=> lang('back'),
-				'lang_contexts'				=> lang('Contexts')
-				
+				'imapDelimiter'				=> $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']
 			);
 			$p->set_var($var);
-			
-			// Save query
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
+
 			$p->set_var('query', $GLOBALS['query']);
 			
@@ -251,27 +237,5 @@
 				// First ABA
 				'display_spam_uid'				=> 'display:none',
-				'lang_general_information'		=> lang('General Information'),
-				'lang_corporative_information'	=> lang('Corporative Information'),
-				'lang_email_config'				=> lang('Email Config'),
-				'lang_groups_permission'		=> lang('Groups Permission'),
-				'lang_lists_permission'			=> lang('Email Lists'),
-				'lang_aplication_permission'	=> lang('Aplication Permission'),	
-				'lang_search_organization'		=> lang('Search Organiztion'),
-				'lang_organizations'			=> lang('Organizations'),
-				'lang_sector'					=> lang('Sector'),
-				'lang_account_lid'				=> lang('Login ID'),
-				'lang_firstname'				=> lang('First Name'),
-				'lang_lastname'					=> lang('Last Name'),
-				'lang_password'					=> lang('Password'),
-				'lang_re-password'				=> lang('Re-Password'),
-				'lang_passwd_expired'			=> lang('Password expired'),
-				'lang_changepassword'			=> lang('Change password'),				
-				'lang_phone'					=> lang('Phone'),
-				'lang_photo'					=> lang('Photo'),
-				'lang_account_active'			=> lang('Account Active'),
-				'lang_account_invisible'		=> lang('Account Invisible'),
-				'lang_never'					=> lang('never'),
-				'lang_back'						=> lang('Back'),
-				'lang_save'						=> lang('Save'),
+				
 				'sectors'						=> $combo_manager_org,
 				'combo_organizations'			=> $combo_manager_org,
@@ -290,18 +254,6 @@
 				// Corporative Information
 				'display_corporative_information' => $this->functions->check_acl($manager_lid,'manipulate_corporative_information') ? '' : 'none',
-				'lang_employeenumber'			=> lang('Employee number'),
-				'lang_cpf'						=> lang('cpf'),
-				'lang_rg'						=> lang('rg'),
-				'lang_rguf'						=> lang('rguf'),
 				
 				//MAIL
-				'lang_activeemailaccount'		=> lang('Active email account'),
-				'lang_email'					=> lang('E-mail'),
-				'lang_aliasemail'				=> lang('Alias email'),
-				'lang_forwardingemail'			=> lang('Forwarding email'),
-				'lang_email_quota'				=> lang('Email quota in MB'),
-				'lang_onlyforwarding'			=> lang('Only forwarding'),
-				'lang_quote_message'			=> lang('leave empty for no quota'),
-				'lang_email_quota_used'			=> lang('Quota used in MB'),
 				'accountstatus_checked'			=> 'CHECKED',
 				'mailquota'						=> $this->current_config['expressoAdmin_defaultUserQuota'],
@@ -310,30 +262,8 @@
 				'input_mailalternateaddress_fields' => '<input type="text" name="mailalternateaddress[]" id="mailalternateaddress" autocomplete="off" value="{mailalternateaddress}" {disabled} size=30>',
 				'input_mailforwardingaddress_fields'=> '<input type="text" name="mailforwardingaddress[]" id="mailforwardingaddress" autocomplete="off" value="{mailforwardingaddress}" {disabled} size=30>',
-
-				//Third ABA
-				'lang_groups'					=> lang('Groups'),
-				'lang_user_groups'				=> 'Grupos do Usuário',
-				'lang_available_groups'			=> 'Grupos disponíveis',
-				'lang_listGroups'				=> lang('ListGroups'),
-				'lang_primary_group'			=> lang('Primary Group'),
-				'lang_add'						=> lang('Add'),
-				'lang_rem'						=> lang('Remove'),
-				
-				//Fourd ABA
-				'lang_user_mail_lists'			=> 'O usuário participa destas Listas de E-mail',
-				'lang_available_mail_lists'		=> 'Listas de E-mail disponíveis',
-				
-				//Five ABA
+				
 				'apps'								=> $applications_list,
 				
 				//SAMBA ABA
-				'lang_samba_config'					=> lang('Samba Config'),
-				'lang_use_attrs_samba'				=> lang('Use samba attributes'),
-				'lang_sambadomain'					=> lang('Domain'),
-				'lang_sambaAcctFlags'				=> lang('AcctFlags'),
-				'lang_sambaLogonScript'				=> lang('Logon Script'),
-				'lang_sambaHomeDirectory'			=> lang('Home Directory'),
-				'lang_active_user'					=> lang('Samba User Active'),
-				'lang_desactive_user'				=> lang('Samba User Desactive'),
 				'use_attrs_samba_checked'			=> 'CHECKED',
 				'sambadomainname_options'			=> $sambadomainname_options,
@@ -342,4 +272,5 @@
 			);
 			$t->set_var($var);
+			$t->set_var($this->functions->make_dinamic_lang($t, 'main'));
 			$t->pfp('out','main');
 		}
@@ -470,15 +401,8 @@
 			$t->set_block('body','main');
 							
-    		// ORGANIZATIONS
-    		/*
-   			foreach ($contexts as $index=>$context)
-   				$orgs .= $this->functions->get_organizations($context, $user_info['context']);
-   			*/
-   				
 			foreach ($contexts as $index=>$context)
 				$combo_manager_org .= $this->functions->get_organizations($context, $user_info['context']);
 			$combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], $user_info['context'], true, true, true);			
 
-
 			// GROUPS.
 			if (count($user_info['groups_info']) > 0)
@@ -491,14 +415,4 @@
 				foreach ($array_groups as $gidnumber=>$cn)
 				{
-					// Grupo existe no Banco mas não no Ldap, excluimos grupo do Banco.
-					/*
-					if (!$this->ldap_functions->group_exist($gidnumber))
-					{
-						$this->db_functions->delete_group($gidnumber);
-						$this->db_functions->write_log("expressoAdmin deletou o grupo $gidnumber do banco, pois não existia no ldap.",'','','','');
-						continue;
-					}
-					*/
-					
 					// O memberUid do usuário está somente no Banco, então adicionamos o memberUid no Ldap.
 					if (is_null($user_info['groups_ldap'][$gidnumber]))
@@ -649,31 +563,7 @@
 				'alert_warning'					=> "$alert_warning",
 				'display_input_account_lid'		=> 'display:none',
-				'lang_general_information'		=> lang('General Information'),
-				'lang_corporative_information'	=> lang('Corporative Information'),
-				'lang_email_config'				=> lang('Email Config'),
-				'lang_groups_permission'		=> lang('Groups Permission'),
-				'lang_lists_permission'			=> lang('Email Lists'),
-				'lang_aplication_permission'	=> lang('Aplication Permission'),	
-				'lang_organizations'			=> lang('Organizations'),
-				'lang_search_organization'		=> lang('Search Organiztion'),
-				'lang_sector'					=> lang('Sector'),
-				'lang_account_lid'				=> lang('Login ID'),
-				'lang_firstname'				=> lang('First Name'),
-				'lang_lastname'					=> lang('Last Name'),
-				'lang_passwd_expired'			=> lang('Password expired'),
-				'lang_password'					=> lang('Password'),
-				'lang_phone'					=> lang('Phone'),
-				'lang_photo'					=> lang('Photo'),
-				'lang_re-password'				=> lang('Re-Password'),
-				'lang_changepassword'			=> lang('Change password'),				
-				'lang_account_active'			=> lang('Account Active'),
-				'lang_account_invisible'		=> lang('Account Invisible'),
-				'lang_back'						=> lang('Back'),
-				'lang_save'						=> lang('Save'),
-				
 				'sectors'						=> $combo_manager_org,
 				'combo_organizations'			=> $combo_manager_org,
 				'combo_all_orgs'				=> $combo_all_orgs,
-				
 				'uid'							=> $user_info['uid'],
 				'givenname'						=> $user_info['givenname'],
@@ -683,9 +573,6 @@
 				'photo_bin'						=> $photo_bin,
 				'disabled_edit_photo'			=> $disabled_edit_photo,
-				//'display_picture'				=> $this->functions->check_acl($manager_account_lid,'edit_users_picture') ? '' : 'none',
 				'display_picture'				=> $display_picture,
-				
 				'display_tr_default_password'	=> $this->functions->check_acl($manager_account_lid,'set_user_default_password') ? '' : 'none',
-				
 				'passwd_expired_checked'		=> $user_info['passwd_expired'] == '0' ? 'CHECKED' : '',
 				'changepassword_checked'		=> $user_info['changepassword'] == '1' ? 'CHECKED' : '',
@@ -694,49 +581,25 @@
 
 				// Corporative Information
-				'lang_employeenumber'			=> lang('Employee number'),
-				'lang_cpf'						=> lang('cpf'),
-				'lang_rg'						=> lang('rg'),
-				'lang_rguf'						=> lang('rguf'),
 				'corporative_information_employeenumber' => $user_info['corporative_information_employeenumber'],
 				'corporative_information_cpf'			=> $user_info['corporative_information_cpf'],
 				'corporative_information_rg'			=> $user_info['corporative_information_rg'],
 				'corporative_information_rguf'			=> $user_info['corporative_information_rguf'],
+				'corporative_information_description'	=> $user_info['corporative_information_description'],
 				
 				//MAIL
 				'disabled_quota_used'		=> 'disabled',
-				'lang_activeemailaccount'	=> lang('Active email account'),
-				'lang_email'				=> lang('E-mail'),
-				'lang_aliasemail'			=> lang('Alias email'),
-				'lang_forwardingemail'		=> lang('Forwarding email'),
-				'lang_email_quota'			=> lang('Email quota in MB'),
-				'lang_onlyforwarding'		=> lang('Only forwarding'),
-				'lang_email_quota_used'		=> lang('Quota used in MB'),
-				
 				'accountstatus_checked'		=> $user_info['accountstatus'] == 'active' ? 'CHECKED' : '',
 				'mail'						=> $user_info['mail'],
-				
-				//'mailalternateaddress'		=> $user_info['mailalternateaddress'],
-				//'mailforwardingaddress'		=> $user_info['mailforwardingaddress'],
 				'input_mailalternateaddress_fields'	=> $input_mailalternateaddress_fields,
 				'input_mailforwardingaddress_fields'=> $input_mailforwardingaddress_fields,
-				
 				'deliverymode_checked'		=> $user_info['deliverymode'] == 'forwardOnly' ? 'CHECKED' : '',
-				
 				'mailquota'					=> $user_info['mailquota'],
 				'mailquota_used'			=> $user_info['mailquota_used'],
 
 				//Third ABA
-				'lang_groups'				=> lang('Groups'),
-				'lang_user_groups'			=> 'Grupos do Usuário',
-				'lang_available_groups'		=> 'Grupos disponíveis',
-				'lang_primary_group'		=> lang('Primary Group'),
-				'lang_add'					=> lang('Add'),
-				'lang_rem'					=> lang('Remove'),
 				'ea_select_user_groups_options'	=> $ea_select_user_groups_options,
 				'ea_combo_primary_user_group_options'	=> $ea_combo_primary_user_group_options,
 				
 				//Fourd ABA
-				'lang_user_mail_lists'			=> 'O usuário participa destas Listas de E-mail',
-				'lang_available_mail_lists'		=> 'Listas de E-mail disponíveis',
 				'ea_select_user_maillists_options'  => $ea_select_user_maillists_options,
 								
@@ -745,13 +608,4 @@
 
 				//SAMBA ABA
-				'lang_samba_config'			=> lang('Samba Config'),
-				'lang_use_attrs_samba'		=> lang('Use samba attributes'),
-				'lang_sambadomain'			=> lang('Domain'),
-				'lang_sambaAcctFlags'		=> lang('AcctFlags'),
-				'lang_sambaLogonScript'		=> lang('Logon Script'),
-				'lang_sambaHomeDirectory'	=> lang('Home Directory'),
-				'lang_active_user'			=> lang('Samba User Active'),
-				'lang_desactive_user'		=> lang('Samba User Desactive'),
-				
 				'userSamba'					=> $user_info['sambaUser'],
 				'sambadomainname_options'	=> $sambadomainname_options,
@@ -765,4 +619,5 @@
 			);
 			$t->set_var($var);
+			$t->set_var($this->functions->make_dinamic_lang($t, 'main'));
 			
 			// Devo mostrar aba SAMBA ??
@@ -911,12 +766,8 @@
 			$var = Array(
 				'th_bg'			=> $GLOBALS['phpgw_info']['theme']['th_bg'],
-				'lang_back'		=> 'Back',
 				'back_url'		=> "./index.php?menuaction=expressoAdmin1_2.uiaccounts.edit_user&account_id=$account_id",
-				'lang_loginid'	=> lang('Login ID'),
-				'lang_ip'		=> lang('IP'),
-				'lang_login'	=> lang('Log IN'),
-				'lang_logout'	=> lang('Log OUT')
 			);
 			$t->set_var($var);
+			$t->set_var($this->functions->make_dinamic_lang($t, 'body'));
 			$t->pfp('out','body');
 		}
Index: trunk/expressoAdmin1_2/inc/class.user.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.user.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.user.inc.php	(revision 414)
@@ -269,5 +269,5 @@
 				}
 
-				$this->db_functions->write_log("criado usuario $dn",'','','','');
+				$this->db_functions->write_log("created user",$dn);
 			}
 
@@ -307,5 +307,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem direito de editar informações de usuários.';
+				$return['msg'] = lang('You do not have access to edit user informations') . '.';
 				return $return;
 			}
@@ -331,5 +331,5 @@
 						{
 							$dn = $newrdn . ',' . $newparent;
-							$this->db_functions->write_log('alterado contexto do usuario' . $new_values['uid'] . ' de: ' . $old_values['context'] . ' para: ' . $new_values['context'],'',$dn,'','');
+							$this->db_functions->write_log('modified user context', $dn . ': ' . $old_values['uid'] . '->' . $new_values['context']);
 						}
 					}
@@ -342,5 +342,5 @@
 					$ldap_mod_replace['givenname'] = $new_values['givenname'];
 					$ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn'];
-					$this->db_functions->write_log("alterado givenname do usuario $dn de ".$old_values['givenname']." para ".$new_values['givenname'],'','','','');
+					$this->db_functions->write_log("modified first name", "$dn: " . $old_values['givenname'] . "->" . $new_values['givenname']);
 				}
 				if ($diff['sn'])
@@ -348,5 +348,5 @@
 					$ldap_mod_replace['sn'] = $new_values['sn'];
 					$ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn'];
-					$this->db_functions->write_log("altera sn do usuario de ".$old_values['sn']." para ".$new_values['sn'],'','','','');
+					$this->db_functions->write_log("modified last name", "$dn: " . $old_values['sn'] . "->" . $new_values['sn']);
 				}
 				if ($diff['mail'])
@@ -355,24 +355,12 @@
 					$this->ldap_functions->replace_user2maillists($new_values['mail'], $old_values['mail']);
 					$this->ldap_functions->replace_mail_from_institutional_account($new_values['mail'], $old_values['mail']);
-					$this->db_functions->write_log("alterado mail do usuario $dn de " . $old_values['mail'] . " para " . $new_values['mail'],'','','','');
-				}
-				/*
-				if (($diff['mailalternateaddress']) && ($old_values['mailalternateaddress'] != ''))
-				{
-					$ldap_mod_replace['mailalternateaddress'] = $new_values['mailalternateaddress'];
-					$this->db_functions->write_log("alterado mailalternateaddress do usuario",'',$dn,'','');
-				}
-				if (($diff['mailforwardingaddress']) && ($old_values['mailforwardingaddress'] != ''))
-				{
-					$ldap_mod_replace['mailforwardingaddress'] = $new_values['mailforwardingaddress'];
-					$this->db_functions->write_log("alterado mailforwardingaddress do usuario",'',$dn,'','');
-				}
-				*/
+					$this->db_functions->write_log("modified user email", "$dn: " . $old_values['mail'] . "->" . $new_values['mail']);
+				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 				// Passwd Expired - Com atributo
-				if (($old_values['passwd_expired'] != '') && ($new_values['passwd_expired'] == '1'))
+				if (($old_values['passwd_expired'] != 0) && ($new_values['passwd_expired'] == '1'))
 				{
 					$ldap_mod_replace['phpgwlastpasswdchange'] = '0';
-					$this->db_functions->write_log("Expirado senha do usuário $dn",'','','','');
+					$this->db_functions->write_log("Expired user password","$dn");
 				}
 			}
@@ -406,5 +394,5 @@
 					}
 					
-					$this->db_functions->write_log("alterado password do usuario $dn",'','','','');
+					$this->db_functions->write_log("modified user password",$dn);
 				}
 			}
@@ -416,5 +404,5 @@
 				{
 					$ldap_mod_replace['telephonenumber'] = $new_values['telephonenumber'];
-					$this->db_functions->write_log("alterado telephonenumber do usuario $dn de ".$old_values['telephonenumber']." para ".$new_values['telephonenumber'],'','','','');
+					$this->db_functions->write_log('modified user telephonenumber', $dn . ': ' . $old_values['telephonenumber'] . '->' . $new_values['telephonenumber']);
 				}
 			}
@@ -432,22 +420,22 @@
 					{
 						$ldap_atribute = str_replace("corporative_information_", "", $atribute);
-						// REPLACE ATTRS OF CORPORATIVE
+						// REPLACE CORPORATIVE ATTRIBUTES
 						if (($diff[$atribute]) && ($old_values[$atribute] != ''))
 						{
 							$ldap_atribute = str_replace("corporative_information_", "", $atribute);
-							$ldap_mod_replace[$ldap_atribute] = $new_values[$atribute];
-							$this->db_functions->write_log("alterado $ldap_atribute do usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','','');
-						}
-						//ADD ATTRS OF CORPORATIVE
+							$ldap_mod_replace[$ldap_atribute] = utf8_encode($new_values[$atribute]);
+							$this->db_functions->write_log('modified user attribute', $dn . ': ' . $ldap_atribute . ': ' . $old_values[$atribute] . '->' . $new_values[$atribute]);
+						}
+						//ADD CORPORATIVE ATTRIBUTES
 						elseif (($old_values[$atribute] == '') && ($new_values[$atribute] != ''))
 						{
-							$ldap_add[$ldap_atribute] = $new_values[$atribute];
-							$this->db_functions->write_log("adicionado $ldap_atribute ao usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','','');
-						}
-						//REMOVE ATTRS OF CORPORATIVE
+							$ldap_add[$ldap_atribute] = utf8_encode($new_values[$atribute]);
+							$this->db_functions->write_log('added user attribute', $dn . ': ' . $ldap_atribute . ': ' . $old_values[$atribute] . '->' . $new_values[$atribute]);
+						}
+						//REMOVE CORPORATIVE ATTRIBUTES
 						elseif (($old_values[$atribute] != '') && ($new_values[$atribute] == ''))
 						{
 							$ldap_remove[$ldap_atribute] = array();
-							$this->db_functions->write_log("removido $ldap_atribute do usuario $dn de ".$old_values[$atribute]." para ".$new_values[$atribute],'','','','');	
+							$this->db_functions->write_log('removed user attribute', $dn . ': ' . $ldap_atribute . ': ' . $old_values[$atribute] . '->' . $new_values[$atribute]);	
 						}
 					}
@@ -463,5 +451,5 @@
 				{
 					$ldap_mod_replace['gidnumber'] = $new_values['gidnumber'];
-					$this->db_functions->write_log("alterado gidnumber do usuario $dn. De:".$old_values['gidnumber']." Para:".$new_values['gidnumber'],'','','','');
+					$this->db_functions->write_log('modified user primary group', $dn . ': ' . $old_values['gidnumber'] . '->' . $new_values['gidnumber']);
 				}
 				
@@ -471,5 +459,5 @@
 					{
 						$ldap_mod_replace['sambaPrimaryGroupSID']	= $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $new_values['gidnumber'])+1001);
-						$this->db_functions->write_log("alterado sambaPrimaryGroupSID do usuario $dn.",'','','','');
+						$this->db_functions->write_log('modified user sambaPrimaryGroupSID', $dn);
 					}
 					
@@ -477,15 +465,15 @@
 					{
 						$ldap_mod_replace['sambaacctflags'] = $new_values['sambaacctflags'];
-						$this->db_functions->write_log("alterado sambaacctflags do usuario $dn",'','','','');
+						$this->db_functions->write_log("modified user sambaacctflags",$dn);
 					}
 					if ($diff['sambalogonscript'])
 					{
 						$ldap_mod_replace['sambalogonscript'] = $new_values['sambalogonscript'];
-						$this->db_functions->write_log("alterado sambalogonscript do usuario $dn",'','','','');
+						$this->db_functions->write_log("modified user sambalogonscript",$dn);
 					}
 					if ($diff['sambahomedirectory'])
 					{
 						$ldap_mod_replace['homedirectory'] = $new_values['sambahomedirectory'];
-						$this->db_functions->write_log("alterado homedirectory do usuario $dn",'','','','');
+						$this->db_functions->write_log("modified user homedirectory",$dn);
 					}
 					if ($diff['sambadomain'])
@@ -493,5 +481,5 @@
 						$ldap_mod_replace['sambaSID']				= $diff['sambadomain'] . '-' . ((2 * $old_values['uidnumber'])+1000);
 						$ldap_mod_replace['sambaPrimaryGroupSID']	= $diff['sambadomain'] . '-' . ((2 * $old_values['gidnumber'])+1001);
-						$this->db_functions->write_log("alterado dominio samba do usuario $dn para " . $params['sambadomain'],'','','','');
+						$this->db_functions->write_log('modified user samba domain', $dn . ': ' . $old_values['sambadomain'] . '->' . $new_values['sambadomain']);
 					}
 				}
@@ -509,5 +497,5 @@
 				{
 					$this->ldap_functions->ldap_remove_photo($dn);
-					$this->db_functions->write_log("removido jpegphoto do usuario $dn",'','','','');
+					$this->db_functions->write_log("removed user photo",$dn);
 				}
 				elseif ($_FILES['photo']['name'] != '')
@@ -517,5 +505,5 @@
 					{
 						$return['status'] = false;
-						$return['msg'] .= 'Foto do usuário não foi salva, pois excede o tamanho máximo de 10 kb.';
+						$return['msg'] .= lang('User photo could not be save because is bigger the 10 kb') . '.';
 					}
 					else
@@ -524,10 +512,10 @@
 						{
 							$photo_exist = true;
-							$this->db_functions->write_log("substituido jpegphoto do usuario $dn",'','','','');
+							$this->db_functions->write_log("mofified user photo",$dn);
 						}
 						else
 						{
 							$photo_exist = false;
-							$this->db_functions->write_log("adicionado jpegphoto ao usuario $dn",'','','','');
+							$this->db_functions->write_log("added user photo",$dn);
 						}				
 						$this->ldap_functions->ldap_save_photo($dn, $_FILES['photo']['tmp_name'], $new_values['photo_exist'], $photo_exist);
@@ -544,10 +532,10 @@
 				{
 					$ldap_add['telephonenumber'] = $new_values['telephonenumber'];
-					$this->db_functions->write_log("adicionado telephonenumber ao usuario $dn",'','','','');
+					$this->db_functions->write_log("added user phone",$dn);
 				}
 				if (($old_values['telephonenumber'] != '') && ($new_values['telephonenumber'] == ''))
 				{
 					$ldap_remove['telephonenumber'] = array();
-					$this->db_functions->write_log("removido telephonenumber do usuario $dn",'','','','');
+					$this->db_functions->write_log("removed user phone",$dn);
 				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -556,10 +544,10 @@
 				{
 					$ldap_add['phpgwlastpasswdchange'] = '0';
-					$this->db_functions->write_log("Expirado senha do usuário $dn",'','','','');
+					$this->db_functions->write_log("expired user password",$dn);
 				}
 				if (($old_values['passwd_expired'] == '0') && ($new_values['passwd_expired'] == ''))
 				{
 					$ldap_remove['phpgwlastpasswdchange'] = array();
-					$this->db_functions->write_log("Removido expiração da senha do usuário $dn",'','','','');
+					$this->db_functions->write_log("removed expiry from user password",$dn);
 				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -568,10 +556,10 @@
 				{
 					$this->db_functions->add_pref_changepassword($new_values['uidnumber']);
-					$this->db_functions->write_log("adicionado changepassword ao usuario $dn",'','','','');
+					$this->db_functions->write_log("turn on changepassword",$dn);
 				}
 				if (($old_values['changepassword'] != '') && ($new_values['changepassword'] == ''))
 				{
 					$this->db_functions->remove_pref_changepassword($new_values['uidnumber']);
-					$this->db_functions->write_log("removido changepassword do usuario $dn",'','','','');
+					$this->db_functions->write_log("turn of changepassword",$dn);
 				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -580,10 +568,10 @@
 				{
 					$ldap_add['phpgwaccountstatus'] = 'A';
-					$this->db_functions->write_log("ativado conta do usuario $dn",'','','','');
+					$this->db_functions->write_log("turn on user account",$dn);
 				}
 				if (($old_values['phpgwaccountstatus'] != '') && ($new_values['phpgwaccountstatus'] == ''))
 				{
 					$ldap_remove['phpgwaccountstatus'] = array();
-					$this->db_functions->write_log("desativado conta do usuario $dn",'','','','');
+					$this->db_functions->write_log("turn off user account",$dn);
 				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -592,10 +580,10 @@
 				{
 					$ldap_add['phpgwaccountvisible'] = '-1';
-					$this->db_functions->write_log("adicionado phpgwaccountvisible ao usuario $dn",'','','','');
+					$this->db_functions->write_log("turn on phpgwaccountvisible",$dn);
 				}
 				if (($old_values['phpgwaccountvisible'] != '') && ($new_values['phpgwaccountvisible'] == ''))
 				{
 					$ldap_remove['phpgwaccountvisible'] = array();
-					$this->db_functions->write_log("removido phpgwaccountvisible ao usuario $dn",'','','','');
+					$this->db_functions->write_log("turn off phpgwaccountvisible",$dn);
 				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -604,38 +592,11 @@
 				{
 					$ldap_add['accountstatus'] = 'active';
-					$this->db_functions->write_log("ativado conta de email do usuario $dn",'','','','');
+					$this->db_functions->write_log("turn on user account email",$dn);
 				}
 				if (($old_values['accountstatus'] != '') && ($new_values['accountstatus'] == ''))
 				{
 					$ldap_remove['accountstatus'] = array();
-					$this->db_functions->write_log("desativado conta de email do usuario $dn",'','','','');
-				}
-				/*
-				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-				// MAILALTERNATEADDRESS
-				if (($old_values['mailalternateaddress'] == '') && ($new_values['mailalternateaddress'] != ''))
-				{
-					$ldap_add['mailalternateaddress'] = $new_values['mailalternateaddress'];
-					$this->db_functions->write_log("adicionado mailalternateaddress ao usuario",'',$dn,'','');
-				}
-				if (($old_values['mailalternateaddress'] != '') && ($new_values['mailalternateaddress'] == ''))
-				{
-					$ldap_remove['mailalternateaddress'] = array();
-					$this->db_functions->write_log("removido mailalternateaddress ao usuario",'',$dn,'','');
-				}
-				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-				// MAILFORWARDINGADDRESS
-				if (($old_values['mailforwardingaddress'] == '') && ($new_values['mailforwardingaddress'] != ''))
-				{
-					$ldap_add['mailforwardingaddress'] = $new_values['mailforwardingaddress'];
-					$this->db_functions->write_log("adicionado mailforwardingaddress ao usuario",'',$dn,'','');
-				}
-				if (($old_values['mailforwardingaddress'] != '') && ($new_values['mailforwardingaddress'] == ''))
-				{
-					$ldap_remove['mailforwardingaddress'] = array();
-					$this->db_functions->write_log("removido mailforwardingaddress ao usuario",'',$dn,'','');
-				}
-				*/
-				
+					$this->db_functions->write_log("turn off user account email",$dn);
+				}
 				////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 				// MAILALTERNATEADDRESS
@@ -651,5 +612,5 @@
 					{
 						$ldap_add['mailalternateaddress'][] = $mailalternateaddress;
-						$this->db_functions->write_log("adicionado mailalternateaddress $mailalternateaddress ao usuario $dn",'',$dn,'','');
+						$this->db_functions->write_log("added mailalternateaddress","$dn: $mailalternateaddress");
 					}
 				}
@@ -661,5 +622,5 @@
 						{
 							$ldap_remove['mailalternateaddress'][] = $mailalternateaddress;
-							$this->db_functions->write_log("removido mailalternateaddress $mailalternateaddress do usuario $dn",'',$dn,'','');
+							$this->db_functions->write_log("removed mailalternateaddress","$dn: $mailalternateaddress");
 						}
 					}
@@ -679,5 +640,5 @@
 					{
 						$ldap_add['mailforwardingaddress'][] = $mailforwardingaddress;
-						$this->db_functions->write_log("adicionado mailforwardingaddress $mailforwardingaddress ao usuario $dn",'',$dn,'','');
+						$this->db_functions->write_log("added mailforwardingaddress","$dn: $mailforwardingaddress");
 					}
 				}
@@ -689,5 +650,5 @@
 						{
 							$ldap_remove['mailforwardingaddress'][] = $mailforwardingaddress;
-							$this->db_functions->write_log("removido mailforwardingaddress $mailforwardingaddress do usuario $dn",'',$dn,'','');
+							$this->db_functions->write_log("removed mailforwardingaddress","$dn: $mailforwardingaddress");
 						}
 					}
@@ -699,10 +660,10 @@
 				{
 					$ldap_add['deliverymode'] = 'forwardOnly';
-					$this->db_functions->write_log("adicionado forwardOnly ao usuario $dn",'','','','');
+					$this->db_functions->write_log("added forwardOnly", $dn);
 				}
 				if (($old_values['deliverymode'] != '') && ($new_values['deliverymode'] == ''))
 				{
 					$ldap_remove['deliverymode'] = array();
-					$this->db_functions->write_log("removido forwardOnly ao usuario $dn",'','','','');
+					$this->db_functions->write_log("removed forwardOnly", $dn);
 				}
 			}
@@ -716,5 +677,5 @@
 				{
 					$this->imap_functions->change_user_quota($new_values['uid'], $new_values['mailquota']);
-					$this->db_functions->write_log("alterado cota do usuario $dn",'','','','');
+					$this->db_functions->write_log("modified user email quota", $dn);
 				}
 			}
@@ -739,5 +700,5 @@
 					$ldap_remove['sambaPwdLastSet']			= array();
 					$ldap_remove['sambaPwdMustChange']		= array();
-					$this->db_functions->write_log("removido atributos samba do usuario $dn.",'','','','');
+					$this->db_functions->write_log("removed user samba attributes", $dn);
 				}
 				//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -745,9 +706,10 @@
 				if (($this->current_config['expressoAdmin_samba_support'] == 'true') && (!$new_values['userSamba']) && ($new_values['use_attrs_samba'] == 'on'))
 				{
-					//Verifica se o binario para criar as senhas do samba exite.
 					if (!is_file('/home/expressolivre/mkntpwd'))
 					{
 						$return['status'] = false;
-						$return['msg'] .= "O arquivo binário /home/expressolivre/mkntpwd não exite.\\nEle é necessário para a criação das senhas usadas pelo SAMBA.\\nInforme o administrador ExpressoLivre sobre isto.\\n";
+						$return['msg'] .= lang("The file /home/expressolivre/mkntpwd does not exist") . ".\n";
+						$return['msg'] .= lang("It is necessery to create samba passwords") . ".\n";
+						$return['msg'] .= lang("Inform your system administrator about this") . ".\n";
 					}
 					else
@@ -766,5 +728,5 @@
 						$ldap_add['sambaPwdLastSet']		= strtotime("now");
 						$ldap_add['sambaPwdMustChange']	= '2147483647';
-						$this->db_functions->write_log("adicionado atributos samba ao usuario $dn.",'','','','');
+						$this->db_functions->write_log("added user samba attribute", $dn);
 					}
 				}
@@ -795,5 +757,5 @@
 						$this->db_functions->add_user2group($gidnumber, $new_values['uidnumber']);
 						$this->ldap_functions->add_user2group($gidnumber, $user_uid);
-						$this->db_functions->write_log("adicionado usuario $dn ao grupo $gidnumber.",'','','','');
+						$this->db_functions->write_log("inserted user to group", "$dn: $gidnumber");
 					}
 				}
@@ -809,21 +771,9 @@
 								$this->db_functions->remove_user2group($gidnumber, $new_values['uidnumber']);
 								$this->ldap_functions->remove_user2group($gidnumber, $user_uid);
-								$this->db_functions->write_log("removido usuario $dn do grupo $gidnumber.",'','','','');
+								$this->db_functions->write_log("removed user from group", "$dn: $gidnumber");
 							}
 						}
 					}
 				}
-				/* GIDNUMBER agora é um atributo samba e pode ser alterado por gerentes com este perfil
-				/*
-				if ($diff['gidnumber'])
-				{
-					$ldap_mod_replace['gidnumber'] = $new_values['gidnumber'];
-					if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($new_values['userSamba']) && ($new_values['use_attrs_samba'] == 'on'))
-					{
-						$ldap_mod_replace['sambaPrimaryGroupSID']	= $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $new_values['gidnumber'])+1001);
-					}
-					$this->db_functions->write_log("alterado gidnumber do usuario.",'',$dn,'','');
-				}
-				*/
 			}
 			////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -843,6 +793,4 @@
 			if (count($ldap_add))
 			{
-				echo 'ldap-add<br>';
-				print_r($ldap_add);
 				$result = $this->ldap_functions->add_user_attributes($dn, $ldap_add);
 				if (!$result['status'])
@@ -857,6 +805,4 @@
 			if (count($ldap_remove))
 			{
-				echo 'ldap-remove<br>';
-				print_r($ldap_remove);
 				$result = $this->ldap_functions->remove_user_attributes($dn, $ldap_remove);
 				if (!$result['status'])
@@ -886,13 +832,8 @@
 					{
 						$this->ldap_functions->add_user2maillist($uid, $new_values['mail']);
-						$this->db_functions->write_log("adicionado usuario $dn a maillist $uid.",'','','','');
-					}
-				}
-				/*
-				echo '<pre>';
-				print_r($old_values['maillists']);
-				print_r($new_values['maillists']);
-				*/
-				
+						$this->db_functions->write_log("inserted user to maillist","$dn: $uid");
+					}
+				}
+
 				if (count($remove_maillists)>0)
 				{
@@ -900,5 +841,5 @@
 					{
 						$this->ldap_functions->remove_user2maillist($uid, $new_values['mail']);
-						$this->db_functions->write_log("removido usuario $dn da maillist $uid.",'','','','');
+						$this->db_functions->write_log("removed user from maillist","$dn: $uid");
 					}
 				}
@@ -930,5 +871,5 @@
 
 					foreach ($add_apps as $app => $index)
-						$this->db_functions->write_log("Adicionado aplicativo $app ao usuário $dn",'',$dn,'','');
+						$this->db_functions->write_log("added application to user","$dn: $app");
 				}
 				if (count($remove_apps)>0)
@@ -945,5 +886,5 @@
 					
 					foreach ($remove_apps2 as $app => $access)
-						$this->db_functions->write_log("Removido aplicativo $app do usuário $dn",'',$dn,'','');
+						$this->db_functions->write_log("removed application to user","$dn: $app");
 				}
 				//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -976,8 +917,8 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Senha default já cadastrada!';
-			}
-			
-			$this->db_functions->write_log("Setado senha default para $uid",'','','','');
+				$return['msg'] = lang('default password already registered') . '!';
+			}
+			
+			$this->db_functions->write_log("inserted default password",$uid);
 			
 			return $return;
@@ -997,8 +938,8 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Senha default NÃO cadastrada!';
-			}
-			
-			$this->db_functions->write_log("Retornado senha default de $uid",'','','','');
+				$return['msg'] = lang('default password not registered') . '!';
+			}
+			
+			$this->db_functions->write_log("returned user password",$uid);
 			
 			return $return;
@@ -1039,5 +980,5 @@
 						$return['msg'] .= $result_ldap['msg'];
 					}
-					$this->db_functions->write_log('deletado usuario ' . $user_info['uid'],'','','','');
+					$this->db_functions->write_log('deleted user', $user_info['uid']);
 				}
 			}
@@ -1055,13 +996,13 @@
 			{
 				$return['status'] = false;
-				$return['msg'] .= 'Você não tem acesso para deletar este usuário.';
+				$return['msg'] .= lang('You do not have access to delete user') . '.';
 				return $return;
 			}
 
-			// Check if the new_uid alrteady is in use.			
+			// Check if the new_uid is in use.			
 			if ( ! $this->ldap_functions->check_rename_new_uid($params['new_uid']) )
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Novo login já está em uso.';
+				$return['msg'] = lang('New login already in use') . '.';
 				return $return;
 			}
@@ -1095,6 +1036,8 @@
     	    	{
 					$return['status'] = false;
-					$return['msg'] = "A renomeação de usuários só permitida com o cyrus versão 2.2 ou superior,";
-					$return['msg'] .= "\ne com a opção 'allowusermoves: yes' configurado no imapd.conf.";
+					$return['msg'] = "The rename user is only permitted with cyrus 2.2 or higher,";
+					$return['msg'] .= "\nand with the option 'allowusermoves: yes' set in imapd.conf.";
+
+
 					return $return;
 	        	}
@@ -1105,5 +1048,5 @@
 				{
 					$return['status'] = false;
-					$return['msg'] = "Erro ao renomear usuário no LDAP. Processo abortado.";
+					$return['msg'] = lang("Error rename user in LDAP") . '.';
 					return $return;
 				}
@@ -1117,5 +1060,5 @@
 					
 					$return['status'] = false;
-					$return['msg'] = "Erro ao renomear usuário no Cyrus. Processo abortado.";
+					$return['msg'] = lang("Erro rename user in Cyrus") . '.';
 					return $return;
 				}
@@ -1154,15 +1097,12 @@
 					else 
 					{
+						$return['msg'] .= $result['msg'] . lang("Error renome sieve script") . '.';
+					}
+					$sieve->sieve_logout();
+				}
+				else
+				{
 						$return['status'] = false;
-						$return['msg'] .= $result['msg'] . "Erro ao renomear script sieve, falha no envio do novo script." .
-															"\nCaixa postal e login alterados.";
-					}
-					$sieve->sieve_logout();
-				}
-				else
-				{
-						$return['status'] = false;
-						$return['msg'] .= $result['msg'] . "Erro ao renomear script sieve, falha no Login." .
-															"\nCaixa postal e login alterados.";
+						$return['msg'] .= $result['msg'] . lang("Error renome sieve script") . '.';
 				}
 
@@ -1170,5 +1110,5 @@
 				$this->ldap_functions->set_user_password($new_uid, $user_password);
 		
-				$this->db_functions->write_log("renomeado login do usuario $uid para $new_uid.",'','','','');
+				$this->db_functions->write_log("renamed user", "$uid -> $new_uid");
 
 				$return['exec_return'] = "";
Index: trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 414)
@@ -12,4 +12,8 @@
 	var $imap_server;
 	var $imap_port;
+    var $imap_trashfolder;
+    var $imap_sentfolder;
+    var $imap_draftsfolder;
+    var $imap_spamfolder;
 	
 	function imap_functions(){
@@ -18,4 +22,8 @@
 		$this->imap_server	= $_SESSION['phpgw_info']['expresso']['email_server']['imapServer'];
 		$this->imap_port	= $_SESSION['phpgw_info']['expresso']['email_server']['imapPort'];
+		$this->imap_trashfolder		= $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultTrashFolder'];
+		$this->imap_sentfolder		= $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSentFolder'];
+		$this->imap_draftsfolder	= $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultDraftsFolder'];
+		$this->imap_spamfolder		= $_SESSION['phpgw_info']['expresso']['email_server']['imapDefaultSpamFolder'];
 		$this->imapDelimiter= $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter'];
 		$this->imap 		= imap_open('{'.$this->imap_server.':'.$this->imap_port.'/novalidate-cert}', $this->imap_admin, $this->imap_passwd, OP_HALFOPEN);
@@ -28,34 +36,52 @@
 		{
 			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = 'Erro na funcao imap_function->create(INBOX): ' . $error[0];
-			return $result;
-		}
-		if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Enviados"))
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = 'Erro na funcao imap_function->create(Enviados): ' . $error[0];
-			return $result;
-		}
-		if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Rascunhos"))
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = 'Erro na funcao imap_function->create(Rascunho): ' . $error[0];
-			return $result;
-		}
-		if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . "Lixeira"))
-		{
-			$error = imap_errors();
-			$result['status'] = false;
-			$result['msg'] = 'Erro na funcao imap_function->create(Lixeira): ' . $error[0];
-			return $result;
-		}
+			if ($error[0] == 'Mailbox already exists')
+			{
+				$result['status'] = true;
+			}
+			else
+			{
+				$result['status'] = false;
+				$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(INBOX) ($uid):" . $error[0];
+			}
+			return $result;
+		}
+		if ( (!empty($this->imap_sentfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_sentfolder)) )
+		{
+			$error = imap_errors();
+			$result['status'] = false;
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_sentfolder."):" . $error[0];
+			return $result;
+		}
+		if ( (!empty($this->imap_draftsfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_draftsfolder)) )
+		{
+			$error = imap_errors();
+			$result['status'] = false;
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_draftsfolder."):" . $error[0];
+			return $result;
+		}
+		if ( (!empty($this->imap_trashfolder)) && (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_trashfolder)) )
+		{
+			$error = imap_errors();
+			$result['status'] = false;
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_trashfolder."):" . $error[0];
+			return $result;
+		}
+		if (!empty($this->imap_sentfolder))
+		{
+		    if (!imap_createmailbox($this->imap, '{'.$this->imap_server.'}' . "user" . $this->imapDelimiter . $uid . $this->imapDelimiter . $this->imap_spamfolder))
+			{
+			    $error = imap_errors();
+			    $result['status'] = false;
+			    $result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(".$this->imap_spamfolder."):" . $error[0];
+			    return $result;
+			}
+		}
+
 		if (!imap_set_quota($this->imap,"user" . $this->imapDelimiter . $uid, ($mailquota*1024))) 
 		{
 			$error = imap_errors();
 			$result['status'] = false;
-			$result['msg'] = 'Erro na funcao imap_function->create(set_quota): ' . $error[0];
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->create(imap_set_quota):" . $error[0];
 			return $result;
 		}
@@ -100,5 +126,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao imap_function->delete_user.\nRetorno do servidor: " . imap_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->delete_user.\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
 		}
 		
@@ -122,5 +148,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao imap_function->rename_mailbox.\nRetorno do servidor: " . imap_last_error();
+			$result['msg'] = $this->functions->lang('Error on function') . " imap_functions->rename_mailbox.\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
 		}
 		else
@@ -138,5 +164,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Você não tem acesso para executar esta operação.';
+			$result['msg'] = $this->functions->lang('You do not have access to clean an user inbox');
 			return $result;
 		}
@@ -159,5 +185,4 @@
 		if ($return_setacl)
 		{
-			//$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options.'/user="'.$uid.'"}', $this->imap_admin, $this->imap_passwd);
 			$mbox_stream = imap_open('{'.$this->imap_server.':'.$this->imap_port.$imap_options .'}user'. $this->imapDelimiter . $uid, $this->imap_admin, $this->imap_passwd);
 			
@@ -180,11 +205,11 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = "Nao foi possivel esvaziar a caixa postal do usuario:\n" . imap_last_error();
-			}
-		}
-		else
-		{
-			$result['status'] = false;
-			$result['msg'] = "Nao foi possivel modificar a acl do usuario:\n" . imap_last_error();
+				$result['msg'] = $this->functions->lang('It was not possible clean the users inbox') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
+			}
+		}
+		else
+		{
+			$result['status'] = false;
+			$result['msg'] = $this->functions->lang('It was not possible to modify the users acl') . ".\n" . $this->functions->lang('Server returns') . ': ' . imap_last_error();
 		}
 		return $result;
Index: trunk/expressoAdmin1_2/inc/class.maillist.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.maillist.inc.php	(revision 355)
+++ trunk/expressoAdmin1_2/inc/class.maillist.inc.php	(revision 414)
@@ -113,9 +113,9 @@
 			if ($return['status'] == true)
 			{
-				$this->db_functions->write_log('Criado lista de email','',$dn,'','');
+				$this->db_functions->write_log('created email list',$dn);
 				
 				foreach($params['mailForwardingAddress'] as $index=>$mail)
 				{
-					$this->db_functions->write_log("Adicionado email $mail a lista ".$params['cn']." no momento da criação",$dn,'','','');
+					$this->db_functions->write_log("added user on email list creation", $params['cn'].':' . $mail);
 				}
 			}
@@ -130,5 +130,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para editar listas de email.';
+				$return['msg'] = lang('You do not have access to edit email lists') . '.';
 				return $return;
 			}
@@ -158,5 +158,5 @@
 						$dn = $newrdn . ',' . $newparent;
 						$old_dn = $old_values['uid'];
-						$this->db_functions->write_log("Renomeado login da lista de $old_dn para $dn",'',$dn,$old_values['uid'],'');
+						$this->db_functions->write_log("renamed list login",$old_dn . ' -> ' . $dn);
 					}
 				}
@@ -168,10 +168,10 @@
 			{
 				$ldap_mod_replace['mail'] = $new_values['mail'];
-				$this->db_functions->write_log('Modificado email da lista para ' . $new_values['mail'],'',$dn,'','');
+				$this->db_functions->write_log('modified list email', $dn . ': ' . $old_values['mail'] . '->' . $new_values['mail']);
 			}
 			if ($new_values['cn'] != $old_values['cn'])
 			{
 				$ldap_mod_replace['cn'] = $new_values['cn'];
-				$this->db_functions->write_log("Modificado common name da lista $dn",'',$dn,'','');
+				$this->db_functions->write_log('modified list name', $old_values['cn'] . '->' . $new_values['cn']);
 			}
 			if ($diff['uid'])
@@ -255,5 +255,5 @@
 					foreach($add_users as $index=>$mail)
 					{
-						$this->db_functions->write_log("Adicionado usuario $mail a lista de email $dn",$dn,'','','');
+						$this->db_functions->write_log("added user to list", "$dn: $mail");
 					}
 				}
@@ -275,5 +275,5 @@
 					foreach($remove_users as $index=>$mail)
 					{
-						$this->db_functions->write_log("Removido usuario $mail da lista de email $dn",$dn,'','','');
+						$this->db_functions->write_log("removed user from list", "$dn: $mail");
 					}
 				}
@@ -289,5 +289,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para editar SCL de listas de email.';
+				$return['msg'] = lang('You do not have access to edit email lists SCL') . '.';
 				return $return;
 			}
@@ -314,5 +314,5 @@
 			{
 				$ldap_add['participantCanSendMail'] = "TRUE";
-				$this->db_functions->write_log("Ativado participantCanSendMail da SCL da lista de email " . $new_values['mail'],'','','','');
+				$this->db_functions->write_log("turned on participantCanSendMail",$new_values['mail']);
 			}
 			if (($new_values['accountRestrictive'] == 'on') && ($old_values['accountRestrictive'] == ''))
@@ -320,5 +320,5 @@
 				$ldap_add['accountRestrictive'] = "mailListRestriction";
 				$ldap_add['accountDeliveryMessage']	= 'OK';
-				$this->db_functions->write_log("Ativado mailListRestriction da SCL da lista de email " . $new_values['mail'],'','','','');
+				$this->db_functions->write_log("turned on mailListRestriction", $new_values['mail']);
 			}
 			if (count($ldap_add))
@@ -337,5 +337,5 @@
 			{
 				$ldap_remove['participantCanSendMail']	= array();
-				$this->db_functions->write_log("Desativado participantCanSendMail da SCL da lista de email " . $new_values['mail'],'','','','');
+				$this->db_functions->write_log("turned off participantCanSendMail",$new_values['mail']);
 			}
 			if (($new_values['accountRestrictive'] != 'on') && ($old_values['accountRestrictive'] == 'mailListRestriction'))
@@ -343,5 +343,5 @@
 				$ldap_remove['accountRestrictive']	= array();
 				$ldap_remove['accountDeliveryMessage']	= array();
-				$this->db_functions->write_log("Desativado restrição (mailListRestriction) da SCL da lista de email " . $new_values['mail'],'','','','');
+				$this->db_functions->write_log("turned off mailListRestriction",$new_values['mail']);
 			}
 			if (count($ldap_remove))
@@ -381,5 +381,5 @@
 					foreach($add_users as $index=>$mail)
 					{
-						$this->db_functions->write_log("Adicionado usuario $mail da SCP da lista de email $dn",$dn,'','','');
+						$this->db_functions->write_log("added user to SCL","$dn: $mail",'','','');
 					}
 				}
@@ -401,5 +401,5 @@
 					foreach($add_users as $index=>$mail)
 					{
-						$this->db_functions->write_log("Removido usuario $mail da SCP da lista de email $dn",$dn,'','','');
+						$this->db_functions->write_log("removed user from SCL","$dn: $mail",'','','');
 					}
 				}
@@ -427,5 +427,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para excluir listas de email.';
+				$return['msg'] = lang('You do not have access to delete email lists') . '.';
 				return $return;
 			}
@@ -447,10 +447,9 @@
 			if ($return['status'] == true)
 			{
-				$this->db_functions->write_log('Deletado lista de email','',$uid,'','');
+				$this->db_functions->write_log('deleted email list',$uid);
 			}
 			
 			return $return;	
 		}
-		
 	}
 ?>
Index: trunk/expressoAdmin1_2/inc/class.uicomputers.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uicomputers.inc.php	(revision 309)
+++ trunk/expressoAdmin1_2/inc/class.uicomputers.inc.php	(revision 414)
@@ -91,15 +91,8 @@
 				'add_computers_disabled'	=> $this->functions->check_acl($manager_lid,'create_computers') ? '' : 'display:none',
 				'back_url'					=> $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
-				'lang_back'					=> lang('Back'),
 				'context_display'			=> $context_display,
-				'lang_computers_uid'		=> lang('Computer UID'),
-				'lang_add_computers'		=> lang('Create Computers'),
-				'lang_description'			=> lang('Description'),
-				'lang_edit'  				=> lang('Edit'),
-				'lang_delete'				=> lang('Delete'),
-				'lang_context'				=> lang('context'),
-				'lang_search'				=> lang('search')
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 			
 			// Save query
@@ -183,4 +176,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_email_list' => 'computers_form.tpl'));
+			$p->set_block('create_email_list','body','body');
 
 			// Inclue na combo, os usuarios previamente selecionados no caso de um erro na validacao dos dados.
@@ -224,21 +218,5 @@
 				'row_off'						=> "#EEEEEE",
 				'color_bg1'						=> "#E8F0F0",
-				'lang_back'						=> lang('Back'),
-				'lang_save'						=> lang('save'),
-				'lang_search_organization'		=> lang('Search Organiztion'),
-				'lang_organizations'			=> lang('Organizations'),
-				'lang_sectors'					=> lang('Sectors'),
-				'lang_sambadomain'				=> lang('Domain'),
-				
-				'lang_computer_cn'				=> lang('Computer UID'),
-				'lang_computer_description'		=> lang('Description'),
-				'lang_computer_type'			=> lang('Computer Type'),
-				
-				'lang_active_workstation'		=> lang('WorkStation Active'),
-				'lang_desactive_workstation'	=> lang('WorkStation Desactive'),
-				'lang_trust_account'			=> lang('Trust Account'),
-				'lang_server'					=> lang('Server'),
-				'lang_computer_password'		=> lang('Computer password'),
-				
+
 				'display_tr_computer_password'	=> $_POST['sambaAcctFlags'] == '[I          ]' ? '' : 'display:none',
 
@@ -254,4 +232,5 @@
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 			
 			if ($_POST['sambaAcctFlags'] != '')
@@ -329,4 +308,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('edit_computers' => 'computers_form.tpl'));
+			$p->set_block('edit_computers','body','body');
 			
 			//O POST esta vazio, oq indica que precisamos recuperar os dados do computador no ldap.
@@ -370,18 +350,4 @@
 					'row_off'						=> "#EEEEEE",
 					'color_bg1'						=> "#E8F0F0",
-					'lang_back'						=> lang('Back'),
-					'lang_save'						=> lang('save'),
-					'lang_search_organization'		=> lang('Search Organiztion'),
-					'lang_organizations'			=> lang('Organizations'),
-					'lang_sectors'					=> lang('Sectors'),
-					'lang_sambadomain'				=> lang('Domain'),
-					'lang_computer_cn'				=> lang('Computer UID'),
-					'lang_computer_description'		=> lang('Description'),
-					'lang_computer_type'			=> lang('Computer Type'),
-					'lang_active_workstation'		=> lang('WorkStation Active'),
-					'lang_desactive_workstation'	=> lang('WorkStation Desactive'),
-					'lang_trust_account'			=> lang('Trust Account'),
-					'lang_server'					=> lang('Server'),
-					'lang_computer_password'		=> lang('Computer password'),
 				
 					'display_tr_computer_password'	=> $computer_data['sambaAcctFlags'] == '[I          ]' ? '' : 'display:none',
@@ -398,4 +364,5 @@
 				);
 				$p->set_var($var);
+				$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 				
 				if ($computer_data['sambaAcctFlags'] != '')
@@ -450,17 +417,5 @@
 					'row_off'						=> "#EEEEEE",
 					'color_bg1'						=> "#E8F0F0",
-					'lang_back'						=> lang('Back'),
-					'lang_save'						=> lang('save'),
-					'lang_sectors'					=> lang('Sectors'),
-					'lang_sambadomain'				=> lang('Domain'),
-					'lang_computer_cn'				=> lang('Computer UID'),
-					'lang_computer_description'		=> lang('Description'),
-					'lang_computer_type'			=> lang('Computer Type'),
-					'lang_active_workstation'		=> lang('WorkStation Active'),
-					'lang_desactive_workstation'	=> lang('WorkStation Desactive'),
-					'lang_trust_account'			=> lang('Trust Account'),
-					'lang_server'					=> lang('Server'),
-					'lang_computer_password'		=> lang('Computer password'),
-		
+
 					// Retorna os valores, quando da um erro na validação.
 					'uidnumber'						=> $_POST['uidnumber'],
@@ -483,5 +438,6 @@
 					'old_sambasid'					=> $_POST['sambasid']
 				);
-				$p->set_var($var);		
+				$p->set_var($var);
+				$p->set_var($this->functions->make_dinamic_lang($p, 'body'));	
 
 				if ($_POST['sambaAcctFlags'] != '')
@@ -522,6 +478,4 @@
 		function delete_computer()
 		{
-			//_debug_array($_GET);
-			
 			$account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
 			$acl = $this->functions->read_acl($account_lid);
@@ -542,4 +496,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('delete_computer' => 'computers_delete.tpl'));
+			$p->set_block('delete_computer','body','body');
 			
 			// Get group data 
@@ -550,7 +505,4 @@
 			$var = Array(
 				'color_bg1'					=> "#E8F0F0",
-				'lang_back'					=> lang('Back'),
-				'lang_delete'				=> lang('Delete'),
-				'lang_delete_computer'		=> lang('Do you realy want delete this Computer?'),
 				'dn'						=> $email_list_data['dn'],
 				'computer_cn'				=> $computer_data['computer_cn'],
@@ -561,4 +513,5 @@
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 			$p->pfp('out','delete_computer');
 		}
Index: trunk/expressoAdmin1_2/inc/class.uisectors.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uisectors.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.uisectors.inc.php	(revision 414)
@@ -68,13 +68,8 @@
 				'th_bg'					=> $GLOBALS['phpgw_info']['theme']['th_bg'],
 				'back_url'				=> $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
-				'context_display'		=> $context_display,
-				'lang_context'			=> lang('context'),
-				'header_name'			=> lang('SECTORS'),
-				'lang_add_sub_sectors'	=> lang('Add Sub-Sectors'),
-				'header_edit'			=> lang('Edit'),
-				'lang_back'				=> lang('back'),
-				'header_delete'			=> lang('Delete')
-			);
-			$p->set_var($var);
+				'context_display'		=> $context_display
+			);
+			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 
 			if (!count($sectors_info))
@@ -144,7 +139,4 @@
 		function add_sector($context='')
 		{
-			//_debug_array($_GET);
-			//_debug_array($_POST);
-
 			$manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
 			$acl = $this->functions->read_acl($manager_lid);
@@ -166,4 +158,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_sector' => 'sectors_form.tpl'));
+			$p->set_block('create_sector','list','list');
 
 			// Seta variaveis utilizadas pelo tpl.
@@ -175,14 +168,8 @@
 				'sector'			=> $_POST['sector'],
 				'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '',
-				
-				'lang_add'			=> lang('Add'),
-				'lang_save'			=> lang('Save'),
-				'lang_back'			=> lang('Back'),
-				'lang_context'		=> lang('Context'),
-				'lang_sector_name'	=> lang('Sector name'),
-				'lang_occult_ou'	=> lang('Occult Sector'),
 				'error_messages'	=> $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>",
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 
 			$p->pfp('out','create_sector');
@@ -191,6 +178,4 @@
 		function edit_sector()
 		{
-			//_debug_array($_POST);
-			
 			$account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
 			$acl = $this->functions->read_acl($account_lid);
@@ -215,4 +200,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('edit_sector' => 'sectors_form.tpl'));
+			$p->set_block('edit_sector','list','list');
 			
 			if (!$_POST)
@@ -233,13 +219,9 @@
 				'lang_add'			=> lang('Add'),
 				'disable'			=> 'disabled',
-				'lang_save'			=> lang('Save'),
-				'lang_back'			=> lang('Back'),
-				'lang_context'		=> lang('Context'),
-				'lang_sector_name'	=> lang('Sector name'),
-				'lang_occult_ou'	=> lang('Occult Sector'),
 				'error_messages'	=> $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>",
 			);
 			$p->set_var($var);
-
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
+			
 			$p->pfp('out','edit_sector');
 		}
@@ -247,6 +229,4 @@
 		function validate_data_sectors_add()
 		{
-			//_debug_array($_POST);
-
 			$sector_name	= $_POST['sector'];
 			$context		= $_POST['context'];
@@ -273,6 +253,4 @@
 		function delete_sector()
 		{
-			//_debug_array($_GET);
-			
 			$account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
 			$acl = $this->functions->read_acl($account_lid);
@@ -293,4 +271,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('delete_sector' => 'sectors_delete.tpl'));
+			$p->set_block('delete_sector','list','list');
 			
 			$tmp_sector_name = $_GET['context'];
@@ -305,8 +284,4 @@
 			$sector_subsectors	= $this->so->get_sector_subsectors($_GET['context']);
 			
-			//_debug_array($sector_users);
-			//_debug_array($sector_groups);
-			//_debug_array($sector_subsectors);
-
 			$users_list = '';
 			foreach ($sector_users as $user)
@@ -331,12 +306,4 @@
 			$var = Array(
 				'color_bg1'					=> "#E8F0F0",
-				'lang_back'					=> lang('Back'),
-				'lang_delete'				=> lang('Delete'),
-				'lang_delete_sector'		=> lang('Do you realy want delete this sector?'),
-				'lang_content_the_users'	=> lang('Content the folling users'),
-				'lang_content_the_groups'	=> lang('Content the folling groups'),
-				'lang_content_the_sectors'	=> lang('Content the folling sectors'),
-				'lang_obs'					=> lang('All users, groups and sub-sectors of this sector will be DELETED!'),
-				
 				'manager_context'			=> $manager_context,
 				'dn'						=> $_GET['context'],
@@ -350,4 +317,5 @@
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 			$p->pfp('out','delete_sector');			
 		}
Index: trunk/expressoAdmin1_2/inc/class.socomputers.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.socomputers.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.socomputers.inc.php	(revision 414)
@@ -42,5 +42,4 @@
 			else
 			{
-				echo "Erro na escrita no LDAP, funcao so->write_ldap:" . ldap_error($this->ldap_connection);
 				ldap_close($this->ldap_connection);
 				return false;
@@ -102,4 +101,5 @@
 			$result = ldap_delete($this->ldap_connection, $dn);
 			ldap_close($this->ldap_connection);
+			$this->functions->write_log('deleted computer',$dn);
 			return $result;				
 		}
@@ -109,4 +109,5 @@
 			$result = ldap_rename($this->ldap_connection, $old_dn, $new_rdn, $new_context, true);
 			ldap_close($this->ldap_connection);
+			$this->functions->write_log('rename computer',$old_dn . '->' . $new_rdn);
 			return $result;
 		}
@@ -116,5 +117,5 @@
 			$result = ldap_mod_add($this->ldap_connection, $dn, $ldap_add_attribute);
 			ldap_close($this->ldap_connection);
-			$this->functions->write_log($GLOBALS['phpgw']->accounts->data['account_lid'], 'add attributes in ldap in email list', $dn,'','','');						
+			$this->functions->write_log('added ldap attributes from computer',$dn);						
 			return $result;
 		}
@@ -124,6 +125,5 @@
 			$result = ldap_mod_del($this->ldap_connection, $dn, $ldap_remove_attribute);
 			ldap_close($this->ldap_connection);
-			//Escreve no log
-			$this->functions->write_log($GLOBALS['phpgw']->accounts->data['account_lid'], 'remove attributes in ldap in email list', $dn,'','','');						
+			$this->functions->write_log('removed ldap attributes from computer',$dn);						
 			return $result;
 		}
@@ -133,4 +133,5 @@
 			$result = ldap_mod_replace($this->ldap_connection, $dn, $ldap_replace_attribute);
 			ldap_close($this->ldap_connection);
+			$this->functions->write_log('replace ldap attributes from computer',$dn);
 			return $result;
 		}
Index: trunk/expressoAdmin1_2/inc/class.sosectors.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.sosectors.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.sosectors.inc.php	(revision 414)
@@ -48,6 +48,5 @@
 			if (ldap_add($this->ldap_connection, $dn, $info))
 			{
-				//Escreve no log
-				$this->functions->write_log2($GLOBALS['phpgw']->accounts->data['account_lid'], 'write in ldap', $dn,'','','');
+				$this->db_functions->write_log("write on ldap", "$dn");
 				ldap_close($this->ldap_connection);
 				return true;
@@ -55,5 +54,5 @@
 			else
 			{
-				echo 'Erro na escrita no LDAP, funcao write_ldap';
+				echo lang('Error written in LDAP, function write_ldap');
 				ldap_close($this->ldap_connection);
 				return false;
Index: trunk/expressoAdmin1_2/inc/class.uidomains.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uidomains.inc.php	(revision 317)
+++ trunk/expressoAdmin1_2/inc/class.uidomains.inc.php	(revision 414)
@@ -63,12 +63,8 @@
 			$var = Array(
 				'th_bg'					=> $GLOBALS['phpgw_info']['theme']['th_bg'],
-				'back_url'				=> $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
-				'lang_sambadomainsname'	=> lang('Samba domains name'),
-				'lang_sambaSID'			=> lang('sambaSID'),
-				'lang_add'				=> lang('Add'),
-				'lang_delete'			=> lang('Delete'),				
-				'lang_back'				=> lang('back')
+				'back_url'				=> $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php')
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
 
 			if (!count($sambadomains_info))
@@ -128,4 +124,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_sambadomains' => 'domains_form.tpl'));
+			$p->set_block('create_sambadomains','list','list');
 						
 			// Seta variaveis utilizadas pelo tpl.
@@ -136,12 +133,4 @@
 				'row_off'		=> "#EEEEEE",
 				'color_bg1'		=> "#E8F0F0",
-				
-				'lang_organizations'	=> lang('Organizations'),
-				'lang_name'				=> lang('Samba domain name'),
-				'lang_sid'				=> lang('Samba domain SID'),
-				'lang_add'				=> lang('Add'),
-				'lang_save'				=> lang('Save'),
-				'lang_back'				=> lang('Back'),
-				
 				'organizations'		=> $organizations,
 				'sambadomainname'	=> $_POST['sambadomainname'],
@@ -151,5 +140,6 @@
 			);
 			$p->set_var($var);
-
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
+			
 			$p->pfp('out','create_sambadomains');
 		}
Index: trunk/expressoAdmin1_2/inc/class.group.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.group.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.group.inc.php	(revision 414)
@@ -44,5 +44,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para criar novos grupos.';
+				$return['msg'] = lang('You do not have access to create new groups') . '.';
 				return $return;
 			}
@@ -60,5 +60,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = "Problemas obtendo ID do usuário.\n" . $id['msg'];
+				$return['msg'] = lang('Problems getting  group ID') . ':' . $next_id['msg'];
 				return $return;
 			}
@@ -96,5 +96,5 @@
 					$result = $this->db_functions->add_user2group($id, $uidnumber);
 					
-					$this->db_functions->write_log("Adicionado usuario $uid ao grupo ".$group_info['cn']." no momento da criação",$dn,$uidnumber,'','');
+					$this->db_functions->write_log("Added user to group on user criation", $group_info['cn'] . ": " . $dn);
 				}
 			}
@@ -119,8 +119,10 @@
 				$return['status'] = false;
 				if ($result['error_number'] == '65')
-					$return['msg'] .= "Não foi possível criar este grupo pois os schemas do servidor LDAP estão desatualizados.\n" .
-										"O Administrador deve atualizar o diretório /etc/ldap/schema/ e re-inicializar o ldap.\n".
-										"Uma versão atualizada deste arquivo pode ser encontrada no site:\n" .
+				{
+					$return['msg'] .= lang("It was not possible create the group because the LDAP schemas are not update") . "\n" .
+									  lang("The administrator must update the directory /etc/ldap/schema/ and re-start LDAP") . "\n" .
+									  lang("A update version of this files can be found here") . ":\n" .
 										"www.expressolivre.org -> Downloads -> schema.tgz";
+				}
 				else
 					$return['msg'] .= $result['msg'];
@@ -137,5 +139,5 @@
 			if ($return['status'] == true)
 			{
-				$this->db_functions->write_log("Criado grupo de usuários $dn",'',$dn,'','');
+				$this->db_functions->write_log("Created group",$dn);
 			}
 			
@@ -149,5 +151,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para editar grupos.';
+				$return['msg'] = lang('You do not have access to edit groups') . '.';
 				return $return;
 			}
@@ -181,5 +183,5 @@
 					{
 						$dn = $newrdn . ',' . $newparent;
-						$this->db_functions->write_log('Renomeado grupo de usuários de '.$old_values['cn']." para $dn.",'',$dn,$old_values['cn'],'');
+						$this->db_functions->write_log('Renamed group', $old_values['cn'] . '->' . $dn);
 					}
 				}
@@ -192,5 +194,6 @@
 			{
 				$ldap_mod_replace['sambasid'] = $new_values['sambasid'] . '-' . ((2 * $new_values['gidnumber'])+1001);
-				$this->db_functions->write_log("Alterado dominio samba do grupo $dn para " . $new_values['sambasid'],'',$dn,'','');
+				$this->db_functions->write_log('modified group samba domain', $dn . ': ' . $old_values['sambasid'] . '->' . $new_values['sambasid']);
+				
 			}
 			
@@ -200,5 +203,5 @@
 			{
 				$ldap_mod_replace['description'] = $new_values['description'];
-				$this->db_functions->write_log("Modificado descrição do grupo $dn",'',$dn,'','');
+				$this->db_functions->write_log('modified group description',$dn . ': ' . $old_values['description'] . '->' . $new_values['description'] );
 			}
 
@@ -209,5 +212,5 @@
 			{
 				$ldap_mod_replace['mail'] = $new_values['email'];
-				$this->db_functions->write_log("Modificado E-Mail do grupo $dn",'',$dn,'','');
+				$this->db_functions->write_log('modified group email', $dn . ': ' . $old_values['email'] . '->' . $new_values['email']);
 			}
 
@@ -221,8 +224,10 @@
 					$return['status'] = false;
 					if ($result['error_number'] == '65')
-						$return['msg'] .= "Não foi possível salvar alguns atributos deste grupo pois os schemas do servidor LDAP estão desatualizados.\n" .
-											"O Administrador deve atualizar o diretório /etc/ldap/schema/ e re-inicializar o ldap.\n".
-											"Uma versão atualizada deste arquivo pode ser encontrada no site:\n" .
+					{
+						$return['msg'] .= lang("It was not possible create the group because the LDAP schemas are not update") . "\n" .
+										  lang("The administrator must update the directory /etc/ldap/schema/ and re-start LDAP") . "\n" .
+										  lang("A update version of this files can be found here") . ":\n" .
 											"www.expressolivre.org -> Downloads -> schema.tgz";
+					}
 					else
 						$return['msg'] .= $result['msg'];
@@ -245,5 +250,5 @@
 				}
 				else
-					$this->db_functions->write_log("Removido atributos samba do grupo $dn",'',$dn,'','');
+					$this->db_functions->write_log('removed group samba attributes',$dn);
 			}
 
@@ -252,9 +257,10 @@
 			if (($this->current_config['expressoAdmin_samba_support'] == 'true') && (!$old_values['sambaGroup']) && ($new_values['use_attrs_samba'] == 'on'))
 			{
-				//Verifica se o binario para criar as senhas do samba exite.
 				if (!is_file('/home/expressolivre/mkntpwd'))
 				{
 					$return['status'] = false;
-					$return['msg'] .= "O arquivo binário /home/expressolivre/mkntpwd não exite.\\nEle é necessário para a criação das senhas usadas pelo SAMBA.\\nInforme o administrador ExpressoLivre sobre isto.\\n";
+					$return['msg'] .= lang("The file /home/expressolivre/mkntpwd does not exist") . ".\n";
+					$return['msg'] .= lang("It is necessery to create samba passwords") . ".\n";
+					$return['msg'] .= lang("Inform your system administrator about this") . ".\n";
 				}
 				else
@@ -271,5 +277,5 @@
 					}
 					else
-						$this->db_functions->write_log("Adicionado atributos samba ao grupo $dn",'','','','');
+						$this->db_functions->write_log('Added samba attibutes to group',$dn);
 				}
 			}
@@ -281,5 +287,5 @@
 			{
 				$ldap_add['phpgwaccountvisible'] = '-1';
-				$this->db_functions->write_log("Adicionado atributo phpgwaccountvisible ao grupo $dn",'','','','');
+				$this->db_functions->write_log("added attribute phpgwAccountVisible to group",$dn);
 			}
 			if ((($new_values['email']) && (!$old_values['email'])) &&
@@ -287,5 +293,5 @@
 			{
 				$ldap_add['mail'] = $new_values['email'];
-				$this->db_functions->write_log("Adicionado atributo mail ao grupo $dn",'','','','');
+				$this->db_functions->write_log("added attribute mail to group",$dn);
 			}
 			////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -294,13 +300,14 @@
 			{
 				$result = $this->ldap_functions->add_user_attributes($dn, $ldap_add);
-				
 				if (!$result['status'])
 				{
 					$return['status'] = false;
 					if ($result['error_number'] == '65')
-						$return['msg'] .= "Não foi possível adicionar alguns atributos deste gruupo pois os schemas do servidor LDAP estão desatualizados.\n" .
-											"O Administrador deve atualizar o diretório /etc/ldap/schema/ e re-inicializar o ldap.\n".
-											"Uma versão atualizada deste arquivo pode ser encontrada no site:\n" .
-											"www.expressolivre.org -> Downloads -> schema.tgz";
+					{
+						$return['msg'] .= lang("It was not possible create the group because the LDAP schemas are not update") . "\n" .
+										  lang("The administrator must update the directory /etc/ldap/schema/ and re-start LDAP") . "\n" .
+										  lang("A update version of this files can be found here") . ":\n" .
+											   "www.expressolivre.org -> Downloads -> schema.tgz";
+					}									
 					else
 						$return['msg'] .= $result['msg'];
@@ -314,5 +321,5 @@
 			{
 				$ldap_remove['phpgwaccountvisible'] = array();
-				$this->db_functions->write_log("Removido atributo phpgwaccountvisible do grupo $dn",'','','','');
+				$this->db_functions->write_log("removed attribute phpgwAccountVisible from group",$dn);
 			}
 			if (((!$new_values['email']) && ($old_values['email'])) &&
@@ -320,5 +327,5 @@
 			{
 				$ldap_remove['mail'] = array();
-				$this->db_functions->write_log("Removido atributo mail do grupo $dn",'','','','');
+				$this->db_functions->write_log("removed attribute mail from group",$dn);
 			}
 			////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -355,17 +362,10 @@
 						$user = $this->ldap_functions->uidnumber2uid($uidnumber);
 						$array_memberUids_add[] = $user;
-						$this->db_functions->write_log("Adicionado usuário $user ao grupo $dn.",$dn,'','','');
-					}
-					/*
-					else
-					{
-						// O memberUID existe no grupo, mas o usuário não existe no ldap
-						$this->ldap_functions->remove_user2group($new_values['gidnumber'], $uidnumber);
-					}*/
+						$this->db_functions->write_log("included user to group","$dn: $user");
+					}
 				}
 				if (count($array_memberUids_add) > 0)
 					$this->ldap_functions->add_user2group($new_values['gidnumber'], $array_memberUids_add);
 			}
-
 			if (count($remove_users)>0)
 			{
@@ -378,5 +378,5 @@
 						$user = $this->ldap_functions->uidnumber2uid($uidnumber);
 						$array_memberUids_remove[] = $user;
-						$this->db_functions->write_log("Removido usuário $user do grupo $dn.",$dn,'','','');
+						$this->db_functions->write_log("removed user from group","$dn: $user");
 					}
 				}
@@ -412,5 +412,5 @@
 				
 				foreach ($add_apps as $app => $index)
-					$this->db_functions->write_log("Adicionado aplicativo $app ao grupo $dn",'',$dn,'','');
+					$this->db_functions->write_log("added application to group","$app: $dn");
 			}
 			
@@ -428,5 +428,5 @@
 					
 				foreach ($remove_apps2 as $app => $access)
-					$this->db_functions->write_log("Removido aplicativo $app do grupo $dn",'',$dn,'','');
+					$this->db_functions->write_log("removed application from group","$app: $dn");
 			}
 			//////////////////////////////////////////////////////////////////////////////////////////////////////////////////			
@@ -451,5 +451,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] = 'Você não tem acesso para excluir grupos.';
+				$return['msg'] = lang('You do not have acces to remove groups') . '.';
 				return $return;
 			}
@@ -478,5 +478,5 @@
 			if ($return['status'] == true)
 			{
-				$this->db_functions->write_log("Deletado grupo de usuários $cn",'',$cn,'','');
+				$this->db_functions->write_log("deleted group","$cn");
 			}
 			
Index: trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php	(revision 309)
+++ trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php	(revision 414)
@@ -85,19 +85,9 @@
 				'add_action'				=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.add_maillists'),
 				'add_email_lists_disabled'	=> $this->functions->check_acl($manager_lid,'add_maillists') ? '' : 'disabled',
-				'context_display'			=> $context_display,
-				'lang_email_lists_uid'		=> lang('Email Lists Logins'),
-				'lang_email_lists_names'	=> lang('Email Lists Names'),
-				'lang_add_email_lists'		=> lang('Add Email Lists'),
-				'lang_edit'  				=> lang('Edit'),
-				'lang_scl'  				=> 'SCL',
-				'lang_delete'				=> 'Excluir',
-				'lang_view'					=> lang('View'),
-				'lang_back'					=> lang('back'),
-				'lang_context'				=> lang('context'),
-				'lang_email'				=> lang('E-mail'),
-				'lang_search'				=> lang('search')
+				'context_display'			=> $context_display
 			);
 			$p->set_var($var);
-
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
+			
 			// Save query
 			$p->set_var('query', $GLOBALS['query']);
@@ -196,4 +186,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('create_maillist' => 'maillists_form.tpl'));
+			$p->set_block('create_maillist','body','body');
 
 			// Obtem combos das organizações.
@@ -211,17 +202,4 @@
 				'accountStatus_checked'		=> 'CHECKED',
 				'restrictionsOnEmailLists'	=> $this->current_config['expressoAdmin_restrictionsOnEmailLists'],
-				'lang_back'					=> lang('Back'),
-				'lang_save'					=> lang('save'),
-				'lang_maillist_organization'=> lang('Maillist Organization'),
-				'lang_search_organization'	=> lang('Search Organiztion'),
-				'lang_search_user'			=> lang('Search user'),
-				'lang_organizations'		=> lang('Organizations'),
-				'lang_maillist_uid'			=> lang('Maillist login'),
-				'lang_maillist_mail'		=> lang('Maillist Mail'),
-				'lang_maillist_name'		=> lang('Maillist name'),
-				'lang_maillist_users'		=> lang('Maillist users'),
-				'lang_add_user'				=> lang('Add User'),
-				'lang_rem_user'				=> lang('Remove User'),
-				'lang_all_users'			=> lang('Show users from all sub-organizations'),
 				'back_url'					=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'),
 				'combo_manager_org'			=> $combo_manager_org,
@@ -230,5 +208,5 @@
 			);
 			$p->set_var($var);
-			
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 			$p->pfp('out','create_maillist');
 		}
@@ -259,4 +237,5 @@
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
 			$p->set_file(Array('edit_maillist' => 'maillists_form.tpl'));
+			$p->set_block('edit_maillist','body','body');
 
 			// Obtem combos das organizações.
@@ -313,17 +292,4 @@
 				'type'							=> 'edit_maillist',
 				'ldap_context'					=> $GLOBALS['phpgw_info']['server']['ldap_context'],
-				'lang_back'						=> lang('Back'),
-				'lang_save'						=> lang('save'),
-				'lang_maillist_organization'	=> lang('Maillist Organization'),
-				'lang_search_organization'		=> lang('Search Organiztion'),
-				'lang_search_user'				=> lang('Search user'),
-				'lang_organizations'			=> lang('Organizations'),
-				'lang_maillist_uid'				=> lang('Maillist login'),
-				'lang_maillist_mail'			=> lang('Maillist Mail'),
-				'lang_maillist_name'			=> lang('Maillist name'),
-				'lang_maillist_users'			=> lang('Maillist users'),
-				'lang_add_user'					=> lang('Add User'),
-				'lang_rem_user'					=> lang('Remove User'),
-				'lang_all_users'				=> lang('Select users from all sub-organizations'),
 				'back_url'						=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'),
 				'combo_manager_org'				=> $combo_manager_org,
@@ -340,4 +306,5 @@
 			);
 			$p->set_var($var);
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
 			
 			$p->pfp('out','edit_maillist');
@@ -368,5 +335,6 @@
 			// Set o template
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
-			$p->set_file(Array('sql_maillist' => 'maillists_scl.tpl'));
+			$p->set_file(Array('scl_maillist' => 'maillists_scl.tpl'));
+			$p->set_block('scl_maillist','body','body');
 
 			// Pega combo das organizações e seleciona a org da lista.
@@ -396,14 +364,4 @@
 				'ldap_context'					=> $GLOBALS['phpgw_info']['server']['ldap_context'],
 				'dn'							=> $maillist_info['dn'],
-				'lang_back'						=> lang('Back'),
-				'lang_save'						=> lang('save'),
-				'lang_org'						=> lang('Organizations'),
-				'lang_maillist_uid'				=> lang('Maillist login'),
-				'lang_maillist_mail'			=> lang('Maillist Mail'),
-				'lang_maillist_name'			=> lang('Maillist name'),
-				'lang_maillist_users'			=> lang('Maillist users'),
-				'lang_add_user'					=> lang('Add User'),
-				'lang_rem_user'					=> lang('Remove User'),
-				'lang_all_users'				=> lang('Show users from all sub-organizations'),
 				'back_url'						=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'),
 				'combo_org'						=> $sectors,
@@ -417,6 +375,7 @@
 			);
 			$p->set_var($var);
-			
-			$p->pfp('out','sql_maillist');
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
+			
+			$p->pfp('out','scl_maillist');
 		}
 		
Index: trunk/expressoAdmin1_2/inc/class.uilogs.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uilogs.inc.php	(revision 355)
+++ trunk/expressoAdmin1_2/inc/class.uilogs.inc.php	(revision 414)
@@ -53,5 +53,5 @@
 			if (($_POST['query_manager_lid'] != '') || ($_POST['query_action'] != '') || ($_POST['query_date'] != '') || ($_POST['query_hour'] != '') || ($_POST['query_other'] != ''))
 			{
-				$query = "SELECT manager,date,groupinfo,userinfo,appinfo,msg,action FROM phpgw_expressoadmin_log WHERE"; 
+				$query = "SELECT manager,date,userinfo,action FROM phpgw_expressoadmin_log WHERE"; 
 				
 				if ($_POST['query_manager_lid'] != '')
@@ -86,7 +86,4 @@
 					$query .= " userinfo LIKE '%" . $_POST['query_other'] . "%'";
 					$query .= "OR action LIKE '%" . $_POST['query_other'] . "%'";
-					$query .= "OR groupinfo LIKE '%" . $_POST['query_other'] . "%'";
-					$query .= "OR appinfo LIKE '%" . $_POST['query_other'] . "%'";
-					$query .= "OR msg LIKE '%" . $_POST['query_other'] . "%'";
 					$query .= "OR manager LIKE '%" . $_POST['query_other'] . "%'";
 				}
@@ -112,18 +109,8 @@
 				'query_hour'		=> $_POST['query_hour'],
 				'query_other'		=> $_POST['query_other'],
-				
-				'lang_manager_lid'	=> lang('Manager Login'),
-				'lang_date'			=> lang('Date'),
-				'lang_hour'			=> lang('Hour'),
-				'lang_action'		=> lang('Action'),
-				'lang_view'			=> lang('view'),
-				'lang_back'			=> lang('back'),
-				'lang_search'		=> lang('search'),
-				'lang_action'		=> lang('Action'),
-				'lang_other'		=> lang('Other')
 			);
 			$p->set_var($var);
-			
-			
+			$p->set_var($this->functions->make_dinamic_lang($p, 'list'));
+
 			if ((!count($logs)) && (($_POST['query_manager_lid'] != '') || ($_POST['query_date'] != '') || ($_POST['query_hour'] != '')))
 			{
@@ -145,8 +132,8 @@
 					
 					$var = array(
+						'row_date' 			=> $a_day . '  ' . $a_hour[0],						
 						'row_manager_lid'	=> $log['manager'],
-						'row_action'		=> $log['action'],
-						'row_date' 			=> $a_day . '  ' . $a_hour[0],
-						//'row_view'  => (!$account['account_lastname']?'&nbsp':$account['account_lastname'])
+						'row_action'		=> lang($log['action']),
+						'row_about'			=> $log['userinfo']
 					);
 					$p->set_var($var);
@@ -158,71 +145,5 @@
 			$p->pfp('out','list');
 		}
-		
-		function view_log()
-		{
-			$account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
-			$tmp = $this->functions->read_acl($account_lid);
-			$manager_context = $tmp[0]['context'];
-			
-			// Verifica se o administrador tem acesso.
-			if (!$this->functions->check_acl($account_lid,'view_logs'))
-			{
-				$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
-			}
-						
-			unset($GLOBALS['phpgw_info']['flags']['noheader']);
-			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
-			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('View Log');
-			$GLOBALS['phpgw']->common->phpgw_header();
-
-			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);			
-			$p->set_file(Array('log' => 'log_form.tpl'));
-
-			$query = "SELECT manager,date,groupinfo,userinfo,appinfo,msg,action FROM phpgw_expressoadmin_log"; 
-			$query .= " WHERE date = '".$_GET['date']."'";
 				
-			$GLOBALS['phpgw']->db->query($query);
-			while($GLOBALS['phpgw']->db->next_record())
-			{
-				$log[] = $GLOBALS['phpgw']->db->row();
-			}
-
-			$tmp = explode(" ", $log[0]['date']);
-			$tmp_date = explode("-", $tmp[0]);
-			$date = $tmp_date[2] . '/' . $tmp_date[1] . '/' . $tmp_date[0];
-			
-			$tmp_hour = explode(".", $tmp[1]);
-			$hour = $tmp_hour[0];
-			
-			$var = Array(
-				
-				'manager_lid'		=> $log[0]['manager'],
-				'date'				=> $date,
-				'hour'				=> $hour,
-				'action'			=> $log[0]['action'],
-				'userinfo'			=> $log[0]['userinfo'],
-				'groupinfo'			=> $log[0]['groupinfo'],
-				'appinfo'			=> $log[0]['appinfo'],
-				'back_url'			=> './index.php?menuaction=expressoAdmin1_2.uilogs.list_logs',
-				
-				'color_bg1'			=> "#E8F0F0",
-				'color_bg2'			=> "#D3DCE3",
-				'color_font1'		=> "#DDDDDD",
-				'color_font2'		=> "#EEEEEE",
-				
-				'lang_back'			=> lang('Back'),
-				'lang_manager_lid'	=> lang('Manager Login'),
-				'lang_date'			=> lang('Date'),
-				'lang_hour'			=> lang('Hour'),
-				'lang_action'		=> lang('Action'),
-				'lang_userinfo'		=> lang('User Info'),
-				'lang_groupinfo'	=> lang('Group Info'),
-				'lang_appinfo'		=> lang('App Info')				
-			);
-			
-			$p->set_var($var);
-			$p->pfp('out','log');
-		}
-		
 		function row_action($action,$type,$date)
 		{
Index: trunk/expressoAdmin1_2/inc/class.bosectors.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.bosectors.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.bosectors.inc.php	(revision 414)
@@ -63,5 +63,5 @@
 			
 			//Escreve no log
-			$this->functions->write_log2("Setor criado: $dn", '','','',$dn);
+			$this->db_functions->write_log("created sector", "$dn");
 			
 			// Volta para o ListSectors
Index: trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php	(revision 317)
+++ trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php	(revision 414)
@@ -34,44 +34,8 @@
 				$GLOBALS['phpgw']->js->validate_file('jscode','institutional_accounts','expressoAdmin1_2');
 				$GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2');
-				
-				/*
-				Move this to expressoAdmin.index.
-				$_SESSION['phpgw_info']['expressoAdmin']['user']['preferences']['common']['lang'] = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
-				
-				$fn = './expressoAdmin1_2/setup/phpgw_'.$_SESSION['phpgw_info']['expressoAdmin']['user']['preferences']['common']['lang'].'.lang';
-				if (file_exists($fn)){
-					$fp = fopen($fn,'r');
-					while ($data = fgets($fp,16000)){
-						list($message_id,$app_name,$null,$content) = explode("\t",substr($data,0,-1));
-						$_SESSION['phpgw_info']['expressoAdmin']['lang'][$message_id] =  $content;
-					}
-					fclose($fp);
-				}*/
+				$GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
 			}
 		}
 
-		function make_lang($ram_lang)
-		{
-			$a_lang = split("_", $ram_lang);
-			$a_lang_reverse  = array_reverse ( $a_lang, true );
-			array_pop ( $a_lang_reverse );
-			$a_lang  = array_reverse ( $a_lang_reverse, true );
-			$a_new_lang = implode ( " ", $a_lang );
-			return lang($a_new_lang);
-		}
-
-		function make_dinamic_lang($template_obj, $block)
-		{
-			$tpl_vars = $template_obj->get_undefined($block);
-			foreach ($tpl_vars as $atribute)
-			{
-				$lang = strstr($atribute, 'lang_');
-				if($lang !== false)
-				{
-					$template_obj->set_var($atribute, $this->make_lang($atribute));
-				}
-			}
-		}
-		
 		function index()
 		{
@@ -105,6 +69,6 @@
 			
 			/* dinamic load lang */
-			$this->make_dinamic_lang($p, 'body');
-			$this->make_dinamic_lang($p, 'institutional_accounts_modal');
+			$p->set_var($this->functions->make_dinamic_lang($p, 'body'));
+			$p->set_var($this->functions->make_dinamic_lang($p, 'institutional_accounts_modal'));
 
 
Index: trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 414)
@@ -123,5 +123,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Falha na conexao com o ldap.';
+				$result['msg'] = $this->functions->lang('Connection with ldap fail') . ".";
 				return $result;
 			}
@@ -148,5 +148,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Este LOGIN não pode ser usado pois é uma conta de sistema.';
+			$result['msg'] = $this->functions->lang('This LOGIN can not be used because is a System Account') . ".";
 			return $result;
 		}
@@ -197,5 +197,5 @@
 				
 				$result['status'] = false;
-				$result['msg'] = "LOGIN já está sendo utilizado por:\n" . $users;
+				$this->functions->lang('This LOGIN is already used by') . ":\n" . $users;
 				return $result;
 			}
@@ -209,5 +209,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'LOGIN do usuário já esta sendo usado por um grupo.';
+				$result['msg'] = $this->functions->lang('This LOGIN is being used by a group') . ".";
 				return $result;
 			}
@@ -255,5 +255,5 @@
 					{
 						$result['status'] = false;
-						$result['msg'] = 'LOGIN já esta sendo usado por outro usuário em outra organização.';
+						$result['msg'] = $this->functions->lang('This LOGIN is already used by a user in another organization') . ".";
 						ldap_close($ldap_connection2);
 						return $result;
@@ -277,6 +277,5 @@
 			if ($entries[0]['uid'][0] != $uid){
 				$result['status'] = false;
-				$result['msg'] = 'E-MAIL está sendo usado por 1 usuário: ' . $entries[0]['uid'][0];
-				//ldap_close($ldap_connection);
+				$result['msg'] = $this->functions->lang('Email is being used by 1 user') . ": " . $entries[0]['uid'][0];
 				return $result;
 			}
@@ -284,6 +283,5 @@
 		else if ($entries['count'] > 1){
 			$result['status'] = false;
-			$result['msg'] = 'E-MAIL está sendo usado por 2 ou mais usuários.';
-			//ldap_close($ldap_connection);
+			$result['msg'] = $this->functions->lang('Email is being used by 2 or more users') . ".";
 			return $result;
 		}
@@ -297,6 +295,5 @@
 			if ($entries[0]['uid'][0] != $uid){
 				$result['status'] = false;
-				$result['msg'] = "E-MAIL alternativo está sendo usado por 1 usuário: " . $entries[0]['uid'][0];
-				//ldap_close($ldap_connection);
+				$result['msg'] = $this->functions->lang('Alternative email is being used by 1 user') . ": " . $entries[0]['uid'][0];
 				return $result;
 			}
@@ -304,5 +301,5 @@
 		else if ($entries['count'] > 1){
 			$result['status'] = false;
-			$result['msg'] = 'E-MAIL alternativo está sendo usado por 2 ou mais usuários.';
+			$result['msg'] = $this->functions->lang('Alternative email is being used by 2 or more users') . ".";
 			return $result;
 		}
@@ -334,5 +331,5 @@
 					{
 						$result['status'] = false;
-						$result['msg'] = 'Falha na conexao com o ldap.';
+						$result['msg'] = $this->functions->lang('Connection with ldap fail') . ".";
 						return $result;
 					}
@@ -389,5 +386,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Falha na conexao com o ldap.';
+				$result['msg'] = $this->functions->lang('Connection with ldap fail') . ".";
 				return $result;
 			}
@@ -408,5 +405,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Este nome de grupo não pode ser usado pois é um grupo de sistema.';
+			$result['msg'] = $this->functions->lang('This group name can not be used because is a System Account') . ".";
 			return $result;
 		}
@@ -420,5 +417,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'NOME do grupo já está sendo usado.';
+			$result['msg'] = $this->functions->lang('This name is already used') . ".";
 			return $result;
 		}
@@ -432,5 +429,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'NOME do grupo já esta sendo usado por um usuário.';
+			$result['msg'] = $this->functions->lang('This grupo name is already used by an user') . ".";
 			return $result;
 		}
@@ -456,5 +453,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = 'Falha na conexao com o ldap.';
+				$result['msg'] = $this->functions->lang('Connection with ldap fail') . ".";
 				return $result;
 			}
@@ -476,5 +473,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'Este LOGIN não pode ser usado pois é uma conta de sistema.';
+			$result['msg'] = $this->functions->lang('This LOGIN can not be used because is a System Account') . ".";
 			return $result;
 		}
@@ -488,5 +485,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'LOGIN da lista já está sendo usado.';
+			$result['msg'] = $this->functions->lang('This email list LOGIN is already used') . ".";
 			return $result;
 		}
@@ -500,5 +497,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = 'E-MAIL da lista já está sendo usado.';
+			$result['msg'] = $this->functions->lang('EMAIL is already used') . ".";
 			return $result;
 		}
@@ -543,43 +540,4 @@
     	return $options;
 	}
-
-	//Busca usuários de um contexto e já retorna as options do select;
-	/*
-	function get_available_users_and_maillist($params)
-	{
-		$context = $params['context'];
-		$recursive = $params['recursive'];
-		$justthese = array("cn", "uidNumber");
-		$filter="(|(phpgwAccountType=u)(phpgwAccountType=l))";
-		
-		if ($recursive == 'true')
-			$groups_list=ldap_search($this->ldap, $context, $filter, $justthese);
-		else
-    		$groups_list=ldap_list($this->ldap, $context, $filter, $justthese);
-    	
-    	$entries = ldap_get_entries($this->ldap, $groups_list);
-    	
-		for ($i=0; $i<$entries["count"]; $i++){
-			$u_tmp[$entries[$i]["uidnumber"][0]] = $entries[$i]["cn"][0];
-		}
-			
-		if (count($u_tmp))
-			natcasesort($u_tmp);
-
-		$i = 0;
-		$users = array();
-			
-		if (count($u_tmp))
-		{
-			foreach ($u_tmp as $uidnumber => $cn)
-			{
-				$options .= "<option value=$uidnumber>$cn</option>";
-			}
-			unset($u_tmp);
-		}
-
-    	return $options;
-	}
-	*/
 
 	//Busca usuários e listas de um contexto e já retorna as options do select;
@@ -722,5 +680,5 @@
 			$result['status']		= false;
 			$result['error_number']	= ldap_errno($this->ldap);
-			$result['msg']			= "Erro na funcao ldap_functions->ldap_add_entry ($dn).\nRetorno do servidor:" . ldap_errno($this->ldap) . ldap_error($this->ldap);
+			$result['msg']			= $this->functions->lang('Error on function') . " ldap_functions->ldap_add_entry ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_errno($this->ldap) . ldap_error($this->ldap);
 		}
 		else
@@ -750,5 +708,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->ldap_save_photo ($dn).\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->ldap_save_photo ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		
@@ -768,5 +726,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->ldap_remove_photo ($dn).\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->ldap_remove_photo ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		
@@ -793,5 +751,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->add_user2group ($memberUid).\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2group ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		return $result;
@@ -808,8 +766,4 @@
 		$res = @ldap_mod_del($this->ldap, $group_dn, $attrs);
 		
-		/*echo 'usuarios recebidos para remocao no ldap';
-		echo '<pre>';
-		print_r($memberUid);*/
-		
 		if ($res)
 		{
@@ -819,5 +773,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->remove_user2group ($memberUid).\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2group ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		return $result;
@@ -829,5 +783,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Falha de conexão com o openLDAP.\n\nRetorno do servidor:" . ldap_error($ldapMasterConnect);
+			$result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 			return $result;
 		}
@@ -850,11 +804,11 @@
 			if (ldap_errno($ldapMasterConnect) == '50')
 			{
-				$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist.\n" .
-								 "O usuário utilizado para gravação no LDAP, DEVE ter direito de escrita.\n".
-								 "O usuário " . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . " não tem este direito.\n".
-								 "Edite \"Configuração Global do Catálogo\", no módulo Administrador, Catálogo de Endereços e adicione um usuário com direitos de escrita.";
+				$result['msg'] =	$this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" .
+									$this->functions->lang('The user used for record on LPDA, must have write access') . ".\n";
+									$this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n";
+									$this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n";
 			}					 
 			else
-				$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist.\nRetorno do servidor:" . ldap_error($ldapMasterConnect);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 		}
 		
@@ -878,5 +832,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist_scp ($dn).\n\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist_scp ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		return $result;
@@ -888,5 +842,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Falha de conexão com o openLDAP.\n\nRetorno do servidor:" . ldap_error($ldapMasterConnect);
+			$result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 			return $result;
 		}
@@ -909,11 +863,14 @@
 			if (ldap_errno($ldapMasterConnect) == '50')
 			{
-				$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist.\n" .
-								 "O usuário utilizado para gravação no LDAP, DEVE ter direito de escrita.\n".
-								 "O usuário " . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . " não tem este direito.\n".
-								 "Edite \"Configuração Global do Catálogo\", no módulo Administrador, Catálogo de Endereços e adicione um usuário com direitos de escrita.";
+				
+				$return['msg'] = $this->functions->lang('You do not have right to create institutional accounts') . ".";
+
+				$result['msg'] =	$this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" .
+									$this->functions->lang('The user used for record on LPDA, must have write access') . ".\n";
+									$this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n";
+									$this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n";
 			}					 
 			else
-				$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist.\nRetorno do servidor:" . ldap_error($ldapMasterConnect);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 		}
 		ldap_close($ldapMasterConnect);
@@ -933,5 +890,5 @@
 		{
 			$result['status'] = false;
-			$result['msg'] = "Erro na funcao ldap_functions->remove_user2maillist_scp ($dn).\n\nRetorno do servidor:" . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist_scp ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		return $result;
@@ -955,5 +912,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = "Erro na funcao ldap_functions->replace_user2maillists ($old_mail).\nRetorno do servidor:" . ldap_error($this->ldap);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->replace_user2maillists ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 			}
 		}
@@ -1025,4 +982,5 @@
 					$result['corporative_information_rg']			= $entry[0]['rg'][0];
 					$result['corporative_information_rguf']			= $entry[0]['rguf'][0];
+					$result['corporative_information_description']	= utf8_decode($entry[0]['description'][0]);
 				}
 				
@@ -1379,5 +1337,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] = 'Erro em ldap_funcitons->change_user_context: ' . ldap_error($this->ldap);
+			$return['msg'] = $this->functions->lang('Error on function') . " ldap_functions->change_user_context ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		else
@@ -1393,9 +1351,10 @@
 			$return['status'] = false;
 			$return['error_number'] = ldap_errno($this->ldap);
-			$return['msg'] = 'Erro em ldap_funcitons->replace_user_attributes: ' . ldap_error($this->ldap);
+			$return['msg'] = $this->functions->lang('Error on function') . " ldap_functions->replace_user_attributes ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		else
 			$return['status'] = true;
 		
+		print_r($return);
 		return $return;
 	}
@@ -1407,5 +1366,5 @@
 			$return['status'] = false;
 			$return['error_number'] = ldap_errno($this->ldap);
-			$return['msg'] = 'Erro em ldap_funcitons->add_user_attributes: ' . ldap_error($this->ldap);
+			$return['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user_attributes ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		else
@@ -1420,5 +1379,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] = 'Erro em ldap_funcitons->remove_user_attributes: ' . ldap_error($this->ldap);
+			$return['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user_attributes ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		else
@@ -1456,5 +1415,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] .= 'Você não tem acesso para deletar este usuário.';
+			$result['msg'] = $this->functions->lang('You do not have access to delete this user') . ".";
 			return $return;
 		}
@@ -1481,5 +1440,5 @@
 				{
 					$return['status'] = false;
-					$return['msg'] .= "Erro em ldap_functions->delete_user from group ($dn): " . ldap_error($this->ldap);
+					$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_user from group ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 				}
 			}
@@ -1500,5 +1459,5 @@
 			{
 				$result['status'] = false;
-				$result['msg'] = "Erro na funcao ldap_functions->delete_user, instutional_accounts.\nRetorno do servidor:" . ldap_error($this->ldap);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_user, institutional accounts ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 			}
 		}
@@ -1514,5 +1473,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] .= 'Erro ao conectar ao ldap_master: ' . ldap_error($this->ldap);
+				$result['msg'] = $this->functions->lang('Connection with ldap_master fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 				return $return;
 			}
@@ -1532,11 +1491,11 @@
 					if (ldap_errno($ldapMasterConnect) == '50')
 					{
-						$result['msg'] = "Erro na funcao ldap_functions->delete_user.\n" .
-										 "O usuário utilizado para gravação no LDAP, DEVE ter direito de escrita.\n".
-										 "O usuário " . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . " não tem este direito.\n".
-								 		 "Edite \"Configuração Global do Catálogo\", no módulo Administrador, Catálogo de Endereços e adicione um usuário com direitos de escrita.";
+						$result['msg'] =	$this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" .
+											$this->functions->lang('The user used for record on LPDA, must have write access') . ".\n";
+											$this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n";
+											$this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n";
 					}
 					else
-						$result['msg'] = "Erro na funcao ldap_functions->add_user2maillist.\nRetorno do servidor:" . ldap_error($ldapMasterConnect);
+						$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_user, email lists ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 				}
 			}
@@ -1549,5 +1508,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] .= 'Erro em ldap_funcitons->delete_user, listas de email: ' . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_user, email lists ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);
 		}
 		
@@ -1580,5 +1539,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] .= 'Erro em ldap_funcitons->delete_maillist, listas de email: ' . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		
@@ -1599,5 +1558,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] .= 'Erro em ldap_funcitons->delete_maillist, listas de email: ' . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_group ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		
@@ -1660,5 +1619,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] .= 'Erro em ldap_funcitons->rename_uid: ' . ldap_error($this->ldap);
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->rename_uid ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		
@@ -1797,5 +1756,5 @@
 		{
 			$return['status'] = false;
-			$return['msg'] = "Erro ao adicionar Samba Domain";
+			$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_sambadomain ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 		}
 		else
@@ -1819,5 +1778,5 @@
 			{
 				$return['status'] = false;
-				$return['msg'] .= "Erro em ldap_funcitons->delete_sambadomain ($sambadomainname).\nRetorno do servidor: " . ldap_error($this->ldap);
+				$result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->delete_sambadomain ($sambadomainname)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap);
 			}
 	    }
@@ -1835,5 +1794,5 @@
     	{
     		$return['status'] = 'false';
-    		$return['msg'] = 'Nenhum resultado encontrado.';
+    		$result['msg'] = $this->functions->lang('Any result was found') . '.';
     		return $return;
     	}
@@ -2018,5 +1977,5 @@
 			{
 				$result['status'] = false;
-				$result['msg']  = $this->functions->lang('Error in function') . ' ldap_functions->save_institutional_accounts: ldap_rename';
+				$result['msg']  = $this->functions->lang('Error on function') . ' ldap_functions->save_institutional_accounts: ldap_rename';
 				$result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap);
 			}
@@ -2054,5 +2013,5 @@
 		{
 			$result['status'] = false;
-			$result['msg']  = $this->functions->lang('Error in function') . ' ldap_functions->save_institutional_accounts: ldap_modify';
+			$result['msg']  = $this->functions->lang('Error on function') . ' ldap_functions->save_institutional_accounts: ldap_modify';
 			$result['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap);
 		}
@@ -2119,5 +2078,5 @@
 		{
 			$return['status'] = 'false';
-			$return['msg'] = 'Problemas carregando dados.';
+			$result['msg'] = $this->functions->lang('Problems loading datas') . '.';
 		}
 		else
@@ -2202,5 +2161,5 @@
 		{
 			$return['status'] = false;
-			$return['msg']  = $this->functions->lang('Error in function') . " ldap_functions->delete_institutional_accounts: ldap_delete";
+			$return['msg']  = $this->functions->lang('Error on function') . " ldap_functions->delete_institutional_accounts: ldap_delete";
 			$return['msg'] .= "\n" . $this->functions->lang('Server return') . ': ' . ldap_error($this->ldap);
 			return $return;
@@ -2227,5 +2186,5 @@
 			{
 				$result['status'] = false;
-				$return['msg']  = $this->functions->lang('Error in function') . " ldap_functions->replace_mail_from_institutional_account.";
+				$return['msg']  = $this->functions->lang('Error on function') . " ldap_functions->replace_mail_from_institutional_account.";
 			}
 		}
Index: trunk/expressoAdmin1_2/inc/class.functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 396)
+++ trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 414)
@@ -735,12 +735,4 @@
 		}
 
-		function write_log2($action, $groupinfo='', $userinfo='', $appinfo='', $msg_log='')
-		{
-			$sql = "INSERT INTO phpgw_expressoadmin_log (date, manager, action, groupinfo, userinfo, appinfo, msg) "
-			. "VALUES('now','" . $_SESSION['phpgw_info']['expresso']['user']['account_lid'] . "','" . strtolower($action) . "','" . strtolower($groupinfo) . "','" . strtolower($userinfo) . "','" . strtolower($appinfo) . "','" .strtolower($msg_log) . "')";
-			$GLOBALS['phpgw']->db->query($sql);
-			return;
-		}
-		
 		function lang($key)
 		{
@@ -802,4 +794,31 @@
 			/* Retorna verdadeiro se o cpf eh valido */
 			return true;
+		}
+		
+		function make_lang($ram_lang)
+		{
+			$a_lang = split("_", $ram_lang);
+			$a_lang_reverse  = array_reverse ( $a_lang, true );
+			array_pop ( $a_lang_reverse );
+			$a_lang  = array_reverse ( $a_lang_reverse, true );
+			$a_new_lang = implode ( " ", $a_lang );
+			return lang($a_new_lang);
+		}
+
+		function make_dinamic_lang($template_obj, $block)
+		{
+			$tpl_vars = $template_obj->get_undefined($block);
+			$array_langs = array();
+			
+			foreach ($tpl_vars as $atribute)
+			{
+				$lang = strstr($atribute, 'lang_');
+				if($lang !== false)
+				{
+					//$template_obj->set_var($atribute, $this->make_lang($atribute));
+					$array_langs[$atribute] = $this->make_lang($atribute);
+				}
+			}
+			return $array_langs;
 		}
 	}
@@ -821,3 +840,3 @@
 			$this->sector_leaf = $sector_leaf;
 		}
-	}
+	}	
Index: trunk/expressoAdmin1_2/inc/class.totalsessions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.totalsessions.inc.php	(revision 309)
+++ trunk/expressoAdmin1_2/inc/class.totalsessions.inc.php	(revision 414)
@@ -1,12 +1,12 @@
 <?php
-	/**************************************************************************\
-	* Expresso Administração                 										                                 *
+	/*************************************************************************************\
+	* Expresso Administração                 						           			 *
 	* by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br)  	 *
-	* -----------------------------------------------------------------------------------------------------*
-	*  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.																						 *
-	\**************************************************************************/
+	* -----------------------------------------------------------------------------------*
+	*  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 totalsessions
@@ -42,9 +42,9 @@
 			$this->template->set_file('template','totalsessions.tpl');
 			$this->template->set_block('template','list','list');
+			
+			$this->template->set_var($this->functions->make_dinamic_lang($this->template, 'list'));
 
 			$total = $this->get_total_sessions();
 			
-			$this->template->set_var('lang_total', lang('totalsessions'));
-			$this->template->set_var('lang_back', lang('back'));
 			$this->template->set_var('back_url', $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'));
 			$this->template->set_var('total', $total);
