読書記録ChangeLog

日記内を検索 / / / ランダム RSS

2006-05-11 / 日本時間でGoogle Calenderに予定を追加可能なリンクボタン作成機能 /

http://kengo.preston-net.com/archives/002604.shtml

Add Google Calendar | WWW WACTHなら日本時間でのイベント追加に対応しています。


▼Add Google Calendar
http://hyper-text.org/archives/2006/05/add_google_calendar.shtml

▼Google Calendar
http://www.google.com/googlecalendar/event_publisher_guide.html

dates (required)

Date and time of the event, in UTC format. Append a capitalized letter
"Z" to the end of times. Google Calendar will interpret the date and
time for the user's time zone.

dates=20060415/20060415
for all day, April 15th 2006

dates=20060415T180000Z/20060415T190000Z
for April 15th 2006 11:00am - noon Pacific Time

Zを入れなければユーザのタイムゾーンで登録されるのね。

しょぼいけどこんな感じかしら。

sub google_calendar {
  my ($text,$dates,$details,$location) = @_;
  my $prefix = qq(http://www.google.com/calendar/event);

  my $enc_text = Jcode->new($text)->utf8;
  $enc_text =~ s/([^0-9a-z_ ])/'%'.unpack('H2', $1)/gei;
  $enc_text =~ s/\s/+/g;

  my $enc_details = Jcode->new($details)->utf8;
  $enc_details =~ s/([^0-9a-z_ ])/'%'.unpack('H2', $1)/gei;
  $enc_details =~ s/\s/+/g;

  my $enc_location = Jcode->new($location)->utf8;
  $enc_location =~ s/([^0-9a-z_ ])/'%'.unpack('H2', $1)/gei;
  $enc_location =~ s/\s/+/g;

  my $str = "action=TEMPLATE" . "&text=" .$text . "&dates=" . $dates . "&details=" . $enc_details . "&location=" . $enc_location . "&trp=false";
  return qq(<a href="${prefix}?${str}">GoogleCalendar</a>);
}


google_calendar("イベント","20060515T090000/20060515T093000","詳細","場所");
GoogleCalendar

固定リンク [2006-05-11-3] このエントリーをはてなブックマークに追加 MM/memo投稿

[ コメント |

これまでの訪問者は 人です。