Index: trunk/prototype/modules/calendar/interceptors/Notifications.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 5523)
+++ trunk/prototype/modules/calendar/interceptors/Notifications.php	(revision 5804)
@@ -148,7 +148,7 @@
 
 		$data['nowStartDate'] = date_format( $sTime , 'd/m/Y');
-        $data['nowStartTime'] = ($schedulableReference['allDay']) ? '' : date_format( $sTime , 'H:i');
-        $data['nowEndDate'] = date_format( $eTime , 'd/m/Y');
-        $data['nowEndTime'] = ($schedulableReference['allDay']) ? '' :  date_format( $eTime , 'H:i');
+                $data['nowStartTime'] = ($schedulableReference['allDay']) ? '' : date_format( $sTime , 'H:i');
+                $data['nowEndDate'] = date_format( $eTime , 'd/m/Y');
+                $data['nowEndTime'] = ($schedulableReference['allDay']) ? '' :  date_format( $eTime , 'H:i');
 		$data['userRequest'] = Config::me('uid');
 		
@@ -161,5 +161,5 @@
 		$params['body'] = parseTPL::load_tpl( $data ,ROOTPATH.'/modules/calendar/templates/notify_suggestion_body.tpl');
 		$params['subject'] = parseTPL::load_tpl( $subject ,ROOTPATH.'/modules/calendar/templates/notify_subject.tpl');;
-		$params['from'] = Config::me('mail');   
+		$params['from'] ='"'.Config::me('cn').'" <'.Config::me('mail').'>';   
 		$params['to'] = $organizer['user']['mail'];
 		
@@ -192,5 +192,5 @@
 		$params['subject'] = parseTPL::load_tpl( $subject ,ROOTPATH.'/modules/calendar/templates/notify_subject.tpl');;
 		$params['to'] = $params['from'];
-		$params['from'] = Config::me('mail');   
+		$params['from'] = $params['from'] ='"'.Config::me('cn').'" <'.Config::me('mail').'>';
 	}
 	
@@ -435,5 +435,5 @@
        $mail['body'] = parseTPL::load_tpl( $data ,ROOTPATH.'/modules/calendar/templates/'.$template.'.tpl');
        $mail['subject'] = parseTPL::load_tpl( $subject ,ROOTPATH.'/modules/calendar/templates/notify_subject.tpl');;
-       $mail['from'] = Config::me('mail');   
+       $mail['from'] = '"'.Config::me('cn').'" <'.Config::me('mail').'>';
        $mail['to'] = $to;
        Controller::create( array( 'service' => 'SMTP' ), $mail ); 
Index: trunk/prototype/modules/calendar/interceptors/LDAPMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/LDAPMapping.php	(revision 5437)
+++ trunk/prototype/modules/calendar/interceptors/LDAPMapping.php	(revision 5804)
@@ -36,8 +36,60 @@
                                                           )
                                                 );
+            
+                else
+                     $criteria['filter'] = array('AND',
+                                                array('AND' , 
+                                                            array('=' , 'objectClass' , 'phpgwAccount'),
+                                                            array('OR' , 
+                                                                        array('=' , 'phpgwAccountType' , 'i'),
+                                                                        array('=' , 'phpgwAccountType' , 'u'),
+                                                                        array('=' , 'phpgwAccountType' , 's')
+                                                                 )
+                                                     ),$criteria['filter']
+                                                );                      
             }
           
     }  
    
+
+       public function encodeFindGroup( &$uri , &$params , &$criteria , $original ){
+            if(isset($criteria['filter']))
+            {
+                if($criteria['filter'][0] === '*' && $criteria['filter'][1] === 'name') //Busca pelo nome group DFD00032
+                    $criteria['filter'] = array('AND',
+                                                array('AND' , 
+                                                            array('=' , 'objectClass' , 'phpgwAccount'),
+                                                            array('=' , 'phpgwAccountType' , 'g')
+                                                                 
+                                                    ),
+                                                 array('AND' ,  
+                                                                array('!','phpgwAccountVisible','-1'),
+                                                                array('OR', 
+                                                                        array('=','accountStatus','active'),
+                                                                        array('=','objectClass','posixGroup')
+                                                                    ),
+                                                                array('OR', 
+                                                                        array('*','name',$criteria['filter'][2]),
+                                                                        array('*','id',$criteria['filter'][2]),
+                                                                        array('*','mail',$criteria['filter'][2]),
+                                                                        array('*','mailAlternateAddress',$criteria['filter'][2]),
+                                                                    )
+                                                          )
+                                                );
+                
+                
+                    else
+                        $criteria['filter'] = array('AND',
+                            array('AND' , 
+                                        array('=' , 'objectClass' , 'phpgwAccount'),
+                                        array('=' , 'phpgwAccountType' , 'g')
+                                    ),$criteria['filter']
+                            );                      
+            }
+          
+    }  
+     
+    
+    
 }
 
Index: trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5798)
+++ trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5804)
@@ -468,6 +468,11 @@
 			
 			foreach($newResult as $key => &$value){
-				if($value['user']  != 0)
-					$value['user'] = Controller::read( array( 'concept' => 'user' , 'id' => $value['user'] ));
+                                if($value['user']  != 0){
+                                    $user = $value['user'];
+                                    $value['user'] = Controller::read( array( 'concept' => 'user' , 'id' => $user ));
+
+                                    if(!$value['user'])
+                                        $value['user'] = Controller::read( array( 'concept' => 'group' , 'id' => $user ));
+                                }
 			}
 
@@ -640,18 +645,21 @@
                 if(isset($v['calendar'])){
                     $result[$i]['calendar'] = Controller::read( array( 'concept' => 'calendar' , 'id' => $v['calendar']), false, false); 
-					$result[$i]['defaultAlarms'] = Controller::find( array( 'concept' => 'calendarSignatureAlarm' ) , false ,array( 'filter' => array('=', 'calendarSignature'  ,  $v['id']) ));    
-					//Caso não seja o dono da agenda retorna o objeto permission com as acls
-					if($result[$i]['isOwner'] == 0){
-						$permission = Controller::find( array( 'concept' => 'calendarToPermission'), false ,array( 'filter' => array('AND', array('=', 'calendar' ,  $v['calendar']), array('=', 'user', Config::me('uidNumber') ) ) ) ); 
-
-						if(!is_array($permission) || !$permission  ){
-
-							$permission = Controller::find( array( 'concept' => 'calendarToPermission'), false ,array( 'filter' => array('AND', array('=', 'calendar' ,  $v['calendar']), array('=', 'type', '1' ) ) ) );    
-
-						}
-						$result[$i]['permission'] = $permission[0];
-					}
-				}
-           }
+                    $result[$i]['defaultAlarms'] = Controller::find( array( 'concept' => 'calendarSignatureAlarm' ) , false ,array( 'filter' => array('=', 'calendarSignature'  ,  $v['id']) ));    
+                    //Caso não seja o dono da agenda retorna o objeto permission com as acls
+                    if($result[$i]['isOwner'] == 0){
+                            $permission = Controller::find( array( 'concept' => 'calendarToPermission'), false ,array( 'filter' => array('AND', array('=', 'calendar' ,  $v['calendar']), array('=', 'user', Config::me('uidNumber') ) ) ) ); 
+
+                            if(!is_array($permission) || !$permission  ){
+
+                                    $permission = Controller::find( array( 'concept' => 'calendarToPermission'), false ,array( 'filter' => array('AND', array('=', 'calendar' ,  $v['calendar']), array('=', 'type', '1' ) ) ) );    
+
+                            }
+                            $result[$i]['permission'] = $permission[0];
+                    }
+            }
+            //TODO - Padronizar retorno do deepness
+//            if(isset($v['user']))
+//                $result[$i]['user'] = Controller::read( array( 'concept' => 'user' , 'id' => $v['user']), false, false); 
+          }
        }       
    } 
Index: trunk/prototype/modules/calendar/constants.php
===================================================================
--- trunk/prototype/modules/calendar/constants.php	(revision 5780)
+++ trunk/prototype/modules/calendar/constants.php	(revision 5804)
@@ -44,3 +44,4 @@
 define('CALENDAR_ACL_BUSY', 'b');
 define('CALENDAR_ACL_SHARED', 's');
+define('CALENDAR_ACL_REQUIRED', 'p');
 ?>
Index: trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5752)
+++ trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5804)
@@ -44,5 +44,6 @@
 	'd' : 'remove',
 	'b' : 'busy',
-	's' : 'shared'
+	's' : 'shared',
+        'p' : 'required'
 }
 
@@ -145,6 +146,14 @@
 		*  quando forçado um get do banco, deverá ser criado uma condição para o mesmo
 		*/
-		var descart = DataLayer.get("calendarSignature", {filter: ['=', 'user', User.me.id], criteria: {deepness: 2}});
-		this.signatures  = DataLayer.get("calendarSignature", {filter: ['=', 'user', User.me.id], criteria: {deepness: 2}}, true);
+		var filter = ['=', 'user', User.me.id];
+		if(!!User.me.gidNumber){
+			if(!$.isArray(User.me.gidNumber))
+				User.me.gidNumber = [User.me.gidNumber];
+
+			filter = ['OR', filter, ['IN', 'user', User.me.gidNumber]];
+		}
+		
+		var descart = DataLayer.get("calendarSignature", {filter: filter, criteria: {deepness: 2}});
+		this.signatures  = DataLayer.get("calendarSignature", {filter: filter, criteria: {deepness: 2}}, true);
 	  
 		var prevSources = this.sources;
Index: trunk/prototype/modules/calendar/templates/calendar_list.ejs
===================================================================
--- trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 5596)
+++ trunk/prototype/modules/calendar/templates/calendar_list.ejs	(revision 5804)
@@ -1,78 +1,80 @@
 <div class="all-list-calendars">
-<% var signature = data.signatures %>
-<% var external = false %>
-<div class="my-calendars">
-	<a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a>
-	<span class="status-list ui-icon ui-icon-triangle-1-s"></span>
-	<a href="#" class="button new new-calendar">Nova Agenda</a>
-	<ul class="list-calendars my-list-calendars">
-				<% for (var i=0; i < signature.length; i++) {
-					if(signature[i].isOwner == 1){
-				%>
-					<li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>">
-						
-						<div>
-							<input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
-							<label><%= signature[i].calendar.name %></label>
-							
-						</div> 
-							<a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
-								<img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
-							</a>
-							
-							
-						<div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id %> hidden">
-							<ul>
-								<li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id%>);">Configurações</a></li>
-								<li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id%>);">Importar</a></li>
-								<li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id%>);">Exportar</a></li>
-								<li><a href="#" onclick="show_modal_shared(<%= signature[i].calendar.id%>);">Compartilhar agenda</a></li>
-                                <li><a href="#" onclick="remove_calendar();">Remover agenda</a></li>
-							</ul>
-                                                        
-						</div>
-					</li>
-			<% 		
-					}else
-						external = true;
-				}
-			%>
-		   
-	</ul>
+    <% var signature = data.signatures %>
+    <% var external = false %>
+    <div class="my-calendars">
+        <a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a>
+        <span class="status-list ui-icon ui-icon-triangle-1-s"></span>
+        <a href="#" class="button new new-calendar">Nova Agenda</a>
+        <ul class="list-calendars my-list-calendars">
+            <% for (var i=0; i < signature.length; i++) {
+            if(signature[i].isOwner == 1){
+            %>
+            <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>">
+
+                <div>
+                    <input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
+                    <label><%= signature[i].calendar.name %></label>
+
+                </div> 
+                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
+                    <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/>
+                </a>
+
+
+                <div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id %> hidden">
+                    <ul>
+                        <li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id%>);">Configurações</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id%>);">Importar</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id%>);">Exportar</a></li>
+                        <li><a href="#" onclick="show_modal_shared(<%= signature[i].calendar.id%>);">Compartilhar agenda</a></li>
+                        <li><a href="#" onclick="remove_calendar();">Remover agenda</a></li>
+                    </ul>
+
+                </div>
+            </li>
+            <% 		
+            }else
+            external = true;
+            }
+            %>
+
+        </ul>
+    </div>
+
+    <div class="signed-calendars">
+        <a title='Agendas assinadas' class="title-signed-calendars" aria-expanded='false' role='button' tabindex='0'>Agendas assinadas</a>			
+        <span class="status-list-shared ui-icon ui-icon-triangle-1-s"></span>
+        <a href="#" class="button new new-calendar-shared tiny">Nova Agenda</a>
+
+        <% if (external) { %>	
+        <ul class="list-calendars signed-list-calendars">
+            <% for (var i=0; i < signature.length; i++) {
+            if(signature[i].isOwner == 0){
+            %>
+            <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>">
+                <input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
+                <label><%= signature[i].calendar.name %></label>
+
+                <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
+                    <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/></a>
+                <div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id  %> hidden">
+                    <ul>
+                        <!--<li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id %>);">Configurações</a></li>-->
+                        <li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id %>);">Importar</a></li>
+                        <li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id %>);">Exportar</a></li>
+                        <%if(!signature[i].permission.acl['required']){%>
+                            <li><a href="#" onclick="cancel_signature(<%= signature[i].id %>);">Cancelar assinatura</a></li>
+                        <%}%>
+                    </ul>
+
+                </div>
+
+            </li>
+            <% 		
+            }
+            }
+            %>
+        </ul>
+        <% } %>
+    </div>
 </div>
-
-<div class="signed-calendars">
-	<a title='Agendas assinadas' class="title-signed-calendars" aria-expanded='false' role='button' tabindex='0'>Agendas assinadas</a>			
-	<span class="status-list-shared ui-icon ui-icon-triangle-1-s"></span>
-	<a href="#" class="button new new-calendar-shared tiny">Nova Agenda</a>
-	
-	<% if (external) { %>	
-		<ul class="list-calendars signed-list-calendars">
-				<% for (var i=0; i < signature.length; i++) {
-						if(signature[i].isOwner == 0){
-					%>
-						<li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>">
-							<input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>
-							<label><%= signature[i].calendar.name %></label>
-
-							<a class="cal-list-options-btn my-cal-list-options-btn-<%= signature[i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">
-							<img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/></a>
-							<div class="cal-list-options my-cal-list-options-<%= signature[i].calendar.id  %> hidden">
-								<ul>
-									<!--<li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id %>);">Configurações</a></li>-->
-									<li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id %>);">Importar</a></li>
-									<li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id %>);">Exportar</a></li>
-									<li><a href="#" onclick="cancel_signature(<%= signature[i].id %>);">Cancelar assinatura</a></li>
-								</ul>
-
-						</div>
-
-						</li>
-					<% 		
-						}
-					}
-					%>
-		</ul>
-	<% } %>
-	</div>
-</div>
