Commit 35b7ad11 authored by Malte Sussdorff's avatar Malte Sussdorff

- Malte

parent 06f0847e
Pipeline #63 failed with stages
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="acs-events" url="http://openacs.org/repository/apm/packages/acs-events" type="apm_service">
<package-name>Events</package-name>
<pretty-plural>Events</pretty-plural>
<package key="acs-events" url="http://www.jsabino.com/acs-repository/apm/packages/acs-events" type="apm_service">
<package-name>ACS Events</package-name>
<pretty-plural>ACS Events</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<version name="0.4d2" url="http://openacs.org/repository/download/apm/acs-events-0.4d2.apm">
<version name="0.6d2" url="http://openacs.org/repository/download/apm/acs-events-0.6d2.apm">
<owner url="http://openacs.org">OpenACS</owner>
<summary>API support for relationships between intervals in time, activities, and parties.</summary>
<release-date>2003-11-10</release-date>
<release-date>2006-02-18</release-date>
<vendor url="http://openacs.org">OpenACS</vendor>
<description format="text/html">The events service is primarily intended for use by writers of application packages and other service packages. The service allows developers to specify and manipulate relationships (possibly recurring) between an object and another object.</description>
<maturity>0</maturity>
<provides url="acs-events" version="0.4d"/>
<provides url="acs-events" version="0.6d2"/>
<requires url="acs-kernel" version="5.3.1a1"/>
<callbacks>
</callbacks>
......
......@@ -16,7 +16,7 @@ create sequence acs_events_seq start with 1;
-- The event object
begin
acs_object_type.create_type (
supertype => 'acs_object',
supertype =>g 'acs_object',
object_type => 'acs_event',
pretty_name => 'ACS Event',
pretty_plural => 'ACS Events',
......@@ -365,7 +365,8 @@ as
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
context_id in acs_objects.context_id%TYPE default null,
package_id in acs_objects.package_id%TYPE default null
) return acs_events.event_id%TYPE;
procedure del (
......@@ -444,7 +445,8 @@ as
procedure recurrence_timespan_edit (
event_id in acs_events.event_id%TYPE,
start_date in time_intervals.start_date%TYPE,
end_date in time_intervals.end_date%TYPE
end_date in time_intervals.end_date%TYPE,
edit_past_events in char default 't'
);
procedure activity_set (
......@@ -579,7 +581,8 @@ as
creation_date in acs_objects.creation_date%TYPE default sysdate,
creation_user in acs_objects.creation_user%TYPE default null,
creation_ip in acs_objects.creation_ip%TYPE default null,
context_id in acs_objects.context_id%TYPE default null
context_id in acs_objects.context_id%TYPE default null,
package_id in acs_objects.package_id%TYPE default null
) return acs_events.event_id%TYPE
is
new_event_id acs_events.event_id%TYPE;
......@@ -587,12 +590,14 @@ as
new_event_id := acs_object.new(
object_id => event_id,
object_type => object_type,
title => name,
creation_date => creation_date,
creation_user => creation_user,
creation_ip => creation_ip,
context_id => context_id
context_id => context_id,
package_id => package_id
);
insert into acs_events
(event_id, name, description, html_p, status_summary, activity_id, timespan_id, recurrence_id)
values
......@@ -725,7 +730,8 @@ as
procedure recurrence_timespan_edit (
event_id in acs_events.event_id%TYPE,
start_date in time_intervals.start_date%TYPE,
end_date in time_intervals.end_date%TYPE
end_date in time_intervals.end_date%TYPE,
edit_past_events in char default 't'
)
is
v_timespan timespans%ROWTYPE;
......@@ -740,7 +746,8 @@ as
event_id= recurrence_timespan_edit.event_id;
for v_timespan in
(select * from time_intervals where interval_id in (select interval_id from timespans where timespan_id in (select timespan_id from acs_events where recurrence_id = (select recurrence_id from acs_events where event_id = recurrence_timespan_edit.event_id))))
(select * from time_intervals where interval_id in (select interval_id from timespans where timespan_id in (select timespan_id from acs_events where recurrence_id = (select recurrence_id from acs_events where event_id = recurrence_timespan_edit.event_id)))
and (edit_past_events = 't' or start_date >= to_date(v_one_start_date,'YYYY-MM-DD HH24:MI:SS') ))
LOOP
time_interval.edit(v_timespan.interval_id, v_timespan.start_date + (start_date - v_one_start_date), v_timespan.end_date + (end_date - v_one_end_date));
END LOOP;
......@@ -858,7 +865,8 @@ as
recurrence_id => event.recurrence_id,
creation_user => object.creation_user,
creation_ip => object.creation_ip,
context_id => object.context_id
context_id => object.context_id,
package_id => object.package_id
);
return new_event_id;
......
......@@ -200,6 +200,7 @@ as
new_activity_id := acs_object.new(
object_id => activity_id,
object_type => object_type,
title => name,
creation_date => creation_date,
creation_user => creation_user,
creation_ip => creation_ip,
......@@ -265,6 +266,10 @@ as
html_p = nvl(edit.html_p, html_p),
status_summary = nvl(edit.status_summary, status_summary)
where activity_id = edit.activity_id;
update acs_objects
set title = nvl(edit.name, title)
where object_id = edit.activity_id;
end edit;
procedure object_map (
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -198,7 +198,10 @@ begin
new__creation_date, -- creation_date
new__creation_user, -- creation_user
new__creation_ip, -- creation_ip
new__context_id -- context_id
new__context_id, -- context_id
''t'', -- security_inherit_p
new__name, -- title
null -- package_id
);
insert into acs_activities
......@@ -300,6 +303,10 @@ begin
status_summary = coalesce(edit__status_summary, status_summary)
where activity_id = edit__activity_id;
update acs_objects
set title = coalesce(edit__name, name)
where activity_id = edit__activity_id;
return 0;
end;' language 'plpgsql';
......
......@@ -90,8 +90,10 @@ begin
end;' language 'plpgsql';
create or replace function next_day (
create function next_day (
--
-- Equivalent of Oracle next_day function
--
-- @author jowell@jsabino.com
--
-- @param somedate Reference date
......@@ -101,7 +103,8 @@ create or replace function next_day (
--
timestamptz, -- somedate
varchar -- weekday
) returns timestamptz as '
)
returns timestamptz as '
declare
next_day__somedate alias for $1;
next_day__weekday alias for $2;
......@@ -126,8 +129,8 @@ begin
-- Do date math
return next_day__somedate + to_interval(v_add_days,''days'');
end;' language 'plpgsql';
end;' language 'plpgsql';
create function add_months (
--
......
This diff is collapsed.
update acs_objects
set title = (select name
from acs_events
where event_id = object_id)
where object_type = 'acs_event';
update acs_objects
set title = (select name
from acs_activities
where activity_id = object_id)
where object_type = 'acs_activity';
drop function acs_event__new (integer,varchar,text,boolean,text,integer,integer,integer,varchar,timestamptz,integer,varchar,integer);
create function acs_event__new (
--
-- Creates a new event (20.10.10)
--
-- @author W. Scott Meeks
--
-- @param event_id id to use for new event
-- @param name Name of the new event
-- @param description Description of the new event
-- @param html_p Is the description HTML?
-- @param status_summary Optional additional status line to display
-- @param timespan_id initial time interval set
-- @param activity_id initial activity
-- @param recurrence_id id of recurrence information
-- @param object_type 'acs_event'
-- @param creation_date default now()
-- @param creation_user acs_object param
-- @param creation_ip acs_object param
-- @param context_id acs_object param
--
-- @return The id of the new event.
--
integer, -- acs_events.event_id%TYPE,
varchar, -- acs_events.name%TYPE,
text, -- acs_events.description%TYPE,
boolean, -- acs_events.html_p%TYPE,
text, -- acs_events.status_summary%TYPE,
integer, -- acs_events.timespan_id%TYPE,
integer, -- acs_events.activity_id%TYPE,
integer, -- acs_events.recurrence_id%TYPE,
varchar, -- acs_object_types.object_type%TYPE,
timestamptz, -- acs_objects.creation_date%TYPE,
integer, -- acs_objects.creation_user%TYPE,
varchar, -- acs_objects.creation_ip%TYPE,
integer -- acs_objects.context_id%TYPE,
)
returns integer as ' -- acs_events.event_id%TYPE
declare
new__event_id alias for $1; -- default null,
new__name alias for $2; -- default null,
new__description alias for $3; -- default null,
new__html_p alias for $4; -- default null
new__status_summary alias for $5; -- default null
new__timespan_id alias for $6; -- default null,
new__activity_id alias for $7; -- default null,
new__recurrence_id alias for $8; -- default null,
new__object_type alias for $9; -- default ''acs_event'',
new__creation_date alias for $10; -- default now(),
new__creation_user alias for $11; -- default null,
new__creation_ip alias for $12; -- default null,
new__context_id alias for $13; -- default null
v_event_id acs_events.event_id%TYPE;
begin
v_event_id := acs_object__new(
new__event_id, -- object_id
new__object_type, -- object_type
new__creation_date, -- creation_date
new__creation_user, -- creation_user
new__creation_ip, -- creation_ip
new__context_id, -- context_id
''t'', -- security_inherit_p
new__name, -- title
null -- package_id
);
insert into acs_events
(event_id, name, description, html_p, status_summary, activity_id, timespan_id, recurrence_id)
values
(v_event_id, new__name, new__description, new__html_p, new__status_summary, new__activity_id, new__timespan_id,
new__recurrence_id);
return v_event_id;
end;' language 'plpgsql';
drop function acs_activity__new (integer,varchar,text,boolean,text,varchar,timestamptz,integer,varchar,integer);
create function acs_activity__new (
--
-- Create a new activity
--
-- @author W. Scott Meeks
--
-- @param activity_id Id to use for new activity
-- @param name Name of the activity
-- @param description Description of the activity
-- @param html_p Is the description HTML?
-- @param status_summary Additional status note (optional)
-- @param object_type 'acs_activity'
-- @param creation_date default now()
-- @param creation_user acs_object param
-- @param creation_ip acs_object param
-- @param context_id acs_object param
--
-- @return The id of the new activity.
--
integer, -- in acs_activities.activity_id%TYPE
varchar, -- in acs_activities.name%TYPE,
text, -- in acs_activities.description%TYPE
boolean, -- in acs_activities.html_p%TYPE
text, -- in acs_activities.status_summary%TYPE
varchar, -- in acs_object_types.object_type%TYPE
timestamptz, -- in acs_objects.creation_date%TYPE
integer, -- in acs_objects.creation_user%TYPE
varchar, -- in acs_objects.creation_ip%TYPE
integer -- in acs_objects.context_id%TYPE
)
returns integer as ' -- return acs_activities.activity_id%TYPE
declare
new__activity_id alias for $1; -- default null,
new__name alias for $2;
new__description alias for $3; -- default null,
new__html_p alias for $4; -- default ''f'',
new__status_summary alias for $5; -- default null,
new__object_type alias for $6; -- default ''acs_activity''
new__creation_date alias for $7; -- default now(),
new__creation_user alias for $8; -- default null,
new__creation_ip alias for $9; -- default null,
new__context_id alias for $10; -- default null
v_activity_id acs_activities.activity_id%TYPE;
begin
v_activity_id := acs_object__new(
new__activity_id, -- object_id
new__object_type, -- object_type
new__creation_date, -- creation_date
new__creation_user, -- creation_user
new__creation_ip, -- creation_ip
new__context_id, -- context_id
''t'', -- security_inherit_p
new__name, -- title
null -- package_id
);
insert into acs_activities
(activity_id, name, description, html_p, status_summary)
values
(v_activity_id, new__name, new__description, new__html_p, new__status_summary);
return v_activity_id;
end;' language 'plpgsql';
drop function acs_activity__edit (integer,varchar,text,boolean,text);
create function acs_activity__edit (
--
-- Update the name or description of an activity
--
-- @author W. Scott Meeks
--
-- @param activity_id activity to update
-- @param name optional New name for this activity
-- @param description optional New description for this activity
-- @param html_p optional New value of html_p for this activity
-- @param status_summary optional New value of status_summary for this activity
--
-- @return 0 (procedure dummy)
--
integer, -- acs_activities.activity_id%TYPE,
varchar, -- acs_activities.name%TYPE default null,
text, -- acs_activities.description%TYPE default null,
boolean, -- acs_activities.html_p%TYPE default null
text -- acs_activities.status_summary%TYPE default null,
) returns integer as '
declare
edit__activity_id alias for $1;
edit__name alias for $2; -- default null,
edit__description alias for $3; -- default null,
edit__html_p alias for $4; -- default null
edit__status_summary alias for $5; -- default null
begin
update acs_activities
set name = coalesce(edit__name, name),
description = coalesce(edit__description, description),
html_p = coalesce(edit__html_p, html_p),
status_summary = coalesce(edit__status_summary, status_summary)
where activity_id = edit__activity_id;
update acs_objects
set title = coalesce(edit__name, name)
where activity_id = edit__activity_id;
return 0;
end;' language 'plpgsql';
create or replace function acs_event__get_html_p (
--
-- Returns html_p or html_p of the activity associated with the event if
-- html_p is null.
--
-- @author W. Scott Meeks
--
-- @param event_id id of event to get html_p for
--
-- @return The html_p or html_p of the activity associated with the event if html_p is null.
--
integer -- acs_events.event_id%TYPE
)
returns boolean as ' -- acs_events.html_p%TYPE
declare
get_html_p__event_id alias for $1; -- in acs_events.event_id%TYPE
v_html_p acs_events.html_p%TYPE;
begin
select coalesce(e.html_p, a.html_p) into v_html_p
from acs_events e
left join acs_activities a
on (e.activity_id = a.activity_id)
where e.event_id = get_html_p__event_id;
return v_html_p;
end;' language 'plpgsql';
create or replace function acs_event__get_status_summary (
--
-- Returns status_summary or status_summary of the activity associated with the event if
-- status_summary is null.
--
-- @author W. Scott Meeks
--
-- @param event_id id of event to get status_summary for
--
-- @return The status_summary or status_summary of the activity associated with the event if status_summary is null.
--
integer -- acs_events.event_id%TYPE
)
returns boolean as '
declare
get_status_summary__event_id alias for $1; -- acs_events.event_id%TYPE
v_status_summary acs_events.status_summary%TYPE;
begin
select coalesce(e.status_summary, a.status_summary) into v_status_summary
from acs_events e
left join acs_activities a
on (e.activity_id = a.activity_id)
where e.event_id = get_status_summary__event_id;
return v_status_summary;
end;' language 'plpgsql';
-- backwards compatible 13 param version
create or replace function acs_event__new (
integer,
varchar,
text,
boolean,
text,
integer,
integer,
integer,
varchar,
timestamptz,
integer,
varchar,
integer
)
returns integer as '
begin
return acs_event__new($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,null);
end;' language 'plpgsql';
create or replace function acs_event__new (
--
-- Creates a new event (20.10.10)
--
-- @author W. Scott Meeks
--
-- @param event_id id to use for new event
-- @param name Name of the new event
-- @param description Description of the new event
-- @param html_p Is the description HTML?
-- @param status_summary Optional additional status line to display
-- @param timespan_id initial time interval set
-- @param activity_id initial activity
-- @param recurrence_id id of recurrence information
-- @param object_type 'acs_event'
-- @param creation_date default now()
-- @param creation_user acs_object param
-- @param creation_ip acs_object param
-- @param context_id acs_object param
--
-- @return The id of the new event.
--
integer, -- acs_events.event_id%TYPE,
varchar, -- acs_events.name%TYPE,
text, -- acs_events.description%TYPE,
boolean, -- acs_events.html_p%TYPE,
text, -- acs_events.status_summary%TYPE,
integer, -- acs_events.timespan_id%TYPE,
integer, -- acs_events.activity_id%TYPE,
integer, -- acs_events.recurrence_id%TYPE,
varchar, -- acs_object_types.object_type%TYPE,
timestamptz, -- acs_objects.creation_date%TYPE,
integer, -- acs_objects.creation_user%TYPE,
varchar, -- acs_objects.creation_ip%TYPE,
integer, -- acs_objects.context_id%TYPE,
integer -- acs_objects.package_id%TYPE,
)
returns integer as ' -- acs_events.event_id%TYPE
declare
new__event_id alias for $1; -- default null,
new__name alias for $2; -- default null,
new__description alias for $3; -- default null,
new__html_p alias for $4; -- default null
new__status_summary alias for $5; -- default null
new__timespan_id alias for $6; -- default null,
new__activity_id alias for $7; -- default null,
new__recurrence_id alias for $8; -- default null,
new__object_type alias for $9; -- default ''acs_event'',
new__creation_date alias for $10; -- default now(),
new__creation_user alias for $11; -- default null,
new__creation_ip alias for $12; -- default null,
new__context_id alias for $13; -- default null
new__package_id alias for $14; -- default null
v_event_id acs_events.event_id%TYPE;
begin
v_event_id := acs_object__new(
new__event_id, -- object_id
new__object_type, -- object_type
new__creation_date, -- creation_date
new__creation_user, -- creation_user
new__creation_ip, -- creation_ip
new__context_id, -- context_id
''t'', -- security_inherit_p
new__name, -- title
new__package_id -- package_id
);
insert into acs_events
(event_id, name, description, html_p, status_summary, activity_id, timespan_id, recurrence_id)
values
(v_event_id, new__name, new__description, new__html_p, new__status_summary, new__activity_id, new__timespan_id,
new__recurrence_id);
return v_event_id;
end;' language 'plpgsql';
create or replace function acs_event__new_instance (
--
-- Create a new instance of an event, with dateoffset from the start_date
-- and end_date of event identified by event_id. Note that dateoffset
-- is an interval, not an integer. This function is used internally by
-- insert_instances. Since this function is internal, there is no need
-- to overload a function that has an integer for the dateoffset.
--
-- @author W. Scott Meeks
--
-- @param event_id Id of event to reference
-- @param date_offset Offset from reference event, in date interval
--
-- @return event_id of new event created.
--
integer, -- acs_events.event_id%TYPE,
interval
)
returns integer as ' -- acs_events.event_id%TYPE
declare
new_instance__event_id alias for $1;
new_instance__date_offset alias for $2;
event_row acs_events%ROWTYPE;
object_row acs_objects%ROWTYPE;
v_event_id acs_events.event_id%TYPE;
v_timespan_id acs_events.timespan_id%TYPE;
begin
-- Get event parameters
select * into event_row
from acs_events
where event_id = new_instance__event_id;
-- Get object parameters
select * into object_row
from acs_objects
where object_id = new_instance__event_id;
-- We allow non-zero offset, so we copy
v_timespan_id := timespan__copy(event_row.timespan_id, new_instance__date_offset);
-- Create a new instance
v_event_id := acs_event__new(
null, -- event_id (default)
event_row.name, -- name
event_row.description, -- description
event_row.html_p, -- html_p
event_row.status_summary, -- status_summary
v_timespan_id, -- timespan_id
event_row.activity_id, -- activity_id
event_row.recurrence_id, -- recurrence_id
''acs_event'', -- object_type (default)
now(), -- creation_date (default)
object_row.creation_user, -- creation_user
object_row.creation_ip, -- creation_ip
object_row.context_id, -- context_id
object_row.package_id -- context_id
);
return v_event_id;
end;' language 'plpgsql';
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment