Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/calendar.info 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,69 @@ + + + + + Calendar + Calendars + f + + + + oracle-8.1.6 + + Gary Jin + Calendar system + ArsDigita Corporation + Calendar System + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/cal-item-create.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,258 @@ +-- 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/cal-item-drop.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,31 @@ +-- 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/cal-table-create.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,139 @@ +-- 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/cal-table-drop.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,26 @@ +-- 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; + + + + + + + + + + + + Index: openacs-4/packages/calendar/sql/calendar-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/calendar-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/calendar-create.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,624 @@ +-- creates the calendar object +-- +-- @author Gary Jin (gjin@arsdigita.com) +-- @creation-date Nov 17, 2000 +-- @cvs-id $Id: calendar-create.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ +-- + +------------------------------------------------------------------ +-- calendar system permissions +------------------------------------------------------------------ + + -- creating the basic set of permissions for cal_item + -- + -- 1 create: create an new item + -- 2. read: can view the cal_item + -- 3. write: edit an existing cal_item + -- 4. delete: can delete the cal_item + -- 5. invite: can allow other parties to view or edit the cal_item +begin + acs_privilege.create_privilege('cal_item_create', 'Add an new item'); + acs_privilege.create_privilege('cal_item_read', 'view an cal_item'); + acs_privilege.create_privilege('cal_item_write', 'Edit an exsiting cal_item'); + acs_privilege.create_privilege('cal_item_delete', 'Delete cal_item' ); + acs_privilege.create_privilege('cal_item_invite', 'Allow others to view cal_item'); + + -- bind the calendar permissions to the golbal names + + acs_privilege.add_child('create', 'cal_item_create'); + acs_privilege.add_child('read', 'cal_item_read'); + acs_privilege.add_child('write', 'cal_item_write'); + acs_privilege.add_child('delete', 'cal_item_delete'); + +end; +/ +show errors + + -- creating the addition set of permissions for calendar. + -- these are going to be used as status markers for the calendar + -- + -- 1. calendar_on: calendar has been selected + -- 2. calendar_show: user wants to view events from the calendar + -- 3. calendar_hide: user does not want to view events from the calendar + +begin + acs_privilege.create_privilege('calendar_on', 'Implies that a calendar is selected'); + acs_privilege.create_privilege('calendar_show', 'Show a calendar'); + + -- bind the calendar permissions to the golbal names + + acs_privilege.add_child('read', 'calendar_on'); + acs_privilege.add_child('read', 'calendar_show'); +end; +/ +show errors + + -- creating the basic set of permissions for calendar. + -- + -- 1. calendar_create: make a new calendar + -- 2. calendar_read: can view all items on an exsiting calendar + -- 3. calendar_write: can edit all items on an exsiting calendar + -- 4. calendar_delete: delete an existing calendar + + +begin + acs_privilege.create_privilege('calendar_create', 'Create a new calendar'); + acs_privilege.create_privilege('calendar_read', 'View items on an exsiting calendar'); + acs_privilege.create_privilege('calendar_write', 'Edit items of an exsiting calendar'); + acs_privilege.create_privilege('calendar_delete','Delete an calendar' ); + + + -- bind the calendar permissions to the golbal names + + acs_privilege.add_child('create', 'calendar_create'); + acs_privilege.add_child('read', 'calendar_read'); + acs_privilege.add_child('write', 'calendar_write'); + acs_privilege.add_child('delete', 'calendar_delete'); + + -- bind the cal_item permissions to the calendar permissions + + -- When a calendar has the permission of public, + -- it implies that all the default permission to magic group 'public' + -- have the permissions of "calendar_read" + + -- When a calendar has the permission of private + -- it implies that the only group that will have the permission + -- "calendar_read" would the group that the calendar belong to. + + acs_privilege.add_child('calendar_create', 'cal_item_create'); + acs_privilege.add_child('calendar_read', 'cal_item_read'); + acs_privilege.add_child('calendar_write', 'cal_item_write'); + acs_privilege.add_child('calendar_delete', 'cal_item_delete'); + +end; +/ +show errors + + -- Assign the four basic permissions to more specific roles and conditions + -- + -- calendar_admin is assigned by the owner when the calendar + -- is created. A calendar_admin can grant any combinations + -- or read, write, delete and invite to any member of the party + -- on a cal_item basis or on a calendar basis(all items). +begin + acs_privilege.create_privilege('calendar_admin', 'calendar adminstrator'); + acs_privilege.add_child('admin', 'calendar_admin'); + acs_privilege.add_child('calendar_admin', 'calendar_read'); + acs_privilege.add_child('calendar_admin', 'calendar_write'); + acs_privilege.add_child('calendar_admin', 'calendar_delete'); + acs_privilege.add_child('calendar_admin', 'calendar_create'); + acs_privilege.add_child('calendar_admin', 'cal_item_invite'); + +end; +/ +show errors + + + + +---------------------------------------------------------- +-- calendar_ojbect +----------------------------------------------------------- + +begin + -- create the calendar object + + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'calendar', + pretty_name => 'Calendar', + pretty_plural => 'Calendars', + table_name => 'calendars', + id_column => 'calendar_id' + ); +end; +/ +show errors + +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + attr_id := acs_attribute.create_attribute ( + object_type => 'calendar', + attribute_name => 'owner_id', + pretty_name => 'Owner', + pretty_plural => 'Owners', + datatype => 'integer' + ); + + attr_id := acs_attribute.create_attribute ( + object_type => 'calendar', + attribute_name => 'private_p', + pretty_name => 'Private Calendar', + pretty_plural => 'Private Calendars', + datatype => 'string' + ); + + attr_id := acs_attribute.create_attribute ( + object_type => 'calendar', + attribute_name => 'calendar_name', + pretty_name => 'Calendar Name', + pretty_plural => 'Calendar Names', + datatype => 'string' + ); +end; +/ +show errors + + + -- Calendar is a collection of events. Each calendar must + -- belong to somebody (a party). +create table calendars ( + -- primary key + calendar_id integer + constraint calendars_calendar_id_fk + references acs_objects + constraint calendars_calendar_id_pk + primary key, + -- the name of the calendar + calendar_name varchar2(200), + -- the name of the calendar in a system should be unique + -- to avoid confusion + constraint calendar_calendar_name_un unique (calendar_name), + -- the individual or party that owns the calendar + owner_id integer + constraint calendars_calendar_owner_id_fk + references parties + on delete cascade, + -- keep track of package instances + package_id integer + constraint calendars_package_id_fk + references apm_packages(package_id) + on delete cascade, + -- whether or not the calendar is a private personal calendar or a + -- public calendar. + private_p varchar2(1) + default 'f' + constraint calendars_prviate_p_ck + check (private_p in ( + 't', + 'f' + ) + ) +); + +comment on table calendars is ' + Table calendars maps the many to many relationship betweens + calendar and its owners. +'; + +comment on column calendars.calendar_id is ' + Primary Key +'; + +comment on column calendars.calendar_name is ' + the name of the calendar. This would be unique to avoid confusion +'; + +comment on column calendars.owner_id is ' + the individual or party that owns the calendar +'; + +comment on column calendars.package_id is ' + keep track of package instances +'; + + +------------------------------------------------------------- +-- Load cal_item_object +------------------------------------------------------------- +@@cal-item-create + +------------------------------------------------------------- +-- create package calendar +------------------------------------------------------------- + +create or replace package calendar +as + function new ( + calendar_id in acs_objects.object_id%TYPE default null, + calendar_name in calendars.calendar_name%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'calendar', + owner_id in calendars.owner_id%TYPE , + private_p in calendars.private_p%TYPE default 'f', + package_id in calendars.package_id%TYPE default null, + 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 calendars.calendar_id%TYPE; + + procedure delete ( + calendar_id in calendars.calendar_id%TYPE + ); + + -- figures out the name of the calendar + function name ( + calendar_id in calendars.calendar_id%TYPE + ) return calendars.calendar_name%TYPE; + + -- returns 't' if calendar is private and 'f' if its not + function private_p ( + calendar_id in calendars.calendar_id%TYPE + ) return char; + + + -- returns 't' if calendar is viewable by the given party + -- this implies that the party has calendar_read permission + -- on this calendar + function readable_p ( + calendar_id in calendars.calendar_id%TYPE, + party_id in parties.party_id%TYPE + ) return char; + + -- returns 't' if party wants to be able to select + -- this calendar, and return 'f' otherwise. + function show_p ( + calendar_id in calendars.calendar_id%TYPE, + party_id in parties.party_id%TYPE + ) return char; + + + ---------------------------------------------------------------- + -- Helper functions for calendar generations: + -- + -- These functions are used for assist in calendar + -- generation. Putting them in the PL/SQL level ensures that + -- the date date will be the same, and allowing adoptation + -- to a different language much easier and faster. + -- + -- current month name + function month_name ( + current_date date + ) return char; + + -- next month + function next_month ( + current_date date + ) return date; + + -- prev month + function prev_month ( + current_date date + ) return date; + + -- number of days in the month + function num_day_in_month ( + current_date date + ) return integer; + + -- first day to be displayed in a month. + function first_displayed_date ( + current_date date + ) return date; + + -- last day to be displayed in a month. + function last_displayed_date ( + current_date date + ) return date; + +end calendar; +/ +show errors; + + +create or replace package body calendar +as + + function new ( + calendar_id in acs_objects.object_id%TYPE default null, + calendar_name in calendars.calendar_name%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'calendar', + owner_id in calendars.owner_id%TYPE , + private_p in calendars.private_p%TYPE default 'f', + package_id in calendars.package_id%TYPE default null, + 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 calendars.calendar_id%TYPE + + is + v_calendar_id calendars.calendar_id%TYPE; + + begin + v_calendar_id := acs_object.new ( + object_id => calendar_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); + + insert into calendars + (calendar_id, calendar_name, owner_id, package_id, private_p) + values (v_calendar_id, calendar_name, owner_id, package_id, private_p); + + + -- each calendar has three default conditions + -- 1. all items are public + -- 2. all items are private + -- 3. no default conditions + -- + -- calendar being public implies granting permission + -- calendar_read to the group 'the_public' and 'registered users' + -- + -- calendar being private implies granting permission + -- calendar_read to the owner party/group of the party + -- + -- by default, we grant "calendar_admin" to + -- the owner of the calendar + acs_permission.grant_permission ( + object_id => v_calendar_id, + grantee_id => owner_id, + privilege => 'calendar_admin' + ); + + + return v_calendar_id; + end new; + + + + -- body for procedure delete + procedure delete ( + calendar_id in calendars.calendar_id%TYPE + ) + is + + begin + -- First erase all the item relate to this calendar. + delete from calendars + where calendar_id = calendar.delete.calendar_id; + + -- Delete all privileges associate with this calendar + delete from acs_permissions + where object_id = calendar.delete.calendar_id; + + -- Delete all privilges of the cal_items that's associated + -- with this calendar + delete from acs_permissions + where object_id in ( + select cal_item_id + from cal_items + where on_which_calendar = calendar.delete.calendar_id + ); + + + acs_object.delete(calendar_id); + end delete; + + + + -- figures out the name of the calendar + function name ( + calendar_id in calendars.calendar_id%TYPE + ) + return calendars.calendar_name%TYPE + + is + v_calendar_name calendars.calendar_name%TYPE; + begin + select calendar_name + into v_calendar_name + from calendars + where calendar_id = calendar.name.calendar_id; + + return v_calendar_name; + end name; + + + + -- returns 't' if calendar is private and 'f' if its not + function private_p ( + calendar_id in calendars.calendar_id%TYPE + ) + return char + + is + v_private_p char(1) := 't'; + begin + select private_p + into v_private_p + from calendars + where calendar_id = calendar.private_p.calendar_id; + + return v_private_p; + end private_p; + + + + -- returns 't' if calendar is viewable by the given party + -- this implies that the party has calendar_read permission + -- on this calendar + function readable_p ( + calendar_id in calendars.calendar_id%TYPE, + party_id in parties.party_id%TYPE + ) + return char + + is + v_readable_p char(1) := 't'; + begin + select decode(count(*), 1, 't', 'f') + into v_readable_p + from acs_object_party_privilege_map + where party_id = calendar.readable_p.party_id + and object_id = calendar.readable_p.calendar_id + and privilege = 'calendar_read'; + + return v_readable_p; + + end readable_p; + + -- returns 't' if party wants to be able to select (calendar_show granted) + -- this calendar, and .return 'f' otherwise. + -- + -- this seems to be a problem with the problem that when + -- revoking the permissions using acs_permissions.revoke + -- data is not removed from table acs_object_party_privilege_map. + function show_p ( + calendar_id in calendars.calendar_id%TYPE, + party_id in parties.party_id%TYPE + ) + return char + + is + v_show_p char(1) := 't'; + begin + select decode(count(*), 1, 't', 'f') + into v_show_p + from acs_permissions + where grantee_id = calendar.show_p.party_id + and object_id = calendar.show_p.calendar_id + and privilege = 'calendar_show'; + + return v_show_p; + + end show_p; + + + -- Helper functions for calendar generations: + -- + -- These functions are used for assist in calendar + -- generation. Putting them in the PL/SQL level ensures that + -- the date date will be the same, and allowing adoptation + -- to a different language much easier and faster. + -- + -- current month name + function month_name ( + current_date date + ) return char + + is + name char; + begin + select to_char(to_date(calendar.month_name.current_date), 'fmMonth') + into name + from dual; + + return name; + end month_name; + + + -- next month + function next_month ( + current_date date + ) return date + + is + v_date date; + begin + select trunc(add_months(to_date(sysdate), -1)) + into v_date + from dual; + + return v_date; + end next_month; + + + -- prev month + function prev_month ( + current_date date + ) return date + + is + v_date date; + begin + select trunc(add_months(to_date(sysdate), -1)) + into v_date + from dual; + + return v_date; + end prev_month; + + -- number of days in the month + function num_day_in_month ( + current_date date + ) return integer + + is + v_num integer; + begin + select to_char(last_day(to_date(sysdate)), 'DD') + into v_num + from dual; + + return v_num; + end num_day_in_month; + + -- first day to be displayed in a month. + function first_displayed_date ( + current_date date + ) return date + + is + v_date date; + begin + select next_day(trunc(to_date(sysdate), 'Month') - 7, 'SUNDAY') + into v_date + from dual; + + return v_date; + end first_displayed_date; + + -- last day to be displayed in a month. + function last_displayed_date ( + current_date date + ) return date + + is + v_date date; + begin + select next_day(last_day(to_date(sysdate)), 'SATURDAY') + into v_date + from dual; + + return v_date; + end last_displayed_date; + +end calendar; +/ +show errors + + + +----------------------------------------------------------------- +-- load related sql files +----------------------------------------------------------------- +-- +@@cal-table-create + + + + + + + + + + Index: openacs-4/packages/calendar/sql/calendar-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/Attic/calendar-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/sql/calendar-drop.sql 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,145 @@ +-- drop the calendar system +-- +-- @author Gary Jin (gjin@arsdigita.com) +-- @creation-date Nov 27, 2000 +-- $Id: calendar-drop.sql,v 1.1 2001/04/23 23:09:38 donb Exp $ + + +------------------------------------------------ +-- Drop the Permissions +------------------------------------------------ + +delete from acs_permissions +where privilege in ( + 'cal_item_create', + 'cal_item_read', + 'cal_item_write', + 'cal_item_delete', + 'cal_item_invite' + ); + + +delete from acs_privilege_hierarchy +where privilege in ( + 'cal_item_create', + 'cal_item_read', + 'cal_item_write', + 'cal_item_delete', + 'cal_item_invite' + ); + + +delete from acs_privilege_hierarchy +where child_privilege in ( + 'cal_item_create', + 'cal_item_read', + 'cal_item_write', + 'cal_item_delete', + 'cal_item_invite' + ); + + +delete from acs_privileges +where privilege in ( + 'cal_item_create', + 'cal_item_read', + 'cal_item_write', + 'cal_item_delete', + 'cal_item_invite' + ); + + + +delete from acs_permissions +where privilege in ( + 'calendar_create', + 'calendar_read', + 'calendar_write', + 'calendar_delete', + 'calendar_admin', + 'calendar_on', + 'calendar_show' + ); + + +delete from acs_privilege_hierarchy +where privilege in ( + 'calendar_create', + 'calendar_read', + 'calendar_write', + 'calendar_delete', + 'calendar_admin', + 'calendar_on', + 'calendar_show' + ); + + +delete from acs_privilege_hierarchy +where child_privilege in ( + 'calendar_create', + 'calendar_read', + 'calendar_write', + 'calendar_delete', + 'calendar_admin', + 'calendar_on', + 'calendar_show' + ); + + + +delete from acs_privileges +where privilege in ( + 'calendar_create', + 'calendar_read', + 'calendar_write', + 'calendar_delete', + 'calendar_admin' + 'calendar_on', + 'calendar_show' + ); + + + +------------------------------------------------ +-- Drop Support Tables +------------------------------------------------ +@@cal-table-drop + + +------------------------------------------------ +-- drop cal_item +------------------------------------------------ +@@cal-item-drop + + +------------------------------------------------ +-- Drop Calendar +------------------------------------------------ + + -- drop attributes and acs_object_type +begin + acs_attribute.drop_attribute ('calendar','owner_id'); + acs_attribute.drop_attribute ('calendar','private_p'); + acs_object_type.drop_type ('calendar'); +end; +/ +show errors + + + -- drop package +drop package calendar; + + + -- drop table +drop table calendars; + + + + + + + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,287 @@ +# /packages/calendar/tcl/cal-item-procs.tcl + +ad_library { + + Utility functions for Calendar Applications + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Jan 11, 2001 + @cvs-id $Id: cal-item-procs.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ + +} + + +#------------------------------------------------ +# update the permissions of the calendar +ad_proc cal_assign_item_permission { cal_item_id + party_id + permission + {revoke ""} +} { + update the permission of the specific cal_item + if revoke is set to revoke, then we revoke all permissions +} { + + # adding permission + + if { ![string equal $revoke "revoke"] } { + + # we make the assumation that permission cal_read is + # by default granted to all users who needs write, delete + # and invite permission + + if { ![string equal $permission "cal_item_read"] } { + + # grant read permission first + + db_exec_plsql grant_calendar_permissions_to_items { + begin + acs_permission.grant_permission ( + object_id => :cal_item_id, + grantee_id => :party_id, + privilege => 'cal_item_read' + ); + end; + } + + } + + # grant other permission + + db_exec_plsql grant_calendar_permissions_to_items { + begin + acs_permission.grant_permission ( + object_id => :cal_item_id, + grantee_id => :party_id, + privilege => :permission + ); + end; + } + + + } elseif { [string equal $revoke "revoke"] } { + + # revoke the permissions + + db_exec_plsql grant_calendar_permissions_to_items { + begin + acs_permission.revoke_permission ( + object_id => :cal_item_id, + grantee_id => :party_id, + privilege => :permission + ); + end; + } + + + } +} + +#------------------------------------------------ +# adding a new calendar item +ad_proc cal_item_create { start_date + end_date + name + description + on_which_calendar + creation_ip + creation_user +} { + + create a new cal_item + for this version, i am omitting recurrence + +} { + + + # find out the activity_id + set activity_id [db_exec_plsql insert_activity { + begin + :1 := acs_activity.new ( + name => :name, + description => :description, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + } + ] + + # set the date_format + set date_format "YYYY-MM-DD HH24:MI" + + # find out the timespan_id + set timespan_id [db_exec_plsql insert_timespan { + begin + :1 := timespan.new( + start_date => to_date(:start_date,:date_format), + end_date => to_date(:end_date,:date_format) + ); + end; + } + ] + + # create the cal_item + # we are leaving the name and description fields in acs_event + # blank to abide by the definition that an acs_event is an acs_activity + # with added on temperoal information + + set cal_item_id [db_exec_plsql cal_item_add { + begin + :1 := cal_item.new( + on_which_calendar => :on_which_calendar, + activity_id => :activity_id, + timespan_id => :timespan_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + } + ] + + + # getting the permissions out + # all this is because cal-item is not a child + # of the calendar. + + # by default, the cal_item permissions + # are going to be inherited from the calendar permissions + # + # i.e.: party with calendar_admin can create, read, write, delete + # all items on the calendar, but a party with only calendar_read + # cannot added items to the specific calendar + # + # NOTE: this default permissions can be circumvented by assign item + # specific permission on a party basis + + # the stuff in pl/sql layer didn't work + # NOTE: need to fold the following back in into pl/sql. + + db_foreach get_permissions_to_items { + select grantee_id, + privilege + from acs_permissions + where object_id = :on_which_calendar + } { + + # setting the permission + + db_exec_plsql grant_calendar_permissions_to_items { + begin + acs_permission.grant_permission ( + object_id => :cal_item_id, + grantee_id => :grantee_id, + privilege => :privilege + ); + end; + } + + } + + # grant default read, write, delete permissions. + # should roll into pl/sql + +# db_exec_plsql grant_cal_item_permissions { + #begin + #acs_permission.grant_permission ( + # object_id => :cal_item_id, + # grantee_id => :grantee_id, + # privilege => 'cal_item_invite' + #); + #end; + # } + + return $cal_item_id + +} + + +#------------------------------------------------ +# update an existing calendar item +ad_proc cal_item_update { cal_item_id + start_date + end_date + name + description +} { + + updating a new cal_item + for this version, i am omitting recurrence + +} { + + # set the date_format + set date_format "YYYY-MM-DD HH24:MI" + + # first update the acs_activities + set sql " + update acs_activities + set name = :name, + description = :description + where activity_id + in ( + select activity_id + from acs_events + where event_id = :cal_item_id + ) + " + + db_dml update_activity $sql + + # update the time interval based on the timespan id + + # find out the interval_id so we can call time_interval.edit() + set sql " + select interval_id + from timespans + where timespan_id + in ( + select timespan_id + from acs_events + where event_id = :cal_item_id + ) + " + db_1row get_interval_id $sql + + # call edit procedure + db_exec_plsql update_interval " + begin + time_interval.edit ( + interval_id => :interval_id, + start_date => to_date(:start_date,:date_format), + end_date => to_date(:end_date,:date_format) + ); + end; + " + +} + + +#------------------------------------------------ +# delete an exiting cal_item +ad_proc cal_item_delete { cal_item_id } { + + delete an existing cal_item given a cal_item_id + +} { + + # call delete procedure + db_exec_plsql delete_cal_item " + begin + cal_item.delete ( + cal_item_id => :cal_item_id + ); + end; + " +} + + + + + + + + + + + Index: openacs-4/packages/calendar/tcl/calendar-community-core-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-community-core-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/calendar-community-core-procs.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,113 @@ +# /packages/calendar/tcl/calendar-community-core-procs.tcl + +ad_library { + + added functions to community-core-procs + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Jan 10, 2001 + @cvs-id $Id: calendar-community-core-procs.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ + +} + +ad_proc cc_group_to_name { group_id } { + + Returns the group name given a group_id +} { + return [db_string group_name_select { + select acs_group.name(:group_id) + from dual + } -default ""] + +} + + + +ad_proc cc_is_party_group_p { party_id } { + + returns 't' if the given party_id is a group + requires acs_object_util package + should roll this into pl/sql + +} { + + db_1row get_group_result { + select acs_object_util.get_object_type(:party_id) + as result + from dual + } + + + if {[string equal $result "group"]} { + return 1 + } else { + return 0 + } +} + +ad_proc cc_is_party_user_p { party_id } { + + given and party_id, return 't' if it is a user + requires acs_object_util package + should roll this into pl/sql + +} { + + db_1row get_group_result { + select acs_object_util.get_object_type(:party_id) + as result + from dual + } + + if {[string equal $result "user"]} { + return 1 + } else { + return 0 + } + +} + + + +#----------------------------------------------- +# should probably move this proc into acs-procs +# since it is pretty useful when you want to get a + +ad_proc cc_member_of_groups { member_id } { + + Given a party_id, this procs returns a ns_set of + party_id and party_name that the given member_id is a member of. + The party_id is the key and party_name is the value + +} { + + # create the ns_set + set set_id [ns_set new party_set] + + # would have called acs_group.member_p procs + # but its not implemented yet!!! + # so we query group_member_index table with the given + # member_id looking for the group_id + + set sql " + select group_id + from group_member_index + where member_id = :member_id + " + + db_foreach get_all_party_ids $sql { + # construct the set + + ns_set put $set_id $group_id [cc_group_to_name $group_id] + + } + + return $set_id + +} + + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/calendar-procs.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,337 @@ +# /packages/calendar/tcl/calendar-procs.tcl + +ad_library { + + Utility functions for Calendar Applications + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: calendar-procs.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ + +} + + +#------------------------------------------------ +# datetime info extraction + +ad_proc calendar_make_datetime { event_date + event_time +} { + given a date, and a time, construct the proper date string + to be imported into oracle. (yyyy-mm-dd hh24:mi format)s +} { + + # extract from even-date + set year [lindex $event_date 5] + set day [lindex $event_date 7] + set month [lindex $event_date 9] + + # extract from event_time + set hours [lindex $event_time 3] + set minutes [lindex $event_time 1] + + + if {$hours < 10} { + set hours "0$hours" + } + + return "$year-$month-$day $hours:$minutes" + +} + + +#------------------------------------------------ +# datetime info extraction + +ad_proc calendar_make_date { event_date } { + given a date, construct the proper date string + to be imported into oracle (yyyy-mm-dd format) +} { + + # extract from even-date + set year [lindex $event_date 5] + set day [lindex $event_date 7] + set month [lindex $event_date 9] + + return "$year-$month-$day" + +} + + +#------------------------------------------------ +# should probably roll this one into the pl/sql since +# note: not sure how useful this is going to be + +ad_proc calendar_have_group_cal_p { party_id } { + + figures out if the given party_id have an existing calendar. + + +} { + + set sql " + select calendar_id, + from calendars + where owner_id = :party_id + " + return [db_0or1row get_calendar_info $sql] + +} + + +#------------------------------------------------ +# figure out if user have a private calendar or not +# again, best suited to be rolled into the pl/sql + +ad_proc calendar_have_private_p { {-return_id 0} party_id } { + + check to see if ther user have a prviate calendar + if -return_id is 1, then proc will return the calendar_id + +} { + + + # query to figure out the existence of the private calendar + set sql " + select calendar_id + from calendars + where owner_id = :party_id + and private_p = 't' + " + set result [db_string get_calendar_info $sql -default 0] + + if { ![string equal $result "0"] } { + + if { [string equal $return_id "1"] } { + return $result + } else { + return 1 + } + + } else { + + return 0 + } +} + + +#------------------------------------------------ +# creating a new calendar + +ad_proc calendar_create { owner_id + private_p + {calendar_name ""} +} { + + create a new calendar + private_p is default to true since the default + calendar is a private calendar +} { + + # find out configuration info + set package_id [ad_conn package_id] + set creation_ip [ad_conn "peeraddr"] + set creation_user [ad_conn "user_id"] + + + set calendar_id [db_exec_plsql create_new_calendar { + begin + :1 := calendar.new( + owner_id => :owner_id, + private_p => :private_p, + calendar_name => :calendar_name, + package_id => :package_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + } + ] + + return $calendar_id + +} + + +#------------------------------------------------ +# assign the permission of the calendar to a party + +ad_proc calendar_assign_permissions { calendar_id + party_id + cal_privilege + {revoke ""} +} { + 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 + +} { + # default privilege is being able to read + + # if the permission is public, oassign the magic object + # and set permission to read + + if { [string equal $cal_privilege "public"] } { + + db_1row get_magic_id { + select acs.magic_object_id('the_public') + as party_id + from dual + } + + set cal_privilege "calendar_read" + } elseif { [string equal $cal_privilege "private"] } { + set cal_privilege "calendar_read" + } + + + if { [empty_string_p $revoke] } { + # grant the permissions + + db_exec_plsql assign_calendar_permissions { + begin + acs_permission.grant_permission ( + object_id => :calendar_id, + grantee_id => :party_id, + privilege => :cal_privilege + ); + end; + } + + + } elseif { [string equal $revoke "revoke"] } { + # revoke the permissions + + + db_exec_plsql revoke_calendar_permissions { + begin + acs_permission.revoke_permission ( + object_id => :calendar_id, + grantee_id => :party_id, + privilege => :cal_privilege + ); + end; + } + + } + +} + + +#------------------------------------------------ +# add a new private calendar to a user + +ad_proc calendar_create_private { private_id } { + + create a private calendar + +} { + # check to make sure the user_id given is indeed a user + # this shouldn always happen + + if {![cc_is_party_user_p $private_id]} { + return "ERROR: ID NOT USER" + } + + # set the private calendar name + set calendar_name "private calendar for [db_string get_user_name { + select acs_object.name(:private_id) + from dual + } -default ""]" + + set calendar_id [calendar_create $private_id "t" $calendar_name] + + return $calendar_id +} + + +#------------------------------------------------ +# find out if the name of a calendar has already +# been taken + +#ad_proc calendar_name_exist_p { calendar_name } { + + #since calendar_name is unique, this proc determines + #if a given name is already used +#} { + +#} + +#------------------------------------------------ +# update a calendar + +ad_proc calendar_update { calendar_id + party_id + calendar_name + cal_privilege +} { + update the basic info of a calendar + does not pretain to the audience of + the calendar +} { + + #update the calendar table + db_dml update_calendar { + update calendars + set calendar_name = :calendar_name + where calendar_id = :calendar_id + } + + #reassign the permission + calendar_assign_permissions $calendar_id $party_id $cal_privilege +} + +#------------------------------------------------ +# find out the name of a calendar < roll into pl/sql > +# NOTE: calendar.name() + +ad_proc calendar_get_name { calendar_id } { + + find out the name of a calendar +} { + + return [db_string get_calendar_name { + select calendar.name(:calendar_id) + from dual + } -default ""] + +} + + + +#------------------------------------------------ +# figures out if a given calendar is public or not + +ad_proc calendar_public_p { calendar_id } { + + returns 't' if a given calendar is public + and 'f' if it is not + +} { + + return [db_string check_calendar_permission { + select acs_permission.permission_p( + :calendar_id, + acs.magic_object_id('the_public'), + 'calendar_read' + ) + from dual + + }] + +} + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-dayview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-dayview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-dayview.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,11 @@ + + + +@row_html@ + Index: openacs-4/packages/calendar/www/cal-dayview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-dayview.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-dayview.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,218 @@ +# /packages/calendar/www/cal-dayview.tcl + +ad_page_contract { + + Source files for the day view generation + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-dayview.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {date now} + {view day} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} +} -properties { + row_html:onevalue + date:onevalue +} + +if { $date == "now"} { + set date [dt_sysdate] +} + + +#------------------------------------------------- +# find out the user_id +set user_id [ad_verify_and_get_user_id] + + +set current_date $date +set date_format "YYYY-MM-DD" + +#get cal-item +set sql " +select to_char(start_date, 'HH24') as start_hour, + to_char(start_date, 'HH24:MI') as pretty_start_date, + to_char(end_date, 'HH24:MI') as pretty_end_date, + nvl(e.name, a.name) as name, + e.event_id as item_id +from acs_activities a, + acs_events e, + timespans s, + time_intervals t +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:current_date,:date_format) and + to_date(:current_date,:date_format) + (24 - 1/3600)/24 +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) +" + +set mlist "" +set set_id [ns_set new day_items] + + + +#------------------------------------------------- +# verifiy if the calendar_list has elements or not + +if {[llength $calendar_list] == 0} { + + # in the case when there are no elements, we check the + # default, the calendar is set to -1 + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + + } else { + + # otherwise, get the calendar_name for the give_id + set calendar_name [calendar_get_name $calendar_id] + } + + db_foreach get_day_items $sql { + ns_set put $set_id $start_hour " + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
" + } +} else { + + # when there are elements, we construct the query to extract all + # the cal_items associated with the calendar in which the given + # party has read permissions to. + + foreach item $calendar_list { + set calendar_id [lindex $item 0] + + if { [string equal $calendar_id "-1"] } { + + # find out the calendar_id of the private calendar + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + + } else { + set calendar_name [calendar_get_name $calendar_id] + } + + db_foreach get_day_items $sql { + ns_set put $set_id $start_hour " + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
" + } + + } +} + + +#------------------------------------------------- +# +set num_hour_rows 24 +set i 0 + +set bgcolor_html "border=1 color=blue" + +set row_html " + + + + + + +" + + +while {$i < $num_hour_rows} { + set filled_cell_count 0 + + + # making hours before 10 looks prettier + if {$i < 10} { + set cal_hour "0$i" + } else { + set cal_hour "$i" + } + + + # am or pm determination logic + if {$i < 12} { + if {$i == 0} { + set time "12:00 am" + } else { + set time "$cal_hour:00 am" + } + } else { + if {$i == 12} { + set time "12:00 pm" + } else { + set fm_hour [expr $i - 12] + if {$fm_hour < 10} { + set fm_hour "0$fm_hour" + } + set time "$fm_hour:00 pm" + } + } + + set cal_item_index [ns_set find $set_id $cal_hour] + + append row_html " + + + + + + + " + + incr i +} + +append row_html "
+ Time + + Title +
+ $time + + " + + if {$cal_item_index == -1} { + append row_html " " + } + + while {$cal_item_index > -1} { + + append row_html "[ns_set value $set_id $cal_item_index]" + + ns_set delete $set_id $cal_item_index + set cal_item_index [ns_set find $set_id $cal_hour] + } + + + append row_html " +
" + +ad_return_template + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-item-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-create.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-item-create.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,149 @@ +# /packages/calendar/www/cal-item-create.tcl + +ad_page_contract { + + Creation of new calendar item + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-item-create.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {view day} + {action view} + {event_date:array} + {start_time:array} + {end_time:array} + {name:notnull} + {description ""} + {date now} + {calendar_id "-1"} +} + +if { $date == "now" } { + set date [dt_sysdate] +} + + +#---------------------------------------------------------------- +# extract the time info +# + +set start_datetime [calendar_make_datetime [array get event_date] [array get start_time]] +set end_datetime [calendar_make_datetime [array get event_date] [array get end_time]] + +#----------------------------------------------------------------- +# validate time interval ( start_time <= end_time ) + +if { [dt_interval_check $start_datetime $end_datetime] < 0 } { + ad_return_complaint 1 "you end time $end_datetime can't happen before start time $start_datetime " +} + +#------------------------------------------------------------------ +# insert the information +# +# probably not the best way to do it, well fix +# after this release + + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + +# find out configuration info +set package_id [ad_conn package_id] +set creation_ip [ad_conn "peeraddr"] + +# Owner_id refers to a party, user or group +# the default creation_user is just the person +# who happen to made the calendar +set creation_user [ad_conn "user_id"] + + +#------------------------------------------------------------------- +# if calendar_id is not provided, +# we assume that its a private calendar + +if { [string equal $calendar_id "-1"] } { + #private calendar + + # check to see if the user have a private calendar of not. + # if he doesn't have a private calendar, then we will should + # seamlessly create a private calendar before creating the + # cal-item + + if { ![calendar_have_private_p $user_id] } { + # no private calendar detected. + # we need to create the private calendar + + set calender_id [calendar_create_private $user_id ] + + } + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + + +} else { + # its not a private calendar + # we expect there to be a calendar_id + # we perform error check if the calendar_id + # is not given + + if { [empty_string_p $calendar_id] } { + ad_return_compliant 1 "You need to supply a caledar" + } + + # now we make sure that the user has the permission + # to create the event on the calendar + + ad_require_permission $user_id cal_item_create + + +} + +# create new cal_item +set cal_item_id [cal_item_create $start_datetime \ + $end_datetime \ + $name \ + $description \ + $calendar_id \ + $creation_ip \ + $creation_user] + +# set the date to be the date of the event +set date [calendar_make_date [array get event_date]] +ad_returnredirect "?[export_url_vars date action view calendar_id]" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-item-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-item-edit.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,103 @@ +# /packages/calendar/www/cal-item-edit.tcl + +ad_page_contract { + + edit an existing calendar item + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-item-edit.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {cal_item_id:integer} + {view day} + {action edit} + {event_date:array ""} + {start_time:array ""} + {end_time:array ""} + {name ""} + {description ""} +} + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + + +#------------------------------------------------------ +# if the action is set to delete +# we call the delete proc and return to +# to index with the passed through options + +if { $action == "delete" } { + + cal_item_delete $cal_item_id + + ad_returnredirect "?[export_url_vars date action view]" + +} + +#------------------------------------------------------ +# extract the time info + +set start_datetime [calendar_make_datetime [array get event_date] [array get start_time]] +set end_datetime [calendar_make_datetime [array get event_date] [array get end_time]] + + +#----------------------------------------------------------------- +# validate time interval ( start_time <= end_time ) + +if { [dt_interval_check $start_datetime $end_datetime] < 0 } { + ad_return_compliant 1 "you end time can't happen before start time" +} + + +#------------------------------------------------------------------ +# update the exsiting calendar_item +set cal_item_id [cal_item_update $cal_item_id \ + $start_datetime \ + $end_datetime \ + $name \ + $description \ + ] + +# set the proper rediret value to view and date +set action "view" +set date [calendar_make_date [array get event_date]] + +ad_returnredirect "?[export_url_vars date action view]" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-item.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,146 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +
+ Title + + +
+ Date + + <%= [dt_widget_datetime -date_time_sep "
" -default @start_date@ event_date days] %> + +
+ Start Time @start_time@ + + <%= [dt_widget_datetime -show_date 0 -date_time_sep "
" -default @start_time@ start_time minutes] %> +
+ End Time + + <%= [dt_widget_datetime -show_date 0 -date_time_sep "
" -default @end_time@ end_time minutes] %> +
+ Description + + +
+ Calendar + + +
+ + + + + +
+
  • + Manage the audience to this calendar item + +
  • + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-item.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,149 @@ +# /packages/calendar/www/cal-item.tcl + +ad_page_contract { + + Management of cal-items. Takes in the parameters for the adp pages. + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-item.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {action add} + {date now} + {cal_item_id 0} + {start_time "now"} + {end_time "now"} +} -properties { + cal_item_id:onevalue + + name:onevalue + description:onevalue + + start_date:onevalue + start_time:onevalue + end_time:onevalue + + edit_p:onevalue + delete_p:onevalue + admin_p:onevalue + + calendars:multirow + +} + + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + + +# find out the calendar_id +# for this case, we are assuming that its +# a private calendar +set calendar_id [calendar_have_private_p -return_id 1 $user_id] + +# set up all the default values +set name "" +set description "" + +if {$date == "now"} { + set start_date "now" +} else { + set start_date $date +} + + +#------------------------------------------------ +# check the permission on the party to the object +# then set up the variable to the template + +# write permission +set edit_p [ad_permission_p $cal_item_id cal_item_write] + +# delete permission +set delete_p [ad_permission_p $cal_item_id cal_item_delete] + +# admin permission +set admin_p [ad_permission_p $cal_item_id calendar_admin] + +#------------------------------------------------ +# only worry about the query when it is an edit +if { $action == "edit" } { + + # check so that cal_item_id does exist + if { [empty_string_p cal_item_id] } { + # barf error + ad_return_compliant 1 "you need to supply a cal_item_id" + } + + + # get data time + db_1row get_item_data { + select to_char(start_date, 'MM/DD/YYYY') as start_date, + to_char(start_date, 'HH24:MI') as start_time, + to_char(end_date, 'HH24:MI') as end_time, + nvl(a. name, e.name) as name, + nvl(e.description, a.description) as description + from acs_activities a, + acs_events e, + timespans s, + time_intervals t + where e.timespan_id = s.timespan_id + and s.interval_id = t.interval_id + and e.activity_id = a.activity_id + and e.event_id = :cal_item_id + } + + + + # forced error checking + set name [ad_quotehtml $name] + set description [ad_quotehtml $description] + +} elseif { [string equal $action "add"] } { + # get calendar names that user has calendar + # write permission to + + + # write permission for the calendar + set edit_p [ad_permission_p $calendar_id calendar_write] + + # user has no private calendar + if { [string equal $calendar_id 0] } { + set edit_p 1 + } + + db_multirow calendars list_calendars { + + select object_id as calendar_id, + calendar.name(object_id) as calendar_name + from acs_permissions + where privilege in ( + 'calendar_write', + 'calendar_admin' + ) + and grantee_id = :user_id + and acs_object_util.object_type_p( + object_id, + 'calendar' + ) = 't' + and calendar.private_p( + object_id + ) = 'f' + + + } + +} + +ad_return_template + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-listview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-listview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-listview.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,13 @@ + + +

    +For @date@:
    +@items@ +

    + Index: openacs-4/packages/calendar/www/cal-listview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-listview.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-listview.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,147 @@ +# /packages/calendar/www/cal-listview.tcl + +ad_page_contract { + + Source files for the day view generation + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-listview.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {date now} + {view list} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} +} -properties { + items:onevalue +} + +if { $date == "now"} { + set date [dt_systime] +} + +set current_date $date +set date_format "YYYY-MM-DD" + + +set items "" +set mlist "" +set set_id [ns_set new day_items] + + + + +#------------------------------------------------- +# find out the user_id +set user_id [ad_verify_and_get_user_id] + + +#get cal-item +set sql " +select to_char(start_date, 'j') as start_date, + to_char(start_date, 'HH24:MI') as pretty_start_date, + to_char(end_date, 'HH24:MI') as pretty_end_date, + nvl(e.name, a.name) as name, + e.event_id as item_id +from acs_activities a, + acs_events e, + timespans s, + time_intervals t +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:current_date,:date_format) and + to_date(:current_date,:date_format) + (24 - 1/3600)/24 +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) +" + + + +#------------------------------------------------- +# verifiy if the calendar_list has elements or not + +if {[llength $calendar_list] == 0} { + + # in the case when there are no elements, we check the + # default, the calendar is set to -1 + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + + } else { + # otherwise, get the calendar_name for the give_id + set calendar_name [calendar_get_name $calendar_id] + } + + db_foreach get_day_items $sql { + ns_set put $set_id $start_date " + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + append items "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + } + + + +} else { + # when there are elements, we construct the query to extract all + # the cal_items associated with the calendar in which the given + # party has read permissions to. + + + + foreach item $calendar_list { + set calendar_id [lindex $item 0] + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + } else { + set calendar_name [calendar_get_name $calendar_id] + } + + db_foreach get_day_items $sql { + ns_set put $set_id $start_date " + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + append items "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + } + + } + +} + + + + + +#------------------------------------------------- +# date info +dt_get_info_from_db $date + +set day_of_week $first_day_of_month +set julian_date $first_julian_date + +set calendar_day_index [ns_set find $set_id $julian_date] + +#------------------------------------------------- +# + +ad_return_template + + + + Index: openacs-4/packages/calendar/www/cal-monthview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-monthview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-monthview.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,22 @@ + + + + + + + + + @row_html@ +
    + @mlist@ +

    + +

    + + \ No newline at end of file Index: openacs-4/packages/calendar/www/cal-monthview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-monthview.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-monthview.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,121 @@ +# /packages/calendar/www/cal-monthview.tcl + +ad_page_contract { + + Source files for the month view generation + Requires acs_datetime to be installed and enabled + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-monthview.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {date now} + {view month} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} +} -properties { + row_html:onevalue + mlist:onevalue + month_items +} + + + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + +# extract all the cal-item that's occuring within the given month + +set sql " +select to_char(start_date, 'j') as start_date, + nvl(e.name, a.name) as name, + nvl(e.description, a.description) as description, + e.event_id as item_id +from acs_activities a, + acs_events e, + timespans s, + time_intervals t +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) +" + +set mlist "" +set set_id [ns_set new month_items] + + +#------------------------------------------------- +# verifiy if the calendar_list has elements or not + +if {[llength $calendar_list] == 0} { + + # in the case when there are no elements, we check the + # default, the calendar is set to -1 + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + + } else { + # otherwise, get the calendar_name for the give_id + set calendar_name [calendar_get_name $calendar_id] + } + + + db_foreach get_monthly_items $sql { + ns_set put $set_id $start_date " + $name ($calendar_name) +
    " + } + + + + + +} else { + # when there are elements, we construct the query to extract all + # the cal_items associated with the calendar in which the given + # party has read permissions to. + + + + foreach item $calendar_list { + set calendar_id [lindex $item 0] + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + } else { + set calendar_name [calendar_get_name $calendar_id] + } + + + db_foreach get_monthly_items $sql { + ns_set put $set_id $start_date " + $name ($calendar_name) +
    " + } + + } + +} + + + + + +set row_html [dt_widget_month -calendar_details $set_id] + +ad_return_template + + + Index: openacs-4/packages/calendar/www/cal-nav.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-nav.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-nav.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,23 @@ + + + +@html@ + +

    +

  • add an event + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-nav.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-nav.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-nav.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,62 @@ +# /packages/calendar/www/cal-nav.tcl + +ad_page_contract { + + Nav page + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-nav.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {view day} + {date now} + {action view} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} +} -properties { + html:onevalue + view:onevalue + date:onevalue +} + +if {$date == "now"} { + set date [dt_sysdate] +} + +# we have to deal with the list +# if the list is empty, we ignore the list +# if the there is content, we have to break +# apart the list and append element per element + +if {[llength $calendar_list] == 0} { + + set pass_in_vars "[export_url_vars calendar_id]" + +} else { + + set pass_in_vars "" + foreach items $calendar_list { + + append pass_in_vars "calendar_list=[lindex $items 0]&" + } +} + +# set the html +set html [dt_widget_calendar_navigation "" $view $date $pass_in_vars] + +ad_return_template + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-options.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-options.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-options.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + calendar options +
    + No Other Calendars +
    + + + + Private + +
    + + + + @calendars.calendar_name@ + +
    + +
    + Manage Your Calendars +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/cal-options.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-options.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-options.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,174 @@ +# /packages/calendar/www/cal-nav.tcl + +ad_page_contract { + + option pages + + list all the calendars that has + the user has read privilege + + @view + @date + @calendar_id + @calendar_list + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-options.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ + + +} { + + {view day} + {date now} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} + +} -properties { + + private_id:onevalue + private_checked_p:onevalue + + date:onevalue + view:onevalue + + calendars:multirow + calendar_id_list:multirow + +} + +# get a user_id +set user_id [ad_verify_and_get_user_id] + + +# get a list of the calendars that the user has read access to +# NOTE: this query would need to optimized. Its take a major +# performence hit when the system have a lot of objects (ie. +# 20000+ rows of geographical data) +# +# A possbile solution for a later release would be to query out +# only objects with acs_object_type of calendar or calendar events +# and then include that as a subquery on permissions (basically +# construct a calendar only version of the acs_object_party_privilege_map + +# select unique(object_id) as calendar_id, + # calendar.name(object_id) as calendar_name, + # ' ' as checked_p + # from acs_object_party_privilege_map + # where calendar.show_p(object_id, :user_id) = 't' + # and calendar.readable_p(object_id, :user_id) = 't' + # and party_id = :user_id + # and acs_object_util.object_type_p(object_id, 'calendar') = 't' + # and calendar.private_p(object_id) = 'f' + + #union + +# select cal_item.on_which_calendar(object_id) as calendar_id, +# calendar.name(cal_item.on_which_calendar(object_id)) as calendar_name, +# ' ' as checked_p +# from acs_object_party_privilege_map +# where privilege = 'cal_item_read' +# and calendar.show_p(cal_item.on_which_calendar(object_id), :user_id) = 't' +# and party_id = :user_id +# and acs_object_util.object_type_p(object_id, 'cal_item') = 't' + # and calendar.private_p(cal_item.on_which_calendar(object_id)) = 'f' + + +db_multirow calendars get_readable_calendars { + + select unique(calendar_id) as calendar_id, + calendar_name, + ' ' as checked_p + from calendars + where acs_permission.permission_p(calendar_id, :user_id, 'calendar_read') = 't' + and acs_permission.permission_p(calendar_id, :user_id, 'calendar_show') = 't' + and private_p = 'f' + + union + + select unique(on_which_calendar) as calendar_id, + calendar.name(on_which_calendar) as calendar_name, + ' ' as checked_p + from cal_items + where acs_permission.permission_p(cal_item_id, :user_id, 'cal_item_read') = 't' + and calendar.private_p(on_which_calendar) = 'f' + + +} + + +#------------------------------------------------------------- + +# initialize the private marker +set private_checked_p "" + +# get a list of the calendar_id that's currently selected +# multirow method is going to be used to send the ids to +# the template. + + +if { [llength $calendar_list] == 0 } { + # in the case when a single calendar is selected (when a user + # clicked on the link as oppse to using the check box and hit + # the button, then the calendar_list will be empty and we + # use the calendar_id instead. + + # check for private calendar + # if not, then do the comparison + + if { [string equal $calendar_id "-1"] } { + set private_checked_p "checked" + + } else { + + # check the selected calendar + for {set i 1} {$i <= [multirow size calendars] } {incr i} { + if { [string equal [multirow get calendars $i calendar_id] $calendar_id] } { + multirow set calendars $i checked_p "checked" + } + } + + } + +} else { + + # we cross check the existing calendar_id + # with the id that from the selected list. + # if calendar_id are being selected, we + # set checked_p to "checked" + # + # this is quite ineifficent since i am looking + # the id through two loops. But which ever way + # i perform this cross check, i would have to + # cycle through all of the ids in one set to math + # with all the id in another set. + + + foreach items $calendar_list { + + # check for private calendar (when id = -1) + if { [string equal [lindex $items 0] "-1"] } { + set private_checked_p "checked" + } + + # checked the selected calendar + for {set i 1} {$i <= [multirow size calendars]} {incr i} { + + if { [string equal [multirow get calendars $i calendar_id] [lindex $items 0]] } { + multirow set calendars $i checked_p "checked" + } + } + + } + + +} + +return +ad_return_template + + + + + + Index: openacs-4/packages/calendar/www/cal-weekview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-weekview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-weekview.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,11 @@ + + + +@row_html@ + Index: openacs-4/packages/calendar/www/cal-weekview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-weekview.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/cal-weekview.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,213 @@ + # /packages/calendar/www/cal-weekview.tcl + +ad_page_contract { + + Source files for the week view generation + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: cal-weekview.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {date now} + {view week} + {calendar_id:integer "-1"} + {calendar_list:multiple,optional {}} +} -properties { + row_html:onevalue + date:onevalue +} + +if { $date == "now"} { + set date [dt_systime] +} + + +#------------------------------------------------- +# find out the user_id +set user_id [ad_verify_and_get_user_id] + +set current_date $date +set date_format "YYYY-MM-DD" + +# get the week info from oracle +# this should be part of the proc +# dt_get_info_from_db + +db_1row get_weekday_info " +select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') +as day_of_the_week, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'SUNDAY')) +as sunday_of_the_week, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday')) +as saturday_of_the_week +from dual +" + +#----------------------------------------------- +# get cal-item +set sql " +select to_char(start_date, 'J') as start_date, + to_char(start_date, 'HH24:MI') as pretty_start_date, + to_char(end_date, 'HH24:MI') as pretty_end_date, + nvl(e.name, a.name) as name, + e.event_id as item_id +from acs_activities a, + acs_events e, + timespans s, + time_intervals t +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:sunday_of_the_week,'YYYY-MM-DD') and + to_date(:saturday_of_the_week,'YYYY-MM-DD') +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) +" + +set mlist "" +set set_id [ns_set new week_items] + + + +#------------------------------------------------- +# verifiy if the calendar_list has elements or not + +if {[llength $calendar_list] == 0} { + + # in the case when there are no elements, we check the + # default, the calendar is set to -1 + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + + } else { + # otherwise, get the calendar_name for the give_id + set calendar_name [calendar_get_name $calendar_id] + } + + + db_foreach get_day_items $sql { + ns_set put $set_id $start_date "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) + " + append items "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + } + +} else { + # when there are elements, we construct the query to extract all + # the cal_items associated with the calendar in which the given + # party has read permissions to. + + foreach item $calendar_list { + set calendar_id [lindex $item 0] + + if { [string equal $calendar_id "-1"] } { + # find out the calendar_id of the private calendar + set calendar_id [calendar_have_private_p -return_id 1 $user_id] + set calendar_name "Private" + } else { + set calendar_name [calendar_get_name $calendar_id] + } + + + db_foreach get_day_items $sql { + ns_set put $set_id $start_date "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) + " + append items "
  • + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
    " + } + + + } +} + + +#------------------------------------------------- +# +set num_hour_rows 7 +set i 0 + +set bgcolor_html "bgcolor=DCDCDC" + +set row_html " + + +" + + + + +while {$i < $num_hour_rows} { + + set sql " + select to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'SUNDAY')+:i, 'DAY') + as weekday, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'SUNDAY')+:i, 'YYYY-MM-DD') + as pretty_date, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'SUNDAY')+:i, 'J') + as start_date + from dual + " + + db_1row week_data $sql + append row_html " + + + + + + + + " + + incr i +} +append row_html "
    $weekday + $pretty_date +
    " + + + set cal_item_index [ns_set find $set_id $start_date] + + if {$cal_item_index == -1} { + append row_html " " + } + + while {$cal_item_index > -1} { + + append row_html [ns_set value $set_id $cal_item_index] + + ns_set delete $set_id $cal_item_index + set cal_item_index [ns_set find $set_id $start_date] + } + + + append row_html " +
    " + +ad_return_template + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/dayview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/dayview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/dayview.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,9 @@ + + +DAYVIEW Index: openacs-4/packages/calendar/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/index.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,61 @@ + + + + +ArsDigita Calendar for User # @user_id@ + + + + + + + + + +
    +

    + +

    + +

    + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/index.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,68 @@ +# /packages/calendar/www/index.tcl + +ad_page_contract { + + Main Calendar Page. + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: index.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {view day} + {action view} + {date now} + {calendar_list:multiple,optional {}} +} -properties { + package_id:onevalue + user_id:onevalue + + date:onevalue + view:onevalue +} + + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + +set package_id [ad_conn package_id] + + + +ad_return_template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/master.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/master.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,15 @@ + + +<%= [ad_header $title] %> +

    @title@

    +<%= [eval ad_context_bar $context_bar] %> +
    + +<%= [ad_footer] %> + Index: openacs-4/packages/calendar/www/admin/cal-item-permissions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/cal-item-permissions.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/cal-item-permissions.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,136 @@ + + + +ArsDigita Calendar Item Administration + "Calendar Item Permissions" + + + + + + +
    +

    + Audiences for item: @cal_item_name@ +

    + + +

    + There are no audiences for this calendar +

    +
    + + +

    + +

  • + + @audiences.name@ + + +

    + + + + Add a new Audience + + +
  • + +
    + + + + + Current Permissions + + +

    +

  • no privilege has been granted +

    + + + +

    + +

  • @privileges.privilege@ + [ revoke + ] + +

    + + + + + + Grant Permissions + +

    +

    + + + + + + + + + + + + + + + + +
    + + + +
  • no privilege exist. contact your system admin + + + + + + +
  • + + to + +
  • no parties exist. contact your system admin + + + + + + + +
  • +
    + +
    + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/cal-item-permissions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/cal-item-permissions.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/cal-item-permissions.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,150 @@ +# /packages/calendar/www/admin/cal-item-permissions.tcl + +ad_page_contract { + + this provides a very basic permissioning UI by + assigning permission to cal_items + + @author Gary Jin (gjin@arsdigita.com) + + @party_id key to owner id + @calendar_name the name of the calendar + @calendar_permission the permissions of the calendar + + @creation-date Jan 14, 2000 + @cvs-id $Id: cal-item-permissions.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {party_id:integer -1} + {cal_item_id:integer,notnull} + {action list} + {permission ""} +} -properties { + action:onevalue + party_id:onevalue + party_name:onevalue + cal_item_name:onevalue + + privileges:multirow + cal_item_permissions:multirow + parties:multirow + audiences:multirow +} + + +# get user_id and check permission of the user +set user_id [ad_verify_and_get_user_id] +#ad_require_permission $user_id cal_item_invite + +# get party name +set party_name [db_string get_party_name { + select acs_object.name(:party_id) + from dual + } -default ""] + +# get cal_item name +set cal_item_name [db_string get_cal_item)name { + select cal_item.name(:cal_item_id) + from dual + } -default ""] + + +# ---------------------------------------------- +# get cal_item_permissions within the system + +db_multirow cal_item_permissions get_existing_permissions { + select unique(child_privilege) as privilege + from acs_privilege_hierarchy + where child_privilege like 'cal_item%' +} + +# ---------------------------------------------- +# view, edit, or delete + +# view +if { [string equal $action "view"] } { + + #list all the privilege for the given party + + db_multirow privileges get_party_privileges { + select privilege + from acs_object_party_privilege_map + where party_id = :party_id + and object_id = :cal_item_id + and privilege like '%cal_item%' + } + + +# edit and delete must be done with users +# with calendar admin privilege only +# edit + +} elseif { [string equal $action "edit"] } { + + ad_require_permission $user_id calendar_admin + + # verify that permission does exist + if { ![empty_string_p $permission] } { + + # grant permission + cal_assign_item_permission $cal_item_id $party_id $permission + } + + set action view + ad_returnredirect "cal-item-permissions?[export_url_vars cal_item_id party_id action]" + +# delete +} elseif { [string equal $action "revoke"] } { + ad_require_permission $user_id calendar_admin + + cal_assign_item_permission $cal_item_id $party_id $permission "revoke" + + set action "view" + ad_returnredirect "cal-item-permissions?[export_url_vars cal_item_id party_id action]" + +# add user +} elseif { [string equal $action "add" ] } { + + # simple UI this would need be changed in the next release + + db_multirow parties list_users { + select acs_object.name(party_id) + as pretty_name, + party_id + from parties + } + + +# list +} elseif { [string equal $action "list"] } { + + + db_multirow audiences get_calendar_audiences { + select unique(grantee_id) as party_id, + acs_object.name(grantee_id) as name + from acs_permissions + where object_id = :cal_item_id + } + + + +} + + + +ad_return_template + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/calendar-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/calendar-create.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-create.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,49 @@ +# /packages/calendar/www/admin/calendar-create.tcl + +ad_page_contract { + + generation of new group calendar + when a party_wide calendar is generated + the default permission is that this calendar is + + @author Gary Jin (gjin@arsdigita.com) + + @party_id key to owner id + @calendar_name the name of the calendar + @calendar_permission the permissions of the calendar + + @creation-date Dec 14, 2000 + @cvs-id $Id: calendar-create.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {party_id:notnull} + {calendar_name:notnull} + {calendar_permission "private"} +} + +# needs to perform check on if the calendar_name is already being used +# whether or not this is a need should be further thought about + +# create the calendar +set calendar_id [calendar_create $party_id "f" $calendar_name] + +# if the permission is public, we assign it right now +# if the permission is private, we would have to wait until +# the user selects an audience. + +if { [string equal $calendar_permission "public"]} { + + # assign the permission to the calendar + calendar_assign_permissions $calendar_id $party_id $calendar_permission + ad_returnredirect "one?action=permission&calendar_id=$calendar_id" + +} elseif { [string equal $calendar_permission "private"]} { + + # this would be a special case where they'd have to select their audience first + ad_returnredirect "one?action=permission&calendar_id=$calendar_id&calendar_permission=private" +} + + + + + + Index: openacs-4/packages/calendar/www/admin/calendar-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/calendar-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-edit.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,24 @@ + + + + + +
    + + +

    + Are you sure you want to delete this calendar. All the calendar items + and all the permission that's associated with this calendar will be + deleted as well. +

    + + + +
    +
    Index: openacs-4/packages/calendar/www/admin/calendar-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/calendar-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-edit.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,31 @@ +# /packages/calendar/www/admin/calendar-edit.tcl + +ad_page_contract { + + edit the basic info + of an existing calendar + + @author Gary Jin (gjin@arsdigita.com) + + @party_id key to owner id + @calendar_name the name of the calendar + @calendar_permission the permissions of the calendar + + @creation-date Dec 14, 2000 + @cvs-id $Id: calendar-edit.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {action edit} + {party_id:integer,notnull} + {calendar_id:integer,notnull} + {calendar_name:notnull} + {calendar_permission "private"} +} + +if { [string equal $action "edit"] } { + calendar_update $calendar_id $party_id $calendar_name $calendar_permission +} + +ad_returnredirect "/calendar/admin" + + + Index: openacs-4/packages/calendar/www/admin/calendar-permissions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-permissions.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-permissions.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,100 @@ + + + +ArsDigita Calendar Administration: @party_name@ + Calendar Permissions + + + + Current Permissions + + +

    +

  • no privilege has been granted +

    + + + +

    + +

  • @privileges.privilege@ + [ + revoke + ] + +

    + + + + + + Grant Permissions +

    +

    + + + + + + + + + + + + + + + +
    + + + + + + to + +
  • no parties exist. contact your system admin + + + + + + +
  • +
    + +
    + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/calendar-permissions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-permissions.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-permissions.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,123 @@ +# /packages/calendar/www/admin/calendar-permissions.tcl + +ad_page_contract { + + this provides a very basic permissioning UI by + assigning permission to calendars + + @author Gary Jin (gjin@arsdigita.com) + + @party_id key to owner id + @calendar_name the name of the calendar + @calendar_permission the permissions of the calendar + + @creation-date Dec 14, 2000 + @cvs-id $Id: calendar-permissions.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {party_id -1} + {calendar_id:notnull} + {action view} + {permission ""} +} -properties { + party_id:onevalue + party_name:onevalue + calendar_name:onevalue + + privileges:multirow + calendar_permissions:multirow + parties:multirow +} + + +# get user_id and check permission of the user +set user_id [ad_verify_and_get_user_id] +ad_require_permission $user_id calendar_admin + +# get party name +set party_name [db_string get_party_name { + select acs_object.name(:party_id) + from dual + } -default ""] + +# get calendar_name +set calendar_name [calendar_get_name $calendar_id] + +# ---------------------------------------------- +# get calendar_permissions within the system + +db_multirow calendar_permissions get_existing_permissions { + select unique(child_privilege) as privilege + from acs_privilege_hierarchy + where child_privilege like 'calendar%' +} + +# ---------------------------------------------- +# view, greant, or revoke + +# view +if { [string equal $action "view"] } { + + #list all the privilege for the given party + + db_multirow privileges get_party_privileges { + select privilege + from acs_object_party_privilege_map + where object_id = :calendar_id + and party_id = :party_id + and privilege like '%calendar%' + } + + +# grant +} elseif { [string equal $action "grant"] } { + + # verify that permission does exist + if { ![empty_string_p $permission] } { + + # grant permission + calendar_assign_permissions $calendar_id $party_id $permission + + calendar_assign_permissions $calendar_id $party_id "calendar_show" + } + + set action view + ad_returnredirect "calendar-permissions?[export_url_vars calendar_id party_id action]" + +# revoke +} elseif { [string equal $action "revoke"] } { + + calendar_assign_permissions $calendar_id $party_id $permission "revoke" + ad_returnredirect "calendar-permissions?[export_url_vars calendar_id party_id]" + +# add user +} elseif { [string equal $action "add" ] } { + + # simple UI this would need be changed in the next release + + db_multirow parties list_users { + select acs_object.name(party_id) + as pretty_name, + party_id + from parties + } + + +} + +ad_return_template + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/calendar-preferences.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-preferences.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-preferences.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,104 @@ + + +ArsDigita Calendar Administration: @party_name@ + "Calendar Preferences" + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + +
    + Select Calendars +
    + Note The following is a list of calendars that is accessible to you. + This list will show up on your calendar as an option for you to see events between + these calendars. You can select which calendar you want to keep on that list. +
    + No Calendars +
    + + + + + + + + + + @calendars.calendar_name@ +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/calendar-preferences.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/calendar-preferences.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/calendar-preferences.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,123 @@ +# /packages/calendar/www/admin/calendar-selection.tcl + +ad_page_contract { + + support page for the selection of calendars + + user can select a list of calendars + + @action which action to perform + @calendar_list a list that keep track of the call the calendar + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: calendar-preferences.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + + {action "view"} + {calendar_old_list:multiple,optional {}} + {calendar_hide_list:multiple,optional {}} + +} -properties { + + party_id:onevalue + party_name:onevalue + calendar_name:onevalue + action:onevalue + + privileges:multirow + calendars:multirow + parties:multirow + +} + + +# get user_id and check permission of the user +set party_id [ad_verify_and_get_user_id] + +# get party name +set party_name [db_string get_party_name { + select acs_object.name(:party_id) + from dual + } -default ""] + + + +# ---------------------------------------------- +# view, greant, or revoke + +# view +if { [string equal $action "view"] } { + + + # ---------------------------------------------- + # get calendar_permissions within the system + + db_multirow calendars get_viewable_calendar { + + select unique(object_id) as calendar_id, + calendar.name(object_id) as calendar_name, + calendar.show_p(object_id, :party_id) as show_p + from acs_object_party_privilege_map + where calendar.readable_p(object_id, :party_id) = 't' + and party_id = :party_id + and acs_object_util.object_type_p(object_id, 'calendar') = 't' + and calendar.private_p(object_id) = 'f' + + union + + select cal_item.on_which_calendar(object_id) as calendar_id, + calendar.name(cal_item.on_which_calendar(object_id)) as calendar_name, + calendar.show_p(cal_item.on_which_calendar(object_id), :party_id) as show_p + from acs_object_party_privilege_map + where privilege = 'cal_item_read' + and party_id = :party_id + and acs_object_util.object_type_p(object_id, 'cal_item') = 't' + and calendar.private_p(cal_item.on_which_calendar(object_id)) = 'f' + + + } + +# grant +} elseif { [string equal $action "edit"] } { + + + + + foreach old_items $calendar_old_list { + + if { [string equal [lsearch -exact $calendar_hide_list [lindex $old_items 0]] "-1"] } { + + # revoke permission + calendar_assign_permissions [lindex $old_items 0] $party_id "calendar_show" + + } else { + + calendar_assign_permissions [lindex $old_items 0] $party_id "calendar_show" "revoke" + + } + + + } + + + set action view + ad_returnredirect "calendar-preferences?[export_url_vars action]" + +} + +ad_return_template + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/index.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,58 @@ + + + + +ArsDigita Calendar Administration for User # @user_id@ +@context_bar@ + + +

    +Your are in the following group:
    +@data@ +

    + + +

    + You have no party wide calendars +

    +
    + + +

    + You can manage the following calendars + + + + + + +
    +
  • [ + @calendars.calendar_name@ + ] +
  • +

    +
    + +

    + +create a new calendar + +

    + + +

    + +Edit your Calendar Preferences + +

    + + + + Index: openacs-4/packages/calendar/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/index.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,92 @@ +# /packages/calendar/www/admin/index.tcl + +ad_page_contract { + + Main Calendar Admin Page. + + This pages checks to see if the user has any group calendar + that he or she is the admin of. + + + @author Gary Jin (gjin@arsdigita.com) + @creation-date Dec 14, 2000 + @cvs-id $Id: index.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + +} -properties { + context_bar:onevalue + user_id:onevalue + data:onevalue + calendars:multirow +} + + +# find out the user_id +set user_id [ad_verify_and_get_user_id] + +set package_id [ad_conn package_id] +set context_bar "calendar admin" + + +db_multirow calendars calendar_list { + select calendar_id, + calendar_name + from calendars + where owner_id = :user_id + and acs_permission.permission_p( + calendar_id, + :user_id, + 'calendar_admin' + ) = 't' + order by calendar_name +} + + +# list the groups that the user_id is a member of +set group_set_id [cc_member_of_groups $user_id] + +set set_size [ns_set size $group_set_id] +set data "" + +for {set i 0} {$i < [ns_set size $group_set_id]} {incr i} { + set data "
  • [ns_set key $group_set_id $i] => [ns_set value $group_set_id $i]" +} + +ad_return_template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/admin/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/master.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/master.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,15 @@ + + +<%= [ad_header $title] %> +

    @title@

    +<%= [eval ad_context_bar $context_bar] %> +
    + +<%= [ad_footer] %> + Index: openacs-4/packages/calendar/www/admin/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/one.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/one.adp 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,156 @@ + + + + +ArsDigita Calendar Administration@title@ + @context_bar@ + + + Calendar detail: listing all the info about the individual calendar + + + + + + + + +
    + + +
    +
    + + + + + + + + +
    +

    + Audiences for calendar: @calendar_name@ +

    + + +

    + There are no audiences for this calendar +

    +
    + + +

    + +

  • + + @audiences.name@ + + +

    + + + + Add a new Audience + + +
  • +
    + + + + + +

    + + DEVELOPER NOTE: + + the calendar creation process involves the following steps: + +

      +
    1. create the calendar object, and change the default permission if needed +
    2. select groups and/or users who are going to the audiences of the calendar +
    3. apply group, user specific permissions as needed +
    + +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Calendar Name + + + + + + + + + +
    + Calendar Permissions + + +
    + +
      +
    • Public: everyone have read permission, and can see the items, registered + and un-reg-ed users alike. +
    • Private: only those you choose to be the audience of the calendar can see the items. +
    +
    + +
    + +

    + + Manage Calendar Audiences + +

    + +
    +
    Index: openacs-4/packages/calendar/www/admin/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/admin/Attic/one.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/admin/one.tcl 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,114 @@ +# /packages/calendar/www/admin/one.tcl + +ad_page_contract { + + tcl support file for one.adp + + @author Gary Jin (gjin@arsdigita.com) + + @action the action that's going to be performed. view, add, edit, delete, permissions + @calendar_name the name of the calendar + @calendar_permission the permissions of the calendar + + @creation-date Dec 14, 2000 + @cvs-id $Id: one.tcl,v 1.1 2001/04/23 23:09:38 donb Exp $ +} { + {action view} + {calendar_id:integer ""} +} -properties { + action:onevalue + party_id:onevalue + calendar_name:onevalue + calendar_permission:onevalue + + title:onevalue + context_bar:onevalue + + audiences:multirow +} + +# get party_id of the calendar_admin +set party_id [ad_verify_and_get_user_id] + +# TODO: should be a proc here to make sure +# user truly has the calendar admin privilege + + +# action is edit +if { [string equal $action "edit" ] } { + # make sure that calendar_id exist, barf if not + + if { ![empty_string_p $calendar_id] } { + + #set context bar and title + set context_bar "Edit" + set title ": Edit a Calendar" + + # get calendar name + set calendar_name [calendar_get_name $calendar_id] + + # get calendar permission + if { [calendar_public_p $calendar_id] } { + set calendar_permission "public" + } else { + set calendar_permission "private" + } + + } else { + ad_return_complaint 1 "Calendar_id is required but not supplied!" + } + + +# action is add +} elseif { [string equal $action "add" ] } { + + #set context bar and title + set context_bar "Create" + set title ": Create a Calendar" + + +# action is view +} elseif { [string equal $action "view"] } { + + #set context bar and title + set context_bar "Create" + set title ": Create a Calendar" + + +# action is delete +} elseif { [string equal $action "delete"] } { + + #set context bar and title + set context_bar "Delete" + set title ": Delete a Calendar" + + +# action is permission +} elseif { [string equal $action "permission"] } { + + #set context bar and title + set context_bar "permissions" + set title ": Manage Calendar Permissions" + + # get calendar_name + set calendar_name [calendar_get_name $calendar_id] + + # list the audiences of the user + # note: this would be supported a more complex UI + # i am envision it somewhat like the file-storage system + # where you can expand the levels.. after this versions though + + db_multirow audiences get_calendar_audiences { + select unique(grantee_id) as party_id, + acs_object.name(grantee_id) as name + from acs_permissions + where object_id = :calendar_id + } + +} + + + + + + Index: openacs-4/packages/calendar/www/doc/permissions.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/doc/Attic/permissions.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/doc/permissions.html 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,69 @@ + + + + + +Calendar Package Permissions + + + + + + + +

    Calendar Package Permissions

    + +author: Gary Jin +
    +

    Note: This document will be rolled into the Design Doc in the very near future. + +

    +First, the cal_item permissions: +

      +
    1. read: can view the item +
    2. write: can add and edit the item +
    3. delete: can delete the item +
    4. invite: can allow other parties to see the item +
    + +

    +Second the calendar permissions: +

      +
    1. public: everyone have read permission, and can see the items, registered and un-reg-ed users alike. This implies applying read privilege to +group "Public." +
    2. private: only the member of the party can see the items. This implies granting read privilege to the owner group. I would say read only +'cause it might be undesirable for group members to edit or delete items. +
    + +

    +There three conditions for a calendar: +

      +
    1. by default, all items are public +
    2. by default, all items are private +
    3. by default, no conditions defined. +
    + +

    +The major assumption here is that the Permissions of the Cal_item can overwrite the Permissions of the Calendar. + +

    +Under the first two conditions, when a new cal_item is generated, it will by default inherit either public or private. +If there are no default conditions (3), then the user would need to define what kinda of permission is going to be associated with the +cal_item. + +

    +In generation, the owner of the calendar would need to: +

      +
    1. assign calendar admin. This implies granting read, write, delete, invite permissions to some party. +
    2. assign default calendar permissions (optional). +
    + +

    +The calendar admin can grant or any combinations of read, write, delete and invite) to other member of the party which uses the particular +calendar on a item specific basis and on a calendar level. Once more, permisssion assigned to specific items can overwrite those of the +calendar. + + +


    +Last Modificed: $Id: permissions.html,v 1.1 2001/04/23 23:09:38 donb Exp $ + \ No newline at end of file Index: openacs-4/packages/calendar/www/doc/requirements.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/doc/requirements.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/doc/requirements.html 23 Apr 2001 23:09:38 -0000 1.1 @@ -0,0 +1,533 @@ + + + + Calendar Package Requirements + + + +

    +Calendar Package Requirements

    +by Gary Jin and W. +Scott Meeks +
    +

    +I. Introduction

    +A calendar is an aggregate of events which fall within a given time interval, +e.g., on a particular day, week, or month. The ArsDigita Calendar application +provides users with a tool which allows them to add, view, edit and organize +these events at both the personal and party/group levels. +

    +II. Vision Statement

    The ArsDigita Calendar application is a Web +based calendar system that can be accessed through any browser. The +application allows people to keep track of events as they normally +would on a paper calendar while giving them the opportunity to share +these events with other parties. Various types of additional +information related to a calendar item, such as an URL, a map indicating a +meeting's location, et cetera, can also be managed through the +Calendar application. The Calendar application also provides different +end-user specifiable presentation formats for viewing this +information. In its current form, the Calendar application can be +integrated with other ACS components, for example, our Intranet +application and our Portals application; eventually the Calendar +application will integrate with yet further systems, for example, PDAs. + +

    Calendar objects have been designed to allow them to be tied to +particular ACS parties where each party member can see events +associated with that particular party. Events from the various parties +of which one is a member can also be shown on a party member's +personal calendar. + +

    This package could be used for any application +where event tracking is important. This would include many +business, educational, club, and other community scenarios. +

    +III. System/Application Overview

    In our system, a +party-specific event is an event associated with a particular +party, typically of the sort scheduled by that party or of particular +interest to members of that party. For example, a reading group may +wish to associate an upcoming book signing event with their reading +group party using the Calendar application. + +

    A user's calendar is the aggregate of the party-specific +events which are associated with parties of which the user is a member +and which have been specified by this user as desirable for calendar +inclusion. Users will have the option to suppress the inclusion of all +party-specific events for a particular party of which they wish to +remain a member but the party-specific events of which they do not +wish to have appear on their calendars. Since in our system, groups +are parties and parties can have calendars, this account of a user's +calendar generalizes to cover a party's calendar. + +

    The Calendar Package is built on top of the ACS Event service +package and performs the following three high-level functions: +

      +
    • +Event Management
    • + +
    • +Calendar Views
    • + +
    • +Navigation
    • +
    +Event Management covers those aspects of the application which pertain +to events, such as adding, editing, viewing, deleting events, and +setting up recurring events. An event is defined as an activity +associated +with one or more time intervals. For instance, "participating in +an ACS bootcamp" is an activity, but "participating in the ACS bootcamp +during the upcoming week" is an event. Therefore, the Event Management +portion would also needs to deal with scheduling issues associated with +adding a temporal aspect to activities . +

    Calendar Views covers those aspects of the application which +pertain to the display of calendar events for a particular span of time. +

    Navigation covers those aspects of the application which pertain +to ways in which the end-user can change the timespan currently being displayed. +

    +IV. Use-cases and User-scenarios

    +There are three main classes of users for the Calendar: +
      +
    • +Individuals
    • + +
    • +Groups and Parties
    • + +
    • +Administrators
    • +
    +The individual is primarily interested in having a personal Web +based calendar. The calendar needs to support the manipulation of basic +calendar event components, among these: times, titles, and possibly descriptions. Example: +Irwin Individual wants to be able to manage his schedule from any Web browser +while travelling abroad. He should, by virtue of belonging to different +parties recognized by the system, be able to visit his calendar to +receive updates on party-specific events for these parties, retrieve clerical +information regarding his upcoming commitments, and add local events which +are specific to his travels. +

    Groups and Parties can have a collective calendar that stands +apart from the private individual calendar. This would be useful to display +calendar events for the public, for whom there is no individual calendar. +For example, ArsDigita can display a schedule of upcoming bootcamps, lectures +and other approved events on a calendar on arsdigita.com. A +common visitor does not have to be registered with the site to be able +to obtain this event information through their personal calendar. +To allow this functionality, the calendars for groups and parties would +need to support all the event managment and calendar views had by individual +calendars, and in addition, the role of calendar administrator must +be assigned to handle event managment. +

    Administrators for a group and party wide calendar are given +create, read, and write permissions on each individual item on the calendar. +He or she also has the privilege to change the permissions for each of +these items and also individual's ability to interact with these items. +For example, the side-wide administrator, Joe Admin, who also has the role +of the calendar administrator realizes that the date on which one of the +ACS bootcamps is scheduled to take place this month is incorrect. He has the permission to +change it. He also can grant Jane Bootcamp write permission on that particular +event, so that Jane can make changes on her own. +

    +V. Related Links

    + + + +

    +VI.A Requirements: Private Calendar

    +10 Private Calendar +

    10.0 User Interface +

    10.0.10 The calendar page should indicate whether or not private, +public or party-specific events are to be displayed. +

    10.0.20 The calendar should support navigation to view different +dates in a simple manner. +

    10.0.30 Links to different calendar functions should be clear +and obvious. +

    10.0.40 Each calendar item should be displayed with its subject +and time span as the basic information. +

    10.10 Views +

    10.10.0 Different views should be easily selectable. +

    10.10.0 Different views should also be indicated in a clear and +noticeable location +

    10.10.10 List View +

    10.10.10.10 The calendar should support a view showing selected +items in a tabular list format. +

    10.10.10.20 Columns should include date, time, and other relevant +information. +

    10.10.10.30 The columns should be sortable. +

    10.10.10.40 There should be at least two lists of items. One +list should consist of items whose dates occur within a user-specified +number of days of the currently viewed date. One list should consist of +items that have been added within a user-specified number of days of the +current date. +

    10.10.20 Day View +

    10.10.20.10 The calendar should support a view showing all the +events for a particular day. +

    10.10.20.20 This view should show the events arranged chronologically +with a time guide along one side. +

    10.10.20.30 The range of the time guide should be user-specifiable. +

    10.10.20.40 The user should have the option of compressing the +time guide so that only those time intervals upon which fall selected calendar +events are shown. +

    10.10.20.50 Overlapping events should be displayed in an easy +to understand fashion. +

    10.10.20.60 There should be a simple mechanism for adding events +which start at a particular hour. +

    10.10.20.70 The day view should support events that don't have +a specified start and end time, and the time guide should include a slot +for these items. +

    10.10.30 Week View +

    10.10.30.10 The calendar should support a view showing all the +events for a particular week. +

    10.10.30.20 The events for a particular day should be grouped +together. +

    10.10.30.30 There should be a simple mechanism for adding an +event for a particular day. +

    10.10.30.40 The currently selected day should be highlighted +or otherwise clearly indicated to the user. +

    10.10.30.50 There should some way to move to the next and previous +week from this particular view. +

    10.10.40 Month View +

    10.10.40.10 The calendar should support a view showing all the +items for a particular month. +

    10.10.40.20 The events for a particular day should be grouped +together. +

    10.10.40.30 There should be a simple mechanism for adding an +event for a particular day. +

    10.10.40.40 The currently selected day should be indicated. +

    10.10.40.50 The application should display only some of the events +per day on the month calendar as oppose to every item. +

    10.10.40.60 There should some way to move to the next and previous +week from this particular view. +

    10.10.40.70 For each day, there should be a link to the day view +for that day. +

    10.10.50 Year View +

    10.10.50.10 As a navigational mechanism, the calendar should +support a view that shows all months and days in a particular year but +not necessarily with any information on items for the days displayed. +

    10.10.50.20 For each month, there should be a link to the month +view of that month. +

    10.10.50.30 For each day, there should be a link to the day view +of that day. +

    10.20 Navigation +

    10.20.10 Navigation Widget +

    10.20.10.10 The calendar should provide a widget for collecting +together related navigation links. This should be similar to the widget +provided by Yahoo Calendar and +Excite +Planner. +

    10.20.10.20 Navigation to a different date should maintain the +same view. +

    10.20.10.30 In the list, day, and week views, the widget should +display a mini calendar of the days of the current month. Each day should +be a link except for the currently viewed day which should not be a link +and should be highlighted in some manner. +

    10.20.10.40 In the month view, the widget should contain a list +of the months of the year. Each month should be a link except for the month +containing the currently viewed day which should not be a link and should +be highlighted in some manner. +

    10.20.10.50 In the year view, the widget should contain a short +list of years before and after the current year. Each year should be a +link except for the year containing the currently viewed day which should +not be a link and should be highlighted in some manner. +

    10.20.10.60 The widget should contain some mechanism for entering +an arbitrary date using a clearly defined format, such as that employed +by Yahoo Calendar. +

    10.20.10.70 The widget should clearly display today's date along +with some mechanism for navigating to that date. +

    10.20.10.80 In the list, day, and week views there should be +a mechanism for jumping forwards or backwards by a whole month at a time. +

    10.20.10.90 In the month and year views, there should be a mechanism +for jumping forwards or backwards by a year at a time. +

    10.20.20 View Specific Navigation +

    10.20.20.10 Each view except for 'list' should have some easy +mechanism for jumping forward or backward by the interval being viewed. +

    10.20.20.20 Selecting a day in week, month, or year view should +take you to the day view for the that day. +

    10.20.20.30 Selecting a month in year view should take you to +the month view for that month. +

    10.30 Adding Events +

    10.30.10 Adding an event should involve entering information +for the event in a form and then submitting that form. Form should include +title, start date and time, or an explicit indication that the event does +not have a start time. Default values should already be entered with +the correct time zone offset in place. Non-required fields should include +end time or duration, type information, a description, to which party the +event belongs, and an indicator as to whether or not this event recurs. +

    10.30.20 There should be a simple, clearly labeled link for adding +an event. The date should default to the currently viewed date and +the present time. +

    10.30.30 The time guide in the day view should have links from +each hour and from the slot for items with no start time. +

    10.30.40 Selecting the 'no start time' link should bring up the +form with the date defaulting to the currently viewed date and the 'no +start time' indicator set. +

    10.30.50 Selecting a link from a specific hour should bring up +the form with the date defaulting to the currently viewed date, the start +time to the hour selected, and the end time to one hour later. +

    10.30.60 The week view should have a link for each day for adding +an item. +

    10.30.70 The month view should have a link for each day for adding +an item. +

    10.30.80 As in the Yahoo style calendar, there should be a 'quick +add' box on the side of their calendar that allows user to add events quickly +without having to click through on different days and different views. +

    10.40 Viewing Events +

    10.40.10 Selecting an event's title from any view should display +details for that event, including links to edit, add attachment, and delete. +

    10.50 Editing Events +

    10.50.10 While viewing an event, select 'Edit'. You should get +a form allowing you to edit the title, date, times, types, and description +for the event. Non-recurring items should have a "Repeat?" field but not +an "Update?" field. [need to clarify what this means] +

    10.60 Adding Recurring Events +

    10.60.10 If the recurring events indicator is selected in the +form for adding an item, then after submitting that form, a second form +should be presented which summarizes the date and time of the item and +provides fields to set how the item recurs. +

    10.60.20 The form should include fields to enter the type of +interval, the number of intervals between recurrences, and any specific +information for the selected type of interval. +

    10.70 Editing Recurring Events +

    10.70.10 Selecting Edit when viewing a repeating item should +add a field at the bottom of the form to specify whether any changes should +be applied to only the current instance being edited or to all instances +of this recurring item. +

    10.80 Adding Attachments to Events +

    10.80.10 When viewing an item, there should be a link to add +an attachment to that item. Selecting that link should bring up a form +to add attachments of various types. +

    10.80.20 The form should include a field for the title of the +attachment. +

    10.80.30 One type of admissible attachment supported should be +an uploaded file. This type should be handled in the standard ACS manner. +

    10.80.40 One type of admissible attachment should be a URL. +

    10.80.50 One type of admissible attachment should be a block +of text. The form should provide a text box for entering the text and a +way to indicate if the text is plaintext or HTML. +

    10.80.60 After adding an attachment of any sort, the calendar +should return to the view of the item which should have a list of attachments +including the attachment just added. +

    10.80.70 For each attachment listed, there should be displayed +-- when permissions admit -- the title of the attachment, a link to the +content of the attachment, a link to manage the attachment, and a link +to edit it. +

    10.80.80 For a file attachment, the content link should return +the content of the file. +

    10.80.90 For a URL attachment, the content link should navigate +to the URL. +

    10.80.100 For a text attachment, the content link should display +the entered text. +

    10.80.110 The manage link links to the management page of the +corresponding file in the file-storage system. [file-storage or +CR?] +

    10.80.120 The edit link allows direct editing of the content +of the attachment. +

    10.90 Inviting other groups to view Events +

    10.90.10 The application should have a link that lets the owner +of the event to invite other groups, individual or parties to add this +event to their personal calendars. +

    10.100 Deleting events +

    10.100.10 When viewing an item, there should be a link to delete +that item. +

    10.100.20 Selecting the delete link should bring up a confirmation +dialog. +

    10.100.30 If the item is not recurring, then the choice button +will simply be labeled 'OK'. +

    10.100.40 If the item is recurring, then in addition to the choice +buttons, there should be a selection to indicate either the current instance +only or all occurrences. +

    10.100.50 Selecting 'Cancel' should return to the item view. +

    10.100.60 Selecting 'OK' should delete the item in question. +

    10.100.70 If the item was recurring and 'all occurrences' had +been selected, then all other occurrences of the item should be deleted +as well. +

    10.100.80 Selecting OK should return to the view where the item +was originally selected. +

    +VI.B Requirements: Party-Specific Events

    +20 Party-Specific Events +

    20.10 The calendar should display a list of calendars to which +the user has access. At a minimum, this will include the user's +personal calendar and a public events calendar. If the user belongs to +parties that have party-specific events associated with them, there should +be additional links to these party-specific events as well as the calendar +of the party to which the user belongs. +

    20.30 On the personal calendar, there should also be a toggle +for each such party that controls whether or not events from that party +appear on the personal calendar. +

    20.40 On a user's calendar, party-specific events should indicate +to which party they are specific. +

    20.50 The link for adding an event should clearly indicate whether +a party-specific item or a personal item will be created. +

    +VI.C Requirements: Managing Party-Specific Events

    +30 Managing Party-Specific Events +

    30.10 If the user has write permission to any parties, when he +chooses to add an event, the choice of which party to associate with that +event is given. +

    30.20 There should also be a page where permissions of read, +write, approve, and delete can be given to different parties +

    30.30 There should be a link to the admin page for the group. +

    30.40 There should be a way to delete the calendar. This +route should involve passing the user through a confirmation dialog. +

    +VI.D Requirements: Calendar Administration

    +40 Calendar Administration +

    40.10 Calendar User Privilege Administration +

    40.10.10 Cal Admin must have access to pages where permissions +can be set for different parties +

    40.10.20 Cal Admin can also add new user party/groups/person +to the entire calendar +

    40.10.30 Cal Admin can also add new user party/groups/person +to indivdual calendar items +

    40.20 Calendar Items Administration +

    40.20.10 Provides the funcationality to delete, add, edit any +item on the calendar +

    40.20.20 Provides the funcatinality to allow Calendar Administrator +to change the permissions on each calendar item. +

    40.20.20 Provides the funcatinality to allow Calendar Administrator +to change the default permissions of the entire calendar +
    +

    +VI.E Requirements: API

    +50 API +

    50.10 Calendar Events Manipulation +

    50.10.10 Provide a function to add a new item to a calendar. +This function should support specifying all the values that can be specified +in the 'add item' form. It should allow creating either a user or +a party-specific item. Iit should support specifying a mapping between +the new item and an arbitrary object in the database. +

    50.20 Calendar Views +

    50.20.10 Provide a function to generate the HTML for the list +view. +

    50.20.20 Provide a function to generate the HTML for the day +view. +

    50.20.30 Provide a function to generate the HTML for the week +view. +

    50.20.40 Provide a function to generate the HTML for the month +view. +

    50.20.50 Provide a function to generate the HTML for the year +view. +

    50.20.60 Provide a function to generate the HTML for the calendar +navigation. +

    50.20.70 Provide a function to generate the HTML for the complete +calendar. +

    +VII. Revision History

    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Document Revision #Action Taken, NotesWhen?By Whom?
    0.1Creation2000/10/25W. Scott Meeks
    0.2Emendation2000/11/10Gary Jin
    0.3Edit for Content and Consistency2000/11/10Joshua Finkler
    0.4Additional revisions and included cX-Mozilla-Status: 0009eview2000/11/30Gary Jin
    0.5Further Revisions2000/12/02Joshua Finkler
    0.6Revisions of User Cases and Scenario sections and applied corrections.2000/12/04Gary Jin
    0.7Further Revisions2000/12/06Joshua Finkler and Gary Jin
    + +

    +


    +
    +gjin@arsdigita.com and smeeks@arsdigita.com
    + + + + +