Index: openacs-4/packages/notifications/sql/postgresql/delivery-method-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/Attic/delivery-method-sc-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/delivery-method-sc-create.sql 29 Jun 2002 01:27:50 -0000 1.1 @@ -0,0 +1,69 @@ + +-- +-- The Notifications Package +-- +-- @author Ben Adida (ben@openforce.net) +-- @version $Id: delivery-method-sc-create.sql,v 1.1 2002/06/29 01:27:50 ben Exp $ +-- +-- Copyright OpenForce, 2002. +-- +-- GNU GPL v2 +-- + +-- +-- The service contract for defining a delivery method +-- + +create function inline_1() +returns integer as ' +DECLARE +BEGIN + PERFORM acs_sc_contract__new ( + ''NotificationDeliveryMethod'', + ''Notification Delivery Method'' + ); + + PEROFRM acs_sc_msg_type__new ( + ''NotificationDeliveryMethod.Send.InputType'', + ''to_user_id:integer,reply_object_id:integer,notification_type_id:integer,subject:string,content:string'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationDeliveryMethod.Send.OutputType'', + '''' + ); + + PERFORM acs_sc_operation__new ( + ''NotificationDeliveryMethod'', + ''Send'', + ''send a notification'', + ''f'', + 5, + ''NotificationDeliveryMethod.Send.InputType'', + ''NotificationDeliveryMethod.Send.OutputType'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationDeliveryMethod.ScanReplies.InputType'', + '''' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationDeliveryMethod.ScanReplies.OutputType'', + '''' + ); + + PERFORM acs_sc_operation__new ( + ''NotificationDeliveryMethod'', + ''ScanReplies'', + ''scan for replies'', + ''f'', + 0, + ''NotificationDeliveryMethod.ScanReplies.InputType'', + ''NotificationDeliveryMethod.ScanReplies.OutputType'' + ); + + return(0); + +end; +' language 'plpgsql'; Index: openacs-4/packages/notifications/sql/postgresql/notification-type-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/Attic/notification-type-sc-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notification-type-sc-create.sql 29 Jun 2002 01:27:50 -0000 1.1 @@ -0,0 +1,73 @@ + +-- +-- The Notifications Package +-- +-- @author Ben Adida (ben@openforce.net) +-- @version $Id: notification-type-sc-create.sql,v 1.1 2002/06/29 01:27:50 ben Exp $ +-- +-- Copyright OpenForce, 2002. +-- +-- GNU GPL v2 +-- + +-- +-- The service contract for a notification type +-- + +create function inline_1() +returns integer as ' +DECLARE +BEGIN + PERFORM acs_sc_contract__new ( + ''NotificationType'', + ''Notification Type'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationType.GetURL.InputType'', + ''object_id:integer'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationType.GetURL.OutputType'', + ''url:string'' + ); + + PERFORM acs_sc_operation__new ( + ''NotificationType'', + ''GetURL'', + ''gets the URL for an object in this notification type'', + ''f'', + 1, + ''NotificationType.GetURL.InputType'', + ''NotificationType.GetURL.OutputType'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationType.ProcessReply.InputType'', + ''reply_id:integer'' + ); + + PERFORM acs_sc_msg_type__new ( + ''NotificationType.ProcessReply.OutputType'', + ''success_p:boolean'' + ); + + PERFORM acs_sc_operation__new ( + ''NotificationType'', + ''ProcessReply'', + ''Process a single reply'', + ''f'', + 1, + ''NotificationType.ProcessReply.InputType'', + ''NotificationType.ProcessReply.OutputType'' + ); + + return (0); + +END; +' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); + Index: openacs-4/packages/notifications/sql/postgresql/notifications-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 12 Jun 2002 13:53:13 -0000 1.2 +++ openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 29 Jun 2002 01:27:50 -0000 1.3 @@ -10,8 +10,18 @@ \i notifications-core-create.sql \i notifications-package-create.sql +-- replies +\i notifications-replies-create.sql +\i notifications-replies-package-create.sql + -- the service contracts will eventually be created -- @ notifications-interval-sc-create.sql -- @ notifications-delivery-sc-create.sql +\i notification-type-sc-create.sql + +-- WORK HERE!! (ben) + +\i delivery-method-sc-create.sql \i notifications-init.sql +\i email-sc-impl-create.sql Index: openacs-4/packages/notifications/sql/postgresql/notifications-replies-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-replies-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notifications-replies-create.sql 29 Jun 2002 01:27:50 -0000 1.1 @@ -0,0 +1,42 @@ + +-- +-- The Notifications Package +-- +-- ben@openforce.net +-- Copyright OpenForce, 2002. +-- +-- GNU GPL v2 +-- + +-- +-- The queue of messages coming back +-- + +create table notification_replies ( + reply_id integer not null + constraint notif_repl_repl_id_fk references acs_objects(object_id) + constraint notif_repl_repl_id_pk primary key, + object_id integer not null + constraint notif_repl_obj_id_fk references acs_objects(object_id), + type_id integer not null + constraint notif_repl_type_id_fk references notification_types(type_id), + from_user integer not null + constraint notif_repl_from_fk references users(user_id), + subject varchar(100), + content text, + reply_date timestamp +); + + +select acs_object_type__create_type ( + 'notification_reply', + 'Notification Reply', + 'Notification Replies', + 'acs_object', + 'notification_replies', + 'reply_id', + 'notification_reply', + 'f', + NULL, + NULL +); Index: openacs-4/packages/notifications/sql/postgresql/notifications-replies-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-replies-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notifications-replies-package-create.sql 29 Jun 2002 01:27:50 -0000 1.1 @@ -0,0 +1,62 @@ + +-- +-- The Notifications Package +-- +-- ben@openforce.net +-- Copyright OpenForce, 2002. +-- +-- GNU GPL v2 +-- + + +-- The Notification Replies Package + +select define_function_args ('notification_reply__new','reply_id,object_id,type_id,from_user,subject,content,reply_date,creation_date,creation_user,creation_ip,context_id'); + +select define_function_args ('notification_reply__delete','reply_id'); + + +create function notification_reply__new (integer,integer,integer,integer,varchar,text,timestamp,timestamp,integer,varchar,integer) +returns integer as ' +DECLARE + p_reply_id alias for $1; + p_object_id alias for $2; + p_type_id alias for $3; + p_from_user alias for $4; + p_subject alias for $5; + p_content alias for $6; + p_reply_date alias for $7; + p_creation_date alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + p_context_id alias for $11; + v_reply_id integer; +BEGIN + v_reply_id:= acs_object__new ( + p_reply_id, + ''notification_reply'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + insert into notification_replies + (reply_id, object_id, type_id, from_user, subject, content, reply_date) + values + (v_reply_id, object_id, type_id, from_user, subject, content, reply_date); + + return v_reply_id; +END; +' language 'plpgsql'; + + +create function notification_reply__delete(integer) +returns integer as ' +DECLARE + p_reply_id alias for $1; +BEGIN + perform acs_object__delete(p_reply_id); + return (0); +END; +' language 'plpgsql';