Index: /trunk/expressoAdmin1_2/docs/change_log.txt
===================================================================
--- /trunk/expressoAdmin1_2/docs/change_log.txt	(revision 32)
+++ /trunk/expressoAdmin1_2/docs/change_log.txt	(revision 36)
@@ -71,2 +71,9 @@
 04/06/2007
 - Permitido ocultar setores.
+
+14/06/2007
+- Melhorado exibição de grupos e listas na inclusão/edição de usuários
+(muito mais rápido agora).
+- Melhorado exibição dos domínios samba:
+	- deixa a opção desmarcado caso não existe nenhum sambaDomain na OU.
+	- Seleciona automaticamente o sambaDomain da OU.
Index: /trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
===================================================================
--- /trunk/expressoAdmin1_2/templates/default/accounts_form.tpl	(revision 33)
+++ /trunk/expressoAdmin1_2/templates/default/accounts_form.tpl	(revision 36)
@@ -316,5 +316,5 @@
 		</td>
 		<td width="10%" align="right" class="td_right" bgcolor="{color_bg1}">
-			<input {disabled} type="button" value="{lang_save}" onClick="javascript:validate_fields('{type}');">
+			<input type="button" value="{lang_save}" onClick="javascript:validate_fields('{type}');">
 		</td>
 	</tr>
Index: /trunk/instant_messenger/inc/class.contacts_im.inc.php
===================================================================
--- /trunk/instant_messenger/inc/class.contacts_im.inc.php	(revision 33)
+++ /trunk/instant_messenger/inc/class.contacts_im.inc.php	(revision 36)
@@ -78,4 +78,33 @@
 			return 0;
 	}
+	
+	function UserPermission($param)
+	{
+		$db_acls = $this->db_user->get_accounts_acl();
+		$members = array();		
+		$search_uid 	= "";
+		$search_groups = "|";
+		
+		$search_uid = $this->ldap->list_users_ldap("uid=".$param['uid']);
+
+		foreach($db_acls as $tmp)
+			if($tmp['acl_account'] == $search_uid[0]['uidnumber'])
+				return 1;
+			else
+				$search_groups .= "(gidNumber=".$tmp['acl_account'].")";
+
+		$groups = $this->ldap->list_groups_ldap($search_groups);
+
+		if($groups)
+		foreach($groups as $tmp){
+			$members = $tmp['members'];	
+			foreach($members as $mb){		
+				if(trim($mb) == trim($search_uid[0]['uid']))
+					return 1;
+			}			
+		}
+		
+		return 0;
+	}
 }
 ?>
Index: /trunk/instant_messenger/inc/class.db_im.inc.php
===================================================================
--- /trunk/instant_messenger/inc/class.db_im.inc.php	(revision 33)
+++ /trunk/instant_messenger/inc/class.db_im.inc.php	(revision 36)
@@ -95,5 +95,4 @@
 			return 1;
 		}else{
-			//$query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')";
 			$query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'";
 			if($this->query_db($query))
@@ -121,5 +120,5 @@
 			return unserialize($result[0]['preference_value']);
 		else
-			return "ch_time:true;ch_offline:true;ch_contacts:true;rd_nm:true;rd_al:false;rd_ch:false";
+			return "ch_time:true;ch_offline:true;ch_contacts:false;rd_nm:true;rd_al:false;rd_ch:false";
 		
 	}
Index: /trunk/instant_messenger/js/im_win.js
===================================================================
--- /trunk/instant_messenger/js/im_win.js	(revision 32)
+++ /trunk/instant_messenger/js/im_win.js	(revision 36)
@@ -84,5 +84,5 @@
       main_menu_head_pref = func.newEl('span');
       func.confEl(main_menu_head_pref, 'id', 'span_menu_pref');
-	   func.confEl(main_menu_head_pref,'style','float: left;');
+	  func.confEl(main_menu_head_pref,'style','float: left;');
 
       br3 = func.newEl('br');
@@ -95,5 +95,5 @@
       func.confEl(main_menu_head_pref_img, 'id', 'img_pref');
 
-  	   main_menu_head_pref.onclick = function(){IM.menu_preferences('menu_preferences');};
+  	  main_menu_head_pref.onclick = function(){IM.menu_preferences('menu_preferences');};
       main_menu_head_pref_txt = document.createTextNode(IM.get_lang('Options'));
 
@@ -105,5 +105,5 @@
       func.insEl(main_menu_head_pref_img, main_menu_head_pref_txt, main_menu_head_div, main_menu_head_pref);
 
-      params = new Array();
+	  var params = [];
       params['body']       = main_menu_all;
       params['close']      = true;
@@ -626,5 +626,5 @@
          text += '<a onclick="javascript:IM.sendMessage(\'' + pId + '\')" title="Send a message" style="float:left"><img src="' + im_path + 'templates/default/images/img/skins/deathdart/send.gif" width="102" height="50" border=0 style="margin-top:3px"></a>';
 
-         params = [];
+         var params = [];
          params['body']     = text;
          params['height']   = 215;
Index: /trunk/instant_messenger/js/im_templates.js
===================================================================
--- /trunk/instant_messenger/js/im_templates.js	(revision 33)
+++ /trunk/instant_messenger/js/im_templates.js	(revision 36)
@@ -246,5 +246,5 @@
       grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Arial\')" id="fontStyle1" style="width:120px;font-family:arial">Arial</div>';
       grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Courier\')" id="fontStyle1" style="width:120px;font-family:Courier">Courier</div>';
-      grid += '<div class="menuitems" onMouseover="im_wihttp://www1.la.dell.com/content/products/features.aspx/advertised_latn.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Times\')" id="fontStyle1" style="width:120px;font-family:Times New Roman">Times New Roman</div>';
+      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'Times\')" id="fontStyle1" style="width:120px;font-family:Times New Roman">Times New Roman</div>';
       grid += '<div style="background:#cccccc;margin:1px"><img src="../images/blank.gif" height="1" width="1" border="0"/></div>';
       grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>';
Index: /trunk/instant_messenger/js/im_functions.js
===================================================================
--- /trunk/instant_messenger/js/im_functions.js	(revision 33)
+++ /trunk/instant_messenger/js/im_functions.js	(revision 36)
@@ -24,11 +24,13 @@
       var handler_contacts = function(data)
       {
-            _this.array_users.splice(0,_this.array_users.length);
-            _this.array_users = data;
-            _this.mount_list(data);
-            _this.conf_VcardUser(data[0]);
-      }
-
-      if ( force || this.getWinContactsState() )
+          if( (data.length) >= (_this.array_users.length) || (data.length - 1) > 0){
+	          _this.array_users.splice(0,_this.array_users.length);
+    	      _this.array_users = data;
+        	  _this.mount_list(data);
+	          _this.conf_VcardUser(data[0]);
+	      }
+      }
+	
+	  if ( force || this.getWinContactsState() )
          cIM.cExecute("$this.Ujabber.list_user",handler_contacts);
    }
@@ -77,10 +79,7 @@
    {
 		// Manutencao
-        //
-        //   var div_manutencao = document.getElementById('contacts_im_window_body_inner');
-       	//       div_manutencao.innerHTML = '<p align="center"><img src='+img_manutencao_im.src+'></p>';
-		//       return false;
-		//
-		//
+        var div_manutencao = document.getElementById('contacts_im_window_body_inner');
+       	    div_manutencao.innerHTML = '<p align="center"><img src='+img_manutencao_im.src+'></p>';
+		    return false;
 	}
 
@@ -604,11 +603,46 @@
       im_menu_action.menu("_span_" + pElement, form_menu_button_right);
    }
-
-	/*
-	 * url_encode
-	 */
-	
-	function url_encode(str)
-    { 
+   
+  /*
+   * Integração com o Expresso, verifica se o usuário tem permissão no Módulo IM
+   */
+   
+   IM.prototype.UserPermission = function(uid, handler)
+   {
+		cIM.cExecute("$this.contacts_im.UserPermission",handler,"uid="+uid);
+   }
+
+  /*
+   *  Ação do botão onclick da lista de contatos;
+   */
+
+   IM.prototype.action_button = function(pEv,pStatus,pJid,pReq)
+   {
+		var _this = this;
+		if(pEv.button > 1){
+			_this.menu_button_right(pJid,pReq);
+			document.oncontextmenu = new Function("return false");
+		}else{
+			if(pStatus == parseInt(1))
+				_this.open_chat(pJid);
+		}
+   }
+	
+  /*
+   * Abre Conversa
+   */
+
+   IM.prototype.open_chat = function(pJID)
+   {
+      func.byId(pJID).firstChild.src = img_chat_bubble.src;
+      im_win.open_chat(pJID);
+   }
+
+  /*
+   * url_encode
+   */
+	
+   function url_encode(str)
+   { 
 	    var hex_chars = "0123456789ABCDEF"; 
 	    var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 
@@ -630,37 +664,10 @@
 	    } 
 	    return strEncode; 
-	}  
-
-	/*
-	 *  Ação do botão onclick da lista de contatos;
-	 */
-
-	IM.prototype.action_button = function(pEv,pStatus,pJid,pReq)
-	{
-		var _this = this;
-		if(pEv.button > 1){
-			_this.menu_button_right(pJid,pReq);
-			document.oncontextmenu = new Function("return false");
-		}else{
-			if(pStatus == parseInt(1))
-				_this.open_chat(pJid);
-		}
-	}
-	
-	/*
-	 * Abre Conversa
-	 */
-
-	IM.prototype.open_chat = function(pJID)
-	{
-      func.byId(pJID).firstChild.src = img_chat_bubble.src;
-      im_win.open_chat(pJID);
-	}
-
-
-	String.prototype.rm_space = function()
-	{
+   }  
+
+   String.prototype.rm_space = function()
+   {
     	return this.replace(/( *)/g,"");
-	}
+   }
 
 // Build Object	
Index: /trunk/calendar/doc/change_log.txt
===================================================================
--- /trunk/calendar/doc/change_log.txt	(revision 29)
+++ /trunk/calendar/doc/change_log.txt	(revision 36)
@@ -2,4 +2,8 @@
 módulo Agenda de Eventos, e a partir da versão 29/11/2006 [0.9.17]
 Nilton Emilio Buhrer Neto.
+
+05/06/2007 - [0.9.2]
+- Adicionando funcionalidade de adicionar eventos externos, pelo email
+- Corrigido problema de carregar os usuários da organização selecionada, ao criar um compromisso.
 
 22/05/2007 - [0.9.2]
Index: /trunk/calendar/inc/class.bocalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.bocalendar.inc.php	(revision 29)
+++ /trunk/calendar/inc/class.bocalendar.inc.php	(revision 36)
@@ -2687,8 +2687,8 @@
 			}
 
-			if(!is_object($GLOBALS['phpgw']->send))
+			/*if(!is_object($GLOBALS['phpgw']->send))
 			{
 				$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
-			}
+			}*/
 		//	$send = &$GLOBALS['phpgw']->send;
 			
@@ -2708,5 +2708,7 @@
 			foreach($to_notify as $userid => $statusid) 
 			{
-			
+			 	$mail->ClearAllRecipients();
+			 	$mail->ClearAttachments();
+			 	
 				$userid = (int)$userid;
 
@@ -2731,4 +2733,5 @@
 
 					$to = $preferences->email_address($userid);
+					
 					if (empty($to) || $to[0] == '@' || $to[0] == '$')	// we have no valid email-address
 					{
@@ -2945,5 +2948,5 @@
 							break;
 					}
-					$mail->AddAddress(implode(",",$to));	
+					$mail->AddAddress($to);
 					$mail->Body = $tmpbody;
 					$mail->From = $sender;
@@ -2957,4 +2960,5 @@
 					if(!$mail->Send())
 					{
+						
    						$returncode=false;
 					}
@@ -2991,6 +2995,7 @@
 						if($ex_participant)
 							$to[] = $ex_participant;
-				}
-				$mail->AddAddress(implode(",",$to));
+				}		
+				foreach($to as $i => $to_array)
+					$mail->AddAddress($to_array);
 				$_body = explode("<hr size='1' width='100%'>",$tmpbody);
 				$tmpbody = $_body[0];
@@ -2998,6 +3003,23 @@
 				$tmpbody.= "<br>".lang("Summary").": ".$this->so->cal->event[title]."<br>";
 				$tmpbody.= "<br>".lang("Start date").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>";
-				$tmpbody.= "<br><br><hr size='1' width='100%'><font color='red'>".lang("This message was sent by server. You must send a message to sender to confirm this event")."</font>";
-			
+				$tmpbody.= "<br><br><hr size='1' width='100%'><font color='red'>"
+				.lang("This message was sent by server. You must send a message to sender to confirm this event")."<br>"
+				.lang("This is an external event. Even if it added to your expresso its can be changed any time at all")."</font><br>";
+				
+				if ($GLOBALS['bocalendar']->so->cal->event[start][month] > 10)
+					$event_month=$GLOBALS['bocalendar']->so->cal->event[start][month];
+				else
+					$event_month="0".$GLOBALS['bocalendar']->so->cal->event[start][month];
+				$tmpbody .="<a href='../index.php?menuaction=calendar.uicalendar.add&date="
+				.$GLOBALS['bocalendar']->so->cal->event[start][year]
+				.$event_month
+				.$GLOBALS['bocalendar']->so->cal->event[start][mday]
+				."&hour=".$GLOBALS['bocalendar']->so->cal->event[start][hour]
+				."&minute=".$GLOBALS['bocalendar']->so->cal->event[start][min]
+				."&title=".$GLOBALS['bocalendar']->so->cal->event['title']
+				."&description=".$GLOBALS['bocalendar']->so->cal->event['description']
+				."&location=".$GLOBALS['bocalendar']->so->cal->event['location']."'>"
+				."<h2>".lang("Add to my expresso")."</h2>";
+				
 				//attach extern vcard			
 				// define('context','$GLOBALS.bocalendar.so.cal.event');
@@ -3013,5 +3035,5 @@
 				fclose($attach_fd);
 				$mail->From = $sender;
-				$mail->FromName = lang("Expresso external user").": ".$GLOBALS['phpgw_info']['user']['fullname'];
+				$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
 				$mail->Sender = $mail->From;
 				$mail->SenderName = $mail->FromName;
Index: /trunk/calendar/inc/class.uicalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.uicalendar.inc.php	(revision 29)
+++ /trunk/calendar/inc/class.uicalendar.inc.php	(revision 36)
@@ -1181,11 +1181,20 @@
 				$endmin    = $startmin + (int)$this->bo->prefs['calendar']['defaultlength'];
 				$endhour   = $starthour + $this->bo->normalizeminutes($endmin);
-				;
+				
+				$subject	= (string)(get_var('title',array('GET'),0));
+				if ($subject != '0')
+				{
+					$description	= (string)(get_var('description',array('GET'),0));
+					$location	= (string)(get_var('location',array('GET'),0));
+				}
+				else
+					unset($subject);
+				
 				$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
 				$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
-				$this->bo->set_title('');
-				$this->bo->set_description('');
+				$this->bo->set_title($subject);
+				$this->bo->set_description($description);
+				$this->bo->add_attribute('location',$location);
 				$this->bo->set_ex_participants('');
-				$this->bo->add_attribute('location','');
 				$this->bo->add_attribute('uid','');
 				$this->bo->add_attribute('priority',2);
@@ -4005,6 +4014,9 @@
 										$user_context[] = $dn_part;
 								}
-								$user_context = implode(",",$user_context);
-								$combo_org = $this->get_organizations($context, trim(strtolower($user_context)));
+								// Prepara o contexto do usuario com sua OU raiz, pois ele pode pertencer a uma OU de nivel N.
+								$user_ou = explode(",",str_replace($context,"",implode(",",$user_context)));								
+								$user_context = trim(strtolower($user_ou[count($user_ou) - 2].",".$context));
+								// Fim
+								$combo_org = $this->get_sectors(trim(strtolower($user_context)));
 								$footer_ext_participantes = lang("Tip: To search in the <b>Global Catalog</b>, type the <b>F9</b> key, like the ExpressoMail.");
 								
@@ -4045,5 +4057,5 @@
 											"<script type='text/javascript'>var DEFAULT_URL = '".$module_name."/controller.php?action=';</script> ".											
 											"<script type='text/javascript'>" .
-											"setTimeout('get_available_users(\"".$module_name."\",\'".$user_context."\')',1000);" .
+											"setTimeout('get_available_users(\"".$module_name."\",\'".$user_context."\')',1000);". 
 											"</script> "
 												
@@ -4630,10 +4642,11 @@
 		}
 
-		function get_organizations($context, $selected='')
+		function get_sectors($selected='')
 		{
 			$s = CreateObject('phpgwapi.sector_search_ldap');
-			$sectors_info = $s->get_organizations($context, $selected, false, false);
+			$sectors_info = $s->get_sectors($selected, false, false);
 			return $sectors_info;
 		}
+		
 		/*
 		function get_organizations($context, $selected='')
Index: /trunk/calendar/templates/celepar/js/edit_exmail.js
===================================================================
--- /trunk/calendar/templates/celepar/js/edit_exmail.js	(revision 18)
+++ /trunk/calendar/templates/celepar/js/edit_exmail.js	(revision 36)
@@ -52,5 +52,5 @@
 		}
 		var options = '###';
-		if (data) {			
+		if (data) {
 			if(data.groups && data.groups.length > 0) {
 				data.groups = '<option  value="-1" disabled>------------------- '+document.getElementById("txt_groups").value+' ------------------ </option>' + data.groups;
@@ -75,5 +75,6 @@
 	}	
 
-	cExecute (path+'.ldap_functions.get_available_users&context='+context, handler_get_available_users);
+	document.getElementById('combo_org').value = context;
+	cExecute (path+'.ldap_functions.get_available_users&context='+context+'&type=search', handler_get_available_users);
 }
 function add_user()
