Changeset 29 for trunk/calendar


Ignore:
Timestamp:
05/29/07 14:06:42 (17 years ago)
Author:
niltonneto
Message:

* empty log message *

Location:
trunk/calendar
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/doc/change_log.txt

    r23 r29  
    22módulo Agenda de Eventos, e a partir da versão 29/11/2006 [0.9.17] 
    33Nilton Emilio Buhrer Neto. 
     4 
     522/05/2007 - [0.9.2] 
     6- Adicionando/corrigindo funcionalidade de exportar vcard de todos os eventos 
     7 
     822/05/2007 - [0.9.2] 
     9- Adicionando funcionalidade de exportar vcard de eventos externos 
    410 
    51103/05/2007 - [0.9.2] 
  • trunk/calendar/inc/class.bocalendar.inc.php

    r2 r29  
    24952495                } 
    24962496 
     2497        function create_vcard($event) 
     2498        { 
     2499                // It translates int to string 
     2500                if ( $event[end][month] < 10 ) 
     2501                        $end_event_month="0".$event[end][month]; 
     2502                else 
     2503                        $end_event_month=$event[end][month]; 
     2504                if ( $event[start][month] < 10 ) 
     2505                        $start_event_month="0".$event[start][month]; 
     2506                else 
     2507                        $start_event_month=$event[start][month]; 
     2508                if ( $event[end][mday] < 10 ) 
     2509                        $end_event_day="0".$event[end][mday]; 
     2510                else 
     2511                        $end_event_day=$event[end][mday]; 
     2512                if ( $event[start][mday] < 10 ) 
     2513                        $start_event_day="0".$event[start][mday]; 
     2514                else 
     2515                        $start_event_day=$event[start][mday]; 
     2516                if ( $event[start][hour] < 10) 
     2517                        $start_event_hour="0".$event[start][hour]; 
     2518                else 
     2519                        $start_event_hour=$event[start][hour]; 
     2520                if ( $event[end][hour] < 10) 
     2521                        $end_event_hour="0".$event[end][hour]; 
     2522                else 
     2523                        $end_event_hour=$event[end][hour]; 
     2524                         
     2525                if ( $event[start][min] < 10) 
     2526                        $start_event_min="0".$event[start][min]; 
     2527                else 
     2528                        $start_event_min=$event[start][min]; 
     2529                if ( $event[end][min] < 10) 
     2530                        $end_event_min="0".$event[end][min]; 
     2531                else 
     2532                        $end_event_min=$event[end][min];         
     2533         
     2534                $tmpattach="BEGIN:VCALENDAR\n" 
     2535                ."PRODID:-//Expresso Livre//Calendar//EN\n" 
     2536                ."VERSION:1.0\n" 
     2537                ."BEGIN:VEVENT\n" 
     2538                ."DTSTART:".$event[start][year].$start_event_month.$start_event_day."T".$start_event_hour.$start_event_min."00Z\n" 
     2539                ."DTEND:".$event[end][year].$end_event_month.$end_event_day."T".$end_event_hour.$end_event_min."00Z\n" 
     2540                ."UID:Expresso-".$event[id].$event[uid]."\n" 
     2541                ."LAST-MODIFIED:".time()."\n" 
     2542                ."DESCRIPTION:".$event[description]."\n" 
     2543                ."SUMMARY:".$event[title]."\n" 
     2544                ."LOCATION:".$event[location]."\n" 
     2545                ."END:VEVENT"."\n" 
     2546                ."END:VCALENDAR\n"; 
     2547                return $tmpattach; 
     2548} 
     2549 
    24972550                /*! 
    24982551                @function send_update 
     
    25202573 
    25212574                        $GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences(); 
    2522                         $sender = $GLOBALS['phpgw_info']['user']['preferences']['email']['address']; 
     2575                        $sender = $GLOBALS['phpgw_info']['user']['email']; 
    25232576 
    25242577                        $temp_tz_offset = $this->prefs['common']['tz_offset']; 
     
    26382691                                $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send'); 
    26392692                        } 
    2640                         $send = &$GLOBALS['phpgw']->send; 
     2693                //      $send = &$GLOBALS['phpgw']->send; 
     2694                         
     2695                        //Seta o email usando phpmailer 
     2696                        define('PHPGW_INCLUDE_ROOT','../');      
     2697                        define('PHPGW_API_INC','../phpgwapi/inc');       
     2698                        include_once(PHPGW_API_INC.'/class.phpmailer.inc.php'); 
     2699                        $mail = new PHPMailer(); 
     2700                        $mail->IsSMTP(); 
     2701                        $mail->Host = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpServer']; 
     2702                        $mail->Port = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpPort']; 
     2703                        $mail->From = $_SESSION['phpgw_info']['expressomail']['user']['email']; 
     2704                        $mail->FromName = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 
     2705                        $mail->IsHTML(true); 
     2706                         
    26412707                        // Aqui é enviado o email 
    2642  
    26432708                        foreach($to_notify as $userid => $statusid)  
    26442709                        { 
     
    26882753                                         
    26892754                                        list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2); 
    2690                                         $subject = $send->encode_subject($subject); 
    26912755                                         
    26922756                                        switch($part_prefs['calendar']['update_format']) 
     
    28612925                                                        $body->set_var($var); 
    28622926                                                        $tmpbody = $body->fp('out','list'); 
    2863                                                          
     2927                                                                                                                 
    28642928                                                        break; 
    28652929 
    28662930                                                case 'ical': 
    28672931                                                        $content_type = "calendar; method=$method; name=calendar.ics"; 
    2868 /* would be nice, need to get it working 
    2869                                                         if ($body != '') 
     2932/*                                                      if ($body != '') 
    28702933                                                        { 
    28712934                                                                $boundary = '----Message-Boundary'; 
     
    28822945                                                        break; 
    28832946                                        } 
     2947                                        $mail->AddAddress(implode(",",$to));     
     2948                                        $mail->Body = $tmpbody; 
     2949                                        $mail->From = $sender; 
     2950                                        $mail->FromName = $GLOBALS['phpgw_info']['user']['fullname']; 
     2951                                        $mail->Sender = $mail->From; 
     2952                                        $mail->SenderName = $mail->FromName; 
     2953                                        $mail->Subject = $subject; 
     2954                                         
    28842955                                         
    28852956                                        //It sends email for the participants ( Envia email para os participantes) 
    2886                                          
    2887                                         $returncode = $send->msg('email',$to,$subject,$tmpbody,''/*$msgtype*/,'','','',$sender, $content_type/*,$boundary*/); 
     2957                                        if(!$mail->Send()) 
     2958                                        { 
     2959                                                $returncode=false; 
     2960                                        } 
     2961                                        else 
     2962                                        { 
     2963                                                $returncode=true; 
     2964                                        } 
     2965                                                                 
     2966                                        //$returncode = $send->msg('email',$to,$subject,$tmpbody,''/*$msgtype*/,'','','',$sender, $content_type/*,$boundary*/); 
    28882967 
    28892968                                 
    28902969                                        unset($vardata5); 
    28912970                                        unset($vardata6); 
    2892                                         //echo "<b><p>send(to='$to', sender='$sender'<br>subject='$subject') returncode=$returncode<br>".nl2br($body)."</p></b>\n"; 
    28932971                                        if (!$returncode)       // not nice, but better than failing silently 
    28942972                                        { 
    28952973                                                echo '<p><b>bocalendar::send_update</b>: '.lang("Failed sending message to '%1' #%2 subject='%3', sender='%4' !!!",$to,$userid,htmlspecialchars($subject), $sender)."<br>\n"; 
    2896                                                 echo '<i>'.$send->err['desc']."</i><br>\n"; 
     2974                                                echo '<i>'.$mail->ErrorInfo."</i><br>\n"; 
    28972975                                                echo lang('This is mostly caused by a not or wrongly configured SMTP server. Notify your administrator.')."</p>\n"; 
    28982976                                                echo '<p>'.lang('Click %1here%2 to return to the calendar.','<a href="'.$GLOBALS['phpgw']->link('/calendar/').'">','</a>')."</p>\n"; 
     
    29072985                                        $details['enddate']   = $GLOBALS['phpgw']->common->show_date($endtime); 
    29082986                                        list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2); 
    2909                                         $subject = $send->encode_subject($subject); 
    29102987                                } 
    29112988                                foreach($var as $index => $ex_participant){ 
     
    29152992                                                        $to[] = $ex_participant; 
    29162993                                } 
    2917                                 $to = implode(",",$to); 
     2994                                $mail->AddAddress(implode(",",$to)); 
    29182995                                $_body = explode("<hr size='1' width='100%'>",$tmpbody); 
    29192996                                $tmpbody = $_body[0]; 
    29202997                                $tmpbody.= "<b>".lang("external participants").":: </b> ".htmlentities($this->ex_participants); 
     2998                                $tmpbody.= "<br>".lang("Summary").": ".$this->so->cal->event[title]."<br>"; 
     2999                                $tmpbody.= "<br>".lang("Start date").": ".$GLOBALS['phpgw']->common->show_date($starttime)."<br>".lang("End date").": ".$GLOBALS['phpgw']->common->show_date($endtime)."<br>"; 
    29213000                                $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>"; 
    2922                                 $returncode = $send->msg('email', '', $subject, $tmpbody, '', '', $to, '', $sender, $content_type); 
    2923                         } 
    2924  
    2925                         unset($send); 
     3001                         
     3002                                //attach extern vcard                    
     3003                                // define('context','$GLOBALS.bocalendar.so.cal.event'); 
     3004                                $tmpattach = $this->create_vcard($GLOBALS['bocalendar']->so->cal->event); 
     3005                                $tempdir = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP; 
     3006                                srand((double)microtime()*1000000); 
     3007                                $random_number = rand(100000000,999999999); 
     3008                                $newfilename = md5(time() . getenv("REMOTE_ADDR") . $random_number ); 
     3009                                $filename = $tempdir . $newfilename; 
     3010                                $attach_fd = fopen($filename,"w+"); 
     3011                                fwrite($attach_fd,$tmpattach); 
     3012                                $mail->AddAttachment($filename, "extern.vcard", "base64", "text/plain"); // "application/octet-stream" 
     3013                                fclose($attach_fd); 
     3014                                $mail->From = $sender; 
     3015                                $mail->FromName = lang("Expresso external user").": ".$GLOBALS['phpgw_info']['user']['fullname']; 
     3016                                $mail->Sender = $mail->From; 
     3017                                $mail->SenderName = $mail->FromName; 
     3018                                $mail->Subject = lang("External event from Expresso"); 
     3019                                $mail->Body = $tmpbody; 
     3020                                 
     3021                                if(!$mail->Send()) 
     3022                                { 
     3023                                        $returncode=false; 
     3024                                } 
     3025                                else 
     3026                                { 
     3027                                        $returncode=true; 
     3028                                } 
     3029                        } 
     3030 
    29263031 
    29273032                        if((is_int($this->user) && $this->user != $temp_user['account_id']) || 
  • trunk/calendar/inc/class.uialarm.inc.php

    r23 r29  
    136136                                if ($alarm_time <= time()) 
    137137                                { 
    138                                         echo "Alarm is older than now!!!"; 
     138                                        echo lang('Alarm is older than now!!!'); 
    139139                                        $GLOBALS['phpgw']->common->phpgw_exit(True); 
    140140                                } 
  • trunk/calendar/inc/class.uicalendar.inc.php

    r24 r29  
    10041004                function export($vcal_id=0) 
    10051005                { 
    1006                         if(!isset($_POST['cal_id']) || !$_POST['cal_id']) 
    1007                         { 
    1008                                 Header('Location: '.$this->index()); 
    1009                                 $GLOBALS['phpgw']->common->phpgw_exit(); 
    1010                         } 
    1011                         $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
    1012                         $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
    1013                         if(!isset($_POST['output_file']) || !$_POST['output_file']) 
    1014                         { 
    1015                                 unset($GLOBALS['phpgw_info']['flags']['noheader']); 
    1016                                 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
    1017                                 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Export'); 
    1018                                 $GLOBALS['phpgw']->common->phpgw_header(); 
    1019  
    1020                                 $p = $GLOBALS['phpgw']->template; 
    1021                                 $p->set_file( 
    1022                                         Array( 
    1023                                                 'form_button'   => 'form_button_script.tpl' 
    1024                                         ) 
    1025                                 ); 
    1026                                 $var = Array( 
    1027                                         'action_url_button'     => $this->page('export'), 
    1028                                         'action_text_button'    => lang('Submit'), 
    1029                                         'action_confirm_button' => '', 
    1030                                         'action_extra_field'    => "\n".lang('Enter Output Filename: ( .vcs appended )')."\n".'   <input name="output_file" size="25" maxlength="80" value="">'."\n" 
    1031                                                 . '   <input type="hidden" name="cal_id" value="'.$_POST['cal_id'].'">' 
    1032                                 ); 
    1033                                 $p->set_var($var); 
    1034                                 echo $p->fp('out','form_button'); 
    1035                         } 
    1036                         else 
    1037                         { 
    1038                                 $output_file = $_POST['output_file'].'.vcs'; 
    1039                                 $vfs = CreateObject('phpgwapi.vfs'); 
    1040 //                              if(!$vfs->file_exists('.calendar',array(RELATIVE_USER))) 
    1041 //                              { 
    1042 //                                      $vfs->mkdir('.calendar',array(RELATIVE_USER)); 
    1043 //                              } 
    1044  
    1045                                 $content = ExecMethod('calendar.boicalendar.export', Array( 
    1046                                         'l_event_id' => $_POST['cal_id'], 
    1047                                         'chunk_split' => False, 
    1048                                 )); 
    1049  
    1050                                 $vfs->cd(array( 
    1051                                         'string' => '/', 
    1052                                         'relatives' => array(RELATIVE_USER) 
    1053                                 )); 
    1054                                 $vfs->write(array( 
    1055                                         'string' => $output_file, 
    1056                                         'relatives' => array (RELATIVE_USER), 
    1057                                         'content' => $content 
    1058                                 )); 
    1059  
    1060                                 if($this->debug) 
    1061                                 { 
    1062                                         echo '<!-- DEBUG: Output Filename = '.$output_file.' -->'."\n"; 
    1063                                         echo '<!-- DEBUG: Fakebase = '.$vfs->fakebase.' -->'."\n"; 
    1064                                         echo '<!-- DEBUG: Path = '.$vfs->pwd().' -->'."\n"; 
    1065                                 } 
    1066                                 if ($this->bo->return_to) 
    1067                                 { 
    1068                                         $GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->bo->return_to); 
    1069                                 } 
    1070                                 else 
    1071                                 { 
    1072                                         $GLOBALS['phpgw']->redirect($this->index()); 
    1073                                 } 
    1074                                 $GLOBALS['phpgw']->common->phpgw_exit(); 
    1075                         } 
     1006                         
     1007                        $temp_path = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP; 
     1008                        srand((double)microtime()*1000000); 
     1009                        $random_number = rand(100000000,999999999); 
     1010                        $newfilename = md5(time() . getenv("REMOTE_ADDR") . $random_number ); 
     1011                        $filename = $temp_path . $newfilename; 
     1012                        $attach_fd = fopen($filename,"w+"); 
     1013                        $cal_id = get_var('cal_id',array('GET','POST'),$vcal_id); 
     1014                        $event = $this->bo->read_entry($cal_id); 
     1015                        include_once('class.bocalendar.inc.php'); 
     1016                        $cal = new bocalendar; 
     1017                        $tmpattach=$cal->create_vcard($event); 
     1018                        fwrite($attach_fd,$tmpattach); 
     1019                        header ("Content-Type: text/plain");  
     1020                        header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
     1021                        header('Content-Length: ' . filesize($filename)); 
     1022                        header("Content-disposition: attachment; filename="."export.vcard"); 
     1023                        readfile($filename); 
     1024                        fclose($attach_fd); 
    10761025                } 
    10771026 
Note: See TracChangeset for help on using the changeset viewer.