Index: openacs-4/packages/calendar/tcl/cal-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.tcl,v
diff -u -N -r1.35.2.8 -r1.35.2.9
--- openacs-4/packages/calendar/tcl/cal-item-procs.tcl 15 Feb 2023 14:52:49 -0000 1.35.2.8
+++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 24 Feb 2023 12:53:08 -0000 1.35.2.9
@@ -148,15 +148,14 @@
upvar $array row
}
- set attachments_enabled_p [calendar::attachments_enabled_p]
+ db_1row select_item_data {} -column_array row
- if { $attachments_enabled_p } {
- set query_name select_item_data_with_attachment
- } else {
- set query_name select_item_data
+ if {[calendar::attachments_enabled_p -package_id $row(calendar_package_id)]} {
+ set row(n_attachments) [db_string count_attachments {
+ select count(*) from attachments where object_id = :cal_item_id
+ }]
}
- db_1row $query_name {} -column_array row
if {$normalize_time_to_utc} {
set row(start_date_ansi) [lc_time_local_to_utc $row(start_date_ansi)]
set row(end_date_ansi) [lc_time_local_to_utc $row(end_date_ansi)]
Index: openacs-4/packages/calendar/tcl/cal-item-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.xql,v
diff -u -N -r1.11.2.1 -r1.11.2.2
--- openacs-4/packages/calendar/tcl/cal-item-procs.xql 25 Jan 2022 14:00:42 -0000 1.11.2.1
+++ openacs-4/packages/calendar/tcl/cal-item-procs.xql 24 Feb 2023 12:53:08 -0000 1.11.2.2
@@ -53,49 +53,6 @@
-
-
- select
- i.cal_item_id,
- (select count(*) from attachments where object_id = cal_item_id) as n_attachments,
- to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as start_date_ansi,
- to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as end_date_ansi,
- coalesce(e.name, a.name) as name,
- coalesce(e.description, a.description) as description,
- recurrence_id,
- i.item_type_id,
- it.type as item_type,
- on_which_calendar as calendar_id,
- c.calendar_name,
- o.creation_user,
- c.package_id as calendar_package_id,
- e.related_link_url,
- e.related_link_text,
- e.redirect_to_rel_link_p,
- e.location,
- e.related_link_url,
- e.related_link_text,
- e.redirect_to_rel_link_p
- from
- acs_events e join timespans s
- on (e.timespan_id = s.timespan_id)
- join time_intervals t
- on (s.interval_id = t.interval_id)
- join acs_activities a
- on (e.activity_id = a.activity_id)
- join cal_items i
- on (e.event_id = i.cal_item_id)
- left join cal_item_types it
- on (it.item_type_id = i.item_type_id)
- left join calendars c
- on (c.calendar_id = i.on_which_calendar)
- left join acs_objects o
- on (o.object_id = i.cal_item_id)
- where
- e.event_id = :cal_item_id
-
-
-
update acs_events set
Index: openacs-4/packages/calendar/tcl/calendar-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-procs.tcl,v
diff -u -N -r1.39.2.17 -r1.39.2.18
--- openacs-4/packages/calendar/tcl/calendar-procs.tcl 15 Feb 2023 15:31:42 -0000 1.39.2.17
+++ openacs-4/packages/calendar/tcl/calendar-procs.tcl 24 Feb 2023 12:53:08 -0000 1.39.2.18
@@ -497,12 +497,29 @@
}
}
-ad_proc -public calendar::attachments_enabled_p {} {
+ad_proc -public calendar::attachments_enabled_p {
+ -package_id
+} {
+ @param package_id the package_id, assumed to belong to a calendar
+ package instance. When not specified, we will
+ determine the package from the connection. When
+ no package can be determined, this proc will
+ return 0.
+
@return 1 if the attachments are enabled, otherwise 0.
} {
+ if {![info exists package_id]} {
+ if {[ns_conn isconnected]} {
+ set package_id [ad_conn package_id]
+ } else {
+ ad_log warning "Cannot determine package_id. Returning 0"
+ return 0
+ }
+ }
+
return [site_node_apm_integration::child_package_exists_p \
+ -package_id $package_id \
-package_key attachments]
- #return [parameter::get -parameter Attachments -default 0]
}
ad_proc -public calendar::rename {