Index: openacs-4/packages/calendar/sql/cal-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/cal-item-create.sql,v diff -u -N --- openacs-4/packages/calendar/sql/cal-item-create.sql 23 Apr 2001 23:09:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,258 +0,0 @@ --- Create the cal_item object --- --- @author Gary Jin (gjin@arsdigita.com) --- @creation-date Nov 17, 2000 --- @cvs-id $Id: cal-item-create.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ --- - - - ----------------------------------------------------------- --- cal_item_ojbect ----------------------------------------------------------- - -begin - - acs_object_type.create_type ( - supertype => 'acs_event', - object_type => 'cal_item', - pretty_name => 'Calendar Item', - pretty_plural => 'Calendar Items', - table_name => 'cal_items', - id_column => 'cal_item_id' - ); - -end; -/ -show errors - - -declare - attr_id acs_attributes.attribute_id%TYPE; -begin - attr_id := acs_attribute.create_attribute ( - object_type => 'cal_item', - attribute_name => 'on_which_caledar', - pretty_name => 'On Which Calendar', - pretty_plural => 'On Which Calendars', - datatype => 'integer' - ); -end; -/ -show errors - - - -- Each cal_item has the super_type of ACS_EVENTS - -- Table cal_items supplies additional information -create table cal_items ( - -- primary key - cal_item_id integer - constraint cal_item_cal_item_id_fk - references acs_events - constraint news_item_news_item_id_pk - primary key, - -- a references to calendar - -- Each cal_item is owned by one calendar - on_which_calendar integer - constraint cal_item_which_cal_fk - references calendars - on delete cascade -); - -comment on table cal_items is ' - Table cal_items maps the ownership relation between - an cal_item_id to calendars. Each cal_item is owned - by a calendar -'; - -comment on column cal_items.cal_item_id is ' - Primary Key -'; - -comment on column cal_items.on_which_calendar is ' - Mapping to calendar. Each cal_item is owned - by a calendar -'; - - -------------------------------------------------------------- --- create package cal_item -------------------------------------------------------------- - - -create or replace package cal_item -as - function new ( - cal_item_id in cal_items.cal_item_id%TYPE default null, - on_which_calendar in calendars.calendar_id%TYPE , - name in acs_activities.name%TYPE default null, - description in acs_activities.description%TYPE default null, - timespan_id in acs_events.timespan_id%TYPE default null, - activity_id in acs_events.activity_id%TYPE default null, - recurrence_id in acs_events.recurrence_id%TYPE default null, - object_type in acs_objects.object_type%TYPE default 'cal_item', - context_id in acs_objects.context_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null - ) return cal_items.cal_item_id%TYPE; - - -- delete cal_item - procedure delete ( - cal_item_id in cal_items.cal_item_id%TYPE - ); - - -- functions to return the name of the cal_item - function name ( - cal_item_id in cal_items.cal_item_id%TYPE - ) return acs_activities.name%TYPE; - - -- functions to return the calendar that owns the cal_item - function on_which_calendar ( - cal_item_id in cal_items.cal_item_id%TYPE - ) return calendars.calendar_id%TYPE; - -end cal_item; -/ -show errors; - - - -create or replace package body cal_item -as - function new ( - cal_item_id in cal_items.cal_item_id%TYPE default null, - on_which_calendar in calendars.calendar_id%TYPE , - name in acs_activities.name%TYPE default null, - description in acs_activities.description%TYPE default null, - timespan_id in acs_events.timespan_id%TYPE default null, - activity_id in acs_events.activity_id%TYPE default null, - recurrence_id in acs_events.recurrence_id%TYPE default null, - object_type in acs_objects.object_type%TYPE default 'cal_item', - context_id in acs_objects.context_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null - ) return cal_items.cal_item_id%TYPE - - is - v_cal_item_id cal_items.cal_item_id%TYPE; - v_grantee_id acs_permissions.grantee_id%TYPE; - v_privilege acs_permissions.privilege%TYPE; - - begin - v_cal_item_id := acs_event.new ( - event_id => cal_item_id, - name => name, - description => description, - timespan_id => timespan_id, - activity_id => activity_id, - recurrence_id => recurrence_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); - - insert into cal_items - (cal_item_id, on_which_calendar) - values (v_cal_item_id, on_which_calendar); - - -- assign the default permission to the cal_item - -- by default, cal_item are going to inherit the - -- calendar permission that it belongs too. - - -- first find out the permissions. - --select grantee_id into v_grantee_id - --from acs_permissions - --where object_id = cal_item.new.on_which_calendar; - - --select privilege into v_privilege - --from acs_permissions - --where object_id = cal_item.new.on_which_calendar; - - -- now we grant the permissions - --acs_permission.grant_permission ( - -- object_id => v_cal_item_id, - -- grantee_id => v_grantee_id, - -- privilege => v_privilege - - --); - - return v_cal_item_id; - - end new; - - procedure delete ( - cal_item_id in cal_items.cal_item_id%TYPE - ) - is - - begin - -- Erase the cal_item assoicated with the id - delete from cal_items - where cal_item_id = cal_item.delete.cal_item_id; - - -- Erase all the privileges - delete from acs_permissions - where object_id = cal_item.delete.cal_item_id; - - acs_event.delete(cal_item_id); - end delete; - - -- functions to return the name of the cal_item - function name ( - cal_item_id in cal_items.cal_item_id%TYPE - ) - return acs_activities.name%TYPE - - is - v_name acs_activities.name%TYPE; - begin - select name - into v_name - from acs_activities - where activity_id = - ( - select activity_id - from acs_events - where event_id = cal_item.name.cal_item_id - ); - - return v_name; - end name; - - - -- functions to return the calendar that owns the cal_item - function on_which_calendar ( - cal_item_id in cal_items.cal_item_id%TYPE - ) - return calendars.calendar_id%TYPE - - is - v_calendar_id calendars.calendar_id%TYPE; - begin - select on_which_calendar - into v_calendar_id - from cal_items - where cal_item_id = cal_item.on_which_calendar.cal_item_id; - - return v_calendar_id; - end on_which_calendar; - -end cal_item; -/ -show errors; - - - - - - - - - - - - Index: openacs-4/packages/calendar/sql/cal-item-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/cal-item-drop.sql,v diff -u -N --- openacs-4/packages/calendar/sql/cal-item-drop.sql 23 Apr 2001 23:09:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,31 +0,0 @@ --- Drop the cal_item object and all related tables, --- views, and package --- --- @author Gary Jin (gjin@arsdigita.com) --- @creation-date Nov 17, 2000 --- @cvs-id $Id: cal-item-drop.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ --- - - ----------------------------------------------------------- --- drop cal_item ----------------------------------------------------------- - - -- drop attributes and acs_object_type -begin - acs_attribute.drop_attribute ('cal_item','on_which_calendar'); - acs_object_type.drop_type ('cal_item'); -end; -/ -show errors - - - -- drop package -drop package cal_item; - - - -- drop table -drop table cal_items; - - - Index: openacs-4/packages/calendar/sql/cal-table-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/cal-table-create.sql,v diff -u -N --- openacs-4/packages/calendar/sql/cal-table-create.sql 23 Apr 2001 23:09:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,139 +0,0 @@ --- Creates support tables and useful views for the calendar system --- --- @author Gary Jin (gjin@arsdigita.com) --- @creation-date Nov 30, 2000 --- @cvs-id $Id: cal-table-create.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ --- - - -------------------------------------------------------- --- Calendar Support Tables -------------------------------------------------------- - - -- Table cal_party_prefs stores customization information - -- for each calendar. These data are unique to each party. - -- This means that each party using the same calendar can - -- have a different look to it. -create table cal_party_prefs ( - -- refers to a particular calendar Id - calendar_id integer - constraint cal_pty_prefs_cal_id_fk - references calendars - on delete cascade, - -- Party Id - party_id integer - constraint cal_pty_prefs_party_id_fk - references parties - on delete cascade, - -- default_view stores whether the user wants - -- list, month, day, week, or year as his/her default view. - default_view varchar2(10) - default 'day' - constraint cal_pty_prefs_default_view_ck - check (default_view in ( - 'list', - 'day', - 'week', - 'month', - 'year' - ) - ), - -- the default number of minutes for each appointment - default_duration integer - default 60 - constraint cal_pty_prefs_default_duration - check (default_duration > 0), - -- the default starting time in daily view in military time 00 - 23 - daily_start number(2) - default 07 - constraint cal_pty_prefs_daily_start - check (daily_start < 24 and daily_start > -1), - -- the default ending time in daily view in military time 00 -23 - daily_end number(2) - default 18 - constraint cal_pty_prefs_daily_end - check (daily_end < 24 and daily_end > 0), - -- which time zone does the user belong to - time_zone integer - constraint cal_pty_prefs_time_zone_fk - references timezones - on delete cascade, - -- which day to start the week, monday or sunday - first_day_of_week varchar2(9) - default 'Sunday' - constraint cal_pty_prefs_1st_day_ck - check (first_day_of_week in ( - 'Sunday', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday' - ) - ), - -- unique constraint between calendar_id and party_id - -- this ensures that each party has only one set of - -- perferences per calendar - constraint cal_party_prefs_un unique(calendar_id, party_id) -); - - -comment on table cal_party_prefs is ' - Table cal_user_prefs would stores custom information - about each indivdual user. This would include time zone - which is the first day of the week, monday or sunday, - and the likes. -'; - -comment on column cal_party_prefs.party_id is ' - Maps to a party -'; - -comment on column cal_party_prefs.default_view is ' - default_view stores whether the user wants - list, month, day, week, or year as his/her default view. -'; - -comment on column cal_party_prefs.default_duration is ' - the default number of minutes for each appointment -'; - - -comment on column cal_party_prefs.daily_start is ' - the default start time in daily view in military time 00 - 23 - default to 07 or 7 am -'; - -comment on column cal_party_prefs.daily_end is ' - the default end time in daily view in military time 00 - 23 - default to 18 or 6 pm -'; - -comment on column cal_party_prefs.time_zone is ' - The time zone that the user is in. This is useful in sending out - reminders and other applications -'; - -comment on column cal_party_prefs.first_day_of_week is ' - Which day of the week will be displayed first in month and week view -'; - - - - - - - - - - - - - - - - - - - Index: openacs-4/packages/calendar/sql/cal-table-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/cal-table-drop.sql,v diff -u -N --- openacs-4/packages/calendar/sql/cal-table-drop.sql 23 Apr 2001 23:09:38 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,26 +0,0 @@ --- Drop the cal_item object and all related tables, --- views, and package --- --- @author Gary Jin (gjin@arsdigita.com) --- @creation-date Nov 17, 2000 --- @cvs-id $Id: cal-table-drop.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ --- - - ----------------------------------------------------------- --- Drop Support Table ----------------------------------------------------------- - -drop table cal_party_prefs; - - - - - - - - - - - -