Index: /branches/2.4/expressoAdmin1_2/js/jscode/shared_accounts.js
===================================================================
--- /branches/2.4/expressoAdmin1_2/js/jscode/shared_accounts.js	(revision 6096)
+++ /branches/2.4/expressoAdmin1_2/js/jscode/shared_accounts.js	(revision 6884)
@@ -173,5 +173,4 @@
 	Element('em_input_writeAcl').checked = false;
 	Element('em_input_sendAcl').checked = false;
-	Element('em_input_saveAcl').checked = false;
 	Element('em_input_folderAcl').checked = false;
                 
@@ -339,5 +338,4 @@
 		Element('em_input_writeAcl').disabled = true;
 		Element('em_input_sendAcl').disabled = true;
-		Element('em_input_saveAcl').disabled = true;
 		Element('em_input_folderAcl').disabled = true;
 	    }
@@ -625,6 +623,4 @@
     Element('em_input_writeAcl').checked = false;
     Element('em_input_sendAcl').checked = false;
-    Element('em_input_saveAcl').checked = false;
-    Element('em_input_saveAcl').disabled = true;
     Element('em_input_folderAcl').checked = false;
     Element('em_input_readCalendar').checked = false;
@@ -707,5 +703,8 @@
     if(this.ownersAcl[user])
     {
-	if ( this.ownersAcl[user].indexOf('lrs',0) >= 0)
+	if ( (this.ownersAcl[user].indexOf('l',0) >= 0) && 
+ 	         (this.ownersAcl[user].indexOf('r',0) >= 0) && 
+ 	         (this.ownersAcl[user].indexOf('s',0) >= 0)  
+ 	    )
 	{
 	    Element('em_input_sendAcl').disabled = false;
@@ -715,29 +714,30 @@
 	    Element('em_input_sendAcl').disabled = true;
 			
-	if ( this.ownersAcl[user].indexOf('d',0) >= 0)
+	if ( (this.ownersAcl[user].indexOf('t',0) >= 0) && 
+ 	         (this.ownersAcl[user].indexOf('e',0) >= 0)  
+ 	    ) 
 	{
 	    Element('em_input_deleteAcl').checked = true;
 	}
-	if ( this.ownersAcl[user].indexOf('wi',0) >= 0)
+	if ( (this.ownersAcl[user].indexOf('w',0) >= 0) && 
+ 	         (this.ownersAcl[user].indexOf('i',0) >= 0)  
+ 	   ) 
 	{
 	    Element('em_input_writeAcl').checked = true;
 	}		
-	if (this.ownersAcl[user].indexOf('a',0) >= 0)
+	if ((this.ownersAcl[user].indexOf('p',0) >= 0) && 
+ 	        (this.ownersAcl[user].indexOf('a',0) >= 0) )
 	{
 	    Element('em_input_sendAcl').disabled = false;
 	    Element('em_input_sendAcl').checked = true;
 	}
-	if ( this.ownersAcl[user].indexOf('p',0) >= 0)
-	{
-	    Element('em_input_saveAcl').disabled = false;
-	    Element('em_input_saveAcl').checked = true;
-	}
-	if ( this.ownersAcl[user].indexOf('c',0) >= 0)
+	if ( (this.ownersAcl[user].indexOf('k',0) >= 0) && 
+ 	         (this.ownersAcl[user].indexOf('x',0) >= 0)  
+       ) 
 	{
 	    Element('em_input_folderAcl').checked = true;
 	}
-	if( Element('em_input_writeAcl').checked && Element('em_input_sendAcl').checked ){
-	    Element('em_input_saveAcl').disabled = false;
-	} else Element('em_input_saveAcl').disabled = true;
+	
+
     }
 }
@@ -771,5 +771,5 @@
 				
 	if (Element('em_input_deleteAcl').checked)
-	    acl += 'd';
+	    acl += 'te';
 
 	if (Element('em_input_writeAcl').checked)
@@ -777,17 +777,9 @@
 
 	if (Element('em_input_sendAcl').checked)
-	    acl += 'a';
+	    acl += 'pa';
 		
 	if (Element('em_input_folderAcl').checked)
-	    acl += 'c';
+	    acl += 'kx';
 				
-	if (Element('em_input_sendAcl').checked && Element('em_input_writeAcl').checked){
-	    Element('em_input_saveAcl').disabled = false;				
-	} else {
-	    Element('em_input_saveAcl').disabled = true;
-	    Element('em_input_saveAcl').checked = false;
-	}
-	if (Element('em_input_saveAcl').checked)
-	    acl += 'p';
                         
 	this.ownersAcl[user] = acl;		
@@ -980,5 +972,4 @@
     Element('em_input_writeAcl').checked = false;
     Element('em_input_sendAcl').checked = false;
-    Element('em_input_saveAcl').checked = false;
     Element('em_input_folderAcl').checked = false;
                 
Index: /branches/2.4/expressoAdmin1_2/js/jscode/messages_size.js
===================================================================
--- /branches/2.4/expressoAdmin1_2/js/jscode/messages_size.js	(revision 5144)
+++ /branches/2.4/expressoAdmin1_2/js/jscode/messages_size.js	(revision 6884)
@@ -586,69 +586,73 @@
 	{
 	
-		//Element('em_input_readAcl').checked = false;
-		//Element('em_input_deleteAcl').checked = false;
-		//Element('em_input_writeAcl').checked = false;
-		//Element('em_input_sendAcl').checked = false;
-		//Element('em_input_saveAcl').checked = false;
-		//Element('em_input_saveAcl').disabled = true;
-		//Element('em_input_folderAcl').checked = false;
 		
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('lrs',0) >= 0)
-		{
-			Element('em_input_sendAcl').disabled = false;
-			Element('em_input_readAcl').checked = true;
+		if ( (this.ownersAcl[user].indexOf('l',0) >= 0) && 
+                 (this.ownersAcl[user].indexOf('r',0) >= 0) && 
+                 (this.ownersAcl[user].indexOf('s',0) >= 0)  
+            ) 
+        { 
+            Element('em_input_sendAcl').disabled = false; 
+            Element('em_input_readAcl').checked = true; 
 		}
 		else
-			Element('em_input_sendAcl').disabled = true;
+			Element('em_input_sendAcl').disabled = true; 
+ 		                                 
+        if ( (this.ownersAcl[user].indexOf('t',0) >= 0) && 
+                 (this.ownersAcl[user].indexOf('e',0) >= 0)  
+           ) 
+        { 
+            Element('em_input_deleteAcl').checked = true; 
+        } 
+        if ( (this.ownersAcl[user].indexOf('w',0) >= 0) && 
+                 (this.ownersAcl[user].indexOf('i',0) >= 0)  
+           ) 
+        { 
+            Element('em_input_writeAcl').checked = true; 
+        }                
+        if ((this.ownersAcl[user].indexOf('p',0) >= 0) && 
+                (this.ownersAcl[user].indexOf('a',0) >= 0) ) 
+        { 
+            Element('em_input_sendAcl').disabled = false; 
+            Element('em_input_sendAcl').checked = true; 
+        } 
+
+        if ( (this.ownersAcl[user].indexOf('k',0) >= 0) && 
+                 (this.ownersAcl[user].indexOf('x',0) >= 0)  
+           ) 
+        { 
+            Element('em_input_folderAcl').checked = true; 
+        } 
+
+} 
+ 
+cShareMailbox.prototype.setaclfromuser = function() 
+{ 
+    var acl             = ''; 
+    var select  = Element('ea_select_owners'); 
+
+    if(select.selectedIndex == "-1"){ 
+        alert("Selecione antes um usuario!"); 
+        return false; 
+    } 
+                 
+    for(var k = 0; k < select.options.length; k ++ ) 
+    { 
+        if(select.options[k].selected !== true ) continue; 
+                     
+                     
+        acl = ''; 
+        var user = select.options[k].value; 
 			
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('d',0) >= 0)
-		{
-			Element('em_input_deleteAcl').checked = true;
-		}
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('wi',0) >= 0)
-		{
-			Element('em_input_writeAcl').checked = true;
-		}		
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('a',0) >= 0)
-		{
-			Element('em_input_sendAcl').disabled = false;
-			Element('em_input_sendAcl').checked = true;
-		}
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('p',0) >= 0)
-		{
-			Element('em_input_saveAcl').disabled = false;
-			Element('em_input_saveAcl').checked = true;
-		}
-		if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('c',0) >= 0)
-		{
-			Element('em_input_folderAcl').checked = true;
-		}
-		if( this.ownersAcl[user] != "false" && Element('em_input_writeAcl').checked && Element('em_input_sendAcl').checked ){
-			Element('em_input_saveAcl').disabled = false;
-		} else Element('em_input_saveAcl').disabled = true;
-	}
-	
-	cShareMailbox.prototype.setaclfromuser = function()
-	{
-		var acl		= '';
-		var select 	= Element('ea_select_owners');
-
-		if(select.selectedIndex == "-1"){
-			alert("Selecione antes um usuario!");
-			return false;
-		}
-		var user = select.options[select.selectedIndex].value;
-		
 		if (Element('em_input_readAcl').checked) {
-			Element('em_input_sendAcl').disabled = false;
-			acl = 'lrs';
+			Element('em_input_sendAcl').disabled = false; 
+ 	        acl = 'lrsa'; 
 		}
 		else{
-			Element('em_input_sendAcl').disabled = true;
-			Element('em_input_sendAcl').checked = false;
-		}
+			Element('em_input_sendAcl').disabled = true; 
+ 	        Element('em_input_sendAcl').checked = false; 
+ 	    } 
 				
 		if (Element('em_input_deleteAcl').checked)
-			acl += 'd';
+			acl += 'te'; 
 
 		if (Element('em_input_writeAcl').checked)
@@ -656,18 +660,12 @@
 
 		if (Element('em_input_sendAcl').checked)
-			acl += 'a';
+			acl += 'p'; 
 		
 		if (Element('em_input_folderAcl').checked)
-			acl += 'c';
-				
-		if (Element('em_input_sendAcl').checked && Element('em_input_writeAcl').checked){
-			Element('em_input_saveAcl').disabled = false;				
-		} else {
-			Element('em_input_saveAcl').disabled = true;
-			Element('em_input_saveAcl').checked = false;
-		}
-		if (Element('em_input_saveAcl').checked)
-			acl += 'p';
+			acl += 'kx';
+
+
 		this.ownersAcl[user] = acl;		
+		}
 	}
 		
@@ -730,5 +728,4 @@
 		Element('em_input_writeAcl').checked = false;
 		Element('em_input_sendAcl').checked = false;
-		Element('em_input_saveAcl').checked = false;
 		Element('em_input_folderAcl').checked = false;
 	}
Index: /branches/2.4/expressoAdmin1_2/templates/default/shared_accounts_modal.tpl
===================================================================
--- /branches/2.4/expressoAdmin1_2/templates/default/shared_accounts_modal.tpl	(revision 6157)
+++ /branches/2.4/expressoAdmin1_2/templates/default/shared_accounts_modal.tpl	(revision 6884)
@@ -95,5 +95,4 @@
                         <tr><td>{lang_creation}:</td><td><input id="em_input_writeAcl" onclick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="{lang_this_user_will_can_create/add_messages}." src="./expressoAdmin1_2/templates/default/images/ajuda.jpg"></td></tr>
                         <tr><td>{lang_send}:</td><td><input disabled="disabled" id="em_input_sendAcl" onclick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="{lang_this_user_will_can_send_messages}." src="./expressoAdmin1_2/templates/default/images/ajuda.jpg"></td></tr>
-                        <tr><td>{lang_save}:</td><td><input disabled="disabled" id="em_input_saveAcl" onclick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="{lang_this_user_will_save_the_sent_messages_on_this_mailbox}." src="./expressoAdmin1_2/templates/default/images/ajuda.jpg"></td></tr>
                         <tr><td>{lang_folder}:</td><td><input id="em_input_folderAcl" onclick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="{lang_allow_create_or_delete_folders_on_this_mailbox}." src="./expressoAdmin1_2/templates/default/images/ajuda.jpg"></td></tr>
                         </tbody></table>
Index: /branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6873)
+++ /branches/2.4/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6884)
@@ -4361,5 +4361,5 @@
 	{
 		$return = array();
-		$mbox_stream = $this->open_mbox();
+		$mbox_stream = $this->open_mbox('INBOX');
 		
 		if( $decode )
@@ -4369,13 +4369,10 @@
 		//Afim de tratar as pastas compartilhadas, verificandos as permissoes de operacao sobre as mesmas
 		//No caso de se tratar da caixa do proprio usuario logado, utiliza a sintaxe abaixo
-		if(substr($user,0,4) != 'user')
-		$mbox_acl = imap_getacl($mbox_stream, 'user'.$this->imap_delimiter.$user);
+		if(substr($user,0,5) != 'user'.$this->imap_delimiter) 
+ 	            $mbox_acl = imap_getacl($mbox_stream, 'user'.$this->imap_delimiter.$user); 
 		else
-		  $mbox_acl = @imap_getacl($mbox_stream, $user);
-		
-                if(isset($mbox_acl[$this->username]))
-		return $mbox_acl[$this->username];
-                else 
-                    return '';
+		  $mbox_acl = imap_getacl($mbox_stream, $user); 
+ 	                
+ 	    return (isset($mbox_acl[$this->username])) ? $mbox_acl[$this->username] : '';
 	}
 
Index: /branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php
===================================================================
--- /branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 6870)
+++ /branches/2.4/expressoMail1_2/inc/class.ldap_functions.inc.php	(revision 6884)
@@ -893,29 +893,25 @@
 	function getSharedUsersFrom($params){
 		$filter = '';
-		//Added to save if must save sent messages in shared folder
-		$acl_save_sent_in_shared = array();
-		
-		$acls = $this->imap->getacl();
-
-		if($params['uids']) {
-			$uids = explode(";",$params['uids']);
-			$this->imap = new imap_functions();			
-			foreach($uids as $index => $uid){		
-			
-				$params = array();
-				//Added to save if user has create permission 
-				$acl_create_message = array();
-				$user_arr = array();
-				$user_arr['user'] = $uid;
-				$user_arr['getShared'] = true;
-				
-				if(isset($acls[$uid])){ 
- 	                    if ( preg_match("/[pa]+/",$acls[$uid]['acls'])){	
-						$filter .= "(uid=$uid)";							
-						$acl_save_sent_in_shared[] =$uid;			
-					}	
-				}
-			}			
-		}
+		$i = 0;          
+        //Added to save if must save sent messages in shared folder 
+        $acl_save_sent_in_shared = array(); 
+        
+        if($params['uids']) { 
+                $uids = explode(";",$params['uids']); 
+                $this->imap = new imap_functions();                      
+                foreach($uids as $index => $uid){ 
+                        $params = array(); 
+                        //Added to save if user has create permission 
+                        $acl_create_message = array(); 
+                        $acl = $this->imap->getacltouser($uid ,true); 
+   
+                        if ( preg_match("/p/",$acl )){                          
+                            $filter .= "(uid=$uid)";                                                     
+                            $acl_save_sent_in_shared[ $i ] =$uid; 
+                            $i++; 
+                                                                        
+                        }                                                        
+                }                        
+        }
 		
 		$this->ldapRootConnect(false);
@@ -952,12 +948,14 @@
 				$result = ldap_get_entries($this->ds, $sr);
 				for ($j = 0;$j < $result["count"]; $j++){
-					$info[$i]['cn'][0] = utf8_decode($result[$j]['cn'][0]);
-					$info[$i]['mail'][0] = $result[$j]['mail'][0];
-					$info[$i]['save_shared'][0] = 'n';
-					$info[$i++]['uid'][0] = $result[$j]['uid'][0];					
+					$result[$j]['cn'][0] = utf8_decode($result[$j]['cn'][0]); 
+                    $result[$j]['mail'][0] = $result[$j]['mail'][0]; 
+                    $result[$j]['save_shared'][0] = 'n'; 
+                    $info[$info['count']] = $result[$j]; 
+                    $info['count'] = (int)$info['count'] + 1; 					
 				}
 			}
 
 			$_SESSION['phpgw_info']['expressomail']['user']['shared_mailboxes'] = $info;
+			
 			return $info;
 		}
Index: /branches/2.4/expressoMail1_2/js/sharemailbox.js
===================================================================
--- /branches/2.4/expressoMail1_2/js/sharemailbox.js	(revision 6859)
+++ /branches/2.4/expressoMail1_2/js/sharemailbox.js	(revision 6884)
@@ -46,4 +46,5 @@
             (this.users[user].acls.indexOf('r',0) >= 0) && 
             (this.users[user].acls.indexOf('s',0) >= 0) ) 
+
     { 
             Element('em_input_sendAcl').disabled = false; 
@@ -72,5 +73,5 @@
     } 
      
-    if (this.users[user].acls != "false" && this.users[user].acls.indexOf('p',0) >= 0) 
+    if (this.users[user].acls != "false" && this.users[user].acls.indexOf('p',0) >= 0 && this.users[user].acls.indexOf('a',0) >= 0)
     { 
             Element('em_input_sendAcl').disabled = false; 
@@ -116,5 +117,5 @@
 		}		
 		if (Element('em_input_sendAcl').checked){
-			acl += 'p';                      
+			acl += 'pa';                      
         } 
 
