caldav::get_sync_calendar (private)
caldav::get_sync_calendar -user_id user_id
Defined in packages/caldav/tcl/caldav-procs.tcl
Get the calendar, to which we want to sync. This method returns the first (and only in usual installations) calendar_id if it is found.
- Switches:
- -user_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- get_calitems
Source code: set calendar_id [ns_cache_eval ns:memoize caldav-sync-cal-$user_id ::xo::dc list get_sync_calendar { select calendar_id from calendars where private_p = 't' and owner_id = :user_id }] if {[llength $calendar_id] > 1} { # # In general, there is no rule which states that there is # for a user just a single private calendar. However, in # typical installations, this is the case for "normal" # users. In case there are multiple such calendars, return # the first a sync calendar and issue a warning. Probably, # such cases should be fixed manually in the database. # ns_log warning "CalDAV: more than one sync calendar for user $user_id ($calendar_id);" "fall back to first one" set calendar_id [lindex $calendar_id 0] } elseif {[llength $calendar_id] == 0} { # # On non-DotLRN installations, the private calendar is # created when a user visits the first time the calendar # package, and no personal calendar exists. Bail out if # no such calendar exists. # error "can't get sync calendar for user $user_id" } return $calendar_idXQL Not present: Generic, PostgreSQL, Oracle