calendar-procs.tcl

Utility functions for Calendar Applications

Location:
packages/calendar/tcl/calendar-procs.tcl
Created:
Dec 14, 2000
Authors:
Dirk Gomez <openacs@dirkgomez.de>
Gary Jin <gjin@arsdigita.com>
Ben Adida <ben@openforce.net>
CVS Identification:
$Id: calendar-procs.tcl,v 1.39.2.21 2023/06/06 14:37:01 antoniop Exp $

Procedures in this file

Detailed information

calendar::adjust_date (public, deprecated)

 calendar::adjust_date [ -date date ] [ -julian_date julian_date ]
Deprecated. Invoking this procedure generates a warning.

Switches:
-date (optional)
-julian_date (optional)
Returns:
the date if it is provided. Otherwise, the julian date in ANSI format, if provided, or the system date. DEPRECATED: this proc implements a trivial defaulting logic that can be inlined just as well.
See Also:

Testcases:
No testcase defined.

calendar::assign_permissions (public, deprecated)

 calendar::assign_permissions calendar_id party_id cal_privilege \
    [ revoke ]
Deprecated. Invoking this procedure generates a warning.

Given a calendar_id, party_id and a permission this proc will assign the permission to the party the legal permissions are: public, private, calendar_read, calendar_write, calendar_delete If the revoke is set, then the given permission will be removed for the party. DEPRECATED: this api is a trivial wrapper to the permission api

Parameters:
calendar_id (required)
party_id (required)
cal_privilege (required)
revoke (optional)
See Also:

Testcases:
No testcase defined.

calendar::attachments_enabled_p (public)

 calendar::attachments_enabled_p [ -package_id package_id ]
Switches:
-package_id (optional)
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.
Returns:
1 if the attachments are enabled, otherwise 0.

Testcases:
attachments_enabled

calendar::calendar_list (public)

 calendar::calendar_list [ -package_id package_id ] \
    [ -user_id user_id ] [ -privilege privilege ]
Switches:
-package_id (optional)
-user_id (optional)
-privilege (optional)
Returns:
a list of calendars

Testcases:
cal_item_add_delete

calendar::compare_day_items_by_current_hour (private)

 calendar::compare_day_items_by_current_hour a b

Compare a day item by the current hour (field 0). This is needed by the one-day view for sorting.

Parameters:
a (required)
b (required)

Testcases:
No testcase defined.

calendar::create (public)

 calendar::create owner_id private_p [ calendar_name ]

Create a new calendar.

Parameters:
owner_id (required)
private_p (required)
defaults to true since the default calendar is a private calendar.
calendar_name (optional)

Testcases:
get_calitems, cal_item_edit_recurrence, cal_item_add_delete

calendar::delete (public)

 calendar::delete -calendar_id calendar_id

Delete a calendar

Switches:
-calendar_id (required)

Testcases:
cal_item_add_delete, calendar_basic_api

calendar::do_notifications (public)

 calendar::do_notifications -mode mode -cal_item_id cal_item_id

Perform the notifications

Switches:
-mode (required)
-cal_item_id (required)

Testcases:
cal_item_add_delete

calendar::from_sql_datetime (public, deprecated)

 calendar::from_sql_datetime -sql_date sql_date -format format
Deprecated. Invoking this procedure generates a warning.

Converts a date in a specified format into a templating date dict.

Switches:
-sql_date (required)
a date in one of the supported format.
-format (required)
one of the supported format, "YYYY-MM-DD", "HH12:MIam" or "HH24:MI". When unspecified or invalid, we will try to treat the date as an ansi date. DEPRECATED: this api has been superseded by api in acs-templating.
See Also:

Testcases:
No testcase defined.

calendar::get (public)

 calendar::get -calendar_id calendar_id [ -array array ]

Get calendar info

Switches:
-calendar_id (required)
-array (optional)

Testcases:
calendar_basic_api

calendar::get_item_types (public)

 calendar::get_item_types -calendar_id calendar_id

return the item types

Switches:
-calendar_id (required)

Testcases:
calendar_basic_api

calendar::get_month_multirow_information (private)

 calendar::get_month_multirow_information -current_day current_day \
    -today_julian_date today_julian_date \
    -first_julian_date_of_month first_julian_date_of_month

Builds a multirow with information about the month. Used to display the month calendar view.

Switches:
-current_day (required)
-today_julian_date (required)
-first_julian_date_of_month (required)
Author:
Dirk Gomez <openacs@dirkgomez.de>
Created:
20-July-2003

Testcases:
No testcase defined.

calendar::have_private_p (public)

 calendar::have_private_p [ -return_id return_id ] \
    [ -calendar_id_list calendar_id_list ] [ -party_id party_id ]

Check to see if the user has a private calendar. When the provided -return_id is 1, then proc will return the calendar_id

Switches:
-return_id (optional, defaults to "0")
when set to 1, this proc will return the calendar_id
-calendar_id_list (optional)
If you supply the calendar_id_list, then we'll only search for a personal calendar among the calendars supplied here.
-party_id (optional, defaults to "party_id")
Returns:
boolean or the calendar_id according to 'return_id' flag.

Testcases:
cal_item_add_delete

calendar::item_type_delete (public)

 calendar::item_type_delete -calendar_id calendar_id \
    -item_type_id item_type_id

Delete an item type

Switches:
-calendar_id (required)
-item_type_id (required)

Testcases:
calendar_basic_api

calendar::item_type_new (public)

 calendar::item_type_new -calendar_id calendar_id \
    [ -item_type_id item_type_id ] -type type

creates a new item type

Switches:
-calendar_id (required)
-item_type_id (optional)
-type (required)

Testcases:
calendar_basic_api

calendar::make_datetime (public, deprecated)

 calendar::make_datetime event_date [ event_time ]
Deprecated. Invoking this procedure generates a warning.

given a date, and a time, construct the proper date string to be imported into oracle. (yyyy-mm-dd hh24:mi format)s DEPRECATED: clock idioms and HTML5 feature make this date conversion api less useful

Parameters:
event_date (required)
event_time (optional)
See Also:
  • clock

Testcases:
No testcase defined.

calendar::name (public)

 calendar::name calendar_id

Return a calendar's name

Parameters:
calendar_id (required)

Testcases:
calendar_basic_api

calendar::new (public)

 calendar::new -owner_id owner_id [ -private_p private_p ] \
    -calendar_name calendar_name [ -package_id package_id ]

Create a new calendar

Switches:
-owner_id (required)
-private_p (optional, defaults to "f")
-calendar_name (required)
-package_id (optional)
Returns:
the new calendar_id

Testcases:
calendar_basic_api

calendar::notification::get_url (public)

 calendar::notification::get_url object_id
Parameters:
object_id (required)
Returns:
a full URL to the object_id

Testcases:
cal_item_add_delete

calendar::personal_p (public)

 calendar::personal_p -calendar_id calendar_id [ -user_id user_id ]
Switches:
-calendar_id (required)
-user_id (optional)
The user whose calendar you want to check
Returns:
true (1) if this is the user's personal calendar, false (0) otherwise.

Testcases:
cal_item_add_delete

calendar::rename (public)

 calendar::rename -calendar_id calendar_id -calendar_name calendar_name

rename a calendar

Switches:
-calendar_id (required)
-calendar_name (required)

Testcases:
calendar_basic_api

calendar::to_sql_datetime (public, deprecated)

 calendar::to_sql_datetime -date date -time time [ -time_p time_p ]
Deprecated. Invoking this procedure generates a warning.

This takes two date chunks, one for date one for time, and combines them correctly. The issue here is the incoming format. date: ANSI SQL YYYY-MM-DD time: we return HH24. DEPRECATED: this api has been superseded by api in acs-templating.

Switches:
-date (required)
-time (required)
-time_p (optional, defaults to "1")
See Also:

Testcases:
No testcase defined.
[ show source ]