Changeset 29 for trunk/calendar
- Timestamp:
- 05/29/07 14:06:42 (17 years ago)
- Location:
- trunk/calendar
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/doc/change_log.txt
r23 r29 2 2 módulo Agenda de Eventos, e a partir da versão 29/11/2006 [0.9.17] 3 3 Nilton Emilio Buhrer Neto. 4 5 22/05/2007 - [0.9.2] 6 - Adicionando/corrigindo funcionalidade de exportar vcard de todos os eventos 7 8 22/05/2007 - [0.9.2] 9 - Adicionando funcionalidade de exportar vcard de eventos externos 4 10 5 11 03/05/2007 - [0.9.2] -
trunk/calendar/inc/class.bocalendar.inc.php
r2 r29 2495 2495 } 2496 2496 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 2497 2550 /*! 2498 2551 @function send_update … … 2520 2573 2521 2574 $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']; 2523 2576 2524 2577 $temp_tz_offset = $this->prefs['common']['tz_offset']; … … 2638 2691 $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send'); 2639 2692 } 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 2641 2707 // Aqui é enviado o email 2642 2643 2708 foreach($to_notify as $userid => $statusid) 2644 2709 { … … 2688 2753 2689 2754 list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2); 2690 $subject = $send->encode_subject($subject);2691 2755 2692 2756 switch($part_prefs['calendar']['update_format']) … … 2861 2925 $body->set_var($var); 2862 2926 $tmpbody = $body->fp('out','list'); 2863 2927 2864 2928 break; 2865 2929 2866 2930 case 'ical': 2867 2931 $content_type = "calendar; method=$method; name=calendar.ics"; 2868 /* would be nice, need to get it working 2869 if ($body != '') 2932 /* if ($body != '') 2870 2933 { 2871 2934 $boundary = '----Message-Boundary'; … … 2882 2945 break; 2883 2946 } 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 2884 2955 2885 2956 //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*/); 2888 2967 2889 2968 2890 2969 unset($vardata5); 2891 2970 unset($vardata6); 2892 //echo "<b><p>send(to='$to', sender='$sender'<br>subject='$subject') returncode=$returncode<br>".nl2br($body)."</p></b>\n";2893 2971 if (!$returncode) // not nice, but better than failing silently 2894 2972 { 2895 2973 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"; 2897 2975 echo lang('This is mostly caused by a not or wrongly configured SMTP server. Notify your administrator.')."</p>\n"; 2898 2976 echo '<p>'.lang('Click %1here%2 to return to the calendar.','<a href="'.$GLOBALS['phpgw']->link('/calendar/').'">','</a>')."</p>\n"; … … 2907 2985 $details['enddate'] = $GLOBALS['phpgw']->common->show_date($endtime); 2908 2986 list($subject,$body1) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2); 2909 $subject = $send->encode_subject($subject);2910 2987 } 2911 2988 foreach($var as $index => $ex_participant){ … … 2915 2992 $to[] = $ex_participant; 2916 2993 } 2917 $ to = implode(",",$to);2994 $mail->AddAddress(implode(",",$to)); 2918 2995 $_body = explode("<hr size='1' width='100%'>",$tmpbody); 2919 2996 $tmpbody = $_body[0]; 2920 2997 $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>"; 2921 3000 $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 2926 3031 2927 3032 if((is_int($this->user) && $this->user != $temp_user['account_id']) || -
trunk/calendar/inc/class.uialarm.inc.php
r23 r29 136 136 if ($alarm_time <= time()) 137 137 { 138 echo "Alarm is older than now!!!";138 echo lang('Alarm is older than now!!!'); 139 139 $GLOBALS['phpgw']->common->phpgw_exit(True); 140 140 } -
trunk/calendar/inc/class.uicalendar.inc.php
r24 r29 1004 1004 function export($vcal_id=0) 1005 1005 { 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); 1076 1025 } 1077 1026
Note: See TracChangeset
for help on using the changeset viewer.