caldav::calitem method as_ical_event (public)

 <instance of caldav::calitem[i]> as_ical_event

Defined in packages/caldav/tcl/caldav-item-procs.tcl

Output a ::caldav::calitem into ical VEVENT notation. It differs from standard as_ical in the following aspects: - it hard-codes the item_type to VEVENT - it handles the VALARM block handed in via ical_vars TODO: probably not the best way. - it imports the attributes of the ical_vars into instance attributes. TODO: this is dangerous - it flags entries as all day events

Testcases:
No testcase defined.
Source code:
set extra_block ""
foreach {tag param value} ${:ical_vars} {
    #:debug "attribute $tag value <$value>"
    
    if {$tag eq "OPAQUE-VALARM"} {
        #
        # This is a full block, already correctly encoded
        
        append extra_block $value
        
    } else {
        #
        # standard case
        #
        append extra_block  [:tag -tag $tag -param $param -value $value ""]
    }
}

#
# Check for all day events (start time and end time are
# equal) and convert them
#
if {${:dtstart} eq ${:dtend}
    && [clock format [clock scan ${:dtstart}] -format %H%M] eq "0000"
} {
    set :is_day_item true
    :debug "this is an all day event ${:dtstart}"
} else {
    :debug "no day event ${:dtstart} ${:dtend} SCAN [clock format [clock scan ${:dtstart}] -format %H%M]"
}
return "BEGIN:VEVENT\r\n[:ical_body]${extra_block}END:VEVENT\r\n"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: