Commit 434ac311 authored by Frank Bergmann's avatar Frank Bergmann

- OpenACS 5.9 Import

parent 7e568207
-- providing upgrade script for function
-- added
select define_function_args('acs_message__new','message_id,reply_to,sent_date,sender,rfc822_id,title,description,mime_type,text,data,parent_id,context_id,creation_user,creation_ip,object_type,is_live,package_id');
--
-- procedure acs_message__new/17
--
CREATE OR REPLACE FUNCTION acs_message__new(
p_message_id integer, --default null,
p_reply_to integer, --default null,
p_sent_date timestamptz, --default sysdate,
p_sender integer, --default null,
p_rfc822_id varchar, --default null,
p_title varchar, --default null,
p_description varchar, --default null,
p_mime_type varchar, --default 'text/plain',
p_text text, --default null,
p_data integer, --default null,
p_parent_id integer, --default 0,
p_context_id integer,
p_creation_user integer, --default null,
p_creation_ip varchar, --default null,
p_object_type varchar, --default 'acs_message',
p_is_live boolean, --default 't'
p_package_id integer
) RETURNS integer AS $$
DECLARE
p_creation_date timestamptz := current_timestamp; -- alias for $13 --default sysdate,
v_message_id acs_messages.message_id%TYPE;
v_rfc822_id acs_messages.rfc822_id%TYPE;
v_revision_id cr_revisions.revision_id%TYPE;
v_system_url varchar;
v_domain_name varchar;
v_idx integer;
BEGIN
-- generate a message id now so we can get an rfc822 message-id
if p_message_id is null then
select nextval('t_acs_object_id_seq') into v_message_id;
else
v_message_id := p_message_id;
end if;
-- need to make this mandatory also - jg
-- this needs to be fixed up, but Oracle doesn't give us a way
-- to get the FQDN
-- vk: get SystemURL parameter and use it to extract domain name
select apm__get_value(package_id, 'SystemURL') into v_system_url
from apm_packages where package_key='acs-kernel';
v_idx := position('http://' in v_system_url);
v_domain_name := trim (substr(v_system_url, v_idx + 7));
if p_rfc822_id is null then
v_rfc822_id := current_date || '.' || v_message_id || '@' ||
v_domain_name || '.hate';
else
v_rfc822_id := p_rfc822_id;
end if;
v_message_id := content_item__new (
v_rfc822_id, -- name
p_parent_id, -- parent_id
p_message_id, -- item_id
null, -- locale
p_creation_date, -- creation_date
p_creation_user, -- creation_user
p_context_id, -- context_id
p_creation_ip, -- creation_ip
p_object_type, -- item_subtype
'acs_message_revision', -- content_type
null, -- title
null, -- description
'text/plain', -- mime_type
null, -- nls_language
null, -- text
'text', -- storage_type
p_package_id
);
insert into acs_messages
(message_id, reply_to, sent_date, sender, rfc822_id)
values
(v_message_id, p_reply_to, p_sent_date, p_sender, v_rfc822_id);
-- create an initial revision for the new message
v_revision_id := acs_message__edit (
v_message_id, -- message_id
p_title, -- title
p_description, -- description
p_mime_type, -- mime_type
p_text, -- text
p_data, -- data
p_creation_date, -- creation_date
p_creation_user, -- creation_user
p_creation_ip, -- creation_ip
p_is_live -- is_live
);
return v_message_id;
END;
$$ LANGUAGE plpgsql;
select define_function_args('acs_message__delete','message_id');
select define_function_args('acs_message__delete_extlink','extlink_id');
select define_function_args('acs_message__delete_file','file_id');
select define_function_args('acs_message__delete_image','image_id');
select define_function_args('acs_message__edit','message_id,title;null,description;null,mime_type;text/plain,text;null,data;null,creation_date;sysdate,creation_user;null,creation_ip;null,is_live;t');
select define_function_args('acs_message__edit_extlink','extlink_id,url,label;null,description');
select define_function_args('acs_message__edit_file','file_id,title;null,description;null,mime_type;text/plain,data;null,creation_date;sysdate,creation_user;null,creation_ip;null,is_live;t');
select define_function_args('acs_message__edit_image','image_id,title;null,description;null,mime_type;text/plain,data;null,width;null,height;null,creation_date;sysdate,creation_user;null,creation_ip;null,is_live;t');
select define_function_args('acs_message__first_ancestor','message_id');
select define_function_args('acs_message__message_p','message_id');
select define_function_args('acs_message__name','message_id');
select define_function_args('acs_message__new','message_id,reply_to,sent_date,sender,rfc822_id,title,description,mime_type,text,data,parent_id,context_id,creation_user,creation_ip,object_type,is_live,package_id');
select define_function_args('acs_message__new_extlink','name;null,extlink_id;null,url,label;null,description;null,parent_id,creation_date;sysdate,creation_user;null,creation_ip;null,package_id;null');
select define_function_args('acs_message__new_file','message_id,file_id;null,file_name,title;null,description;null,mime_type;text/plain,data;null,creation_date;sysdate,creation_user;null,creation_ip;null,is_live;t,storage_type;file,package_id;null');
select define_function_args('acs_message__new_image','message_id,image_id;null,file_name,title;null,description;null,mime_type;text/plain,data;null,width;null,height;null,creation_date;sysdate,creation_user;null,creation_ip;null,is_live;t,storage_type;file,package_id;null');
select define_function_args('acs_message__send','message_id,recipient_id,grouping_id;null,wait_until;sysdate');
select define_function_args('acs_message_get_tree_sortkey','message_id');
<property name="context">{/doc/acs-messaging {Messaging}} {ACS Messaging Design}</property>
<property name="doc(title)">ACS Messaging Design</property>
<master>
<body>
<h2>ACS Messaging Design</h2>
ACS Messaging was born out of the design of the new bboard. One
thing we discovered when researching requirements for bboard and
discussion software in general was that there are a variety of ways
one may wish to structure and organize threads of messages e.g. in
discrete forums with tagged categories, attached to other user
objects annotated with user ratings, etc.,. Our design addressed
this by separating the store of messages from the organizational
data model and any user interfaces.ACS Messaging is this separate
layer. Built atop the content repository, it provides the storage
and retrieval of messages. We take messages to be objects that
consist of a sender (an ACS party), a text body, an optional
reference to a parent message, optional file attachments, and some
miscellaneous auditing data.With these constraining constraining
set of semantics, we can build a library of component functionality
to operate on messages. For example: code that displays a message,
forwards a message, compiles a set of messages into a digest,
displays a specific attachment, etc., This functionality can then
be reused across messaging applications such as bboard, webmail,
and general comments. We can maintain user preferences on HTML vs.
text email, inline attachments vs. URLs across the system, and have
simple procedures that do the right thing when sending email.
Another example: if we built the IMAP server functionality 3.4
webmail provides against acs-messaging, then bboard forums, pages
of comments, and webmail folders could be viewed uniformly through
your email client. The IMAP mapping isn't quite trivial, but you
can see the idea.To reiterate, if applications are storing the same
sort of data (a text-ish messages with optional attachments and
replies), they should store them the same way. Then code from
particular applications can possibly be refactored into generic
functionality.spam/general alerts/etc isn't meant to be replaced by
ACS Messaging, at least not with what is there currently. Currently
it is just a store; but we intend it to be the canonical store for
messages that need to be stored in the database. If messages are
automatically generated from other user objects, they might need to
be queue'd up or archived in the RDBMS. If so this should be done
in the acs-messaging tables. We can implement the generic incoming
email system by stashing messages in acs-messaging, then
dispatching the message id to package specific code for
processing.Currently (11/2000), ACS Messaging is very slim; it just
supports bboard. We intend to add attachments (most likely
implemented as content repository items that are children of the
message), extensible headers (just like the webmail datamodel), and
versioning as provided by the content repository.
<h2>API</h2>
ACS Messaging provides the <code>acs_messages_all</code> view as
the primary mechanism for message queries.
<blockquote><pre><code>create or replace view acs_messages_all as
select m.message_id, m.reply_to, o.context_id, r.title, r.publish_date,
r.mime_type, r.content, o.creation_user
...
</code></pre></blockquote>
ACS Messaging provides the PL/SQL function acs_message.post to add
new messages.
<hr><address>akk@arsdigita.com</address>
</body>
<property name="context">{/doc/acs-messaging {Messaging}} {ACS Messaging Docs}</property>
<property name="doc(title)">ACS Messaging Docs</property>
<master>
<body>
<h1>ACS Messaging Docs</h1><ul>
<li><a href="requirements">requirements</a></li><li><a href="design">design</a></li>
</ul><hr><address><a href="mailto:akk@arsdigita.com">Anukul
Kapoor</a></address><!-- Created: Sat Sep 30 16:42:40 EDT 2000 --><!-- hhmts start -->
Last modified: Sat Sep 30 17:45:40 EDT 2000 <!-- hhmts end -->
</body>
<property name="context">{/doc/acs-messaging {Messaging}} {ACS Messaging Requirements}</property>
<property name="doc(title)">ACS Messaging Requirements</property>
<master>
<body>
<h1>ACS Messaging Requirements</h1>
by <a href="mailto:akk@arsdigita.com">Anukul Kapoor</a> and
<a href="mailto:akk@arsdigita.com">Pete Su</a><i>This is only a DRAFT</i><h3>I. Introduction</h3><p>In ACS 3.x, each messaging application (e.g. bboard, general
comments, spam, ticket tracker and so on) used its own specialized
data model for representing and manipulating messages. ACS Messages
provides a common data model and API for these applications. The
service provides the following common mechanisms:</p><ul>
<li>A single data model for representing message objects. Message
objects model electronic messages between users of a collaborative
system. Mail messages, USENET news messages, Bboard messages, user
comments are all examples of applications that might use message
objects.</li><li>Storage of message objects.</li><li>Central support for attachments, threading, and search.</li><li>Mechanisms for sending and receiving message objects as
e-mail.</li>
</ul><h3>II. Vision Statement</h3><p>Messaging applications constitute some of the most useful forms
of web collaboration. Many of the application packages that have
been developed for ACS have a messaging component. Therefore, ACS
Messaging provides a standard set of abstractions for storing,
sending and receiving messages through a web service. Our goal is
to support a diverse group of messaging applications through a
single centralized facility.</p><h3>III. System/Application Overview</h3><p>The ACS Messaging package defines a data model and API for the
storage and retrieval of messages. While the package standarizes
how messages are stored, applications may use any data model they
want for higher level organization of messages into threads,
forums, and so on. ACS Messaging places no organizational
constraints on client applications.</p><p>The package consists of the following components:</p><ul>
<li>A data model for representing and storing messages.</li><li>A data model for representing and storing attachments to
messages.</li><li>A mechanism for sending messages as e-mail.</li><li>A mechanism for integrating the message store into site wide
search.</li>
</ul><h3>IV. Use-cases and User Scenarios</h3><p>ACS Messaging is generally not used directly by users, so there
are no user interface level scenarios to consider at this point.
It's possible that in the future we will want to extend the system
with generic administrative user interfaces, but this is not clear
right now.</p><p>We scenarios that we should consider are the kinds of
applications that we mean to support with this package, and what
the developers of those applications would like to see in the data
model and API.</p><p>The following applications in ACS 3.x could have been
implemented using this package:</p><ul>
<li>BBoard</li><li>Webmail</li><li>General Comments</li><li>Spam</li><li>Various parts of the ticket tracker.</li>
</ul><p>Each of these applications requires a message store and each
defines it's own high level organization for messages whithin that
store.</p><ul>
<li>Bboard organizes messages into forums and categories and
threads. It also allows users to send and reply to messages via
e-mail.</li><li>Webmail organizes messages into mail folders.</li><li>General comments attaches messages to objects representing
static or other content.</li><li>Spam queues messages and sends them to groups of people as
e-mail.</li>
</ul><p>The main requirement of the ACS Messages package is to support
this diverse set of applications with a common infrastructure. This
is because all of these applications would like the following kinds
of common functionality:</p><ul>
<li>Reply chaining and threading.</li><li>Messages with attachments of various types.</li><li>Representing messages as multipart MIME e-mail.</li><li>Queuing and sending messages as e-mail.</li>
</ul><h3>V. Related Links</h3><ul><li><a href="design">Design Document</a></li></ul><h3>VI.A Requirements: Datamodel</h3><p><strong>10.0 Message Store</strong></p><p>ACS Messages should provide a single store for objects
representing messages.</p><p><strong>20.0 Message Content</strong></p><p>A message should have a primary content body consisting of a
specified MIME type and a block of storage holding the content. In
addition, applications may store one or more seperate revisions of
a message.</p><p><strong>30.0 Attachments</strong></p><p>Messages may be composed of additional attachments. Each
attachment should be tagged with a MIME type to indicate what type
of data is stored there. Each attachment can only be attached to a
single parent message. In addition, the system must be able to
store one or more revisions of each attachment.</p><p><strong>40.0 Unique ID</strong></p><p>Messages should have universally unique identifiers to allow
global reference and RFC-822 compliance.</p><p><strong>50.0 Sender</strong></p><p>Messages should be related to the sending party.</p><p><strong>60.0 Threading</strong></p><p>The system model simple message threads, that is chains of
messages that are replies to each other. If message M is a reply to
some other message N, then M should be able to refer to N in a
straightforward way.</p><p><strong>70.0 Search</strong></p><p>Messages should be searchable as part of a site wide search.
Therefore, the data model must integrate with the data model for
site wide search.</p><h3>VI.B Requirements: API</h3><p><strong>80.0 Messages</strong></p><p>The system should provide the following interfaces for
manipulating messages:</p><blockquote>
<p><strong>80.10 Creation</strong></p><p>Applications should be able to create new messages objects.</p><p><strong>80.20 Revisions</strong></p><p>Applications should be able to create a new revision of a given
message object.</p><p><strong>80.30 Deletion</strong></p><p>Applications should be able to delete a message and all of its
revisions and attachments. (is this true?).</p><p>
<strong>80.40 Type Checking</strong> Applications should be able
to check whether or not a given object is a message.</p>
</blockquote><p><strong>90.0 Message Attachments</strong></p><p>The system should provide the following interfaces for
manipulating message attachments.</p><blockquote>
<p><strong>90.10 Creation</strong></p><p>Applications should be able to create new message attachments
and connect to their parent object.</p><p><strong>90.20 Revisions</strong></p><p>Applications should be able to create a new revision of a given
attachment.</p><p><strong>90.30 MIME Types</strong></p><p>Each attachment should have a MIME type. The system should be
able in principle to deal with an arbitrary collection of MIME
types, although initial implementations may be more limited.</p>
</blockquote><p><strong>100.0 Messages and E-Mail</strong></p><p>The system should provide the following interfaces for
integrating with existing E-mail systems. Note that these
requirements only deal with <i>sending</i> mail. Our feeling that a
seperate package should be implemented to deal with
<i>receiving</i> mail that would use ACS Messages for storage of
incoming messages.</p><blockquote>
<p><strong>100.10 Sending Single Messages</strong></p><p>The system should provide a mechanism for specifying that a
message should be sent as outgoing E-mail. Outgoing messages should
be queued so that the system can maintain auditing information to
deal with transport failures and so on.</p><p><strong>100.20 Sending MIME Messages</strong></p><p>The system should be able to send messages with attachments as
multipart MIME messages.</p><p><strong>100.30 Sending Digests</strong></p><p>The system should be able to group multiple messages together as
a single e-mail digest. For example, all the messages in a single
bboard thread could be sent to a user as a digest.</p>
</blockquote><h3>VII. Revision History</h3><table cellpadding="2" cellspacing="2" width="90%" bgcolor="#EFEFEF">
<tr bgcolor="#E0E0E0">
<th width="10%">Document Revision #</th><th width="50%">Action Taken, Notes</th><th>When?</th><th>By Whom?</th>
</tr><tr>
<td>0.1</td><td>Creation</td><td>10/04/2000</td><td>Anukul Kapoor</td>
</tr><tr>
<td>0.2</td><td>Edited and extended for more general data model</td><td>11/07/2000</td><td>Pete Su</td>
</tr>
</table><hr><address><a href="mailto:kapoor@maya.com"></a></address>
Last modified: $Id: requirements.html,v 1.1.1.1 2001/03/13 22:59:26
ben Exp $
</body>
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