Class ::xowiki::formfield::event
::xowiki::formfield::event
create ...
Class Relations
- class: ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xowiki::formfield::CalendarField
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xowiki::formfield::event \
-superclass ::xowiki::formfield::CalendarField
Methods (to be applied on instances)
convert_to_internal (scripted)
if {[info exists :calendar]} {
if {[info commands ::calendar::item::new] eq ""} {
error "the calendar package is not available"
}
set calendar_id ""
if {[nsf::is integer ${:calendar}]} {
set calendar_id ${:calendar}
if {[calendar::name $calendar_id] eq ""} {
set calendar_id ""
}
}
if {$calendar_id eq ""} {
error "calendar '${:calendar} has no valid calendar_id"
}
set dtstart_val [[:get_component dtstart] value]
set dtend_val [[:get_component dtend] value]
set title_val [[:get_component title] value]
set title_val [[:get_component title] value]
set summary_val [[:get_component summary] value]
set cal_item_id [[:get_component cal_item_id] value]
if {$cal_item_id ne ""} {
if {![acs_object::object_p -id $cal_item_id]} {
set cal_item_id ""
} else {
acs_object::get -object_id $cal_item_id -array row
if {$row(object_type) ne "cal_item"} {
ns_log warning "event: the associated entry $cal_item_id is not a calendar item, ignore the old association"
set cal_item_id ""
}
}
}
set queue ::__xowiki__transaction_queue([${:object} item_id])
lappend $queue [list [self] update_calendar -cal_item_id $cal_item_id -calendar_id $calendar_id -start $dtstart_val -end $dtend_val -name $title_val -description $summary_val]
}
nextget_compound_value (scripted)
if {![info exists :__initialized]} {
return ""
}
set dtstart [:get_component dtstart]
set dtend [:get_component dtend]
if {!${:multiday}} {
set end_day [lindex [$dtstart value] 0]
set end_time [lindex [$dtend value] 1]
$dtend value "$end_day $end_time"
}
nextinitialize (scripted)
if {${:__state} ne "after_specs"} return
set :widget_type event
if {${:multiday}} {
set dtend_format DD_MONTH_YYYY_#xowiki.event-hour_prefix#_HH24_MI
set dtend_display_format %Q_%X
} else {
set dtend_format HH24_MI
set dtend_display_format %X
}
:create_components [subst {
{title {text,label=#xowiki.event-title_of_event#}}
{summary {richtext,height=150px,label=#xowiki.event-summary_of_event#}}
{dtstart {date,required,format=DD_MONTH_YYYY_#xowiki.event-hourprefix#_HH24_MI,
default=now,label=#xowiki.event-start_of_event#,display_format=%Q_%X}}
{dtend date,format=$dtend_format,default=now,label=#xowiki.event-end_of_event#,display_format=$dtend_display_format}
{location text,label=#xowiki.event-location#}
{cal_item_id hidden}
}]
set :__initialized 1pretty_value (scripted)
set dtstart [:get_component dtstart]
set dtstart_val [$dtstart value]
set dtstart_iso [::xo::ical clock_to_iso [clock scan $dtstart_val]]
set dtstart_pretty [$dtstart pretty_value $dtstart_val]
set dtend [:get_component dtend]
set dtend_val [$dtend value]
set dtend_txt ""
if {$dtend_val ne ""} {
set dtend_iso [::xo::ical clock_to_iso [clock scan $dtend_val]]
set dtend_txt " - <time class='dt-end' title='$dtend_iso'>[$dtend pretty_value $dtend_val]</time>"
}
set time_label [:time_label]
if {[regexp {^#([a-zA-Z0-9_:-]+\.[a-zA-Z0-9_:-]+)#$} $time_label _ msg_key]} {
set time_label [lang::message::lookup [:locale] $msg_key]
}
set title_val [[:get_component title] value]
if {$title_val eq ""} {
set title_val [${:object} property _title]
}
set summary_val [[:get_component summary] value]
set location [:get_component location]
set location_val [$location value]
set location_txt ""
if {$location_val ne ""} {
set location_label [$location label]
if {[regexp {^#(.+)#$} $location_label _ msg_key]} {
set location_label [lang::message::lookup [:locale] $msg_key]
}
set location_txt "<tr><td>$location_label:</td><td><span class='p-location'>$location_val</span></td></tr>"
}
append result \n "<div class='h-event'>" \n "<h1 class=p-name>$title_val</h1>" \n "<p class='p-summary'>$summary_val</p>" "<br> " \n "<table>" \n "<tr><td>$time_label:</td><td><time class='dt-start' datetime='$dtstart_iso'>$dtstart_pretty</time> $dtend_txt</td></tr>" \n $location_txt \n "</table>" \n "</div>" \n
return $result