Changeset 8006


Ignore:
Timestamp:
03/13/13 14:40:39 (6 years ago)
Author:
douglas
Message:

Ticket #3378 - Correcao BUG edicao de eventos compartilhados com repeticao

Location:
branches/2.5/prototype/modules/calendar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/prototype/modules/calendar/js/calendar.codecs.js

    r8004 r8006  
    18151815                                 
    18161816                                return DataLayer.merge({ 
    1817                                         editable: aclSignature.acl['write'] && !isRecurrence, 
    1818                                         disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 
     1817                                        editable: evt.editable, 
     1818                        disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 
    18191819                                        disableDragging  : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true: false), 
    18201820                                        className: mountClass(aclSignature.acl) 
  • branches/2.5/prototype/modules/calendar/js/init.js

    r8003 r8006  
    473473                case 1: 
    474474                    if(evt.selectable){ 
    475                         if(evt.isRepeat){ 
     475                        if(evt.isRepeat && evt.editable ){ 
    476476                            $.Zebra_Dialog(evt.title + ' é um evento com repetição.', { 
    477477                                'type':     'question', 
  • branches/2.5/prototype/modules/calendar/schedules.php

    r7990 r8006  
    113113    function normalizeEvents( &$result, $timezones ){ 
    114114 
    115         $myCalendarsT =  Controller::service('PostgreSQL')->execResultSql('SELECT calendar_id FROM calendar_signature WHERE user_uidnumber = \''.Config::me('uidNumber').'\' AND is_owner = \'1\' AND type = \'0\'');  
    116         $myCalendars = array();  
    117         foreach($myCalendarsT as $v)  
    118             $myCalendars[] = $v['calendar_id'];  
    119   
     115        $mySig = Controller::find(array('concept' => 'calendarSignature') , array('calendar') , array('filter' => array( 'AND' , array('=' , 'type' , '0' ) , array( '=' , 'user' ,Config::me('uidNumber') ) , array('=' , 'isOwner' , '0' ))));  
     116  
     117        $signedCalendars = array();  
     118        foreach($mySig as $v)  
     119        {  
     120            $tmp = Controller::find(array('concept' => 'calendarToPermission') , array('acl' ,'owner') , array('filter' => array( 'AND' ,array( '=' , 'calendar' , $v['calendar'] ) , array( '=' , 'user' , Config::me('uidNumber')  ) )));  
     121            $signedCalendars[$v['calendar']] = $tmp[0];  
     122        }  
    120123  
    121124        $date = new DateTime('now', new DateTimeZone('UTC')); 
     
    162165            } 
    163166 
    164             $attend = Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  ))); 
    165  
    166             $result[$i]['unanswered'] = 0;  
     167            $attend = (isset($signedCalendars[$result[$i]['calendar']])) ?  
     168                Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', $signedCalendars[$result[$i]['calendar']]['owner'] )  ))):  
     169                Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  )));  
     170  
     171                $result[$i]['unanswered'] = 0;  
    167172  
    168173            if(count($attend) > 0 && !empty($attend)){ 
    169                 if(array_key_exists(0, $attend)) 
    170                     $attend = $attend[0]; 
    171  
    172                 $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0; 
    173   
    174                 if($attend['status'] == STATUS_UNANSWERED && in_array($result[$i]['calendar'] , $myCalendars) )  
    175                     $result[$i]['unanswered'] = 1;  
     174               if(array_key_exists(0, $attend))  
     175                  $attend = $attend[0];  
     176  
     177                if(isset($signedCalendars[$result[$i]['calendar']])) //Caso agenda compartilhada verificar tmb se tem compartilhamento de escrita  
     178                    $result[$i]['editable'] = (strpos($signedCalendars[$result[$i]['calendar']]['acl'],"w") >=0  &&  (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ) ? 1 : 0;  
     179                else  
     180                   $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0;  
     181  
     182                if($attend['status'] == STATUS_UNANSWERED && !isset($signedCalendars[$result[$i]['calendar']]) )  
     183                   $result[$i]['unanswered'] = 1;  
    176184 
    177185            }else{ 
Note: See TracChangeset for help on using the changeset viewer.