Index: openacs-4/contrib/packages/room-reservation/room-reservation.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/room-reservation.info,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/room-reservation.info 15 Mar 2004 03:39:29 -0000 1.1
@@ -0,0 +1,134 @@
+
+
+
+
+ Room Reservation
+ Room Reservations
+ f
+ f
+
+
+
+ oracle
+ postgresql
+
+ Deds Castillo
+ Room Reservation
+ Infiniteinfo
+ Room Reservation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/#reservations-create.sql#
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/Attic/#reservations-create.sql#,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/#reservations-create.sql# 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,98 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: #reservations-create.sql#,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the table stuff
+create table rr_reservations (
+ reservation_id integer
+ constraint rr_r_reservation_id_nn
+ not null
+ constraint rr_r_reservation_id_fk
+ references acs_events (event_id)
+ constraint rr_r_reservation_id_pk
+ primary key,
+ room_id integer
+ constraint rr_reservations_room_id_nn
+ not null
+ constraint rr_reservations_room_id_fk
+ references rr_rooms (room_id),
+ reserving_user integer
+ constraint rr_r_reserving_user_nn
+ not null
+ constraint rr_r_reserving_user_fk
+ references users (user_id),
+ attendees integer,
+ note varchar(400),
+ contact_person varchar(200),
+ contact_email varchar(100),
+ contact_phone varchar(50),
+ status varchar(100)
+ default 'pending'
+ constraint rr_reservations_status_nn
+ not null
+ constraint rr_reservations_status_ck
+ check (status in ('pending','approved','rejected','canceled')),
+ reason varchar(400),
+ action_user integer
+ constraint rr_reservations_action_user_fk
+ references users (user_id),
+ action_date timestamp
+);
+
+-- let's do the views stuff
+create view rr_reservations_approve
+as
+ select *
+ from rr_reservations
+ where status = 'approved';
+
+create view rr_reservations_reject
+as
+ select *
+ from rr_reservations
+ where status = 'rejected';
+
+create view rr_reservations_pending
+as
+ select *
+ from rr_reservations
+ where status = 'pending';
+
+create view rr_reservations_cancel
+as
+ select *
+ from rr_reservations
+ where status = 'canceled';
+
+-- let's create our object
+create function inline_0 ()
+returns integer as'
+begin
+ perform acs_object_type__create_type(
+ ''rr_reservation'', -- object_type
+ ''Room Reservation'', -- pretty_name
+ ''Room Reservations'', -- pretty_plural
+ ''acs_event'', -- supertype
+ ''rr_reservations'', -- table_name
+ ''reservation_id'', -- id_column
+ ''rr_reservations'', -- package_name
+ ''f'', -- abstract_p
+ null, -- type_extensions_table
+ null -- name_method
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/#rooms-create.sql#
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/Attic/#rooms-create.sql#,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/#rooms-create.sql# 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,95 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: #rooms-create.sql#,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the table stuff
+create table rr_rooms (
+ room_id integer
+ constraint rr_rooms_room_id_nn
+ not null
+ constraint rr_rooms_room_id_fk
+ references acs_objects (object_id)
+ constraint rr_rooms_room_id_pk
+ primary key,
+ name varchar(200)
+ constraint rr_rooms_name_nn
+ not null,
+ facility_id integer
+ constraint rr_rooms_facility_id_nn
+ not null
+ constraint rr_rooms_facility_id_fk
+ references rr_facilities (facility_id),
+ description varchar(400),
+ capacity integer
+ constraint rr_rooms_capacity_nn
+ not null,
+ phone varchar(50),
+ -- is this an open facility?
+ approval_needed_p char(1)
+ default 't'
+ constraint rr_rooms_approval_needed_p_nn
+ not null
+ constraint rr_rooms_approval_needed_p_ck
+ check (approval_needed_p in ('t','f')),
+ enabled_p char(1)
+ default 't'
+ constraint rr_rooms_enabled_p_nn
+ not null
+ constraint rr_rooms_enabled_p_ck
+ check (enabled_p in ('t','f')),
+ constraint rr_rooms_name_un
+ unique (name, facility_id)
+);
+
+
+-- let's do the views stuff
+-- CM added package_id from facilities
+-- Should we only be including enabled facilities?
+
+--create or replace view rr_rooms_enabled
+--as
+-- select r.*, package_id
+-- from rr_rooms r, rr_facilities f
+-- where r.enabled_p = 't'
+-- and r.facility_id = r.facility_id;
+
+create view rr_rooms_enabled
+as
+ select *
+ from rr_rooms
+ where enabled_p = 't';
+
+create view rr_rooms_disabled
+as
+ select *
+ from rr_rooms
+ where enabled_p = 'f';
+
+-- let's create our object
+create function inline_0 ()
+returns integer as'
+begin
+ perform acs_object_type__create_type(
+ ''rr_room'', -- object_type
+ ''Room'', -- pretty_name
+ ''Rooms'', -- pretty_plural
+ ''acs_object'', -- supertype
+ ''rr_rooms'', -- table_name
+ ''room_id'', -- id_column
+ ''rr_rooms'', -- package_name
+ ''f'', -- abstract_p
+ null, -- type_extensions_table
+ ''rr_rooms__name'' -- name_method
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,108 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: facilities-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the permissions stuff
+begin;
+ select acs_privilege__create_privilege('room_reservation_view',null,null);
+ select acs_privilege__create_privilege('room_reservation_create',null,null);
+ select acs_privilege__create_privilege('room_reservation_delete',null,null);
+ select acs_privilege__create_privilege('room_reservation_modify',null,null);
+ select acs_privilege__create_privilege('room_reservation_admin','Room Reservations Administrator',null);
+
+ -- temporarily drop this trigger to avoid a data-change violation
+ -- on acs_privilege_hierarchy_index while updating the child privileges.
+
+ drop trigger acs_priv_hier_ins_del_tr on acs_privilege_hierarchy;
+
+ -- bind privileges to global names
+ select acs_privilege__add_child('create','room_reservation_create');
+ select acs_privilege__add_child('write','room_reservation_modify');
+ select acs_privilege__add_child('read','room_reservation_view');
+ select acs_privilege__add_child('delete','room_reservation_delete');
+
+ select acs_privilege__add_child('admin','room_reservation_admin');
+
+
+ select acs_privilege__add_child('room_reservation_admin','room_reservation_view');
+ select acs_privilege__add_child('room_reservation_admin','room_reservation_create');
+ select acs_privilege__add_child('room_reservation_admin','room_reservation_delete');
+
+ -- re-enable the trigger before the last insert to force the
+ -- acs_privilege_hierarchy_index table to be updated.
+
+ create trigger acs_priv_hier_ins_del_tr after insert or delete
+ on acs_privilege_hierarchy for each row
+ execute procedure acs_priv_hier_ins_del_tr ();
+
+ select acs_privilege__add_child('room_reservation_admin','room_reservation_modify');
+end;
+
+-- let's do the table stuff
+create table rr_facilities (
+ facility_id integer
+ constraint rr_facilities_facility_id_nn
+ not null
+ constraint rr_facilities_facility_id_fk
+ references acs_objects (object_id)
+ constraint rr_facilities_facility_id_pk
+ primary key,
+ name varchar(200)
+ constraint rr_facilities_name_un
+ unique
+ constraint rr_facilities_name_nn
+ not null,
+ description varchar(400),
+ enabled_p char(1)
+ default 't'
+ constraint rr_facilities_enabled_p_nn
+ not null
+ constraint rr_facilities_enabled_p_ck
+ check (enabled_p in ('t','f')),
+ -- to keep track of instances
+ package_id integer
+ constraint rr_facilities_package_id_nn
+ not null
+);
+
+-- let's do the views stuff
+create view rr_facilities_enabled
+as
+ select *
+ from rr_facilities
+ where enabled_p = 't';
+
+create view rr_facilities_disabled
+as
+ select *
+ from rr_facilities
+ where enabled_p = 'f';
+
+-- let's create our object
+create function inline_0 ()
+returns integer as'
+begin
+ perform acs_object_type__create_type(
+ ''rr_facility'', -- object_type
+ ''Facility'', -- pretty_name
+ ''Facilities'', -- pretty_plural
+ ''acs_object'', -- supertype
+ ''rr_facilities'', -- table_name
+ ''facility_id'', -- id_column
+ ''rr_facilities'', -- package_name
+ ''f'', -- abstract_p
+ null, -- type_extensions_table
+ ''rr_facilities__name'' -- name_method
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,84 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: facilities-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the permissions stuff
+create function inline_0()
+returns integer as '
+begin
+ -- temporarily drop this trigger to avoid a data-change violation
+ -- on acs_privilege_hierarchy_index while updating the child privileges.
+ drop trigger acs_priv_hier_ins_del_tr on acs_privilege_hierarchy;
+
+ -- remove children
+ perform acs_privilege__remove_child(''room_reservation_admin'',''room_reservation_modify'');
+ perform acs_privilege__remove_child(''room_reservation_admin'',''room_reservation_delete'');
+ perform acs_privilege__remove_child(''room_reservation_admin'',''room_reservation_create'');
+ perform acs_privilege__remove_child(''room_reservation_admin'',''room_reservation_view'');
+
+ perform acs_privilege__remove_child(''admin'',''room_reservation_admin'');
+
+ perform acs_privilege__remove_child(''delete'',''room_reservation_delete'');
+ perform acs_privilege__remove_child(''read'',''room_reservation_view'');
+ perform acs_privilege__remove_child(''write'',''room_reservation_modify'');
+
+ -- re-enable the trigger before the last insert to force the
+ -- acs_privilege_hierarchy_index table to be updated.
+ create trigger acs_priv_hier_ins_del_tr after insert or delete
+ on acs_privilege_hierarchy for each row
+ execute procedure acs_priv_hier_ins_del_tr ();
+
+ perform acs_privilege__remove_child(''create'',''room_reservation_create'');
+
+ perform acs_privilege__drop_privilege(''room_reservation_admin'');
+ perform acs_privilege__drop_privilege(''room_reservation_modify'');
+ perform acs_privilege__drop_privilege(''room_reservation_delete'');
+ perform acs_privilege__drop_privilege(''room_reservation_create'');
+ perform acs_privilege__drop_privilege(''room_reservation_view'');
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
+
+-- let's remove permissions (PARANOIA)
+delete from acs_permissions where object_id in (select facility_id from rr_facilities);
+
+-- let's do the views stuff
+drop view rr_facilities_enabled;
+drop view rr_facilities_disabled;
+
+-- let's do the table stuff
+drop table rr_facilities;
+
+-- let's remove our objects and our object type
+
+create function inline_0 ()
+returns integer as '
+declare
+ object_rec record;
+begin
+ -- drop objects first
+ for object_rec in select object_id from acs_objects where object_type=''rr_facility''
+ loop
+ PERFORM acs_object__delete( object_rec.object_id );
+ end loop;
+
+ -- drop the type
+ perform acs_object_type__drop_type (
+ ''rr_facility'', ''f''
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0 ();
+
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,95 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: facilities-package-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_facilities__new','facility_id,object_type;rr_facility,name,description,package_id,creation_date,creation_user,creation_ip,context_id');
+
+create or replace function rr_facilities__new (integer,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_description alias for $4;
+ p_package_id alias for $5;
+ p_creation_date alias for $6;
+ p_creation_user alias for $7;
+ p_creation_ip alias for $8;
+ p_context_id alias for $9;
+ v_facility_id integer;
+begin
+ v_facility_id:= acs_object__new(
+ p_facility_id,
+ p_object_type,
+ p_creation_date,
+ p_creation_user,
+ p_creation_ip,
+ coalesce(p_context_id, p_package_id)
+ );
+
+ insert into rr_facilities
+ (facility_id, name, description, package_id)
+ values
+ (v_facility_id, p_name, p_description, p_package_id);
+
+ perform acs_object__update_last_modified(coalesce(p_context_id, p_package_id), p_creation_user, p_creation_ip);
+
+ return v_facility_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_facilities__edit','facility_id,name,description,package_id,edit_user,edit_ip');
+
+create or replace function rr_facilities__edit (integer,varchar,varchar,integer,integer,varchar)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+ p_name alias for $2;
+ p_description alias for $3;
+ p_package_id alias for $4;
+ p_edit_user alias for $5;
+ p_edit_ip alias for $6;
+begin
+ update rr_facilities
+ set name = p_name,
+ description = p_description
+ where facility_id = p_facility_id and
+ package_id = p_package_id;
+
+ perform acs_object__update_last_modified(p_facility_id, p_edit_user, p_edit_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_facilities__name','facility_id');
+
+create or replace function rr_facilities__name(integer)
+returns varchar as '
+declare
+ p_facility_id alias for $1;
+begin
+ return name from rr_facilities where facility_id = p_facility_id;
+end;
+' language 'plpgsql';
+
+
+-- delete a facility
+select define_function_args('rr_facilities__delete','facility_id');
+
+create or replace function rr_facilities__delete(integer)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+begin
+ perform acs_object__delete(p_facility_id);
+ return 0;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-create.sql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/Attic/facilities-package-create.sql~,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-create.sql~ 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,93 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: facilities-package-create.sql~,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_facilities__new','facility_id,object_type;rr_facility,name,description,package_id,creation_date,creation_user,creation_ip,context_id');
+
+create function rr_facilities__new (integer,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_description alias for $4;
+ p_package_id alias for $5;
+ p_creation_date alias for $6;
+ p_creation_user alias for $7;
+ p_creation_ip alias for $8;
+ p_context_id alias for $9;
+ v_facility_id integer;
+begin
+ v_facility_id:= acs_object__new(
+ p_facility_id,
+ p_object_type,
+ p_creation_date,
+ p_creation_user,
+ p_creation_ip,
+ coalesce(p_context_id, p_package_id)
+ );
+
+ insert into rr_facilities
+ (facility_id, name, description, package_id)
+ values
+ (v_facility_id, p_name, p_description, p_package_id);
+
+ perform acs_object__update_last_modified(coalesce(p_context_id, p_package_id));
+
+ return v_facility_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_facilities__edit','facility_id,name,description,package_id');
+
+create function rr_facilities__edit (integer,varchar,varchar,integer)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+ p_name alias for $2;
+ p_description alias for $3;
+ p_package_id alias for $4;
+begin
+ update rr_facilities
+ set name = p_name,
+ description = p_description
+ where facility_id = p_facility_id and
+ package_id = p_package_id;
+
+ perform acs_object__update_last_modified(p_facility_id);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_facilities__name','facility_id');
+
+create function rr_facilities__name(integer)
+returns varchar as '
+declare
+ p_facility_id alias for $1;
+begin
+ return name from rr_facilities where facility_id = p_facility_id;
+end;
+' language 'plpgsql';
+
+
+-- delete a facility
+select define_function_args('rr_facilities__delete','facility_id');
+
+create function rr_facilities__delete(integer)
+returns integer as '
+declare
+ p_facility_id alias for $1;
+begin
+ perform acs_object__delete(p_facility_id);
+ return 0;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/facilities-package-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,15 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: facilities-package-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's drop our helper functions
+drop function rr_facilities__new (integer,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer);
+drop function rr_facilities__edit (integer,varchar,varchar,integer);
+drop function rr_facilities__name(integer);
+drop function rr_facilities__delete(integer);
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,94 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: reservations-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the table stuff
+create table rr_reservations (
+ reservation_id integer
+ constraint rr_r_reservation_id_nn
+ not null
+ constraint rr_r_reservation_id_fk
+ references acs_events (event_id)
+ constraint rr_r_reservation_id_pk
+ primary key,
+ room_id integer
+ constraint rr_reservations_room_id_nn
+ not null
+ constraint rr_reservations_room_id_fk
+ references rr_rooms (room_id),
+ reserving_user integer
+ constraint rr_r_reserving_user_nn
+ not null
+ constraint rr_r_reserving_user_fk
+ references users (user_id),
+ attendees integer,
+ note varchar(400),
+ contact_person varchar(200),
+ contact_email varchar(100),
+ contact_phone varchar(50),
+ status varchar(100)
+ default 'pending'
+ constraint rr_reservations_status_nn
+ not null
+ constraint rr_reservations_status_ck
+ check (status in ('pending','approved','rejected','canceled')),
+ reason varchar(400),
+ action_user integer
+ constraint rr_reservations_action_user_fk
+ references users (user_id),
+ action_date timestamp
+);
+
+-- let's do the views stuff
+create view rr_reservations_approve
+as
+ select *
+ from rr_reservations
+ where status = 'approved';
+
+create view rr_reservations_reject
+as
+ select *
+ from rr_reservations
+ where status = 'rejected';
+
+create view rr_reservations_pending
+as
+ select *
+ from rr_reservations
+ where status = 'pending';
+
+create view rr_reservations_cancel
+as
+ select *
+ from rr_reservations
+ where status = 'canceled';
+
+-- let's create our object
+create function inline_0 ()
+returns integer as'
+begin
+ perform acs_object_type__create_type(
+ ''rr_reservation'', -- object_type
+ ''Room Reservation'', -- pretty_name
+ ''Room Reservations'', -- pretty_plural
+ ''acs_event'', -- supertype
+ ''rr_reservations'', -- table_name
+ ''reservation_id'', -- id_column
+ ''rr_reservations'', -- package_name
+ ''f'', -- abstract_p
+ null, -- type_extensions_table
+ null -- name_method
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,56 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: reservations-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's remove permissions (PARANOIA)
+delete from acs_permissions where object_id in (select reservation_id from rr_reservations);
+
+-- let's do the views stuff
+drop view rr_reservations_approve;
+drop view rr_reservations_reject;
+drop view rr_reservations_pending;
+drop view rr_reservations_cancel;
+
+-- let's remove our objects
+
+create function inline_0 ()
+returns integer as '
+declare
+ object_rec record;
+begin
+ -- drop objects first
+ for object_rec in select reservation_id from rr_reservations
+ loop
+ PERFORM rr_reservations__delete( object_rec.reservation_id );
+ end loop;
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0 ();
+
+-- let's do the table stuff
+drop table rr_reservations;
+
+create function inline_1 ()
+returns integer as '
+declare
+begin
+ -- drop the type
+ perform acs_object_type__drop_type (
+ ''rr_reservation'', ''f''
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_1();
+drop function inline_1 ();
+
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,318 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: reservations-package-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_reservations__new','reservation_id,object_type;rr_reservation,name,room_id,reserving_user,attendees,note,contact_person,contact_email,contact_phone,timespan_id,activity_id,creation_date,creation_user,creation_ip,context_id');
+
+create or replace function rr_reservations__new (integer,varchar,varchar,integer,integer,integer,varchar,varchar,varchar,varchar,integer,integer,timestamptz,integer,varchar,integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_room_id alias for $4;
+ p_reserving_user alias for $5;
+ p_attendees alias for $6;
+ p_note alias for $7;
+ p_contact_person alias for $8;
+ p_contact_email alias for $9;
+ p_contact_phone alias for $10;
+ p_timespan_id alias for $11;
+ p_activity_id alias for $12;
+ p_creation_date alias for $13;
+ p_creation_user alias for $14;
+ p_creation_ip alias for $15;
+ p_context_id alias for $16;
+ v_reservation_id integer;
+ v_status rr_reservations.status%TYPE;
+ v_approval_needed_p rr_rooms.approval_needed_p%TYPE;
+begin
+ v_reservation_id := acs_event__new(
+ p_reservation_id, -- event_id
+ p_name, -- name
+ null, -- description
+ ''f'', -- html_p
+ null, -- status_summary
+ p_timespan_id, -- timespan_id
+ p_activity_id, -- activity_id
+ null, -- recurrence_id
+ p_object_type, -- object_type
+ p_creation_date, -- creation_date
+ p_creation_user, -- creation_user
+ p_creation_ip, -- creation_ip
+ coalesce(p_context_id, p_reservation_id) -- context_id
+ );
+
+ insert into rr_reservations
+ (reservation_id, room_id, reserving_user, attendees, note, contact_person, contact_email, contact_phone)
+ values
+ (v_reservation_id, p_room_id, p_reserving_user, p_attendees, p_note, p_contact_person, p_contact_email, p_contact_phone);
+
+-- DEDS: Is this an open room?
+-- If yes, then we can auto approve
+
+ select approval_needed_p
+ into v_approval_needed_p
+ from rr_rooms
+ where room_id = p_room_id;
+
+ if (v_approval_needed_p = ''f'') then
+ perform rr_reservations__approve (p_reservation_id, ''Open Policy Room'',p_creation_user);
+ end if;
+
+ perform acs_object__update_last_modified(p_reservation_id, p_creation_user, p_creation_ip);
+
+ return v_reservation_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__edit','reservation_id,room_id,attendees,note,contact_person,contact_email,contact_phone,status,reason,action_user,action_date,action_ip');
+
+create or replace function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,integer,timestamp,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_attendees alias for $3;
+ p_note alias for $4;
+ p_contact_person alias for $5;
+ p_contact_email alias for $6;
+ p_contact_phone alias for $7;
+ p_status alias for $8;
+ p_reason alias for $9;
+ p_action_user alias for $10;
+ p_action_date alias for $11;
+ p_action_ip alias for $12;
+begin
+ update rr_reservations
+ set room_id = p_room_id,
+ attendees = p_attendees,
+ note = p_note,
+ contact_person = p_contact_person,
+ contact_email = p_contact_email,
+ contact_phone = p_contact_phone,
+ status = p_status,
+ reason = p_reason,
+ action_user = p_action_user,
+ action_date = p_action_date
+ where reservation_id = p_reservation_id;
+
+ perform acs_object__update_last_modified(p_reservation_id,p_action_user,p_action_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__edit','reservation_id,room_id,attendees,note,contact_person,contact_email,contact_phone,edit_user,edit_ip');
+
+create or replace function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar,integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_attendees alias for $3;
+ p_note alias for $4;
+ p_contact_person alias for $5;
+ p_contact_email alias for $6;
+ p_contact_phone alias for $7;
+ p_edit_user alias for $8;
+ p_edit_ip alias for $9;
+begin
+ update rr_reservations
+ set room_id = p_room_id,
+ attendees = p_attendees,
+ note = p_note,
+ contact_person = p_contact_person,
+ contact_email = p_contact_email,
+ contact_phone = p_contact_phone
+ where reservation_id = p_reservation_id;
+
+ perform acs_object__update_last_modified(p_reservation_id, p_edit_user, p_edit_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__get_status','reservation_id');
+
+create or replace function rr_reservations__get_status (integer)
+returns varchar as '
+declare
+ p_reservation_id alias for $1;
+ v_status rr_reservations.status%TYPE;
+begin
+ select status into v_status
+ from rr_reservations
+ where reservation_id = p_reservation_id;
+
+ return v_status;
+end;
+' language 'plpgsql';
+
+-- helper function for approve/reject
+select define_function_args('rr_reservations__set_status','reservation_id,reason,status,action_user,action_ip');
+
+create or replace function rr_reservations__set_status (integer,varchar,varchar,integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_status alias for $3;
+ p_action_user alias for $4;
+ p_action_ip alias for $5;
+ v_room_id rr_reservations.room_id%TYPE;
+ v_attendees rr_reservations.attendees%TYPE;
+ v_note rr_reservations.note%TYPE;
+ v_contact_person rr_reservations.contact_person%TYPE;
+ v_contact_email rr_reservations.contact_email%TYPE;
+ v_contact_phone rr_reservations.contact_phone%TYPE;
+ v_action_date rr_reservations.action_date%TYPE;
+begin
+ v_action_date = now();
+
+-- DEDS: let us get the current values of this
+-- reservation so that we can pass them
+
+ select room_id, attendees, note, contact_person, contact_email, contact_phone
+ into v_room_id, v_attendees, v_note, v_contact_person, v_contact_email, v_contact_phone
+ from rr_reservations
+ where reservation_id = p_reservation_id;
+
+ perform rr_reservations__edit(p_reservation_id, v_room_id, v_attendees, v_note, v_contact_person, v_contact_email, v_contact_phone, p_status, p_reason, p_action_user, v_action_date, p_action_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__approve','reservation_id,reason,action_user,action_ip');
+
+create or replace function rr_reservations__approve (integer,varchar,integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_action_user alias for $3;
+ p_action_ip alias for $4;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''approved'', p_action_user, p_action_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__reject','reservation_id,reason,action_user,action_ip');
+
+create or replace function rr_reservations__reject (integer,varchar,integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_action_user alias for $3;
+ p_action_ip alias for $4;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''rejected'', p_action_user, p_action_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__cancel','reservation_id,reason,action_user,action_ip');
+
+create or replace function rr_reservations__cancel (integer,varchar,integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_action_user alias for $3;
+ p_action_ip alias for $4;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''canceled'', p_action_user, p_action_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+-- delete a reservation
+select define_function_args('rr_reservations__delete','reservation_id');
+
+create or replace function rr_reservations__delete(integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ v_activity_id acs_activities.activity_id%TYPE;
+ v_time_interval_id time_intervals.interval_id%TYPE;
+ v_count integer;
+begin
+-- get the activity this reservation maps to
+ select e.activity_id, t.interval_id
+ into v_activity_id, v_time_interval_id
+ from acs_events e,
+ timespans t
+ where e.timespan_id = t.timespan_id and
+ e.event_id = p_reservation_id;
+
+-- delete the reservation
+ perform acs_object__delete(p_reservation_id);
+
+-- delete the time interval
+ delete from time_intervals where interval_id = v_time_interval_id;
+
+-- are there any other reservations mapped to this activity
+ select count(event_id) into v_count
+ from acs_events
+ where event_id = v_activity_id;
+
+-- if none then delete this activity
+ if (v_count = 0) then
+ perform acs_activity__delete (v_activity_id);
+ end if;
+
+ return 0;
+end;
+' language 'plpgsql';
+
+-- helper for time conflicts
+select define_function_args('rr_reservations__conflict_p','reservation_id,room_id,start_date,end_date');
+
+create or replace function rr_reservations__conflict_p (integer,integer,timestamp,timestamp)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_start_date alias for $3;
+ p_end_date alias for $4;
+ v_conflict_count integer;
+ v_conflict_result char;
+begin
+ select count(event_id) into v_conflict_count
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = p_room_id and
+ not (r.reservation_id = p_reservation_id) and
+ r.status in (''approved'', ''rejected'') and
+ ((p_start_date >= start_date and p_start_date < end_date) or
+ (start_date >= p_start_date and start_date < p_end_date));
+
+ if (v_conflict_count > 0) then
+ v_conflict_result := 1;
+ else
+ v_conflict_result := 0;
+ end if;
+
+ return v_conflict_result;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-create.sql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/Attic/reservations-package-create.sql~,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-create.sql~ 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,310 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: reservations-package-create.sql~,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_reservations__new','reservation_id,object_type;rr_reservation,name,room_id,reserving_user,attendees,note,contact_person,contact_email,contact_phone,timespan_id,activity_id,creation_date,creation_user,creation_ip,context_id');
+
+create function rr_reservations__new (integer,varchar,varchar,integer,integer,integer,varchar,varchar,varchar,varchar,integer,integer,timestamp,integer,varchar,integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_room_id alias for $4;
+ p_reserving_user alias for $5;
+ p_attendees alias for $6;
+ p_note alias for $7;
+ p_contact_person alias for $8;
+ p_contact_email alias for $9;
+ p_contact_phone alias for $10;
+ p_timespan_id alias for $11;
+ p_activity_id alias for $12;
+ p_creation_date alias for $13;
+ p_creation_user alias for $14;
+ p_creation_ip alias for $15;
+ p_context_id alias for $16;
+ v_reservation_id integer;
+ v_status rr_reservations.status%TYPE;
+ v_approval_needed_p rr_rooms.approval_needed_p%TYPE;
+begin
+ v_reservation_id := acs_event__new(
+ p_reservation_id, -- event_id
+ p_name, -- name
+ null, -- description
+ ''f'', -- html_p
+ null, -- status_summary
+ p_timespan_id, -- timespan_id
+ p_activity_id, -- activity_id
+ null, -- recurrence_id
+ p_object_type, -- object_type
+ p_creation_date, -- creation_date
+ p_creation_user, -- creation_user
+ p_creation_ip, -- creation_ip
+ coalesce(p_context_id, p_reservation_id) -- context_id
+ );
+
+ insert into rr_reservations
+ (reservation_id, room_id, reserving_user, attendees, note, contact_person, contact_email, contact_phone)
+ values
+ (v_reservation_id, p_room_id, p_reserving_user, p_attendees, p_note, p_contact_person, p_contact_email, p_contact_phone);
+
+-- DEDS: Is this an open room?
+-- If yes, then we can auto approve
+
+ select approval_needed_p
+ into v_approval_needed_p
+ from rr_rooms
+ where room_id = p_room_id;
+
+ if (v_approval_needed_p = ''f'') then
+ perform rr_reservations__approve (p_reservation_id, ''Open Policy Room'',p_creation_user);
+ end if;
+
+ perform acs_object__update_last_modified(p_reservation_id);
+
+ return v_reservation_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__edit','reservation_id,room_id,attendees,note,contact_person,contact_email,contact_phone,status,reason,action_user,action_date');
+
+create function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,integer,timestamp)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_attendees alias for $3;
+ p_note alias for $4;
+ p_contact_person alias for $5;
+ p_contact_email alias for $6;
+ p_contact_phone alias for $7;
+ p_status alias for $8;
+ p_reason alias for $9;
+ p_action_user alias for $10;
+ p_action_date alias for $11;
+begin
+ update rr_reservations
+ set room_id = p_room_id,
+ attendees = p_attendees,
+ note = p_note,
+ contact_person = p_contact_person,
+ contact_email = p_contact_email,
+ contact_phone = p_contact_phone,
+ status = p_status,
+ reason = p_reason,
+ action_user = p_action_user,
+ action_date = p_action_date
+ where reservation_id = p_reservation_id;
+
+ perform acs_object__update_last_modified(p_reservation_id);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__edit','reservation_id,room_id,attendees,note,contact_person,contact_email,contact_phone');
+
+create function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_attendees alias for $3;
+ p_note alias for $4;
+ p_contact_person alias for $5;
+ p_contact_email alias for $6;
+ p_contact_phone alias for $7;
+begin
+ update rr_reservations
+ set room_id = p_room_id,
+ attendees = p_attendees,
+ note = p_note,
+ contact_person = p_contact_person,
+ contact_email = p_contact_email,
+ contact_phone = p_contact_phone
+ where reservation_id = p_reservation_id;
+
+ perform acs_object__update_last_modified(p_reservation_id);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__get_status','reservation_id');
+
+create function rr_reservations__get_status (integer)
+returns varchar as '
+declare
+ p_reservation_id alias for $1;
+ v_status rr_reservations.status%TYPE;
+begin
+ select status into v_status
+ from rr_reservations
+ where reservation_id = p_reservation_id;
+
+ return v_status;
+end;
+' language 'plpgsql';
+
+-- helper function for approve/reject
+select define_function_args('rr_reservations__set_status','reservation_id,reason,status,action_user');
+
+create function rr_reservations__set_status (integer,varchar,varchar,integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_status alias for $3;
+ p_action_user alias for $4;
+ v_room_id rr_reservations.room_id%TYPE;
+ v_attendees rr_reservations.attendees%TYPE;
+ v_note rr_reservations.note%TYPE;
+ v_contact_person rr_reservations.contact_person%TYPE;
+ v_contact_email rr_reservations.contact_email%TYPE;
+ v_contact_phone rr_reservations.contact_phone%TYPE;
+ v_action_date rr_reservations.action_date%TYPE;
+begin
+ v_action_date = now();
+
+-- DEDS: let us get the current values of this
+-- reservation so that we can pass them
+
+ select room_id, attendees, note, contact_person, contact_email, contact_phone
+ into v_room_id, v_attendees, v_note, v_contact_person, v_contact_email, v_contact_phone
+ from rr_reservations
+ where reservation_id = p_reservation_id;
+
+ perform rr_reservations__edit(p_reservation_id, v_room_id, v_attendees, v_note, v_contact_person, v_contact_email, v_contact_phone, p_status, p_reason, p_action_user, v_action_date);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__approve','reservation_id,reason,action_user');
+
+create function rr_reservations__approve (integer,varchar,integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_action_user alias for $3;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''approved'', p_action_user);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_reservations__reject','reservation_id,reason,action_user');
+
+create function rr_reservations__reject (integer,varchar,integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+ p_action_user alias for $3;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''rejected'', p_action_user);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+
+select define_function_args('rr_reservations__cancel','reservation_id,reason');
+
+create function rr_reservations__cancel (integer,varchar)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_reason alias for $2;
+begin
+ perform rr_reservations__set_status(p_reservation_id, p_reason, ''canceled'', null);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+-- delete a reservation
+select define_function_args('rr_reservations__delete','reservation_id');
+
+create function rr_reservations__delete(integer)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ v_activity_id acs_activities.activity_id%TYPE;
+ v_time_interval_id time_intervals.interval_id%TYPE;
+ v_count integer;
+begin
+-- get the activity this reservation maps to
+ select e.activity_id, t.interval_id
+ into v_activity_id, v_time_interval_id
+ from acs_events e,
+ timespans t
+ where e.timespan_id = t.timespan_id and
+ e.event_id = p_reservation_id;
+
+-- delete the reservation
+ perform acs_object__delete(p_reservation_id);
+
+-- delete the time interval
+ delete from time_intervals where interval_id = v_time_interval_id;
+
+-- are there any other reservations mapped to this activity
+ select count(event_id) into v_count
+ from acs_events
+ where event_id = v_activity_id;
+
+-- if none then delete this activity
+ if (v_count = 0) then
+ perform acs_activity__delete (v_activity_id);
+ end if;
+
+ return 0;
+end;
+' language 'plpgsql';
+
+-- helper for time conflicts
+select define_function_args('rr_reservations__conflict_p','reservation_id,room_id,start_date,end_date');
+
+create function rr_reservations__conflict_p (integer,integer,timestamp,timestamp)
+returns integer as '
+declare
+ p_reservation_id alias for $1;
+ p_room_id alias for $2;
+ p_start_date alias for $3;
+ p_end_date alias for $4;
+ v_conflict_count integer;
+ v_conflict_result char;
+begin
+ select count(event_id) into v_conflict_count
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = p_room_id and
+ not (r.reservation_id = p_reservation_id) and
+ r.status in (''approved'', ''rejected'') and
+ ((p_start_date >= start_date and p_start_date < end_date) or
+ (start_date >= p_start_date and start_date < p_end_date));
+
+ if (v_conflict_count > 0) then
+ v_conflict_result := 1;
+ else
+ v_conflict_result := 0;
+ end if;
+
+ return v_conflict_result;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/reservations-package-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,20 @@
+-- Facility Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: reservations-package-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+drop function rr_reservations__new (integer,varchar,varchar,integer,integer,integer,varchar,varchar,varchar,varchar,integer,integer,timestamp,integer,varchar,integer);
+drop function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar,varchar,varchar,integer,timestamp);
+drop function rr_reservations__edit (integer,integer,integer,varchar,varchar,varchar,varchar);
+drop function rr_reservations__get_status (integer);
+drop function rr_reservations__set_status (integer,varchar,varchar,integer);
+drop function rr_reservations__approve (integer,varchar,integer);
+drop function rr_reservations__reject (integer,varchar,integer);
+drop function rr_reservations__cancel (integer,varchar);
+drop function rr_reservations__delete(integer);
+drop function rr_reservations__conflict_p (integer,integer,timestamp,timestamp);
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,21 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: room-reservation-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- facilities stuff
+\i facilities-create.sql
+\i facilities-package-create.sql
+
+-- facility rooms stuff
+\i rooms-create.sql
+\i rooms-package-create.sql
+
+-- facility reservations stuff
+\i reservations-create.sql
+\i reservations-package-create.sql
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/room-reservation-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,23 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: room-reservation-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- facility reservations stuff
+-- we drop the table related stuff for reservations
+-- first because we use a function in the package
+\i reservations-drop.sql
+\i reservations-package-drop.sql
+
+-- facility rooms stuff
+\i rooms-package-drop.sql
+\i rooms-drop.sql
+
+-- facilities stuff
+\i facilities-package-drop.sql
+\i facilities-drop.sql
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,85 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: rooms-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's do the table stuff
+create table rr_rooms (
+ room_id integer
+ constraint rr_rooms_room_id_nn
+ not null
+ constraint rr_rooms_room_id_fk
+ references acs_objects (object_id)
+ constraint rr_rooms_room_id_pk
+ primary key,
+ name varchar(200)
+ constraint rr_rooms_name_nn
+ not null,
+ facility_id integer
+ constraint rr_rooms_facility_id_nn
+ not null
+ constraint rr_rooms_facility_id_fk
+ references rr_facilities (facility_id),
+ description varchar(400),
+ capacity integer
+ constraint rr_rooms_capacity_nn
+ not null,
+ phone varchar(50),
+ -- is this an open facility?
+ approval_needed_p char(1)
+ default 't'
+ constraint rr_rooms_approval_needed_p_nn
+ not null
+ constraint rr_rooms_approval_needed_p_ck
+ check (approval_needed_p in ('t','f')),
+ enabled_p char(1)
+ default 't'
+ constraint rr_rooms_enabled_p_nn
+ not null
+ constraint rr_rooms_enabled_p_ck
+ check (enabled_p in ('t','f')),
+ constraint rr_rooms_name_un
+ unique (name, facility_id)
+);
+
+
+-- let's do the views stuff
+create view rr_rooms_enabled
+as
+ select *
+ from rr_rooms
+ where enabled_p = 't';
+
+create view rr_rooms_disabled
+as
+ select *
+ from rr_rooms
+ where enabled_p = 'f';
+
+-- let's create our object
+create function inline_0 ()
+returns integer as'
+begin
+ perform acs_object_type__create_type(
+ ''rr_room'', -- object_type
+ ''Room'', -- pretty_name
+ ''Rooms'', -- pretty_plural
+ ''acs_object'', -- supertype
+ ''rr_rooms'', -- table_name
+ ''room_id'', -- id_column
+ ''rr_rooms'', -- package_name
+ ''f'', -- abstract_p
+ null, -- type_extensions_table
+ ''rr_rooms__name'' -- name_method
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,44 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: rooms-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's remove permissions (PARANOIA)
+delete from acs_permissions where object_id in (select room_id from rr_rooms);
+
+-- let's do the views stuff
+drop view rr_rooms_enabled;
+drop view rr_rooms_disabled;
+
+-- let's do the table stuff
+drop table rr_rooms;
+
+-- let's remove our objects and our object type
+
+create function inline_0 ()
+returns integer as '
+declare
+ object_rec record;
+begin
+ -- drop objects first
+ for object_rec in select object_id from acs_objects where object_type=''rr_room''
+ loop
+ PERFORM acs_object__delete( object_rec.object_id );
+ end loop;
+
+ -- drop the type
+ perform acs_object_type__drop_type (
+ ''rr_room'', ''f''
+ );
+
+ return null;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0 ();
+
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-create.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-create.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,106 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: rooms-package-create.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_rooms__new','room_id,object_type;rr_room,name,facility_id,description,capacity,phone,approval_needed_p,creation_date,creation_user,creation_ip,context_id');
+
+create or replace function rr_rooms__new (integer,varchar,varchar,integer,varchar,integer,varchar,char,timestamp,integer,varchar,integer)
+returns integer as '
+declare
+ p_room_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_facility_id alias for $4;
+ p_description alias for $5;
+ p_capacity alias for $6;
+ p_phone alias for $7;
+ p_approval_needed_p alias for $8;
+ p_creation_date alias for $9;
+ p_creation_user alias for $10;
+ p_creation_ip alias for $11;
+ p_context_id alias for $12;
+ v_room_id integer;
+begin
+ v_room_id:= acs_object__new(
+ p_room_id,
+ p_object_type,
+ p_creation_date,
+ p_creation_user,
+ p_creation_ip,
+ coalesce(p_context_id, p_facility_id)
+ );
+
+ insert into rr_rooms
+ (room_id, name, facility_id, description, capacity, phone, approval_needed_p)
+ values
+ (v_room_id, p_name, p_facility_id, p_description, p_capacity, p_phone, p_approval_needed_p);
+
+ perform acs_object__update_last_modified(p_room_id, p_creation_user, p_creation_ip);
+
+ return v_room_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_rooms__edit','room_id,name,facility_id,description,capacity,phone,approval_needed_p,edit_user,edit_ip');
+
+create or replace function rr_rooms__edit (integer,varchar,integer,varchar,integer,varchar,char,integer,varchar)
+returns integer as '
+declare
+ p_room_id alias for $1;
+ p_name alias for $2;
+ p_facility_id alias for $3;
+ p_description alias for $4;
+ p_capacity alias for $5;
+ p_phone alias for $6;
+ p_approval_needed_p alias for $7;
+ p_edit_user alias for $8;
+ p_edit_ip alias for $9;
+begin
+-- we check on facility_id just
+-- to protect from url surgery hacks
+ update rr_rooms
+ set name = p_name,
+ description = p_description,
+ capacity = p_capacity,
+ phone = p_phone,
+ approval_needed_p = p_approval_needed_p
+ where room_id = p_room_id and
+ facility_id = p_facility_id;
+
+ perform acs_object__update_last_modified(p_room_id,p_edit_user,p_edit_ip);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_rooms__name','room_id');
+
+create or replace function rr_rooms__name(integer)
+returns varchar as '
+declare
+ p_room_id alias for $1;
+begin
+ return name from rr_rooms where room_id = p_room_id;
+end;
+' language 'plpgsql';
+
+
+-- delete a room
+select define_function_args('rr_rooms__delete','room_id');
+
+create or replace function rr_rooms__delete(integer)
+returns integer as '
+declare
+ p_room_id alias for $1;
+begin
+ perform acs_object__delete(p_room_id);
+ return 0;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-create.sql~
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/Attic/rooms-package-create.sql~,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-create.sql~ 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,104 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: rooms-package-create.sql~,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's create helper functions
+select define_function_args('rr_rooms__new','room_id,object_type;rr_room,name,facility_id,description,capacity,phone,approval_needed_p,creation_date,creation_user,creation_ip,context_id');
+
+create function rr_rooms__new (integer,varchar,varchar,integer,varchar,integer,varchar,char,timestamp,integer,varchar,integer)
+returns integer as '
+declare
+ p_room_id alias for $1;
+ p_object_type alias for $2;
+ p_name alias for $3;
+ p_facility_id alias for $4;
+ p_description alias for $5;
+ p_capacity alias for $6;
+ p_phone alias for $7;
+ p_approval_needed_p alias for $8;
+ p_creation_date alias for $9;
+ p_creation_user alias for $10;
+ p_creation_ip alias for $11;
+ p_context_id alias for $12;
+ v_room_id integer;
+begin
+ v_room_id:= acs_object__new(
+ p_room_id,
+ p_object_type,
+ p_creation_date,
+ p_creation_user,
+ p_creation_ip,
+ coalesce(p_context_id, p_facility_id)
+ );
+
+ insert into rr_rooms
+ (room_id, name, facility_id, description, capacity, phone, approval_needed_p)
+ values
+ (v_room_id, p_name, p_facility_id, p_description, p_capacity, p_phone, p_approval_needed_p);
+
+ perform acs_object__update_last_modified(p_room_id);
+
+ return v_room_id;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_rooms__edit','room_id,name,facility_id,description,capacity,phone,approval_needed_p');
+
+create function rr_rooms__edit (integer,varchar,integer,varchar,integer,varchar,char)
+returns integer as '
+declare
+ p_room_id alias for $1;
+ p_name alias for $2;
+ p_facility_id alias for $3;
+ p_description alias for $4;
+ p_capacity alias for $5;
+ p_phone alias for $6;
+ p_approval_needed_p alias for $7;
+begin
+-- we check on facility_id just
+-- to protect from url surgery hacks
+ update rr_rooms
+ set name = p_name,
+ description = p_description,
+ capacity = p_capacity,
+ phone = p_phone,
+ approval_needed_p = p_approval_needed_p
+ where room_id = p_room_id and
+ facility_id = p_facility_id;
+
+ perform acs_object__update_last_modified(p_room_id);
+
+ return 0;
+end;
+' language 'plpgsql';
+
+select define_function_args('rr_rooms__name','room_id');
+
+create function rr_rooms__name(integer)
+returns varchar as '
+declare
+ p_room_id alias for $1;
+begin
+ return name from rr_rooms where room_id = p_room_id;
+end;
+' language 'plpgsql';
+
+
+-- delete a room
+select define_function_args('rr_rooms__delete','room_id');
+
+create function rr_rooms__delete(integer)
+returns integer as '
+declare
+ p_room_id alias for $1;
+begin
+ perform acs_object__delete(p_room_id);
+ return 0;
+end;
+' language 'plpgsql';
Index: openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-drop.sql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/sql/postgresql/rooms-package-drop.sql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,15 @@
+-- Room Reservation Package
+--
+-- @author Deds Castillo (deds@infiniteinfo.com)
+-- @creation-date 2002-08-28
+-- @cvs-id $Id: rooms-package-drop.sql,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+--
+-- Total rewrite though some
+-- concepts were taken from the old
+-- ACS3.x Room Reservation package
+
+-- let's drop our helper functions
+drop function rr_rooms__new (integer,varchar,varchar,integer,varchar,integer,varchar,char,timestamp,integer,varchar,integer);
+drop function rr_rooms__edit (integer,varchar,integer,varchar,integer,varchar,char);
+drop function rr_rooms__name(integer);
+drop function rr_rooms__delete(integer);
Index: openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/calendar-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,116 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select r.reservation_id,
+ r.status,
+ to_char(start_date, 'HH:MIpm') as pretty_start_date,
+ to_char(end_date, 'HH:MIpm') as pretty_end_date,
+ to_char(start_date, 'HH24') as start_hour,
+ to_char(start_date, 'HH24:MI') as start_date,
+ to_char(end_date, 'HH24:MI') as end_date,
+ e.name
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id and
+ start_date >= to_date(:current_date,:date_format) and
+ start_date < to_date(:current_date,:date_format) + 1
+
+
+
+
+
+
+
+ select r.reservation_id,
+ r.status,
+ to_char(start_date, 'HH24') as start_hour,
+ to_char(start_date, 'MM/DD/YYYY') as pretty_date,
+ to_char(start_date, 'Day') as pretty_weekday,
+ to_char(start_date, 'HH:MIpm') as pretty_start_date,
+ to_char(end_date, 'HH:MIpm') as pretty_end_date,
+ e.name
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id and
+ (start_date > to_date(:start_date,:date_format) or :start_date is null) and
+ (start_date < to_date(:end_date,:date_format) or :end_date is null)
+
+
+
+
+
+
+
+ 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')- '1 week'::timespan, 'Sunday'), 'YYYY-MM-DD')
+ as sunday_of_the_week,
+ to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD')
+ as saturday_of_the_week
+ from dual
+
+
+
+
+
+
+
+ select r.reservation_id,
+ r.status,
+ to_char(start_date, 'J') as start_date_julian,
+ to_char(start_date, 'HH:MIpm') as pretty_start_date,
+ to_char(end_date, 'HH:MIpm') as pretty_end_date,
+ to_char(start_date,'HH24:MI') as start_date,
+ to_char(end_date,'HH24:MI') as end_date,
+ e.name
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id and
+ start_date between
+ to_date(:sunday_of_the_week,'YYYY-MM-DD') and
+ to_date(:saturday_of_the_week,'YYYY-MM-DD')
+
+
+
+
+
+
+
+
+ select r.reservation_id,
+ r.status,
+ to_char(start_date, 'J') as start_date,
+ to_char(start_date, 'HH:MIpm') as start_time,
+ to_char(end_date, 'HH:MIpm') as end_time,
+ e.name
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id
+ order by start_date,end_date
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/calendar-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,263 @@
+ad_library {
+ Calendar Display and Navigation procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: calendar-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation::calendar {
+
+ ad_proc -public one_day_display {
+ {-room_id:required}
+ {-date ""}
+ {-hour_template {$hour}}
+ {-item_template {$item}}
+ {-prev_nav_template {<}}
+ {-next_nav_template {>}}
+ {-start_hour 0}
+ {-end_hour 23}
+ } {
+ Creates a day widget containing all reservations for said date
+ } {
+ set widget_start_hour $start_hour
+ set widget_end_hour $end_hour
+
+ set date_format "YYYY-MM-DD HH24:MI"
+
+ if {[empty_string_p $date]} {
+ set date [dt_sysdate]
+ }
+
+ set current_date $date
+
+ set items [ns_set create]
+
+ # Loop through the calendars
+ db_foreach select_day_reservations {} {
+
+ set item $name
+ set item_subst [subst $item_template]
+
+ set item "$pretty_start_date - $pretty_end_date: $item_subst (status: $status)"
+
+ set ns_set_pos $start_hour
+
+ ns_set put $items $ns_set_pos [list $start_date $end_date $item]
+ }
+
+ set hour {$display_hour}
+ set start_time {$hour}
+ set end_time {$next_hour}
+
+ set hour_template [subst $hour_template]
+
+ return [dt_widget_day -hour_template $hour_template \
+ -prev_nav_template $prev_nav_template \
+ -next_nav_template $next_nav_template \
+ -start_hour $widget_start_hour -end_hour $widget_end_hour \
+ -calendar_details $items -date $date -overlap_p 1]
+
+ }
+
+ ad_proc -public list_display {
+ {-room_id:required}
+ {-date ""}
+ {-start_date ""}
+ {-end_date ""}
+ {-item_template {$item}}
+ } {
+ create a list display of reservations
+ } {
+
+ set date_format "YYYY-MM-DD HH24:MI"
+ set current_date $date
+ set items [ns_set create]
+
+ db_foreach select_list_reservations {} {
+ set item "$name"
+ set item [subst $item_template]
+
+ ns_set put $items $start_hour [list $pretty_date $pretty_start_date $pretty_end_date $pretty_weekday $item $status]
+ }
+
+ return [room-reservation::calendar::dt_widget_list -item_template $item_template \
+ -calendar_details $items \
+ -start_date $start_date \
+ -end_date $end_date \
+ ]
+
+ }
+
+ ad_proc -public one_week_display {
+ {-room_id:required}
+ {-date ""}
+ {-day_template "\$day - \$pretty_date"}
+ {-item_template "\$item"}
+ {-item_add_template ""}
+ {-prev_nav_template ""}
+ {-next_nav_template ""}
+ } {
+ Creates a week widget for reservations
+ } {
+ if {[empty_string_p $date]} {
+ set date [dt_sysdate]
+ }
+
+ set current_date $date
+
+ set items [ns_set create]
+
+ db_1row select_weekday_info {}
+
+ # Loop through the calendars
+ db_foreach select_week_reservations {} {
+ set item "$name (status: $status)"
+ set item_details "[subst $item_template]"
+
+ set time_details "$pretty_start_date - $pretty_end_date:"
+
+ set item "$time_details $item_details"
+
+ ns_set put $items $start_date_julian $item
+ }
+
+ # display stuff
+
+ if {[empty_string_p $item_add_template]} {
+ set day_number_template "$day_template"
+ } else {
+ set day_number_template "$day_template $item_add_template"
+ }
+
+ return [dt_widget_week -calendar_details $items -date $date -day_template $day_number_template -prev_week_template $prev_nav_template -next_week_template $next_nav_template]
+
+ }
+
+ ad_proc -public dt_widget_list {
+ {-calendar_details:required}
+ {-item_template {$item}}
+ {-start_date ""}
+ {-end_date ""}
+ } {
+ create a list display of reservations
+ } {
+
+ if {[ns_set size $calendar_details] == 0} {
+ return "No Items"
+ }
+
+ # The title
+ if {[empty_string_p $start_date] && [empty_string_p $end_date]} {
+ set title "All Items"
+ }
+
+ if {[empty_string_p $start_date] && ![empty_string_p $end_date]} {
+ set title "Items until [util_AnsiDatetoPrettyDate $end_date]"
+ }
+
+ if {![empty_string_p $start_date] && [empty_string_p $end_date]} {
+ set title "Items starting [util_AnsiDatetoPrettyDate $start_date]"
+ }
+
+ if {![empty_string_p $start_date] && ![empty_string_p $end_date]} {
+ set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]"
+ }
+
+ set return_html "$title
"
+
+
+ # Create the header
+ append return_html "
+
+
+
+ Day of Week | Date | Start Time | End Time |
+ Event |
+ Status | \n"
+
+ set flip 0
+
+ # Loop through the events, and add them
+ set flip 0
+ for {set i 0} {$i < [ns_set size $calendar_details]} {incr i} {
+ set item [ns_set value $calendar_details $i]
+ set date [lindex $item 0]
+ set start_time [lindex $item 1]
+ set end_time [lindex $item 2]
+ set weekday [lindex $item 3]
+ set event_name [lindex $item 4]
+ set status [lindex $item 5]
+
+ if {[expr $flip % 2] == 0} {
+ set bgcolor white
+ } else {
+ set bgcolor #dddddd
+ }
+
+ append return_html "
+ $weekday | $date | $start_time | $end_time | $event_name | $status | \n"
+ incr flip
+ }
+
+ append return_html " |
\n"
+
+ return $return_html
+ }
+
+ ad_proc -public one_month_display {
+ {-room_id:required}
+ {-day_template "\$day_number"}
+ {-item_template "\$item"}
+ {-item_add_template ""}
+ {-date ""}
+ {-prev_nav_template ""}
+ {-next_nav_template ""}
+ } {
+ Creates a month widget for reservations
+ } {
+ if {[empty_string_p $date]} {
+ set date [dt_systime]
+ }
+
+ set items [ns_set create]
+
+ db_foreach select_monthly_reservations {} {
+ set item "$name (status: $status)"
+ set item "[subst $item_template]"
+
+ if {![dt_no_time_p -start_time $start_time -end_time $end_time]} {
+ set item "$start_time - $end_time $item"
+ }
+
+ append item "
"
+
+ ns_set put $items $start_date $item
+ }
+
+
+ # Display stuff
+ if {[empty_string_p $item_add_template]} {
+ set day_number_template "$day_template"
+ } else {
+ set day_number_template "$day_template $item_add_template"
+ }
+
+ return [dt_widget_month -calendar_details $items -date $date \
+ -master_bgcolor black \
+ -header_bgcolor lavender \
+ -header_text_color black \
+ -header_text_size "+1" \
+ -day_header_bgcolor lavender \
+ -day_bgcolor white \
+ -today_bgcolor #FFF8DC \
+ -empty_bgcolor lightgrey \
+ -day_text_color black \
+ -prev_next_links_in_title 1 \
+ -prev_month_template $prev_nav_template \
+ -next_month_template $next_nav_template \
+ -day_number_template $day_number_template]
+ }
+
+
+}
\ No newline at end of file
Index: openacs-4/contrib/packages/room-reservation/tcl/datetime-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/datetime-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/datetime-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,37 @@
+
+
+
+ postgresql7.1
+
+
+
+
+ select CASE WHEN (now() - :date::timestamp) < 0
+ THEN 1
+ ELSE 0
+ END
+
+
+
+
+
+
+ select CASE WHEN (:start_date::timestamp - :end_date::timestamp) < 0
+ THEN 1
+ ELSE 0
+ END
+
+
+
+
+
+
+ select CASE WHEN (:start_date::timestamp - (now() + :future_years)) < 0
+ THEN 1
+ ELSE 0
+ END
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/datetime-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/datetime-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/datetime-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,51 @@
+ad_library {
+ Date and Time procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: datetime-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation::datetime {
+
+ ad_proc -public convert_to_sql {
+ {-date:required}
+ {-time:required}
+ } {
+ creates a sql formatted date given a date chunk and a time chunk
+ } {
+ set year [template::util::date::get_property year $date]
+ set month [template::util::date::get_property month $date]
+ set day [template::util::date::get_property day $date]
+ set hours [template::util::date::get_property hours $time]
+ set minutes [template::util::date::get_property minutes $time]
+ return "$year-$month-$day $hours:$minutes"
+ }
+
+ ad_proc -public check_valid_end_date_p {
+ {-date:required}
+ } {
+ checks that end date has not yet passed
+ } {
+ return [db_string valid_p {}]
+ }
+
+ ad_proc -public check_valid_dates_p {
+ {-start_date:required}
+ {-end_date:required}
+ } {
+ checks that start date comes before end date
+ } {
+ return [db_string valid_p {}]
+ }
+
+ ad_proc -public check_valid_year_p {
+ {-start_date:required}
+ } {
+ checks that start date falls within allowable year range
+ } {
+ set future_years "[parameter::get -parameter FutureYears -default 5] years"
+ return [db_string valid_p {}]
+ }
+
+}
Index: openacs-4/contrib/packages/room-reservation/tcl/facilities-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/facilities-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/facilities-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,38 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select rr_facilities__edit(:facility_id,
+ :name,
+ :description,
+ :package_id,
+ :edit_user,
+ :edit_ip)
+
+
+
+
+
+
+
+
+ select rr_facilities__delete(:facility_id)
+
+
+
+
+
+
+
+
+ select rr_facilities__name(:facility_id)
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,142 @@
+ad_library {
+ Facilities procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facilities-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation::facilities {
+
+ ad_proc -public new {
+ {-facility_id:required}
+ {-name:required}
+ {-description}
+ {-package_id:required}
+ } {
+ creates a new facility
+ } {
+ # We want unique names
+ if {[room-reservation::facilities::name_exists -name $name]} {
+ ad_return_complaint 1 "- the name you provided is already being used.
"
+ ad_script_abort
+ }
+
+ # Prepare the variables for instantiation
+ set extra_vars [ns_set create]
+ oacs_util::vars_to_ns_set -ns_set $extra_vars \
+ -var_list {facility_id name description package_id}
+
+ # Instantiate the facility
+ return [package_instantiate_object -extra_vars $extra_vars rr_facility]
+ }
+
+ ad_proc -public edit {
+ {-facility_id:required}
+ {-name:required}
+ {-description}
+ {-package_id:required}
+ } {
+ edits properties of an existing facility
+ } {
+ # We want unique names
+ set name_exists_p [room-reservation::facilities::name_exists -name $name]
+ if {$name_exists_p && ![string equal $name_exists_p $facility_id]} {
+ ad_return_complaint 1 "- the name you provided is already being used.
"
+ ad_script_abort
+ }
+ set edit_user [ad_conn user_id]
+ set edit_ip [ad_conn peeraddr]
+
+ return [db_exec_plsql edit_facility {}]
+ }
+
+ ad_proc -public delete {
+ {-facility_id:required}
+ } {
+ delete a facility
+ } {
+ return [db_string delete_facility {}]
+ }
+
+ ad_proc -public disable {
+ {-facility_id:required}
+ } {
+ disables a currently enabled facility
+ } {
+ set package_id [ad_conn package_id]
+ return [db_dml disable_facility {}]
+ }
+
+ ad_proc -public enable {
+ {-facility_id:required}
+ } {
+ enables a currently disabled facility
+ } {
+ set package_id [ad_conn package_id]
+ return [db_dml enable_facility {}]
+ }
+
+ ad_proc -public get {
+ {-facility_id:required}
+ {-array:required}
+ } {
+ Get the data for one facility
+ } {
+ set package_id [ad_conn package_id]
+ upvar $array row
+
+ db_1row select_facility_data {} -column_array row
+ }
+
+ ad_proc -public get_name {
+ {-facility_id:required}
+ } {
+ Gets the name of a facility
+ } {
+ return [db_string select_facility_name {} -default "Unnamed"]
+ }
+
+ ad_proc -public name_exists {
+ {-name:required}
+ {-package_id ""}
+ } {
+ Checks if a facility name already exists
+ } {
+ if [string equal $package_id ""] {
+ set package_id [ad_conn package_id]
+ }
+ return [db_string check_name {} -default 0]
+ }
+
+ ad_proc -public get_name_id_list_enabled {
+ {-package_id ""}
+ } {
+ Returns a list of lists consisting of facility ids and names
+ } {
+ if [string equal $package_id ""] {
+ set package_id [ad_conn package_id]
+ }
+ return [db_list_of_lists select_name_id {}]
+ }
+
+ ad_proc -public get_name_id_list_enabled_and_non_empty {
+ {-package_id ""}
+ } {
+ Returns a list of lists consisting of facility ids and names who have enabled rooms
+ } {
+ if [string equal $package_id ""] {
+ set package_id [ad_conn package_id]
+ }
+ return [db_list_of_lists select_name_id {}]
+ }
+
+ ad_proc -public get_room_list {
+ {-facility_id:required}
+ } {
+ Returns a list or room ids for a given facility_id
+ } {
+ return [db_list select_room_ids {}]
+ }
+
+}
Index: openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/facilities-procs.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+ update rr_facilities
+ set enabled_p = 'f'
+ where facility_id = :facility_id and
+ package_id = :package_id
+
+
+
+
+
+
+
+
+ update rr_facilities
+ set enabled_p = 't'
+ where facility_id = :facility_id and
+ package_id = :package_id
+
+
+
+
+
+
+
+
+ select name,
+ description
+ from rr_facilities
+ where facility_id = :facility_id and
+ package_id = :package_id
+
+
+
+
+
+
+
+
+ select facility_id
+ from rr_facilities
+ where UPPER(name) = UPPER(:name) and
+ package_id = :package_id
+
+
+
+
+
+
+
+
+ select name, facility_id
+ from rr_facilities_enabled
+ where package_id = :package_id
+
+
+
+
+
+
+
+
+ select name, facility_id
+ from rr_facilities_enabled f
+ where package_id = :package_id and
+ (select count(room_id)
+ from rr_rooms_enabled r
+ where r.facility_id = f.facility_id) > 0
+
+
+
+
+
+
+
+
+ select room_id
+ from rr_rooms
+ where facility_id = :facility_id
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/reservations-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/reservations-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/reservations-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,251 @@
+
+
+
+ postgresql7.1
+
+
+
+
+
+ select acs_activity__new (
+ null,
+ :activity_name,
+ null,
+ 'f',
+ null,
+ 'acs_activity',
+ now(),
+ :creation_user,
+ :creation_ip,
+ :room_id
+ )
+
+
+
+
+
+
+
+
+ select timespan__new (
+ :start_date::timestamp,
+ :end_date::timestamp
+ )
+
+
+
+
+
+
+
+
+ select rr_reservations__new (
+ :reservation_id,
+ 'rr_reservation',
+ :name,
+ :room_id,
+ :creation_user,
+ :attendees,
+ :note,
+ :contact_person,
+ :contact_email,
+ :contact_phone,
+ :timespan_id,
+ :activity_id,
+ now(),
+ :creation_user,
+ :creation_ip,
+ :room_id
+ )
+
+
+
+
+
+
+
+
+ select time_interval__edit (
+ :interval_id,
+ :start_date::timestamp,
+ :end_date::timestamp
+ )
+
+
+
+
+
+
+
+
+
+ select rr_reservations__edit (
+ :reservation_id,
+ :room_id,
+ :attendees,
+ :note,
+ :contact_person,
+ :contact_email,
+ :contact_phone,
+ :edit_user,
+ :edit_ip
+
+ )
+
+
+
+
+
+
+
+
+
+ select rr_reservations__get_status (
+ :reservation_id
+ )
+
+
+
+
+
+
+
+
+ select rr_reservations__cancel (
+ :reservation_id,
+ :reason,
+ :action_user,
+ :action_ip
+ )
+
+
+
+
+
+
+
+
+ select rr_reservations__approve (
+ :reservation_id,
+ :reason,
+ :action_user,
+ :action_ip
+ )
+
+
+
+
+
+
+
+
+ select rr_reservations__reject (
+ :reservation_id,
+ :reason,
+ :action_user,
+ :action_ip
+ )
+
+
+
+
+
+
+
+
+ select r.room_id,
+ r.reservation_id,
+ coalesce(e.name, a.name) as name,
+ r.attendees,
+ r.note,
+ r.contact_person,
+ r.contact_email,
+ r.contact_phone,
+ r.status,
+ r.reason,
+ to_char(r.action_date, 'Month DD, YYYY HH:MI AM') as full_action_date,
+ f.name as facility_name,
+ fr.name as room_name,
+ r.status,
+ to_char(start_date, 'Month DD, YYYY HH:MI AM') as full_start_date,
+ to_char(end_date, 'Month DD, YYYY HH:MI AM') as full_end_date,
+ to_char(start_date, 'HH12:MIam') as start_time,
+ to_char(end_date, 'HH12:MIam') as end_time,
+ to_char(end_date, 'YYYY-MM-DD') as date,
+ to_char(start_date, 'YYYY-MM-DD HH24:MI') as start_date,
+ to_char(end_date, 'YYYY-MM-DD HH24:MI') as end_date,
+ p.first_names||' '||p.last_name as username
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join acs_activities a
+ on (e.activity_id = a.activity_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ join rr_rooms fr
+ on (r.room_id = fr.room_id)
+ join rr_facilities f
+ on (f.facility_id = fr.facility_id)
+ join persons p
+ on (r.reserving_user = p.person_id)
+ where r.reservation_id = :reservation_id
+
+
+
+
+
+
+
+ select rr_reservations__conflict_p (
+ :reservation_id,
+ :room_id,
+ :start_date::timestamp,
+ :end_date::timestamp
+ )
+
+
+
+
+
+
+
+
+ select r.reservation_id
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id and
+ not (r.reservation_id = :reservation_id) and
+ r.status in ('approved', 'rejected') and
+ ((:start_date >= start_date and :start_date < end_date) or
+ (start_date >= :start_date and start_date < :end_date));
+
+
+
+
+
+
+
+
+ select r.reservation_id
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where r.room_id = :room_id and
+ not (r.reservation_id = :reservation_id) and
+ r.status = 'pending' and
+ ((:start_date >= start_date and :start_date < end_date) or
+ (start_date >= :start_date and start_date < :end_date));
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,199 @@
+ad_library {
+ Reservations procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservations-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation::reservations {
+
+ ad_proc -public new {
+ {-name:required}
+ {-room_id:required}
+ {-start_date:required}
+ {-end_date:required}
+ {-attendees}
+ {-note}
+ {-contact_person}
+ {-contact_email}
+ {-contact_phone}
+ } {
+ creates a new reservation
+ } {
+
+ db_transaction {
+
+ set creation_user [ad_conn user_id]
+ set creation_ip [ad_conn peeraddr]
+ # create the activity here
+ set activity_name "Facility Reservation"
+ set activity_id [db_exec_plsql insert_activity {}]
+
+ # 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 {}]
+
+ # create the reservation
+ # Pre-fetch the reservation_id
+ set reservation_id [db_nextval acs_object_id_seq]
+
+ set reservation_id [db_exec_plsql insert_reservation {}]
+
+ return $reservation_id
+ }
+
+ }
+
+ ad_proc -public edit {
+ {-reservation_id:required}
+ {-name:required}
+ {-room_id:required}
+ {-start_date:required}
+ {-end_date:required}
+ {-attendees}
+ {-note}
+ {-contact_person}
+ {-contact_email}
+ {-contact_phone}
+ } {
+ edits an existing reservation
+ } {
+
+ db_transaction {
+
+ # set the date_format
+ set date_format "YYYY-MM-DD HH24:MI"
+
+ # update the events
+ db_dml update_event ""
+
+ # update the time interval based on the timespan id
+
+ db_1row get_interval_id ""
+
+ db_exec_plsql update_interval {}
+
+ # call edit procedure
+ set edit_user [ad_conn user_id]
+ set edit_ip [ad_conn peeraddr]
+
+ db_exec_plsql update_reservation {}
+ return $reservation_id
+ }
+
+ }
+
+ ad_proc -public get_status {
+ {-reservation_id:required}
+ } {
+ gets the status of a reservation
+ } {
+ return [db_string select_status {}]
+ }
+
+ ad_proc -public cancel {
+ {-reservation_id:required}
+ {-reason ""}
+ } {
+ cancels a reservation
+ } {
+ set action_user [ad_conn user_id]
+ set action_ip [ad_conn peeraddr]
+
+ return [db_string cancel_reservation {}]
+ }
+
+ ad_proc -public approve {
+ {-reservation_id:required}
+ {-reason ""}
+ } {
+ approves a reservation
+ } {
+ set action_user [ad_conn user_id]
+ set action_ip [ad_conn peeraddr]
+
+ return [db_string approve_reservation {}]
+ }
+
+ ad_proc -public reject {
+ {-reservation_id:required}
+ {-reason ""}
+ } {
+ rejects a reservation
+ } {
+ set action_user [ad_conn user_id]
+ set action_ip [ad_conn peeraddr]
+
+ return [db_string reject_reservation {}]
+ }
+
+ ad_proc -public get {
+ {-reservation_id:required}
+ {-array:required}
+ } {
+ Get the data for one reservation
+ } {
+ upvar $array row
+
+ db_1row select_reservation_data {} -column_array row
+ }
+
+ ad_proc -public check_conflict_p {
+ {-reservation_id "0"}
+ {-room_id:required}
+ {-start_date:required}
+ {-end_date:required}
+ } {
+ checks for a time conflict
+ } {
+ if {[db_exec_plsql check_conflict {}]} {
+ return 1
+ } else {
+ return 0
+ }
+
+ }
+
+ ad_proc -public get_conflict_ids {
+ {-reservation_id "0"}
+ {-room_id:required}
+ {-start_date:required}
+ {-end_date:required}
+ } {
+ returns a list of the conflicting ids for this reservation attemp
+ } {
+ return [db_list select_ids {}]
+ }
+
+ ad_proc -public get_simultaneous_pending_ids {
+ {-reservation_id "0"}
+ {-room_id:required}
+ {-start_date:required}
+ {-end_date:required}
+ } {
+ returns a list of ids of the pending reservations that is simultaneous with this reservation
+ } {
+ return [db_list select_ids {}]
+ }
+
+ ad_proc -public get_room_id {
+ {-reservation_id:required}
+ } {
+ gets the room_id of a reservation
+ } {
+ return [db_string select_room_id {} -default 0]
+ }
+
+ ad_proc -public owner_p {
+ {-reservation_id:required}
+ {-user_id:required}
+ } {
+ checks if the user_id is the reserving_user
+ } {
+ return [db_string reserving_user_p {} -default 0]
+ }
+
+}
Index: openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/reservations-procs.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+ update acs_events
+ set name = :name
+ where event_id= :reservation_id
+
+
+
+
+
+
+
+
+ select interval_id
+ from timespans
+ where timespan_id
+ in (
+ select timespan_id
+ from acs_events
+ where event_id = :reservation_id
+ )
+
+
+
+
+
+
+
+
+ select room_id
+ from rr_reservations
+ where reservation_id = :reservation_id
+
+
+
+
+
+
+
+ select 1
+ from rr_reservations
+ where reservation_id = :reservation_id and
+ reserving_user = :user_id
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/room-reservation-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/room-reservation-init.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/room-reservation-init.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,20 @@
+ad_library {
+
+ initialization for room-reservation module
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-reservation-init.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+
+}
+
+if { [server_cluster_enabled_p] && ![ad_canonical_server_p] } {
+ # no sense doing this for non-canonical servers on clustered servers
+ return
+}
+
+ns_log Notice "room-reservation: Scheduling proc room-reservation::expire_stale_items"
+#let's schedule it daily at 1:00 AM
+set schedule_id [ns_schedule_daily 1 0 room-reservation::expire_stale_items]
+ns_log Notice "room-reservation: Done scheduling room-reservation::expire_stale_items. Schedule ID is $schedule_id."
+
Index: openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select r.reservation_id
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ where end_date < (now() - to_number(:expiry_days,'999'));
+
+
+
+
+
+
+
+
+ select rr_reservations__delete(:reservation_id)
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/room-reservation-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,94 @@
+ad_library {
+ Facility Reservation procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-reservation-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation {
+
+ ad_proc -public package_key {} {
+ returns the package key
+ } {
+ return "room-reservation"
+ }
+
+ ad_proc -public expire_stale_items {} {
+ expires stale items
+ } {
+ set expiry_days [parameter::get -parameter ExpiryDays -default 30]
+
+ if {$expiry_days} {
+ set expired_list [db_list get_expired_reservations {}]
+
+ foreach reservation_id $expired_list {
+ db_exec_plsql expire_reservation {}
+ }
+ }
+
+ return 0
+ }
+
+ ad_proc -public get_facilities_pretty_name {} {
+ returns the package key
+ } {
+ return [util_memoize "parameter::get -parameter FacilitiesPrettyName -default Facility"]
+ }
+
+ ad_proc -public get_facilities_pretty_plural {} {
+ returns the package key
+ } {
+ return [util_memoize "parameter::get -parameter FacilitiesPrettyPlural -default Facilities"]
+ }
+
+ ad_proc -public get_rooms_pretty_name {} {
+ returns the package key
+ } {
+ return [util_memoize "parameter::get -parameter RoomsPrettyName -default Room"]
+ }
+
+ ad_proc -public get_rooms_pretty_plural {} {
+ returns the package key
+ } {
+ return [util_memoize "parameter::get -parameter RoomsPrettyPlural -default Rooms"]
+ }
+
+ ad_proc -public get_ui_params {
+ {-facilities_pretty_name}
+ {-facilities_pretty_plural}
+ {-rooms_pretty_name}
+ {-rooms_pretty_plural}
+ } {
+ assigns the cached stuff for UI to passed in variables
+ } {
+ if {[exists_and_not_null facilities_pretty_name]} {
+ upvar 1 $facilities_pretty_name var
+ set var [room-reservation::get_facilities_pretty_name]
+ }
+ if {[exists_and_not_null facilities_pretty_plural]} {
+ upvar 1 $facilities_pretty_plural var
+ set var [room-reservation::get_facilities_pretty_plural]
+ }
+ if {[exists_and_not_null rooms_pretty_name]} {
+ upvar 1 $rooms_pretty_name var
+ set var [room-reservation::get_rooms_pretty_name]
+ }
+ if {[exists_and_not_null rooms_pretty_plural]} {
+ upvar 1 $rooms_pretty_plural var
+ set var [room-reservation::get_rooms_pretty_plural]
+ }
+ return 0
+ }
+
+ ad_proc -public flush_parameters {} {
+ flushes all the cached parameters for the package
+ } {
+ util_memoize_flush "parameter::get -parameter FacilitiesPrettyName -default Facility"
+ util_memoize_flush "parameter::get -parameter FacilitiesPrettyPlural -default Facilities"
+ util_memoize_flush "parameter::get -parameter RoomsPrettyName -default Room"
+ util_memoize_flush "parameter::get -parameter RoomsPrettyPlural -default Rooms"
+ return 0
+ }
+
+}
Index: openacs-4/contrib/packages/room-reservation/tcl/rooms-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/rooms-procs-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/rooms-procs-postgresql.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,72 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select rr_rooms__edit(:room_id,
+ :name,
+ :facility_id,
+ :description,
+ :capacity,
+ :phone,
+ :approval_needed_p,
+ :edit_user,
+ :edit_ip)
+
+
+
+
+
+
+
+
+ select rr_rooms__delete(:room_id)
+
+
+
+
+
+
+
+
+ select rr_rooms__name(:room_id)
+
+
+
+
+
+
+
+
+ select r.reservation_id,
+ f.name as facility_name,
+ fr.name as room_name,
+ r.status,
+ to_char(start_date, 'Mon DD, YYYY HH12:MI AM') as full_start_date,
+ to_char(end_date, 'Mon DD, YYYY HH12:MI AM') as full_end_date,
+ e.name,
+ p.first_names||' '||p.last_name as username
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ join $rooms_table fr
+ on (r.room_id = fr.room_id)
+ join $facilities_table f
+ on (f.facility_id = fr.facility_id)
+ join persons p
+ on (r.reserving_user = p.person_id)
+ $condition_sql
+ order by start_date
+
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.tcl 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,194 @@
+ad_library {
+ Rooms procs
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: rooms-procs.tcl,v 1.1 2004/03/15 03:39:30 carolinem Exp $
+}
+
+namespace eval room-reservation::rooms {
+
+ ad_proc -public new {
+ {-room_id:required}
+ {-name:required}
+ {-facility_id:required}
+ {-description}
+ {-capacity:required}
+ {-phone}
+ {-approval_needed_p}
+ } {
+ creates a new room
+ } {
+ # We want unique names per facility
+ if {[room-reservation::rooms::name_exists -name $name -facility_id $facility_id]} {
+ ad_return_complaint 1 "- the name you provided is already being used.
"
+ ad_script_abort
+ }
+
+ # Prepare the variables for instantiation
+ set extra_vars [ns_set create]
+ oacs_util::vars_to_ns_set -ns_set $extra_vars \
+ -var_list {room_id name facility_id description capacity phone approval_needed_p}
+
+ # Instantiate the facility
+ return [package_instantiate_object -extra_vars $extra_vars rr_room]
+ }
+
+ ad_proc -public edit {
+ {-room_id:required}
+ {-name:required}
+ {-facility_id:required}
+ {-description}
+ {-capacity:required}
+ {-phone}
+ {-approval_needed_p}
+ } {
+ edits properties of an existing facility
+ } {
+ # We want unique names per facility
+ set name_exists_p [room-reservation::rooms::name_exists -name $name -facility_id $facility_id]
+ if {$name_exists_p && ![string equal $name_exists_p $room_id]} {
+ ad_return_complaint 1 "- the name you provided is already being used.
"
+ ad_script_abort
+ }
+ set edit_user [ad_conn user_id]
+ set edit_ip [ad_conn peeraddr]
+
+ return [db_exec_plsql edit_room {}]
+ }
+
+ ad_proc -public delete {
+ {-room_id:required}
+ } {
+ deletes a currently enabled room
+ } {
+ return [db_string delete_room {}]
+ }
+
+ ad_proc -public disable {
+ {-room_id:required}
+ {-facility_id:required}
+ } {
+ disables a currently enabled room
+ } {
+ return [db_dml disable_room {}]
+ }
+
+ ad_proc -public enable {
+ {-room_id:required}
+ {-facility_id:required}
+ } {
+ enables a currently enabled room
+ } {
+ return [db_dml enable_room {}]
+ }
+
+
+ ad_proc -public get {
+ {-room_id:required}
+ {-array:required}
+ } {
+ Get the data for one room
+ } {
+ upvar $array row
+
+ db_1row select_room_data {} -column_array row
+ }
+
+ ad_proc -public get_name {
+ {-room_id:required}
+ } {
+ Gets the name of a room.
+ Returns empty string if room not found.
+ } {
+ return [db_string select_room_name {} -default ""]
+ }
+
+ ad_proc -public get_facility_id {
+ {-room_id:required}
+ } {
+ Gets the associated facility_id of a room. Returns 0 if room not found.
+ } {
+ return [db_string select_facility_id {} -default 0]
+ }
+
+ ad_proc -public get_full_name {
+ {-room_id:required}
+ } {
+ Gets the full name of a room (facility name + room name).
+ Returns empty string if room not found
+ } {
+ set room_name [room-reservation::rooms::get_name -room_id $room_id]
+ if {[string equal $room_name ""]} {
+ return ""
+ } else {
+ set full_room_name [room-reservation::facilities::get_name \
+ -facility_id [room-reservation::rooms::get_facility_id -room_id $room_id] \
+ ]
+ append full_room_name ", $room_name"
+ return $full_room_name
+ }
+ }
+
+ ad_proc -public name_exists {
+ {-name:required}
+ {-facility_id:required}
+ } {
+ Checks if a room name already exists for a particular facility
+ } {
+ return [db_string check_name {} -default 0]
+ }
+
+ ad_proc -public get_reservations_list_of_ns_sets {
+ {-room_id ""}
+ {-status_list ""}
+ {-facilities_enabled_p "t"}
+ {-rooms_enabled_p "t"}
+ {-reserving_user ""}
+ {-package_id ""}
+ } {
+ Returns a list_of_ns_sets of reservations for this room
+ whose state is in state_list. Convert to a multirow source
+ in the calling environment via template::util::list_of_ns_sets_to_multirow
+ } {
+ set condition_list [list]
+ if {![empty_string_p $room_id]} {
+ lappend condition_list "fr.room_id = '$room_id' "
+ }
+ if {[exists_and_not_null status_list]} {
+ set formatted_list [list]
+ foreach status $status_list {
+ # sanity check if it's passing us valid vars
+ if {![empty_string_p $status]} {
+ lappend formatted_list "'$status'"
+ }
+ }
+ # did we actually get anything?
+ if {[llength $formatted_list]} {
+ lappend condition_list "status in ([join $formatted_list ,]) "
+ }
+ }
+ if {![empty_string_p $reserving_user]} {
+ lappend condition_list "reserving_user = '$reserving_user' "
+ }
+ if {[string equal "f" $facilities_enabled_p]} {
+ set facilities_table rr_facilities
+ } else {
+ set facilities_table rr_facilities_enabled
+ }
+ if {![empty_string_p $package_id]} {
+ lappend condition_list "package_id = '$package_id' "
+ }
+ if {[string equal "f" $rooms_enabled_p]} {
+ set rooms_table rr_rooms
+ } else {
+ set rooms_table rr_rooms_enabled
+ }
+ if {[llength $condition_list]} {
+
+ set condition_sql "where [join $condition_list " and "]"
+ }
+ return [db_list_of_ns_sets select_reservations {}]
+ }
+
+}
Index: openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/tcl/rooms-procs.xql 15 Mar 2004 03:39:30 -0000 1.1
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ update rr_rooms
+ set enabled_p = 'f'
+ where room_id = :room_id and
+ facility_id = :facility_id
+
+
+
+
+
+
+
+
+ update rr_rooms
+ set enabled_p = 't'
+ where room_id = :room_id and
+ facility_id = :facility_id
+
+
+
+
+
+
+
+
+ select *
+ from rr_rooms
+ where room_id = :room_id
+
+
+
+
+
+
+
+
+ select facility_id
+ from rr_rooms
+ where room_id = :room_id
+
+
+
+
+
+
+
+
+ select room_id
+ from rr_rooms
+ where UPPER(name) = UPPER(:name) and
+ facility_id = :facility_id
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/index.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/index.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,39 @@
+
+@title@
+
+
+
+
+Your reservations:
+
+Show @filter_list:item@@filter_list:item@ |
reservations
+
+
+
+ @facilities_pretty_name@ Name |
+ @rooms_pretty_name@ Name |
+ Event |
+ Date Reserved |
+ Status |
+ Action |
+
+
+
+ @personal_reservations.facility_name@ |
+ @personal_reservations.room_name@ |
+ @personal_reservations.name@ |
+ @personal_reservations.full_start_date@ to @personal_reservations.full_end_date@ |
+ @personal_reservations.status@ |
+ [ View Details | Edit | Cancel ] |
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/index.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/index.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,58 @@
+# /packages/room-reservation/www/index.tcl
+
+ad_page_contract {
+
+ Room Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: index.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ {filter_on ""}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+set package_id [ad_conn package_id]
+
+set admin_p [ad_permission_p $package_id admin]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set title "Room Reservation"
+
+switch -exact -- $filter_on {
+ {canceled} {
+ set status "canceled"
+ }
+ {pending} {
+ set status "pending"
+ }
+ {approved} {
+ set status "approved"
+ }
+ {rejected} {
+ set status "rejected"
+ }
+ default {
+ set status ""
+ set filter_on "all"
+ }
+}
+
+set filter_list [list all pending approved rejected canceled]
+
+set reservations [room-reservation::rooms::get_reservations_list_of_ns_sets \
+ -reserving_user $user_id \
+ -status_list [list $status] \
+ -package_id $package_id \
+ ]
+
+template::util::list_of_ns_sets_to_multirow -rows $reservations -var_name personal_reservations
+
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/reservation-cancel.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-cancel.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-cancel.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,26 @@
+# /packages/room-reservation/www/reservation-cancel.tcl
+
+ad_page_contract {
+
+ Room Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservation-cancel.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ reservation_id:integer,notnull
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+# Check if user has permission to cancel this room
+if {![room-reservation::reservations::owner_p -reservation_id $reservation_id -user_id $user_id]} {
+ permission::require_permission -party_id $user_id -object_id $reservation_id -privilege "write"
+}
+
+room-reservation::reservations::cancel -reservation_id $reservation_id
+
+ad_returnredirect "rooms"
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/reservation-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-edit.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-edit.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,5 @@
+
+@title@
+@context@
+
+
Index: openacs-4/contrib/packages/room-reservation/www/reservation-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-edit.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-edit.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,191 @@
+# /packages/room-reservation/www/reservation-edit.tcl
+
+ad_page_contract {
+
+ Edit an existing Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservation-edit.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ reservation_id:integer,notnull
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+# Check if user has permission to edit this room
+if {![room-reservation::reservations::owner_p -reservation_id $reservation_id -user_id $user_id]} {
+ permission::require_permission -party_id $user_id -object_id $reservation_id -privilege "write"
+}
+
+if {![string equal "pending" [room-reservation::reservations::get_status -reservation_id $reservation_id]] && ![permission::permission_p -party_id $user_id -object_id $reservation_id -privilege "admin"]} {
+ ad_return_complaint 1 "you can only edit a pending reservation"
+}
+
+room-reservation::get_ui_params -rooms_pretty_plural rooms_pretty_plural
+
+set room_id [room-reservation::reservations::get_room_id -reservation_id $reservation_id]
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "Edit A Reservation"
+set context [list [list "rooms" $rooms_pretty_plural] [list "room-view?room_id=$room_id" "$room_full_name Info"] [list "room-reservations?room_id=$room_id" "$room_full_name Reservations"] [list "reservation-view?reservation_id=$reservation_id" "Reservation Info"] $title]
+
+form create reservation_edit
+
+element create reservation_edit reservation_id \
+ -label "Reservation ID" \
+ -datatype integer \
+ -widget hidden
+
+element create reservation_edit room_id \
+ -label "Room ID" \
+ -datatype integer \
+ -widget hidden
+
+element create reservation_edit room_name \
+ -label "Room Name" \
+ -datatype text \
+ -widget inform
+
+element create reservation_edit name \
+ -label "Event Name" \
+ -datatype text \
+ -widget text
+
+element create reservation_edit date \
+ -label "Date" \
+ -datatype date \
+ -widget date
+
+element create reservation_edit start_time \
+ -label "Start Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM"
+
+
+element create reservation_edit end_time \
+ -label "End Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM"
+
+element create reservation_edit attendees \
+ -label "Expected No. of Attendees" \
+ -datatype integer \
+ -widget text
+
+element create reservation_edit note \
+ -label "Added Instructions / Extra Notes" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+element create reservation_edit contact_person \
+ -label "Contact Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+element create reservation_edit contact_email \
+ -label "Contact Email" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+element create reservation_edit contact_phone \
+ -label "Contact Phone" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+set form_valid 0
+set form_submit 1
+
+
+if {[form is_valid reservation_edit] || [form is_submission reservation_edit]} {
+ template::form get_values reservation_edit \
+ reservation_id room_id name date start_time end_time attendees note contact_person contact_email contact_phone
+}
+
+if {[form is_valid reservation_edit]} {
+ set form_valid 1
+}
+
+if {$form_valid && [form is_submission reservation_edit]} {
+ set start_date [calendar::to_sql_datetime -date $date -time $start_time]
+ set end_date [calendar::to_sql_datetime -date $date -time $end_time]
+
+ if {![room-reservation::datetime::check_valid_end_date_p -date $end_date]} {
+ element set_error reservation_edit date "End date and time has already passed"
+ set form_submit 0
+ }
+
+ if {![room-reservation::datetime::check_valid_dates_p -start_date $start_date -end_date $end_date]} {
+ element set_error reservation_edit date "Start date must be before end date"
+ set form_submit 0
+ }
+
+ if {![room-reservation::datetime::check_valid_year_p -start_date $start_date]} {
+ element set_error reservation_edit date "Start date must fall within [parameter::get -parameter FutureYears -default 5] years from now"
+ set form_submit 0
+ }
+
+ if {[room-reservation::reservations::check_conflict_p -reservation_id $reservation_id -room_id $room_id -start_date $start_date -end_date $end_date]} {
+ element set_error reservation_edit date "The reservation you are trying to make conflicts with another reservation"
+ set form_submit 0
+ }
+
+ if {![empty_string_p $contact_email] && ![util_email_valid_p $contact_email]} {
+ element set_error reservation_edit contact_email "Invalid email address format for "contact email"
+ set form_submit 0
+ }
+}
+
+if {$form_valid && $form_submit} {
+ set result [room-reservation::reservations::edit -reservation_id $reservation_id \
+ -name $name \
+ -room_id $room_id \
+ -start_date $start_date \
+ -end_date $end_date \
+ -attendees $attendees \
+ -note $note \
+ -contact_person $contact_person \
+ -contact_email $contact_email \
+ -contact_phone $contact_phone \
+ ]
+
+
+ ad_returnredirect "reservation-view?reservation_id=$reservation_id"
+ ad_script_abort
+}
+
+element set_properties reservation_edit room_name -value $room_full_name
+
+if { [form is_request reservation_edit] } {
+ room-reservation::reservations::get -reservation_id $reservation_id -array reservation_info
+ set start_time_date [calendar::from_sql_datetime -sql_date $reservation_info(start_time) -format {HH12:MIam}]
+ set end_time_date [calendar::from_sql_datetime -sql_date $reservation_info(end_time) -format {HH12:MIam}]
+
+ element set_properties reservation_edit reservation_id -value $reservation_info(reservation_id)
+ element set_properties reservation_edit room_id -value $reservation_info(room_id)
+ element set_properties reservation_edit name -value $reservation_info(name)
+ element set_properties reservation_edit date -value [calendar::from_sql_datetime -sql_date $reservation_info(date) -format "YYYY-MM-DD"]
+ element set_properties reservation_edit start_time -value $start_time_date
+ element set_properties reservation_edit end_time -value $end_time_date
+ element set_properties reservation_edit attendees -value $reservation_info(attendees)
+ element set_properties reservation_edit note -value $reservation_info(note)
+ element set_properties reservation_edit contact_person -value $reservation_info(contact_person)
+ element set_properties reservation_edit contact_email -value $reservation_info(contact_email)
+ element set_properties reservation_edit contact_phone -value $reservation_info(contact_phone)
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/reservation-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-new.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-new.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,5 @@
+
+@title@
+@context@
+
+
Index: openacs-4/contrib/packages/room-reservation/www/reservation-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-new.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-new.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,185 @@
+# /packages/room-reservation/www/reservation-new.tcl
+
+ad_page_contract {
+
+ Create a new Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservation-new.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ {date ""}
+ {julian_date ""}
+ {start_time ""}
+ {end_time ""}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+room-reservation::get_ui_params -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "Reserve A $rooms_pretty_name"
+set context [list [list "rooms" $rooms_pretty_plural] [list "room-view?room_id=$room_id" "$room_full_name Info"] [list "room-reservations?room_id=$room_id" "$room_full_name Reservations"] $title]
+
+# let's make sure we have a date and a time
+set date [calendar::adjust_date -date $date -julian_date $julian_date]
+if {[empty_string_p $start_time]} {
+ set start_time "10"
+}
+if {[empty_string_p $end_time]} {
+ set end_time "11"
+}
+set start_time_date [calendar::from_sql_datetime -sql_date $start_time -format {HH24}]
+set end_time_date [calendar::from_sql_datetime -sql_date $end_time -format {HH24}]
+
+form create reservation
+
+element create reservation room_id \
+ -label "Room ID" \
+ -datatype integer \
+ -widget hidden
+
+element create reservation room_name \
+ -label "Room Name" \
+ -datatype text \
+ -widget inform
+
+element create reservation name \
+ -label "Event Name" \
+ -datatype text \
+ -widget text
+
+element create reservation date \
+ -label "Date" \
+ -datatype date \
+ -widget date
+
+element create reservation start_time \
+ -label "Start Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM"
+
+
+element create reservation end_time \
+ -label "End Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM"
+
+element create reservation attendees \
+ -label "Expected No. of Attendees" \
+ -datatype integer \
+ -widget text
+
+element create reservation note \
+ -label "Added Instructions / Extra Notes" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+element create reservation contact_person \
+ -label "Contact Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+element create reservation contact_email \
+ -label "Contact Email" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+element create reservation contact_phone \
+ -label "Contact Phone" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200} \
+ -optional
+
+
+set form_valid 0
+set form_submit 1
+
+
+if {[form is_valid reservation] || [form is_submission reservation]} {
+ template::form get_values reservation \
+ room_id name date start_time end_time attendees note contact_person contact_email contact_phone
+}
+
+if {[form is_valid reservation]} {
+ set form_valid 1
+}
+
+if {$form_valid && [form is_submission reservation]} {
+ set start_date [calendar::to_sql_datetime -date $date -time $start_time]
+ set end_date [calendar::to_sql_datetime -date $date -time $end_time]
+
+ if {![room-reservation::datetime::check_valid_end_date_p -date $end_date]} {
+ element set_error reservation date "End date and time has already passed"
+ set form_submit 0
+ }
+
+ if {![room-reservation::datetime::check_valid_dates_p -start_date $start_date -end_date $end_date]} {
+ element set_error reservation date "Start date must be before end date"
+ set form_submit 0
+ }
+
+ if {![room-reservation::datetime::check_valid_year_p -start_date $start_date]} {
+ element set_error reservation date "Start date must fall within [parameter::get -parameter FutureYears -default 5] years from now"
+ set form_submit 0
+ }
+
+ if {[room-reservation::reservations::check_conflict_p -room_id $room_id -start_date $start_date -end_date $end_date]} {
+ set error_string "The reservation you are trying to make conflicts with reservation(s):
"
+ set conflict_list [room-reservation::reservations::get_conflict_ids -room_id $room_id -start_date $start_date -end_date $end_date]
+ foreach reservation_id $conflict_list {
+ append error_string "Reservation $reservation_id (view)
"
+ }
+ element set_error reservation date $error_string
+ set form_submit 0
+ }
+
+ if {![empty_string_p $contact_email] && ![util_email_valid_p $contact_email]} {
+ element set_error reservation contact_email "Invalid email address format for "contact email"
+ set form_submit 0
+ }
+}
+
+if {$form_valid && $form_submit} {
+ set reservation_id [room-reservation::reservations::new -room_id $room_id \
+ -name $name \
+ -start_date $start_date \
+ -end_date $end_date \
+ -attendees $attendees \
+ -note $note \
+ -contact_person $contact_person \
+ -contact_email $contact_email \
+ -contact_phone $contact_phone \
+ ]
+
+ ad_returnredirect "room-reservations?room_id=$room_id"
+ ad_script_abort
+}
+
+element set_properties reservation room_name -value $room_full_name
+
+if { [form is_request reservation] } {
+ element set_properties reservation room_id -value $room_id
+ element set_properties reservation date -value [calendar::from_sql_datetime -sql_date $date -format "YYYY-MM-DD"]
+ element set_properties reservation start_time -value $start_time_date
+ element set_properties reservation end_time -value $end_time_date
+
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/reservation-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-view.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-view.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,80 @@
+
+@title@
+@context@
+
+
+
+
+
+
+ @facilities_pretty_name@ Name: |
+ @reservation_info.facility_name@ |
+
+
+ @rooms_pretty_name@ Name: |
+ @reservation_info.room_name@ |
+
+
+ Event: |
+ @reservation_info.name@ |
+
+
+ Reservation Date and Time: |
+ @reservation_info.full_start_date@ to @reservation_info.full_end_date@ |
+
+
+ Reserved by: |
+ @reservation_info.username@ |
+
+
+ Estimated No. of Attendees: |
+ @reservation_info.attendees@ |
+
+
+ Added Instructions / Extra Notes: |
+ @reservation_info.note@ |
+
+
+ Contact Person: |
+ @reservation_info.contact_person@ |
+
+
+ Contact Email: |
+ @reservation_info.contact_email@ |
+
+
+ Contact Phone: |
+ @reservation_info.contact_phone@ |
+
+
+ Status: |
+ @reservation_info.status@ |
+
+
+
+ Administrator's reason why reservation request was @reservation_info.status@: |
+ @reservation_info.reason@ |
+
+
+ Date when reservation request was @reservation_info.status@: |
+ @reservation_info.full_action_date@ |
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/reservation-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/reservation-view.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/reservation-view.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,39 @@
+# /packages/room-reservation/www/reservation-view.tcl
+
+ad_page_contract {
+
+ Shows information about a Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservation-view.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ reservation_id:integer,notnull
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+# Check if user has write permission for this room
+set owner_p [room-reservation::reservations::owner_p -reservation_id $reservation_id -user_id $user_id]
+set write_p [permission::permission_p -party_id $user_id -object_id $reservation_id -privilege "write"]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set room_id [room-reservation::reservations::get_room_id -reservation_id $reservation_id]
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "Reservation Info"
+set context [list [list "rooms" $rooms_pretty_plural] [list "room-view?room_id=$room_id" "$room_full_name Info"] [list "room-reservations?room_id=$room_id" "$room_full_name Reservations"] $title]
+
+room-reservation::reservations::get -reservation_id $reservation_id -array reservation_info
+if {[room-reservation::reservations::check_conflict_p -reservation_id $reservation_id -room_id $reservation_info(room_id) -start_date $reservation_info(start_date) -end_date $reservation_info(end_date)]} {
+ set conflict_p 1
+} else {
+ set conflict_p 0
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/room-reservations.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-reservations.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-reservations.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,15 @@
+
+@title@
+@context@
+
+
+
+
+
+
+@calendar_navigation;noquote@ |
+@content;noquote@ |
+
+
\ No newline at end of file
Index: openacs-4/contrib/packages/room-reservation/www/room-reservations.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-reservations.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-reservations.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,74 @@
+# /packages/room-reservation/www/room-reservations.tcl
+
+ad_page_contract {
+
+ Shows reservations of a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-reservations.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ {view "list"}
+ {date ""}
+ {julian_date ""}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+set date [calendar::adjust_date -date $date -julian_date $julian_date]
+
+room-reservation::get_ui_params -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "$room_full_name Reservations"
+set context [list [list "rooms" $rooms_pretty_plural] [list "room-view?room_id=$room_id" "$room_full_name Info"] $title]
+
+set item_template "\$item"
+set day_template "\$day - \$pretty_date (Reserve on this date)"
+set item_add_template "(Reserve)"
+
+switch -exact -- $view {
+ {list} {
+ set content [room-reservation::calendar::list_display -room_id $room_id \
+ -date $date \
+ -item_template $item_template \
+ ]
+ }
+ {week} {
+ set content [room-reservation::calendar::one_week_display -room_id $room_id \
+ -date $date \
+ -prev_nav_template "<" \
+ -next_nav_template ">" \
+ -item_template $item_template \
+ -day_template $day_template \
+ ]
+ }
+ {month} {
+ set content [room-reservation::calendar::one_month_display -room_id $room_id \
+ -date $date \
+ -prev_nav_template "<" \
+ -next_nav_template ">" \
+ -item_template "$item_template" \
+ -day_template "\$day_number" \
+ -item_add_template "$item_add_template" \
+ ]
+ }
+ default {
+ set content [room-reservation::calendar::one_day_display -room_id $room_id \
+ -date $date \
+ -prev_nav_template "<" \
+ -next_nav_template ">" \
+ -item_template $item_template \
+ ]
+ }
+}
+
+set calendar_navigation [dt_widget_calendar_navigation "room-reservations" $view $date "room_id=$room_id"]
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/room-search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-search.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-search.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,7 @@
+
+@title@
+{@context@}
+room_search.facility
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/room-search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-search.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-search.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,103 @@
+# /packages/room-reservation/www/room-search.tcl
+
+ad_page_contract {
+
+ Room Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-search.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_verify_and_get_user_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set title "Search for $rooms_pretty_plural"
+set context $title
+
+form create room_search
+
+element create room_search facility_id \
+ -label "$facilities_pretty_name" \
+ -datatype integer \
+ -widget select \
+ -options [linsert [room-reservation::facilities::get_name_id_list_enabled_and_non_empty] 0 [list All 0]] \
+ -optional
+
+element create room_search date_start \
+ -label "Start on this date" \
+ -datatype date \
+ -widget date \
+ -optional
+
+element create room_search date_end \
+ -label "End on this date" \
+ -datatype date \
+ -widget date \
+ -optional
+
+element create room_search start_time \
+ -label "Start Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM" \
+ -optional
+
+element create room_search end_time \
+ -label "End Time" \
+ -datatype date \
+ -widget date \
+ -format "HH12:MI AM" \
+ -optional
+
+element create room_search capacity \
+ -label "Seating capacity" \
+ -datatype integer \
+ -widget text
+
+# Process the form
+if {[form is_valid room_search]} {
+ template::form get_values room_search facility_id date_start date_end start_time end_time capacity
+
+ # Set up the datetimes
+ #set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p]
+ #set end_date [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p]
+
+ #set room_search_id [calendar::item::new -start_date $start_date \
+ \# -end_date $end_date \
+ \# -name $title \
+ \# -description $description \
+ \# -calendar_id $calendar_id \
+ \# -item_type_id $item_type_id]
+
+ ad_script_abort
+}
+
+# Set some properties
+#element set_properties room_search date -value [calendar::from_sql_datetime -sql_date $date -format "YYYY-MM-DD"]
+
+#if {[dt_no_time_p -start_time $start_time -end_time $end_time]} {
+# # No time event
+# element set_properties room_search time_p -value 0
+#} else {
+# if {![empty_string_p $start_time]} {
+# set start_time_date [calendar::from_sql_datetime -sql_date $start_time -format {HH24}]
+# element set_properties room_search start_time -value $start_time_date
+# }
+#
+# if {![empty_string_p $end_time]} {
+# set end_time_date [calendar::from_sql_datetime -sql_date $end_time -format {HH24}]
+# element set_properties room_search end_time -value $end_time_date
+# }
+#
+# element set_properties room_search time_p -value 1
+#}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/room-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-view.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-view.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,40 @@
+
+@title@
+@context@
+
+
+
+
+
+
+ Room Name: |
+ @room_info.name@ |
+
+
+ Description: |
+ @room_info.description@ |
+
+
+ Capacity: |
+ @room_info.capacity@ |
+
+
+ Room Name: |
+ @room_info.name@ |
+
+
+ Phone: |
+ @room_info.phone@ |
+
+
+ Needs Approval: |
+ YesNo |
+
+
+ Enabled: |
+ YesNo |
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/room-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/room-view.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/room-view.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,29 @@
+# /packages/room-reservation/www/room-view.tcl
+
+ad_page_contract {
+
+ Shows information about a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-view.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+room-reservation::get_ui_params -rooms_pretty_plural rooms_pretty_plural
+
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "$room_full_name Info"
+set context [list [list "rooms" $rooms_pretty_plural] $title]
+
+room-reservation::rooms::get -room_id $room_id -array room_info
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/rooms.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/rooms.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/rooms.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,14 @@
+
+@title@
+@title@
+
+@rooms_pretty_plural@
+
+
+@facilities_pretty_name@: @rooms.facility_name@ (@rooms.room_count@ @rooms_pretty_plural@)
+
+
Index: openacs-4/contrib/packages/room-reservation/www/rooms.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/rooms.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/rooms.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,27 @@
+# /packages/room-reservation/www/rooms.tcl
+
+ad_page_contract {
+
+ Room Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: rooms.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+set package_id [ad_conn package_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set title "$rooms_pretty_plural"
+
+
+db_multirow rooms select_enabled_rooms_grouped {}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/rooms.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/rooms.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/rooms.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ select f.facility_id,
+ f.name as facility_name,
+ (select count(room_id)
+ from rr_rooms_enabled
+ where facility_id = f.facility_id) as room_count,
+ r.room_id,
+ coalesce(r.name,'0') as room_name,
+ r.capacity
+ from rr_facilities_enabled f,
+ rr_rooms_enabled r
+ where f.facility_id = r.facility_id
+ and f.package_id = :package_id
+ order by f.name, r.name
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facilities.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facilities.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facilities.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,35 @@
+
+@title@
+{@context@}
+
+@facilities_pretty_plural@
+
+
+
+
+
+
+ Enabled @facilities_pretty_plural@Disabled @facilities_pretty_plural@ |
+
+
+ Name |
+ Description |
+ No. of rooms |
+ Action |
+
+
+
+ @facilities.name@ |
+ @facilities.description@ |
+ @facilities.roomcount@ |
+ [ DisableEnable | Edit | View @rooms_pretty_plural@ | Delete] |
+
+
+
+
+
+
+No @facilities_pretty_plural@
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facilities.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facilities.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facilities.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,30 @@
+# /packages/room-reservation/www/admin/facilities.tcl
+
+ad_page_contract {
+
+ Facilities Administration
+
+ This page displays the available facilities used in
+ facility reservation as well as links to toggle their
+ availability and also link to create a new facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facilities.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set package_id [ad_conn package_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_plural rooms_pretty_plural
+
+set title "$facilities_pretty_plural"
+set context $title
+
+db_multirow facilities select_facilities {}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/facilities.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facilities.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facilities.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ select f.facility_id,
+ f.name,
+ f.description,
+ f.enabled_p,
+ (select count(room_id)
+ from rr_rooms
+ where facility_id = f.facility_id) as roomcount
+ from rr_facilities f
+ where package_id = :package_id
+ order by enabled_p desc, name
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-delete.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-delete.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,20 @@
+# /packages/room-reservation/www/admin/facility-delete.tcl
+
+ad_page_contract {
+
+ Deletes a Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-delete.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+}
+
+if { [catch { room-reservation::facilities::delete -facility_id $facility_id } errmsg] } {
+ ad_return_error "Delete Error" "This [room-reservation::get_facilities_pretty_name] cannot be deleted due to the following reason:
$errmsg
"
+
+}
+
+ad_returnredirect "facilities"
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,32 @@
+
+@title@
+@context@
+
+
+@facility_name@ cannot be disabled if pending and/or approved reservations exist. The conflicting reservations are listed blow.
+
+
+
+ Facility |
+ Room |
+ Event Name |
+ Reservation Date |
+ Status |
+ Reserved by |
+ Action |
+
+
+
+
+ @reservations_list.facility_name@ |
+ @reservations_list.room_name@ |
+ @reservations_list.name@ |
+ @reservations_list.full_start_date@ to @reservations_list.full_end_date@ |
+ @reservations_list.status@ |
+ @reservations_list.username@ |
+ [ View Details | Approve | Reject ] |
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-disable.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,47 @@
+# /packages/room-reservation/www/admin/facility-disable.tcl
+
+ad_page_contract {
+
+ Disables a Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-disable.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+ {return_url "facilities"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set room_list [room-reservation::facilities::get_room_list -facility_id $facility_id]
+set reservations [list]
+
+foreach room_id $room_list {
+ set one_room_reservation [room-reservation::rooms::get_reservations_list_of_ns_sets \
+ -room_id $room_id \
+ -status_list [list pending approved] \
+ ]
+
+ set reservations [concat $reservations $one_room_reservation]
+}
+
+# are there valid reesrvations that will conflict when we disable this room?
+if {[llength $reservations]} {
+ room-reservation::get_ui_params -rooms_pretty_name rooms_pretty_name
+ set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+
+ room-reservation::get_ui_params -facilities_pretty_plural facilities_pretty_plural
+
+ set title "Disable $facility_name"
+ set context [list [list "facilities" $facilities_pretty_plural] $title]
+
+ template::util::list_of_ns_sets_to_multirow -rows $reservations -var_name reservations_list
+ ad_return_template
+} else {
+ # no conflicts. let's proceed with disabling
+ room-reservation::facilities::disable -facility_id $facility_id
+ ad_returnredirect "facilities"
+}
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,6 @@
+
+@title@
+@context@
+facility.name
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-edit.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,75 @@
+# /packages/room-reservation/www/admin/facility-edit.tcl
+
+ad_page_contract {
+
+ Edits properties of an existing Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-edit.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set package_id [ad_conn package_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural
+
+set title "Edit A $facilities_pretty_name"
+set context [list [list "facilities" $facilities_pretty_plural] $title]
+
+form create facility_edit
+
+element create facility_edit facility_id \
+ -label "Facility ID" \
+ -datatype integer \
+ -widget hidden
+
+element create facility_edit name \
+ -label "Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200}
+
+element create facility_edit description \
+ -label "Description" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+if {[form is_valid facility_edit] || [form is_submission facility_edit]} {
+ template::form get_values facility_edit \
+ facility_id name description
+
+ set name_exists_p [room-reservation::facilities::name_exists -name $name]
+
+ if {$name_exists_p && ![string equal $name_exists_p $facility_id]} {
+ element set_error facility_edit name "The name you provided is already being used"
+ } else {
+ set facility_id [room-reservation::facilities::edit -facility_id $facility_id \
+ -name $name \
+ -description $description \
+ -package_id $package_id \
+ ]
+
+ ad_returnredirect "facilities"
+ ad_script_abort
+ }
+
+}
+
+if { [form is_request facility_edit] } {
+ # Select info for the item
+ room-reservation::facilities::get -facility_id $facility_id -array facility_info
+
+ element set_properties facility_edit facility_id -value $facility_id
+ element set_properties facility_edit name -value $facility_info(name)
+ element set_properties facility_edit description -value $facility_info(description)
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-enable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-enable.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-enable.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,17 @@
+# /packages/room-reservation/www/admin/facility-enable.tcl
+
+ad_page_contract {
+
+ Enables a Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-enable.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+}
+
+room-reservation::facilities::enable -facility_id $facility_id
+
+ad_returnredirect "facilities"
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-new.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-new.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,6 @@
+
+@title@
+@context@
+facility.name
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-new.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-new.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,67 @@
+# /packages/room-reservation/www/admin/facility-new.tcl
+
+ad_page_contract {
+
+ Create a new Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-new.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set package_id [ad_conn package_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural
+
+set title "Create New $facilities_pretty_name"
+set context [list [list "facilities" $facilities_pretty_plural] $title]
+
+form create facility
+
+element create facility facility_id \
+ -label "Facility ID" \
+ -datatype integer \
+ -widget hidden
+
+element create facility name \
+ -label "Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200}
+
+element create facility description \
+ -label "Description" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+if {[form is_valid facility] || [form is_submission facility]} {
+ template::form get_values facility \
+ facility_id name description
+
+ if {[room-reservation::facilities::name_exists -name $name]} {
+ element set_error facility name "The name you provided is already being used"
+ } else {
+ set facility_id [room-reservation::facilities::new -facility_id $facility_id \
+ -name $name \
+ -description $description \
+ -package_id $package_id \
+ ]
+
+ ad_returnredirect "facilities"
+ ad_script_abort
+ }
+}
+
+if { [form is_request facility] } {
+ # Pre-fetch the facility_id
+ set facility_id [db_nextval acs_object_id_seq]
+ element set_properties facility facility_id -value $facility_id
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-view.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-view.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,22 @@
+
+@title@
+@context@
+
+@facility_name@
+
+
+
+
+Enabled @rooms_pretty_plural@Disabled @rooms_pretty_plural@
+
+
+
+
+No @rooms_pretty_plural@
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-view.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-view.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,31 @@
+# /packages/room-reservation/www/admin/facility-view.tcl
+
+ad_page_contract {
+
+ Shows statistics for an existing Facility
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: facility-view.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set package_id [ad_conn package_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+
+set title "$facility_name $rooms_pretty_plural"
+set context [list [list "facilities" $facilities_pretty_plural] $title]
+
+set return_url [ad_urlencode "facility-view?facility_id=$facility_id"]
+
+db_multirow rooms select_rooms {}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/facility-view.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/facility-view.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/facility-view.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ select r.room_id,
+ r.name,
+ r.enabled_p,
+ (select count(reservation_id)
+ from rr_reservations re
+ where re.room_id = r.room_id) as reservation_count
+ from rr_rooms r
+ where facility_id = :facility_id
+ order by enabled_p desc, name
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/index.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/index.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,11 @@
+
+@title@
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/index.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/index.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,21 @@
+# /packages/room-reservation/www/admin/index.tcl
+
+ad_page_contract {
+
+ Room Reservation Administration
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: index.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+
+} -properties {
+ title:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_plural rooms_pretty_plural
+
+set title "Room Reservation Administration"
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/params-flush.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/params-flush.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/params-flush.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,13 @@
+
+@title@
+@context@
+
+
+Cached parameters flushed. Here are the new values:
+
+
+
+ - @parameter_list:item@
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/params-flush.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/params-flush.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/params-flush.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,34 @@
+# /packages/room-reservation/www/admin/params-flush.tcl
+
+ad_page_contract {
+
+ Room Reservation Administration
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: params-flush.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+
+set package_id [ad_conn package_id]
+
+set title "Flush Cached Parameters"
+set context [list [list "params" "Manage Package Parameters"] $title]
+
+room-reservation::flush_parameters
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set parameter_list [list \
+ "Facilities Pretty Name - $facilities_pretty_name" \
+ "Facilities Pretty Plural - $facilities_pretty_plural" \
+ "Rooms Pretty Name - $rooms_pretty_name" \
+ "Rooms Pretty Plural - $rooms_pretty_plural" \
+ ]
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/params.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/params.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/params.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,9 @@
+
+@title@
+{@context@}
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/params.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/params.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/params.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,23 @@
+# /packages/room-reservation/www/admin/params.tcl
+
+ad_page_contract {
+
+ Room Reservation Administration
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: params.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set package_id [ad_conn package_id]
+
+set title "Manage Package Parameters"
+set context $title
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/reservations-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/reservations-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/reservations-postgresql.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,47 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select r.reservation_id,
+ f.name as facility_name,
+ fr.name as room_name,
+ r.status,
+ to_char(start_date, 'Mon DD, YYYY HH12:MI AM') as full_start_date,
+ to_char(end_date, 'Mon DD, YYYY HH12:MI AM') as full_end_date,
+ (CASE
+ WHEN
+ r.status = 'pending'
+ THEN 1
+ WHEN
+ r.status = 'approved'
+ THEN 2
+ WHEN
+ r.status = 'rejected'
+ THEN 3
+ ELSE 4
+ END) as status_order,
+ e.name,
+ p.first_names||' '||p.last_name as username
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join $table_name r
+ on (e.event_id = r.reservation_id)
+ join rr_rooms fr
+ on (r.room_id = fr.room_id)
+ join rr_facilities f
+ on (f.facility_id = fr.facility_id)
+ join persons p
+ on (r.reserving_user = p.person_id)
+ where f.package_id = :package_id
+ order by status_order, full_start_date
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/reservations.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/reservations.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/reservations.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,35 @@
+
+@title@
+@context@
+
+
+Show @filter_list:item@@filter_list:item@ |
reservations
+
+
+
+ @facilities_pretty_name@ Name |
+ @rooms_pretty_name@ Name |
+ Event Name |
+ Reservation Date |
+ Status |
+ Reserved by |
+ Action |
+
+
+
+ |
+
+
+
+ @all_reservations.facility_name@ |
+ @all_reservations.room_name@ |
+ @all_reservations.name@ |
+ @all_reservations.full_start_date@ to @all_reservations.full_end_date@ |
+ @all_reservations.status@ |
+ @all_reservations.username@ |
+ [ View Details | Approve | Reject ] |
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/reservations.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/reservations.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/reservations.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,52 @@
+# /packages/room-reservation/www/admin/reservations.tcl
+
+ad_page_contract {
+
+ Room Reservation
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: reservations.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ {filter_on ""}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set user_id [ad_conn user_id]
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set title "Reservations"
+set context $title
+
+switch -exact -- $filter_on {
+ {canceled} {
+ set table_name "rr_reservations_cancel"
+ }
+ {pending} {
+ set table_name "rr_reservations_pending"
+ }
+ {approved} {
+ set table_name "rr_reservations_approve"
+ }
+ {rejected} {
+ set table_name "rr_reservations_reject"
+ }
+ default {
+ set table_name "rr_reservations"
+ set filter_on "all"
+ }
+}
+
+set filter_list [list all pending approved rejected canceled]
+
+set package_id [ad_conn package_id]
+
+db_multirow all_reservations get_all_reservations {}
+
+set return_url "[ad_urlencode [ad_conn url]]"
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-delete.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-delete.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,21 @@
+# /packages/room-reservation/www/admin/room-delete.tcl
+
+ad_page_contract {
+
+ Deletes a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-delete.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ facility_id:integer,notnull
+}
+
+if { [catch { room-reservation::rooms::delete -room_id $room_id } errmsg] } {
+ ad_return_error "Delete Error" "This [room-reservation::get_rooms_pretty_name] cannot be deleted due to the following reason: $errmsg
"
+
+}
+
+ad_returnredirect "facility-view?facility_id=$facility_id"
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-disable.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-disable.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-disable.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,28 @@
+
+@title@
+@context@
+
+
+@room_full_name@ cannot be disabled if pending and/or approved reservations exist. The conflicting reservations are listed blow.
+
+
+
+ Event Name |
+ Reservation Date |
+ Status |
+ Reserved by |
+ Action |
+
+
+
+
+ @reservations_list.name@ |
+ @reservations_list.full_start_date@ to @reservations_list.full_end_date@ |
+ @reservations_list.status@ |
+ @reservations_list.username@ |
+ [ View Details | Approve | Reject ] |
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-disable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-disable.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-disable.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,39 @@
+# /packages/room-reservation/www/admin/room-disable.tcl
+
+ad_page_contract {
+
+ Disables a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-disable.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ facility_id:integer,notnull
+ {return_url "rooms"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+set reservations [room-reservation::rooms::get_reservations_list_of_ns_sets \
+ -room_id $room_id \
+ -status_list [list pending approved] \
+ ]
+
+# are there valid reesrvations that will conflict when we disable this room?
+if {[llength $reservations]} {
+ room-reservation::get_ui_params -rooms_pretty_name rooms_pretty_name
+ set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+ set title "Disable $room_full_name"
+ set context [list [list "room-view?room_id=$room_id" "View $rooms_pretty_name"] $title]
+
+ template::util::list_of_ns_sets_to_multirow -rows $reservations -var_name reservations_list
+ ad_return_template
+} else {
+ # no conflicts. let's proceed with disabling
+ room-reservation::rooms::disable -room_id $room_id -facility_id $facility_id
+ ad_returnredirect $return_url
+}
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-edit.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-edit.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,6 @@
+
+@title@
+@context@
+room.name
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-edit.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-edit.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,113 @@
+# /packages/room-reservation/www/admin/room-edit.tcl
+
+ad_page_contract {
+
+ Edits properties of an existing Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-edit.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ facility_id:integer,notnull
+ {return_url "rooms"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "Edit $rooms_pretty_name Properties"
+set context [list [list "facilities" $facilities_pretty_plural] [list "facility-view?facility_id=$facility_id" "$facility_name $rooms_pretty_plural"] [list "room-view?room_id=$room_id" $room_full_name] $title]
+
+form create room_edit
+
+element create room_edit room_id \
+ -label "Room ID" \
+ -datatype integer \
+ -widget hidden
+
+element create room_edit facility_id \
+ -label "Facility ID" \
+ -datatype integer \
+ -widget hidden
+
+element create room_edit return_url \
+ -label "Return URL" \
+ -datatype text \
+ -widget hidden
+
+element create room_edit name \
+ -label "Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200}
+
+element create room_edit description \
+ -label "Description" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+element create room_edit capacity \
+ -label "Capacity" \
+ -datatype integer \
+ -html {size 5} \
+ -widget text
+
+element create room_edit phone \
+ -label "Phone" \
+ -datatype text \
+ -widget text \
+ -html {size 20 maxlength 50} \
+ -optional
+
+element create room_edit approval_needed_p \
+ -label "Needs approval to reserve" \
+ -datatype text \
+ -widget select \
+ -options {{Yes t} {No f}}
+
+if {[form is_valid room_edit] || [form is_submission room_edit]} {
+ template::form get_values room_edit \
+ room_id facility_id return_url name description capacity phone approval_needed_p
+
+ set name_exists_p [room-reservation::rooms::name_exists -name $name -facility_id $facility_id]
+ if {$name_exists_p && ![string equal $name_exists_p $room_id]} {
+ element set_error room_edit name "The name you provided is already being used."
+ } else {
+ set room_id [room-reservation::rooms::edit -room_id $room_id \
+ -name $name \
+ -facility_id $facility_id \
+ -description $description \
+ -capacity $capacity \
+ -phone $phone \
+ -approval_needed_p $approval_needed_p \
+ ]
+
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
+}
+
+if { [form is_request room_edit] } {
+ # Select info for the item
+ room-reservation::rooms::get -room_id $room_id -array room_info
+
+ element set_properties room_edit room_id -value $room_id
+ element set_properties room_edit return_url -value $return_url
+ element set_properties room_edit name -value $room_info(name)
+ element set_properties room_edit facility_id -value $room_info(facility_id)
+ element set_properties room_edit description -value $room_info(description)
+ element set_properties room_edit capacity -value $room_info(capacity)
+ element set_properties room_edit phone -value $room_info(phone)
+ element set_properties room_edit approval_needed_p -value $room_info(approval_needed_p)
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-enable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-enable.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-enable.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,19 @@
+# /packages/room-reservation/www/admin/room-enable.tcl
+
+ad_page_contract {
+
+ Enables a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-enable.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ facility_id:integer,notnull
+ {return_url "rooms"}
+}
+
+room-reservation::rooms::enable -room_id $room_id -facility_id $facility_id
+
+ad_returnredirect $return_url
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-history-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-history-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-history-postgresql.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,33 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select r.reservation_id,
+ r.status,
+ coalesce(to_char(action_date, 'Mon DD, YYYY'), to_char(creation_date, 'Mon DD, YYYY')) as status_date,
+ e.name,
+ p.first_names||' '||p.last_name as username
+ from acs_events e join timespans s
+ on (e.timespan_id = s.timespan_id)
+ join time_intervals t
+ on (s.interval_id = t.interval_id)
+ join rr_reservations r
+ on (e.event_id = r.reservation_id)
+ join rr_rooms fr
+ on (r.room_id = fr.room_id)
+ join acs_objects o
+ on (r.reservation_id = o.object_id)
+ join persons p
+ on (coalesce(r.action_user, r.reserving_user) = p.person_id)
+ where fr.room_id = :room_id
+ order by coalesce(action_date, creation_date)
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-history.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-history.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-history.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,12 @@
+
+@title@
+@context@
+
+
+Reservation History for @room_full_name@
+
+
+ - On @all_reservations.status_date@, room was requested for reservation@all_reservations.status@ by @all_reservations.username@ for "@all_reservations.name@"
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-history.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-history.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-history.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,31 @@
+# /packages/room-reservation/www/admin/room-history.tcl
+
+ad_page_contract {
+
+ Shows the reservation history of a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-history.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ {return_url "rooms"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set facility_id [room-reservation::rooms::get_facility_id -room_id $room_id]
+set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+
+set title "Reservation History"
+set context [list [list "facilities" $facilities_pretty_plural] [list "facility-view?facility_id=$facility_id" "$facility_name $rooms_pretty_plural"] [list "room-view?room_id=$room_id" "$room_full_name Info"] $title]
+
+db_multirow all_reservations get_room_history {}
+
+set return_url_2 [ad_urlencode "room-view?room_id=$room_id&return_url=$return_url"]
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-new.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-new.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,6 @@
+
+@title@
+@context@
+room.name
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-new.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-new.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,105 @@
+# /packages/room-reservation/www/admin/room-new.tcl
+
+ad_page_contract {
+
+ Create a new Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-new.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ facility_id:integer,notnull
+ {return_url "rooms"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+
+set title "Create New $rooms_pretty_name"
+set context [list [list "facilities" $facilities_pretty_plural] [list "facility-view?facility_id=$facility_id" "$facility_name $rooms_pretty_plural"] $title]
+
+form create room
+
+element create room room_id \
+ -label "Room ID" \
+ -datatype integer \
+ -widget hidden
+
+element create room facility_id \
+ -label "Facility ID" \
+ -datatype integer \
+ -widget hidden
+
+element create room return_url \
+ -label "Return URL" \
+ -datatype text \
+ -widget hidden
+
+element create room name \
+ -label "Name" \
+ -datatype text \
+ -widget text \
+ -html {size 60 maxlength 200}
+
+element create room description \
+ -label "Description" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 60 rows 10 wrap soft} \
+ -optional
+
+element create room capacity \
+ -label "Capacity" \
+ -datatype integer \
+ -html {size 5} \
+ -widget text
+
+element create room phone \
+ -label "Phone" \
+ -datatype text \
+ -widget text \
+ -html {size 20 maxlength 50} \
+ -optional
+
+element create room approval_needed_p \
+ -label "Needs approval to reserve" \
+ -datatype text \
+ -widget select \
+ -options {{Yes t} {No f}}
+
+if {[form is_valid room] || [form is_submission room]} {
+ template::form get_values room \
+ room_id facility_id return_url name description capacity phone approval_needed_p
+
+ if {[room-reservation::rooms::name_exists -name $name -facility_id $facility_id]} {
+ element set_error room name "The name you provided is already being used."
+ } else {
+ set room_id [room-reservation::rooms::new -room_id $room_id \
+ -name $name \
+ -facility_id $facility_id \
+ -description $description \
+ -capacity $capacity \
+ -phone $phone \
+ -approval_needed_p $approval_needed_p \
+ ]
+
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
+}
+
+if { [form is_request room] } {
+ # Pre-fetch the room_id
+ set room_id [db_nextval acs_object_id_seq]
+ element set_properties room room_id -value $room_id
+ element set_properties room facility_id -value $facility_id
+ element set_properties room return_url -value $return_url
+ element set_properties room approval_needed_p -value t
+}
+
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-view.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-view.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,43 @@
+
+@title@
+@context@
+
+
+Back
+
+
+
+
+
+ Room Name: |
+ @room_info.name@ |
+
+
+ Description: |
+ @room_info.description@ |
+
+
+ Capacity: |
+ @room_info.capacity@ |
+
+
+ Room Name: |
+ @room_info.name@ |
+
+
+ Phone: |
+ @room_info.phone@ |
+
+
+ Needs Approval: |
+ YesNo |
+
+
+ Enabled: |
+ YesNo |
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/room-view.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/room-view.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/room-view.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,31 @@
+# /packages/room-reservation/www/admin/room-view.tcl
+
+ad_page_contract {
+
+ Shows information about a Room
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: room-view.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+ room_id:integer,notnull
+ {return_url "rooms"}
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -facilities_pretty_plural facilities_pretty_plural -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set room_full_name [room-reservation::rooms::get_full_name -room_id $room_id]
+set facility_id [room-reservation::rooms::get_facility_id -room_id $room_id]
+set facility_name [room-reservation::facilities::get_name -facility_id $facility_id]
+
+set title "$room_full_name Info"
+set context [list [list "facilities" $facilities_pretty_plural] [list "facility-view?facility_id=$facility_id" "$facility_name $rooms_pretty_plural"] $title]
+
+room-reservation::rooms::get -room_id $room_id -array room_info
+
+set return_url_2 [ad_urlencode "room-view?room_id=$room_id&return_url=$return_url"]
+ad_return_template
Index: openacs-4/contrib/packages/room-reservation/www/admin/rooms-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/rooms-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/rooms-postgresql.xql 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,25 @@
+
+
+ postgresql7.1
+
+
+
+
+
+ select f.facility_id,
+ f.name as facility_name,
+ r.room_id,
+ coalesce(r.name,'0') as room_name,
+ r.capacity,
+ r.enabled_p
+ from rr_facilities f
+ left join rr_rooms r
+ on f.facility_id = r.facility_id
+ where f.package_id = :package_id
+ order by f.name, r.name
+
+
+
+
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/rooms.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/rooms.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/rooms.adp 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,14 @@
+
+@title@
+@context@
+
+@rooms_pretty_plural@
+
+
+@facilities_pretty_name@: @rooms.facility_name@ [ Add a @rooms_pretty_name@ ]
+
+
Index: openacs-4/contrib/packages/room-reservation/www/admin/rooms.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/room-reservation/www/admin/rooms.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/room-reservation/www/admin/rooms.tcl 15 Mar 2004 03:39:31 -0000 1.1
@@ -0,0 +1,26 @@
+# /packages/room-reservation/www/admin/rooms.tcl
+
+ad_page_contract {
+
+ Facilities Administration
+
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: rooms.tcl,v 1.1 2004/03/15 03:39:31 carolinem Exp $
+
+} {
+} -properties {
+ title:onevalue
+ context:onevalue
+}
+
+room-reservation::get_ui_params -facilities_pretty_name facilities_pretty_name -rooms_pretty_name rooms_pretty_name -rooms_pretty_plural rooms_pretty_plural
+
+set title "$rooms_pretty_plural"
+set context $title
+
+set package_id [ad_conn package_id]
+
+db_multirow rooms select_all_rooms_grouped {}
+
+ad_return_template