Index: trunk/expressoAdmin1_2/docs/change_log.txt
===================================================================
--- trunk/expressoAdmin1_2/docs/change_log.txt	(revision 62)
+++ trunk/expressoAdmin1_2/docs/change_log.txt	(revision 63)
@@ -87,2 +87,6 @@
 - Corrigido bug ao adicionar email em grupos
 - Corrigido bug ao adicionar atributos samba a um usuários já existente.
+
+14/08/2007
+- Criado aba Informações Corporativas, com os campo employeeNumber, cpf, rg, rgUf
+- Melhorado classe user.inc.php.
Index: trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 63)
@@ -242,4 +242,5 @@
 				'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'),
@@ -274,4 +275,11 @@
 				'ldap_context'					=> ldap_dn2ufn($GLOBALS['phpgw_info']['server']['ldap_context']),
 				
+				// 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'),
@@ -305,4 +313,5 @@
 				
 				//SAMBA ABA
+				'display_samba_suport'				=> $this->functions->check_acl($manager_lid,'edit_sambausers_attributes') ? '' : 'none',
 				'lang_samba_config'					=> lang('Samba Config'),
 				'lang_use_attrs_samba'				=> lang('Use samba attributes'),
@@ -536,4 +545,5 @@
 				'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'),
@@ -572,5 +582,16 @@
 				'phpgwaccountvisible_checked'	=> $user_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '',
 
-				//MAIL BORD
+				// Corporative Information
+				'display_corporative_information'=> $this->functions->check_acl($manager_account_lid,'edit_sambausers_attributes') ? '' : 'none',
+				'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'],
+				
+				//MAIL
 				'disabled_quota_used'			=> 'disabled',
 				'lang_activeemailaccount'		=> lang('Active email account'),
Index: trunk/expressoAdmin1_2/inc/class.user.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.user.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.user.inc.php	(revision 63)
@@ -117,32 +117,54 @@
 				if (($this->current_config['expressoAdmin_samba_support'] == 'true') && ($params['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.";
-					}
-					else
-					{
-						$user_info['objectClass'][] 		= 'sambaSamAccount';
-						$user_info['loginShell']			= '/bin/bash';
-
-						$user_info['sambaSID']				= $params['sambadomain'] . '-' . ((2 * $id)+1000);
-						$user_info['sambaPrimaryGroupSID']	= $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001);
-
-						$user_info['sambaAcctFlags']		= $params['sambaacctflags'];
-			
-						$user_info['sambaLogonScript']		= $params['sambalogonscript'];
-						$user_info['homeDirectory']			= $params['sambahomedirectory'];
-			
-						$user_info['sambaLMPassword']		= exec('/home/expressolivre/mkntpwd -L '.$params['password1']);
-						$user_info['sambaNTPassword']		= exec('/home/expressolivre/mkntpwd -N '.$params['password1']);
-						$user_info['sambaPasswordHistory']	= '0000000000000000000000000000000000000000000000000000000000000000';
-			
-						$user_info['sambaPwdCanChange']		= strtotime("now");
-						$user_info['sambaPwdLastSet']		= strtotime("now");
-						$user_info['sambaPwdMustChange']	= '2147483647';
-					}
-				}
+					// Verifica o acesso do gerente aos atributos samba
+					if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes'))
+					{
+						//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.";
+						}
+						else
+						{
+							$user_info['objectClass'][] 		= 'sambaSamAccount';
+							$user_info['loginShell']			= '/bin/bash';
+	
+							$user_info['sambaSID']				= $params['sambadomain'] . '-' . ((2 * $id)+1000);
+							$user_info['sambaPrimaryGroupSID']	= $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001);
+
+							$user_info['sambaAcctFlags']		= $params['sambaacctflags'];
+			
+							$user_info['sambaLogonScript']		= $params['sambalogonscript'];
+							$user_info['homeDirectory']			= $params['sambahomedirectory'];
+			
+							$user_info['sambaLMPassword']		= exec('/home/expressolivre/mkntpwd -L '.$params['password1']);
+							$user_info['sambaNTPassword']		= exec('/home/expressolivre/mkntpwd -N '.$params['password1']);
+							$user_info['sambaPasswordHistory']	= '0000000000000000000000000000000000000000000000000000000000000000';
+			
+							$user_info['sambaPwdCanChange']		= strtotime("now");
+							$user_info['sambaPwdLastSet']		= strtotime("now");
+							$user_info['sambaPwdMustChange']	= '2147483647';
+						}
+					}
+				}
+				
+				// Verifica o acesso do gerente aos atributos corporativos
+				if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information'))
+				{
+					foreach ($params as $atribute=>$value)
+					{
+						$pos = strrpos($atribute, 'corporative_information_');
+						if ($pos !== false)
+						{
+							if ($params[$atribute])
+							{
+								$ldap_atribute = str_replace("corporative_information_", "", $atribute);
+								$user_info[$ldap_atribute] = $params[$atribute];
+							}
+						}
+					}
+				}
+				
 				$result = $this->ldap_functions->ldap_add_entry($dn, $user_info);
 				if (!$result['status'])
@@ -239,7 +261,7 @@
 			$old_values = $this->get_user_info($new_values['uidnumber'], $new_values['manager_context']);
 			$dn = 'uid=' . $old_values['uid'] . ',' . strtolower($old_values['context']);
-			
+
 			$diff = array_diff($new_values, $old_values);
-			
+
 			$manager_account_lid = $_SESSION['phpgw_session']['session_lid'];
 			if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) &&
@@ -254,10 +276,4 @@
 
 			// Verifica o acesso do gerente
-			if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users'))
-			{
-				
-			}
-			
-			// Verifica o acesso do gerente
 			if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users'))
 			{
@@ -293,5 +309,5 @@
 					$ldap_mod_replace['sn'] = $new_values['sn'];
 					$ldap_mod_replace['cn'] = $new_values['givenname'] . ' ' . $new_values['sn'];
-					$this->db_functions->write_log("alterado sn do usuario",'',$dn,'','');
+					$this->db_functions->write_log("altera$ldap_mod_do sn do usuario",'',$dn,'','');
 				}
 				if ($diff['mail'])
@@ -349,5 +365,38 @@
 				}
 			}
-
+			
+			// REPLACE, ADD & REMOVE COPORATIVEs ATRIBUTES
+			// Verifica o acesso do gerente aos atributos corporativos
+			if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information'))
+			{
+				foreach ($new_values as $atribute=>$value)
+				{
+					$pos = strrpos($atribute, 'corporative_information_');
+					if ($pos !== false)
+					{
+						$ldap_atribute = str_replace("corporative_information_", "", $atribute);
+						// REPLACE ATTRS OF CORPORATIVE
+						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,'','');
+						}
+						//ADD ATTRS OF CORPORATIVE
+						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,'','');
+						}
+						//REMOVE ATTRS OF CORPORATIVE
+						elseif (($old_values[$atribute] != '') && ($new_values[$atribute] == ''))
+						{
+							$ldap_remove[$ldap_atribute] = array();
+							$this->db_functions->write_log("removido $ldap_atribute do usuario",'',$dn,'','');	
+						}
+					}
+				}
+			}
+			
 			//Suporte ao SAMBA
 			if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) || 
@@ -512,5 +561,5 @@
 				}
 			}
-			
+
 			if ( ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users')) || 
 			     ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_sambausers_attributes')) )
@@ -640,5 +689,4 @@
 			if (count($ldap_remove))
 			{
-				
 				$result = $this->ldap_functions->remove_user_attributes($dn, $ldap_remove);
 				if (!$result['status'])
@@ -727,5 +775,4 @@
 			return $return;
 		}		
-		
 		
 		function get_user_info($uidnumber, $context)
@@ -1076,4 +1123,10 @@
 			}
 		}
+		
+		function write_log_from_ajax($params)
+		{
+			$this->db_functions->write_log($params['_action'],'',$params['userinfo'],'','');
+			return true;
+		}
 	}
 ?>
Index: trunk/expressoAdmin1_2/inc/class.bomanagers.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.bomanagers.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.bomanagers.inc.php	(revision 63)
@@ -30,4 +30,5 @@
 			'lid'						=> $_POST['manager_lid'],
 			'context'					=> $_POST['context'],
+			
 			'add_users'					=> $_POST['add_users'],
 			'edit_users'				=> $_POST['edit_users'],
@@ -35,4 +36,5 @@
 			'rename_users'				=> $_POST['rename_users'],
 			'view_users'				=> $_POST['view_users'],
+			'manipulate_corporative_information' => $_POST['manipulate_corporative_information'],
 			'add_groups'				=> $_POST['add_groups'],
 			'edit_groups'				=> $_POST['edit_groups'],
@@ -42,4 +44,5 @@
 			'change_users_quote'		=> $_POST['change_users_quote'],
 			'set_user_default_password'	=> $_POST['set_user_default_password'],
+			'empty_user_inbox'			=> $_POST['empty_user_inbox'],
 			'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'],
 			'edit_sambadomains'			=> $_POST['edit_sambadomains'],
@@ -54,5 +57,6 @@
 			'create_computers'			=> $_POST['create_computers'],
 			'edit_computers'			=> $_POST['edit_computers'],
-			'delete_computers'			=> $_POST['delete_computers'],			
+			'delete_computers'			=> $_POST['delete_computers'],
+					
 			'apps'						=> $_POST['applications_list']
 			);
@@ -60,7 +64,7 @@
 			// Soma os niveis de acesso criando uma ACL
 			$acl = 0;
-			$acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'];
+			$acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information'];
 			$acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups'];
-			$acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'];
+			$acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox'];
 			$acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains'];
 			$acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists'];
@@ -102,4 +106,5 @@
 			'lid'						=> $_POST['manager_lid'],
 			'context'					=> $_POST['context'],
+			
 			'add_users'					=> $_POST['add_users'],
 			'edit_users'				=> $_POST['edit_users'],
@@ -107,4 +112,5 @@
 			'rename_users'				=> $_POST['rename_users'],
 			'view_users'				=> $_POST['view_users'],
+			'manipulate_corporative_information' => $_POST['manipulate_corporative_information'],
 			'add_groups'				=> $_POST['add_groups'],
 			'edit_groups'				=> $_POST['edit_groups'],
@@ -114,4 +120,5 @@
 			'change_users_quote'		=> $_POST['change_users_quote'],
 			'set_user_default_password'	=> $_POST['set_user_default_password'],
+			'empty_user_inbox'			=> $_POST['empty_user_inbox'],
 			'edit_sambausers_attributes'=> $_POST['edit_sambausers_attributes'],
 			'edit_sambadomains'			=> $_POST['edit_sambadomains'],
@@ -127,4 +134,5 @@
 			'edit_computers'			=> $_POST['edit_computers'],
 			'delete_computers'			=> $_POST['delete_computers'],
+			
 			'apps'						=> $_POST['applications_list']
 			);
@@ -132,7 +140,7 @@
 			// Soma os niveis de acesso criando uma ACL
 			$acl = 0;
-			$acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'];
+			$acl = $acl + $manager['add_users'] + $manager['edit_users'] + $manager['delete_users'] + $manager['rename_users'] + $manager['view_users'] + $manager['manipulate_corporative_information'];
 			$acl = $acl + $manager['add_groups'] + $manager['edit_groups'] + $manager['delete_groups'] + $manager['edit_email_groups'];
-			$acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'];
+			$acl = $acl + $manager['change_users_password'] + $manager['change_users_quote'] + $manager['set_user_default_password'] + $manager['empty_user_inbox'];
 			$acl = $acl + $manager['edit_sambausers_attributes'] + $manager['edit_sambadomains'];
 			$acl = $acl + $manager['add_email_lists'] + $manager['edit_email_lists'] + $manager['delete_email_lists'];
Index: trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 63)
@@ -1,6 +1,9 @@
 <?php
+
+include_once('class.functions.inc.php');
 
 class imap_functions
 {
+	var $functions;
 	var $imap;
 	var $imapDelimiter;
@@ -17,4 +20,5 @@
 		$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);
+		$this->functions	= new functions;
 	}
 	
@@ -72,6 +76,6 @@
 		else
 		{
-			$quota['mailquota'] = ($get_quota['limit'] / 1024);
-			$quota['mailquota_used'] = ($get_quota['usage'] / 1024);
+			$quota['mailquota'] = round (($get_quota['limit'] / 1024), 2);
+			$quota['mailquota_used'] = round (($get_quota['usage'] / 1024), 2);
 		}
 			
@@ -116,3 +120,62 @@
 		return $result;
 	}
+	
+	function empty_inbox($params)
+	{
+		// Verifica o acesso do gerente
+		if (!$this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'empty_user_inbox'))
+		{
+			$result['status'] = false;
+			$result['msg'] = 'Você não tem acesso para executar esta operação.';
+			return $result;
+		}
+		
+		if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
+		{
+			$imap_options = '/tls/novalidate-cert';
+		}
+		else
+		{
+			$imap_options = '/notls/novalidate-cert';
+		}
+
+		
+		$result['status'] = true;
+		$uid = $params['uid'];
+		
+		$return_setacl = imap_setacl($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, 'lrswipcda');
+		
+		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);
+			
+			$check = imap_mailboxmsginfo($mbox_stream);
+			$inbox_size = (string)(round ((($check->Size)/(1024*1024)), 2));
+			
+			$return_imap_delete = imap_delete($mbox_stream,'1:*');
+			imap_close($mbox_stream, CL_EXPUNGE);
+			
+			imap_setacl ($this->imap, "user" . $this->imapDelimiter . $uid, $this->imap_admin, '');
+			
+			if ($return_imap_delete)
+			{
+				$result['inbox_size'] = $inbox_size;
+				
+				$get_user_quota = @imap_get_quotaroot($this->imap,"user" . $this->imapDelimiter . $uid);
+				$result['mailquota_used'] = (string)(round(($get_user_quota['usage']/1024), 2));
+			}
+			else
+			{
+				$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();
+		}
+		return $result;
+	}
 }
Index: trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php	(revision 63)
@@ -207,4 +207,5 @@
 				'lang_rename_user'				=> lang('Rename users'),
 				'lang_view_user'				=> lang('View users'),
+				'lang_manipulate_corporative_information' => lang('Manipulate corporative information'),
 				'lang_add_groups'				=> lang('Add groups'),
 				'lang_edit_groups'				=> lang('Edit groups'),
@@ -214,4 +215,5 @@
 				'lang_change_users_quote'		=> lang('Change users quote'),
 				'lang_set_user_default_password'=> lang('Set default users password'),
+				'lang_empty_user_inbox'			=> lang('Empty user inbox'),
 				'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'),
 				'lang_edit_sambadomains'		=> lang('Edit SAMBA domains'),
@@ -233,4 +235,6 @@
 				'add_users' 					=> $_POST['add_users'] != '' ? 'checked' : '',
 				'edit_users'					=> $_POST['edit_users'] != '' ? 'checked' : '',
+				'view_users' 					=> $_POST['view_users'] != '' ? 'checked' : '',
+				'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '',
 				'delete_users' 					=> $_POST['delete_users'] != '' ? 'checked' : '',
 				'add_groups' 					=> $_POST['add_groups'] != '' ? 'checked' : '',
@@ -335,4 +339,5 @@
 				$_POST['rename_users'] 			= $acl['rename_users'];
 				$_POST['view_users'] 			= $acl['view_users'];
+				$_POST['manipulate_corporative_information'] = $acl['manipulate_corporative_information'];
 				$_POST['add_groups']			= $acl['add_groups'];
 				$_POST['edit_groups']			= $acl['edit_groups'];
@@ -342,4 +347,5 @@
 				$_POST['change_users_quote']	= $acl['change_users_quote'];
 				$_POST['set_user_default_password']	= $acl['set_user_default_password'];
+				$_POST['empty_user_inbox']		= $acl['empty_user_inbox'];
 				$_POST['edit_sambausers_attributes'] = $acl['edit_sambausers_attributes'];
 				$_POST['edit_sambadomains'] 	= $acl['edit_sambadomains'];
@@ -453,4 +459,5 @@
 				'lang_rename_user'				=> lang('Rename users'),
 				'lang_view_user'				=> lang('View users'),
+				'lang_manipulate_corporative_information' => lang('Manipulate corporative information'),
 				'lang_add_groups'				=> lang('Add groups'),
 				'lang_edit_groups'				=> lang('Edit groups'),
@@ -460,4 +467,5 @@
 				'lang_change_users_quote'		=> lang('Change users quote'),
 				'lang_set_user_default_password'=> lang('Set default user password'),
+				'lang_empty_user_inbox'			=> lang('Empty user inbox'),
 				'lang_edit_sambausers_attributes'=> lang('Edit SAMBA users attributes'),
 				'lang_edit_sambadomains'		=> lang('Edit SAMBA domains'),
@@ -483,4 +491,5 @@
 				'rename_users' 					=> $_POST['rename_users'] != '' ? 'checked' : '',
 				'view_users' 					=> $_POST['view_users'] != '' ? 'checked' : '',
+				'manipulate_corporative_information' => $_POST['manipulate_corporative_information'] != '' ? 'checked' : '',
 				'add_groups' 					=> $_POST['add_groups'] != '' ? 'checked' : '',
 				'edit_groups'					=> $_POST['edit_groups'] != '' ? 'checked' : '',
@@ -490,4 +499,5 @@
 				'change_users_quote'			=> $_POST['change_users_quote'] != '' ? 'checked' : '',
 				'set_user_default_password'		=> $_POST['set_user_default_password'] != '' ? 'checked' : '',
+				'empty_user_inbox'				=> $_POST['empty_user_inbox'] != '' ? 'checked' : '',
 				'edit_sambausers_attributes'	=> $_POST['edit_sambausers_attributes'] != '' ? 'checked' : '',
 				'edit_sambadomains'				=> $_POST['edit_sambadomains'] != '' ? 'checked' : '',
Index: trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 63)
@@ -3,4 +3,5 @@
 define('PHPGW_API_INC','../phpgwapi/inc');	
 include_once(PHPGW_API_INC.'/class.common.inc.php');
+include_once('class.functions.inc.php');
 
 class ldap_functions
@@ -8,4 +9,5 @@
 	var $ldap;
 	var $current_config;
+	var $functions;
 	
 	function ldap_functions(){
@@ -14,8 +16,10 @@
 		$common = new common();
 		$this->ldap = $common->ldapConnect();
+		$this->functions = new functions;
 	}
 	
 	function validate_fields($params)
 	{
+		$result['status'] = true;
 		$params = unserialize($params['attributes']);
 		$type = $params['type'];
@@ -24,7 +28,5 @@
 		$mail = $params['mail'];
 		$mailalternateaddress = $params['mailalternateaddress'];
-
-		$result['status'] = true;
-		
+				
 		if ($_SESSION['phpgw_info']['expresso']['global_denied_users'][$uid])
 		{
@@ -657,4 +659,13 @@
 			array_pop($a_tmp);
 			$result['sambasid'] = implode("-", $a_tmp);
+		}
+
+		// Verifica o acesso do gerente aos atributos corporativos
+		if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'manipulate_corporative_information'))
+		{
+			$result['corporative_information_employeenumber']= $entry[0]['employeenumber'][0];
+			$result['corporative_information_cpf']			= $entry[0]['cpf'][0];
+			$result['corporative_information_rg']			= $entry[0]['rg'][0];
+			$result['corporative_information_rguf']			= $entry[0]['rguf'][0];
 		}
 		
Index: trunk/expressoAdmin1_2/inc/class.functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 62)
+++ trunk/expressoAdmin1_2/inc/class.functions.inc.php	(revision 63)
@@ -66,4 +66,8 @@
 						return true;
 					break;
+				case manipulate_corporative_information:
+					if ($array_acl[manipulate_corporative_information])
+						return true;
+					break;
 				case change_users_password:
 					if ($array_acl[change_users_password])
@@ -76,4 +80,8 @@
 				case set_user_default_password:
 					if ($array_acl[set_user_default_password])
+						return true;
+					break;
+				case empty_user_inbox:
+					if (($array_acl[empty_user_inbox]) && ($array_acl[edit_users]))
 						return true;
 					break;
@@ -186,5 +194,5 @@
 		
 		// Make a array read humam
-		// Last acl:	33.554.432, 67.108.864
+		// Last acl:	33.554.432, 67.108.864, 134.217.728, 134.217.728, 268.435.456
 		function make_array_acl($acl)
 		{
@@ -194,4 +202,5 @@
 			$array_acl['rename_users'] = $acl & 8388608;
 			$array_acl['view_users'] = $acl & 33554432;
+			$array_acl['manipulate_corporative_information'] = $acl & 268435456;
 			$array_acl['add_groups'] = $acl & 16;
 			$array_acl['edit_groups'] = $acl & 32;
@@ -201,4 +210,5 @@
 			$array_acl['change_users_quote'] = $acl & 262144;
 			$array_acl['set_user_default_password'] = $acl & 524288;
+			$array_acl['empty_user_inbox'] = $acl & 134217728;
 			$array_acl['edit_sambausers_attributes'] = $acl & 32768;
 			$array_acl['edit_sambadomains'] = $acl & 16777216;
Index: trunk/expressoAdmin1_2/js/jscode/users.js
===================================================================
--- trunk/expressoAdmin1_2/js/jscode/users.js	(revision 62)
+++ trunk/expressoAdmin1_2/js/jscode/users.js	(revision 63)
@@ -41,5 +41,37 @@
 		return;
 	}
-
+	
+	// Corporative Information
+	if (document.forms[0].corporative_information_employeenumber.value != "")
+	{
+		var re_employeenumber = /^([0-9])+$/;
+		
+		if(!re_employeenumber.test(document.forms[0].corporative_information_employeenumber.value))
+		{
+			alert('Campo matrícula contém caracteres não permitidos. Somente números são permitidos.');
+			document.forms[0].corporative_information_employeenumber.focus();
+			return;
+		}
+	}
+
+	if (document.forms[0].corporative_information_cpf.value != "")
+	{
+		var re_cpf = /^([0-9])+$/;
+
+		if(!re_cpf.test(document.forms[0].corporative_information_cpf.value))
+		{
+			alert('Campo cpf contém caracteres não permitidos. Somente números são permitidos');
+			document.forms[0].corporative_information_employeenumber.focus();
+			return;
+		}
+	
+		if (! validarCPF(document.forms[0].corporative_information_cpf.value) )
+		{
+			alert("Campo CPF invalido.");
+			document.forms[0].corporative_information_cpf.focus();
+			return;
+		}
+	}
+	
 	//MAIL
 	document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase();
@@ -606,2 +638,51 @@
 	}
 }
+
+function empty_inbox(uid)
+{
+	var action = "Limpado INBOX do usuario";
+	var handler_write_log = function(){}
+	var handler_empty_inbox = function(data)
+	{
+		if (!data.status)
+			alert(data.msg);
+		else{
+			cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log);
+			alert("Esvaziados '" + data.inbox_size + "' MB da caixa postal do usuário");
+			document.getElementById('mailquota_used').value = data.mailquota_used;
+		}
+	}
+	cExecute ('$this.imap_functions.empty_inbox&uid='+uid, handler_empty_inbox);
+}
+
+function validarCPF(cpf)
+{
+	if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" ||
+		cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" ||
+		cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" ||
+		cpf == "88888888888" || cpf == "99999999999"){
+	  return false;
+   }
+
+	soma = 0;
+	for(i = 0; i < 9; i++)
+		soma += parseInt(cpf.charAt(i)) * (10 - i);
+	resto = 11 - (soma % 11);
+	if(resto == 10 || resto == 11)
+		resto = 0;
+	if(resto != parseInt(cpf.charAt(9)))
+	{
+		return false;
+	}
+	
+	soma = 0;
+	for(i = 0; i < 10; i ++)
+		soma += parseInt(cpf.charAt(i)) * (11 - i);
+	resto = 11 - (soma % 11);
+	if(resto == 10 || resto == 11)
+		resto = 0;
+	if(resto != parseInt(cpf.charAt(10))){
+		return false;
+	}
+	return true;
+}
Index: trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
===================================================================
--- trunk/expressoAdmin1_2/templates/default/accounts_form.tpl	(revision 62)
+++ trunk/expressoAdmin1_2/templates/default/accounts_form.tpl	(revision 63)
@@ -2,5 +2,5 @@
 
 <script type="text/javascript">
-var tab = new Tabs(6,'activetab','inactivetab','tab','tabcontent','','','tabpage');
+var tab = new Tabs(7,'activetab','inactivetab','tab','tabcontent','','','tabpage');
 function initAll()
 {
@@ -28,9 +28,10 @@
 	<tr>
 		<th id="tab1" class="activetab" onclick="javascript:tab.display(1);"><a href="#" tabindex="0" accesskey="1" onfocus="tab.display(1);" onclick="tab.display(1); return(false);">{lang_general_information}</a></th>
-		<th id="tab2" class="activetab" onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);">{lang_email_config}</a></th>
-		<th id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_groups_permission}</a></th>
-		<th id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_lists_permission}</a></th>
-		<th id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_aplication_permission}</a></th>
-		<th style="{display_samba_suport}" id="tab6" class="activetab" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_samba_config}</a></th>
+		<th id="tab2" class="activetab" style="display:{display_corporative_information}"onclick="javascript:tab.display(2);"><a href="#" tabindex="0" accesskey="2" onfocus="tab.display(2);" onclick="tab.display(2); return(false);">{lang_corporative_information}</a></th>
+		<th id="tab3" class="activetab" onclick="javascript:tab.display(3);"><a href="#" tabindex="0" accesskey="3" onfocus="tab.display(3);" onclick="tab.display(3); return(false);">{lang_email_config}</a></th>
+		<th id="tab4" class="activetab" onclick="javascript:tab.display(4);"><a href="#" tabindex="0" accesskey="4" onfocus="tab.display(4);" onclick="tab.display(4); return(false);">{lang_groups_permission}</a></th>
+		<th id="tab5" class="activetab" onclick="javascript:tab.display(5);"><a href="#" tabindex="0" accesskey="5" onfocus="tab.display(5);" onclick="tab.display(5); return(false);">{lang_lists_permission}</a></th>
+		<th id="tab6" class="activetab" onclick="javascript:tab.display(6);"><a href="#" tabindex="0" accesskey="6" onfocus="tab.display(6);" onclick="tab.display(6); return(false);">{lang_aplication_permission}</a></th>
+		<th id="tab7" class="activetab" style="display:{display_samba_suport}" onclick="javascript:tab.display(7);"><a href="#" tabindex="0" accesskey="7" onfocus="tab.display(7);" onclick="tab.display(7); return(false);">{lang_samba_config}</a></th>
 	</tr>
 </table>
@@ -111,6 +112,28 @@
 </div>
 
+<!-- The code for Corporative Information -->
+<div id="tabcontent2" class="inactivetab">
+	<table width="60%" border="0" cellspacing="4" cellpading="0">
+		<tr bgcolor={row_on}>
+			<td>{lang_employeenumber}:</td>
+			<td><input type="text" name="corporative_information_employeenumber" autocomplete="off" value="{corporative_information_employeenumber}" size="30"></td>
+		</tr>
+		<tr bgcolor={row_off}>
+			<td>{lang_cpf}:</td>
+			<td><input type="text" name="corporative_information_cpf" autocomplete="off" value="{corporative_information_cpf}" size="30"></td>
+		</tr>
+		<tr bgcolor={row_on}>
+			<td>{lang_rg}:</td>
+			<td><input type="text" name="corporative_information_rg" autocomplete="off" value="{corporative_information_rg}" size="30"></td>
+		</tr>
+		<tr bgcolor={row_off}>
+			<td>{lang_rguf}:</td>
+			<td><input type="text" name="corporative_information_rguf" autocomplete="off" value="{corporative_information_rguf}" size="30"></td>
+		</tr>
+	</table>
+</div>
+
 <!-- The code for Email Config -->
-<div id="tabcontent2" class="inactivetab">
+<div id="tabcontent3" class="inactivetab">
 	<table width="60%" border="0" cellspacing="4" cellpading="0">
 		<tr bgcolor={row_off}>
@@ -146,12 +169,16 @@
 		<tr bgcolor={row_off}>
 			<td>{lang_email_quota_used}:</td>
-			<td><input type="text" name="mailquota_used" value="{mailquota_used}" disabled size=10></td>
-		</tr>
-				
+			<td><input type="text" name="mailquota_used" id="mailquota_used" value="{mailquota_used}" disabled size=10></td>
+		</tr>
+
+		<tr bgcolor={row_on}>
+			<td><input type='button' {disabled} {disabled_empty_inbox} value='Limpar INBOX do usuário' onclick="javascript:empty_inbox(uid.value);"></td>
+		</tr>
+
 	</table>
 </div>
 
 <!-- The code for Group -->
-<div id="tabcontent3" class="inactivetab">
+<div id="tabcontent4" class="inactivetab">
 	<table width="60%" border="0" cellspacing="4" cellpading="0">
 		<tr bgcolor={row_on}>
@@ -213,5 +240,5 @@
 
 <!-- The code for lists Email -->
-<div id="tabcontent4" class="inactivetab">
+<div id="tabcontent5" class="inactivetab">
 	<table width="60%" border="0" cellspacing="4" cellpading="0">
 		<tr bgcolor={row_on}>
@@ -265,5 +292,5 @@
 
 <!-- The code for Apps Tab -->
-<div id="tabcontent5" class="inactivetab">
+<div id="tabcontent6" class="inactivetab">
 	<table id="ea_table_apps" width="80%" border="0" cellspacing="2" cellpading="0">
 		{apps}
@@ -272,5 +299,6 @@
 
 <!-- The code for SAMBA -->
-<div id="tabcontent6" class="inactivetab" style="{display_samba_suport}">
+<!--<div id="tabcontent7" class="inactivetab" style="{display_samba_suport}">-->
+<div id="tabcontent7" class="inactivetab">
 	<table width="60%" border="0" cellspacing="4" cellpading="0">
 		<tr bgcolor={row_on}>
Index: trunk/expressoAdmin1_2/templates/default/managers_form.tpl
===================================================================
--- trunk/expressoAdmin1_2/templates/default/managers_form.tpl	(revision 62)
+++ trunk/expressoAdmin1_2/templates/default/managers_form.tpl	(revision 63)
@@ -76,4 +76,8 @@
 						</tr>
 						<tr bgcolor="{color_font1}" align='right'>
+							<td>{lang_manipulate_corporative_information}:</td>
+							<td><input type="checkbox" name="manipulate_corporative_information" value="268435456" {manipulate_corporative_information}></td>
+						</tr>
+						<tr bgcolor="{color_font1}" align='right'>
 							<td>{lang_view_user}:</td>
 							<td><input type="checkbox" name="view_users" value="33554432" {view_users}></td>
@@ -90,4 +94,8 @@
 							<td>{lang_set_user_default_password}:</td>
 							<td><input type="checkbox" name="set_user_default_password" value="524288" {set_user_default_password}></td>
+						</tr>
+						<tr bgcolor="{color_font1}" align='right'>
+							<td>{lang_empty_user_inbox}:</td>
+							<td><input type="checkbox" name="empty_user_inbox" value="134217728" {empty_user_inbox}></td>
 						</tr>
 						
