Changeset 8005


Ignore:
Timestamp:
03/13/13 11:34:08 (7 years ago)
Author:
cristiano
Message:

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

Location:
trunk/prototype/modules/calendar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/calendar/js/calendar.codecs.js

    r8001 r8005  
    18171817                                 
    18181818                                return DataLayer.merge({ 
    1819                                         editable: aclSignature.acl['write'] && !isRecurrence, 
    1820                                         disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 
     1819                                        editable: evt.editable, 
     1820                        disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 
    18211821                                        disableDragging  : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true: false), 
    18221822                                        className: mountClass(aclSignature.acl) 
  • trunk/prototype/modules/calendar/js/init.js

    r8002 r8005  
    491491                case 1: 
    492492                    if(evt.selectable){ 
    493                         if(evt.isRepeat){ 
     493                        if(evt.isRepeat && evt.editable ){ 
    494494                            $.Zebra_Dialog(evt.title + ' é um evento com repetição.', { 
    495495                                'type':     'question', 
  • trunk/prototype/modules/calendar/schedules.php

    r7989 r8005  
    116116    function normalizeEvents( &$result, $timezones ){ 
    117117 
    118         $myCalendarsT =  Controller::service('PostgreSQL')->execResultSql('SELECT calendar_id FROM calendar_signature WHERE user_uidnumber = \''.Config::me('uidNumber').'\' AND is_owner = \'1\' AND type = \'0\''); 
    119         $myCalendars = array(); 
    120         foreach($myCalendarsT as $v) 
    121             $myCalendars[] = $v['calendar_id']; 
    122  
     118        $mySig = Controller::find(array('concept' => 'calendarSignature') , array('calendar') , array('filter' => array( 'AND' , array('=' , 'type' , '0' ) , array( '=' , 'user' ,Config::me('uidNumber') ) , array('=' , 'isOwner' , '0' )))); 
     119 
     120        $signedCalendars = array(); 
     121        foreach($mySig as $v) 
     122        { 
     123            $tmp = Controller::find(array('concept' => 'calendarToPermission') , array('acl' ,'owner') , array('filter' => array( 'AND' ,array( '=' , 'calendar' , $v['calendar'] ) , array( '=' , 'user' , Config::me('uidNumber')  ) ))); 
     124            $signedCalendars[$v['calendar']] = $tmp[0]; 
     125        } 
    123126 
    124127        $date = new DateTime('now', new DateTimeZone('UTC')); 
     
    165168            } 
    166169 
    167             $attend = Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  ))); 
    168  
    169             $result[$i]['unanswered'] = 0; 
     170            $attend = (isset($signedCalendars[$result[$i]['calendar']])) ? 
     171                Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', $signedCalendars[$result[$i]['calendar']]['owner'] )  ))): 
     172                Controller::read(array('concept' => 'participant'), null, array('filter' => array('AND', array('=','schedulable',$v['id']), array('=','user', Config::me('uidNumber'))  ))); 
     173 
     174                $result[$i]['unanswered'] = 0; 
    170175 
    171176            if(count($attend) > 0 && !empty($attend)){ 
    172                 if(array_key_exists(0, $attend)) 
    173                     $attend = $attend[0]; 
    174  
    175                 $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0; 
    176  
    177                 if($attend['status'] == STATUS_UNANSWERED && in_array($result[$i]['calendar'] , $myCalendars) ) 
    178                     $result[$i]['unanswered'] = 1; 
     177               if(array_key_exists(0, $attend)) 
     178                  $attend = $attend[0]; 
     179 
     180                if(isset($signedCalendars[$result[$i]['calendar']])) //Caso agenda compartilhada verificar tmb se tem compartilhamento de escrita 
     181                    $result[$i]['editable'] = (strpos($signedCalendars[$result[$i]['calendar']]['acl'],"w") >=0  &&  (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ) ? 1 : 0; 
     182                else 
     183                   $result[$i]['editable'] = (strstr($attend['acl'],"w") || strstr($attend['acl'],"o") || $attend['isOrganizer'] == '1') ? 1 : 0; 
     184 
     185                if($attend['status'] == STATUS_UNANSWERED && !isset($signedCalendars[$result[$i]['calendar']]) ) 
     186                   $result[$i]['unanswered'] = 1; 
    179187 
    180188            }else{ 
Note: See TracChangeset for help on using the changeset viewer.