caldav::calendars proc get_cal_item_from_uid (public)
caldav::calendarsget_cal_item_from_uid [ -calendar_ids calendar_ids ] \ uid
Defined in packages/xotcl-core/tcl/01-debug-procs.tcl
- Switches:
- -calendar_ids (optional, integer)
- Parameters:
- uid (required)
- unique id of an calendar item
- Returns:
- for a uid the cal_item_id(s?)
- Testcases:
- No testcase defined.
Source code: # @return for a uid the cal_item_id(s?) # @param uid unique id of an calendar item # # GN TODO: # # - document, why and how the or test "e.activity_id = :uid" is # needed this looks like a hack, since the UID can be modified # by a calendar client, we can't assume that this is the same # as some OpenACS id. # # - when the uid refers to a recurrence item, multiple # cal_item_ids are returned. (a) is this needed (maybe limit # 1 is sufficient)? (b) is this handled everywhere # correctly? (c) if needed, name should be change to # get_cal_items_from_uid # # - HOW ABOUT using activity_id instead of the cal_item_id... such as get_activity_from_uid # # - probably base on get_calendar_and_cal_item_from_uid # # if {[llength $calendar_ids] > 1} { set calclause "in ( [ns_dbquotelist $calendar_ids] )" } elseif {[llength $calendar_ids] eq 0} { return 0 } else { set calclause "= :calendar_ids" } set e_clause [expr {[nsf::is integer $uid] ? " or e.activity_id = :uid" : ""}] return [::xo::dc list get_cal_item_from_uid [subst { select cal_item_id from cal_items c, acs_events e left outer join cal_uids u on u.on_which_activity = e.activity_id where c.cal_item_id = e.event_id and ( u.cal_uid = :uid $e_clause ) and c.on_which_calendar $calclause order by 1 desc }]]XQL Not present: Generic, PostgreSQL, Oracle