Changeset 8022 for trunk


Ignore:
Timestamp:
03/15/13 18:17:23 (11 years ago)
Author:
cristiano
Message:

Ticket #3393 - Desconsiderar sincronização de agendas compartilhadas no Z-Push

Location:
trunk/zpush
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/zpush/backend/expresso/providers/calendarProvider.php

    r7687 r8022  
    3030    { 
    3131        $return = array(); 
    32         $sigs = Controller::find(array('concept' => 'calendarSignature'), array( 'id','calendar' ), array( 'filter' => array( '=' , 'user' , $this->_uidnumber ))); 
    33  
    34         foreach($sigs as $sig) 
    35         { 
    36             $calendar =  Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 
    37             if($calendar['type'] != 0 ) continue; //ecluir grupo de tarefas 
    38  
    39             $tmpSig = array(); 
    40             $tmpSig["id"] = 'calendar'.$sig['id']; 
    41             $tmpSig["parent"] = 0; 
    42             $tmpSig["mod"] = $calendar['name']; 
    43             $return[] = $tmpSig; 
     32        $criteria = CALENDAR_SYNC_SIGNED_CALENDARS ? array( 'filter' => array( 'AND' , array( '=' , 'type' , '0' ) , array( '=' , 'user' , $this->_uidnumber ))) : array( 'filter' => array ( 'AND'  ,array( '=' , 'isOwner' , '1' ),array( '=' , 'type' , '0' ) , array( '=' , 'user' , $this->_uidnumber ))); 
     33        $sigs = Controller::find(array('concept' => 'calendarSignature'), array( 'id','calendar' ), $criteria); 
     34 
     35        if(Request::GetDeviceType()  == 'iPhone') 
     36        { 
     37            foreach($sigs as $sig) 
     38            { 
     39                $calendar =  Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 
     40                $tmpSig = array(); 
     41                $tmpSig["id"] = 'calendar'.$sig['id']; 
     42                $tmpSig["parent"] = 0; 
     43                $tmpSig["mod"] = $calendar['name']; 
     44                $return[] = $tmpSig; 
     45            } 
     46        } 
     47        else 
     48        { 
     49            $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value','id') , array('filter' => array( 'and' , array('=' , 'name' , 'defaultCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $this->_uidnumber )  )) ); 
     50 
     51            if(isset($defaultCalendar[0])) //Prioriza agenda default de importação pois o android so sincroniza a primeira agenda. 
     52            { 
     53                foreach($sigs as $i => $sig) 
     54                { 
     55                    if($sig['calendar'] == $defaultCalendar[0]['value']) 
     56                    { 
     57                        $calendar =  Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 
     58                        $tmpSig = array(); 
     59                        $tmpSig["id"] = 'calendar'.$sig['id']; 
     60                        $tmpSig["parent"] = 0; 
     61                        $tmpSig["mod"] = $calendar['name']; 
     62                        $return[] = $tmpSig; 
     63                    } 
     64                } 
     65            } 
     66            else 
     67            { 
     68                $sig = $sigs[0]; 
     69                $calendar =  Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 
     70                $tmpSig = array(); 
     71                $tmpSig["id"] = 'calendar'.$sig['id']; 
     72                $tmpSig["parent"] = 0; 
     73                $tmpSig["mod"] = $calendar['name']; 
     74                $return[] = $tmpSig; 
     75 
     76            } 
    4477        } 
    4578 
     
    121154    public function ChangeFolder($folderid, $oldid, $displayname, $type) 
    122155    { 
    123        return false; 
     156        return false; 
    124157 
    125158    } 
     
    283316                        case STATUS_ACCEPTED: 
    284317                            $message->busystatus = 2; 
    285                            break; 
     318                            break; 
    286319                        case STATUS_TENTATIVE: 
    287320                            $message->busystatus = 1; 
     
    300333        //------------------------------------------------------------------------------------------------------------// 
    301334 
    302        /* 
    303        * Sincronização de Recorrência 
    304        */ 
     335        /* 
     336        * Sincronização de Recorrência 
     337        */ 
    305338        $repeats = Controller::find(array('concept' => 'repeat'), null , array( 'filter' => array( 'and' , array( '=' , 'schedulable' , $schedulable['id'] ),array( '!=' , 'frequency' , 'none' )  ) )); 
    306339        if(is_array($repeats) && count($repeats) > 0) 
     
    326359 
    327360            if($repeat['endTime']) 
    328                $recur->until =  (int) substr($repeat['endTime'], 0, -3); 
     361                $recur->until =  (int) substr($repeat['endTime'], 0, -3); 
    329362 
    330363            $recur->interval = $repeat['interval'] ? $repeat['interval'] : 1; 
     
    697730            if($v['user']['id'] == $this->_uidnumber ) 
    698731            { 
    699                $schedulable['participants'][$i]['status'] = $this->formatBusy($message->busystatus); 
     732                $schedulable['participants'][$i]['status'] = $this->formatBusy($message->busystatus); 
    700733            } 
    701734        } 
     
    735768        $schedulable['startTime'] = (($message->starttime + $GMT_CEL) + ($calendarSignatureTimezone->getOffset(new DateTime('@'.($message->starttime + $GMT_CEL), new DateTimeZone('UTC'))) * -1) ) *1000; //$message->starttime  * 1000; 
    736769        $schedulable['endTime'] = (($message->endtime + $GMT_CEL) + ($calendarSignatureTimezone->getOffset(new DateTime('@'.($message->endtime + $GMT_CEL), new DateTimeZone('UTC')))* -1)) *1000;//$message->endtime  * 1000; 
     770 
     771        $sv  = new DateTime('@'.($message->starttime + $GMT_CEL), $calendarSignatureTimezone); 
     772 
     773        if($sv->format('I') == 0) 
     774            $schedulable['startTime'] = $schedulable['startTime'] - 3600000; 
     775 
     776        $ev  = new DateTime('@'.($message->endtime + $GMT_CEL), $calendarSignatureTimezone); 
     777 
     778        if($ev->format('I') == 0) 
     779            $schedulable['endTime'] = $schedulable['endTime'] - 3600000; 
     780 
    737781        $schedulable['timezone'] = $calendar['timezone']; 
    738  
    739782 
    740783 
     
    749792        $participant['isOrganizer'] = '1'; 
    750793        $participant['acl'] = 'rowi'; 
     794        $participant['status'] = '1'; 
    751795 
    752796        if($message->organizeremail) 
     
    9661010            if($v['user']['id'] == $this->_uidnumber && $v['user']['isOrganizer']  == '1') 
    9671011            { 
    968               $delete = true; 
     1012                $delete = true; 
    9691013            } 
    9701014        } 
     
    10331077 
    10341078        //Inicia Variaveis de para API expresso 
    1035             if(!isset($_SESSION)) 
    1036                 session_start(); 
    1037  
    1038             $userWallet = array(); 
    1039             $userWallet['uidNumber'] = $entries[0]['uidnumber'][0]; 
    1040             $userWallet['uid'] = $entries[0]['uid'][0]; 
    1041             $userWallet['mail'] = $entries[0]['mail'][0]; 
    1042  
    1043             $_SESSION['wallet'] = array(); 
    1044             $_SESSION['wallet']['user'] = $userWallet; 
    1045             $_SESSION['flags']['currentapp'] = 'expressoCalendar'; 
     1079        if(!isset($_SESSION)) 
     1080            session_start(); 
     1081 
     1082        $userWallet = array(); 
     1083        $userWallet['uidNumber'] = $entries[0]['uidnumber'][0]; 
     1084        $userWallet['uid'] = $entries[0]['uid'][0]; 
     1085        $userWallet['mail'] = $entries[0]['mail'][0]; 
     1086 
     1087        $_SESSION['wallet'] = array(); 
     1088        $_SESSION['wallet']['user'] = $userWallet; 
     1089        $_SESSION['flags']['currentapp'] = 'expressoCalendar'; 
    10461090 
    10471091        //----------------------------------------------------------------------------------------// 
     
    12071251                break; 
    12081252            case 0: 
    1209                return STATUS_UNANSWERED; 
     1253                return STATUS_UNANSWERED; 
    12101254                break; 
    12111255        } 
  • trunk/zpush/config.php

    r7706 r8022  
    311311    define('IMAP_USE_IMAPMAIL', true); 
    312312 
     313    define('CALENDAR_SYNC_SIGNED_CALENDARS', false); 
    313314 
    314315    $rs = pg_query( $GLOBALS['connections']['db'], 'SELECT app_id FROM phpgw_applications WHERE app_name = \'zpush\'' ); 
Note: See TracChangeset for help on using the changeset viewer.